grav-svelte 0.1.248 → 0.1.249
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.
|
@@ -215,6 +215,29 @@
|
|
|
215
215
|
color: var(--grav-crud-color-bg);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
/* Botones extra (customButtons) con badge de conteo en la esquina superior derecha */
|
|
219
|
+
.custom-button {
|
|
220
|
+
position: relative;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.custom-button-badge {
|
|
224
|
+
position: absolute;
|
|
225
|
+
top: -6px;
|
|
226
|
+
right: -6px;
|
|
227
|
+
min-width: 1.1rem;
|
|
228
|
+
height: 1.1rem;
|
|
229
|
+
padding: 0 0.25rem;
|
|
230
|
+
background-color: #dc2626;
|
|
231
|
+
color: #fff;
|
|
232
|
+
border-radius: 9999px;
|
|
233
|
+
font-size: 0.7rem;
|
|
234
|
+
font-weight: 800;
|
|
235
|
+
line-height: 1;
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
justify-content: center;
|
|
239
|
+
}
|
|
240
|
+
|
|
218
241
|
.filter-apply-button {
|
|
219
242
|
display: inline-flex;
|
|
220
243
|
align-items: center;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import Tooltip from "./Tooltip.svelte";
|
|
12
12
|
|
|
13
13
|
import { createEventDispatcher, onMount, tick } from "svelte";
|
|
14
|
-
import type { FiltrosI } from "./interfaces.js";
|
|
14
|
+
import type { FiltrosI, CustomButtonI } from "./interfaces.js";
|
|
15
15
|
const dispatch = createEventDispatcher();
|
|
16
16
|
|
|
17
17
|
export let PageSize = 50;
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
export let showImportButton: boolean = true;
|
|
27
27
|
export let showSettingsButton: boolean = false;
|
|
28
28
|
export let showMostrandoInput: boolean = true;
|
|
29
|
+
/** Botones extra (con badge opcional) que se agregan a la barra de acciones. */
|
|
30
|
+
export let customButtons: CustomButtonI[] = [];
|
|
29
31
|
export let Titulo_Crud: string;
|
|
30
32
|
export let tooltipAgregar: string = 'Agregar';
|
|
31
33
|
export let tooltipImportarExcel: string = 'Importar Excel';
|
|
@@ -270,6 +272,20 @@
|
|
|
270
272
|
</button>
|
|
271
273
|
</Tooltip>
|
|
272
274
|
{/if}
|
|
275
|
+
{#each customButtons as btn}
|
|
276
|
+
<Tooltip text={btn.tooltip ?? ''}>
|
|
277
|
+
<button
|
|
278
|
+
type="button"
|
|
279
|
+
on:click={btn.onClick}
|
|
280
|
+
class="filter-button custom-button"
|
|
281
|
+
>
|
|
282
|
+
<i class={btn.icon}></i>
|
|
283
|
+
{#if btn.badge && btn.badge > 0}
|
|
284
|
+
<span class="custom-button-badge">{btn.badge}</span>
|
|
285
|
+
{/if}
|
|
286
|
+
</button>
|
|
287
|
+
</Tooltip>
|
|
288
|
+
{/each}
|
|
273
289
|
<slot name="headerActions" />
|
|
274
290
|
</div>
|
|
275
291
|
<!-- Show Filters Button -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import "./CrudFilters.css";
|
|
3
3
|
import "../typography.css";
|
|
4
|
-
import type { FiltrosI } from "./interfaces.js";
|
|
4
|
+
import type { FiltrosI, CustomButtonI } from "./interfaces.js";
|
|
5
5
|
declare const __propDef: {
|
|
6
6
|
props: {
|
|
7
7
|
PageSize?: number;
|
|
@@ -10,6 +10,7 @@ declare const __propDef: {
|
|
|
10
10
|
showImportButton?: boolean;
|
|
11
11
|
showSettingsButton?: boolean;
|
|
12
12
|
showMostrandoInput?: boolean;
|
|
13
|
+
/** Botones extra (con badge opcional) que se agregan a la barra de acciones. */ customButtons?: CustomButtonI[];
|
|
13
14
|
Titulo_Crud: string;
|
|
14
15
|
tooltipAgregar?: string;
|
|
15
16
|
tooltipImportarExcel?: string;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type {
|
|
6
6
|
FiltrosI,
|
|
7
7
|
TableHeader,
|
|
8
|
+
CustomButtonI,
|
|
8
9
|
} from "./interfaces.js";
|
|
9
10
|
import PaginationCrud from "./PaginationCRUD.svelte";
|
|
10
11
|
|
|
@@ -23,6 +24,8 @@
|
|
|
23
24
|
export let showPdfButton: boolean = true;
|
|
24
25
|
export let showSettingsButton: boolean = false;
|
|
25
26
|
export let showMostrandoInput: boolean = true;
|
|
27
|
+
/** Botones extra (con badge opcional) para la barra de acciones del Crud. */
|
|
28
|
+
export let customButtons: CustomButtonI[] = [];
|
|
26
29
|
export let Titulo_Crud: string;
|
|
27
30
|
export let tooltipAgregar: string = 'Agregar';
|
|
28
31
|
export let tooltipImportarExcel: string = 'Importar Excel';
|
|
@@ -153,6 +156,7 @@
|
|
|
153
156
|
{showImportButton}
|
|
154
157
|
{showSettingsButton}
|
|
155
158
|
{showMostrandoInput}
|
|
159
|
+
{customButtons}
|
|
156
160
|
{Titulo_Crud}
|
|
157
161
|
{tooltipAgregar}
|
|
158
162
|
{tooltipImportarExcel}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { FiltrosI, TableHeader } from "./interfaces.js";
|
|
2
|
+
import type { FiltrosI, TableHeader, CustomButtonI } from "./interfaces.js";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
Filtros: FiltrosI[];
|
|
@@ -17,6 +17,7 @@ declare const __propDef: {
|
|
|
17
17
|
showPdfButton?: boolean;
|
|
18
18
|
showSettingsButton?: boolean;
|
|
19
19
|
showMostrandoInput?: boolean;
|
|
20
|
+
/** Botones extra (con badge opcional) para la barra de acciones del Crud. */ customButtons?: CustomButtonI[];
|
|
20
21
|
Titulo_Crud: string;
|
|
21
22
|
tooltipAgregar?: string;
|
|
22
23
|
tooltipImportarExcel?: string;
|
|
@@ -8,6 +8,20 @@ export interface ButtonConfig {
|
|
|
8
8
|
*/
|
|
9
9
|
show?: boolean;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Botón extra para la barra de acciones del CrudWrapper (junto a "Ver filtros" y configuración).
|
|
13
|
+
* Se renderiza con el mismo estilo nativo (.filter-button) y muestra un badge de conteo si `badge > 0`.
|
|
14
|
+
*/
|
|
15
|
+
export interface CustomButtonI {
|
|
16
|
+
/** Clase de icono font-awesome, ej. 'fas fa-pause'. */
|
|
17
|
+
icon: string;
|
|
18
|
+
/** Texto del tooltip al pasar el mouse. */
|
|
19
|
+
tooltip?: string;
|
|
20
|
+
/** Si es > 0 se muestra el globito de conteo en la esquina del botón. */
|
|
21
|
+
badge?: number;
|
|
22
|
+
/** Acción al hacer click. */
|
|
23
|
+
onClick: () => void;
|
|
24
|
+
}
|
|
11
25
|
export interface TableHeader {
|
|
12
26
|
titulo: string;
|
|
13
27
|
biSort: boolean;
|