@budibase/bbui 3.32.4 → 3.32.6
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 +2 -2
- package/dist/{easymde-Dl_6LGvM.mjs → easymde-DO-8qhvb.mjs} +1 -1
- package/dist/{index-BK7N9do-.mjs → index-he4Pe7Wm.mjs} +1165 -1098
- package/package.json +2 -2
- package/src/Table/Table.svelte +75 -13
- package/src/bbui.css +73 -0
- package/src/helpers.ts +1 -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": "3.32.
|
|
4
|
+
"version": "3.32.6",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"module": "dist/bbui.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "f499dd1b20467f2fec0926d001b343d91ebdea96"
|
|
111
111
|
}
|
package/src/Table/Table.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script lang="ts" generics="O extends Record<string, any>">
|
|
2
2
|
import "@spectrum-css/table/dist/index-vars.css"
|
|
3
3
|
import { createEventDispatcher, onMount } from "svelte"
|
|
4
4
|
import Checkbox from "../Form/Checkbox.svelte"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* borderLeft: show a left border
|
|
27
27
|
* borderRight: show a right border
|
|
28
28
|
*/
|
|
29
|
-
export let data:
|
|
29
|
+
export let data: O[] = []
|
|
30
30
|
export let schema: Record<string, any> = {}
|
|
31
31
|
export let showAutoColumns: boolean = false
|
|
32
32
|
export let rowCount: number = 0
|
|
@@ -51,8 +51,14 @@
|
|
|
51
51
|
export let defaultSortOrder: "Ascending" | "Descending" = "Ascending"
|
|
52
52
|
export let rounded: boolean = false
|
|
53
53
|
export let stickyHeader: boolean = true
|
|
54
|
+
export let editColumnPosition: "left" | "right" = "left"
|
|
54
55
|
|
|
55
|
-
const dispatch = createEventDispatcher
|
|
56
|
+
const dispatch = createEventDispatcher<{
|
|
57
|
+
click: O
|
|
58
|
+
sort: { column: typeof sortColumn; order: typeof sortOrder }
|
|
59
|
+
editcolumn: string
|
|
60
|
+
editrow: O
|
|
61
|
+
}>()
|
|
56
62
|
|
|
57
63
|
let ref: HTMLDivElement
|
|
58
64
|
|
|
@@ -91,7 +97,12 @@
|
|
|
91
97
|
effectiveHeaderHeight
|
|
92
98
|
)
|
|
93
99
|
$: sortedRows = sortRows(rows, sortColumn, sortOrder)
|
|
94
|
-
$: gridStyle = getGridStyle(
|
|
100
|
+
$: gridStyle = getGridStyle(
|
|
101
|
+
fields,
|
|
102
|
+
schema,
|
|
103
|
+
showEditColumn,
|
|
104
|
+
editColumnPosition
|
|
105
|
+
)
|
|
95
106
|
$: showEditColumn = allowEditRows || allowSelectRows
|
|
96
107
|
$: cellStyles = computeCellStyles(schema)
|
|
97
108
|
|
|
@@ -166,10 +177,11 @@
|
|
|
166
177
|
const getGridStyle = (
|
|
167
178
|
fields: string[],
|
|
168
179
|
schema: Record<string, any>,
|
|
169
|
-
showEditColumn: boolean
|
|
180
|
+
showEditColumn: boolean,
|
|
181
|
+
editColumnPosition: "left" | "right"
|
|
170
182
|
): string => {
|
|
171
183
|
let style = "grid-template-columns:"
|
|
172
|
-
if (showEditColumn) {
|
|
184
|
+
if (showEditColumn && editColumnPosition === "left") {
|
|
173
185
|
style += " auto"
|
|
174
186
|
}
|
|
175
187
|
fields?.forEach(field => {
|
|
@@ -180,6 +192,9 @@
|
|
|
180
192
|
style += " minmax(auto, 1fr)"
|
|
181
193
|
}
|
|
182
194
|
})
|
|
195
|
+
if (showEditColumn && editColumnPosition === "right") {
|
|
196
|
+
style += " auto"
|
|
197
|
+
}
|
|
183
198
|
style += ";"
|
|
184
199
|
return style
|
|
185
200
|
}
|
|
@@ -394,10 +409,10 @@
|
|
|
394
409
|
>
|
|
395
410
|
{#if fields.length && !hideHeader}
|
|
396
411
|
<div class="spectrum-Table-head">
|
|
397
|
-
{#if showEditColumn}
|
|
412
|
+
{#if showEditColumn && editColumnPosition === "left"}
|
|
398
413
|
<div
|
|
399
414
|
class:noBorderHeader={!showHeaderBorder}
|
|
400
|
-
class="spectrum-Table-headCell spectrum-Table-headCell--divider spectrum-Table-headCell--edit"
|
|
415
|
+
class="spectrum-Table-headCell spectrum-Table-headCell--divider spectrum-Table-headCell--edit spectrum-Table-headCell--editLeft"
|
|
401
416
|
>
|
|
402
417
|
{#if allowSelectRows}
|
|
403
418
|
<Checkbox
|
|
@@ -453,15 +468,30 @@
|
|
|
453
468
|
</div>
|
|
454
469
|
</div>
|
|
455
470
|
{/each}
|
|
471
|
+
{#if showEditColumn && editColumnPosition === "right"}
|
|
472
|
+
<div
|
|
473
|
+
class:noBorderHeader={!showHeaderBorder}
|
|
474
|
+
class="spectrum-Table-headCell spectrum-Table-headCell--divider spectrum-Table-headCell--edit spectrum-Table-headCell--editRight"
|
|
475
|
+
>
|
|
476
|
+
{#if allowSelectRows}
|
|
477
|
+
<Checkbox
|
|
478
|
+
bind:value={checkboxStatus}
|
|
479
|
+
on:change={toggleSelectAll}
|
|
480
|
+
/>
|
|
481
|
+
{:else}
|
|
482
|
+
Edit
|
|
483
|
+
{/if}
|
|
484
|
+
</div>
|
|
485
|
+
{/if}
|
|
456
486
|
</div>
|
|
457
487
|
{/if}
|
|
458
488
|
{#if sortedRows?.length}
|
|
459
489
|
{#each sortedRows as row}
|
|
460
490
|
<div class="spectrum-Table-row" class:clickable={allowClickRows}>
|
|
461
|
-
{#if showEditColumn}
|
|
491
|
+
{#if showEditColumn && editColumnPosition === "left"}
|
|
462
492
|
<div
|
|
463
493
|
class:noBorderCheckbox={!showHeaderBorder}
|
|
464
|
-
class="spectrum-Table-cell spectrum-Table-cell--divider spectrum-Table-cell--edit"
|
|
494
|
+
class="spectrum-Table-cell spectrum-Table-cell--divider spectrum-Table-cell--edit spectrum-Table-cell--editLeft"
|
|
465
495
|
on:click={e => {
|
|
466
496
|
if (row.__selectable === false) {
|
|
467
497
|
return
|
|
@@ -508,6 +538,29 @@
|
|
|
508
538
|
</CellRenderer>
|
|
509
539
|
</div>
|
|
510
540
|
{/each}
|
|
541
|
+
{#if showEditColumn && editColumnPosition === "right"}
|
|
542
|
+
<div
|
|
543
|
+
class:noBorderCheckbox={!showHeaderBorder}
|
|
544
|
+
class="spectrum-Table-cell spectrum-Table-cell--divider spectrum-Table-cell--edit spectrum-Table-cell--editRight"
|
|
545
|
+
on:click={e => {
|
|
546
|
+
if (row.__selectable === false) {
|
|
547
|
+
return
|
|
548
|
+
}
|
|
549
|
+
toggleSelectRow(row)
|
|
550
|
+
e.stopPropagation()
|
|
551
|
+
}}
|
|
552
|
+
>
|
|
553
|
+
<SelectEditRenderer
|
|
554
|
+
data={row}
|
|
555
|
+
selected={selectedRows.some(
|
|
556
|
+
selectedRow => selectedRow._id === row._id
|
|
557
|
+
)}
|
|
558
|
+
onEdit={e => editRow(e, row)}
|
|
559
|
+
{allowSelectRows}
|
|
560
|
+
{allowEditRows}
|
|
561
|
+
/>
|
|
562
|
+
</div>
|
|
563
|
+
{/if}
|
|
511
564
|
</div>
|
|
512
565
|
{/each}
|
|
513
566
|
{:else}
|
|
@@ -585,6 +638,10 @@
|
|
|
585
638
|
/* adding 1px to compensate for lack of right border in header */
|
|
586
639
|
padding-right: calc(var(--cell-padding) / 1.33 + 1px);
|
|
587
640
|
}
|
|
641
|
+
.spectrum-Table-head > .spectrum-Table-headCell--edit:last-child {
|
|
642
|
+
padding-left: calc(var(--cell-padding) / 1.33);
|
|
643
|
+
padding-right: calc(var(--cell-padding) / 1.33);
|
|
644
|
+
}
|
|
588
645
|
.spectrum-Table-head > :last-child {
|
|
589
646
|
border-right: 1px solid transparent;
|
|
590
647
|
padding-right: var(--cell-padding);
|
|
@@ -640,7 +697,7 @@
|
|
|
640
697
|
position: sticky;
|
|
641
698
|
top: 0;
|
|
642
699
|
}
|
|
643
|
-
.wrapper--sticky-header .spectrum-Table-headCell--
|
|
700
|
+
.wrapper--sticky-header .spectrum-Table-headCell--editLeft {
|
|
644
701
|
position: sticky;
|
|
645
702
|
left: 0;
|
|
646
703
|
}
|
|
@@ -679,6 +736,9 @@
|
|
|
679
736
|
.spectrum-Table-row > .spectrum-Table-cell--edit:first-child {
|
|
680
737
|
padding-left: calc(var(--cell-padding) / 1.33);
|
|
681
738
|
}
|
|
739
|
+
.spectrum-Table-row > .spectrum-Table-cell--edit:last-child {
|
|
740
|
+
padding-right: calc(var(--cell-padding) / 1.33);
|
|
741
|
+
}
|
|
682
742
|
.spectrum-Table-row > :last-child {
|
|
683
743
|
border-right: var(--table-border);
|
|
684
744
|
padding-right: var(--cell-padding);
|
|
@@ -705,13 +765,15 @@
|
|
|
705
765
|
transition: background-color 130ms ease-out;
|
|
706
766
|
}
|
|
707
767
|
.spectrum-Table-cell--edit {
|
|
708
|
-
position: sticky;
|
|
709
|
-
left: 0;
|
|
710
768
|
z-index: 2;
|
|
711
769
|
justify-content: center;
|
|
712
770
|
padding-left: calc(var(--cell-padding) / 1.33);
|
|
713
771
|
padding-right: calc(var(--cell-padding) / 1.33);
|
|
714
772
|
}
|
|
773
|
+
.spectrum-Table-cell--editLeft {
|
|
774
|
+
position: sticky;
|
|
775
|
+
left: 0;
|
|
776
|
+
}
|
|
715
777
|
|
|
716
778
|
/* Placeholder */
|
|
717
779
|
.placeholder {
|
package/src/bbui.css
CHANGED
|
@@ -14,6 +14,79 @@
|
|
|
14
14
|
--bb-blue: #6a9bcc;
|
|
15
15
|
--bb-green: #788c5d;
|
|
16
16
|
|
|
17
|
+
/* temporary colours for Joe testing */
|
|
18
|
+
/* Brand */
|
|
19
|
+
--color-brand-100: #e9f0ff;
|
|
20
|
+
--color-brand-200: #d3e0ff;
|
|
21
|
+
--color-brand-300: #afc7ff;
|
|
22
|
+
--color-brand-400: #7fa6ff;
|
|
23
|
+
--color-brand-500: #386cf4;
|
|
24
|
+
--color-brand-600: #2660f3;
|
|
25
|
+
--color-brand-700: #1e4fd4;
|
|
26
|
+
--color-brand-800: #173ea8;
|
|
27
|
+
--color-brand-900: #112d7a;
|
|
28
|
+
--color-brand-950: #091841;
|
|
29
|
+
|
|
30
|
+
/* Blue */
|
|
31
|
+
--color-blue-100: #eaf2f9;
|
|
32
|
+
--color-blue-200: #c3daea;
|
|
33
|
+
--color-blue-300: #89b5e2;
|
|
34
|
+
--color-blue-400: #6a9bcc;
|
|
35
|
+
--color-blue-500: #467db4;
|
|
36
|
+
--color-blue-600: #215f9e;
|
|
37
|
+
--color-blue-700: #1b436a;
|
|
38
|
+
--color-blue-800: #13324f;
|
|
39
|
+
--color-blue-900: #0c2236;
|
|
40
|
+
--color-blue-950: #0c2236;
|
|
41
|
+
|
|
42
|
+
/* Clay / Orange */
|
|
43
|
+
--color-orange-100: #f6e6da;
|
|
44
|
+
--color-orange-200: #ecd3c2;
|
|
45
|
+
--color-orange-300: #ddb99a;
|
|
46
|
+
--color-orange-400: #d4a27f;
|
|
47
|
+
--color-orange-500: #d97757;
|
|
48
|
+
--color-orange-600: #c86240;
|
|
49
|
+
--color-orange-700: #aa4321;
|
|
50
|
+
--color-orange-800: #7f3118;
|
|
51
|
+
--color-orange-900: #4a1d0e;
|
|
52
|
+
--color-orange-950: #301208;
|
|
53
|
+
|
|
54
|
+
/* Grass / Green */
|
|
55
|
+
--color-green-100: #eef3e9;
|
|
56
|
+
--color-green-200: #d2ddc3;
|
|
57
|
+
--color-green-300: #b6c7a8;
|
|
58
|
+
--color-green-400: #9fb88a;
|
|
59
|
+
--color-green-500: #8ca171;
|
|
60
|
+
--color-green-600: #788c5d;
|
|
61
|
+
--color-green-700: #4c622f;
|
|
62
|
+
--color-green-800: #35461f;
|
|
63
|
+
--color-green-900: #1f2a12;
|
|
64
|
+
--color-green-950: #141b0c;
|
|
65
|
+
|
|
66
|
+
/* Lavender / Purple */
|
|
67
|
+
--color-purple-100: #f1eefb;
|
|
68
|
+
--color-purple-200: #d2ccef;
|
|
69
|
+
--color-purple-300: #bdb0f5;
|
|
70
|
+
--color-purple-400: #a292e3;
|
|
71
|
+
--color-purple-500: #8777d1;
|
|
72
|
+
--color-purple-600: #585392;
|
|
73
|
+
--color-purple-700: #363174;
|
|
74
|
+
--color-purple-800: #252154;
|
|
75
|
+
--color-purple-900: #171336;
|
|
76
|
+
--color-purple-950: #110e27;
|
|
77
|
+
|
|
78
|
+
/* Reds */
|
|
79
|
+
--color-red-100: #f4e7e4;
|
|
80
|
+
--color-red-200: #e9c8c3;
|
|
81
|
+
--color-red-300: #d9a29a;
|
|
82
|
+
--color-red-400: #c87c72;
|
|
83
|
+
--color-red-500: #b4564b;
|
|
84
|
+
--color-red-600: #9c3f36;
|
|
85
|
+
--color-red-700: #7e2c24;
|
|
86
|
+
--color-red-800: #5a1e19;
|
|
87
|
+
--color-red-900: #361210;
|
|
88
|
+
--color-red-950: #220b0a;
|
|
89
|
+
|
|
17
90
|
/* Custom spectrum additions */
|
|
18
91
|
--spectrum-global-color-static-red-1200: #740000;
|
|
19
92
|
--spectrum-global-color-static-orange-1200: #612300;
|
package/src/helpers.ts
CHANGED
|
@@ -1216,6 +1216,7 @@ export const SpectrumIconMap: Record<string, string> = {
|
|
|
1216
1216
|
WebPages: "browsers",
|
|
1217
1217
|
Workflow: "tree-structure",
|
|
1218
1218
|
WorkflowAdd: "tree-structure",
|
|
1219
|
+
Brain: "brain",
|
|
1219
1220
|
Wrench: "wrench",
|
|
1220
1221
|
ZoomIn: "magnifying-glass-plus",
|
|
1221
1222
|
ZoomOut: "magnifying-glass-minus",
|