mountain-ui 1.0.29 → 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 (98) 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/TableView.svelte +8 -0
  21. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/View.svelte +52 -0
  22. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/index.js +6 -2
  23. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/TableView.svelte +28 -0
  24. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/View.svelte +31 -0
  25. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/index.js +4 -1
  26. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/TableView.svelte +13 -0
  27. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/View.svelte +18 -0
  28. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/index.js +4 -1
  29. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/TableView.svelte +8 -0
  30. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/View.svelte +12 -0
  31. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/index.js +4 -1
  32. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/TableView.svelte +8 -0
  33. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/View.svelte +12 -0
  34. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/index.js +4 -1
  35. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/TableView.svelte +8 -0
  36. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/View.svelte +12 -0
  37. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/index.js +4 -1
  38. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/TableView.svelte +8 -0
  39. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/View.svelte +12 -0
  40. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/index.js +4 -1
  41. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/TableView.svelte +8 -0
  42. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/View.svelte +12 -0
  43. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/index.js +4 -1
  44. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/TableView.svelte +8 -0
  45. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/View.svelte +12 -0
  46. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/index.js +4 -1
  47. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/TableView.svelte +8 -0
  48. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/View.svelte +13 -0
  49. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/index.js +4 -1
  50. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/TableView.svelte +8 -0
  51. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/View.svelte +12 -0
  52. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/index.js +4 -1
  53. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/TableView.svelte +8 -0
  54. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/View.svelte +13 -0
  55. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/index.js +4 -1
  56. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/TableView.svelte +8 -0
  57. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/View.svelte +24 -0
  58. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/index.js +4 -1
  59. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/TableView.svelte +9 -0
  60. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/View.svelte +13 -0
  61. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/index.js +4 -1
  62. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/TableView.svelte +9 -0
  63. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/View.svelte +13 -0
  64. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/index.js +4 -1
  65. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/TableView.svelte +9 -0
  66. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/View.svelte +13 -0
  67. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/index.js +4 -1
  68. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/TableView.svelte +8 -0
  69. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/View.svelte +12 -0
  70. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/index.js +4 -1
  71. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/TableView.svelte +8 -0
  72. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/View.svelte +12 -0
  73. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/index.js +4 -1
  74. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/TableView.svelte +8 -0
  75. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/View.svelte +12 -0
  76. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/index.js +4 -1
  77. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/TableView.svelte +8 -0
  78. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/View.svelte +12 -0
  79. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/index.js +4 -1
  80. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/TableView.svelte +9 -0
  81. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/View.svelte +13 -0
  82. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/index.js +4 -1
  83. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/TableView.svelte +8 -0
  84. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/View.svelte +12 -0
  85. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/index.js +4 -1
  86. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/formatDate.js +155 -0
  87. package/src/lib/registry/viewTypeRegistry/components/ViewTypeButton.svelte +27 -0
  88. package/src/lib/registry/viewTypeRegistry/components/ViewTypeComponent.svelte +30 -0
  89. package/src/lib/registry/viewTypeRegistry/createViewType.js +17 -0
  90. package/src/lib/registry/viewTypeRegistry/registerDefaultViewTypes.js +7 -0
  91. package/src/lib/registry/viewTypeRegistry/registry.svelte.js +44 -0
  92. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/Icon.svelte +16 -0
  93. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component copy.svelte +11 -0
  94. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component.svelte +12 -0
  95. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/StructureTable.svelte +287 -0
  96. package/src/lib/registry/viewTypeRegistry/viewTypes/Table/index.js +14 -0
  97. package/src/routes/+layout.svelte +13 -1
  98. 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.29",
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 ViewText from "../../../components/ViewText.svelte";
3
+
4
+ let { name, 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 View from './View.svelte';
8
+ import TableView from './TableView.svelte';
7
9
 
8
10
  export default createFieldType({
9
11
  type: 'calculation-line',
@@ -20,12 +22,14 @@ export default createFieldType({
20
22
  can_be_required: false,
21
23
  can_be_unique: false,
22
24
 
23
- components: {
25
+
26
+ components: {
24
27
  icon: Icon,
25
28
  button: Button,
26
29
  card: Card,
27
30
  input: Input,
28
- cell: null,
31
+ view: View,
32
+ tableView: TableView,
29
33
  filter: null,
30
34
  properties: null
31
35
  },
@@ -0,0 +1,28 @@
1
+ <script>
2
+
3
+ import { Tag } from 'hamzus-ui';
4
+
5
+ let { value, choices } = $props();
6
+
7
+ $effect(() => {
8
+ decodedValue = value.formated ?? [];
9
+ });
10
+ </script>
11
+
12
+
13
+ <div class="tags">
14
+ {#each decodedValue as tagValue}
15
+ {@const data = choices.find((el) => el.value === tagValue)}
16
+ {#if data}
17
+ <Tag label={tagValue} color={data.color.replace('--', '')}></Tag>
18
+ {/if}
19
+ {/each}
20
+ </div>
21
+
22
+ <style>
23
+ .tags {
24
+ display: flex;
25
+ flex-wrap: wrap;
26
+ gap: var(--pad-s);
27
+ }
28
+ </style>
@@ -0,0 +1,31 @@
1
+ <script>
2
+ import Label from '../../../components/Label.svelte';
3
+ import LineView from '../../../components/LineView.svelte';
4
+ import { Tag } from 'hamzus-ui';
5
+
6
+ let { value, choices, compact, unique, secret, label, required } = $props();
7
+
8
+ $effect(() => {
9
+ decodedValue = value.formated ?? [];
10
+ });
11
+ </script>
12
+
13
+ <LineView {compact}>
14
+ <Label {unique} {secret} {label} {required}></Label>
15
+ <div class="tags">
16
+ {#each decodedValue as tagValue}
17
+ {@const data = choices.find((el) => el.value === tagValue)}
18
+ {#if data}
19
+ <Tag label={tagValue} color={data.color.replace('--', '')}></Tag>
20
+ {/if}
21
+ {/each}
22
+ </div>
23
+ </LineView>
24
+
25
+ <style>
26
+ .tags {
27
+ display: flex;
28
+ flex-wrap: wrap;
29
+ gap: var(--pad-s);
30
+ }
31
+ </style>