@lobb-js/studio 0.9.3 → 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/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/package.json +1 -1
- 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
|
@@ -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
|
+
/>
|
package/package.json
CHANGED
|
@@ -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
|
+
/>
|