mountain-ui 1.0.12 → 1.0.13
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.13",
|
|
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",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { entityRegistry } from '../../../entityRegistry/registry.svelte.js';
|
|
4
4
|
import { Button, IconButton, ResponsiveTable } from 'hamzus-ui';
|
|
5
5
|
import Label from '../../components/Label.svelte';
|
|
6
|
+
import { onMount } from 'svelte';
|
|
6
7
|
|
|
7
8
|
let {
|
|
8
9
|
value = $bindable(null),
|
|
@@ -18,15 +19,32 @@
|
|
|
18
19
|
...props
|
|
19
20
|
} = $props();
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
let table = $state([createLine()]);
|
|
24
|
+
|
|
25
|
+
onMount(()=>{
|
|
26
|
+
if (value === null) return
|
|
27
|
+
|
|
28
|
+
const decodedValue = JSON.parse(value)
|
|
29
|
+
|
|
30
|
+
let newLines = []
|
|
31
|
+
|
|
32
|
+
for (const line of decodedValue) {
|
|
33
|
+
newLines.push(createLine(line.id, line))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
table = [...newLines]
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
function createLine(dbId = null, line = null) {
|
|
22
40
|
return {
|
|
23
41
|
id: crypto.randomUUID(),
|
|
24
|
-
|
|
42
|
+
dbId:dbId,
|
|
43
|
+
ctx: line??{},
|
|
25
44
|
detailsCtx: {}
|
|
26
45
|
};
|
|
27
46
|
}
|
|
28
47
|
|
|
29
|
-
let table = $state([createLine()]);
|
|
30
48
|
|
|
31
49
|
function handleAddLine() {
|
|
32
50
|
table = [...table, createLine()];
|
|
@@ -43,7 +61,15 @@
|
|
|
43
61
|
onChangeDetails(table);
|
|
44
62
|
}
|
|
45
63
|
function handleChange() {
|
|
46
|
-
const value = JSON.stringify(table.map((line) =>
|
|
64
|
+
const value = JSON.stringify(table.map((line) => {
|
|
65
|
+
const data = {
|
|
66
|
+
...line.ctx,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (line.dbId) data['id'] = line.dbId
|
|
70
|
+
|
|
71
|
+
return data
|
|
72
|
+
} ));
|
|
47
73
|
|
|
48
74
|
onChange(value);
|
|
49
75
|
}
|