@hashrytech/quick-components-kit 0.17.0 → 0.17.2
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/CHANGELOG.md +12 -0
- package/dist/components/table/Table.svelte +22 -3
- package/dist/components/table/Table.svelte.d.ts +17 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,12 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
30
30
|
- `tableRowMobile?: Snippet<[T]>`
|
|
31
31
|
Optional. Enables mobile view by rendering one `<td>` with stacked content.
|
|
32
32
|
|
|
33
|
+
- `multiSelectTh?: Snippet`
|
|
34
|
+
Custom markup for the multi-select checkbox `<th>`.
|
|
35
|
+
|
|
36
|
+
- `multiSelectTd?: Snippet<[T]>`
|
|
37
|
+
Custom markup for the multi-select checkbox `<td>` in desktop view.
|
|
38
|
+
|
|
33
39
|
- `class?: ClassNameValue`
|
|
34
40
|
Tailwind classes to apply to the `<table>` element.
|
|
35
41
|
|
|
@@ -39,6 +45,12 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
39
45
|
- `headingsRowClass?: ClassNameValue`
|
|
40
46
|
Tailwind classes for the table heading `<tr>`.
|
|
41
47
|
|
|
48
|
+
- `multiSelectThClass?: Snippet`
|
|
49
|
+
Tailwind classes for the multi-select checkbox `<th>`.
|
|
50
|
+
|
|
51
|
+
- `multiSelectTdClass?: Snippet<[T]>`
|
|
52
|
+
Tailwind classes for the multi-select checkbox `<td>` in desktop view.
|
|
53
|
+
|
|
42
54
|
- `tableRowClass?: ClassNameValue`
|
|
43
55
|
Tailwind classes for each row in desktop view.
|
|
44
56
|
|
|
@@ -48,6 +60,9 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
48
60
|
- `tableMobileTdClass?: ClassNameValue`
|
|
49
61
|
Tailwind classes for the mobile row's single `<td>` cell.
|
|
50
62
|
|
|
63
|
+
- `checkboxClass?: ClassNameValue`
|
|
64
|
+
Tailwind classes for the multi-select checkbox.
|
|
65
|
+
|
|
51
66
|
## Features
|
|
52
67
|
|
|
53
68
|
- Multi-select checkboxes with "select all" support
|
|
@@ -142,6 +157,10 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
142
157
|
|
|
143
158
|
/** Class for the <td> cell in mobile view */
|
|
144
159
|
tableMobileTdClass?: ClassNameValue;
|
|
160
|
+
|
|
161
|
+
/** Class for the multi-select checkbox */
|
|
162
|
+
checkboxClass?: ClassNameValue;
|
|
163
|
+
|
|
145
164
|
};
|
|
146
165
|
</script>
|
|
147
166
|
|
|
@@ -150,7 +169,7 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
150
169
|
import {Checkbox} from '../checkbox/index.js';
|
|
151
170
|
|
|
152
171
|
let { showMultiSelect=$bindable(false), selected=$bindable([]), rows=$bindable([]), getKey, headings, tableRow, tableRowMobile, multiSelectTh, multiSelectTd,
|
|
153
|
-
tableMobileTdClass, outerDivClass, headingsRowClass, multiSelectThClass, tableRowClass, multiSelectTdClass, tableRowMobileClass, ...props }: TableProps<T> = $props();
|
|
172
|
+
tableMobileTdClass, outerDivClass, headingsRowClass, multiSelectThClass, tableRowClass, multiSelectTdClass, tableRowMobileClass, checkboxClass, ...props }: TableProps<T> = $props();
|
|
154
173
|
|
|
155
174
|
function addSelected(rowkey: string){
|
|
156
175
|
if(selected.includes(rowkey)){
|
|
@@ -183,7 +202,7 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
183
202
|
{@render multiSelectTh()}
|
|
184
203
|
{:else}
|
|
185
204
|
<th class={twMerge("w-12 px-4 py-2 text-center bg-inherit", multiSelectThClass)}>
|
|
186
|
-
<Checkbox id="header-multiselect-checkbox" onchange={handleSelectAll} checked={ rows ? selected.length === rows.length: false} />
|
|
205
|
+
<Checkbox id="header-multiselect-checkbox" onchange={handleSelectAll} checked={ rows ? selected.length === rows.length: false} class={checkboxClass} />
|
|
187
206
|
</th>
|
|
188
207
|
{/if}
|
|
189
208
|
{/if}
|
|
@@ -204,7 +223,7 @@ Supports both desktop and mobile rendering, multi-select checkboxes, and custom
|
|
|
204
223
|
{@render multiSelectTd(row)}
|
|
205
224
|
{:else}
|
|
206
225
|
<td class={twMerge("text-center px-4 py-2 bg-inherit", multiSelectTdClass )}>
|
|
207
|
-
<Checkbox id={"checkbox-" + rowKey} value={rowKey} checked={isSelected} onchange={()=>{addSelected(rowKey)}} />
|
|
226
|
+
<Checkbox id={"checkbox-" + rowKey} value={rowKey} checked={isSelected} onchange={()=>{addSelected(rowKey)}} class={checkboxClass} />
|
|
208
227
|
</td>
|
|
209
228
|
{/if}
|
|
210
229
|
{/if}
|
|
@@ -39,6 +39,8 @@ export type TableProps<T> = {
|
|
|
39
39
|
tableRowMobileClass?: ClassNameValue;
|
|
40
40
|
/** Class for the <td> cell in mobile view */
|
|
41
41
|
tableMobileTdClass?: ClassNameValue;
|
|
42
|
+
/** Class for the multi-select checkbox */
|
|
43
|
+
checkboxClass?: ClassNameValue;
|
|
42
44
|
};
|
|
43
45
|
declare class __sveltets_Render<T> {
|
|
44
46
|
props(): TableProps<T>;
|
|
@@ -86,6 +88,12 @@ interface $$IsomorphicComponent {
|
|
|
86
88
|
* - `tableRowMobile?: Snippet<[T]>`
|
|
87
89
|
* Optional. Enables mobile view by rendering one `<td>` with stacked content.
|
|
88
90
|
*
|
|
91
|
+
* - `multiSelectTh?: Snippet`
|
|
92
|
+
* Custom markup for the multi-select checkbox `<th>`.
|
|
93
|
+
*
|
|
94
|
+
* - `multiSelectTd?: Snippet<[T]>`
|
|
95
|
+
* Custom markup for the multi-select checkbox `<td>` in desktop view.
|
|
96
|
+
*
|
|
89
97
|
* - `class?: ClassNameValue`
|
|
90
98
|
* Tailwind classes to apply to the `<table>` element.
|
|
91
99
|
*
|
|
@@ -95,6 +103,12 @@ interface $$IsomorphicComponent {
|
|
|
95
103
|
* - `headingsRowClass?: ClassNameValue`
|
|
96
104
|
* Tailwind classes for the table heading `<tr>`.
|
|
97
105
|
*
|
|
106
|
+
* - `multiSelectThClass?: Snippet`
|
|
107
|
+
* Tailwind classes for the multi-select checkbox `<th>`.
|
|
108
|
+
*
|
|
109
|
+
* - `multiSelectTdClass?: Snippet<[T]>`
|
|
110
|
+
* Tailwind classes for the multi-select checkbox `<td>` in desktop view.
|
|
111
|
+
*
|
|
98
112
|
* - `tableRowClass?: ClassNameValue`
|
|
99
113
|
* Tailwind classes for each row in desktop view.
|
|
100
114
|
*
|
|
@@ -104,6 +118,9 @@ interface $$IsomorphicComponent {
|
|
|
104
118
|
* - `tableMobileTdClass?: ClassNameValue`
|
|
105
119
|
* Tailwind classes for the mobile row's single `<td>` cell.
|
|
106
120
|
*
|
|
121
|
+
* - `checkboxClass?: ClassNameValue`
|
|
122
|
+
* Tailwind classes for the multi-select checkbox.
|
|
123
|
+
*
|
|
107
124
|
* ## Features
|
|
108
125
|
*
|
|
109
126
|
* - Multi-select checkboxes with "select all" support
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './components/radio/index.js';
|
|
|
9
9
|
export * from './components/checkbox/index.js';
|
|
10
10
|
export * from './components/tab-navigation/index.js';
|
|
11
11
|
export * from './components/portal/index.js';
|
|
12
|
+
export * from './components/table/index.js';
|
|
12
13
|
export * from './actions/disable-scroll.js';
|
|
13
14
|
export * from './actions/on-keydown.js';
|
|
14
15
|
export * from './actions/lock-scroll.js';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from './components/radio/index.js';
|
|
|
11
11
|
export * from './components/checkbox/index.js';
|
|
12
12
|
export * from './components/tab-navigation/index.js';
|
|
13
13
|
export * from './components/portal/index.js';
|
|
14
|
+
export * from './components/table/index.js';
|
|
14
15
|
export * from './actions/disable-scroll.js';
|
|
15
16
|
export * from './actions/on-keydown.js';
|
|
16
17
|
export * from './actions/lock-scroll.js';
|