grav-svelte 0.0.34 → 0.0.35

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,11 +5,13 @@
5
5
  export let buttonsConfig: ButtonConfig[];
6
6
  export let align: 'left' | 'right' | 'center' = 'center';
7
7
  let showTooltip = "";
8
+
9
+ $: visibleButtons = buttonsConfig.filter((btn) => btn.show ?? true);
8
10
  </script>
9
11
 
10
12
  <td class="table-cell" style="text-align: {align}">
11
13
  <div class="button-group" role="group">
12
- {#each buttonsConfig as button, i}
14
+ {#each visibleButtons as button, i}
13
15
  <div class="tooltip-container">
14
16
  {#if showTooltip == button.tooltip}
15
17
  <div class="tooltip">
@@ -23,7 +25,7 @@
23
25
  on:mouseenter={() => (showTooltip = button.tooltip)}
24
26
  on:mouseleave={() => (showTooltip = "")}
25
27
  type="button"
26
- class="action-buttons-group {i == 0 ? 'rounded-left' : i == buttonsConfig.length - 1 ? 'rounded-right' : ''} {button.color}"
28
+ class="action-buttons-group {i == 0 ? 'rounded-left' : i == visibleButtons.length - 1 ? 'rounded-right' : ''} {button.color}"
27
29
  >
28
30
  <i class={button.icon}> </i>
29
31
  </button>
@@ -96,14 +96,14 @@ import { ModalContainer } from "../Modals/index.js";
96
96
  on:click={() => handleExport("excel")}
97
97
  class="export-button excel-button"
98
98
  >
99
- <i class="fas fa-file-excel pr-3"> </i>EXCEL
99
+ <i class="fas fa-file-excel"></i>EXCEL
100
100
  </button>
101
101
  <button
102
102
  type="button"
103
103
  on:click={() => handleExport("pdf")}
104
104
  class="export-button pdf-button"
105
105
  >
106
- <i class="far fa-file-pdf pr-3"> </i>PDF
106
+ <i class="far fa-file-pdf"></i>PDF
107
107
  </button>
108
108
  </div>
109
109
  <ModalContainer />
@@ -129,6 +129,10 @@ import { ModalContainer } from "../Modals/index.js";
129
129
  border-radius: 0.25rem;
130
130
  }
131
131
 
132
+ .export-button i {
133
+ margin-right: 0.75rem;
134
+ }
135
+
132
136
  .excel-button {
133
137
  background-color: #16a34a; /* green-600 */
134
138
  }
@@ -3,6 +3,10 @@ export interface ButtonConfig {
3
3
  color: string;
4
4
  action: (id: number) => void;
5
5
  tooltip: string;
6
+ /**
7
+ * When set to false the button will not be rendered. Defaults to true.
8
+ */
9
+ show?: boolean;
6
10
  }
7
11
  export interface TableHeader {
8
12
  titulo: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grav-svelte",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "A collection of Svelte components",
5
5
  "license": "MIT",
6
6
  "scripts": {