mountain-ui 1.0.47 → 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.
|
|
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",
|
|
@@ -55,21 +55,37 @@
|
|
|
55
55
|
|
|
56
56
|
function handleDeleteLine(lineIndex) {
|
|
57
57
|
table = table.filter((_, i) => i !== lineIndex);
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
81
|
+
if (!calculations[lineIndex]) {
|
|
82
|
+
calculations[lineIndex] = {};
|
|
83
|
+
}
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
calculations[lineIndex][config.id] = config;
|
|
70
86
|
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
178
|
+
registerCalculation={(config) => {
|
|
179
|
+
handleRegisterCalculation(lineIndex, config);
|
|
180
|
+
}}
|
|
164
181
|
></FieldInput>
|
|
165
182
|
{/each}
|
|
166
183
|
{#if columnIndex + 1 === columns.length}
|