mountain-ui 1.0.28 → 1.0.30

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.
Files changed (103) hide show
  1. package/package.json +1 -1
  2. package/src/lib/registry/entityRegistry/components/EntityPage.svelte +158 -0
  3. package/src/lib/registry/entityRegistry/components/FieldTableView.svelte +23 -0
  4. package/src/lib/registry/entityRegistry/components/FieldView.svelte +24 -0
  5. package/src/lib/registry/entityRegistry/createEntity.js +2 -0
  6. package/src/lib/registry/fieldTypeRegistry/components/FieldTypeTableView.svelte +11 -0
  7. package/src/lib/registry/fieldTypeRegistry/components/FieldTypeView.svelte +11 -0
  8. package/src/lib/registry/fieldTypeRegistry/components/LineView.svelte +33 -0
  9. package/src/lib/registry/fieldTypeRegistry/components/ViewText.svelte +5 -0
  10. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/View.svelte +61 -0
  11. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/TableView.svelte +8 -0
  12. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/View.svelte +19 -0
  13. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/index.js +4 -1
  14. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/TableView.svelte +8 -0
  15. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/View.svelte +15 -0
  16. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/index.js +4 -1
  17. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/TableView.svelte +8 -0
  18. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/View.svelte +52 -0
  19. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/index.js +4 -1
  20. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/Button.svelte +8 -0
  21. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/Card.svelte +6 -0
  22. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/Icon.svelte +30 -0
  23. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/Input.svelte +153 -0
  24. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/TableView.svelte +8 -0
  25. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/View.svelte +52 -0
  26. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/index.js +41 -0
  27. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/TableView.svelte +28 -0
  28. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/View.svelte +31 -0
  29. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/index.js +4 -1
  30. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/TableView.svelte +13 -0
  31. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/View.svelte +18 -0
  32. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/index.js +4 -1
  33. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/TableView.svelte +8 -0
  34. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/View.svelte +12 -0
  35. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/index.js +4 -1
  36. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/TableView.svelte +8 -0
  37. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/View.svelte +12 -0
  38. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/index.js +4 -1
  39. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/TableView.svelte +8 -0
  40. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/View.svelte +12 -0
  41. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/index.js +4 -1
  42. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/TableView.svelte +8 -0
  43. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/View.svelte +12 -0
  44. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/index.js +4 -1
  45. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/TableView.svelte +8 -0
  46. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/View.svelte +12 -0
  47. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/index.js +4 -1
  48. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/TableView.svelte +8 -0
  49. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/View.svelte +12 -0
  50. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/index.js +4 -1
  51. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/TableView.svelte +8 -0
  52. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/View.svelte +13 -0
  53. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/index.js +4 -1
  54. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/TableView.svelte +8 -0
  55. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/View.svelte +12 -0
  56. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/index.js +4 -1
  57. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/TableView.svelte +8 -0
  58. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/View.svelte +13 -0
  59. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/index.js +4 -1
  60. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/TableView.svelte +8 -0
  61. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/View.svelte +24 -0
  62. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/index.js +4 -1
  63. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/TableView.svelte +9 -0
  64. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/View.svelte +13 -0
  65. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/index.js +4 -1
  66. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/TableView.svelte +9 -0
  67. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/View.svelte +13 -0
  68. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/index.js +4 -1
  69. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/TableView.svelte +9 -0
  70. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/View.svelte +13 -0
  71. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/index.js +4 -1
  72. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/TableView.svelte +8 -0
  73. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/View.svelte +12 -0
  74. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/index.js +4 -1
  75. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/TableView.svelte +8 -0
  76. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/View.svelte +12 -0
  77. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/index.js +4 -1
  78. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/TableView.svelte +8 -0
  79. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/View.svelte +12 -0
  80. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/index.js +4 -1
  81. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/TableView.svelte +8 -0
  82. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/View.svelte +12 -0
  83. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/index.js +4 -1
  84. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/TableView.svelte +9 -0
  85. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/View.svelte +13 -0
  86. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/index.js +4 -1
  87. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/TableView.svelte +8 -0
  88. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/View.svelte +12 -0
  89. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/index.js +4 -1
  90. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/formatDate.js +155 -0
  91. package/src/lib/registry/fieldTypeRegistry/registerDefaultFieldTypes.js +2 -0
  92. package/src/lib/registry/viewTypeRegistry/components/ViewTypeButton.svelte +27 -0
  93. package/src/lib/registry/viewTypeRegistry/components/ViewTypeComponent.svelte +30 -0
  94. package/src/lib/registry/viewTypeRegistry/createViewType.js +17 -0
  95. package/src/lib/registry/viewTypeRegistry/registerDefaultViewTypes.js +7 -0
  96. package/src/lib/registry/viewTypeRegistry/registry.svelte.js +44 -0
  97. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/Icon.svelte +16 -0
  98. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component copy.svelte +11 -0
  99. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component.svelte +12 -0
  100. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/StructureTable.svelte +287 -0
  101. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/index.js +14 -0
  102. package/src/routes/+layout.svelte +31 -1
  103. package/src/routes/+page.svelte +22 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mountain-ui",
