mountain-ui 1.0.161 → 1.0.163
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 +1 -1
- package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/component/Binding.svelte +1 -1
- package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/component/BindingClone.svelte +1 -1
- package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/index.js +13 -1
- package/src/lib/registry/fieldTypeRegistry/createFieldType.js +3 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Input.svelte +1 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/index.js +42 -42
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Input/Input.svelte +19 -22
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/View.svelte +1 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/index.js +30 -22
- package/src/lib/registry/navigationRegistry/components/NavigationRow.svelte +1 -1
- package/src/lib/registry/projectRegistry/createProject.js +1 -1
- package/src/lib/registry/viewEntriesProfilRegistry/components/ViewEntriesProfilComponent.svelte +1 -4
- package/src/lib/registry/viewEntriesTypeRegistry/viewEntriesTypes/Table/component/StructureTable.svelte +1 -1
- package/src/lib/registry/widgetGroupRegistry/components/GroupPreview.svelte +1 -1
- package/src/routes/+layout.svelte +6 -2
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.163",
|
|
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",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
const toFieldType = $derived(fieldTypeRegistry.get(toField.type));
|
|
16
16
|
const toEntity = $derived.by(() => {
|
|
17
17
|
const childEntityId = toFieldType.getChildEntityId(toField);
|
|
18
|
-
console.log(childEntityId);
|
|
18
|
+
// console.log(childEntityId);
|
|
19
19
|
if (childEntityId) {
|
|
20
20
|
return entityRegistry.get(childEntityId);
|
|
21
21
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
const toFieldType = $derived(fieldTypeRegistry.get(toField.type));
|
|
16
16
|
const toEntity = $derived.by(() => {
|
|
17
17
|
const childEntityId = toFieldType.getChildEntityId(toField);
|
|
18
|
-
console.log(childEntityId);
|
|
18
|
+
// console.log(childEntityId);
|
|
19
19
|
if (childEntityId) {
|
|
20
20
|
return entityRegistry.get(childEntityId);
|
|
21
21
|
}
|
|
@@ -60,8 +60,20 @@ export function createNewCtxFromBinding(entity, entry, bindings) {
|
|
|
60
60
|
const fromField = entityRegistry.getField(binding.fromFieldId, entityField.entity_id)
|
|
61
61
|
const toField = entityRegistry.getField(binding.toFieldId)
|
|
62
62
|
if (!toField || toField.type === "primary") continue
|
|
63
|
+
|
|
64
|
+
// if (fromField.type === "primary" && toField.type === "link") {
|
|
65
|
+
// console.log("from + to");
|
|
66
|
+
// console.log(fromField);
|
|
67
|
+
// console.log(toField);
|
|
68
|
+
// console.log(bindings);
|
|
69
|
+
// console.log(entry);
|
|
70
|
+
// }
|
|
71
|
+
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
let valueFromActualEntry = entry[fromField.id] ?? null
|
|
74
|
+
if (fromField.type === "primary" && !valueFromActualEntry) {
|
|
75
|
+
valueFromActualEntry = entry.id ?? null;
|
|
76
|
+
}
|
|
65
77
|
|
|
66
78
|
// il faux peut etre altérer le binding du field en fonction de son type
|
|
67
79
|
const fromFieldType = fieldTypeRegistry.get(fromField.type)
|
|
@@ -35,7 +35,9 @@ export function createFieldType(config) {
|
|
|
35
35
|
getChildEntityId: (field) => { return null},
|
|
36
36
|
getChildsBindings: (field) => { return null},
|
|
37
37
|
getMoreFieldBindings: (field) => { return null},
|
|
38
|
-
computeBindings: (value, bindings) => {
|
|
38
|
+
computeBindings: (value, bindings) => {
|
|
39
|
+
return value
|
|
40
|
+
},
|
|
39
41
|
|
|
40
42
|
formatter: (value) => value,
|
|
41
43
|
parser: (value) => value,
|
|
@@ -10,49 +10,49 @@ import { entityRegistry } from '../../../entityRegistry/registry.svelte';
|
|
|
10
10
|
import { createNewCtxFromBinding } from '../../../entryActionTypeRegistry/entryActionTypes/PrefillNewEntry';
|
|
11
11
|
|
|
12
12
|
export default createFieldType({
|
|
13
|
-
|
|
13
|
+
type: 'lines',
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
category_path: '',
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
label: 'Lignes',
|
|
18
|
+
description:
|
|
19
|
+
'Liste de lignes de données, généralement utilisées pour représenter des sous-éléments ou des sous-formulaires.',
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
is_hidden: false,
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
can_be_required: true,
|
|
24
|
+
can_be_unique: true,
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
props: {},
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
components: {
|
|
29
|
+
icon: Icon,
|
|
30
|
+
button: Button,
|
|
31
|
+
card: Card,
|
|
32
|
+
input: Input,
|
|
33
|
+
tableView: TableView,
|
|
34
|
+
view: View,
|
|
35
|
+
filter: null,
|
|
36
|
+
properties: null
|
|
37
|
+
},
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
allowBindings:["lines"],
|
|
41
|
-
getChildsBindings:(field)=>{
|
|
40
|
+
allowBindings: ["lines"],
|
|
41
|
+
getChildsBindings: (field) => {
|
|
42
42
|
if (!field.props.linkId) return null;
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
const lineEntity = entityRegistry.get(field.props.linkId)
|
|
45
45
|
|
|
46
|
-
return lineEntity.fields.map(f=>f.id)
|
|
46
|
+
return lineEntity.fields.map(f => f.id)
|
|
47
47
|
},
|
|
48
|
-
getChildEntityId:(field)=>{
|
|
48
|
+
getChildEntityId: (field) => {
|
|
49
49
|
if (!field.props.linkId) return null;
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
return parseInt(field.props.linkId)
|
|
52
52
|
},
|
|
53
|
-
getMoreFieldBindings:(field)=>{
|
|
53
|
+
getMoreFieldBindings: (field) => {
|
|
54
54
|
if (!field.props.columns) return null;
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
let allFieldIds = []
|
|
57
57
|
|
|
58
58
|
for (const column of field.props.columns) {
|
|
@@ -63,39 +63,39 @@ export default createFieldType({
|
|
|
63
63
|
|
|
64
64
|
return allFieldIds
|
|
65
65
|
},
|
|
66
|
-
computeBindings:(value, field, bindings)=>{
|
|
66
|
+
computeBindings: (value, field, bindings) => {
|
|
67
67
|
if (!value) return value;
|
|
68
68
|
if (!field.props.linkId) return value;
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
|
|
71
71
|
const lineEntity = entityRegistry.get(field.props.linkId)
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
if (!lineEntity) return value;
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
const lines = JSON.parse(value)
|
|
76
76
|
|
|
77
|
-
console.log("tyext");
|
|
78
|
-
console.log(lines);
|
|
77
|
+
// console.log("tyext");
|
|
78
|
+
// console.log(lines);
|
|
79
79
|
let newLines = []
|
|
80
80
|
|
|
81
81
|
for (const lineCtx of lines) {
|
|
82
82
|
const newLineCtx = createNewCtxFromBinding(lineEntity, lineCtx, bindings)
|
|
83
|
-
console.log("comp");
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
// console.log("comp");
|
|
84
|
+
|
|
85
|
+
// console.log(lineCtx);
|
|
86
|
+
// console.log(newLineCtx);
|
|
87
87
|
|
|
88
88
|
newLines.push(newLineCtx)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
|
|
93
93
|
return JSON.stringify(newLines)
|
|
94
94
|
},
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
formatter: (value) => value,
|
|
98
|
+
parser: (value) => value,
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
validate: () => true
|
|
101
101
|
});
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
multiple = false,
|
|
19
19
|
display = false,
|
|
20
20
|
bindings = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// {
|
|
22
|
+
// elementFieldId: 0,
|
|
23
|
+
// ctxFieldId:0
|
|
24
|
+
// }
|
|
25
|
+
],
|
|
26
26
|
name = null,
|
|
27
27
|
value = null,
|
|
28
28
|
onChangeDetails = () => {},
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
async function getElement(data) {
|
|
70
|
-
|
|
71
70
|
if (!data?.id) {
|
|
72
71
|
return;
|
|
73
72
|
}
|
|
@@ -81,7 +80,6 @@
|
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
82
|
|
|
84
|
-
|
|
85
83
|
onChangeDetails(lastRequest.data ?? null);
|
|
86
84
|
onChange(lastRequest.data.id.flat ?? null);
|
|
87
85
|
|
|
@@ -94,21 +92,20 @@
|
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
function handleChange(value) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
95
|
+
// console.log(value);
|
|
96
|
+
if (value === null) {
|
|
97
|
+
onChangeDetails(null);
|
|
98
|
+
onChange(null);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// changer le ctx
|
|
102
|
+
for (const bind of bindings) {
|
|
103
|
+
const elementField = entityRegistry.getField(bind.elementFieldId, structure.id);
|
|
104
|
+
if (!elementField) continue;
|
|
105
|
+
const value = lastRequest.data[elementField.normalized_name]?.flat ?? null;
|
|
106
|
+
// update la valeur dans le ctx
|
|
107
|
+
changeCtx(bind.ctxFieldId, value);
|
|
108
|
+
}
|
|
112
109
|
}
|
|
113
110
|
</script>
|
|
114
111
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import Label from "../../components/Label.svelte";
|
|
6
6
|
import ViewText from "../../components/ViewText.svelte";
|
|
7
7
|
import LineView from "../../components/LineView.svelte";
|
|
8
|
-
import { projectRegistry } from "
|
|
8
|
+
import { projectRegistry } from "../../../projectRegistry/registry.svelte";
|
|
9
9
|
|
|
10
10
|
let {value, compact, unique, secret, label, required} = $props()
|
|
11
11
|
|
|
@@ -8,36 +8,44 @@ import TableView from './TableView.svelte';
|
|
|
8
8
|
import View from './View.svelte';
|
|
9
9
|
|
|
10
10
|
export default createFieldType({
|
|
11
|
-
|
|
11
|
+
type: 'link',
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
category_path: '',
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
label: 'Lien',
|
|
16
|
+
description: "Lien vers un élément d'une autre structure.",
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
is_hidden: false,
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
can_be_required: true,
|
|
21
|
+
can_be_unique: true,
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
props: {},
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
components: {
|
|
26
|
+
icon: Icon,
|
|
27
|
+
button: Button,
|
|
28
|
+
card: Card,
|
|
29
|
+
input: Input,
|
|
30
|
+
tableView: TableView,
|
|
31
|
+
view: View,
|
|
32
|
+
filter: null,
|
|
33
|
+
properties: null
|
|
34
|
+
},
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
allowBindings:["link", "text", "number"],
|
|
37
|
+
allowBindings: ["link", "text", "number"],
|
|
38
|
+
computeBindings: (value, bindings) => {
|
|
39
|
+
// console.log("val : ");
|
|
40
|
+
// console.log(value);
|
|
41
|
+
// console.log("bindings : ");
|
|
42
|
+
// console.log(bindings);
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
return value
|
|
45
|
+
},
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
formatter: (value) => value,
|
|
48
|
+
parser: (value) => value,
|
|
49
|
+
|
|
50
|
+
validate: () => true
|
|
43
51
|
});
|