@wishbone-media/spark 0.23.1 → 0.25.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@wishbone-media/spark",
3
- "version": "0.23.1",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -9,6 +9,14 @@
9
9
  --ht-header-highlighted-background-color: transparent;
10
10
  }
11
11
 
12
+ .spark-table .handsontable td.current:not(.spark-table-cell-actions) {
13
+ @apply relative;
14
+
15
+ &::before {
16
+ @apply absolute opacity-[0.14] content-[''] inset-0 bg-[var(--ht-cell-selection-background-color,#1a42e8)] pointer-events-none;
17
+ }
18
+ }
19
+
12
20
  .spark-table .handsontable tr.ht__row_odd:hover td,
13
21
  .spark-table .handsontable tr.ht__row_even:hover td {
14
22
  @apply !bg-gray-100;
@@ -93,23 +93,23 @@ const computedButtonClass = computed(() => {
93
93
 
94
94
  switch (props.size) {
95
95
  case 'xs':
96
- classes += ' px-2 py-1 text-xs'
96
+ classes += ' px-4 py-1 text-xs'
97
97
  roundingSize = 'sm'
98
98
  break
99
99
  case 'sm':
100
- classes += ' px-2 py-1 text-sm'
100
+ classes += ' px-4 py-1 text-sm'
101
101
  roundingSize = 'sm'
102
102
  break
103
103
  case 'md':
104
- classes += ' px-2.5 py-1.5 text-sm'
104
+ classes += ' px-5 py-1.5 text-sm'
105
105
  roundingSize = 'md'
106
106
  break
107
107
  case 'lg':
108
- classes += ' px-3 py-2 text-sm'
108
+ classes += ' px-6 py-2 text-sm'
109
109
  roundingSize = 'md'
110
110
  break
111
111
  case 'xl':
112
- classes += ' px-3.5 py-2.5 min-h-[42px] text-sm'
112
+ classes += ' px-7 py-2.5 min-h-[42px] text-sm'
113
113
  roundingSize = 'md'
114
114
  break
115
115
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="divide-y divide-gray-300 rounded-lg border border-gray-300 text-gray-700 bg-gray-100">
3
- <div v-if="$slots.header" class="p-5">
3
+ <div v-if="$slots.header" class="px-[30px] py-5">
4
4
  <slot name="header" />
5
5
  </div>
6
6
 
@@ -15,15 +15,23 @@
15
15
  <div v-else class="pt-5"></div>
16
16
 
17
17
  <!-- Table Grid -->
18
- <HotTable theme-name="ht-theme-classic" ref="table" :settings="sparkTable.tableSettings" />
18
+ <HotTable v-show="!isEmpty" theme-name="ht-theme-classic" ref="table" :settings="sparkTable.tableSettings" />
19
+
20
+ <!-- Empty State -->
21
+ <div v-if="isEmpty" class="flex flex-col items-center justify-center py-16 text-gray-500 rounded-md border border-gray-300 bg-white">
22
+ <font-awesome-icon :icon="Icons.farInbox" class="size-12 mb-4 text-gray-300" />
23
+ <p class="text-sm">No records found</p>
24
+ </div>
19
25
 
20
26
  <!-- Footer Toolbar: Pagination always on the right -->
21
27
  <spark-table-toolbar v-if="sparkTable.computed.ready" position="footer">
22
28
  <spark-table-pagination-details
29
+ v-if="!isEmpty"
23
30
  :spark-table="sparkTable"
24
31
  />
25
- <div class="flex items-center gap-x-3">
32
+ <div class="flex items-center gap-x-3 ml-auto">
26
33
  <spark-table-pagination-paging
34
+ v-if="!isEmpty"
27
35
  :spark-table="sparkTable"
28
36
  @paginate="sparkTable.methods.applyParams"
29
37
  />
@@ -85,6 +93,7 @@ import SparkTablePaginationPaging from './SparkTablePaginationPaging.vue'
85
93
  import SparkTablePaginationPerPage from './SparkTablePaginationPerPage.vue'
86
94
  import SparkTableToolbar from './SparkTableToolbar.vue'
87
95
  import { SparkTableSearch, SparkTableFilterSelect, SparkTableFilterButtons, SparkTableDatePicker, SparkTableReset } from './plugins'
96
+ import { Icons } from '@/plugins/fontawesome.js'
88
97
 
89
98
  const props = defineProps({
90
99
  url: {
@@ -383,6 +392,11 @@ const sparkTable = reactive({
383
392
  })),
384
393
  })
385
394
 
395
+ // Empty state detection - true when data has loaded but contains no records
396
+ const isEmpty = computed(() =>
397
+ sparkTable.computed.ready && sparkTable.response.data?.length === 0
398
+ )
399
+
386
400
  /**
387
401
  * Get the param key for a plugin based on its type and configuration
388
402
  */
@@ -6,6 +6,7 @@
6
6
  v-for="option in config.options"
7
7
  :key="option.value"
8
8
  size="xl"
9
+ button-class="px-3.5"
9
10
  :variant="isSelected(option.value) ? 'primary' : 'secondary'"
10
11
  @click="handleSelect(option.value)"
11
12
  >
@@ -3,6 +3,7 @@
3
3
  <SparkButton
4
4
  @click="handleReset"
5
5
  variant="secondary"
6
+ button-class="px-3.5"
6
7
  size="xl"
7
8
  >
8
9
  <font-awesome-icon v-if="config.icon" :icon="['far', config.icon]" :class="{'mr-1.5': config.label}"/>
@@ -42,6 +42,7 @@ import {
42
42
  faUndo,
43
43
  faBolt,
44
44
  faCloudDownload,
45
+ faInbox,
45
46
  } from '@fortawesome/pro-regular-svg-icons'
46
47
 
47
48
  import {
@@ -91,6 +92,7 @@ export const Icons = {
91
92
  farUndo: faUndo,
92
93
  farBolt: faBolt,
93
94
  farCloudDownload: faCloudDownload,
95
+ farInbox: faInbox,
94
96
 
95
97
  fadSort: faSortDuotone,
96
98
  fadSortDown: faSortDownDuotone,