@lobb-js/studio 0.20.0 → 0.22.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 +1 -0
- package/dist/components/dataTable/utils.js +8 -14
- package/dist/components/dataTableDrawer/dataTableDrawer.svelte +14 -10
- package/dist/components/dataTableDrawer/dataTableDrawer.svelte.d.ts +1 -0
- package/dist/components/detailView/create/children.svelte +13 -30
- package/dist/components/detailView/create/createDetailView.svelte +9 -32
- package/dist/components/detailView/update/children.svelte +122 -35
- package/dist/components/detailView/utils.d.ts +5 -2
- package/dist/components/detailView/utils.js +28 -71
- package/dist/components/drawer.svelte +24 -8
- package/dist/components/drawer.svelte.d.ts +1 -0
- package/dist/extensions/extension.types.d.ts +2 -0
- package/dist/extensions/extensionUtils.js +2 -0
- package/dist/store.types.d.ts +13 -0
- package/package.json +2 -2
- package/src/lib/actions.ts +1 -0
- package/src/lib/components/dataTable/utils.ts +7 -16
- package/src/lib/components/dataTableDrawer/dataTableDrawer.svelte +14 -10
- package/src/lib/components/detailView/create/children.svelte +13 -30
- package/src/lib/components/detailView/create/createDetailView.svelte +9 -32
- package/src/lib/components/detailView/update/children.svelte +122 -35
- package/src/lib/components/detailView/utils.ts +24 -76
- package/src/lib/components/drawer.svelte +24 -8
- package/src/lib/extensions/extension.types.ts +2 -1
- package/src/lib/extensions/extensionUtils.ts +2 -0
- package/src/lib/store.types.ts +7 -0
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { calculateDrawerWidth } from "../utils";
|
|
3
3
|
import type { Snippet } from "svelte";
|
|
4
|
-
import { fade
|
|
4
|
+
import { fade } from "svelte/transition";
|
|
5
|
+
import { cubicOut } from "svelte/easing";
|
|
5
6
|
import Portal from "svelte-portal";
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
9
|
children?: Snippet<[]>;
|
|
9
10
|
onHide?: () => Promise<void>;
|
|
11
|
+
position?: "side" | "bottom";
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
let { onHide, children }: Props = $props();
|
|
14
|
+
let { onHide, children, position = "side" }: Props = $props();
|
|
15
|
+
|
|
16
|
+
function slide(_node: Element, { duration = 250, axis }: { duration?: number; axis: "x" | "y" }) {
|
|
17
|
+
return {
|
|
18
|
+
duration,
|
|
19
|
+
easing: cubicOut,
|
|
20
|
+
css: (t: number) => {
|
|
21
|
+
const offset = (1 - t) * 100;
|
|
22
|
+
return axis === "y"
|
|
23
|
+
? `transform: translateY(${offset}%)`
|
|
24
|
+
: `transform: translateX(${offset}%)`;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
13
28
|
</script>
|
|
14
29
|
|
|
15
30
|
<Portal target="body">
|
|
16
31
|
<button
|
|
17
|
-
transition:fade={{ duration:
|
|
32
|
+
transition:fade={{ duration: 200 }}
|
|
18
33
|
onclick={() => onHide?.()}
|
|
19
|
-
class="backgroundDrawerButton fixed left-0 top-0 z-40 h-screen w-screen bg-
|
|
34
|
+
class="backgroundDrawerButton fixed left-0 top-0 z-40 h-screen w-screen bg-black/50 cursor-default"
|
|
20
35
|
aria-label="background used to hide the background"
|
|
21
36
|
></button>
|
|
22
37
|
|
|
23
|
-
<!-- the drawer -->
|
|
24
38
|
<div
|
|
25
|
-
transition:
|
|
26
|
-
class=
|
|
27
|
-
|
|
39
|
+
transition:slide={{ axis: position === "bottom" ? "y" : "x" }}
|
|
40
|
+
class={position === "bottom"
|
|
41
|
+
? "fixed bottom-0 left-0 z-40 flex h-[60vh] w-full flex-col border-t bg-background"
|
|
42
|
+
: "fixed right-0 top-0 z-40 flex h-full w-full flex-col border-l bg-background"}
|
|
43
|
+
style={position === "side" ? `max-width: ${calculateDrawerWidth()}px;` : ""}
|
|
28
44
|
>
|
|
29
45
|
{@render children?.()}
|
|
30
46
|
</div>
|
|
@@ -57,7 +57,8 @@ export interface ExtensionUtils {
|
|
|
57
57
|
location: Location;
|
|
58
58
|
toast: typeof toast;
|
|
59
59
|
showDialog: typeof showDialog;
|
|
60
|
-
openDataTableDrawer: (props: { collectionName: string; filter?: Record<string, any>; title?: string; showHeader?: boolean; showFooter?: boolean }) => void;
|
|
60
|
+
openDataTableDrawer: (props: { collectionName: string; filter?: Record<string, any>; title?: string; showHeader?: boolean; showFooter?: boolean; position?: "side" | "bottom" }) => void;
|
|
61
|
+
emitEvent: (eventName: string, input: Record<string, any>) => Promise<Record<string, any>>;
|
|
61
62
|
components: Components;
|
|
62
63
|
mediaQueries: typeof mediaQueries;
|
|
63
64
|
intlDate: typeof intlDate;
|
|
@@ -8,6 +8,7 @@ import type { LobbClient } from "@lobb-js/sdk";
|
|
|
8
8
|
import type { CTX } from "../store.types";
|
|
9
9
|
import { toast } from "svelte-sonner";
|
|
10
10
|
import { showDialog, openDataTableDrawer } from "../actions";
|
|
11
|
+
import { emitEvent } from "../eventSystem";
|
|
11
12
|
import { Button } from "../components/ui/button";
|
|
12
13
|
import { Input } from "../components/ui/input";
|
|
13
14
|
import { Separator } from "../components/ui/separator";
|
|
@@ -65,6 +66,7 @@ export function getExtensionUtils(lobb: LobbClient, ctx: CTX): ExtensionUtils {
|
|
|
65
66
|
toast: toast,
|
|
66
67
|
showDialog: showDialog,
|
|
67
68
|
openDataTableDrawer: (props) => openDataTableDrawer({ lobb, ctx }, props),
|
|
69
|
+
emitEvent: (eventName, input) => emitEvent({ lobb, ctx }, eventName, input),
|
|
68
70
|
components: getComponents(),
|
|
69
71
|
mediaQueries: mediaQueries,
|
|
70
72
|
intlDate: intlDate,
|
package/src/lib/store.types.ts
CHANGED
|
@@ -7,12 +7,19 @@ interface CollectionTab {
|
|
|
7
7
|
default?: boolean;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
type CollectionChild =
|
|
11
|
+
| { type: "fk"; collection: string; field: string }
|
|
12
|
+
| { type: "m2m"; collection: string }
|
|
13
|
+
| { type: "polymorphic"; collection: string };
|
|
14
|
+
|
|
10
15
|
interface Collection {
|
|
11
16
|
category: string;
|
|
12
17
|
owner: string;
|
|
13
18
|
fields: Record<string, any>;
|
|
14
19
|
singleton: boolean;
|
|
15
20
|
virtual?: boolean;
|
|
21
|
+
junction?: boolean;
|
|
22
|
+
children?: CollectionChild[];
|
|
16
23
|
ui?: {
|
|
17
24
|
icon?: string;
|
|
18
25
|
tabs?: CollectionTab[];
|