mountain-ui 1.0.75 → 1.0.77

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.75",
4
+ "version": "1.0.77",
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,6 +10,23 @@
10
10
 
11
11
  const entity = $derived(entityRegistry.select(entityId));
12
12
 
13
+ let initialized = $state(false);
14
+
15
+ $effect(() => {
16
+ if (!initialized && Object.keys(calculations).length > 0) {
17
+ initialized = true;
18
+ recalculateAll();
19
+ }
20
+ });
21
+
22
+ function recalculateAll() {
23
+ for (const calc of Object.values(calculations)) {
24
+ calc.calculate(ctx);
25
+ }
26
+
27
+ ctx = { ...ctx };
28
+ }
29
+
13
30
  function handleSubmit() {
14
31
  onSubmit({ ...ctx });
15
32
  }
@@ -33,14 +50,14 @@
33
50
  function handleChangeDetails(fieldId, value) {
34
51
  detailsCtx[fieldId] = value;
35
52
 
36
- // si c est un type lien alors on parcour ses champs enfant et on reagis
37
- const field = entityRegistry.getField(fieldId, entity.id)
38
- if (field.type === "link") {
39
- const entity = entityRegistry.get(field.props.linkId)
40
- for (const linkedFields of entity.fields) {
41
- recalculate(linkedFields.id)
42
- }
43
- }
53
+ // si c est un type lien alors on parcour ses champs enfant et on reagis
54
+ const field = entityRegistry.getField(fieldId, entity.id);
55
+ if (field.type === 'link') {
56
+ const entity = entityRegistry.get(field.props.linkId);
57
+ for (const linkedFields of entity.fields) {
58
+ recalculate(linkedFields.id);
59
+ }
60
+ }
44
61
 
45
62
  detailsCtx = { ...detailsCtx };
46
63
  }
@@ -89,7 +106,7 @@
89
106
  display: flex;
90
107
  flex-direction: column;
91
108
  align-items: center;
92
- width: 100%;
109
+ width: 100%;
93
110
  }
94
111
 
95
112
  .button {
@@ -30,7 +30,7 @@
30
30
  bindings: []
31
31
  };
32
32
 
33
- const field = entityRegistry.getField(toFieldId);
33
+ const field = entityRegistry.getField(fromFieldId);
34
34
  const fieldType = fieldTypeRegistry.get(field.type);
35
35
 
36
36
  // verifier si il y a du bindings
@@ -64,6 +64,8 @@
64
64
 
65
65
  for (const allowedBind of allowedTypes) {
66
66
  if (field.type.startsWith(allowedBind)) {
67
+ console.log(field.entity_id);
68
+
67
69
  return true;
68
70
  }
69
71
  }
@@ -32,6 +32,8 @@ console.log(props);
32
32
 
33
33
  const field = entityRegistry.getField(toFieldId);
34
34
  const fieldType = fieldTypeRegistry.get(field.type);
35
+ console.log(field.type);
36
+ console.log(field.name);
35
37
 
36
38
  // verifier si il y a du bindings
37
39
  const childFieldIds = fieldType.getChildsBindings(field);