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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mountain-ui",
3
3
  "private": false,
4
- "version": "1.0.161",
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
- const valueFromActualEntry = entry[fromField.id] ?? null
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) => { return value},
38
+ computeBindings: (value, bindings) => {
39
+ return value
40
+ },
39
41
 
40
42
  formatter: (value) => value,
41
43
  parser: (value) => value,
@@ -32,7 +32,7 @@
32
32
  if (value === null) return;
33
33
 
34
34
  const decodedValue = JSON.parse(value);
35
- console.log(decodedValue);
35
+ // console.log(decodedValue);
36
36
 
37
37
  let newLines = [];
38
38
 
@@ -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
- type: 'lines',
13
+ type: 'lines',
14
14
 
15
- category_path: '',
15
+ category_path: '',
16
16
 
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.',
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
- is_hidden: false,
21
+ is_hidden: false,
22
22
 
23
- can_be_required: true,
24
- can_be_unique: true,
23
+ can_be_required: true,
24
+ can_be_unique: true,
25
25
 
26
- props: {},
26
+ props: {},
27
27
 
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
- },
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
- console.log(lineCtx);
86
- console.log(newLineCtx);
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
- formatter: (value) => value,
98
- parser: (value) => value,
97
+ formatter: (value) => value,
98
+ parser: (value) => value,
99
99
 
100
- validate: () => true
100
+ validate: () => true
101
101
  });
@@ -18,11 +18,11 @@
18
18
  multiple = false,
19
19
  display = false,
20
20
  bindings = [
21
- // {
22
- // elementFieldId: 0,
23
- // ctxFieldId:0
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
- console.log(value);
98
- if (value === null) {
99
-
100
- onChangeDetails(null);
101
- onChange(null);
102
- }
103
-
104
- // changer le ctx
105
- for (const bind of bindings) {
106
- const elementField = entityRegistry.getField(bind.elementFieldId,structure.id)
107
- if (!elementField) continue
108
- const value = lastRequest.data[elementField.normalized_name]?.flat ?? null
109
- // update la valeur dans le ctx
110
- changeCtx(bind.ctxFieldId, value)
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 "$lib/registry/projectRegistry/registry.svelte";
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
- type: 'link',
11
+ type: 'link',
12
12
 
13
- category_path: '',
13
+ category_path: '',
14
14
 
15
- label: 'Lien',
16
- description: "Lien vers un élément d'une autre structure.",
15
+ label: 'Lien',
16
+ description: "Lien vers un élément d'une autre structure.",
17
17
 
18
- is_hidden: false,
18
+ is_hidden: false,
19
19
 
20
- can_be_required: true,
21
- can_be_unique: true,
20
+ can_be_required: true,
21
+ can_be_unique: true,
22
22
 
23
- props: {},
23
+ props: {},
24
24
 
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
- },
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
- formatter: (value) => value,
40
- parser: (value) => value,
44
+ return value
45
+ },
41
46
 
42
- validate: () => true
47
+ formatter: (value) => value,
48
+ parser: (value) => value,
49
+
50
+ validate: () => true
43
51
  });
@@ -70,7 +70,7 @@
70
70
  }
71
71
 
72
72
  function handleDrop(e) {
73
- console.log(e.target);
73
+ // console.log(e.target);
74
74
 
75
75
  if (activeDrag == id) {
76
76
  return
@@ -119,7 +119,7 @@ export function createProject(config = {}) {
119
119
 
120
120
  const navigation = navigationRegistry.selectNavbarState()
121
121
 
122
- console.log(get(navigation));
122
+ // console.log(get(navigation));
123
123
 
124
124
 
125
125
  navigation.subscribe((val)=>{
@@ -7,10 +7,7 @@
7
7
 
8
8
  const viewProfil = $derived(viewEntriesProfilRegistry.select(id));
9
9
 
10
- $effect(()=>{
11
- console.log($viewProfil.props);
12
-
13
- })
10
+
14
11
  </script>
15
12
  {#if $viewProfil}
16
13
  {#key id}
@@ -36,7 +36,7 @@
36
36
  });
37
37
 
38
38
  onMount(() => {
39
- console.log();
39
+ // console.log();
40
40
 
41
41
  mounted = true;
42
42
  getColumnsFromStructureColumns($entity);
@@ -20,7 +20,7 @@
20
20
  }
21
21
 
22
22
  async function handleSave(data) {
23
- console.log(data);
23
+ // console.log(data);
24
24
 
25
25
  const request = await sendRequest({
26
26
  path: '/create-widget',
@@ -39,8 +39,12 @@
39
39
  });
40
40
 
41
41
  onMount(async () => {
42
- await loadSession()
43
- await registerProjects()
42
+ try {
43
+ await loadSession()
44
+ await registerProjects()
45
+ } catch (error) {
46
+
47
+ }
44
48
 
45
49
  isMount = true
46
50
  });