mountain-ui 1.0.24 → 1.0.26
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.26",
|
|
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",
|
|
@@ -61,13 +61,16 @@
|
|
|
61
61
|
|
|
62
62
|
let calculations = $state({});
|
|
63
63
|
|
|
64
|
-
function handleRegisterCalculation(config) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
[config.id]: config
|
|
68
|
-
};
|
|
64
|
+
function handleRegisterCalculation(lineIndex, config) {
|
|
65
|
+
if (!calculations[lineIndex]) {
|
|
66
|
+
calculations[lineIndex] = {};
|
|
69
67
|
}
|
|
70
68
|
|
|
69
|
+
calculations[lineIndex][config.id] = config;
|
|
70
|
+
|
|
71
|
+
calculations = {...calculations};
|
|
72
|
+
}
|
|
73
|
+
|
|
71
74
|
function handleChange(lineIndex, fieldId, value) {
|
|
72
75
|
table[lineIndex].ctx[fieldId] = value;
|
|
73
76
|
|
|
@@ -112,7 +115,7 @@
|
|
|
112
115
|
|
|
113
116
|
function recalculate(lineIndex, changedFieldId) {
|
|
114
117
|
// on parcour les calcules et on verifie si un depend du champs changé
|
|
115
|
-
for (const calc of Object.values(calculations)) {
|
|
118
|
+
for (const calc of Object.values(calculations[lineIndex])) {
|
|
116
119
|
console.log(changedFieldId);
|
|
117
120
|
if (!calc.dependsOn.includes(changedFieldId)) continue;
|
|
118
121
|
|
|
@@ -154,7 +157,9 @@
|
|
|
154
157
|
}}
|
|
155
158
|
id={row.fieldId}
|
|
156
159
|
value={table[lineIndex].ctx?.[row.fieldId] ?? null}
|
|
157
|
-
registerCalculation={
|
|
160
|
+
registerCalculation={(config)=>{
|
|
161
|
+
handleRegisterCalculation(lineIndex, config);
|
|
162
|
+
}}
|
|
158
163
|
></FieldInput>
|
|
159
164
|
{/each}
|
|
160
165
|
{#if columnIndex + 1 === columns.length}
|