@bexis2/bexis2-core-ui 0.3.1 → 0.3.3
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/README.md +14 -1
- package/dist/TableView.svelte +1 -1
- package/dist/components/File/FileIcon.svelte +45 -45
- package/dist/components/File/FileInfo.svelte +13 -13
- package/dist/components/ListView.svelte +5 -5
- package/dist/components/Table/Table.svelte +165 -100
- package/dist/components/Table/TableFilter.svelte +1 -0
- package/dist/components/form/Checkbox.svelte +13 -13
- package/dist/components/form/CheckboxKvPList.svelte +16 -16
- package/dist/components/form/CheckboxList.svelte +10 -10
- package/dist/components/form/DateInput.svelte +14 -14
- package/dist/components/form/DropdownKvP.svelte +54 -54
- package/dist/components/form/NumberInput.svelte +15 -15
- package/dist/components/form/TextArea.svelte +14 -14
- package/dist/components/form/TextInput.svelte +15 -15
- package/dist/components/page/Alert.svelte +28 -28
- package/dist/components/page/BackToTop.svelte +30 -30
- package/dist/components/page/Docs.svelte +22 -22
- package/dist/components/page/ErrorMessage.svelte +8 -8
- package/dist/components/page/Footer.svelte +5 -5
- package/dist/components/page/Header.svelte +5 -5
- package/dist/components/page/HelpPopUp.svelte +30 -30
- package/dist/components/page/PageCaller.js +19 -19
- package/dist/components/page/Spinner.svelte +14 -14
- package/dist/components/page/menu/MenuDataCaller.js +10 -10
- package/dist/css/core.ui.postcss +17 -17
- package/dist/css/themes/theme-bexis2.css +96 -96
- package/dist/css/themes/theme-crimson.css +101 -101
- package/dist/css/themes/theme-gold-nouveau.css +140 -140
- package/dist/css/themes/theme-hamlindigo.css +112 -112
- package/dist/css/themes/theme-modern.css +127 -127
- package/dist/css/themes/theme-rocket.css +119 -119
- package/dist/css/themes/theme-sahara.css +128 -128
- package/dist/css/themes/theme-seafoam.css +122 -122
- package/dist/css/themes/theme-seasonal.css +115 -115
- package/dist/css/themes/theme-skeleton.css +118 -118
- package/dist/css/themes/theme-vintage.css +125 -125
- package/dist/models/Models.d.ts +2 -0
- package/dist/services/BaseCaller.js +16 -16
- package/dist/stores/pageStores.js +1 -1
- package/dist/themes/theme-bexis2.js +104 -91
- package/package.json +2 -2
- package/src/lib/TableView.svelte +1 -1
- package/src/lib/components/CodeEditor/CodeEditor.svelte +1 -1
- package/src/lib/components/ListView.svelte +11 -11
- package/src/lib/components/Table/Table.svelte +198 -125
- package/src/lib/components/Table/TableFilter.svelte +7 -3
- package/src/lib/components/Table/filter.ts +141 -141
- package/src/lib/components/file/FileIcon.svelte +45 -45
- package/src/lib/components/file/FileInfo.svelte +13 -13
- package/src/lib/components/form/Checkbox.svelte +24 -24
- package/src/lib/components/form/CheckboxKvPList.svelte +29 -29
- package/src/lib/components/form/CheckboxList.svelte +21 -21
- package/src/lib/components/form/DateInput.svelte +27 -27
- package/src/lib/components/form/DropdownKvP.svelte +54 -54
- package/src/lib/components/form/NumberInput.svelte +30 -30
- package/src/lib/components/form/TextArea.svelte +28 -28
- package/src/lib/components/form/TextInput.svelte +28 -28
- package/src/lib/components/page/Alert.svelte +41 -41
- package/src/lib/components/page/BackToTop.svelte +30 -30
- package/src/lib/components/page/Docs.svelte +46 -46
- package/src/lib/components/page/ErrorMessage.svelte +10 -10
- package/src/lib/components/page/Footer.svelte +18 -18
- package/src/lib/components/page/Header.svelte +18 -18
- package/src/lib/components/page/HelpPopUp.svelte +72 -72
- package/src/lib/components/page/Notification.svelte +42 -47
- package/src/lib/components/page/Page.svelte +0 -1
- package/src/lib/components/page/PageCaller.js +19 -19
- package/src/lib/components/page/Spinner.svelte +20 -20
- package/src/lib/components/page/menu/MenuDataCaller.js +10 -10
- package/src/lib/css/core.ui.postcss +17 -17
- package/src/lib/css/themes/theme-bexis2.css +96 -96
- package/src/lib/css/themes/theme-crimson.css +101 -101
- package/src/lib/css/themes/theme-gold-nouveau.css +140 -140
- package/src/lib/css/themes/theme-hamlindigo.css +112 -112
- package/src/lib/css/themes/theme-modern.css +127 -127
- package/src/lib/css/themes/theme-rocket.css +119 -119
- package/src/lib/css/themes/theme-sahara.css +128 -128
- package/src/lib/css/themes/theme-seafoam.css +122 -122
- package/src/lib/css/themes/theme-seasonal.css +115 -115
- package/src/lib/css/themes/theme-skeleton.css +118 -118
- package/src/lib/css/themes/theme-vintage.css +125 -125
- package/src/lib/index.ts +1 -1
- package/src/lib/models/Models.ts +6 -4
- package/src/lib/models/Page.ts +40 -40
- package/src/lib/services/Api.ts +55 -55
- package/src/lib/services/BaseCaller.js +16 -16
- package/src/lib/stores/apiStores.ts +34 -34
- package/src/lib/stores/pageStores.ts +3 -3
- package/src/lib/themes/theme-bexis2.ts +107 -96
package/README.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# bexis-core-ui
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
- Table
|
|
6
|
+
- `rowHeight (number)`: fixed height for rows in pixels. (if combined with resizability, acts as minimum height)
|
|
7
|
+
- `exportability (boolean)`: if toggled true, lets user to export the current state of the table as CSV.
|
|
8
|
+
- Optimized styles for dark mode.
|
|
9
|
+
- Bug fix related to empty tables.
|
|
10
|
+
- Migrated to new TableOfContents (Beta) on documentation page.
|
|
11
|
+
- LightSwitch for toggling dark mode on documentation pages.
|
|
12
|
+
- Optimized surface colors in dark mode.
|
|
13
|
+
|
|
3
14
|
## 0.3.1
|
|
15
|
+
|
|
4
16
|
- add bexis2theme
|
|
5
|
-
|
|
17
|
+
|
|
6
18
|
## 0.3.0
|
|
19
|
+
|
|
7
20
|
- update skeleton ui -> 2.5.0
|
|
8
21
|
|
|
9
22
|
## 0.2.32
|
package/dist/TableView.svelte
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<h1>table</h1>
|
|
1
|
+
<h1>table</h1>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Fa from 'svelte-fa';
|
|
3
|
-
import { faFileAudio } from '@fortawesome/free-regular-svg-icons';
|
|
4
|
-
import { faFileVideo } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
-
import { faFileWord } from '@fortawesome/free-regular-svg-icons';
|
|
6
|
-
import { faFilePdf } from '@fortawesome/free-regular-svg-icons';
|
|
7
|
-
import { faFileExcel } from '@fortawesome/free-regular-svg-icons';
|
|
8
|
-
import { faFileAlt } from '@fortawesome/free-regular-svg-icons';
|
|
9
|
-
import { faFileImage } from '@fortawesome/free-regular-svg-icons';
|
|
10
|
-
import { faFileArchive } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
-
|
|
12
|
-
export let type = '';
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
{#if type.includes('excel') || type.includes('spreadsheetml')}
|
|
16
|
-
<Fa icon={faFileExcel} />
|
|
17
|
-
{/if}
|
|
18
|
-
|
|
19
|
-
{#if type.includes('text')}
|
|
20
|
-
<Fa icon={faFileAlt} />
|
|
21
|
-
{/if}
|
|
22
|
-
|
|
23
|
-
{#if type.includes('image')}
|
|
24
|
-
<Fa icon={faFileImage} />
|
|
25
|
-
{/if}
|
|
26
|
-
|
|
27
|
-
{#if type.includes('audio')}
|
|
28
|
-
<Fa icon={faFileAudio} />
|
|
29
|
-
{/if}
|
|
30
|
-
|
|
31
|
-
{#if type.includes('video')}
|
|
32
|
-
<Fa icon={faFileVideo} />
|
|
33
|
-
{/if}
|
|
34
|
-
|
|
35
|
-
{#if type.includes('word')}
|
|
36
|
-
<Fa icon={faFileWord} />
|
|
37
|
-
{/if}
|
|
38
|
-
|
|
39
|
-
{#if type.includes('pdf')}
|
|
40
|
-
<Fa icon={faFilePdf} />
|
|
41
|
-
{/if}
|
|
42
|
-
|
|
43
|
-
{#if type.includes('zip')}
|
|
44
|
-
<Fa icon={faFileArchive} />
|
|
45
|
-
{/if}
|
|
1
|
+
<script>
|
|
2
|
+
import Fa from 'svelte-fa';
|
|
3
|
+
import { faFileAudio } from '@fortawesome/free-regular-svg-icons';
|
|
4
|
+
import { faFileVideo } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
+
import { faFileWord } from '@fortawesome/free-regular-svg-icons';
|
|
6
|
+
import { faFilePdf } from '@fortawesome/free-regular-svg-icons';
|
|
7
|
+
import { faFileExcel } from '@fortawesome/free-regular-svg-icons';
|
|
8
|
+
import { faFileAlt } from '@fortawesome/free-regular-svg-icons';
|
|
9
|
+
import { faFileImage } from '@fortawesome/free-regular-svg-icons';
|
|
10
|
+
import { faFileArchive } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
+
|
|
12
|
+
export let type = '';
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#if type.includes('excel') || type.includes('spreadsheetml')}
|
|
16
|
+
<Fa icon={faFileExcel} />
|
|
17
|
+
{/if}
|
|
18
|
+
|
|
19
|
+
{#if type.includes('text')}
|
|
20
|
+
<Fa icon={faFileAlt} />
|
|
21
|
+
{/if}
|
|
22
|
+
|
|
23
|
+
{#if type.includes('image')}
|
|
24
|
+
<Fa icon={faFileImage} />
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
{#if type.includes('audio')}
|
|
28
|
+
<Fa icon={faFileAudio} />
|
|
29
|
+
{/if}
|
|
30
|
+
|
|
31
|
+
{#if type.includes('video')}
|
|
32
|
+
<Fa icon={faFileVideo} />
|
|
33
|
+
{/if}
|
|
34
|
+
|
|
35
|
+
{#if type.includes('word')}
|
|
36
|
+
<Fa icon={faFileWord} />
|
|
37
|
+
{/if}
|
|
38
|
+
|
|
39
|
+
{#if type.includes('pdf')}
|
|
40
|
+
<Fa icon={faFilePdf} />
|
|
41
|
+
{/if}
|
|
42
|
+
|
|
43
|
+
{#if type.includes('zip')}
|
|
44
|
+
<Fa icon={faFileArchive} />
|
|
45
|
+
{/if}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import FileIcon from './FileIcon.svelte';
|
|
3
|
-
|
|
4
|
-
export let name = '';
|
|
5
|
-
export let type = '';
|
|
6
|
-
// export let description;
|
|
7
|
-
export let size = '';
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<div style="font-size:{size}">
|
|
11
|
-
<FileIcon {type} />
|
|
12
|
-
{name}
|
|
13
|
-
</div>
|
|
1
|
+
<script>
|
|
2
|
+
import FileIcon from './FileIcon.svelte';
|
|
3
|
+
|
|
4
|
+
export let name = '';
|
|
5
|
+
export let type = '';
|
|
6
|
+
// export let description;
|
|
7
|
+
export let size = '';
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<div style="font-size:{size}">
|
|
11
|
+
<FileIcon {type} />
|
|
12
|
+
{name}
|
|
13
|
+
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>let result = { name: "david" };
|
|
2
|
-
</script>
|
|
3
|
-
|
|
4
|
-
<h1>MyList</h1>
|
|
5
|
-
{result.name}
|
|
6
|
-
<b>from bexis-lib</b>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<h1>MyList</h1>
|
|
5
|
+
{result.name}
|
|
6
|
+
<b>from bexis-lib</b>
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
addPagination,
|
|
6
6
|
addExpandedRows,
|
|
7
7
|
addColumnFilters,
|
|
8
|
-
addTableFilter
|
|
8
|
+
addTableFilter,
|
|
9
|
+
addDataExport
|
|
9
10
|
} from "svelte-headless-table/plugins";
|
|
10
11
|
import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
|
|
11
12
|
import { SlideToggle, storePopup } from "@skeletonlabs/skeleton";
|
|
@@ -16,15 +17,29 @@ import { columnFilter, searchFilter } from "./filter";
|
|
|
16
17
|
export let config;
|
|
17
18
|
let {
|
|
18
19
|
id: tableId,
|
|
20
|
+
// Unique table ID
|
|
19
21
|
data,
|
|
22
|
+
// Data store
|
|
20
23
|
columns,
|
|
24
|
+
// Column configuration
|
|
21
25
|
resizable = "none",
|
|
26
|
+
// Resizability config
|
|
22
27
|
height = null,
|
|
28
|
+
// Table height
|
|
29
|
+
rowHeight = null,
|
|
30
|
+
// Row height
|
|
23
31
|
optionsComponent,
|
|
32
|
+
// Custom component to render in the last column
|
|
24
33
|
defaultPageSize = 10,
|
|
34
|
+
// Default page size - number of rows to display per page
|
|
25
35
|
toggle = false,
|
|
36
|
+
// Whether to display the fitToScreen toggle
|
|
26
37
|
pageSizes = [5, 10, 15, 20],
|
|
27
|
-
|
|
38
|
+
// Page sizes to display in the pagination component
|
|
39
|
+
fitToScreen = true,
|
|
40
|
+
// Whether to fit the table to the screen,
|
|
41
|
+
exportable = false
|
|
42
|
+
// Whether to display the export button and enable export functionality
|
|
28
43
|
} = config;
|
|
29
44
|
const dispatch = createEventDispatcher();
|
|
30
45
|
const actionDispatcher = (obj) => dispatch("action", obj);
|
|
@@ -35,7 +50,8 @@ const table = createTable(data, {
|
|
|
35
50
|
}),
|
|
36
51
|
sort: addSortBy({ disableMultiSort: true }),
|
|
37
52
|
page: addPagination({ initialPageSize: defaultPageSize }),
|
|
38
|
-
expand: addExpandedRows()
|
|
53
|
+
expand: addExpandedRows(),
|
|
54
|
+
export: addDataExport({ format: "csv" })
|
|
39
55
|
});
|
|
40
56
|
const allCols = {};
|
|
41
57
|
$data.forEach((item) => {
|
|
@@ -58,20 +74,29 @@ const tableColumns = [
|
|
|
58
74
|
if (columns !== void 0 && key in columns) {
|
|
59
75
|
const {
|
|
60
76
|
header,
|
|
77
|
+
// Custom header to display
|
|
61
78
|
colFilterFn,
|
|
79
|
+
// Custom column filter function
|
|
62
80
|
colFilterComponent,
|
|
81
|
+
// Custom column filter component
|
|
63
82
|
instructions,
|
|
83
|
+
// Custom instructions for the column cells (sorting, filtering, searching, rendering)
|
|
64
84
|
disableFiltering = false,
|
|
85
|
+
// Whether to disable filtering for the column
|
|
65
86
|
disableSorting = false
|
|
87
|
+
// Whether to disable sorting for the column
|
|
66
88
|
} = columns[key];
|
|
67
89
|
const { toSortableValueFn, toFilterableValueFn, toStringFn, renderComponent } = instructions ?? {};
|
|
68
90
|
return table.column({
|
|
91
|
+
// If header is not provided, use the key as the header
|
|
69
92
|
header: header ?? key,
|
|
70
93
|
accessor,
|
|
94
|
+
// Render the cell with the provided component, or use the toStringFn if provided, or just use the value
|
|
71
95
|
cell: ({ value, row }) => {
|
|
72
96
|
return renderComponent ? createRender(renderComponent, { value, row }) : toStringFn ? toStringFn(value) : value;
|
|
73
97
|
},
|
|
74
98
|
plugins: {
|
|
99
|
+
// Sorting config
|
|
75
100
|
sort: {
|
|
76
101
|
disable: disableSorting,
|
|
77
102
|
invert: true,
|
|
@@ -95,6 +120,7 @@ const tableColumns = [
|
|
|
95
120
|
}
|
|
96
121
|
} : void 0,
|
|
97
122
|
tableFilter: {
|
|
123
|
+
// Search filter config
|
|
98
124
|
getFilterValue: (row) => {
|
|
99
125
|
return toStringFn ? toStringFn(row) : row;
|
|
100
126
|
}
|
|
@@ -109,9 +135,11 @@ const tableColumns = [
|
|
|
109
135
|
return value ? value : "";
|
|
110
136
|
},
|
|
111
137
|
plugins: {
|
|
138
|
+
// Sorting enabled by default
|
|
112
139
|
sort: {
|
|
113
140
|
invert: true
|
|
114
141
|
},
|
|
142
|
+
// Filtering enabled by default
|
|
115
143
|
colFilter: {
|
|
116
144
|
fn: columnFilter,
|
|
117
145
|
render: ({ filterValue: filterValue2, values, id }) => createRender(TableFilter, {
|
|
@@ -131,6 +159,11 @@ if (optionsComponent !== void 0) {
|
|
|
131
159
|
table.display({
|
|
132
160
|
id: "optionsColumn",
|
|
133
161
|
header: "",
|
|
162
|
+
plugins: {
|
|
163
|
+
export: {
|
|
164
|
+
exclude: true
|
|
165
|
+
}
|
|
166
|
+
},
|
|
134
167
|
cell: ({ row }, _) => {
|
|
135
168
|
return createRender(optionsComponent, {
|
|
136
169
|
row: row.isData() ? row.original : null,
|
|
@@ -143,6 +176,7 @@ if (optionsComponent !== void 0) {
|
|
|
143
176
|
const createdTableColumns = table.createColumns(tableColumns);
|
|
144
177
|
const { headerRows, pageRows, tableAttrs, tableBodyAttrs, pluginStates } = table.createViewModel(createdTableColumns);
|
|
145
178
|
const { filterValue } = pluginStates.tableFilter;
|
|
179
|
+
const { exportedData } = pluginStates.export;
|
|
146
180
|
const minWidth = (id) => {
|
|
147
181
|
if (columns && id in columns) {
|
|
148
182
|
return columns[id].minWidth ?? 0;
|
|
@@ -183,10 +217,20 @@ const resetResize = () => {
|
|
|
183
217
|
});
|
|
184
218
|
}
|
|
185
219
|
};
|
|
220
|
+
const exportAsCsv = () => {
|
|
221
|
+
const anchor = document.createElement("a");
|
|
222
|
+
anchor.style.display = "none";
|
|
223
|
+
anchor.href = `data:text/csv;charset=utf-8,${encodeURIComponent($exportedData)}`;
|
|
224
|
+
anchor.download = `${tableId}.csv`;
|
|
225
|
+
document.body.appendChild(anchor);
|
|
226
|
+
anchor.click();
|
|
227
|
+
document.body.removeChild(anchor);
|
|
228
|
+
};
|
|
186
229
|
</script>
|
|
187
230
|
|
|
188
231
|
<div class="grid gap-2 overflow-auto" class:w-fit={!fitToScreen} class:w-full={fitToScreen}>
|
|
189
232
|
<div class="table-container">
|
|
233
|
+
<!-- Enable the search filter if table is not empty -->
|
|
190
234
|
{#if $data.length > 0}
|
|
191
235
|
<input
|
|
192
236
|
class="input p-2 border border-primary-500"
|
|
@@ -195,123 +239,144 @@ const resetResize = () => {
|
|
|
195
239
|
placeholder="Search rows..."
|
|
196
240
|
id="{tableId}-search"
|
|
197
241
|
/>
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
242
|
+
<div class="flex justify-between items-center py-2 w-full">
|
|
243
|
+
<div>
|
|
244
|
+
<!-- Enable the fitToScreen toggle if toggle === true -->
|
|
245
|
+
{#if toggle}
|
|
246
|
+
<SlideToggle
|
|
247
|
+
name="slider-label"
|
|
248
|
+
active="bg-primary-500"
|
|
249
|
+
size="sm"
|
|
250
|
+
checked={fitToScreen}
|
|
251
|
+
id="{tableId}-toggle"
|
|
252
|
+
on:change={() => (fitToScreen = !fitToScreen)}>Fit to screen</SlideToggle
|
|
253
|
+
>
|
|
254
|
+
{/if}
|
|
255
|
+
</div>
|
|
256
|
+
<div class="flex gap-2">
|
|
257
|
+
<!-- Enable the resetResize button if resizable !== 'none' -->
|
|
258
|
+
{#if resizable !== 'none'}
|
|
259
|
+
<button
|
|
260
|
+
type="button"
|
|
261
|
+
class="btn btn-sm variant-filled-primary rounded-full order-last"
|
|
262
|
+
on:click|preventDefault={resetResize}>Reset sizing</button
|
|
263
|
+
>
|
|
264
|
+
{/if}
|
|
265
|
+
{#if exportable}
|
|
266
|
+
<button
|
|
267
|
+
type="button"
|
|
268
|
+
class="btn btn-sm variant-filled-primary rounded-full order-last"
|
|
269
|
+
on:click|preventDefault={exportAsCsv}>Export as CSV</button
|
|
270
|
+
>
|
|
271
|
+
{/if}
|
|
272
|
+
</div>
|
|
221
273
|
</div>
|
|
222
|
-
|
|
274
|
+
{/if}
|
|
223
275
|
|
|
224
276
|
<div class="overflow-auto" style="height: {height}px">
|
|
225
277
|
<table
|
|
226
278
|
{...$tableAttrs}
|
|
227
|
-
class="table table-auto table-compact bg-tertiary-500/30 overflow-clip"
|
|
279
|
+
class="table table-auto table-compact bg-tertiary-500/30 dark:bg-tertiary-900/10 overflow-clip"
|
|
228
280
|
id="{tableId}-table"
|
|
229
281
|
>
|
|
282
|
+
<!-- If table height is provided, making the top row sticky -->
|
|
230
283
|
<thead class=" {height != null ? `sticky top-0` : ''}">
|
|
231
|
-
{#
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
<div class="flex
|
|
252
|
-
<
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
{#if cell.isData()}
|
|
270
|
-
{#if props.colFilter?.render}
|
|
271
|
-
<div class="">
|
|
272
|
-
<Render of={props.colFilter.render} />
|
|
284
|
+
{#if $data.length > 0}
|
|
285
|
+
{#each $headerRows as headerRow (headerRow.id)}
|
|
286
|
+
<Subscribe
|
|
287
|
+
rowAttrs={headerRow.attrs()}
|
|
288
|
+
let:rowAttrs
|
|
289
|
+
rowProps={headerRow.props()}
|
|
290
|
+
let:rowProps
|
|
291
|
+
>
|
|
292
|
+
<tr {...rowAttrs} class="bg-primary-300 dark:bg-primary-500 items-stretch">
|
|
293
|
+
{#each headerRow.cells as cell (cell.id)}
|
|
294
|
+
<Subscribe attrs={cell.attrs()} props={cell.props()} let:props let:attrs>
|
|
295
|
+
<th
|
|
296
|
+
scope="col"
|
|
297
|
+
class="!p-2 overflow-auto"
|
|
298
|
+
class:resize-x={(resizable === 'columns' || resizable === 'both') &&
|
|
299
|
+
!fixedWidth(cell.id)}
|
|
300
|
+
{...attrs}
|
|
301
|
+
id="th-{tableId}-{cell.id}"
|
|
302
|
+
style={cellStyle(cell.id)}
|
|
303
|
+
>
|
|
304
|
+
<div class="flex justify-between items-center">
|
|
305
|
+
<div class="flex gap-1 whitespace-pre-wrap">
|
|
306
|
+
<!-- Adding sorting config and styling -->
|
|
307
|
+
<span
|
|
308
|
+
class:underline={props.sort.order}
|
|
309
|
+
class:normal-case={cell.id !== cell.label}
|
|
310
|
+
class:cursor-pointer={!props.sort.disabled}
|
|
311
|
+
on:click={props.sort.toggle}
|
|
312
|
+
on:keydown={props.sort.toggle}
|
|
313
|
+
>
|
|
314
|
+
{cell.render()}
|
|
315
|
+
</span>
|
|
316
|
+
<div class="w-2">
|
|
317
|
+
{#if props.sort.order === 'asc'}
|
|
318
|
+
▾
|
|
319
|
+
{:else if props.sort.order === 'desc'}
|
|
320
|
+
▴
|
|
321
|
+
{/if}
|
|
273
322
|
</div>
|
|
323
|
+
</div>
|
|
324
|
+
<!-- Adding column filter config -->
|
|
325
|
+
{#if cell.isData()}
|
|
326
|
+
{#if props.colFilter?.render}
|
|
327
|
+
<div class="">
|
|
328
|
+
<Render of={props.colFilter.render} />
|
|
329
|
+
</div>
|
|
330
|
+
{/if}
|
|
274
331
|
{/if}
|
|
275
|
-
|
|
276
|
-
</
|
|
277
|
-
</
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
</
|
|
281
|
-
|
|
332
|
+
</div>
|
|
333
|
+
</th>
|
|
334
|
+
</Subscribe>
|
|
335
|
+
{/each}
|
|
336
|
+
</tr>
|
|
337
|
+
</Subscribe>
|
|
338
|
+
{/each}
|
|
282
339
|
{:else}
|
|
340
|
+
<!-- Table is empty -->
|
|
283
341
|
<p class="items-center justify-center flex w-full p-10 italic">Nothing to show here.</p>
|
|
284
|
-
{/
|
|
342
|
+
{/if}
|
|
285
343
|
</thead>
|
|
286
344
|
|
|
287
345
|
<tbody class="overflow-auto" {...$tableBodyAttrs}>
|
|
288
|
-
{#
|
|
289
|
-
|
|
290
|
-
<
|
|
291
|
-
{
|
|
292
|
-
|
|
293
|
-
<
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
346
|
+
{#if $data.length > 0}
|
|
347
|
+
{#each $pageRows as row (row.id)}
|
|
348
|
+
<Subscribe rowAttrs={row.attrs()} let:rowAttrs>
|
|
349
|
+
<tr {...rowAttrs} id="{tableId}-row-{row.id}" class="">
|
|
350
|
+
{#each row.cells as cell, index (cell?.id)}
|
|
351
|
+
<Subscribe attrs={cell.attrs()} let:attrs>
|
|
352
|
+
<td
|
|
353
|
+
{...attrs}
|
|
354
|
+
class="!p-2 overflow-auto {index === 0 &&
|
|
355
|
+
(resizable === 'rows' || resizable === 'both')
|
|
356
|
+
? 'resize-y'
|
|
357
|
+
: ''}"
|
|
358
|
+
id="{tableId}-{cell.id}-{row.id}"
|
|
359
|
+
>
|
|
360
|
+
<!-- Adding config for initial rowHeight, if provided -->
|
|
361
|
+
<div
|
|
362
|
+
class="flex items-center"
|
|
363
|
+
style="height: {rowHeight ? `${rowHeight}px` : 'auto'};"
|
|
364
|
+
>
|
|
365
|
+
<div class="grow h-full"><Render of={cell.render()} /></div>
|
|
366
|
+
</div>
|
|
367
|
+
</td>
|
|
368
|
+
</Subscribe>
|
|
369
|
+
{/each}
|
|
370
|
+
</tr>
|
|
371
|
+
</Subscribe>
|
|
372
|
+
{/each}
|
|
373
|
+
{/if}
|
|
310
374
|
</tbody>
|
|
311
375
|
</table>
|
|
312
376
|
</div>
|
|
313
377
|
</div>
|
|
314
378
|
{#if $data.length > 0}
|
|
379
|
+
<!-- Adding pagination, if table is not empty -->
|
|
315
380
|
<TablePagination pageConfig={pluginStates.page} {pageSizes} id={tableId} />
|
|
316
381
|
{/if}
|
|
317
382
|
</div>
|
|
@@ -129,6 +129,7 @@ type = isDate ? "date" : type;
|
|
|
129
129
|
class="btn variant-filled-primary btn-sm"
|
|
130
130
|
type="button"
|
|
131
131
|
on:click|preventDefault={() => {
|
|
132
|
+
// Set the defaults when cleared
|
|
132
133
|
firstOption = 'isequal';
|
|
133
134
|
firstValue = undefined;
|
|
134
135
|
secondOption = 'isequal';
|
|
@@ -6,16 +6,16 @@ export let valid;
|
|
|
6
6
|
export let invalid;
|
|
7
7
|
export let required;
|
|
8
8
|
export let feedback;
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<InputContainer {label} {feedback} {required}>
|
|
12
|
-
<input
|
|
13
|
-
{id}
|
|
14
|
-
class="input variant-form-material"
|
|
15
|
-
type="checkbox"
|
|
16
|
-
class:input-success={valid}
|
|
17
|
-
class:input-error={invalid}
|
|
18
|
-
bind:checked
|
|
19
|
-
on:input
|
|
20
|
-
/>
|
|
21
|
-
</InputContainer>
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<InputContainer {label} {feedback} {required}>
|
|
12
|
+
<input
|
|
13
|
+
{id}
|
|
14
|
+
class="input variant-form-material"
|
|
15
|
+
type="checkbox"
|
|
16
|
+
class:input-success={valid}
|
|
17
|
+
class:input-error={invalid}
|
|
18
|
+
bind:checked
|
|
19
|
+
on:input
|
|
20
|
+
/>
|
|
21
|
+
</InputContainer>
|
|
@@ -8,19 +8,19 @@ export let key;
|
|
|
8
8
|
export let help = false;
|
|
9
9
|
let required = false;
|
|
10
10
|
let feedback;
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
14
|
-
{#each source as item}
|
|
15
|
-
<label class="flex items-center space-x-2" for={key}>
|
|
16
|
-
<input
|
|
17
|
-
class="checkbox"
|
|
18
|
-
type="checkbox"
|
|
19
|
-
bind:group={target}
|
|
20
|
-
checked={item.key}
|
|
21
|
-
value={item.key}
|
|
22
|
-
/>
|
|
23
|
-
<p>{item.value}</p>
|
|
24
|
-
</label>
|
|
25
|
-
{/each}
|
|
26
|
-
</InputContainer>
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
14
|
+
{#each source as item}
|
|
15
|
+
<label class="flex items-center space-x-2" for={key}>
|
|
16
|
+
<input
|
|
17
|
+
class="checkbox"
|
|
18
|
+
type="checkbox"
|
|
19
|
+
bind:group={target}
|
|
20
|
+
checked={item.key}
|
|
21
|
+
value={item.key}
|
|
22
|
+
/>
|
|
23
|
+
<p>{item.value}</p>
|
|
24
|
+
</label>
|
|
25
|
+
{/each}
|
|
26
|
+
</InputContainer>
|
|
@@ -6,13 +6,13 @@ export let description = "";
|
|
|
6
6
|
export let key;
|
|
7
7
|
let required = false;
|
|
8
8
|
let feedback;
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<InputContainer label={title} {feedback} {required}>
|
|
12
|
-
{#each source as item}
|
|
13
|
-
<label class="flex items-center space-x-2" for={key}>
|
|
14
|
-
<input class="checkbox" type="checkbox" bind:group={target} value={item} />
|
|
15
|
-
<p>{item}</p>
|
|
16
|
-
</label>
|
|
17
|
-
{/each}
|
|
18
|
-
</InputContainer>
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<InputContainer label={title} {feedback} {required}>
|
|
12
|
+
{#each source as item}
|
|
13
|
+
<label class="flex items-center space-x-2" for={key}>
|
|
14
|
+
<input class="checkbox" type="checkbox" bind:group={target} value={item} />
|
|
15
|
+
<p>{item}</p>
|
|
16
|
+
</label>
|
|
17
|
+
{/each}
|
|
18
|
+
</InputContainer>
|