mountain-ui 1.0.151 → 1.0.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/component/Binding.svelte +0 -1
- package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/component/BindingClone.svelte +2 -4
- package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/index.js +1 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Input.svelte +178 -34
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/index.js +8 -0
- package/src/routes/exemple/[project_normalized_name]/[entity_slug]/[entry_id]/+page.svelte +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mountain-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.153",
|
|
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",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import EntityFieldContainer from '../../../../entityRegistry/components/EntityFieldContainer.svelte';
|
|
8
8
|
|
|
9
9
|
let { fieldId, toEntityId, props = null, onChange = (newProps) => {} } = $props();
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
const fromField = $derived(entityRegistry.getField(props.fromFieldId));
|
|
12
12
|
const fromFieldType = $derived(fieldTypeRegistry.get(fromField.type));
|
|
13
13
|
|
|
@@ -30,10 +30,8 @@ console.log(props);
|
|
|
30
30
|
bindings: []
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const field = entityRegistry.getField(
|
|
33
|
+
const field = entityRegistry.getField(fromFieldId);
|
|
34
34
|
const fieldType = fieldTypeRegistry.get(field.type);
|
|
35
|
-
console.log(field.type);
|
|
36
|
-
console.log(field.name);
|
|
37
35
|
|
|
38
36
|
// verifier si il y a du bindings
|
|
39
37
|
const childFieldIds = fieldType.getChildsBindings(field);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { goto } from '$app/navigation';
|
|
2
2
|
import { page } from '$app/state';
|
|
3
|
+
import { get } from 'svelte/store';
|
|
3
4
|
import { entityRegistry } from '../../../entityRegistry/registry.svelte';
|
|
4
5
|
import { fieldTypeRegistry } from '../../../fieldTypeRegistry/registry.svelte';
|
|
5
6
|
import { createEntryActionType } from '../../createEntryActionType';
|
|
@@ -21,10 +21,13 @@
|
|
|
21
21
|
|
|
22
22
|
let table = $state([createLine()]);
|
|
23
23
|
|
|
24
|
+
let isHidden = $state(false);
|
|
25
|
+
|
|
24
26
|
onMount(() => {
|
|
25
27
|
if (value === null) return;
|
|
26
28
|
|
|
27
29
|
const decodedValue = JSON.parse(value);
|
|
30
|
+
console.log(decodedValue);
|
|
28
31
|
|
|
29
32
|
let newLines = [];
|
|
30
33
|
|
|
@@ -151,29 +154,52 @@
|
|
|
151
154
|
calc.calculate(table[lineIndex].ctx);
|
|
152
155
|
}
|
|
153
156
|
}
|
|
157
|
+
|
|
158
|
+
function handleToggleVisibility() {
|
|
159
|
+
isHidden = !isHidden;
|
|
160
|
+
}
|
|
154
161
|
</script>
|
|
155
162
|
|
|
156
163
|
<div class="table">
|
|
157
164
|
<div class="title">
|
|
158
165
|
<Label {label} {required} {secret} {unique}></Label>
|
|
166
|
+
|
|
167
|
+
<div class="right">
|
|
168
|
+
<Button onClick={handleAddLine}>
|
|
169
|
+
<h5>ajouter une rangée</h5>
|
|
170
|
+
</Button>
|
|
171
|
+
<IconButton size="24px" variant="ghost" onClick={handleToggleVisibility}>
|
|
172
|
+
<svg
|
|
173
|
+
width="24"
|
|
174
|
+
height="24"
|
|
175
|
+
viewBox="0 0 24 24"
|
|
176
|
+
fill="none"
|
|
177
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
178
|
+
>
|
|
179
|
+
<path
|
|
180
|
+
d="M11.9995 16.8001C11.2995 16.8001 10.5995 16.5301 10.0695 16.0001L3.54953 9.48014C3.25953 9.19014 3.25953 8.71014 3.54953 8.42014C3.83953 8.13014 4.31953 8.13014 4.60953 8.42014L11.1295 14.9401C11.6095 15.4201 12.3895 15.4201 12.8695 14.9401L19.3895 8.42014C19.6795 8.13014 20.1595 8.13014 20.4495 8.42014C20.7395 8.71014 20.7395 9.19014 20.4495 9.48014L13.9295 16.0001C13.3995 16.5301 12.6995 16.8001 11.9995 16.8001Z"
|
|
181
|
+
fill="#292D32"
|
|
182
|
+
/>
|
|
183
|
+
</svg>
|
|
184
|
+
</IconButton>
|
|
185
|
+
</div>
|
|
159
186
|
</div>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
187
|
+
<div class="table-container" style="--column-number:{columns.length};" class:hidden={isHidden}>
|
|
188
|
+
{#if columns.length > 0 && columns.find(c=>(c.name??false) !== false)}
|
|
189
|
+
<div class="header">
|
|
163
190
|
{#each columns as column, columnIndex}
|
|
164
|
-
<
|
|
191
|
+
<div class="header-cell">
|
|
165
192
|
<h6>{columns[columnIndex].name ?? ''}</h6>
|
|
166
|
-
|
|
167
|
-
</ResponsiveTable.HeaderCell>
|
|
193
|
+
</div>
|
|
168
194
|
{/each}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<
|
|
195
|
+
</div>
|
|
196
|
+
{/if}
|
|
197
|
+
<div class="body">
|
|
172
198
|
{#if $entity}
|
|
173
199
|
{#each table as line, lineIndex (line.id)}
|
|
174
|
-
<
|
|
200
|
+
<div class="line">
|
|
175
201
|
{#each columns as column, columnIndex}
|
|
176
|
-
<
|
|
202
|
+
<div class="cell">
|
|
177
203
|
{#each column.rows as row, rowIndex}
|
|
178
204
|
<FieldInput
|
|
179
205
|
compact
|
|
@@ -198,7 +224,7 @@
|
|
|
198
224
|
{#if columnIndex + 1 === columns.length}
|
|
199
225
|
<div class="delete">
|
|
200
226
|
<IconButton
|
|
201
|
-
|
|
227
|
+
avoidRipple
|
|
202
228
|
variant="destructive"
|
|
203
229
|
onClick={() => {
|
|
204
230
|
handleDeleteLine(lineIndex);
|
|
@@ -235,33 +261,131 @@
|
|
|
235
261
|
</IconButton>
|
|
236
262
|
</div>
|
|
237
263
|
{/if}
|
|
238
|
-
</
|
|
264
|
+
</div>
|
|
239
265
|
{/each}
|
|
240
|
-
</
|
|
266
|
+
</div>
|
|
241
267
|
{/each}
|
|
242
268
|
{/if}
|
|
243
|
-
</
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
269
|
+
</div>
|
|
270
|
+
<!-- <ResponsiveTable.Root let:ctx>
|
|
271
|
+
{#if columns.length > 0}
|
|
272
|
+
<ResponsiveTable.Header>
|
|
273
|
+
{#each columns as column, columnIndex}
|
|
274
|
+
<ResponsiveTable.HeaderCell align="left" label={column.name ?? '-'} {ctx}>
|
|
275
|
+
<h6>{columns[columnIndex].name ?? ''}</h6>
|
|
276
|
+
|
|
277
|
+
</ResponsiveTable.HeaderCell>
|
|
278
|
+
{/each}
|
|
279
|
+
</ResponsiveTable.Header>
|
|
280
|
+
{/if}
|
|
281
|
+
<ResponsiveTable.Body>
|
|
282
|
+
{#if $entity}
|
|
283
|
+
{#each table as line, lineIndex (line.id)}
|
|
284
|
+
<ResponsiveTable.Line>
|
|
285
|
+
{#each columns as column, columnIndex}
|
|
286
|
+
<ResponsiveTable.Cell {ctx}>
|
|
287
|
+
{#each column.rows as row, rowIndex}
|
|
288
|
+
<FieldInput
|
|
289
|
+
compact
|
|
290
|
+
detailsCtx={table[lineIndex].detailsCtx}
|
|
291
|
+
ctx={table[lineIndex].ctx}
|
|
292
|
+
onChangeDetails={(value) => {
|
|
293
|
+
handleChangeDetails(lineIndex, row.fieldId, value);
|
|
294
|
+
}}
|
|
295
|
+
onChange={(value) => {
|
|
296
|
+
handleChange(lineIndex, row.fieldId, value);
|
|
297
|
+
}}
|
|
298
|
+
changeCtx={(fieldId, value) => {
|
|
299
|
+
handleChange(lineIndex, fieldId, value);
|
|
300
|
+
}}
|
|
301
|
+
id={row.fieldId}
|
|
302
|
+
value={table[lineIndex].ctx?.[row.fieldId] ?? null}
|
|
303
|
+
registerCalculation={(config) => {
|
|
304
|
+
handleRegisterCalculation(lineIndex, config);
|
|
305
|
+
}}
|
|
306
|
+
></FieldInput>
|
|
307
|
+
{/each}
|
|
308
|
+
{#if columnIndex + 1 === columns.length}
|
|
309
|
+
<div class="delete">
|
|
310
|
+
<IconButton
|
|
311
|
+
avoidRipple
|
|
312
|
+
variant="destructive"
|
|
313
|
+
onClick={() => {
|
|
314
|
+
handleDeleteLine(lineIndex);
|
|
315
|
+
}}
|
|
316
|
+
>
|
|
317
|
+
<svg
|
|
318
|
+
width="24"
|
|
319
|
+
height="24"
|
|
320
|
+
viewBox="0 0 24 24"
|
|
321
|
+
fill="none"
|
|
322
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
323
|
+
>
|
|
324
|
+
<path
|
|
325
|
+
d="M20.9997 6.72998C20.9797 6.72998 20.9497 6.72998 20.9197 6.72998C15.6297 6.19998 10.3497 5.99998 5.11967 6.52998L3.07967 6.72998C2.65967 6.76998 2.28967 6.46998 2.24967 6.04998C2.20967 5.62998 2.50967 5.26998 2.91967 5.22998L4.95967 5.02998C10.2797 4.48998 15.6697 4.69998 21.0697 5.22998C21.4797 5.26998 21.7797 5.63998 21.7397 6.04998C21.7097 6.43998 21.3797 6.72998 20.9997 6.72998Z"
|
|
326
|
+
fill="#292D32"
|
|
327
|
+
/>
|
|
328
|
+
<path
|
|
329
|
+
d="M8.50074 5.72C8.46074 5.72 8.42074 5.72 8.37074 5.71C7.97074 5.64 7.69074 5.25 7.76074 4.85L7.98074 3.54C8.14074 2.58 8.36074 1.25 10.6907 1.25H13.3107C15.6507 1.25 15.8707 2.63 16.0207 3.55L16.2407 4.85C16.3107 5.26 16.0307 5.65 15.6307 5.71C15.2207 5.78 14.8307 5.5 14.7707 5.1L14.5507 3.8C14.4107 2.93 14.3807 2.76 13.3207 2.76H10.7007C9.64074 2.76 9.62074 2.9 9.47074 3.79L9.24074 5.09C9.18074 5.46 8.86074 5.72 8.50074 5.72Z"
|
|
330
|
+
fill="#292D32"
|
|
331
|
+
/>
|
|
332
|
+
<path
|
|
333
|
+
d="M15.2104 22.7501H8.79039C5.30039 22.7501 5.16039 20.8201 5.05039 19.2601L4.40039 9.19007C4.37039 8.78007 4.69039 8.42008 5.10039 8.39008C5.52039 8.37008 5.87039 8.68008 5.90039 9.09008L6.55039 19.1601C6.66039 20.6801 6.70039 21.2501 8.79039 21.2501H15.2104C17.3104 21.2501 17.3504 20.6801 17.4504 19.1601L18.1004 9.09008C18.1304 8.68008 18.4904 8.37008 18.9004 8.39008C19.3104 8.42008 19.6304 8.77007 19.6004 9.19007L18.9504 19.2601C18.8404 20.8201 18.7004 22.7501 15.2104 22.7501Z"
|
|
334
|
+
fill="#292D32"
|
|
335
|
+
/>
|
|
336
|
+
<path
|
|
337
|
+
d="M13.6601 17.25H10.3301C9.92008 17.25 9.58008 16.91 9.58008 16.5C9.58008 16.09 9.92008 15.75 10.3301 15.75H13.6601C14.0701 15.75 14.4101 16.09 14.4101 16.5C14.4101 16.91 14.0701 17.25 13.6601 17.25Z"
|
|
338
|
+
fill="#292D32"
|
|
339
|
+
/>
|
|
340
|
+
<path
|
|
341
|
+
d="M14.5 13.25H9.5C9.09 13.25 8.75 12.91 8.75 12.5C8.75 12.09 9.09 11.75 9.5 11.75H14.5C14.91 11.75 15.25 12.09 15.25 12.5C15.25 12.91 14.91 13.25 14.5 13.25Z"
|
|
342
|
+
fill="#292D32"
|
|
343
|
+
/>
|
|
344
|
+
</svg>
|
|
345
|
+
</IconButton>
|
|
346
|
+
</div>
|
|
347
|
+
{/if}
|
|
348
|
+
</ResponsiveTable.Cell>
|
|
349
|
+
{/each}
|
|
350
|
+
</ResponsiveTable.Line>
|
|
351
|
+
{/each}
|
|
352
|
+
{/if}
|
|
353
|
+
</ResponsiveTable.Body>
|
|
354
|
+
</ResponsiveTable.Root> -->
|
|
250
355
|
</div>
|
|
251
356
|
</div>
|
|
252
357
|
|
|
253
358
|
<style>
|
|
359
|
+
.table {
|
|
360
|
+
width: 100%;
|
|
361
|
+
height: fit-content;
|
|
362
|
+
border-radius: 0 var(--radius-m) var(--radius-m) 0;
|
|
363
|
+
overflow: clip;
|
|
364
|
+
border: 1px solid var(--stroke);
|
|
365
|
+
border-left: 3px solid var(--accent);
|
|
366
|
+
}
|
|
367
|
+
|
|
254
368
|
.title {
|
|
255
369
|
display: flex;
|
|
256
370
|
align-items: center;
|
|
257
|
-
|
|
258
|
-
|
|
371
|
+
justify-content: space-between;
|
|
372
|
+
padding: var(--pad-m);
|
|
259
373
|
width: 100%;
|
|
260
374
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
375
|
+
.title {
|
|
376
|
+
border-bottom: 1px solid var(--bg-blur);
|
|
377
|
+
position: sticky;
|
|
378
|
+
top: 45px;
|
|
379
|
+
background-color: var(--bg-1);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.right {
|
|
383
|
+
display: flex;
|
|
384
|
+
align-items: center;
|
|
385
|
+
column-gap: var(--pad-m);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
:global(.table-container .line:has(> .cell > .delete .button:hover)) {
|
|
265
389
|
background-color: var(--red-b);
|
|
266
390
|
}
|
|
267
391
|
|
|
@@ -275,12 +399,32 @@
|
|
|
275
399
|
padding: var(--pad-s);
|
|
276
400
|
}
|
|
277
401
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
402
|
+
.table-container.hidden {
|
|
403
|
+
display: none;
|
|
404
|
+
overflow: hidden;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.header {
|
|
408
|
+
display: grid;
|
|
409
|
+
grid-template-columns: repeat(var(--column-number), 1fr);
|
|
410
|
+
background-color: var(--bg-blur);
|
|
411
|
+
padding: var(--pad-m);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.body {
|
|
415
|
+
display: flex;
|
|
416
|
+
flex-direction: column;
|
|
417
|
+
padding: var(--pad-xs);
|
|
285
418
|
}
|
|
419
|
+
|
|
420
|
+
.line {
|
|
421
|
+
display: grid;
|
|
422
|
+
grid-template-columns: repeat(var(--column-number), 1fr);
|
|
423
|
+
border-bottom: 1px solid var(--stroke);
|
|
424
|
+
padding-top: var(--pad-xs);
|
|
425
|
+
}
|
|
426
|
+
.line:last-child {
|
|
427
|
+
border-bottom: initial;
|
|
428
|
+
}
|
|
429
|
+
|
|
286
430
|
</style>
|
|
@@ -74,14 +74,22 @@ export default createFieldType({
|
|
|
74
74
|
|
|
75
75
|
const lines = JSON.parse(value)
|
|
76
76
|
|
|
77
|
+
console.log("tyext");
|
|
78
|
+
console.log(lines);
|
|
77
79
|
let newLines = []
|
|
78
80
|
|
|
79
81
|
for (const lineCtx of lines) {
|
|
80
82
|
const newLineCtx = createNewCtxFromBinding(lineEntity, lineCtx, bindings)
|
|
83
|
+
console.log("comp");
|
|
84
|
+
|
|
85
|
+
console.log(lineCtx);
|
|
86
|
+
console.log(newLineCtx);
|
|
81
87
|
|
|
82
88
|
newLines.push(newLineCtx)
|
|
83
89
|
}
|
|
84
90
|
|
|
91
|
+
|
|
92
|
+
|
|
85
93
|
return JSON.stringify(newLines)
|
|
86
94
|
},
|
|
87
95
|
|