3
3
  "private": false,
4
- "version": "1.0.28",
4
+ "version": "1.0.30",
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",
@@ -0,0 +1,158 @@
1
+ <script>
2
+ import { onMount } from 'svelte';
3
+ import { entityRegistry } from '../registry.svelte';
4
+ import FieldView from './FieldView.svelte';
5
+ import { sendRequest } from 'hamzus-ui';
6
+
7
+ let { entityId, entryId, children } = $props();
8
+
9
+ let ctx = $state(null);
10
+
11
+ let mounted = false;
12
+
13
+ const entity = entityRegistry.select(entityId);
14
+
15
+ $effect(() => {
16
+ getData(entityId, entryId);
17
+ });
18
+
19
+ onMount(() => {
20
+ getData(entityId, entryId, true);
21
+ });
22
+
23
+ async function getData(entityId, entryId, isMounting = false) {
24
+ if (!isMounting && !mounted) return;
25
+
26
+ const request = await sendRequest({
27
+ path: '/get-entry',
28
+ data: {
29
+ entityId: entityId,
30
+ entryId: entryId,
31
+ idMode: true
32
+ }
33
+ });
34
+
35
+ if (request.statusType === 'error') {
36
+ if (request.statusCode === 403) {
37
+ ctx = 403;
38
+ } else {
39
+ ctx = 'error';
40
+ }
41
+ toast.error({
42
+ title: 'Erreur !',
43
+ description: request.message
44
+ });
45
+ return;
46
+ }
47
+
48
+ ctx = request.data;
49
+ console.log(ctx);
50
+ console.log($entity);
51
+
52
+ mounted = true;
53
+ }
54
+ </script>
55
+
56
+ {#if ctx !== null}
57
+ {#if ctx === 403}
58
+ <div class="error">
59
+ <svg
60
+ width="24"
61
+ height="24"
62
+ viewBox="0 0 24 24"
63
+ fill="none"
64
+ xmlns="http://www.w3.org/2000/svg"
65
+ >
66
+ <path
67
+ opacity="0.4"
68
+ d="M10.9608 2.10989L5.46078 4.16989C4.41078 4.56989 3.55078 5.80989 3.55078 6.93989V15.0399C3.55078 15.8499 4.08078 16.9199 4.73078 17.3999L10.2308 21.5099C11.2008 22.2399 12.7908 22.2399 13.7608 21.5099L19.2608 17.3999C19.9108 16.9099 20.4408 15.8499 20.4408 15.0399V6.93989C20.4408 5.81989 19.5808 4.56988 18.5308 4.17988L13.0308 2.11989C12.4708 1.89989 11.5308 1.89989 10.9608 2.10989Z"
69
+ fill="#292D32"
70
+ />
71
+ <path
72
+ d="M14.5 10.5C14.5 9.12 13.38 8 12 8C10.62 8 9.5 9.12 9.5 10.5C9.5 11.62 10.24 12.55 11.25 12.87V15.5C11.25 15.91 11.59 16.25 12 16.25C12.41 16.25 12.75 15.91 12.75 15.5V12.87C13.76 12.55 14.5 11.62 14.5 10.5Z"
73
+ fill="#292D32"
74
+ />
75
+ </svg>
76
+
77
+ <h3>Vous n'avez pas accès a cet ressource</h3>
78
+ <p>Vous ne pouvez pas consulté les element lié a cette entité !</p>
79
+ </div>
80
+ {:else if ctx === 'error'}
81
+ <div class="error">
82
+ <svg
83
+ width="24"
84
+ height="24"
85
+ viewBox="0 0 24 24"
86
+ fill="none"
87
+ xmlns="http://www.w3.org/2000/svg"
88
+ >
89
+ <path
90
+ opacity="0.4"
91
+ d="M21.7605 15.92L15.3605 4.4C14.5005 2.85 13.3105 2 12.0005 2C10.6905 2 9.50047 2.85 8.64047 4.4L2.24047 15.92C1.43047 17.39 1.34047 18.8 1.99047 19.91C2.64047 21.02 3.92047 21.63 5.60047 21.63H18.4005C20.0805 21.63 21.3605 21.02 22.0105 19.91C22.6605 18.8 22.5705 17.38 21.7605 15.92Z"
92
+ fill="#292D32"
93
+ />
94
+ <path
95
+ d="M12 14.75C11.59 14.75 11.25 14.41 11.25 14V9C11.25 8.59 11.59 8.25 12 8.25C12.41 8.25 12.75 8.59 12.75 9V14C12.75 14.41 12.41 14.75 12 14.75Z"
96
+ fill="#292D32"
97
+ />
98
+ <path
99
+ d="M12 18.0001C11.94 18.0001 11.87 17.9901 11.8 17.9801C11.74 17.9701 11.68 17.9501 11.62 17.9201C11.56 17.9001 11.5 17.8701 11.44 17.8301C11.39 17.7901 11.34 17.7501 11.29 17.7101C11.11 17.5201 11 17.2601 11 17.0001C11 16.7401 11.11 16.4801 11.29 16.2901C11.34 16.2501 11.39 16.2101 11.44 16.1701C11.5 16.1301 11.56 16.1001 11.62 16.0801C11.68 16.0501 11.74 16.0301 11.8 16.0201C11.93 15.9901 12.07 15.9901 12.19 16.0201C12.26 16.0301 12.32 16.0501 12.38 16.0801C12.44 16.1001 12.5 16.1301 12.56 16.1701C12.61 16.2101 12.66 16.2501 12.71 16.2901C12.89 16.4801 13 16.7401 13 17.0001C13 17.2601 12.89 17.5201 12.71 17.7101C12.66 17.7501 12.61 17.7901 12.56 17.8301C12.5 17.8701 12.44 17.9001 12.38 17.9201C12.32 17.9501 12.26 17.9701 12.19 17.9801C12.13 17.9901 12.06 18.0001 12 18.0001Z"
100
+ fill="#292D32"
101
+ />
102
+ </svg>
103
+
104
+ <h3>Une erreur est survenue !</h3>
105
+ <p>Impossible de récuperer l'entrée !</p>
106
+ </div>
107
+ {:else}
108
+ {@const primaryField = $entity.getPrimaryField()}
109
+ <div class="form">
110
+ <div class="title">
111
+ <h1>{$entity.symbol}{ctx?.[primaryField.id].flat}</h1>
112
+ {#if children}
113
+ {@render children()}
114
+ {/if}
115
+ </div>
116
+ {#each $entity.fields as field}
117
+ <FieldView id={field.id} entityId={$entity.id} value={ctx?.[field.id] ?? null}></FieldView>
118
+ {/each}
119
+ </div>
120
+ {/if}
121
+ {/if}
122
+
123
+ <style>
124
+ .loader {
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: center;
128
+ padding: 60px var(--pad-m);
129
+ }
130
+
131
+ .error {
132
+ padding: 60px var(--pad-m);
133
+ display: flex;
134
+ flex-direction: column;
135
+ align-items: center;
136
+ row-gap: var(--pad-m);
137
+ }
138
+ .error > svg {
139
+ width: 60px;
140
+ height: auto;
141
+ }
142
+ .error > svg path {
143
+ fill: var(--red);
144
+ }
145
+ .title {
146
+ display: flex;
147
+ align-items: center;
148
+ justify-content: space-between;
149
+ width: min(100%, 900px);
150
+ margin-bottom: 20px;
151
+ }
152
+
153
+ .form {
154
+ display: flex;
155
+ flex-direction: column;
156
+ align-items: center;
157
+ }
158
+ </style>
@@ -0,0 +1,23 @@
1
+ <script>
2
+ import FieldTypeTableView from '$lib/registry/fieldTypeRegistry/components/FieldTypeTableView.svelte';
3
+ import { entityRegistry } from '../registry.svelte';
4
+
5
+ let { id, value, entityId = null, onChange = () => {}, onChangeDetails = () => {}, ...props } = $props();
6
+
7
+ const field = entityRegistry.selectField(id, entityId);
8
+ </script>
9
+
10
+ {#if $field}
11
+ <FieldTypeTableView
12
+ {...props}
13
+ id={$field.id}
14
+ value={value}
15
+ entity_id={$field.entity_id}
16
+ label={$field.name}
17
+ {...$field.props}
18
+ type={$field.type}
19
+ required={$field.is_required}
20
+ secret={$field.is_secret}
21
+ unique={$field.is_unique}
22
+ ></FieldTypeTableView>
23
+ {/if}
@@ -0,0 +1,24 @@
1
+ <script>
2
+ import FieldTypeView from '$lib/registry/fieldTypeRegistry/components/FieldTypeView.svelte';
3
+ import { entityRegistry } from '../registry.svelte';
4
+
5
+ let { id, value, entityId = null, onChange = () => {}, onChangeDetails = () => {}, ...props } = $props();
6
+
7
+ const field = entityRegistry.selectField(id, entityId);
8
+
9
+ </script>
10
+
11
+ {#if $field}
12
+ <FieldTypeView
13
+ {...props}
14
+ id={$field.id}
15
+ value={value}
16
+ entity_id={$field.entity_id}
17
+ label={$field.name}
18
+ {...$field.props}
19
+ type={$field.type}
20
+ required={$field.is_required}
21
+ secret={$field.is_secret}
22
+ unique={$field.is_unique}
23
+ ></FieldTypeView>
24
+ {/if}
@@ -34,5 +34,7 @@ export function createEntity(config = {}) {
34
34
 
35
35
  entity.getField = (id) => entity.fields.find((field) => field.id === id);
36
36
 
37
+ entity.getPrimaryField = () => entity.fields.find((field) => field.type === "primary");
38
+
37
39
  return entity;
38
40
  }
@@ -0,0 +1,11 @@
1
+ <script>
2
+ import { fieldTypeRegistry } from '../registry.svelte';
3
+
4
+ let { type, value, ...props } = $props();
5
+
6
+ const field = fieldTypeRegistry.select(type);
7
+ </script>
8
+
9
+ {#if $field}
10
+ <svelte:component this={$field.components.tableView} {value} {...props} field={$field}></svelte:component>
11
+ {/if}
@@ -0,0 +1,11 @@
1
+ <script>
2
+ import { fieldTypeRegistry } from '../registry.svelte';
3
+
4
+ let { type, value, ...props } = $props();
5
+
6
+ const field = fieldTypeRegistry.select(type);
7
+ </script>
8
+
9
+ {#if $field}
10
+ <svelte:component this={$field.components.view} {...props} {value} field={$field}></svelte:component>
11
+ {/if}
@@ -0,0 +1,33 @@
1
+ <script>
2
+ let { children, compact = false } = $props();
3
+ </script>
4
+
5
+ <div class="line" class:compact>
6
+ {@render children()}
7
+ </div>
8
+
9
+ <style>
10
+ .line {
11
+ display: grid;
12
+ grid-template-columns: 170px 1fr ;
13
+ width: min(100%, 900px);
14
+ padding: var(--pad-s);
15
+ gap: var(--pad-s);
16
+ align-items: center;
17
+ }
18
+
19
+ .line:not(:last-of-type) {
20
+ border-bottom: 1px solid var(--stroke);
21
+ }
22
+
23
+ @media (max-width: 500px) {
24
+ .line {
25
+ grid-template-columns: 1fr;
26
+ }
27
+ }
28
+ .line.compact {
29
+ grid-template-columns: 1fr;
30
+ border-bottom: initial;
31
+ }
32
+
33
+ </style>
@@ -0,0 +1,5 @@
1
+ <script>
2
+ let {children} = $props()
3
+ </script>
4
+
5
+ <h5>{@render children()}</h5>
@@ -0,0 +1,61 @@
1
+ <script>
2
+ import { Button, IconButton, Link, ResponsiveTable } from 'hamzus-ui';
3
+ import { onMount } from 'svelte';
4
+ import { getTypeData, startUrl } from '../const';
5
+ import { structures } from '../../routes/[project_slug]/[origin]/structure';
6
+ import { page } from '$app/stores';
7
+ import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
8
+ import FieldView from '$lib/registry/entityRegistry/components/FieldView.svelte';
9
+
10
+ let { value, unique, secret, label, required, columns = [] } = $props();
11
+
12
+ let entries = null;
13
+
14
+ $effect(() => {
15
+ entries = value?.formated?.entries ?? {};
16
+ });
17
+ </script>
18
+
19
+ <div class="title">
20
+ <Label {label} {required} {secret} {unique}></Label>
21
+ </div>
22
+ <ResponsiveTable.Root let:ctx>
23
+ <ResponsiveTable.Header>
24
+ {#if columns.length > 0}
25
+ {#each columns as column, columnIndex}
26
+ <ResponsiveTable.HeaderCell align="left" label={column.name ?? '-'} {ctx}>
27
+ <h6>{columns[columnIndex].name ?? ''}</h6>
28
+ <!-- {column.columnIndex} -->
29
+ </ResponsiveTable.HeaderCell>
30
+ {/each}
31
+ {/if}
32
+ </ResponsiveTable.Header>
33
+ <ResponsiveTable.Body>
34
+ {#each entries as line, lineIndex}
35
+ <ResponsiveTable.Line>
36
+ {#each columns as column, columnIndex}
37
+ <ResponsiveTable.Cell {ctx}>
38
+ {#each column.rows as row, rowIndex}
39
+ <FieldView
40
+ compact
41
+ id={row.fieldId}
42
+ value={line[row.fieldId] ?? null}
43
+ ></FieldView>
44
+ {/each}
45
+ </ResponsiveTable.Cell>
46
+ {/each}
47
+ </ResponsiveTable.Line>
48
+ {/each}
49
+ </ResponsiveTable.Body>
50
+ </ResponsiveTable.Root>
51
+
52
+ <style>
53
+ .cell {
54
+ position: relative;
55
+ }
56
+ .title {
57
+ display: flex;
58
+ align-items: center;
59
+ width: 100%;
60
+ }
61
+ </style>
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import ViewText from "../../components/ViewText.svelte";
3
+
4
+ let { name, value } = $props();
5
+ </script>
6
+
7
+
8
+ <ViewText>{value?.formated?.display ?? "-"}</ViewText>
@@ -0,0 +1,19 @@
1
+ <script>
2
+ import { page } from "$app/stores";
3
+ import { Link } from "hamzus-ui";
4
+ import Line from "../../components/Line.svelte";
5
+ import Label from "../../components/Label.svelte";
6
+ import ViewText from "../../components/ViewText.svelte";
7
+ import LineView from "../../components/LineView.svelte";
8
+
9
+ let {value, compact, unique, secret, label, required} = $props()
10
+ </script>
11
+
12
+ <LineView {compact}>
13
+ <Label {unique} {secret} {label} {required}></Label>
14
+ {#if value.formated.slug !== null}
15
+ <Link href="{$page.params.project_slug}/{$page.params.origin}/{value.formated.entry_id}">{value.formated.display}</Link>
16
+ {:else}
17
+ <ViewText>{value.formated.display}</ViewText>
18
+ {/if}
19
+ </LineView>
@@ -4,6 +4,8 @@ import Icon from './Icon.svelte';
4
4
  import Button from './Button.svelte';
5
5
  import Card from './Card.svelte';
6
6
  import Input from './Input/Input.svelte';
7
+ import TableView from './TableView.svelte';
8
+ import View from './View.svelte';
7
9
 
8
10
  export default createFieldType({
9
11
  type: 'link',
@@ -25,7 +27,8 @@ export default createFieldType({
25
27
  button: Button,
26
28
  card: Card,
27
29
  input: Input,
28
- cell: null,
30
+ tableView: TableView,
31
+ view: View,
29
32
  filter: null,
30
33
  properties: null
31
34
  },
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import ViewText from "../../components/ViewText.svelte";
3
+
4
+ let { name, value } = $props();
5
+ </script>
6
+
7
+
8
+ <ViewText>{value?.flat ?? "-"}</ViewText>
@@ -0,0 +1,15 @@
1
+ <script>
2
+ import { page } from "$app/stores";
3
+ import { Link } from "hamzus-ui";
4
+ import LineView from "../../components/LineView.svelte";
5
+ import Label from "../../components/Label.svelte";
6
+ import ViewText from "../../components/ViewText.svelte";
7
+
8
+ let {value, compact, unique, secret, label, required} = $props()
9
+ </script>
10
+
11
+ <LineView {compact}>
12
+ <Label {unique} {secret} {label} {required}></Label>
13
+
14
+ <ViewText>{value?.flat}</ViewText>
15
+ </LineView>
@@ -3,6 +3,8 @@ import { createFieldType } from '../../createFieldType';
3
3
  import Icon from './Icon.svelte';
4
4
  import Button from './Button.svelte';
5
5
  import Card from './Card.svelte';
6
+ import TableView from './TableView.svelte';
7
+ import View from './View.svelte';
6
8
 
7
9
  export default createFieldType({
8
10
  type: 'primary',
@@ -25,7 +27,8 @@ export default createFieldType({
25
27
  button: Button,
26
28
  card: Card,
27
29
  input: null,
28
- cell: null,
30
+ tableView:TableView,
31
+ view:View,
29
32
  filter: null,
30
33
  properties: null
31
34
  },
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import ViewText from "../../../components/ViewText.svelte";
3
+
4
+ let { value } = $props();
5
+ </script>
6
+
7
+
8
+ <ViewText>{value === null ? '-' : value.flat}</ViewText>
@@ -0,0 +1,52 @@
1
+ <script>
2
+ let { name, value } = $props();
3
+ </script>
4
+
5
+ <div class="total-container">
6
+ <div class="total">
7
+ <div class="total-content">
8
+ <h4>{name}</h4>
9
+ <h4>{value === null ? '-' : value.flat}</h4>
10
+ </div>
11
+ </div>
12
+ </div>
13
+
14
+ <style>
15
+ .total-container {
16
+ width: min(100%, 1000px);
17
+ display: flex;
18
+ justify-content: end;
19
+ }
20
+
21
+ .total {
22
+ width: min(100%, 350px);
23
+ border-left: 1px solid var(--stroke);
24
+ border-right: 1px solid var(--stroke);
25
+ padding: var(--pad-m);
26
+ row-gap: var(--pad-m);
27
+ }
28
+
29
+ /* Premier d'une suite (ou élément seul) */
30
+ .total-container:not(.total-container + .total-container) .total {
31
+ border-top-left-radius: var(--radius-xxl);
32
+ border-top-right-radius: var(--radius-xxl);
33
+ border-top: 1px solid var(--stroke);
34
+ }
35
+
36
+ /* Dernier d'une suite (ou élément seul) */
37
+ .total-container:not(:has(+ .total-container)) .total {
38
+ border-bottom-left-radius: var(--radius-xxl);
39
+ border-bottom-right-radius: var(--radius-xxl);
40
+ border-bottom: 1px solid var(--stroke);
41
+ }
42
+
43
+ .total-content {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: space-between;
47
+ width: 100%;
48
+ padding: var(--pad-m) var(--pad-xxl);
49
+ border-radius: var(--radius-l);
50
+ background-color: var(--bg-2);
51
+ }
52
+ </style>
@@ -4,6 +4,8 @@ import Icon from './Icon.svelte';
4
4
  import Button from './Button.svelte';
5
5
  import Card from './Card.svelte';
6
6
  import Input from './Input.svelte';
7
+ import TableView from './TableView.svelte';
8
+ import View from './View.svelte';
7
9
 
8
10
  export default createFieldType({
9
11
  type: 'calculation-column',
@@ -25,7 +27,8 @@ export default createFieldType({
25
27
  button: Button,
26
28
  card: Card,
27
29
  input: Input,
28
- cell: null,
30
+ view:View,
31
+ tableView:TableView,
29
32
  filter: null,
30
33
  properties: null
31
34
  },
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import FieldTypeButton from '../../FieldTypeButton.svelte';
3
+ import Icon from './Icon.svelte';
4
+
5
+ let { ...props } = $props();
6
+ </script>
7
+
8
+ <FieldTypeButton {...props}></FieldTypeButton>
@@ -0,0 +1,6 @@
1
+ <script>
2
+ import FieldCard from '../../FieldTypeCard.svelte';
3
+ let { ...props } = $props();
4
+ </script>
5
+
6
+ <FieldCard {...props}></FieldCard>
@@ -0,0 +1,30 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path
3
+ d="M21.6997 6.39014H14.4297C14.0197 6.39014 13.6797 6.05014 13.6797 5.64014C13.6797 5.23014 14.0197 4.89014 14.4297 4.89014H21.6997C22.1097 4.89014 22.4497 5.23014 22.4497 5.64014C22.4497 6.05014 22.1097 6.39014 21.6997 6.39014Z"
4
+ fill="#292D32"
5
+ />
6
+ <path
7
+ d="M9.58078 6.39014H2.30078C1.89078 6.39014 1.55078 6.05014 1.55078 5.64014C1.55078 5.23014 1.89078 4.89014 2.30078 4.89014H9.57078C9.98078 4.89014 10.3208 5.23014 10.3208 5.64014C10.3208 6.05014 9.99078 6.39014 9.58078 6.39014Z"
8
+ fill="#292D32"
9
+ />
10
+ <path
11
+ d="M21.6997 16.0801H14.4297C14.0197 16.0801 13.6797 15.7401 13.6797 15.3301C13.6797 14.9201 14.0197 14.5801 14.4297 14.5801H21.6997C22.1097 14.5801 22.4497 14.9201 22.4497 15.3301C22.4497 15.7401 22.1097 16.0801 21.6997 16.0801Z"
12
+ fill="#292D32"
13
+ />
14
+ <path
15
+ d="M21.6997 22.1401H14.4297C14.0197 22.1401 13.6797 21.8001 13.6797 21.3901C13.6797 20.9801 14.0197 20.6401 14.4297 20.6401H21.6997C22.1097 20.6401 22.4497 20.9801 22.4497 21.3901C22.4497 21.8001 22.1097 22.1401 21.6997 22.1401Z"
16
+ fill="#292D32"
17
+ />
18
+ <path
19
+ d="M18.0898 10.02C17.6798 10.02 17.3398 9.68 17.3398 9.27V2C17.3398 1.59 17.6798 1.25 18.0898 1.25C18.4998 1.25 18.8398 1.59 18.8398 2V9.27C18.8398 9.69 18.5098 10.02 18.0898 10.02Z"
20
+ fill="#292D32"
21
+ />
22
+ <path
23
+ d="M2.30023 22.7499C2.11023 22.7499 1.92023 22.6799 1.77023 22.5299C1.48023 22.2399 1.48023 21.7599 1.77023 21.4699L9.04023 14.1999C9.33023 13.9099 9.81024 13.9099 10.1002 14.1999C10.3902 14.4899 10.3902 14.9699 10.1002 15.2599L2.83023 22.5299C2.69023 22.6799 2.50023 22.7499 2.30023 22.7499Z"
24
+ fill="#292D32"
25
+ />
26
+ <path
27
+ d="M9.58 22.7499C9.39 22.7499 9.2 22.6799 9.05 22.5299L1.78 15.2599C1.49 14.9699 1.49 14.4899 1.78 14.1999C2.07 13.9099 2.55 13.9099 2.84 14.1999L10.11 21.4699C10.4 21.7599 10.4 22.2399 10.11 22.5299C9.96 22.6799 9.77 22.7499 9.58 22.7499Z"
28
+ fill="#292D32"
29
+ />
30
+ </svg>