@bexis2/bexis2-core-ui 0.4.6 → 0.4.8
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 +8 -0
- package/dist/components/page/Page.svelte +10 -2
- package/dist/components/page/menu/MenuItem.svelte +1 -1
- package/dist/models/Models.d.ts +7 -0
- package/dist/models/Models.js +13 -0
- package/dist/services/Api.js +12 -2
- package/dist/stores/apiStores.d.ts +3 -0
- package/dist/stores/apiStores.js +2 -0
- package/dist/stores/pageStores.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/page/Page.svelte +12 -3
- package/src/lib/components/page/menu/MenuItem.svelte +1 -1
- package/src/lib/models/Models.ts +16 -0
- package/src/lib/services/Api.ts +18 -2
- package/src/lib/stores/apiStores.ts +3 -0
- package/src/lib/stores/pageStores.ts +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { onMount } from "svelte";
|
|
2
|
-
import { pageContentLayoutType } from "../../models/Enums";
|
|
2
|
+
import { pageContentLayoutType, notificationType } from "../../models/Enums";
|
|
3
3
|
import { AppShell, AppBar } from "@skeletonlabs/skeleton";
|
|
4
4
|
import Menu from "./menu/Menu.svelte";
|
|
5
5
|
import Footer from "./Footer.svelte";
|
|
@@ -9,7 +9,8 @@ import Breadcrumb from "./breadcrumb/Breadcrumb.svelte";
|
|
|
9
9
|
import Notification from "./Notification.svelte";
|
|
10
10
|
import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
|
|
11
11
|
import { storePopup } from "@skeletonlabs/skeleton";
|
|
12
|
-
import { breadcrumbStore } from "../../stores/pageStores";
|
|
12
|
+
import { breadcrumbStore, notificationStore } from "../../stores/pageStores";
|
|
13
|
+
import { errorStore } from "../../stores/apiStores";
|
|
13
14
|
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
14
15
|
import Docs from "./Docs.svelte";
|
|
15
16
|
import GoToTop from "./GoToTop.svelte";
|
|
@@ -21,6 +22,13 @@ export let footer = true;
|
|
|
21
22
|
export let help = false;
|
|
22
23
|
export let contentLayoutType = pageContentLayoutType.center;
|
|
23
24
|
export let fixLeft = true;
|
|
25
|
+
errorStore.subscribe((error) => {
|
|
26
|
+
console.log("\u{1F680} ~ errorStore.subscribe ~ value:", error.error);
|
|
27
|
+
notificationStore.showNotification({
|
|
28
|
+
notificationType: notificationType.error,
|
|
29
|
+
message: error.error
|
|
30
|
+
});
|
|
31
|
+
});
|
|
24
32
|
onMount(async () => {
|
|
25
33
|
console.log("page");
|
|
26
34
|
breadcrumbStore.clean();
|
|
@@ -34,7 +34,7 @@ let popupCombobox = {
|
|
|
34
34
|
</div>
|
|
35
35
|
<div class="hidden sm:block place-self-center" use:popup={popupCombobox}>
|
|
36
36
|
<button class="flex items-center gap-x-1 px-2">
|
|
37
|
-
<span
|
|
37
|
+
<span>{menubarItem.Title}▾</span>
|
|
38
38
|
</button>
|
|
39
39
|
|
|
40
40
|
<div class="z-50 w-max" data-popup={id}>
|
package/dist/models/Models.d.ts
CHANGED
package/dist/models/Models.js
CHANGED
|
@@ -28,3 +28,16 @@ export class Receive {
|
|
|
28
28
|
this.columns = [];
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
export class errorType {
|
|
32
|
+
statusText;
|
|
33
|
+
status;
|
|
34
|
+
error;
|
|
35
|
+
stackTrace;
|
|
36
|
+
constructor() {
|
|
37
|
+
this.statusText = "";
|
|
38
|
+
this.status = 0;
|
|
39
|
+
this.error = "";
|
|
40
|
+
this.stackTrace = "";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
;
|
package/dist/services/Api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Api.js
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import { host, username, password } from '../stores/apiStores';
|
|
3
|
+
import { host, username, password, errorStore } from '../stores/apiStores';
|
|
4
4
|
console.log('setup axios');
|
|
5
5
|
// implement a method to execute all the request from here.
|
|
6
6
|
const apiRequest = (method, url, request) => {
|
|
@@ -19,9 +19,19 @@ const apiRequest = (method, url, request) => {
|
|
|
19
19
|
headers
|
|
20
20
|
})
|
|
21
21
|
.then((res) => {
|
|
22
|
+
// console.log("res",res);
|
|
22
23
|
return Promise.resolve(res);
|
|
23
24
|
})
|
|
24
|
-
.catch((
|
|
25
|
+
.catch((er) => {
|
|
26
|
+
//console.log("🚀 ~ apiRequest ~ err:", er)
|
|
27
|
+
const err = er.response;
|
|
28
|
+
let error = {
|
|
29
|
+
status: err.status,
|
|
30
|
+
statusText: err.statusText,
|
|
31
|
+
error: err.data.error,
|
|
32
|
+
stackTrace: err.data.stackTrace,
|
|
33
|
+
};
|
|
34
|
+
errorStore.set(error);
|
|
25
35
|
return Promise.reject(err);
|
|
26
36
|
});
|
|
27
37
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import { errorType } from '../models/Models';
|
|
1
3
|
export declare let host: string;
|
|
2
4
|
export declare let username: string;
|
|
3
5
|
export declare let password: string;
|
|
6
|
+
export declare const errorStore: import("svelte/store").Writable<errorType>;
|
|
4
7
|
export declare function setApiConfig(_host: string, _user: string, _pw: string): void;
|
package/dist/stores/apiStores.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
|
+
import { errorType } from '../models/Models';
|
|
2
3
|
export let host = 'window.location.origin';
|
|
3
4
|
export let username = '';
|
|
4
5
|
export let password = '';
|
|
5
6
|
const hostStore = writable(''); //writable(window.location.origin);
|
|
6
7
|
const usernameStore = writable('');
|
|
7
8
|
const passwordStore = writable('');
|
|
9
|
+
export const errorStore = writable(new errorType());
|
|
8
10
|
hostStore.subscribe((value) => {
|
|
9
11
|
host = value;
|
|
10
12
|
});
|
|
@@ -95,7 +95,7 @@ function createBreadcrumbStore() {
|
|
|
95
95
|
breadcrumbStore.subscribe((value) => {
|
|
96
96
|
value = value === undefined ? new BreadcrumbModel() : value;
|
|
97
97
|
let v = value.items.find((i) => i.link === item.link);
|
|
98
|
-
console.log(value.items, v);
|
|
98
|
+
//console.log(value.items, v);
|
|
99
99
|
if (v) {
|
|
100
100
|
const i = value.items.indexOf(v);
|
|
101
101
|
value.items[i] = item;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
|
|
4
|
-
import type { linkType } from '$lib/models/Models';
|
|
5
|
-
import { pageContentLayoutType } from '$lib/models/Enums';
|
|
4
|
+
import type { errorType, linkType } from '$lib/models/Models';
|
|
5
|
+
import { pageContentLayoutType, notificationType } from '$lib/models/Enums';
|
|
6
6
|
|
|
7
7
|
// ui components
|
|
8
8
|
import { AppShell, AppBar } from '@skeletonlabs/skeleton';
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
//popup
|
|
17
17
|
import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom';
|
|
18
18
|
import { storePopup } from '@skeletonlabs/skeleton';
|
|
19
|
-
import { breadcrumbStore } from '$store/pageStores';
|
|
19
|
+
import { breadcrumbStore,notificationStore } from '$store/pageStores';
|
|
20
|
+
import { errorStore } from '$store/apiStores';
|
|
20
21
|
|
|
21
22
|
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
22
23
|
|
|
@@ -38,6 +39,14 @@ import type { helpItemType, helpStoreType } from '$models/Models';
|
|
|
38
39
|
export let contentLayoutType: pageContentLayoutType = pageContentLayoutType.center;
|
|
39
40
|
export let fixLeft: boolean = true;
|
|
40
41
|
|
|
42
|
+
errorStore.subscribe((error:errorType) => {
|
|
43
|
+
console.log("🚀 ~ errorStore.subscribe ~ value:", error.error)
|
|
44
|
+
notificationStore.showNotification({
|
|
45
|
+
notificationType: notificationType.error,
|
|
46
|
+
message: error.error
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
41
50
|
onMount(async () => {
|
|
42
51
|
console.log('page');
|
|
43
52
|
breadcrumbStore.clean();
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</div>
|
|
46
46
|
<div class="hidden sm:block place-self-center" use:popup={popupCombobox}>
|
|
47
47
|
<button class="flex items-center gap-x-1 px-2">
|
|
48
|
-
<span
|
|
48
|
+
<span>{menubarItem.Title}▾</span>
|
|
49
49
|
</button>
|
|
50
50
|
|
|
51
51
|
<div class="z-50 w-max" data-popup={id}>
|
package/src/lib/models/Models.ts
CHANGED
|
@@ -221,3 +221,19 @@ export class Receive {
|
|
|
221
221
|
this.columns = [];
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
export class errorType {
|
|
227
|
+
statusText: string;
|
|
228
|
+
status: number;
|
|
229
|
+
error:string;
|
|
230
|
+
stackTrace:string
|
|
231
|
+
|
|
232
|
+
constructor() {
|
|
233
|
+
this.statusText = "";
|
|
234
|
+
this.status = 0;
|
|
235
|
+
this.error = "";
|
|
236
|
+
this.stackTrace = "";
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
};
|
package/src/lib/services/Api.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Api.js
|
|
2
2
|
import axios from 'axios';
|
|
3
|
-
import { host, username, password } from '../stores/apiStores';
|
|
3
|
+
import { host, username, password, errorStore } from '../stores/apiStores';
|
|
4
|
+
import type { errorType } from '$models/Models';
|
|
4
5
|
|
|
5
6
|
console.log('setup axios');
|
|
6
7
|
|
|
@@ -23,9 +24,24 @@ const apiRequest = (method, url, request) => {
|
|
|
23
24
|
headers
|
|
24
25
|
})
|
|
25
26
|
.then((res) => {
|
|
27
|
+
// console.log("res",res);
|
|
28
|
+
|
|
26
29
|
return Promise.resolve(res);
|
|
30
|
+
|
|
27
31
|
})
|
|
28
|
-
.catch((
|
|
32
|
+
.catch((er) => {
|
|
33
|
+
//console.log("🚀 ~ apiRequest ~ err:", er)
|
|
34
|
+
const err = er.response;
|
|
35
|
+
|
|
36
|
+
let error:errorType = {
|
|
37
|
+
status: err.status,
|
|
38
|
+
statusText: err.statusText,
|
|
39
|
+
error: err.data.error,
|
|
40
|
+
stackTrace: err.data.stackTrace,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
errorStore.set(error);
|
|
44
|
+
|
|
29
45
|
return Promise.reject(err);
|
|
30
46
|
});
|
|
31
47
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { writable } from 'svelte/store';
|
|
2
|
+
import { errorType } from '$models/Models'
|
|
2
3
|
|
|
3
4
|
export let host = 'window.location.origin';
|
|
4
5
|
export let username = '';
|
|
@@ -8,6 +9,8 @@ const hostStore = writable(''); //writable(window.location.origin);
|
|
|
8
9
|
const usernameStore = writable('');
|
|
9
10
|
const passwordStore = writable('');
|
|
10
11
|
|
|
12
|
+
export const errorStore = writable(new errorType());
|
|
13
|
+
|
|
11
14
|
hostStore.subscribe((value) => {
|
|
12
15
|
host = value;
|
|
13
16
|
});
|
|
@@ -117,7 +117,7 @@ function createBreadcrumbStore() {
|
|
|
117
117
|
value = value === undefined ? new BreadcrumbModel() : value;
|
|
118
118
|
|
|
119
119
|
let v = value.items.find((i) => i.link === item.link);
|
|
120
|
-
console.log(value.items, v);
|
|
120
|
+
//console.log(value.items, v);
|
|
121
121
|
|
|
122
122
|
if (v) {
|
|
123
123
|
const i = value.items.indexOf(v);
|