mountain-ui 1.0.68 → 1.0.70
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mountain-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.70",
|
|
5
5
|
"description": "A comprehensive UI component library for ERP systems with field types, entities, and registry management built with Svelte",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "index.js",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
...restProps
|
|
11
11
|
} = $props();
|
|
12
12
|
|
|
13
|
-
const entryAction = $derived(entryActionId ? entryActionRegistry.
|
|
13
|
+
const entryAction = $derived(entryActionId ? entryActionRegistry.select(entryActionId) : null);
|
|
14
14
|
|
|
15
|
-
let name = $derived(entryAction?.name ?? '');
|
|
16
|
-
let props = $derived(entryAction?.props ?? null);
|
|
15
|
+
let name = $derived($entryAction?.name ?? '');
|
|
16
|
+
let props = $derived($entryAction?.props ?? null);
|
|
17
17
|
|
|
18
18
|
function handleSubmit() {
|
|
19
19
|
let data = {
|
|
@@ -27,16 +27,18 @@
|
|
|
27
27
|
}
|
|
28
28
|
</script>
|
|
29
29
|
|
|
30
|
-
{#if
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<
|
|
35
|
-
|
|
30
|
+
{#if entryActionId}
|
|
31
|
+
{#if $entryAction && name && props}
|
|
32
|
+
<EntryActionProperties entryActionType={$entryAction.type} bind:name bind:props {...restProps}
|
|
33
|
+
></EntryActionProperties>
|
|
34
|
+
<Button onClick={handleSubmit}>
|
|
35
|
+
<h5>éditer</h5>
|
|
36
|
+
</Button>
|
|
37
|
+
{/if}
|
|
36
38
|
{:else}
|
|
37
39
|
<EntryActionProperties {entryActionType} bind:name bind:props {...restProps}
|
|
38
40
|
></EntryActionProperties>
|
|
39
|
-
|
|
41
|
+
<Button onClick={handleSubmit}>
|
|
40
42
|
<h5>créée</h5>
|
|
41
43
|
</Button>
|
|
42
44
|
{/if}
|
package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/Properties.svelte
CHANGED
|
@@ -7,20 +7,32 @@
|
|
|
7
7
|
import { fieldTypeRegistry } from '../../../fieldTypeRegistry/registry.svelte';
|
|
8
8
|
import { Button } from 'hamzus-ui';
|
|
9
9
|
import Binding from './component/Binding.svelte';
|
|
10
|
+
import { onMount } from 'svelte';
|
|
10
11
|
|
|
11
12
|
let {
|
|
12
13
|
props = $bindable({
|
|
13
14
|
fromEntityId: null,
|
|
14
15
|
toEntityId: null,
|
|
15
|
-
bindings: [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]
|
|
16
|
+
bindings: null //[
|
|
17
|
+
// {
|
|
18
|
+
// fromFieldId:null,
|
|
19
|
+
// toFieldId:null,
|
|
20
|
+
// bindings:[] // disponible lorsque il y a un type imbriquer comme line
|
|
21
|
+
// }
|
|
22
|
+
//]
|
|
22
23
|
}),
|
|
23
|
-
|
|
24
|
+
// props = $bindable({
|
|
25
|
+
// fromEntityId: null,
|
|
26
|
+
// toEntityId: null,
|
|
27
|
+
// bindings: null //[
|
|
28
|
+
// // {
|
|
29
|
+
// // fromFieldId:null,
|
|
30
|
+
// // toFieldId:null,
|
|
31
|
+
// // bindings:[] // disponible lorsque il y a un type imbriquer comme line
|
|
32
|
+
// // }
|
|
33
|
+
// //]
|
|
34
|
+
// }),
|
|
35
|
+
onChange = (props) => {}
|
|
24
36
|
} = $props();
|
|
25
37
|
|
|
26
38
|
let fromEntityId = $derived(props.fromEntityId);
|
|
@@ -29,17 +41,34 @@
|
|
|
29
41
|
const fromEntity = $derived(entityRegistry.get(fromEntityId));
|
|
30
42
|
const toEntity = $derived(entityRegistry.get(toEntityId));
|
|
31
43
|
|
|
44
|
+
let isMounted = $state(false);
|
|
45
|
+
|
|
46
|
+
onMount(()=>{
|
|
47
|
+
isMounted = true
|
|
48
|
+
})
|
|
49
|
+
|
|
32
50
|
$effect(() => {
|
|
51
|
+
const newProps = getProps(fromEntityId, toEntityId);
|
|
52
|
+
|
|
53
|
+
if (newProps === null) return
|
|
54
|
+
|
|
55
|
+
props = {...newProps}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function getProps() {
|
|
59
|
+
if (!isMounted && props.bindings !== null) {
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
|
|
33
63
|
let newProps = {
|
|
34
64
|
fromEntityId: fromEntityId,
|
|
35
65
|
toEntityId: toEntityId
|
|
36
66
|
};
|
|
37
67
|
if (!fromEntity) {
|
|
38
|
-
|
|
68
|
+
return {
|
|
39
69
|
...newProps,
|
|
40
70
|
bindings: []
|
|
41
71
|
};
|
|
42
|
-
return null;
|
|
43
72
|
}
|
|
44
73
|
|
|
45
74
|
let newBindings = [];
|
|
@@ -52,11 +81,11 @@
|
|
|
52
81
|
});
|
|
53
82
|
}
|
|
54
83
|
|
|
55
|
-
|
|
84
|
+
return {
|
|
56
85
|
...newProps,
|
|
57
86
|
bindings: [...newBindings]
|
|
58
87
|
};
|
|
59
|
-
}
|
|
88
|
+
}
|
|
60
89
|
|
|
61
90
|
function getBinding(fieldId) {
|
|
62
91
|
return props.bindings?.find((binding) => binding?.fromFieldId === fieldId);
|