Skip to content

Commit b595a98

Browse files
authored
Merge branch 'master' into fix/email-template-bindings
2 parents 0379a74 + cd62ddc commit b595a98

File tree

70 files changed

+2457
-662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2457
-662
lines changed

packages/backend-core/src/db/Replication.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ class Replication {
5151
}
5252

5353
appReplicateOpts(
54-
opts: PouchDB.Replication.ReplicateOptions & { isCreation?: boolean } = {}
54+
opts: PouchDB.Replication.ReplicateOptions & {
55+
isCreation?: boolean
56+
tablesToSync?: string[] | "all"
57+
} = {}
5558
): PouchDB.Replication.ReplicateOptions {
5659
if (typeof opts.filter === "string") {
5760
return opts
@@ -63,7 +66,20 @@ class Replication {
6366
delete opts.filter
6467

6568
const isCreation = opts.isCreation
69+
let tablesToSync = opts.tablesToSync
6670
delete opts.isCreation
71+
delete opts.tablesToSync
72+
73+
let syncAllTables = false,
74+
tableSyncList: string[] | undefined
75+
if (typeof tablesToSync === "string" && tablesToSync === "all") {
76+
syncAllTables = true
77+
} else if (tablesToSync) {
78+
tableSyncList = tablesToSync
79+
}
80+
81+
const isData = (_id?: string) =>
82+
_id?.startsWith(DocumentType.ROW) || _id?.startsWith(DocumentType.LINK)
6783

6884
return {
6985
...opts,
@@ -79,6 +95,15 @@ class Replication {
7995
if (doc._deleted) {
8096
return true
8197
}
98+
if (
99+
isData(doc._id) &&
100+
(tableSyncList?.find(id => doc._id?.includes(id)) || syncAllTables)
101+
) {
102+
return true
103+
}
104+
if (isData(doc._id)) {
105+
return false
106+
}
82107
if (doc._id?.startsWith(DocumentType.AUTOMATION_LOG)) {
83108
return false
84109
}

packages/bbui/src/ActionButton/ActionButton.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
border: 0.5px solid rgba(75, 117, 255, 0.2);
8888
color: var(--spectrum-global-color-gray-900);
8989
}
90-
.active:hover {
90+
.active:hover:not(:disabled) {
9191
background-color: rgba(75, 117, 255, 0.2);
9292
border: 0.5px solid rgba(75, 117, 255, 0.3);
9393
}
@@ -102,7 +102,7 @@
102102
padding: 0 8px;
103103
border: 1px dashed transparent;
104104
}
105-
.spectrum-ActionButton--quiet:hover {
105+
.spectrum-ActionButton--quiet:hover:not(:disabled) {
106106
background-color: var(--spectrum-global-color-gray-200);
107107
border: 1px solid var(--spectrum-global-color-gray-300);
108108
}
@@ -114,7 +114,7 @@
114114
padding: 0;
115115
min-width: 0;
116116
}
117-
.noPadding:hover {
117+
.noPadding:hover:not(:disabled) {
118118
padding: 0;
119119
min-width: 0;
120120
background-color: transparent;
@@ -145,7 +145,7 @@
145145
border: 1px solid var(--accent-border-color);
146146
background: var(--accent-bg-color);
147147
}
148-
.accent:hover {
148+
.accent:hover:not(:disabled) {
149149
filter: brightness(1.2);
150150
}
151151
</style>

packages/bbui/src/ActionMenu/ActionMenu.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
export let animate: boolean | undefined = true
1212
export let offset: number | undefined = undefined
1313
export let useAnchorWidth = false
14+
export let roundedPopover: boolean = false
1415
1516
const actionMenuContext = getContext("actionMenu")
1617
@@ -77,6 +78,7 @@
7778
{offset}
7879
{useAnchorWidth}
7980
resizable={false}
81+
borderRadius={roundedPopover ? "12px" : undefined}
8082
on:open
8183
on:close
8284
on:mouseenter={openOnHover ? cancelHide : null}

packages/bbui/src/Banner/Banner.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
export let type = "info"
88
export let icon = "info"
99
export let size = "S"
10-
export let extraButtonText
11-
export let extraButtonAction
12-
export let extraLinkText
13-
export let extraLinkAction
10+
export let extraButtonText = undefined
11+
export let extraButtonAction = undefined
12+
export let extraLinkText = undefined
13+
export let extraLinkAction = undefined
1414
export let showCloseButton = true
1515
1616
let show = true

packages/bbui/src/Menu/Item.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
const actionMenu = getContext("actionMenu")
77
88
export let icon: string | undefined = undefined
9+
export let iconHidden: boolean = false
10+
export let iconAlign: "center" | "start" = "center"
911
export let disabled: boolean | undefined = undefined
1012
export let noClose: boolean = false
1113
export let keyBind: string | undefined = undefined
@@ -42,7 +44,7 @@
4244
tabindex="0"
4345
>
4446
{#if icon}
45-
<div class="icon">
47+
<div class="icon" class:iconHidden style="align-self: {iconAlign}">
4648
<Icon
4749
name={icon}
4850
size="S"
@@ -69,9 +71,11 @@
6971

7072
<style>
7173
.icon {
72-
align-self: center;
7374
margin-right: var(--spacing-s);
7475
}
76+
.iconHidden {
77+
opacity: 0;
78+
}
7579
.keys {
7680
margin-left: 30px;
7781
display: flex;

packages/bbui/src/Popover/Popover.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
export let minWidth: number | undefined = undefined
2626
export let maxWidth: number | undefined = undefined
2727
export let maxHeight: number | undefined = undefined
28+
export let borderRadius: string | undefined = undefined
2829
export let open = false
2930
export let useAnchorWidth = false
3031
export let dismissible = true
@@ -142,7 +143,9 @@
142143
class:hidden={!showPopover}
143144
class:blockPointerEvents
144145
role="presentation"
145-
style="height: {customHeight}; --customZIndex: {customZIndex};"
146+
style="height: {customHeight}; --customZIndex: {customZIndex}; {borderRadius
147+
? `border-radius: ${borderRadius}`
148+
: ``}"
146149
transition:fly|local={{
147150
y: -20,
148151
duration: animate ? animationDuration : 0,
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<script lang="ts">
2+
import { createEventDispatcher } from "svelte"
3+
import { AbsTooltip, ActionButton } from "@budibase/bbui"
4+
5+
export let leftIcon: string
6+
export let leftNotificationTooltip: string | undefined = undefined
7+
export let leftNotificationCount: number | undefined = undefined
8+
export let leftText: string
9+
export let rightIcon: string
10+
export let rightNotificationTooltip: string | undefined = undefined
11+
export let rightNotificationCount: number | undefined = undefined
12+
export let rightText: string
13+
export let selected: "left" | "right" = "left"
14+
export let disabled = false
15+
16+
const dispatch = createEventDispatcher<{
17+
left: void
18+
right: void
19+
}>()
20+
</script>
21+
22+
<div class="view-mode-toggle" class:disabled>
23+
<div class="group">
24+
<div class="wrapper">
25+
{#if leftNotificationTooltip && leftNotificationCount}
26+
<AbsTooltip text={leftNotificationTooltip}>
27+
<span
28+
class="notification"
29+
role="button"
30+
tabindex="-1"
31+
aria-label={`Notifications ${leftNotificationCount}`}
32+
>
33+
{leftNotificationCount}
34+
</span>
35+
</AbsTooltip>
36+
{/if}
37+
<div class="left">
38+
<ActionButton
39+
icon={leftIcon}
40+
quiet
41+
{disabled}
42+
selected={selected === "left"}
43+
on:click={() => {
44+
selected = "left"
45+
dispatch("left")
46+
}}
47+
>
48+
{leftText}
49+
</ActionButton>
50+
</div>
51+
</div>
52+
<div class="wrapper">
53+
{#if rightNotificationTooltip && rightNotificationCount}
54+
<AbsTooltip text={rightNotificationTooltip}>
55+
<span
56+
class="notification"
57+
role="button"
58+
tabindex="-1"
59+
aria-label={`Notifications ${rightNotificationCount}`}
60+
>
61+
{rightNotificationCount}
62+
</span>
63+
</AbsTooltip>
64+
{/if}
65+
<div class="right">
66+
<ActionButton
67+
icon={rightIcon}
68+
quiet
69+
{disabled}
70+
selected={selected === "right"}
71+
on:click={() => {
72+
selected = "right"
73+
dispatch("right")
74+
}}
75+
>
76+
{rightText}
77+
</ActionButton>
78+
</div>
79+
</div>
80+
</div>
81+
</div>
82+
83+
<style>
84+
.view-mode-toggle {
85+
display: flex;
86+
gap: var(--spacing-l);
87+
flex-shrink: 0;
88+
}
89+
.view-mode-toggle .group {
90+
border-radius: 12px;
91+
display: flex;
92+
flex-direction: row;
93+
background: var(--spectrum-global-color-gray-100);
94+
padding: 2px;
95+
border: 1px solid var(--spectrum-global-color-gray-300);
96+
}
97+
.right :global(*) {
98+
border-radius: 0 10px 10px 0;
99+
}
100+
.left :global(*) {
101+
border-radius: 10px 0 0 10px;
102+
}
103+
.wrapper {
104+
position: relative;
105+
}
106+
.notification {
107+
position: absolute;
108+
right: -6px;
109+
top: -6px;
110+
background: var(--spectrum-global-color-static-red-600);
111+
color: white;
112+
border-radius: 8px;
113+
padding: 0 4px;
114+
z-index: 2;
115+
font-size: 0.8em;
116+
cursor: pointer;
117+
}
118+
.disabled {
119+
opacity: 0.8;
120+
}
121+
</style>

packages/bbui/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export { default as List } from "./List/List.svelte"
8888
export { default as ListItem } from "./List/ListItem.svelte"
8989
export { default as Accordion } from "./Accordion/Accordion.svelte"
9090
export { default as AbsTooltip } from "./Tooltip/AbsTooltip.svelte"
91+
export { default as Switcher } from "./Switcher/Switcher.svelte"
9192

9293
// Renderers
9394
export { default as BoldRenderer } from "./Table/BoldRenderer.svelte"

0 commit comments

Comments
 (0)