@lobb-js/studio 0.9.2 → 0.10.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/components/Studio.svelte +0 -2
- package/dist/components/dataTable/fieldCell.svelte +4 -1
- package/dist/components/detailView/create/createDetailView.svelte +3 -1
- package/dist/components/detailView/fieldCustomInput.svelte +3 -0
- package/dist/components/detailView/passwordInput.svelte +27 -0
- package/dist/components/detailView/passwordInput.svelte.d.ts +7 -0
- package/dist/components/routes/homeFooter.svelte +4 -16
- package/dist/store.types.d.ts +0 -1
- package/package.json +1 -1
- package/src/lib/components/Studio.svelte +0 -2
- package/src/lib/components/dataTable/fieldCell.svelte +4 -1
- package/src/lib/components/detailView/create/createDetailView.svelte +3 -1
- package/src/lib/components/detailView/fieldCustomInput.svelte +3 -0
- package/src/lib/components/detailView/passwordInput.svelte +27 -0
- package/src/lib/components/routes/homeFooter.svelte +4 -16
- package/src/lib/store.types.ts +0 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -2
- package/src/lib/version.ts +0 -2
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
loadExtensions,
|
|
15
15
|
} from "../extensions/extensionUtils";
|
|
16
16
|
import extensionMap from 'virtual:lobb-studio-extensions';
|
|
17
|
-
import { STUDIO_VERSION } from "../version.ts";
|
|
18
17
|
import { mediaQueries } from "../utils";
|
|
19
18
|
import Home from "./routes/home.svelte";
|
|
20
19
|
import DataModel from "./routes/data_model/dataModel.svelte";
|
|
@@ -33,7 +32,6 @@
|
|
|
33
32
|
extensions: {},
|
|
34
33
|
meta: null,
|
|
35
34
|
currentUrl: new URL(window.location.href),
|
|
36
|
-
studioVersion: STUDIO_VERSION,
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
const lobb = createLobb(lobbUrl ?? "");
|
|
@@ -29,9 +29,12 @@
|
|
|
29
29
|
const isRefrenceField = Boolean(
|
|
30
30
|
getFieldRelation(ctx, collectionName, fieldName),
|
|
31
31
|
);
|
|
32
|
+
const isPasswordField = ctx.meta.collections[collectionName].fields[fieldName]?.ui?.input?.type === "password";
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
|
-
{#if
|
|
35
|
+
{#if isPasswordField}
|
|
36
|
+
<div class="text-muted-foreground tracking-widest">••••••</div>
|
|
37
|
+
{:else if value === ""}
|
|
35
38
|
<div class="text-muted-foreground">EMPTY STRING</div>
|
|
36
39
|
{:else if value === null || value === undefined}
|
|
37
40
|
<div class="text-muted-foreground">NULL</div>
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
parseDetailViewValues,
|
|
34
34
|
serializeEntry,
|
|
35
35
|
} from "../utils";
|
|
36
|
+
import { getChangedProperties } from "../../../utils";
|
|
36
37
|
import type { Snippet } from "svelte";
|
|
37
38
|
import FieldInput from "../fieldInput.svelte";
|
|
38
39
|
import { emitEvent } from "../../../eventSystem";
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
let entry: Record<string, any> = $state(
|
|
56
57
|
getDefaultEntry(ctx, fieldNames, collectionName, values),
|
|
57
58
|
);
|
|
59
|
+
const initialEntry = $state.snapshot(entry);
|
|
58
60
|
let fieldsErrors: Record<string, any> = $state({});
|
|
59
61
|
const subCollections = ctx.meta.relations.filter((relation) => relation.to.collection === collectionName).map((relation) => relation.from.collection);
|
|
60
62
|
const subCollectionsValues: Record<string, any> = {};
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
async function handleSave() {
|
|
69
|
-
let localEntry = $state.snapshot(entry);
|
|
71
|
+
let localEntry = getChangedProperties(initialEntry, $state.snapshot(entry));
|
|
70
72
|
|
|
71
73
|
await emitEvent({ lobb, ctx }, "studio.collections.preCreate", {
|
|
72
74
|
collectionName,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import CodeEditor from "../codeEditor.svelte";
|
|
3
3
|
import RichTextEditor from "../richTextEditor.svelte";
|
|
4
|
+
import PasswordInput from "./passwordInput.svelte";
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
value: any;
|
|
@@ -23,4 +24,6 @@
|
|
|
23
24
|
<CodeEditor name={field.key} {...args} bind:value />
|
|
24
25
|
{:else if type === "richtext"}
|
|
25
26
|
<RichTextEditor name={field.key} bind:value />
|
|
27
|
+
{:else if type === "password"}
|
|
28
|
+
<PasswordInput bind:value {destructive} />
|
|
26
29
|
{/if}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Input from "../ui/input/input.svelte";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value: any;
|
|
6
|
+
destructive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { value = $bindable(), destructive }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const originalValue = value;
|
|
12
|
+
let displayValue = $state("");
|
|
13
|
+
|
|
14
|
+
function onInput(e: Event) {
|
|
15
|
+
const input = e.target as HTMLInputElement;
|
|
16
|
+
displayValue = input.value;
|
|
17
|
+
value = input.value || originalValue;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Input
|
|
22
|
+
type="password"
|
|
23
|
+
placeholder="••••••"
|
|
24
|
+
class="bg-muted/30 text-xs {destructive ? 'border-destructive bg-destructive/10' : ''}"
|
|
25
|
+
value={displayValue}
|
|
26
|
+
oninput={onInput}
|
|
27
|
+
/>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
const { ctx } = getStudioContext();
|
|
11
11
|
|
|
12
|
-
let
|
|
12
|
+
let coreReleaseDate: string | null = $state(null);
|
|
13
13
|
|
|
14
14
|
async function fetchReleaseDate(pkg: string, version: string): Promise<string | null> {
|
|
15
15
|
try {
|
|
@@ -23,28 +23,16 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
onMount(async () => {
|
|
26
|
-
|
|
27
|
-
fetchReleaseDate("@lobb-js/core", ctx.meta.version),
|
|
28
|
-
ctx.studioVersion ? fetchReleaseDate("@lobb-js/studio", ctx.studioVersion) : Promise.resolve(null),
|
|
29
|
-
]);
|
|
30
|
-
releaseDates = { core: coreDate, studio: studioDate };
|
|
26
|
+
coreReleaseDate = await fetchReleaseDate("@lobb-js/core", ctx.meta.version);
|
|
31
27
|
});
|
|
32
28
|
</script>
|
|
33
29
|
|
|
34
30
|
<div class="flex justify-end p-2 text-xs text-muted-foreground/50">
|
|
35
31
|
<div class="flex flex-col text-end gap-0.5">
|
|
36
|
-
{#if ctx.studioVersion}
|
|
37
|
-
<div>
|
|
38
|
-
studio: v{ctx.studioVersion}
|
|
39
|
-
{#if releaseDates.studio}
|
|
40
|
-
<span>({timeAgo.format(new Date(releaseDates.studio!))})</span>
|
|
41
|
-
{/if}
|
|
42
|
-
</div>
|
|
43
|
-
{/if}
|
|
44
32
|
<div>
|
|
45
33
|
core: v{ctx.meta.version}
|
|
46
|
-
{#if
|
|
47
|
-
<span>({timeAgo.format(new Date(
|
|
34
|
+
{#if coreReleaseDate}
|
|
35
|
+
<span>({timeAgo.format(new Date(coreReleaseDate))})</span>
|
|
48
36
|
{/if}
|
|
49
37
|
</div>
|
|
50
38
|
</div>
|
package/dist/store.types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
loadExtensions,
|
|
15
15
|
} from "../extensions/extensionUtils";
|
|
16
16
|
import extensionMap from 'virtual:lobb-studio-extensions';
|
|
17
|
-
import { STUDIO_VERSION } from "../version.ts";
|
|
18
17
|
import { mediaQueries } from "../utils";
|
|
19
18
|
import Home from "./routes/home.svelte";
|
|
20
19
|
import DataModel from "./routes/data_model/dataModel.svelte";
|
|
@@ -33,7 +32,6 @@
|
|
|
33
32
|
extensions: {},
|
|
34
33
|
meta: null,
|
|
35
34
|
currentUrl: new URL(window.location.href),
|
|
36
|
-
studioVersion: STUDIO_VERSION,
|
|
37
35
|
});
|
|
38
36
|
|
|
39
37
|
const lobb = createLobb(lobbUrl ?? "");
|
|
@@ -29,9 +29,12 @@
|
|
|
29
29
|
const isRefrenceField = Boolean(
|
|
30
30
|
getFieldRelation(ctx, collectionName, fieldName),
|
|
31
31
|
);
|
|
32
|
+
const isPasswordField = ctx.meta.collections[collectionName].fields[fieldName]?.ui?.input?.type === "password";
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
|
-
{#if
|
|
35
|
+
{#if isPasswordField}
|
|
36
|
+
<div class="text-muted-foreground tracking-widest">••••••</div>
|
|
37
|
+
{:else if value === ""}
|
|
35
38
|
<div class="text-muted-foreground">EMPTY STRING</div>
|
|
36
39
|
{:else if value === null || value === undefined}
|
|
37
40
|
<div class="text-muted-foreground">NULL</div>
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
parseDetailViewValues,
|
|
34
34
|
serializeEntry,
|
|
35
35
|
} from "../utils";
|
|
36
|
+
import { getChangedProperties } from "../../../utils";
|
|
36
37
|
import type { Snippet } from "svelte";
|
|
37
38
|
import FieldInput from "../fieldInput.svelte";
|
|
38
39
|
import { emitEvent } from "../../../eventSystem";
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
let entry: Record<string, any> = $state(
|
|
56
57
|
getDefaultEntry(ctx, fieldNames, collectionName, values),
|
|
57
58
|
);
|
|
59
|
+
const initialEntry = $state.snapshot(entry);
|
|
58
60
|
let fieldsErrors: Record<string, any> = $state({});
|
|
59
61
|
const subCollections = ctx.meta.relations.filter((relation) => relation.to.collection === collectionName).map((relation) => relation.from.collection);
|
|
60
62
|
const subCollectionsValues: Record<string, any> = {};
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
async function handleSave() {
|
|
69
|
-
let localEntry = $state.snapshot(entry);
|
|
71
|
+
let localEntry = getChangedProperties(initialEntry, $state.snapshot(entry));
|
|
70
72
|
|
|
71
73
|
await emitEvent({ lobb, ctx }, "studio.collections.preCreate", {
|
|
72
74
|
collectionName,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import CodeEditor from "../codeEditor.svelte";
|
|
3
3
|
import RichTextEditor from "../richTextEditor.svelte";
|
|
4
|
+
import PasswordInput from "./passwordInput.svelte";
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
value: any;
|
|
@@ -23,4 +24,6 @@
|
|
|
23
24
|
<CodeEditor name={field.key} {...args} bind:value />
|
|
24
25
|
{:else if type === "richtext"}
|
|
25
26
|
<RichTextEditor name={field.key} bind:value />
|
|
27
|
+
{:else if type === "password"}
|
|
28
|
+
<PasswordInput bind:value {destructive} />
|
|
26
29
|
{/if}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Input from "../ui/input/input.svelte";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value: any;
|
|
6
|
+
destructive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { value = $bindable(), destructive }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const originalValue = value;
|
|
12
|
+
let displayValue = $state("");
|
|
13
|
+
|
|
14
|
+
function onInput(e: Event) {
|
|
15
|
+
const input = e.target as HTMLInputElement;
|
|
16
|
+
displayValue = input.value;
|
|
17
|
+
value = input.value || originalValue;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Input
|
|
22
|
+
type="password"
|
|
23
|
+
placeholder="••••••"
|
|
24
|
+
class="bg-muted/30 text-xs {destructive ? 'border-destructive bg-destructive/10' : ''}"
|
|
25
|
+
value={displayValue}
|
|
26
|
+
oninput={onInput}
|
|
27
|
+
/>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
const { ctx } = getStudioContext();
|
|
11
11
|
|
|
12
|
-
let
|
|
12
|
+
let coreReleaseDate: string | null = $state(null);
|
|
13
13
|
|
|
14
14
|
async function fetchReleaseDate(pkg: string, version: string): Promise<string | null> {
|
|
15
15
|
try {
|
|
@@ -23,28 +23,16 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
onMount(async () => {
|
|
26
|
-
|
|
27
|
-
fetchReleaseDate("@lobb-js/core", ctx.meta.version),
|
|
28
|
-
ctx.studioVersion ? fetchReleaseDate("@lobb-js/studio", ctx.studioVersion) : Promise.resolve(null),
|
|
29
|
-
]);
|
|
30
|
-
releaseDates = { core: coreDate, studio: studioDate };
|
|
26
|
+
coreReleaseDate = await fetchReleaseDate("@lobb-js/core", ctx.meta.version);
|
|
31
27
|
});
|
|
32
28
|
</script>
|
|
33
29
|
|
|
34
30
|
<div class="flex justify-end p-2 text-xs text-muted-foreground/50">
|
|
35
31
|
<div class="flex flex-col text-end gap-0.5">
|
|
36
|
-
{#if ctx.studioVersion}
|
|
37
|
-
<div>
|
|
38
|
-
studio: v{ctx.studioVersion}
|
|
39
|
-
{#if releaseDates.studio}
|
|
40
|
-
<span>({timeAgo.format(new Date(releaseDates.studio!))})</span>
|
|
41
|
-
{/if}
|
|
42
|
-
</div>
|
|
43
|
-
{/if}
|
|
44
32
|
<div>
|
|
45
33
|
core: v{ctx.meta.version}
|
|
46
|
-
{#if
|
|
47
|
-
<span>({timeAgo.format(new Date(
|
|
34
|
+
{#if coreReleaseDate}
|
|
35
|
+
<span>({timeAgo.format(new Date(coreReleaseDate))})</span>
|
|
48
36
|
{/if}
|
|
49
37
|
</div>
|
|
50
38
|
</div>
|
package/src/lib/store.types.ts
CHANGED
package/dist/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const STUDIO_VERSION: string;
|
package/dist/version.js
DELETED
package/src/lib/version.ts
DELETED