mountain-ui 1.0.46 → 1.0.48

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.46",
4
+ "version": "1.0.48",
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",
@@ -76,7 +76,7 @@
76
76
  "vitest-browser-svelte": "^2.1.1"
77
77
  },
78
78
  "dependencies": {
79
- "hamzus-ui": "^0.0.259"
79
+ "hamzus-ui": "^0.0.261"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=18.0.0"
@@ -55,21 +55,37 @@
55
55
 
56
56
  function handleDeleteLine(lineIndex) {
57
57
  table = table.filter((_, i) => i !== lineIndex);
58
- onChangeDetails(table)
59
- handleChange();
58
+ table = [...table];
59
+
60
+ onChangeDetails(table);
61
+ const newValue = JSON.stringify(
62
+ table.map((line) => {
63
+ const data = {
64
+ ...line.ctx
65
+ };
66
+
67
+ if (line.dbId != null) {
68
+ data.id = line.dbId;
69
+ }
70
+
71
+ return data;
72
+ })
73
+ );
74
+
75
+ onChange(newValue);
60
76
  }
61
77
 
62
78
  let calculations = $state({});
63
79
 
64
80
  function handleRegisterCalculation(lineIndex, config) {
65
- if (!calculations[lineIndex]) {
66
- calculations[lineIndex] = {};
67
- }
81
+ if (!calculations[lineIndex]) {
82
+ calculations[lineIndex] = {};
83
+ }
68
84
 
69
- calculations[lineIndex][config.id] = config;
85
+ calculations[lineIndex][config.id] = config;
70
86
 
71
- calculations = {...calculations};
72
- }
87
+ calculations = { ...calculations };
88
+ }
73
89
 
74
90
  function handleChange(lineIndex, fieldId, value) {
75
91
  table[lineIndex].ctx[fieldId] = value;
@@ -109,12 +125,11 @@
109
125
 
110
126
  table = [...table];
111
127
 
112
-
113
128
  onChangeDetails(table);
114
129
  }
115
130
 
116
131
  function recalculate(lineIndex, changedFieldId) {
117
- if (!calculations[lineIndex]) return
132
+ if (!calculations[lineIndex]) return;
118
133
  // on parcour les calcules et on verifie si un depend du champs changé
119
134
  for (const calc of Object.values(calculations[lineIndex])) {
120
135
  if (!calc.dependsOn.includes(changedFieldId)) continue;
@@ -155,12 +170,14 @@
155
170
  onChange={(value) => {
156
171
  handleChange(lineIndex, row.fieldId, value);
157
172
  }}
158
- changeCtx={(fieldId, value)=>{handleChange(lineIndex, fieldId, value)}}
173
+ changeCtx={(fieldId, value) => {
174
+ handleChange(lineIndex, fieldId, value);
175
+ }}
159
176
  id={row.fieldId}
160
177
  value={table[lineIndex].ctx?.[row.fieldId] ?? null}
161
- registerCalculation={(config)=>{
162
- handleRegisterCalculation(lineIndex, config);
163
- }}
178
+ registerCalculation={(config) => {
179
+ handleRegisterCalculation(lineIndex, config);
180
+ }}
164
181
  ></FieldInput>
165
182
  {/each}
166
183
  {#if columnIndex + 1 === columns.length}
@@ -94,7 +94,9 @@
94
94
  }
95
95
 
96
96
  function handleChange(value) {
97
+ console.log(value);
97
98
  if (value === null) {
99
+
98
100
  onChangeDetails(null);
99
101
  onChange(null);
100
102
  }