mountain-ui 1.0.68 → 1.0.69

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.68",
4
+ "version": "1.0.69",
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",
@@ -28,15 +28,17 @@
28
28
  </script>
29
29
 
30
30
  {#if entryAction}
31
- <EntryActionProperties entryActionType={entryAction.type} bind:name bind:props {...restProps}
32
- ></EntryActionProperties>
33
- <Button onClick={handleSubmit}>
34
- <h5>éditer</h5>
35
- </Button>
31
+ {#if 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
- <Button onClick={handleSubmit}>
41
+ <Button onClick={handleSubmit}>
40
42
  <h5>créée</h5>
41
43
  </Button>
42
44
  {/if}
@@ -7,20 +7,21 @@
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
- // fromFieldId:null,
18
- // toFieldId:null,
19
- // bindings:[] // disponible lorsque il y a un type imbriquer comme line
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
- onChange = (props)=>{}
24
+ onChange = (props) => {}
24
25
  } = $props();
25
26
 
26
27
  let fromEntityId = $derived(props.fromEntityId);
@@ -29,17 +30,30 @@
29
30
  const fromEntity = $derived(entityRegistry.get(fromEntityId));
30
31
  const toEntity = $derived(entityRegistry.get(toEntityId));
31
32
 
33
+ let isMounted = $state(false);
34
+
35
+ onMount(()=>{
36
+ isMounted = true
37
+ })
38
+
32
39
  $effect(() => {
40
+ props = getProps(fromEntityId, toEntityId);
41
+ });
42
+
43
+ function getProps() {
44
+ if (!isMounted && props.bindings !== null) {
45
+ return props
46
+ }
47
+
33
48
  let newProps = {
34
49
  fromEntityId: fromEntityId,
35
50
  toEntityId: toEntityId
36
51
  };
37
52
  if (!fromEntity) {
38
- props = {
53
+ return {
39
54
  ...newProps,
40
55
  bindings: []
41
56
  };
42
- return null;
43
57
  }
44
58
 
45
59
  let newBindings = [];
@@ -52,11 +66,11 @@
52
66
  });
53
67
  }
54
68
 
55
- props = {
69
+ return {
56
70
  ...newProps,
57
71
  bindings: [...newBindings]
58
72
  };
59
- });
73
+ }
60
74
 
61
75
  function getBinding(fieldId) {
62
76
  return props.bindings?.find((binding) => binding?.fromFieldId === fieldId);