intelliwaketssveltekitv25 0.2.5 → 0.2.6

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.
@@ -25,6 +25,7 @@ export type IArrayStructure<T extends Record<string, any>> = {
25
25
  defaultSortAscending?: boolean;
26
26
  minColSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
27
27
  rowClick?: (rowData: any) => void;
28
+ emptyMessage?: string | false;
28
29
  hidden?: boolean;
29
30
  };
30
31
  export type TClassNames = {
@@ -77,31 +77,41 @@
77
77
  </tr>
78
78
  </thead>
79
79
  <tbody>
80
- {#each sortedArrayStructure as row, idx (idx)}
81
- <tr class:cursor-pointer={!!arrayStructure.rowClick}
82
- class:hover:bg-slate-50={!!arrayStructure.rowClick}
83
- onclick={() => {
80
+ {#if !sortedArrayStructure.length}
81
+ {#if arrayStructure.emptyMessage !== false}
82
+ <tr>
83
+ <td colspan={validColumns.length} class="text-center text-slate-400 italic">
84
+ {arrayStructure.emptyMessage ?? 'No data available'}
85
+ </td>
86
+ </tr>
87
+ {/if}
88
+ {:else}
89
+ {#each sortedArrayStructure as row, idx (idx)}
90
+ <tr class:cursor-pointer={!!arrayStructure.rowClick}
91
+ class:hover:bg-slate-50={!!arrayStructure.rowClick}
92
+ onclick={() => {
84
93
  if (!!arrayStructure.rowClick) arrayStructure.rowClick(row)
85
94
  }}>
86
- {#each validColumns as column, idx (idx)}
87
- {@const computedValue = ComputeValue(row[column.fieldName], column, row)}
88
- {@const formattedValue = ScreenFormatValue(computedValue, column)}
89
- {#if !hideCosts || !column.isACost}
90
- <td class="text-ellipsis overflow-hidden {!column.size ? '' : ` td-${column.size}`}"
91
- class:text-right={ColumnClassRight(column)}
92
- title={!!formattedValue && formattedValue.toString().length > 10 ? formattedValue : undefined}
93
- onclick={e => {
95
+ {#each validColumns as column, idx (idx)}
96
+ {@const computedValue = ComputeValue(row[column.fieldName], column, row)}
97
+ {@const formattedValue = ScreenFormatValue(computedValue, column)}
98
+ {#if !hideCosts || !column.isACost}
99
+ <td class="text-ellipsis overflow-hidden {!column.size ? '' : ` td-${column.size}`}"
100
+ class:text-right={ColumnClassRight(column)}
101
+ title={!!formattedValue && formattedValue.toString().length > 10 ? formattedValue : undefined}
102
+ onclick={e => {
94
103
  if (!!column.onclick) {
95
104
  e.stopPropagation()
96
105
  column.onclick(row, e)
97
106
  }
98
107
  }}>
99
- {formattedValue}
100
- </td>
101
- {/if}
102
- {/each}
103
- </tr>
104
- {/each}
108
+ {formattedValue}
109
+ </td>
110
+ {/if}
111
+ {/each}
112
+ </tr>
113
+ {/each}
114
+ {/if}
105
115
  </tbody>
106
116
  {#if ObjectKeys(sumsInFooter).length}
107
117
  <tfoot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",