grav-svelte 0.0.85 → 0.0.88
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/dist/CRUD/CrudFilters.css +24 -5
- package/dist/CRUD/CrudFilters.svelte +60 -90
- package/dist/CRUD/CrudFilters.svelte.d.ts +2 -0
- package/dist/CRUD/CrudTableButtons.svelte +1 -1
- package/dist/CRUD/CrudWrapper.svelte +7 -17
- package/dist/CRUD/PaginationCRUD.css +3 -3
- package/dist/CRUD/Tooltip.svelte +1 -1
- package/dist/CRUD/cells/CellRenderer.svelte +67 -62
- package/dist/CRUD/cells/TextAreaCell.svelte +19 -0
- package/dist/CRUD/cells/TextAreaCell.svelte.d.ts +18 -0
- package/dist/CRUD/interfaces.d.ts +1 -1
- package/dist/CRUD/styles/CrudTable.css +436 -383
- package/dist/Inputs/InputFormBool.svelte +2 -2
- package/dist/Modals/Grav_Modal.css +1 -6
- package/dist/typography.css +7 -12
- package/package.json +1 -1
|
@@ -54,6 +54,13 @@
|
|
|
54
54
|
justify-content: center;
|
|
55
55
|
align-items: center;
|
|
56
56
|
gap: 0.5rem;
|
|
57
|
+
margin-top: 0.5rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (min-width: 640px) {
|
|
61
|
+
.filters-actions {
|
|
62
|
+
margin-top: 0;
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
.filters-controls {
|
|
@@ -106,7 +113,7 @@
|
|
|
106
113
|
|
|
107
114
|
.filter-group {
|
|
108
115
|
display: inline-flex;
|
|
109
|
-
gap: 0.
|
|
116
|
+
gap: 0.5rem;
|
|
110
117
|
padding: 0.5rem;
|
|
111
118
|
}
|
|
112
119
|
|
|
@@ -121,27 +128,39 @@
|
|
|
121
128
|
.filter-button {
|
|
122
129
|
display: inline-flex;
|
|
123
130
|
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
124
132
|
cursor: pointer;
|
|
125
133
|
height: 2.5rem;
|
|
126
134
|
font-family: var(--grav-crud-button-font-family, 'mundial', sans-serif);
|
|
127
|
-
font-size:
|
|
135
|
+
font-size: 1.1rem;
|
|
128
136
|
font-weight: var(--grav-crud-button-font-weight, 500);
|
|
129
137
|
line-height: var(--grav-crud-button-line-height, 1.5);
|
|
130
138
|
border-width: var(--grav-crud-filter-border-width, 1.5px);
|
|
131
139
|
border-style: solid;
|
|
132
140
|
border-color: var(--grav-crud-color-neutral);
|
|
133
141
|
color: var(--grav-crud-color-neutral);
|
|
134
|
-
border-radius: var(--grav-crud-filter-border-radius, 0.5rem)
|
|
135
|
-
padding: 0.
|
|
142
|
+
border-radius: var(--grav-crud-filter-border-radius, 0.5rem);
|
|
143
|
+
padding: 0.75rem 1rem;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
@media (min-width: 640px) {
|
|
139
147
|
.filter-button {
|
|
140
148
|
padding: 0.75rem 1rem;
|
|
141
|
-
font-size:
|
|
149
|
+
font-size: 1.2rem;
|
|
142
150
|
}
|
|
143
151
|
}
|
|
144
152
|
|
|
153
|
+
.filter-button-active {
|
|
154
|
+
background-color: var(--grav-crud-color-neutral);
|
|
155
|
+
color: var(--grav-crud-color-bg);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.filters-actions {
|
|
159
|
+
display: flex;
|
|
160
|
+
justify-content: right;
|
|
161
|
+
align-items: center;
|
|
162
|
+
}
|
|
163
|
+
|
|
145
164
|
.filter-button-middle {
|
|
146
165
|
border-radius: 0;
|
|
147
166
|
}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
export let Filtros: FiltrosI[];
|
|
25
25
|
export let showAddButton: boolean = true;
|
|
26
26
|
export let showImportButton: boolean = true;
|
|
27
|
+
export let showSettingsButton: boolean = false;
|
|
27
28
|
export let showMostrandoInput: boolean = true;
|
|
28
29
|
export let Titulo_Crud: string;
|
|
29
30
|
|
|
@@ -181,108 +182,41 @@
|
|
|
181
182
|
<div class="filter-group" role="group">
|
|
182
183
|
{#if Filtros && Filtros.length > 0}
|
|
183
184
|
{#if showFilters}
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<svg
|
|
190
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
191
|
-
width="16"
|
|
192
|
-
height="16"
|
|
193
|
-
viewBox="0 0 24 24"
|
|
194
|
-
fill="none"
|
|
195
|
-
stroke="currentColor"
|
|
196
|
-
stroke-width="2"
|
|
197
|
-
stroke-linecap="round"
|
|
198
|
-
stroke-linejoin="round"
|
|
199
|
-
class="mr-1"
|
|
185
|
+
<Tooltip text="Ver filtros">
|
|
186
|
+
<button
|
|
187
|
+
type="button"
|
|
188
|
+
on:click={() => (showFilters = !showFilters)}
|
|
189
|
+
class="filter-button filter-button-active"
|
|
200
190
|
>
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</svg>
|
|
205
|
-
{showFilters ? "▲" : "▼"}
|
|
206
|
-
</button>
|
|
191
|
+
<i class="fa-solid fa-sliders"></i>
|
|
192
|
+
</button>
|
|
193
|
+
</Tooltip>
|
|
207
194
|
{:else}
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
<svg
|
|
214
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
215
|
-
width="16"
|
|
216
|
-
height="16"
|
|
217
|
-
viewBox="0 0 24 24"
|
|
218
|
-
fill="none"
|
|
219
|
-
stroke="currentColor"
|
|
220
|
-
stroke-width="2"
|
|
221
|
-
stroke-linecap="round"
|
|
222
|
-
stroke-linejoin="round"
|
|
223
|
-
class="mr-1"
|
|
195
|
+
<Tooltip text="Ver filtros">
|
|
196
|
+
<button
|
|
197
|
+
type="button"
|
|
198
|
+
on:click={() => (showFilters = !showFilters)}
|
|
199
|
+
class="filter-button"
|
|
224
200
|
>
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
</svg>
|
|
229
|
-
{showFilters ? "▲" : "▼"}
|
|
230
|
-
</button>
|
|
201
|
+
<i class="fa-solid fa-sliders"></i>
|
|
202
|
+
</button>
|
|
203
|
+
</Tooltip>
|
|
231
204
|
{/if}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<Tooltip text="
|
|
235
|
-
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
236
|
-
<button
|
|
237
|
-
type="button"
|
|
238
|
-
on:click={() => actualizarFiltro()}
|
|
239
|
-
class="filter-button filter-button-middle"
|
|
240
|
-
aria-label="Aplicar filtros"
|
|
241
|
-
>
|
|
242
|
-
<i class="fas fa-search"></i>
|
|
243
|
-
</button>
|
|
244
|
-
</Tooltip>
|
|
245
|
-
|
|
246
|
-
<!-- Btn de limpiar filtros -->
|
|
247
|
-
<Tooltip text="Borrar filtro">
|
|
248
|
-
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
205
|
+
{/if}
|
|
206
|
+
{#if showSettingsButton}
|
|
207
|
+
<Tooltip text="Configuración">
|
|
249
208
|
<button
|
|
250
209
|
type="button"
|
|
251
|
-
on:click={() =>
|
|
252
|
-
class="filter-button
|
|
210
|
+
on:click={() => dispatch("settings")}
|
|
211
|
+
class="filter-button"
|
|
253
212
|
>
|
|
254
|
-
<
|
|
255
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
256
|
-
width="16"
|
|
257
|
-
height="16"
|
|
258
|
-
viewBox="0 0 24 24"
|
|
259
|
-
fill="none"
|
|
260
|
-
stroke="currentColor"
|
|
261
|
-
stroke-width="2"
|
|
262
|
-
stroke-linecap="round"
|
|
263
|
-
stroke-linejoin="round"
|
|
264
|
-
>
|
|
265
|
-
<polyline points="3 6 5 6 21 6"></polyline>
|
|
266
|
-
<path
|
|
267
|
-
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
|
268
|
-
></path>
|
|
269
|
-
</svg>
|
|
213
|
+
<i class="fas fa-cog"></i>
|
|
270
214
|
</button>
|
|
271
215
|
</Tooltip>
|
|
272
216
|
{/if}
|
|
273
217
|
</div>
|
|
274
218
|
|
|
275
|
-
|
|
276
|
-
{#if showMostrandoInput}
|
|
277
|
-
<div class="page-size-input">
|
|
278
|
-
<InputFormText
|
|
279
|
-
label="Mostrando:"
|
|
280
|
-
bind:valueVar={localPageSizeStr}
|
|
281
|
-
noMarginTop={true}
|
|
282
|
-
/>
|
|
283
|
-
</div>
|
|
284
|
-
{/if}
|
|
285
|
-
<!-- /Filtro 2 -->
|
|
219
|
+
|
|
286
220
|
</div>
|
|
287
221
|
</div>
|
|
288
222
|
<!-- Filtros Dynamic -->
|
|
@@ -352,6 +286,42 @@
|
|
|
352
286
|
</div>
|
|
353
287
|
{/if}
|
|
354
288
|
{/each}
|
|
289
|
+
<!-- Filtro 2 -->
|
|
290
|
+
{#if showMostrandoInput}
|
|
291
|
+
|
|
292
|
+
<div class="filter-item ">
|
|
293
|
+
<InputFormText
|
|
294
|
+
label="Mostrando:"
|
|
295
|
+
bind:valueVar={localPageSizeStr}
|
|
296
|
+
/>
|
|
297
|
+
</div>
|
|
298
|
+
{/if}
|
|
299
|
+
<!-- /Filtro 2 -->
|
|
300
|
+
</div>
|
|
301
|
+
<!-- Btn de aplicar filtro -->
|
|
302
|
+
<div class="filters-actions">
|
|
303
|
+
<!-- Btn de limpiar filtros -->
|
|
304
|
+
<Tooltip text="Borrar filtro">
|
|
305
|
+
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
306
|
+
<button
|
|
307
|
+
type="button"
|
|
308
|
+
on:click={() => clearFilters()}
|
|
309
|
+
class="filter-button"
|
|
310
|
+
>
|
|
311
|
+
Limpiar
|
|
312
|
+
</button>
|
|
313
|
+
</Tooltip>
|
|
314
|
+
<Tooltip text="Aplicar filtro">
|
|
315
|
+
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
316
|
+
<button
|
|
317
|
+
type="button"
|
|
318
|
+
on:click={() => actualizarFiltro()}
|
|
319
|
+
class="filter-button"
|
|
320
|
+
aria-label="Aplicar filtros"
|
|
321
|
+
>
|
|
322
|
+
Filtrar
|
|
323
|
+
</button>
|
|
324
|
+
</Tooltip>
|
|
355
325
|
</div>
|
|
356
326
|
{/if}
|
|
357
327
|
</div>
|
|
@@ -8,12 +8,14 @@ declare const __propDef: {
|
|
|
8
8
|
Filtros: FiltrosI[];
|
|
9
9
|
showAddButton?: boolean;
|
|
10
10
|
showImportButton?: boolean;
|
|
11
|
+
showSettingsButton?: boolean;
|
|
11
12
|
showMostrandoInput?: boolean;
|
|
12
13
|
Titulo_Crud: string;
|
|
13
14
|
};
|
|
14
15
|
events: {
|
|
15
16
|
add: CustomEvent<any>;
|
|
16
17
|
import: CustomEvent<any>;
|
|
18
|
+
settings: CustomEvent<any>;
|
|
17
19
|
filtrar: CustomEvent<any>;
|
|
18
20
|
} & {
|
|
19
21
|
[evt: string]: CustomEvent<any>;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
color: white;
|
|
50
50
|
text-align: center;
|
|
51
51
|
font-size: 0.75rem;
|
|
52
|
-
background-color: var(--grav-crud-color-
|
|
52
|
+
background-color: var(--grav-crud-color-tooltip);
|
|
53
53
|
border-radius: var(--grav-crud-tooltip-border-radius, 0.25rem);
|
|
54
54
|
top: -1.8rem;
|
|
55
55
|
right: -2.5rem;
|
|
@@ -130,8 +130,10 @@
|
|
|
130
130
|
on:filtrar={handleFiltroAplicado}
|
|
131
131
|
on:add={handleAdd}
|
|
132
132
|
on:import={handleImport}
|
|
133
|
+
on:settings={handleSettings}
|
|
133
134
|
{showAddButton}
|
|
134
135
|
{showImportButton}
|
|
136
|
+
{showSettingsButton}
|
|
135
137
|
{showMostrandoInput}
|
|
136
138
|
{Titulo_Crud}
|
|
137
139
|
/>
|
|
@@ -157,19 +159,8 @@
|
|
|
157
159
|
/>
|
|
158
160
|
</div>
|
|
159
161
|
|
|
160
|
-
{#if
|
|
162
|
+
{#if showExcelButton || showPdfButton}
|
|
161
163
|
<div class="export-buttons">
|
|
162
|
-
<div class="buttons-left">
|
|
163
|
-
{#if showSettingsButton}
|
|
164
|
-
<button
|
|
165
|
-
type="button"
|
|
166
|
-
on:click={handleSettings}
|
|
167
|
-
class="export-button settings-button"
|
|
168
|
-
>
|
|
169
|
-
<i class="fas fa-cog"></i>
|
|
170
|
-
</button>
|
|
171
|
-
{/if}
|
|
172
|
-
</div>
|
|
173
164
|
<div class="buttons-right">
|
|
174
165
|
{#if showExcelButton}
|
|
175
166
|
<button
|
|
@@ -214,10 +205,9 @@
|
|
|
214
205
|
display: flex;
|
|
215
206
|
gap: 1rem;
|
|
216
207
|
margin-top: 1rem;
|
|
217
|
-
justify-content:
|
|
208
|
+
justify-content: flex-end;
|
|
218
209
|
}
|
|
219
210
|
|
|
220
|
-
.buttons-left,
|
|
221
211
|
.buttons-right {
|
|
222
212
|
display: flex;
|
|
223
213
|
gap: 1rem;
|
|
@@ -229,15 +219,15 @@
|
|
|
229
219
|
color: white;
|
|
230
220
|
padding: 1rem;
|
|
231
221
|
border-radius: 0.25rem;
|
|
232
|
-
background-color: var(--grav-crud-color-
|
|
222
|
+
background-color: var(--grav-crud-color-bg);
|
|
233
223
|
color: var(--grav-crud-color-button);
|
|
234
|
-
border: 1px solid var(--grav-crud-color-
|
|
224
|
+
border: 1px solid var(--grav-crud-color-bg);
|
|
235
225
|
}
|
|
236
226
|
|
|
237
227
|
.export-button:hover {
|
|
238
228
|
transition: all 0.2s ease;
|
|
239
229
|
background-color: transparent;
|
|
240
|
-
color: var(--grav-crud-color-
|
|
230
|
+
color: var(--grav-crud-color-bg);
|
|
241
231
|
}
|
|
242
232
|
|
|
243
233
|
.export-button i {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
border-radius: var(--grav-crud-button-border-radius, 0.5rem);
|
|
14
14
|
border-width: var(--grav-crud-button-border-width, 1.5px);
|
|
15
15
|
border-style: solid;
|
|
16
|
-
font-family: var(--grav-crud-button-font-family,
|
|
16
|
+
font-family: var(--grav-crud-button-font-family, var(--grav-font-family));
|
|
17
17
|
font-size: var(--grav-crud-button-font-size, 0.875rem);
|
|
18
18
|
font-weight: var(--grav-crud-button-font-weight, 500);
|
|
19
19
|
line-height: var(--grav-crud-button-line-height, 1.5);
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
.pagination-ellipsis {
|
|
87
87
|
padding: 0 0.5rem;
|
|
88
88
|
color: var(--grav-crud-color-neutral);
|
|
89
|
-
font-family: var(--grav-crud-button-font-family,
|
|
89
|
+
font-family: var(--grav-crud-button-font-family, var(--grav-font-family));
|
|
90
90
|
font-size: var(--grav-crud-button-font-size, 0.875rem);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
.pagination-info {
|
|
101
|
-
font-family: var(--grav-crud-cell-font-family,
|
|
101
|
+
font-family: var(--grav-crud-cell-font-family, var(--grav-font-family));
|
|
102
102
|
font-size: var(--grav-crud-cell-font-size, 0.875rem);
|
|
103
103
|
font-weight: var(--grav-crud-cell-font-weight, 400);
|
|
104
104
|
line-height: var(--grav-crud-cell-line-height, 1.5);
|
package/dist/CRUD/Tooltip.svelte
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
padding: 0.25rem;
|
|
32
32
|
color: white;
|
|
33
33
|
font-size: 0.75rem;
|
|
34
|
-
background-color: var(--grav-crud-color-
|
|
34
|
+
background-color: var(--grav-crud-color-tooltip);
|
|
35
35
|
border-radius: var(--grav-crud-tooltip-border-radius, 0.25rem);
|
|
36
36
|
top: -1.25rem;
|
|
37
37
|
left: -1.5rem;
|
|
@@ -1,69 +1,74 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import type { TableHeader } from "../interfaces.js";
|
|
3
|
+
import CrudTableButtons from "../CrudTableButtons.svelte";
|
|
4
|
+
import TextCell from "./TextCell.svelte";
|
|
5
|
+
import TextAreaCell from "./TextAreaCell.svelte";
|
|
6
|
+
import DateCell from "./DateCell.svelte";
|
|
7
|
+
import BoolCell from "./BoolCell.svelte";
|
|
8
|
+
import EditableBoolCell from "./EditableBoolCell.svelte";
|
|
9
|
+
import EditableTextCell from "./EditableTextCell.svelte";
|
|
10
|
+
import EditableNumberCell from "./EditableNumberCell.svelte";
|
|
11
|
+
import ImageCell from "./ImageCell.svelte";
|
|
12
|
+
import DynamicButtonCell from "./DynamicButtonCell.svelte";
|
|
13
|
+
import ImageButtonCell from "./ImageButtonCell.svelte";
|
|
14
|
+
import DualTextButtonCell from "./DualTextButtonCell.svelte";
|
|
15
|
+
import ConditionalCell from "./ConditionalCell.svelte";
|
|
16
|
+
import MultiTextButtonCell from "./MultiTextButtonCell.svelte";
|
|
17
|
+
import ComponentCell from "./ComponentCell.svelte";
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
export let item: any;
|
|
20
|
+
export let header: TableHeader;
|
|
21
|
+
export let idField: string;
|
|
22
|
+
export let index: number;
|
|
23
|
+
export let dragEnabled: boolean;
|
|
24
|
+
export let expandEnabled: boolean;
|
|
25
|
+
export let onImageClick: (src: string) => void;
|
|
25
26
|
</script>
|
|
26
27
|
|
|
27
28
|
<td
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
class="table-cell {index == 0 && !dragEnabled && !expandEnabled
|
|
30
|
+
? 'sticky-cell'
|
|
31
|
+
: ''} {header.tipo === 'TextArea' ? 'cell-textarea' : ''}"
|
|
32
|
+
style="text-align: {header.align ?? 'center'}; {header.tipo === 'TextArea'
|
|
33
|
+
? `max-height: calc(${header.cellMaxHeight ?? '150px'} + 14px + 0.6rem);`
|
|
34
|
+
: ''}"
|
|
32
35
|
>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
36
|
+
{#if header.tipo == "Text" || header.tipo == "Number"}
|
|
37
|
+
<TextCell {item} {header} />
|
|
38
|
+
{:else if header.tipo == "TextArea"}
|
|
39
|
+
<TextAreaCell {item} {header} />
|
|
40
|
+
{:else if header.tipo == "Date"}
|
|
41
|
+
<DateCell {item} {header} isDatetime={false} />
|
|
42
|
+
{:else if header.tipo == "Datetime"}
|
|
43
|
+
<DateCell {item} {header} isDatetime={true} />
|
|
44
|
+
{:else if header.tipo == "Bool"}
|
|
45
|
+
<BoolCell {item} {header} />
|
|
46
|
+
{:else if header.tipo == "EditableBool"}
|
|
47
|
+
<EditableBoolCell {item} {header} {idField} />
|
|
48
|
+
{:else if header.tipo == "EditableText"}
|
|
49
|
+
<EditableTextCell {item} {header} {idField} />
|
|
50
|
+
{:else if header.tipo == "EditableNumber"}
|
|
51
|
+
<EditableNumberCell {item} {header} {idField} />
|
|
52
|
+
{:else if header.tipo == "Image"}
|
|
53
|
+
<ImageCell {item} {header} {onImageClick} />
|
|
54
|
+
{:else if header.tipo == "Buttons"}
|
|
55
|
+
<CrudTableButtons
|
|
56
|
+
id={item[header.campo]}
|
|
57
|
+
buttonsConfig={header.buttonsConfig ?? []}
|
|
58
|
+
align={header.align ?? "center"}
|
|
59
|
+
row={item}
|
|
60
|
+
/>
|
|
61
|
+
{:else if header.tipo == "DynamicButton"}
|
|
62
|
+
<DynamicButtonCell {item} {header} {idField} />
|
|
63
|
+
{:else if header.tipo == "ImageButton"}
|
|
64
|
+
<ImageButtonCell {item} {header} {idField} />
|
|
65
|
+
{:else if header.tipo == "DualTextButton"}
|
|
66
|
+
<DualTextButtonCell {item} {header} {idField} />
|
|
67
|
+
{:else if header.tipo == "ConditionalCell"}
|
|
68
|
+
<ConditionalCell {item} {header} {idField} />
|
|
69
|
+
{:else if header.tipo == "MultiTextButton"}
|
|
70
|
+
<MultiTextButtonCell {item} {header} {idField} />
|
|
71
|
+
{:else if header.tipo == "Component"}
|
|
72
|
+
<ComponentCell {item} {header} />
|
|
73
|
+
{/if}
|
|
69
74
|
</td>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableHeader } from "../interfaces.js";
|
|
3
|
+
|
|
4
|
+
export let item: any;
|
|
5
|
+
export let header: TableHeader;
|
|
6
|
+
|
|
7
|
+
// Altura máxima para TextArea (150px por defecto, puede ser personalizada con cellMaxHeight)
|
|
8
|
+
$: maxHeight = header.cellMaxHeight ?? "180px";
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
class="cell-content-textarea {header.biBold ? 'bold' : ''}"
|
|
13
|
+
style="text-align: {header.align ?? 'left'}; {header.colorCampo &&
|
|
14
|
+
item[header.colorCampo]
|
|
15
|
+
? `background-color: ${item[header.colorCampo]}; color: white;`
|
|
16
|
+
: ''} max-height: {maxHeight};"
|
|
17
|
+
>
|
|
18
|
+
{item[header.campo] ?? ""}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { TableHeader } from "../interfaces.js";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
item: any;
|
|
6
|
+
header: TableHeader;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export type TextAreaCellProps = typeof __propDef.props;
|
|
14
|
+
export type TextAreaCellEvents = typeof __propDef.events;
|
|
15
|
+
export type TextAreaCellSlots = typeof __propDef.slots;
|
|
16
|
+
export default class TextAreaCell extends SvelteComponentTyped<TextAreaCellProps, TextAreaCellEvents, TextAreaCellSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -11,7 +11,7 @@ export interface ButtonConfig {
|
|
|
11
11
|
export interface TableHeader {
|
|
12
12
|
titulo: string;
|
|
13
13
|
biSort: boolean;
|
|
14
|
-
tipo: 'Text' | 'Number' | 'Buttons' | 'Bool' | 'Image' | 'Datetime' | 'Date' | 'EditableBool' | 'EditableText' | 'EditableNumber' | 'DynamicButton' | 'ImageButton' | 'DualTextButton' | 'ConditionalCell' | 'MultiTextButton' | 'Component';
|
|
14
|
+
tipo: 'Text' | 'TextArea' | 'Number' | 'Buttons' | 'Bool' | 'Image' | 'Datetime' | 'Date' | 'EditableBool' | 'EditableText' | 'EditableNumber' | 'DynamicButton' | 'ImageButton' | 'DualTextButton' | 'ConditionalCell' | 'MultiTextButton' | 'Component';
|
|
15
15
|
biBold: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* Alignment for the content of the cells belonging to this header.
|