grav-svelte 0.0.70 → 0.0.72

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.
@@ -5,6 +5,7 @@
5
5
  export let id = 1;
6
6
  export let buttonsConfig: ButtonConfig[];
7
7
  export let align: "left" | "right" | "center" = "center";
8
+ export let row: any = undefined;
8
9
 
9
10
  $: visibleButtons = buttonsConfig.filter((btn) => btn.show ?? true);
10
11
  </script>
@@ -15,7 +16,7 @@
15
16
  <Tooltip text={button.tooltip}>
16
17
  <button
17
18
  aria-label={button.tooltip}
18
- on:click={() => button.action(id)}
19
+ on:click={() => button.action(id, row)}
19
20
  type="button"
20
21
  class="action-buttons-group {visibleButtons.length === 1
21
22
  ? 'rounded-left rounded-right'
@@ -5,6 +5,7 @@ declare const __propDef: {
5
5
  id?: number;
6
6
  buttonsConfig: ButtonConfig[];
7
7
  align?: "left" | "right" | "center";
8
+ row?: any;
8
9
  };
9
10
  events: {
10
11
  [evt: string]: CustomEvent<any>;
@@ -19,6 +19,8 @@
19
19
  export let loading: boolean = false;
20
20
  export let showAddButton: boolean = true;
21
21
  export let showImportButton: boolean = true;
22
+ export let showExcelButton: boolean = true;
23
+ export let showPdfButton: boolean = true;
22
24
  export let Titulo_Crud: string;
23
25
  export let dragEnabled: boolean = false;
24
26
  export let orderField: string = "inOrden";
@@ -145,22 +147,28 @@
145
147
  />
146
148
  </div>
147
149
 
148
- <div class="export-buttons">
149
- <button
150
- type="button"
151
- on:click={() => handleExport("excel")}
152
- class="export-button excel-button"
153
- >
154
- <i class="fas fa-file-excel"></i> EXCEL
155
- </button>
156
- <button
157
- type="button"
158
- on:click={() => handleExport("pdf")}
159
- class="export-button pdf-button"
160
- >
161
- <i class="far fa-file-pdf"></i> PDF
162
- </button>
163
- </div>
150
+ {#if showExcelButton || showPdfButton}
151
+ <div class="export-buttons">
152
+ {#if showExcelButton}
153
+ <button
154
+ type="button"
155
+ on:click={() => handleExport("excel")}
156
+ class="export-button excel-button"
157
+ >
158
+ <i class="fas fa-file-excel"></i> EXCEL
159
+ </button>
160
+ {/if}
161
+ {#if showPdfButton}
162
+ <button
163
+ type="button"
164
+ on:click={() => handleExport("pdf")}
165
+ class="export-button pdf-button"
166
+ >
167
+ <i class="far fa-file-pdf"></i> PDF
168
+ </button>
169
+ {/if}
170
+ </div>
171
+ {/if}
164
172
  </div>
165
173
 
166
174
  <style>
@@ -13,6 +13,8 @@ declare const __propDef: {
13
13
  loading?: boolean;
14
14
  showAddButton?: boolean;
15
15
  showImportButton?: boolean;
16
+ showExcelButton?: boolean;
17
+ showPdfButton?: boolean;
16
18
  Titulo_Crud: string;
17
19
  dragEnabled?: boolean;
18
20
  orderField?: string;
@@ -50,6 +50,7 @@
50
50
  id={item[header.campo]}
51
51
  buttonsConfig={header.buttonsConfig ?? []}
52
52
  align={header.align ?? "center"}
53
+ row={item}
53
54
  />
54
55
  {:else if header.tipo == "DynamicButton"}
55
56
  <DynamicButtonCell {item} {header} {idField} />
@@ -1,7 +1,7 @@
1
1
  export interface ButtonConfig {
2
2
  icon: string;
3
3
  color: string;
4
- action: (id: number) => void;
4
+ action: (id: number, row?: any) => void;
5
5
  tooltip: string;
6
6
  /**
7
7
  * When set to false the button will not be rendered. Defaults to true.
@@ -177,6 +177,8 @@ export interface CrudWrapperProps {
177
177
  loading?: boolean;
178
178
  showAddButton?: boolean;
179
179
  showImportButton?: boolean;
180
+ showExcelButton?: boolean;
181
+ showPdfButton?: boolean;
180
182
  /**
181
183
  * Field name that contains the unique ID for each row.
182
184
  * Defaults to 'id' if not specified.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grav-svelte",
3
- "version": "0.0.70",
3
+ "version": "0.0.72",
4
4
  "description": "A collection of Svelte components",
5
5
  "license": "MIT",
6
6
  "scripts": {