mountain-ui 1.0.156 → 1.0.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mountain-ui",
3
3
  "private": false,
4
- "version": "1.0.156",
4
+ "version": "1.0.158",
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",
@@ -76,7 +76,7 @@
76
76
  "vitest-browser-svelte": "^2.1.1"
77
77
  },
78
78
  "dependencies": {
79
- "hamzus-ui": "^0.0.268"
79
+ "hamzus-ui": "^0.0.270"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=18.0.0"
@@ -2,7 +2,7 @@
2
2
  import FieldTypeView from '../../fieldTypeRegistry/components/FieldTypeView.svelte';
3
3
  import { entityRegistry } from '../registry.svelte';
4
4
 
5
- let { id, value, entityId = null, onChange = () => {}, onChangeDetails = () => {}, ...props } = $props();
5
+ let { id, value, entityId = null, onChange = () => {}, onChangeDetails = () => {}, hideLabel =false, ...props } = $props();
6
6
 
7
7
  const field = $derived(entityRegistry.selectField(id, entityId));
8
8
 
@@ -14,7 +14,8 @@
14
14
  id={$field.id}
15
15
  value={value}
16
16
  entity_id={$field.entity_id}
17
- label={$field.name}
17
+ label={hideLabel ? null : $field.name}
18
+ {...(hideLabel ? {placeholder:$field.name} : {})}
18
19
  {...$field.props}
19
20
  type={$field.type}
20
21
  required={$field.is_required}
@@ -344,91 +344,6 @@
344
344
  {/each}
345
345
  {/if}
346
346
  </div>
347
- <!-- <ResponsiveTable.Root let:ctx>
348
- {#if columns.length > 0}
349
- <ResponsiveTable.Header>
350
- {#each columns as column, columnIndex}
351
- <ResponsiveTable.HeaderCell align="left" label={column.name ?? '-'} {ctx}>
352
- <h6>{columns[columnIndex].name ?? ''}</h6>
353
-
354
- </ResponsiveTable.HeaderCell>
355
- {/each}
356
- </ResponsiveTable.Header>
357
- {/if}
358
- <ResponsiveTable.Body>
359
- {#if $entity}
360
- {#each table as line, lineIndex (line.id)}
361
- <ResponsiveTable.Line>
362
- {#each columns as column, columnIndex}
363
- <ResponsiveTable.Cell {ctx}>
364
- {#each column.rows as row, rowIndex}
365
- <FieldInput
366
- compact
367
- detailsCtx={table[lineIndex].detailsCtx}
368
- ctx={table[lineIndex].ctx}
369
- onChangeDetails={(value) => {
370
- handleChangeDetails(lineIndex, row.fieldId, value);
371
- }}
372
- onChange={(value) => {
373
- handleChange(lineIndex, row.fieldId, value);
374
- }}
375
- changeCtx={(fieldId, value) => {
376
- handleChange(lineIndex, fieldId, value);
377
- }}
378
- id={row.fieldId}
379
- value={table[lineIndex].ctx?.[row.fieldId] ?? null}
380
- registerCalculation={(config) => {
381
- handleRegisterCalculation(lineIndex, config);
382
- }}
383
- ></FieldInput>
384
- {/each}
385
- {#if columnIndex + 1 === columns.length}
386
- <div class="delete">
387
- <IconButton
388
- avoidRipple
389
- variant="destructive"
390
- onClick={() => {
391
- handleDeleteLine(lineIndex);
392
- }}
393
- >
394
- <svg
395
- width="24"
396
- height="24"
397
- viewBox="0 0 24 24"
398
- fill="none"
399
- xmlns="http://www.w3.org/2000/svg"
400
- >
401
- <path
402
- 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"
403
- fill="#292D32"
404
- />
405
- <path
406
- 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"
407
- fill="#292D32"
408
- />
409
- <path
410
- 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"
411
- fill="#292D32"
412
- />
413
- <path
414
- 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"
415
- fill="#292D32"
416
- />
417
- <path
418
- 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"
419
- fill="#292D32"
420
- />
421
- </svg>
422
- </IconButton>
423
- </div>
424
- {/if}
425
- </ResponsiveTable.Cell>
426
- {/each}
427
- </ResponsiveTable.Line>
428
- {/each}
429
- {/if}
430
- </ResponsiveTable.Body>
431
- </ResponsiveTable.Root> -->
432
347
  </div>
433
348
  </div>
434
349
 
@@ -460,7 +375,7 @@
460
375
  width: 100%;
461
376
  }
462
377
  .table:has( .hidden) .title {
463
- border-bottom: 1px solid var(--bg-blur);
378
+ border-bottom: 0;
464
379
  }
465
380
 
466
381
  .table-container:global( .title) {
@@ -504,7 +419,7 @@
504
419
  display: grid;
505
420
  grid-template-columns: repeat(var(--column-number), minmax(0, 1fr));
506
421
  border-bottom: 1px solid var(--stroke);
507
- padding-top: var(--pad-xs);
422
+ padding: var(--pad-xs);
508
423
  border-radius: var(--radius-m);
509
424
  overflow: clip;
510
425
  border: 1px solid var(--stroke);
@@ -515,8 +430,13 @@
515
430
  background-color: var(--red-b);
516
431
  }
517
432
 
518
- .table .body .line:global(:has(.table) .table .body .line) {
433
+ .table .body .line:global(:has(.table) .table .body > .line) {
519
434
  border: 0px;
435
+ border-radius: 0;
436
+ border-bottom: 1px solid var(--bg-blur);
437
+ }
438
+ .table .body .line:global(:has(.table) .table .body > .line:last-child) {
439
+ border-bottom: 0;
520
440
  }
521
441
 
522
442
  .cell-delete {
@@ -6,55 +6,199 @@
6
6
  import FieldView from '../../../entityRegistry/components/FieldView.svelte';
7
7
  import Label from '../../components/Label.svelte';
8
8
 
9
- let { value, unique, secret, label, required, columns = [] } = $props();
9
+ let { value, unique, secret,
10
+ placeholder = '', label, required, columns = [], headerIsHidden =false, number = false, labelIsHidden= false, depth = 0 } = $props();
10
11
 
11
12
  let entries = $state([]);
13
+ let isHidden = $state(false);
12
14
 
13
15
  $effect(() => {
16
+ entries = value?.formated?.entries ?? {};
17
+
18
+ console.log(entries);
14
19
 
15
- entries = value?.formated?.entries ?? {};
16
20
  });
21
+
22
+ function handleToggleVisibility() {
23
+ isHidden = !isHidden;
24
+ }
17
25
  </script>
18
26
 
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>
27
+ <div class="table">
28
+ <div class="title">
29
+ <div class="right">
30
+ <IconButton size="24px" variant="ghost" onClick={handleToggleVisibility}>
31
+ <svg
32
+ width="24"
33
+ height="24"
34
+ viewBox="0 0 24 24"
35
+ fill="none"
36
+ xmlns="http://www.w3.org/2000/svg"
37
+ >
38
+ <path
39
+ 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"
40
+ fill="#292D32"
41
+ />
42
+ </svg>
43
+ </IconButton>
44
+ <Label label={label ?? placeholder} {required} {secret} {unique}></Label>
45
+ </div>
46
+ </div>
47
+ <div class="table-container" style="--column-number:{columns.length};" class:hidden={isHidden}>
48
+ {#if !headerIsHidden && columns.length > 0 && columns.find((c) => (c.name ?? false) !== false)}
49
+ <div class="header">
36
50
  {#each columns as column, columnIndex}
37
- <ResponsiveTable.Cell {ctx}>
38
- {#each column.rows as row, rowIndex}
39
- {@const field = entityRegistry.getField(row.fieldId)}
40
- <FieldView
41
- compact
42
- id={row.fieldId}
43
- entityId={field.entity_id}
44
- value={line[field.normalized_name] ?? "null"}
45
- ></FieldView>
46
- {/each}
47
- </ResponsiveTable.Cell>
51
+ <div class="header-cell">
52
+ <h6>{columns[columnIndex].name ?? ''}</h6>
53
+ </div>
48
54
  {/each}
49
- </ResponsiveTable.Line>
50
- {/each}
51
- </ResponsiveTable.Body>
52
- </ResponsiveTable.Root>
55
+ </div>
56
+ {/if}
57
+ <div class="body">
58
+ {#each entries as line, lineIndex (line.id)}
59
+ <div class="line">
60
+ {#each columns as column, columnIndex}
61
+ <div class="cell" style="--depth:{depth};">
62
+ {#each column.rows as row, rowIndex}
63
+ {#if row.fieldId}
64
+ {@const field = entityRegistry.getField(row.fieldId)}
65
+ {#if number && rowIndex === 0 && columnIndex === 0}
66
+ <div class="cell-start">
67
+ <div class="number">
68
+ <h4>{lineIndex + 1}</h4>
69
+ </div>
70
+ <FieldView
71
+ hideLabel={labelIsHidden}
72
+ compact
73
+ id={row.fieldId}
74
+ entityId={field.entity_id}
75
+ value={line[field.normalized_name] ?? 'null'}
76
+ depth={depth + 1}
77
+ ></FieldView>
78
+ </div>
79
+ {:else}
80
+ <FieldView
81
+ compact
82
+ hideLabel={labelIsHidden}
83
+ id={row.fieldId}
84
+ entityId={field.entity_id}
85
+ value={line[field.normalized_name] ?? 'null'}
86
+ depth={depth + 1}
87
+ ></FieldView>
88
+ {/if}
89
+ {/if}
90
+ {/each}
91
+ </div>
92
+ {/each}
93
+ </div>
94
+ {/each}
95
+ </div>
96
+ </div>
97
+ </div>
53
98
 
54
99
  <style>
55
- .title {
100
+ .table {
101
+ width: 100%;
102
+ height: fit-content;
103
+ }
104
+
105
+ .table:global(:has(.table) .table) {
106
+ border-left: 0px;
107
+ border-radius: 0px;
108
+ border: 0px;
109
+ border-top: 1px solid var(--stroke);
110
+ }
111
+
112
+ .table:global(:has(.table) .table) .title {
113
+ padding-left: var(--pad-xxl);
114
+ }
115
+ .table:global(:has(.table) .table) .body {
116
+ padding-left: var(--pad-xxl);
117
+ }
118
+
119
+ .title {
56
120
  display: flex;
57
121
  align-items: center;
122
+ justify-content: space-between;
123
+ padding: var(--pad-s);
58
124
  width: 100%;
59
125
  }
126
+ .table:has(.hidden) .title {
127
+ border-bottom: 0;
128
+ }
129
+
130
+ .table-container:global( .title) {
131
+ background-color: var(--bg-1);
132
+ position: sticky;
133
+ top: 45px;
134
+ z-index: 3;
135
+ border-bottom: 1px solid var(--bg-blur);
136
+ }
137
+
138
+ .right {
139
+ display: flex;
140
+ align-items: center;
141
+ column-gap: var(--pad-m);
142
+ }
143
+
144
+
145
+ .table-container.hidden {
146
+ display: none;
147
+ overflow: hidden;
148
+ }
149
+
150
+ .header {
151
+ display: grid;
152
+ grid-template-columns: repeat(var(--column-number), 1fr);
153
+ padding: var(--pad-m);
154
+ }
155
+
156
+ .body {
157
+ display: flex;
158
+ flex-direction: column;
159
+ row-gap: var(--pad-s);
160
+ }
161
+
162
+ .line {
163
+ display: grid;
164
+ grid-template-columns: repeat(var(--column-number), minmax(0, 1fr));
165
+ border-bottom: 1px solid var(--stroke);
166
+ padding: var(--pad-xs);
167
+ border-radius: var(--radius-m);
168
+ overflow: clip;
169
+ border: 1px solid var(--stroke);
170
+ border-left: 3px solid var(--accent);
171
+ }
172
+
173
+ :global(.line:has(> .cell > .cell-delete .delete .button:hover)) {
174
+ background-color: var(--red-b);
175
+ }
176
+
177
+ .table .body .line:global(:has(.table) .table .body > .line) {
178
+ border: 0px;
179
+ border-radius: 0;
180
+ border-bottom: 1px solid var(--bg-blur);
181
+ }
182
+ .table .body .line:global(:has(.table) .table .body > .line:last-child) {
183
+ border-bottom: 0;
184
+ }
185
+
186
+ .cell-delete {
187
+ display: grid;
188
+ grid-template-columns: 1fr 45px;
189
+ }
190
+
191
+ .cell-start {
192
+ display: grid;
193
+ grid-template-columns: 24px 1fr;
194
+ }
195
+
196
+ .number {
197
+ display: flex;
198
+ align-items: center;
199
+ justify-content: center;
200
+ }
201
+ .number h4 {
202
+ color: hsl(calc(var(--depth) * 45), 70%, 60%);
203
+ }
60
204
  </style>
@@ -3,12 +3,12 @@
3
3
  import Line from '../../../components/Line.svelte';
4
4
  import { Input } from 'hamzus-ui';
5
5
 
6
- let { label, unique = false, secret = false, compact = false, required, ...props } = $props();
6
+ let { label, unique = false, secret = false, compact = false, required, placeholder="un nombre entier", ...props } = $props();
7
7
  </script>
8
8
 
9
9
  <Line {compact}>
10
10
  {#if label}
11
11
  <Label {unique} {secret} {label} {required}></Label>
12
12
  {/if}
13
- <Input {...props} type="number" step="1" placeholder="un nombre entier" {required} />
13
+ <Input {...props} type="number" step="1" {placeholder} {required} />
14
14
  </Line>
@@ -7,6 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <LineView {compact}>
10
- <Label {unique} {secret} {label} {required}></Label>
10
+ {#if label}
11
+ <Label {unique} {secret} {label} {required}></Label>
12
+ {/if}
11
13
  <ViewText>{value === null ? '-' : value.flat}</ViewText>
12
14
  </LineView>
@@ -7,6 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <LineView {compact}>
10
- <Label {unique} {secret} {label} {required}></Label>
10
+ {#if label}
11
+ <Label {unique} {secret} {label} {required}></Label>
12
+ {/if}
11
13
  <ViewText>{value === null ? '-' : value.flat}</ViewText>
12
14
  </LineView>
@@ -7,6 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <LineView {compact}>
10
- <Label {unique} {secret} {label} {required}></Label>
10
+ {#if label}
11
+ <Label {unique} {secret} {label} {required}></Label>
12
+ {/if}
11
13
  <ViewText>{value === null ? '-' : value.flat}</ViewText>
12
14
  </LineView>
@@ -17,6 +17,8 @@
17
17
  </script>
18
18
 
19
19
  <Line {compact}>
20
- <Label {unique} {secret} {label} {required}></Label>
20
+ {#if label}
21
+ <Label {unique} {secret} {label} {required}></Label>
22
+ {/if}
21
23
  <TextArea {...props} {placeholder} bind:value {required}></TextArea>
22
24
  </Line>
@@ -7,6 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <LineView {compact}>
10
- <Label {unique} {secret} {label} {required}></Label>
10
+ {#if label}
11
+ <Label {unique} {secret} {label} {required}></Label>
12
+ {/if}
11
13
  <ViewText>{value === null ? '-' : value.flat}</ViewText>
12
14
  </LineView>
@@ -8,6 +8,8 @@
8
8
  </script>
9
9
 
10
10
  <LineView {compact}>
11
- <Label {unique} {secret} {label} {required}></Label>
11
+ {#if label}
12
+ <Label {unique} {secret} {label} {required}></Label>
13
+ {/if}
12
14
  <Link href="mailto:{value?.flat ?? ""}" label={value?.flat ?? ""}/>
13
15
  </LineView>
@@ -7,6 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <LineView {compact}>
10
- <Label {unique} {secret} {label} {required}></Label>
10
+ {#if label}
11
+ <Label {unique} {secret} {label} {required}></Label>
12
+ {/if}
11
13
  <ViewText>{value === null ? '-' : value.flat}</ViewText>
12
14
  </LineView>
@@ -8,6 +8,8 @@
8
8
  </script>
9
9
 
10
10
  <LineView {compact}>
11
- <Label {unique} {secret} {label} {required}></Label>
11
+ {#if label}
12
+ <Label {unique} {secret} {label} {required}></Label>
13
+ {/if}
12
14
  <Link href="mailto:{value?.flat ?? ""}" label={value?.flat ?? ""}/>
13
15
  </LineView>
@@ -19,6 +19,8 @@
19
19
  </div>
20
20
  </Dialog>
21
21
  <LineView {compact}>
22
- <Label {unique} {secret} {label} {required}></Label>
22
+ {#if label}
23
+ <Label {unique} {secret} {label} {required}></Label>
24
+ {/if}
23
25
  <ViewText>{value === null ? '-' : value.flat}</ViewText>
24
26
  </LineView>
@@ -7,6 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <Line {compact}>
10
- <Label {unique} {secret} {label} {required}></Label>
10
+ {#if label}
11
+ <Label {unique} {secret} {label} {required}></Label>
12
+ {/if}
11
13
  <FrequencyPicker {...props} {required}></FrequencyPicker>
12
14
  </Line>
@@ -68,6 +68,8 @@
68
68
  </script>
69
69
 
70
70
  <LineView {compact}>
71
- <Label {unique} {secret} {label} {required}></Label>
71
+ {#if label}
72
+ <Label {unique} {secret} {label} {required}></Label>
73
+ {/if}
72
74
  <ViewText>{value === null || !value.flat ? '-' : getText(value.flat)}</ViewText>
73
75
  </LineView>