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.
- package/package.json +1 -1
- package/src/lib/registry/entityRegistry/components/EntityPage.svelte +158 -0
- package/src/lib/registry/entityRegistry/components/FieldTableView.svelte +23 -0
- package/src/lib/registry/entityRegistry/components/FieldView.svelte +24 -0
- package/src/lib/registry/entityRegistry/createEntity.js +2 -0
- package/src/lib/registry/fieldTypeRegistry/components/FieldTypeTableView.svelte +11 -0
- package/src/lib/registry/fieldTypeRegistry/components/FieldTypeView.svelte +11 -0
- package/src/lib/registry/fieldTypeRegistry/components/LineView.svelte +33 -0
- package/src/lib/registry/fieldTypeRegistry/components/ViewText.svelte +5 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/View.svelte +61 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/View.svelte +19 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/View.svelte +15 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/View.svelte +52 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/View.svelte +52 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/index.js +6 -2
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/TableView.svelte +28 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/View.svelte +31 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/TableView.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/View.svelte +18 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/View.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/View.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/View.svelte +24 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/TableView.svelte +9 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/View.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/TableView.svelte +9 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/View.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/TableView.svelte +9 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/View.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/TableView.svelte +9 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/View.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/TableView.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/View.svelte +12 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/index.js +4 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/formatDate.js +155 -0
- package/src/lib/registry/viewTypeRegistry/components/ViewTypeButton.svelte +27 -0
- package/src/lib/registry/viewTypeRegistry/components/ViewTypeComponent.svelte +30 -0
- package/src/lib/registry/viewTypeRegistry/createViewType.js +17 -0
- package/src/lib/registry/viewTypeRegistry/registerDefaultViewTypes.js +7 -0
- package/src/lib/registry/viewTypeRegistry/registry.svelte.js +44 -0
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/Icon.svelte +16 -0
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component copy.svelte +11 -0
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component.svelte +12 -0
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/StructureTable.svelte +287 -0
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/index.js +14 -0
- package/src/routes/+layout.svelte +13 -1
- package/src/routes/+page.svelte +22 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
// import
|
|
3
|
+
import { RotativeLoader, sendRequest, TableV2 } from 'hamzus-ui';
|
|
4
|
+
import { page } from '$app/stores';
|
|
5
|
+
import { onMount } from 'svelte';
|
|
6
|
+
import { goto } from '$app/navigation';
|
|
7
|
+
import { fieldTypeRegistry } from '$lib/registry/fieldTypeRegistry/registry.svelte';
|
|
8
|
+
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
entityId = null,
|
|
12
|
+
path = '/get-all-entries',
|
|
13
|
+
data = {},
|
|
14
|
+
slug = null,
|
|
15
|
+
onChange = () => {},
|
|
16
|
+
invisibleFilters = {},
|
|
17
|
+
structureColumns = [],
|
|
18
|
+
defaultColumns = {},
|
|
19
|
+
defaultProps = {},
|
|
20
|
+
...props
|
|
21
|
+
} = $props();
|
|
22
|
+
|
|
23
|
+
const entity = entityRegistry.select(entityId);
|
|
24
|
+
|
|
25
|
+
let error = $state(null);
|
|
26
|
+
|
|
27
|
+
let mounted = false;
|
|
28
|
+
|
|
29
|
+
let columns = $state([]);
|
|
30
|
+
|
|
31
|
+
$effect(() => {
|
|
32
|
+
getColumnsFromStructureColumns($entity);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
onMount(() => {
|
|
36
|
+
mounted = true;
|
|
37
|
+
getColumnsFromStructureColumns($entity);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// function
|
|
41
|
+
function getColumnsFromStructureColumns(entity) {
|
|
42
|
+
// on evite d'executé coté serveur
|
|
43
|
+
if (!mounted) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// parcourir les colonne et generer l objet columns pour le composant table
|
|
48
|
+
let columnsList = [];
|
|
49
|
+
|
|
50
|
+
for (const field of entity.fields) {
|
|
51
|
+
if (field.is_hidden) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let additionalData = {};
|
|
56
|
+
|
|
57
|
+
const fieldType = fieldTypeRegistry.get(field.type);
|
|
58
|
+
|
|
59
|
+
if (fieldType.tableAttributes) {
|
|
60
|
+
if (typeof fieldType.tableAttributes === 'function') {
|
|
61
|
+
additionalData = fieldType.tableAttributes(field.props);
|
|
62
|
+
} else {
|
|
63
|
+
additionalData = fieldType.tableAttributes;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// si il y a un composent de visualisation on l ajoute
|
|
68
|
+
if (fieldType.components.tableView) {
|
|
69
|
+
additionalData = {
|
|
70
|
+
...additionalData,
|
|
71
|
+
componentForVisualisation: fieldType.components.tableView
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (defaultColumns?.[field.normalized_name]?.skipLine) additionalData.skipLine = true;
|
|
76
|
+
if (defaultColumns?.[field.normalized_name]?.width)
|
|
77
|
+
additionalData.width = defaultColumns[field.normalized_name].width;
|
|
78
|
+
if (defaultColumns?.[field.normalized_name]?.hidden) additionalData.hidden = true;
|
|
79
|
+
|
|
80
|
+
columnsList.push({
|
|
81
|
+
name: field.normalized_name,
|
|
82
|
+
label: field.name,
|
|
83
|
+
initialWidth: field.width ?? 50,
|
|
84
|
+
isSearchable: true,
|
|
85
|
+
isSortable: true,
|
|
86
|
+
...additionalData
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
columns = columnsList;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function getRows(filters, sort, limit, offset) {
|
|
94
|
+
// convertir les filter en post data
|
|
95
|
+
let postFilter = {};
|
|
96
|
+
let index = 0;
|
|
97
|
+
for (const columnName in filters) {
|
|
98
|
+
postFilter = {
|
|
99
|
+
...postFilter,
|
|
100
|
+
[`filters[${columnName}]`]: filters[columnName]
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
index++;
|
|
104
|
+
}
|
|
105
|
+
for (const columnName in invisibleFilters) {
|
|
106
|
+
postFilter = {
|
|
107
|
+
...postFilter,
|
|
108
|
+
[`filters[${columnName}]`]: invisibleFilters[columnName]
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
index++;
|
|
112
|
+
}
|
|
113
|
+
// convertir sort en post data
|
|
114
|
+
let postSort = {};
|
|
115
|
+
if (sort.direction) {
|
|
116
|
+
postSort = {
|
|
117
|
+
[`sort[${sort.columnName}]`]: sort.direction
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const request = await sendRequest({
|
|
122
|
+
path: path,
|
|
123
|
+
data: {
|
|
124
|
+
entityId: entityId,
|
|
125
|
+
limit: limit,
|
|
126
|
+
offset,
|
|
127
|
+
...postFilter,
|
|
128
|
+
...postSort,
|
|
129
|
+
...data
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
if (request.statusType === 'error') {
|
|
134
|
+
if (request.statusCode === 403) {
|
|
135
|
+
error = 403;
|
|
136
|
+
} else {
|
|
137
|
+
error === 'error';
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const requestData = request.data;
|
|
143
|
+
|
|
144
|
+
let returnedData = {
|
|
145
|
+
rows: [],
|
|
146
|
+
totalOfRows: requestData.totalOfRows
|
|
147
|
+
};
|
|
148
|
+
for (const row of requestData.rows) {
|
|
149
|
+
let newRow = {};
|
|
150
|
+
|
|
151
|
+
for (const column of columns) {
|
|
152
|
+
// composent
|
|
153
|
+
if (column.componentForVisualisation) {
|
|
154
|
+
newRow[`${column.name}`] = {
|
|
155
|
+
component: column.componentForVisualisation,
|
|
156
|
+
props: {
|
|
157
|
+
// injecter la valeur
|
|
158
|
+
value: row[column.name],
|
|
159
|
+
// injecter les props de colonne
|
|
160
|
+
...column.componentPropsForVisualisation
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
// function de formatage
|
|
166
|
+
if (column.functionForVisualisation) {
|
|
167
|
+
newRow[`${column.name}`] = column.functionForVisualisation(row[column.name]);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
newRow[`${column.name}`] = row[column.name].flat;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
returnedData.rows.push(newRow);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return returnedData;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function handleChange(table) {
|
|
181
|
+
// copier les filtres
|
|
182
|
+
let defaultFilters = { ...table.filters };
|
|
183
|
+
let defaultColumns = null;
|
|
184
|
+
|
|
185
|
+
for (const column of table.columns) {
|
|
186
|
+
if (!column.hidden && !column.width && !column.skipLine) continue;
|
|
187
|
+
|
|
188
|
+
if (defaultColumns === null) defaultColumns = {};
|
|
189
|
+
|
|
190
|
+
let newColumn = {
|
|
191
|
+
name: column.name
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// push les données
|
|
195
|
+
if (column.hidden) newColumn.hidden = true;
|
|
196
|
+
if (column.width) newColumn.width = column.width;
|
|
197
|
+
if (column.skipLine) newColumn.skipLine = true;
|
|
198
|
+
|
|
199
|
+
defaultColumns[column.name] = newColumn;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
defaultProps = {
|
|
203
|
+
defaultFilters: defaultFilters,
|
|
204
|
+
defaultColumns: defaultColumns
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function onClick(rowData) {
|
|
209
|
+
// rediriger vers
|
|
210
|
+
goto(`/${$page.params.projet_slug}/${$page.params.origin}/${slug ?? $page.params.structure_slug}/${rowData.id}`);
|
|
211
|
+
}
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
{#if error === 403}
|
|
215
|
+
<div class="error">
|
|
216
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
217
|
+
<path
|
|
218
|
+
opacity="0.4"
|
|
219
|
+
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"
|
|
220
|
+
fill="#292D32"
|
|
221
|
+
/>
|
|
222
|
+
<path
|
|
223
|
+
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"
|
|
224
|
+
fill="#292D32"
|
|
225
|
+
/>
|
|
226
|
+
</svg>
|
|
227
|
+
|
|
228
|
+
<h3>Vous n'avez pas accès a cet ressource</h3>
|
|
229
|
+
<p>Vous ne pouvez pas consulté les element lié a cette entité !</p>
|
|
230
|
+
</div>
|
|
231
|
+
{:else if error === 'error'}
|
|
232
|
+
<div class="error">
|
|
233
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
234
|
+
<path
|
|
235
|
+
opacity="0.4"
|
|
236
|
+
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"
|
|
237
|
+
fill="#292D32"
|
|
238
|
+
/>
|
|
239
|
+
<path
|
|
240
|
+
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"
|
|
241
|
+
fill="#292D32"
|
|
242
|
+
/>
|
|
243
|
+
<path
|
|
244
|
+
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"
|
|
245
|
+
fill="#292D32"
|
|
246
|
+
/>
|
|
247
|
+
</svg>
|
|
248
|
+
|
|
249
|
+
<h3>Une erreur est survenue !</h3>
|
|
250
|
+
<p>Impossible de récuperer l'entrée !</p>
|
|
251
|
+
</div>
|
|
252
|
+
{:else if columns.length > 0}
|
|
253
|
+
<TableV2.Root {getRows} onChange={handleChange} {onClick} {columns} {...props}>
|
|
254
|
+
<TableV2.ActionsBar slot="actions-bar"
|
|
255
|
+
><slot name="actions" slot="actions" /></TableV2.ActionsBar
|
|
256
|
+
>
|
|
257
|
+
<TableV2.Header slot="header"></TableV2.Header>
|
|
258
|
+
<TableV2.Content slot="content"></TableV2.Content>
|
|
259
|
+
</TableV2.Root>
|
|
260
|
+
{:else}
|
|
261
|
+
<div class="loader">
|
|
262
|
+
<RotativeLoader></RotativeLoader>
|
|
263
|
+
</div>
|
|
264
|
+
{/if}
|
|
265
|
+
|
|
266
|
+
<style>
|
|
267
|
+
.loader {
|
|
268
|
+
padding: 60px var(--pad-m);
|
|
269
|
+
display: flex;
|
|
270
|
+
align-items: center;
|
|
271
|
+
justify-content: center;
|
|
272
|
+
}
|
|
273
|
+
.error {
|
|
274
|
+
padding: 60px var(--pad-m);
|
|
275
|
+
display: flex;
|
|
276
|
+
flex-direction: column;
|
|
277
|
+
align-items: center;
|
|
278
|
+
row-gap: var(--pad-m);
|
|
279
|
+
}
|
|
280
|
+
.error > svg {
|
|
281
|
+
width: 60px;
|
|
282
|
+
height: auto;
|
|
283
|
+
}
|
|
284
|
+
.error > svg path {
|
|
285
|
+
fill: var(--red);
|
|
286
|
+
}
|
|
287
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createViewType } from '../../createViewType';
|
|
2
|
+
|
|
3
|
+
import Icon from '../Table/Icon.svelte';
|
|
4
|
+
import Component from '../Table/component/Component.svelte';
|
|
5
|
+
|
|
6
|
+
export default createViewType({
|
|
7
|
+
type: "table",
|
|
8
|
+
name: "Tableau",
|
|
9
|
+
description: "",
|
|
10
|
+
components: {
|
|
11
|
+
component: Component,
|
|
12
|
+
icon: Icon,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
7
7
|
import { createEntity } from '$lib/registry/entityRegistry/createEntity';
|
|
8
8
|
import { init, sendRequest } from 'hamzus-ui';
|
|
9
|
+
import { registerDefaultViewTypes } from '$lib/registry/viewTypeRegistry/registerDefaultViewTypes';
|
|
9
10
|
|
|
10
11
|
let { children } = $props();
|
|
11
12
|
|
|
@@ -33,9 +34,20 @@
|
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
|
|
36
|
-
onMount(() => {
|
|
37
|
+
onMount(async () => {
|
|
37
38
|
registerDefaultFieldTypes();
|
|
38
39
|
|
|
40
|
+
// recuperer les entités
|
|
41
|
+
const requestStructures = await sendRequest({
|
|
42
|
+
path: '/get-all-entities'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
for (const entity of requestStructures.data) {
|
|
46
|
+
entityRegistry.register(createEntity(entity));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
registerDefaultViewTypes();
|
|
50
|
+
|
|
39
51
|
// enregistrer des entité
|
|
40
52
|
entityRegistry.register(
|
|
41
53
|
createEntity({
|
package/src/routes/+page.svelte
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
import EntityButton from '$lib/registry/entityRegistry/components/EntityButton.svelte';
|
|
3
3
|
import EntityCard from '$lib/registry/entityRegistry/components/EntityCard.svelte';
|
|
4
4
|
import EntityForm from '$lib/registry/entityRegistry/components/EntityForm.svelte';
|
|
5
|
+
import EntityPage from '$lib/registry/entityRegistry/components/EntityPage.svelte';
|
|
5
6
|
import FieldButton from '$lib/registry/entityRegistry/components/FieldButton.svelte';
|
|
6
7
|
import FieldCard from '$lib/registry/entityRegistry/components/FieldCard.svelte';
|
|
7
8
|
import FieldInput from '$lib/registry/entityRegistry/components/FieldInput.svelte';
|
|
9
|
+
import FieldTableView from '$lib/registry/entityRegistry/components/FieldTableView.svelte';
|
|
10
|
+
import FieldView from '$lib/registry/entityRegistry/components/FieldView.svelte';
|
|
8
11
|
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
9
12
|
import FieldTypeButton from '$lib/registry/fieldTypeRegistry/components/FieldTypeButton.svelte';
|
|
10
13
|
import FieldTypeCard from '$lib/registry/fieldTypeRegistry/components/FieldTypeCard.svelte';
|
|
11
14
|
import FieldTypeInput from '$lib/registry/fieldTypeRegistry/components/FieldTypeInput.svelte';
|
|
15
|
+
import FieldTypeTableView from '$lib/registry/fieldTypeRegistry/components/FieldTypeTableView.svelte';
|
|
16
|
+
import FieldTypeView from '$lib/registry/fieldTypeRegistry/components/FieldTypeView.svelte';
|
|
12
17
|
import { fieldTypeRegistry } from '$lib/registry/fieldTypeRegistry/registry.svelte';
|
|
18
|
+
import ViewTypeComponent from '$lib/registry/viewTypeRegistry/components/ViewTypeComponent.svelte';
|
|
19
|
+
import { viewTypeRegistry } from '$lib/registry/viewTypeRegistry/registry.svelte';
|
|
13
20
|
import { onMount } from 'svelte';
|
|
14
21
|
|
|
15
22
|
const entities = entityRegistry.getAll();
|
|
@@ -98,14 +105,28 @@
|
|
|
98
105
|
}
|
|
99
106
|
};
|
|
100
107
|
|
|
108
|
+
const testValues = {
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
onMount(() => {});
|
|
102
113
|
|
|
103
114
|
function handleSubmit(data) {
|
|
104
115
|
console.log(data);
|
|
105
116
|
|
|
106
117
|
}
|
|
107
|
-
</script>
|
|
108
118
|
|
|
119
|
+
const tableView = viewTypeRegistry.get("table")
|
|
120
|
+
</script>
|
|
121
|
+
<h3>Vues</h3>
|
|
122
|
+
<div class="view">
|
|
123
|
+
<h3>{tableView.name}</h3>
|
|
124
|
+
<ViewTypeComponent type="table" entityId={51}></ViewTypeComponent>
|
|
125
|
+
</div>
|
|
126
|
+
<h3>Entré</h3>
|
|
127
|
+
<div class="entry">
|
|
128
|
+
<EntityPage entityId={51} entryId={1}></EntityPage>
|
|
129
|
+
</div>
|
|
109
130
|
<h3>Entité</h3>
|
|
110
131
|
{#each $entities as entity}
|
|
111
132
|
<div class="entity">
|