@lobb-js/studio 0.32.0 → 0.34.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/actions.d.ts +4 -0
- package/dist/applyUITheme.d.ts +2 -0
- package/dist/applyUITheme.js +36 -0
- package/dist/components/LlmButton.svelte +4 -2
- package/dist/components/LlmButton.svelte.d.ts +1 -0
- package/dist/components/Studio.svelte +15 -5
- package/dist/components/canAccess.svelte +52 -0
- package/dist/components/canAccess.svelte.d.ts +10 -0
- package/dist/components/createManyButton.svelte +2 -2
- package/dist/components/dataTable/dataTable.svelte +47 -28
- package/dist/components/dataTable/dataTable.svelte.d.ts +4 -0
- package/dist/components/dataTable/dataTableTabs.svelte +1 -1
- package/dist/components/dataTable/filter.svelte +3 -2
- package/dist/components/dataTable/filterButton.svelte +1 -1
- package/dist/components/dataTable/footer.svelte +1 -1
- package/dist/components/dataTable/header.svelte +20 -26
- package/dist/components/dataTable/header.svelte.d.ts +0 -1
- package/dist/components/dataTable/listViewChildren.svelte +1 -1
- package/dist/components/dataTable/sort.svelte +1 -1
- package/dist/components/dataTable/sortButton.svelte +1 -1
- package/dist/components/dataTable/table.svelte +4 -4
- package/dist/components/dataTablePopup/dataTablePopup.svelte +4 -1
- package/dist/components/dataTablePopup/dataTablePopup.svelte.d.ts +4 -0
- package/dist/components/detailView/create/createDetailView.svelte +2 -2
- package/dist/components/detailView/create/createDetailViewButton.svelte +2 -0
- package/dist/components/detailView/create/createDetailViewButton.svelte.d.ts +1 -0
- package/dist/components/detailView/create/createDetailViewChildren.svelte +3 -3
- package/dist/components/detailView/create/createManyView.svelte +2 -2
- package/dist/components/detailView/update/updateDetailView.svelte +2 -2
- package/dist/components/detailView/update/updateDetailViewButton.svelte +2 -0
- package/dist/components/detailView/update/updateDetailViewButton.svelte.d.ts +1 -0
- package/dist/components/detailView/update/updateDetailViewChildren.svelte +3 -3
- package/dist/components/drawer.svelte +2 -2
- package/dist/components/horizontalNav.svelte +85 -0
- package/dist/components/horizontalNav.svelte.d.ts +3 -0
- package/dist/components/importButton.svelte +6 -6
- package/dist/components/mainNav.svelte +15 -0
- package/dist/components/mainNav.svelte.d.ts +6 -0
- package/dist/components/mainNavShared.d.ts +10 -0
- package/dist/components/mainNavShared.js +62 -0
- package/dist/components/rangeCalendarButton.svelte +1 -2
- package/dist/components/routes/home.svelte +1 -1
- package/dist/components/routes/workflows/workflows.svelte +1 -1
- package/dist/components/setServerPage.svelte +1 -1
- package/dist/components/sidebar/sidebar.svelte +2 -2
- package/dist/components/sidebar/sidebarElements.svelte +3 -3
- package/dist/components/singletone.svelte +2 -2
- package/dist/components/ui/skeleton/skeleton.svelte +1 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/components/verticalNav.svelte +174 -0
- package/dist/components/verticalNav.svelte.d.ts +3 -0
- package/dist/components/workflowEditor.svelte +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/store.types.d.ts +8 -0
- package/package.json +2 -2
- package/src/app.css +52 -75
- package/src/lib/actions.ts +1 -0
- package/src/lib/applyUITheme.ts +38 -0
- package/src/lib/components/LlmButton.svelte +4 -2
- package/src/lib/components/Studio.svelte +15 -5
- package/src/lib/components/canAccess.svelte +52 -0
- package/src/lib/components/createManyButton.svelte +2 -2
- package/src/lib/components/dataTable/dataTable.svelte +47 -28
- package/src/lib/components/dataTable/dataTableTabs.svelte +1 -1
- package/src/lib/components/dataTable/filter.svelte +3 -2
- package/src/lib/components/dataTable/filterButton.svelte +1 -1
- package/src/lib/components/dataTable/footer.svelte +1 -1
- package/src/lib/components/dataTable/header.svelte +20 -26
- package/src/lib/components/dataTable/listViewChildren.svelte +1 -1
- package/src/lib/components/dataTable/sort.svelte +1 -1
- package/src/lib/components/dataTable/sortButton.svelte +1 -1
- package/src/lib/components/dataTable/table.svelte +4 -4
- package/src/lib/components/dataTablePopup/dataTablePopup.svelte +4 -1
- package/src/lib/components/detailView/create/createDetailView.svelte +2 -2
- package/src/lib/components/detailView/create/createDetailViewButton.svelte +2 -0
- package/src/lib/components/detailView/create/createDetailViewChildren.svelte +3 -3
- package/src/lib/components/detailView/create/createManyView.svelte +2 -2
- package/src/lib/components/detailView/update/updateDetailView.svelte +2 -2
- package/src/lib/components/detailView/update/updateDetailViewButton.svelte +2 -0
- package/src/lib/components/detailView/update/updateDetailViewChildren.svelte +3 -3
- package/src/lib/components/drawer.svelte +2 -2
- package/src/lib/components/horizontalNav.svelte +85 -0
- package/src/lib/components/importButton.svelte +6 -6
- package/src/lib/components/mainNav.svelte +15 -0
- package/src/lib/components/mainNavShared.ts +67 -0
- package/src/lib/components/rangeCalendarButton.svelte +1 -2
- package/src/lib/components/routes/home.svelte +1 -1
- package/src/lib/components/routes/workflows/workflows.svelte +1 -1
- package/src/lib/components/setServerPage.svelte +1 -1
- package/src/lib/components/sidebar/sidebar.svelte +2 -2
- package/src/lib/components/sidebar/sidebarElements.svelte +3 -3
- package/src/lib/components/singletone.svelte +2 -2
- package/src/lib/components/ui/skeleton/skeleton.svelte +1 -1
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/src/lib/components/verticalNav.svelte +174 -0
- package/src/lib/components/workflowEditor.svelte +2 -2
- package/src/lib/index.ts +2 -0
- package/src/lib/store.types.ts +6 -0
- package/dist/components/miniSidebar.svelte +0 -300
- package/dist/components/miniSidebar.svelte.d.ts +0 -5
- package/src/lib/components/miniSidebar.svelte +0 -300
|
@@ -10,6 +10,10 @@ interface Props {
|
|
|
10
10
|
showFooter?: boolean;
|
|
11
11
|
tableProps?: Partial<TableProps>;
|
|
12
12
|
tabs?: CollectionTab[];
|
|
13
|
+
view?: {
|
|
14
|
+
id: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
13
17
|
onClose?: () => void;
|
|
14
18
|
}
|
|
15
19
|
declare const DataTablePopup: import("svelte").Component<Props, {}, "">;
|
|
@@ -143,14 +143,14 @@
|
|
|
143
143
|
<Button
|
|
144
144
|
variant="outline"
|
|
145
145
|
onclick={handleCancel}
|
|
146
|
-
|
|
146
|
+
size="sm"
|
|
147
147
|
Icon={X}
|
|
148
148
|
>
|
|
149
149
|
Cancel
|
|
150
150
|
</Button>
|
|
151
151
|
<Button
|
|
152
152
|
variant="default"
|
|
153
|
-
|
|
153
|
+
size="sm"
|
|
154
154
|
Icon={submitButton?.icon ? submitButton.icon : Plus}
|
|
155
155
|
onclick={handleSave}
|
|
156
156
|
>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
interface LocalProp extends CreateDetailViewProp {
|
|
8
8
|
variant?: ButtonProps["variant"];
|
|
9
|
+
size?: ButtonProps["size"];
|
|
9
10
|
class?: ButtonProps["class"];
|
|
10
11
|
Icon?: ButtonProps["Icon"];
|
|
11
12
|
children?: ButtonProps["children"];
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
|
|
18
19
|
<Button
|
|
19
20
|
variant={props.variant}
|
|
21
|
+
size={props.size}
|
|
20
22
|
class={props.class}
|
|
21
23
|
Icon={props.Icon}
|
|
22
24
|
onclick={() => { open = true; }}
|
|
@@ -2,6 +2,7 @@ import type { CreateDetailViewProp } from "./createDetailView.svelte";
|
|
|
2
2
|
import type { ButtonProps } from "../../ui/button/button.svelte";
|
|
3
3
|
interface LocalProp extends CreateDetailViewProp {
|
|
4
4
|
variant?: ButtonProps["variant"];
|
|
5
|
+
size?: ButtonProps["size"];
|
|
5
6
|
class?: ButtonProps["class"];
|
|
6
7
|
Icon?: ButtonProps["Icon"];
|
|
7
8
|
children?: ButtonProps["children"];
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<SelectRecord
|
|
68
68
|
collectionName={child.collection}
|
|
69
69
|
variant="outline"
|
|
70
|
-
|
|
70
|
+
size="sm"
|
|
71
71
|
Icon={Link}
|
|
72
72
|
onSelect={(r) => handleEmptyLink(child.collection, r)}
|
|
73
73
|
>
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
<CreateDetailViewButton
|
|
77
77
|
collectionName={child.collection}
|
|
78
78
|
variant="default"
|
|
79
|
-
|
|
79
|
+
size="sm"
|
|
80
80
|
Icon={Plus}
|
|
81
81
|
onChanges={(c) => handleEmptyCreate(child.collection, c)}
|
|
82
82
|
>
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
{:else}
|
|
89
|
-
<div class="rounded-lg border bg-
|
|
89
|
+
<div class="rounded-lg border bg-card overflow-hidden flex flex-col max-h-96">
|
|
90
90
|
<DataTable
|
|
91
91
|
collectionName={child.collection}
|
|
92
92
|
searchParams={{ children_of: collectionName, parent_id: -1 }}
|
|
@@ -137,12 +137,12 @@
|
|
|
137
137
|
text="Select existing"
|
|
138
138
|
onSelect={onRecordSelect}
|
|
139
139
|
filter={selectRecordFilter}
|
|
140
|
-
|
|
140
|
+
size="sm"
|
|
141
141
|
variant="ghost"
|
|
142
142
|
/>
|
|
143
143
|
<CreateDetailViewButton
|
|
144
144
|
variant="ghost"
|
|
145
|
-
|
|
145
|
+
size="sm"
|
|
146
146
|
Icon={Plus}
|
|
147
147
|
{collectionName}
|
|
148
148
|
onChanges={(updated) => { addChanges = updated; }}
|
|
@@ -180,14 +180,14 @@
|
|
|
180
180
|
<Button
|
|
181
181
|
variant="outline"
|
|
182
182
|
onclick={handleCancel}
|
|
183
|
-
|
|
183
|
+
size="sm"
|
|
184
184
|
Icon={X}
|
|
185
185
|
>
|
|
186
186
|
Cancel
|
|
187
187
|
</Button>
|
|
188
188
|
<Button
|
|
189
189
|
variant="default"
|
|
190
|
-
|
|
190
|
+
size="sm"
|
|
191
191
|
Icon={submitButton?.icon ? submitButton.icon : Pencil}
|
|
192
192
|
onclick={handleSave}
|
|
193
193
|
disabled={!hasChanges}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
interface LocalProp extends UpdateDetailViewProp {
|
|
9
9
|
variant?: ButtonProps["variant"];
|
|
10
|
+
size?: ButtonProps["size"];
|
|
10
11
|
class?: ButtonProps["class"];
|
|
11
12
|
Icon?: ButtonProps["Icon"];
|
|
12
13
|
children?: ButtonProps["children"];
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
|
|
34
35
|
<Button
|
|
35
36
|
variant={props.variant}
|
|
37
|
+
size={props.size}
|
|
36
38
|
class={props.class}
|
|
37
39
|
Icon={props.Icon}
|
|
38
40
|
onclick={openView}
|
|
@@ -2,6 +2,7 @@ import type { UpdateDetailViewProp } from "./updateDetailView.svelte";
|
|
|
2
2
|
import type { ButtonProps } from "../../ui/button/button.svelte";
|
|
3
3
|
interface LocalProp extends UpdateDetailViewProp {
|
|
4
4
|
variant?: ButtonProps["variant"];
|
|
5
|
+
size?: ButtonProps["size"];
|
|
5
6
|
class?: ButtonProps["class"];
|
|
6
7
|
Icon?: ButtonProps["Icon"];
|
|
7
8
|
children?: ButtonProps["children"];
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
<SelectRecord
|
|
76
76
|
collectionName={child.collection}
|
|
77
77
|
variant="outline"
|
|
78
|
-
|
|
78
|
+
size="sm"
|
|
79
79
|
Icon={Link}
|
|
80
80
|
onSelect={(r) => handleEmptyLink(child.collection, r)}
|
|
81
81
|
>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<CreateDetailViewButton
|
|
85
85
|
collectionName={child.collection}
|
|
86
86
|
variant="default"
|
|
87
|
-
|
|
87
|
+
size="sm"
|
|
88
88
|
Icon={Plus}
|
|
89
89
|
onChanges={(c) => handleEmptyCreate(child.collection, c)}
|
|
90
90
|
>
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
96
|
{:else}
|
|
97
|
-
<div class="rounded-lg border bg-
|
|
97
|
+
<div class="rounded-lg border bg-card overflow-hidden flex flex-col max-h-96">
|
|
98
98
|
<DataTable
|
|
99
99
|
collectionName={child.collection}
|
|
100
100
|
searchParams={{ children_of: collectionName, parent_id: entry.id }}
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
<div
|
|
39
39
|
transition:slide={{ axis: position === "bottom" ? "y" : "x" }}
|
|
40
40
|
class={position === "bottom"
|
|
41
|
-
? "fixed bottom-0 left-0 z-40 flex h-[60vh] w-full flex-col border-t bg-
|
|
42
|
-
: "fixed right-0 top-0 z-40 flex h-full w-full flex-col border-l bg-
|
|
41
|
+
? "fixed bottom-0 left-0 z-40 flex h-[60vh] w-full flex-col border-t bg-card"
|
|
42
|
+
: "fixed right-0 top-0 z-40 flex h-full w-full flex-col border-l bg-card"}
|
|
43
43
|
style={position === "side" ? `max-width: ${calculateDrawerWidth()}px;` : ""}
|
|
44
44
|
>
|
|
45
45
|
{@render children?.()}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import { page } from "$app/state";
|
|
4
|
+
import Button from "./ui/button/button.svelte";
|
|
5
|
+
import Separator from "./ui/separator/separator.svelte";
|
|
6
|
+
import * as Popover from "./ui/popover";
|
|
7
|
+
import { getStudioContext } from "../context";
|
|
8
|
+
import { buildNavSections, isItemActive, type NavItem } from "./mainNavShared";
|
|
9
|
+
|
|
10
|
+
const { lobb, ctx } = getStudioContext();
|
|
11
|
+
|
|
12
|
+
let sections: NavItem[][] = $state([[], [], []]);
|
|
13
|
+
onMount(async () => {
|
|
14
|
+
sections = await buildNavSections(lobb, ctx);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const currentPath = $derived(page.url.pathname.replace(/\/$/, "") || "/");
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#snippet section(section: NavItem[])}
|
|
21
|
+
<div class="flex flex-row items-center gap-1">
|
|
22
|
+
{#each section as item}
|
|
23
|
+
{@const active = isItemActive(currentPath, item)}
|
|
24
|
+
{#if !item.navs}
|
|
25
|
+
<Button
|
|
26
|
+
onclick={() => { if (item.onclick) item.onclick(); }}
|
|
27
|
+
href={item.href}
|
|
28
|
+
class="h-8 px-2.5 text-xs font-normal {active
|
|
29
|
+
? 'bg-accent text-foreground'
|
|
30
|
+
: 'text-foreground/70 hover:bg-accent/50 hover:text-foreground'}"
|
|
31
|
+
variant="ghost"
|
|
32
|
+
Icon={item.icon}
|
|
33
|
+
>
|
|
34
|
+
{item.label}
|
|
35
|
+
</Button>
|
|
36
|
+
{:else}
|
|
37
|
+
<Popover.Root>
|
|
38
|
+
<Popover.Trigger>
|
|
39
|
+
<Button
|
|
40
|
+
class="h-8 px-2.5 text-xs font-normal {active
|
|
41
|
+
? 'bg-accent text-accent-foreground'
|
|
42
|
+
: 'text-muted-foreground'}"
|
|
43
|
+
variant="ghost"
|
|
44
|
+
Icon={item.icon}
|
|
45
|
+
>
|
|
46
|
+
{item.label}
|
|
47
|
+
</Button>
|
|
48
|
+
</Popover.Trigger>
|
|
49
|
+
<Popover.Content sideOffset={6} side="bottom" align="start" class="w-60 p-0">
|
|
50
|
+
<div class="py-1">
|
|
51
|
+
{#each item.navs as childItem}
|
|
52
|
+
{@const childActive = isItemActive(currentPath, childItem)}
|
|
53
|
+
<div class="px-1 text-xs text-muted-foreground">
|
|
54
|
+
<Button
|
|
55
|
+
variant="ghost"
|
|
56
|
+
class="flex h-7 w-full justify-start p-2 text-xs font-normal {childActive
|
|
57
|
+
? 'bg-accent text-accent-foreground'
|
|
58
|
+
: 'text-muted-foreground'}"
|
|
59
|
+
Icon={childItem.icon}
|
|
60
|
+
onclick={() => { if (childItem.onclick) childItem.onclick(); }}
|
|
61
|
+
href={childItem.href}
|
|
62
|
+
>
|
|
63
|
+
{childItem.label}
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
{/each}
|
|
67
|
+
</div>
|
|
68
|
+
</Popover.Content>
|
|
69
|
+
</Popover.Root>
|
|
70
|
+
{/if}
|
|
71
|
+
{/each}
|
|
72
|
+
</div>
|
|
73
|
+
{/snippet}
|
|
74
|
+
|
|
75
|
+
<div class="relative border-b border-border bg-card text-foreground h-12 w-full px-3 flex items-center justify-between gap-2">
|
|
76
|
+
<div class="flex flex-row items-center gap-2">
|
|
77
|
+
{@render section(sections[0])}
|
|
78
|
+
{#if sections[1].length > 0}
|
|
79
|
+
<Separator orientation="vertical" class="h-6 bg-border" />
|
|
80
|
+
{@render section(sections[1])}
|
|
81
|
+
{/if}
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
{@render section(sections[2])}
|
|
85
|
+
</div>
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
}
|
|
171
171
|
</script>
|
|
172
172
|
|
|
173
|
-
<Button variant={rest.variant} class={rest.class} onclick={showDrawer}>
|
|
173
|
+
<Button variant={rest.variant} size={rest.size} class={rest.class} onclick={showDrawer}>
|
|
174
174
|
<ExtensionsComponents
|
|
175
175
|
name="collections.import.button.content"
|
|
176
176
|
utils={getExtensionUtils(lobb, ctx)}
|
|
@@ -264,11 +264,11 @@
|
|
|
264
264
|
</div>
|
|
265
265
|
|
|
266
266
|
<div class="flex h-12 shrink-0 items-center justify-end gap-2 border-t px-4">
|
|
267
|
-
<Button variant="outline" onclick={hideDrawer}
|
|
267
|
+
<Button variant="outline" onclick={hideDrawer} size="sm" Icon={X}>
|
|
268
268
|
Cancel
|
|
269
269
|
</Button>
|
|
270
270
|
{#if activeTab === "paste"}
|
|
271
|
-
<Button onclick={() => processContent(pasteContent)}
|
|
271
|
+
<Button onclick={() => processContent(pasteContent)} size="sm" Icon={FileText}>
|
|
272
272
|
Parse
|
|
273
273
|
</Button>
|
|
274
274
|
{/if}
|
|
@@ -289,10 +289,10 @@
|
|
|
289
289
|
</div>
|
|
290
290
|
|
|
291
291
|
<div class="flex h-12 shrink-0 items-center justify-end gap-2 border-t px-4">
|
|
292
|
-
<Button variant="outline" onclick={() => (step = "input")}
|
|
292
|
+
<Button variant="outline" onclick={() => (step = "input")} size="sm" Icon={X}>
|
|
293
293
|
Cancel
|
|
294
294
|
</Button>
|
|
295
|
-
<Button onclick={handleImport}
|
|
295
|
+
<Button onclick={handleImport} size="sm" Icon={Check}>
|
|
296
296
|
Import {transformedRows.length} records
|
|
297
297
|
</Button>
|
|
298
298
|
</div>
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
</div>
|
|
346
346
|
{/if}
|
|
347
347
|
<div class="flex h-12 shrink-0 items-center justify-end gap-2 border-t px-4">
|
|
348
|
-
<Button onclick={hideDrawer}
|
|
348
|
+
<Button onclick={hideDrawer} size="sm" Icon={Check}>
|
|
349
349
|
Done
|
|
350
350
|
</Button>
|
|
351
351
|
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import VerticalNav from "./verticalNav.svelte";
|
|
3
|
+
import HorizontalNav from "./horizontalNav.svelte";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
orientation?: "vertical" | "horizontal";
|
|
7
|
+
}
|
|
8
|
+
const { orientation = "vertical" }: Props = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#if orientation === "horizontal"}
|
|
12
|
+
<HorizontalNav />
|
|
13
|
+
{:else}
|
|
14
|
+
<VerticalNav />
|
|
15
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type NavItem = {
|
|
2
|
+
label: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
icon: any;
|
|
5
|
+
represents?: string;
|
|
6
|
+
onclick?: () => void;
|
|
7
|
+
navs?: NavItem[];
|
|
8
|
+
};
|
|
9
|
+
export declare function buildNavSections(lobb: any, ctx: any): Promise<NavItem[][]>;
|
|
10
|
+
export declare function isItemActive(currentPath: string, item: NavItem): boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { House, Layers, Library, Workflow } from "lucide-svelte";
|
|
2
|
+
import { emitEvent } from "../eventSystem";
|
|
3
|
+
import { getDashboardNavs } from "../extensions/extensionUtils";
|
|
4
|
+
async function isItemVisible(lobb, ctx, item) {
|
|
5
|
+
if (!item.represents)
|
|
6
|
+
return true;
|
|
7
|
+
const res = await emitEvent({ lobb, ctx }, "auth.canAccess", {
|
|
8
|
+
collection: item.represents,
|
|
9
|
+
action: "read",
|
|
10
|
+
});
|
|
11
|
+
return res === true;
|
|
12
|
+
}
|
|
13
|
+
export async function buildNavSections(lobb, ctx) {
|
|
14
|
+
const rawSections = [
|
|
15
|
+
[
|
|
16
|
+
{ label: "Home", href: "/studio", icon: House },
|
|
17
|
+
{ label: "Collections", href: "/studio/collections", icon: Library },
|
|
18
|
+
{ label: "Data Model", href: "/studio/datamodel", icon: Layers, represents: "core_data_model" },
|
|
19
|
+
{ label: "Workflows", href: "/studio/workflows", icon: Workflow, represents: "core_workflows" },
|
|
20
|
+
],
|
|
21
|
+
[],
|
|
22
|
+
[],
|
|
23
|
+
];
|
|
24
|
+
const navs = getDashboardNavs(ctx);
|
|
25
|
+
if (navs.top)
|
|
26
|
+
rawSections[0].push(...navs.top);
|
|
27
|
+
if (navs.middle)
|
|
28
|
+
rawSections[1].push(...navs.middle);
|
|
29
|
+
if (navs.bottom)
|
|
30
|
+
rawSections[2].push(...navs.bottom);
|
|
31
|
+
const result = [[], [], []];
|
|
32
|
+
for (let i = 0; i < rawSections.length; i++) {
|
|
33
|
+
for (const item of rawSections[i]) {
|
|
34
|
+
if (item.navs) {
|
|
35
|
+
const visibleChildren = [];
|
|
36
|
+
for (const child of item.navs) {
|
|
37
|
+
if (await isItemVisible(lobb, ctx, child))
|
|
38
|
+
visibleChildren.push(child);
|
|
39
|
+
}
|
|
40
|
+
if (visibleChildren.length && (await isItemVisible(lobb, ctx, item))) {
|
|
41
|
+
result[i].push({ ...item, navs: visibleChildren });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (await isItemVisible(lobb, ctx, item)) {
|
|
45
|
+
result[i].push(item);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
export function isItemActive(currentPath, item) {
|
|
52
|
+
if (item.navs)
|
|
53
|
+
return item.navs.some((c) => isItemActive(currentPath, c));
|
|
54
|
+
if (!item.href)
|
|
55
|
+
return false;
|
|
56
|
+
const itemHref = item.href.replace(/\/$/, "") || "/";
|
|
57
|
+
// "/studio" needs an exact match — it's a prefix of every other
|
|
58
|
+
// route, so startsWith would always light it up.
|
|
59
|
+
if (itemHref === "/studio")
|
|
60
|
+
return currentPath === "/studio";
|
|
61
|
+
return currentPath === itemHref || currentPath.startsWith(itemHref + "/");
|
|
62
|
+
}
|
|
@@ -33,9 +33,8 @@
|
|
|
33
33
|
<Popover.Root>
|
|
34
34
|
<Popover.Trigger
|
|
35
35
|
class={cn(
|
|
36
|
-
buttonVariants({ variant: "outline" }),
|
|
36
|
+
buttonVariants({ variant: "outline", size: "sm" }),
|
|
37
37
|
!value && "text-muted-foreground",
|
|
38
|
-
"h-7 px-3 text-xs font-normal",
|
|
39
38
|
)}
|
|
40
39
|
>
|
|
41
40
|
<CalendarIcon class="mr-2 size-4" />
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<div class="text-4xl">Welcome back</div>
|
|
35
35
|
<div>Sign in to your account</div>
|
|
36
36
|
</div>
|
|
37
|
-
<div class="flex flex-col gap-6 rounded-md border bg-
|
|
37
|
+
<div class="flex flex-col gap-6 rounded-md border bg-card p-6">
|
|
38
38
|
<div class="flex flex-col gap-2">
|
|
39
39
|
<div>
|
|
40
40
|
<div class="mb-1 text-sm font-medium">Server</div>
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
>
|
|
91
91
|
<div
|
|
92
92
|
class="
|
|
93
|
-
bg-
|
|
93
|
+
bg-card border-r overflow-hidden
|
|
94
94
|
"
|
|
95
95
|
style="
|
|
96
96
|
{sidebarProperties.collapsed ? 'border-right-width: 0px; padding: 0px;' : ''}
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</div>
|
|
124
124
|
<div
|
|
125
125
|
class="
|
|
126
|
-
text-
|
|
126
|
+
text-foreground p-2 overflow-y-auto overflow-x-clip
|
|
127
127
|
"
|
|
128
128
|
style="max-height: {sidebarBodyHeight}px;"
|
|
129
129
|
>
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
href={node.href}
|
|
90
90
|
variant="ghost"
|
|
91
91
|
class="
|
|
92
|
-
flex items-center justify-between p-2 gap-2
|
|
93
|
-
rounded-md {isselected ? 'bg-muted' : ''}
|
|
92
|
+
flex items-center justify-between p-2 gap-2 text-muted-foreground
|
|
93
|
+
rounded-md {isselected ? 'bg-muted' : 'hover:bg-muted-soft'}
|
|
94
94
|
"
|
|
95
95
|
title={node.name}
|
|
96
96
|
>
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
{#if node.icon}
|
|
99
99
|
<node.icon size="17.5" />
|
|
100
100
|
{/if}
|
|
101
|
-
<div class="text-xs {isselected ? 'text-
|
|
101
|
+
<div class="text-xs {isselected ? 'text-foreground font-medium' : ''}">
|
|
102
102
|
{node.name}
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
<div class="flex flex-col h-full bg-background">
|
|
42
|
-
<div class="flex justify-between items-center gap-2 p-2 border-b h-
|
|
42
|
+
<div class="flex justify-between items-center gap-2 p-2 border-b h-12 shrink-0">
|
|
43
43
|
<div class="flex items-center gap-1">
|
|
44
44
|
<SidebarTrigger />
|
|
45
45
|
</div>
|
|
46
46
|
<div>
|
|
47
|
-
<Button
|
|
47
|
+
<Button size="sm" Icon={Save} onclick={handleSave}>
|
|
48
48
|
Save
|
|
49
49
|
</Button>
|
|
50
50
|
</div>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
bind:ref
|
|
15
15
|
{sideOffset}
|
|
16
16
|
class={cn(
|
|
17
|
-
"bg-
|
|
17
|
+
"bg-popover text-popover-foreground border shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md px-3 py-1.5 text-xs",
|
|
18
18
|
className
|
|
19
19
|
)}
|
|
20
20
|
{...restProps}
|