@bexis2/bexis2-core-ui 0.1.2 → 0.1.4
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 +3 -0
- package/dist/components/Table/Table.svelte +8 -3
- package/dist/components/Table/TableFilter.svelte +3 -2
- package/dist/components/Table/TableFilter.svelte.d.ts +1 -0
- package/dist/components/Table/filter.js +1 -1
- package/dist/components/page/menu/Menu.svelte +0 -2
- package/dist/stores/apistore.js +1 -0
- package/package.json +3 -3
- package/src/lib/components/Table/Table.svelte +9 -3
- package/src/lib/components/Table/TableFilter.svelte +3 -2
- package/src/lib/components/Table/filter.ts +1 -1
- package/src/lib/components/page/menu/Menu.svelte +2 -6
- package/src/lib/stores/apistore.ts +3 -0
package/README.md
CHANGED
|
@@ -7,6 +7,9 @@ import {
|
|
|
7
7
|
addColumnFilters,
|
|
8
8
|
addTableFilter
|
|
9
9
|
} from "svelte-headless-table/plugins";
|
|
10
|
+
import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
|
|
11
|
+
import { storePopup } from "@skeletonlabs/skeleton";
|
|
12
|
+
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
10
13
|
import TableFilter from "./TableFilter.svelte";
|
|
11
14
|
import TablePagination from "./TablePagination.svelte";
|
|
12
15
|
import { columnFilter, searchFilter } from "./filter";
|
|
@@ -74,7 +77,8 @@ const tableColumns = [
|
|
|
74
77
|
filterValue: filterValue2,
|
|
75
78
|
id,
|
|
76
79
|
tableId,
|
|
77
|
-
values
|
|
80
|
+
values,
|
|
81
|
+
toFilterableValueFn
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
} : void 0,
|
|
@@ -146,12 +150,13 @@ const { filterValue } = pluginStates.tableFilter;
|
|
|
146
150
|
<tr {...rowAttrs} class="bg-primary-300">
|
|
147
151
|
{#each headerRow.cells as cell (cell.id)}
|
|
148
152
|
<Subscribe attrs={cell.attrs()} props={cell.props()} let:props let:attrs>
|
|
149
|
-
<th scope="col" class="!p-2" {...attrs}>
|
|
153
|
+
<th scope="col" class="!p-2 w-min" {...attrs}>
|
|
150
154
|
<div class="flex w-full justify-between items-center">
|
|
151
155
|
<div class="flex gap-1">
|
|
152
156
|
<span
|
|
153
157
|
class:underline={props.sort.order}
|
|
154
158
|
class:normal-case={cell.id !== cell.label}
|
|
159
|
+
class:cursor-pointer={!props.sort.disabled}
|
|
155
160
|
on:click={props.sort.toggle}
|
|
156
161
|
on:keydown={props.sort.toggle}
|
|
157
162
|
>
|
|
@@ -187,7 +192,7 @@ const { filterValue } = pluginStates.tableFilter;
|
|
|
187
192
|
<tr {...rowAttrs}>
|
|
188
193
|
{#each row.cells as cell (cell?.id)}
|
|
189
194
|
<Subscribe attrs={cell.attrs()} let:attrs>
|
|
190
|
-
<td {...attrs} class="!p-2">
|
|
195
|
+
<td {...attrs} class="!p-2 w-min">
|
|
191
196
|
<div class="flex items-center w-full h-full table-cell-fit">
|
|
192
197
|
<Render of={cell.render()} />
|
|
193
198
|
</div>
|
|
@@ -5,6 +5,7 @@ export let filterValue;
|
|
|
5
5
|
export let values;
|
|
6
6
|
export let id;
|
|
7
7
|
export let tableId;
|
|
8
|
+
export let toFilterableValueFn = void 0;
|
|
8
9
|
let firstOption;
|
|
9
10
|
let firstValue;
|
|
10
11
|
let secondOption;
|
|
@@ -96,7 +97,7 @@ const popupFeatured = {
|
|
|
96
97
|
target: popupId,
|
|
97
98
|
placement: "bottom-start"
|
|
98
99
|
};
|
|
99
|
-
let type = typeof $values[0];
|
|
100
|
+
let type = typeof (toFilterableValueFn ? toFilterableValueFn($values[0]) : $values[0]);
|
|
100
101
|
if (type === "object") {
|
|
101
102
|
if ($values[0] instanceof Date) {
|
|
102
103
|
type = "date";
|
|
@@ -115,7 +116,7 @@ if (type === "object") {
|
|
|
115
116
|
</button>
|
|
116
117
|
|
|
117
118
|
<div data-popup={`${popupId}`}>
|
|
118
|
-
<div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
|
|
119
|
+
<div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min bg-base-100">
|
|
119
120
|
<button
|
|
120
121
|
class="btn variant-filled-primary btn-sm"
|
|
121
122
|
type="button"
|
|
@@ -55,7 +55,7 @@ const dateFilter = (filterOption, filterValue, value) => {
|
|
|
55
55
|
};
|
|
56
56
|
const numericFilter = ({ filterValue, value }) => {
|
|
57
57
|
const [firstFilterOption, firstFilterValue, secondFilterOption, secondFilterValue] = filterValue;
|
|
58
|
-
if (firstFilterValue == null &&
|
|
58
|
+
if (firstFilterValue == null && secondFilterValue == null) {
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
61
|
else if ((firstFilterOption == null || firstFilterValue == null) &&
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
<script>import Fa from "svelte-fa/src/fa.svelte";
|
|
2
2
|
import { faCog } from "@fortawesome/free-solid-svg-icons";
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
|
-
import { setApiConfig } from "../../../stores/apistore";
|
|
5
4
|
import { getMenuItems } from "./MenuDataCaller";
|
|
6
5
|
import MenuBar from "./MenuBar.svelte";
|
|
7
6
|
import SettingsBar from "./SettingsBar.svelte";
|
|
8
7
|
let menu;
|
|
9
8
|
onMount(async () => {
|
|
10
|
-
setApiConfig("https://localhost:44345", "david", "123456");
|
|
11
9
|
menu = await getMenuItems();
|
|
12
10
|
});
|
|
13
11
|
</script>
|
package/dist/stores/apistore.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bexis2/bexis2-core-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
@@ -39,8 +39,6 @@
|
|
|
39
39
|
"raw-loader": "^4.0.2",
|
|
40
40
|
"svelte": "^3.54.0",
|
|
41
41
|
"svelte-check": "^3.0.1",
|
|
42
|
-
"svelte-fa": "^3.0.3",
|
|
43
|
-
"svelte-headless-table": "^0.17.3",
|
|
44
42
|
"tailwindcss": "^3.3.2",
|
|
45
43
|
"tslib": "^2.4.1",
|
|
46
44
|
"typescript": "^5.0.0",
|
|
@@ -69,7 +67,9 @@
|
|
|
69
67
|
"highlight.js": "^11.8.0",
|
|
70
68
|
"highlightjs-svelte": "^1.0.6",
|
|
71
69
|
"svelte": "^3.54.0",
|
|
70
|
+
"svelte-fa": "^3.0.4",
|
|
72
71
|
"svelte-file-dropzone": "^2.0.1",
|
|
72
|
+
"svelte-headless-table": "^0.17.3",
|
|
73
73
|
"svelte-select": "^5.6.0",
|
|
74
74
|
"vest": "^4.6.11"
|
|
75
75
|
},
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
addColumnFilters,
|
|
9
9
|
addTableFilter
|
|
10
10
|
} from 'svelte-headless-table/plugins';
|
|
11
|
+
import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom';
|
|
12
|
+
import { storePopup } from '@skeletonlabs/skeleton';
|
|
13
|
+
|
|
14
|
+
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
11
15
|
|
|
12
16
|
import TableFilter from './TableFilter.svelte';
|
|
13
17
|
import TablePagination from './TablePagination.svelte';
|
|
@@ -93,7 +97,8 @@
|
|
|
93
97
|
filterValue,
|
|
94
98
|
id,
|
|
95
99
|
tableId,
|
|
96
|
-
values
|
|
100
|
+
values,
|
|
101
|
+
toFilterableValueFn
|
|
97
102
|
});
|
|
98
103
|
}
|
|
99
104
|
}
|
|
@@ -171,12 +176,13 @@
|
|
|
171
176
|
<tr {...rowAttrs} class="bg-primary-300">
|
|
172
177
|
{#each headerRow.cells as cell (cell.id)}
|
|
173
178
|
<Subscribe attrs={cell.attrs()} props={cell.props()} let:props let:attrs>
|
|
174
|
-
<th scope="col" class="!p-2" {...attrs}>
|
|
179
|
+
<th scope="col" class="!p-2 w-min" {...attrs}>
|
|
175
180
|
<div class="flex w-full justify-between items-center">
|
|
176
181
|
<div class="flex gap-1">
|
|
177
182
|
<span
|
|
178
183
|
class:underline={props.sort.order}
|
|
179
184
|
class:normal-case={cell.id !== cell.label}
|
|
185
|
+
class:cursor-pointer={!props.sort.disabled}
|
|
180
186
|
on:click={props.sort.toggle}
|
|
181
187
|
on:keydown={props.sort.toggle}
|
|
182
188
|
>
|
|
@@ -212,7 +218,7 @@
|
|
|
212
218
|
<tr {...rowAttrs}>
|
|
213
219
|
{#each row.cells as cell (cell?.id)}
|
|
214
220
|
<Subscribe attrs={cell.attrs()} let:attrs>
|
|
215
|
-
<td {...attrs} class="!p-2">
|
|
221
|
+
<td {...attrs} class="!p-2 w-min">
|
|
216
222
|
<div class="flex items-center w-full h-full table-cell-fit">
|
|
217
223
|
<Render of={cell.render()} />
|
|
218
224
|
</div>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
export let values;
|
|
9
9
|
export let id;
|
|
10
10
|
export let tableId;
|
|
11
|
+
export let toFilterableValueFn: undefined | ((value: any) => any) = undefined;
|
|
11
12
|
|
|
12
13
|
let firstOption;
|
|
13
14
|
let firstValue;
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
placement: 'bottom-start'
|
|
105
106
|
};
|
|
106
107
|
|
|
107
|
-
let type: string = typeof $values[0];
|
|
108
|
+
let type: string = typeof (toFilterableValueFn ? toFilterableValueFn($values[0]) : $values[0]);
|
|
108
109
|
if (type === 'object') {
|
|
109
110
|
if ($values[0] instanceof Date) {
|
|
110
111
|
type = 'date';
|
|
@@ -123,7 +124,7 @@
|
|
|
123
124
|
</button>
|
|
124
125
|
|
|
125
126
|
<div data-popup={`${popupId}`}>
|
|
126
|
-
<div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
|
|
127
|
+
<div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min bg-base-100">
|
|
127
128
|
<button
|
|
128
129
|
class="btn variant-filled-primary btn-sm"
|
|
129
130
|
type="button"
|
|
@@ -62,7 +62,7 @@ const dateFilter = (filterOption, filterValue, value) => {
|
|
|
62
62
|
|
|
63
63
|
const numericFilter: ColumnFilterFn = ({ filterValue, value }) => {
|
|
64
64
|
const [firstFilterOption, firstFilterValue, secondFilterOption, secondFilterValue] = filterValue;
|
|
65
|
-
if (firstFilterValue == null &&
|
|
65
|
+
if (firstFilterValue == null && secondFilterValue == null) {
|
|
66
66
|
return true;
|
|
67
67
|
} else if (
|
|
68
68
|
(firstFilterOption == null || firstFilterValue == null) &&
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
import { faCog } from '@fortawesome/free-solid-svg-icons'
|
|
5
5
|
|
|
6
6
|
import { onMount } from 'svelte';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { setApiConfig } from '../../../stores/apistore';
|
|
7
|
+
|
|
10
8
|
import { getMenuItems} from './MenuDataCaller';
|
|
11
9
|
|
|
12
10
|
import type { Menu } from "./menu";
|
|
@@ -17,9 +15,7 @@
|
|
|
17
15
|
let menu:Menu;
|
|
18
16
|
|
|
19
17
|
onMount(async () => {
|
|
20
|
-
|
|
21
|
-
setApiConfig("https://localhost:44345","david","123456");
|
|
22
|
-
|
|
18
|
+
|
|
23
19
|
menu = await getMenuItems();
|
|
24
20
|
|
|
25
21
|
})
|
|
@@ -22,7 +22,10 @@ passwordStore.subscribe((value) => {
|
|
|
22
22
|
|
|
23
23
|
export function setApiConfig(_host: string, _user: string, _pw: string) {
|
|
24
24
|
console.log('overwrite settings');
|
|
25
|
+
|
|
25
26
|
hostStore.update((h) => (h = _host));
|
|
26
27
|
usernameStore.update((u) => (u = _user));
|
|
27
28
|
passwordStore.update((p) => (p = _pw));
|
|
29
|
+
|
|
30
|
+
console.log('overwrite host',_host);
|
|
28
31
|
}
|