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