@budibase/bbui 1.0.80 → 1.0.81-alpha.0
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.es.js +209 -1
- package/dist/bbui.es.js.map +1 -1
- package/package.json +3 -2
- package/src/Button/Button.svelte +1 -0
- package/src/ColorPicker/ColorPicker.svelte +5 -0
- package/src/Drawer/Drawer.svelte +27 -2
- package/src/Form/Core/Checkbox.svelte +3 -1
- package/src/Modal/Modal.svelte +33 -24
- package/src/Modal/ModalContent.svelte +4 -0
- package/src/Table/AttachmentRenderer.svelte +10 -5
- package/src/Table/BoldRenderer.svelte +4 -0
- package/src/Table/CellRenderer.svelte +28 -4
- package/src/Table/CodeRenderer.svelte +9 -0
- package/src/Table/DateTimeRenderer.svelte +3 -1
- package/src/Table/InternalRenderer.svelte +0 -8
- package/src/Table/SelectEditRenderer.svelte +18 -6
- package/src/Table/StringRenderer.svelte +2 -1
- package/src/Table/Table.svelte +361 -273
- package/src/helpers.js +8 -0
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": "1.0.
|
|
4
|
+
"version": "1.0.81-alpha.0",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
|
41
|
+
"@budibase/string-templates": "^1.0.81-alpha.0",
|
|
41
42
|
"@spectrum-css/actionbutton": "^1.0.1",
|
|
42
43
|
"@spectrum-css/actiongroup": "^1.0.1",
|
|
43
44
|
"@spectrum-css/avatar": "^3.0.2",
|
|
@@ -83,5 +84,5 @@
|
|
|
83
84
|
"svelte-flatpickr": "^3.2.3",
|
|
84
85
|
"svelte-portal": "^1.0.0"
|
|
85
86
|
},
|
|
86
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "0dc36960962fee96dd20d9f683d4fec9572501c4"
|
|
87
88
|
}
|
package/src/Button/Button.svelte
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
export let value
|
|
11
11
|
export let size = "M"
|
|
12
12
|
export let spectrumTheme
|
|
13
|
+
export let alignRight = false
|
|
13
14
|
|
|
14
15
|
let open = false
|
|
15
16
|
|
|
@@ -133,6 +134,7 @@
|
|
|
133
134
|
use:clickOutside={() => (open = false)}
|
|
134
135
|
transition:fly={{ y: -20, duration: 200 }}
|
|
135
136
|
class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
|
|
137
|
+
class:spectrum-Popover--align-right={alignRight}
|
|
136
138
|
>
|
|
137
139
|
{#each categories as category}
|
|
138
140
|
<div class="category">
|
|
@@ -250,6 +252,9 @@
|
|
|
250
252
|
align-items: stretch;
|
|
251
253
|
gap: var(--spacing-xl);
|
|
252
254
|
}
|
|
255
|
+
.spectrum-Popover--align-right {
|
|
256
|
+
right: 0;
|
|
257
|
+
}
|
|
253
258
|
.colors {
|
|
254
259
|
display: grid;
|
|
255
260
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
|
package/src/Drawer/Drawer.svelte
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { slide } from "svelte/transition"
|
|
3
2
|
import Portal from "svelte-portal"
|
|
4
3
|
import Button from "../Button/Button.svelte"
|
|
5
4
|
import Body from "../Typography/Body.svelte"
|
|
@@ -7,7 +6,9 @@
|
|
|
7
6
|
|
|
8
7
|
export let title
|
|
9
8
|
export let fillWidth
|
|
9
|
+
|
|
10
10
|
let visible = false
|
|
11
|
+
|
|
11
12
|
export function show() {
|
|
12
13
|
if (visible) {
|
|
13
14
|
return
|
|
@@ -21,11 +22,27 @@
|
|
|
21
22
|
}
|
|
22
23
|
visible = false
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
const easeInOutQuad = x => {
|
|
27
|
+
return x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Use a custom svelte transition here because the built-in slide
|
|
31
|
+
// transition has a horrible overshoot
|
|
32
|
+
const slide = () => {
|
|
33
|
+
return {
|
|
34
|
+
duration: 360,
|
|
35
|
+
css: t => {
|
|
36
|
+
const translation = 100 - Math.round(easeInOutQuad(t) * 100)
|
|
37
|
+
return `transform: translateY(${translation}%);`
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
}
|
|
24
41
|
</script>
|
|
25
42
|
|
|
26
43
|
{#if visible}
|
|
27
44
|
<Portal>
|
|
28
|
-
<section class:fillWidth class="drawer" transition:slide>
|
|
45
|
+
<section class:fillWidth class="drawer" transition:slide|local>
|
|
29
46
|
<header>
|
|
30
47
|
<div class="text">
|
|
31
48
|
<Heading size="XS">{title}</Heading>
|
|
@@ -79,4 +96,12 @@
|
|
|
79
96
|
align-items: flex-start;
|
|
80
97
|
gap: var(--spacing-xs);
|
|
81
98
|
}
|
|
99
|
+
|
|
100
|
+
.buttons {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
justify-content: flex-start;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: var(--spacing-m);
|
|
106
|
+
}
|
|
82
107
|
</style>
|
package/src/Modal/Modal.svelte
CHANGED
|
@@ -54,34 +54,43 @@
|
|
|
54
54
|
|
|
55
55
|
<svelte:window on:keydown={handleKey} />
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{:else
|
|
57
|
+
{#if inline}
|
|
58
|
+
{#if visible}
|
|
59
|
+
<div use:focusFirstInput class="spectrum-Modal inline is-open">
|
|
60
|
+
<slot />
|
|
61
|
+
</div>
|
|
62
|
+
{/if}
|
|
63
|
+
{:else}
|
|
64
|
+
<!--
|
|
65
|
+
We cannot conditionally render the portal as this leads to a missing
|
|
66
|
+
insertion point when using nested modals. Therefore we just conditionally
|
|
67
|
+
render the content of the portal.
|
|
68
|
+
It still breaks the modal animation, but its better than soft bricking the
|
|
69
|
+
screen.
|
|
70
|
+
-->
|
|
64
71
|
<Portal target=".modal-container">
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<div class="modal-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
{#if visible}
|
|
73
|
+
<div
|
|
74
|
+
class="spectrum-Underlay is-open"
|
|
75
|
+
in:fade={{ duration: 200 }}
|
|
76
|
+
out:fade|local={{ duration: 200 }}
|
|
77
|
+
on:mousedown|self={cancel}
|
|
78
|
+
>
|
|
79
|
+
<div class="modal-wrapper" on:mousedown|self={cancel}>
|
|
80
|
+
<div class="modal-inner-wrapper" on:mousedown|self={cancel}>
|
|
81
|
+
<slot name="outside" />
|
|
82
|
+
<div
|
|
83
|
+
use:focusFirstInput
|
|
84
|
+
class="spectrum-Modal is-open"
|
|
85
|
+
in:fly={{ y: 30, duration: 200 }}
|
|
86
|
+
out:fly|local={{ y: 30, duration: 200 }}
|
|
87
|
+
>
|
|
88
|
+
<slot />
|
|
89
|
+
</div>
|
|
81
90
|
</div>
|
|
82
91
|
</div>
|
|
83
92
|
</div>
|
|
84
|
-
|
|
93
|
+
{/if}
|
|
85
94
|
</Portal>
|
|
86
95
|
{/if}
|
|
87
96
|
|
|
@@ -17,14 +17,16 @@
|
|
|
17
17
|
{#each attachments as attachment}
|
|
18
18
|
{#if isImage(attachment.extension)}
|
|
19
19
|
<Link quiet target="_blank" href={attachment.url}>
|
|
20
|
-
<
|
|
20
|
+
<div class="center">
|
|
21
|
+
<img src={attachment.url} alt={attachment.extension} />
|
|
22
|
+
</div>
|
|
21
23
|
</Link>
|
|
22
24
|
{:else}
|
|
23
25
|
<Tooltip text={attachment.name} direction="right">
|
|
24
26
|
<div class="file">
|
|
25
|
-
<Link quiet target="_blank" href={attachment.url}
|
|
26
|
-
|
|
27
|
-
>
|
|
27
|
+
<Link quiet target="_blank" href={attachment.url}>
|
|
28
|
+
{attachment.extension}
|
|
29
|
+
</Link>
|
|
28
30
|
</div>
|
|
29
31
|
</Tooltip>
|
|
30
32
|
{/if}
|
|
@@ -38,12 +40,15 @@
|
|
|
38
40
|
height: 32px;
|
|
39
41
|
max-width: 64px;
|
|
40
42
|
}
|
|
43
|
+
.center,
|
|
41
44
|
.file {
|
|
42
|
-
height: 32px;
|
|
43
45
|
display: flex;
|
|
44
46
|
flex-direction: row;
|
|
45
47
|
justify-content: flex-start;
|
|
46
48
|
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
.file {
|
|
51
|
+
height: 32px;
|
|
47
52
|
padding: 0 8px;
|
|
48
53
|
color: var(--spectrum-global-color-gray-800);
|
|
49
54
|
border: 1px solid var(--spectrum-global-color-gray-300);
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import AttachmentRenderer from "./AttachmentRenderer.svelte"
|
|
7
7
|
import ArrayRenderer from "./ArrayRenderer.svelte"
|
|
8
8
|
import InternalRenderer from "./InternalRenderer.svelte"
|
|
9
|
+
import { processStringSync } from "@budibase/string-templates"
|
|
9
10
|
|
|
10
11
|
export let row
|
|
11
12
|
export let schema
|
|
@@ -28,10 +29,33 @@
|
|
|
28
29
|
$: type = schema?.type ?? "string"
|
|
29
30
|
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
|
|
30
31
|
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
|
|
32
|
+
$: width = schema?.width || "150px"
|
|
33
|
+
$: cellValue = getCellValue(value, schema.template)
|
|
34
|
+
|
|
35
|
+
const getCellValue = (value, template) => {
|
|
36
|
+
if (!template) {
|
|
37
|
+
return value
|
|
38
|
+
}
|
|
39
|
+
return processStringSync(template, { value })
|
|
40
|
+
}
|
|
31
41
|
</script>
|
|
32
42
|
|
|
33
|
-
{#if renderer && (customRenderer || (
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
|
|
43
|
+
{#if renderer && (customRenderer || (cellValue != null && cellValue !== ""))}
|
|
44
|
+
<div style="--max-cell-width: {schema.width ? 'none' : '200px'};">
|
|
45
|
+
<svelte:component
|
|
46
|
+
this={renderer}
|
|
47
|
+
{row}
|
|
48
|
+
{schema}
|
|
49
|
+
value={cellValue}
|
|
50
|
+
on:clickrelationship
|
|
51
|
+
>
|
|
52
|
+
<slot />
|
|
53
|
+
</svelte:component>
|
|
54
|
+
</div>
|
|
37
55
|
{/if}
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
div {
|
|
59
|
+
display: contents;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -8,9 +8,21 @@
|
|
|
8
8
|
export let allowEditRows = false
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
{
|
|
11
|
+
<div>
|
|
12
|
+
{#if allowSelectRows}
|
|
13
|
+
<Checkbox value={selected} />
|
|
14
|
+
{/if}
|
|
15
|
+
{#if allowEditRows}
|
|
16
|
+
<ActionButton size="S" on:click={onEdit}>Edit</ActionButton>
|
|
17
|
+
{/if}
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
div {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--spacing-m);
|
|
27
|
+
}
|
|
28
|
+
</style>
|