@bexis2/bexis2-core-ui 0.4.94 → 0.4.95
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 +5 -0
- package/dist/components/form/DatePickerInput.svelte +31 -15
- package/dist/components/form/DatePickerInput.svelte.d.ts +2 -1
- package/dist/components/form/InputContainer.svelte +5 -2
- package/dist/components/form/InputContainer.svelte.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/services/Api.js +3 -2
- package/package.json +1 -1
- package/src/lib/components/form/DatePickerInput.svelte +30 -13
- package/src/lib/components/form/InputContainer.svelte +5 -2
- package/src/lib/index.ts +1 -1
- package/src/lib/services/Api.ts +7 -3
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
<script>import
|
|
1
|
+
<script>import Fa from "svelte-fa";
|
|
2
|
+
import { faCalendar, faClock } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import InputContainer from "./InputContainer.svelte";
|
|
2
4
|
import SveltyPicker from "svelty-picker";
|
|
3
5
|
export let id = "";
|
|
4
6
|
export let label = "";
|
|
@@ -17,8 +19,6 @@ export let mode = "date";
|
|
|
17
19
|
export let initialDate = "";
|
|
18
20
|
export let format = "yyyy-mm-dd";
|
|
19
21
|
export let displayFormat = "yyyy-mm-dd";
|
|
20
|
-
export let onChangeHandler = () => {
|
|
21
|
-
};
|
|
22
22
|
let width = "w-32";
|
|
23
23
|
if (mode !== "date" && mode !== "time" && mode !== "datetime") {
|
|
24
24
|
throw new Error(`Invalid mode: ${mode}. Valid modes are 'date', 'time', and 'datetime'.`);
|
|
@@ -34,16 +34,32 @@ if (mode === "datetime") {
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
<!-- 1. Wrap everything in a relative container so the icon positions against this boundary -->
|
|
38
|
+
<div class="relative w-full">
|
|
39
|
+
|
|
40
|
+
<SveltyPicker
|
|
41
|
+
{mode}
|
|
42
|
+
name={label}
|
|
43
|
+
{format}
|
|
44
|
+
{displayFormat}
|
|
45
|
+
{initialDate}
|
|
46
|
+
bind:value
|
|
47
|
+
on:input
|
|
48
|
+
on:change
|
|
49
|
+
{disabled}
|
|
50
|
+
{placeholder}
|
|
51
|
+
manualInput={true}
|
|
52
|
+
|
|
53
|
+
inputClasses="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400 pr-10 {valid ? 'input-success' : ''} {invalid ? 'input-error' : ''}"
|
|
54
|
+
/>
|
|
55
|
+
{#if mode === 'time'}
|
|
56
|
+
<Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
57
|
+
{:else if mode === 'date' }
|
|
58
|
+
<Fa icon={faCalendar} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
59
|
+
{:else if mode === 'datetime'}
|
|
60
|
+
<Fa icon={faCalendar} class="absolute inset-y-2 right-5 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
61
|
+
<Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
49
65
|
</InputContainer>
|
|
@@ -18,11 +18,12 @@ declare const __propDef: {
|
|
|
18
18
|
initialDate?: string;
|
|
19
19
|
format?: string;
|
|
20
20
|
displayFormat?: string;
|
|
21
|
-
onChangeHandler?: (event: CustomEvent) => void;
|
|
22
21
|
};
|
|
23
22
|
events: {
|
|
24
23
|
showDescription: CustomEvent<any>;
|
|
25
24
|
hideDescription: CustomEvent<any>;
|
|
25
|
+
input: CustomEvent<any>;
|
|
26
|
+
change: CustomEvent<any>;
|
|
26
27
|
} & {
|
|
27
28
|
[evt: string]: CustomEvent<any>;
|
|
28
29
|
};
|
|
@@ -11,7 +11,7 @@ export let description = "";
|
|
|
11
11
|
export let showDescription = false;
|
|
12
12
|
export let showIcon = false;
|
|
13
13
|
const dispatch = createEventDispatcher();
|
|
14
|
-
function onMouseOver() {
|
|
14
|
+
export function onMouseOver() {
|
|
15
15
|
if (help) {
|
|
16
16
|
helpStore.show(id);
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ function onMouseOver() {
|
|
|
19
19
|
dispatch("showDescription", { id, description });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
function onMouseOut() {
|
|
22
|
+
export function onMouseOut() {
|
|
23
23
|
if (help) {
|
|
24
24
|
helpStore.hide(id);
|
|
25
25
|
}
|
|
@@ -36,6 +36,9 @@ function onMouseOut() {
|
|
|
36
36
|
on:focus={onMouseOver}
|
|
37
37
|
on:mouseout={onMouseOut}
|
|
38
38
|
on:blur={onMouseOut}
|
|
39
|
+
on:focusin={onMouseOver}
|
|
40
|
+
on:focusout={onMouseOut}
|
|
41
|
+
|
|
39
42
|
>
|
|
40
43
|
<label class="label w-full flex" for="{id}">
|
|
41
44
|
<span class="grow"
|
|
@@ -9,6 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
description?: string;
|
|
10
10
|
showDescription?: boolean;
|
|
11
11
|
showIcon?: boolean;
|
|
12
|
+
onMouseOver?: () => void;
|
|
13
|
+
onMouseOut?: () => void;
|
|
12
14
|
};
|
|
13
15
|
events: {
|
|
14
16
|
showDescription: CustomEvent<any>;
|
|
@@ -26,5 +28,7 @@ export type InputContainerProps = typeof __propDef.props;
|
|
|
26
28
|
export type InputContainerEvents = typeof __propDef.events;
|
|
27
29
|
export type InputContainerSlots = typeof __propDef.slots;
|
|
28
30
|
export default class InputContainer extends SvelteComponent<InputContainerProps, InputContainerEvents, InputContainerSlots> {
|
|
31
|
+
get onMouseOver(): () => void;
|
|
32
|
+
get onMouseOut(): () => void;
|
|
29
33
|
}
|
|
30
34
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DatePickerInput, Dr
|
|
|
32
32
|
export { FileInfo, FileIcon, FileUploader };
|
|
33
33
|
export { Spinner, Page, Alert, Menu, ErrorMessage };
|
|
34
34
|
export { Api } from './services/Api.js';
|
|
35
|
-
export { host, username, password, setApiConfig } from './stores/apiStores.js';
|
|
35
|
+
export { host, username, password, errorStore, setApiConfig } from './stores/apiStores.js';
|
|
36
36
|
export type { userType, inputType, fileUploaderType, linkType, listItemType, keyValuePairType, fileInfoType, fileReaderInfoType, asciiFileReaderInfoType } from './models/Models.js';
|
|
37
37
|
export { helpStore } from './stores/pageStores';
|
|
38
38
|
export type { helpStoreType, helpItemType } from './models/Models';
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,7 @@ export { FileInfo, FileIcon, FileUploader };
|
|
|
45
45
|
export { Spinner, Page, Alert, Menu, ErrorMessage };
|
|
46
46
|
//Api
|
|
47
47
|
export { Api } from './services/Api.js';
|
|
48
|
-
export { host, username, password, setApiConfig } from './stores/apiStores.js';
|
|
48
|
+
export { host, username, password, errorStore, setApiConfig } from './stores/apiStores.js';
|
|
49
49
|
//help
|
|
50
50
|
export { helpStore } from './stores/pageStores';
|
|
51
51
|
//notification
|
package/dist/services/Api.js
CHANGED
|
@@ -27,7 +27,7 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
|
|
|
27
27
|
return Promise.resolve(res);
|
|
28
28
|
})
|
|
29
29
|
.catch((er) => {
|
|
30
|
-
|
|
30
|
+
console.log("🚀 ~ apiRequest ~ err:", er);
|
|
31
31
|
const err = er.response;
|
|
32
32
|
let error = {
|
|
33
33
|
status: err.status,
|
|
@@ -36,7 +36,8 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
|
|
|
36
36
|
stackTrace: err.data.stackTrace,
|
|
37
37
|
};
|
|
38
38
|
errorStore.set(error);
|
|
39
|
-
|
|
39
|
+
console.log("🚀 ~ apiRequest ~ error:", error);
|
|
40
|
+
return Promise.reject(new Error(error.error));
|
|
40
41
|
});
|
|
41
42
|
};
|
|
42
43
|
// function to execute the http get request
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bexis2/bexis2-core-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.95",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).",
|
|
6
6
|
"keywords": [
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Fa from 'svelte-fa';
|
|
3
|
+
import { faCalendar, faClock } from '@fortawesome/free-solid-svg-icons';
|
|
2
4
|
import InputContainer from './InputContainer.svelte';
|
|
3
5
|
import SveltyPicker from 'svelty-picker';
|
|
4
6
|
|
|
@@ -19,7 +21,6 @@
|
|
|
19
21
|
export let initialDate: string = '';
|
|
20
22
|
export let format: string = 'yyyy-mm-dd';
|
|
21
23
|
export let displayFormat: string = 'yyyy-mm-dd';
|
|
22
|
-
export let onChangeHandler: (event: CustomEvent) => void = () => {};
|
|
23
24
|
|
|
24
25
|
let width = 'w-32';
|
|
25
26
|
|
|
@@ -39,16 +40,32 @@
|
|
|
39
40
|
</script>
|
|
40
41
|
|
|
41
42
|
<InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription} {showIcon} on:showDescription on:hideDescription>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
<!-- 1. Wrap everything in a relative container so the icon positions against this boundary -->
|
|
44
|
+
<div class="relative w-full">
|
|
45
|
+
|
|
46
|
+
<SveltyPicker
|
|
47
|
+
{mode}
|
|
48
|
+
name={label}
|
|
49
|
+
{format}
|
|
50
|
+
{displayFormat}
|
|
51
|
+
{initialDate}
|
|
52
|
+
bind:value
|
|
53
|
+
on:input
|
|
54
|
+
on:change
|
|
55
|
+
{disabled}
|
|
56
|
+
{placeholder}
|
|
57
|
+
manualInput={true}
|
|
58
|
+
|
|
59
|
+
inputClasses="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400 pr-10 {valid ? 'input-success' : ''} {invalid ? 'input-error' : ''}"
|
|
60
|
+
/>
|
|
61
|
+
{#if mode === 'time'}
|
|
62
|
+
<Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
63
|
+
{:else if mode === 'date' }
|
|
64
|
+
<Fa icon={faCalendar} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
65
|
+
{:else if mode === 'datetime'}
|
|
66
|
+
<Fa icon={faCalendar} class="absolute inset-y-2 right-5 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
67
|
+
<Fa icon={faClock} class="absolute inset-y-2 right-0 flex items-center pr-3 pointer-events-none text-gray-400 dark:text-gray-300" />
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
54
71
|
</InputContainer>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
const dispatch = createEventDispatcher();
|
|
17
17
|
|
|
18
|
-
function onMouseOver() {
|
|
18
|
+
export function onMouseOver() {
|
|
19
19
|
if (help) {
|
|
20
20
|
helpStore.show(id);
|
|
21
21
|
}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function onMouseOut() {
|
|
29
|
+
export function onMouseOut() {
|
|
30
30
|
if (help) {
|
|
31
31
|
helpStore.hide(id);
|
|
32
32
|
}
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
on:focus={onMouseOver}
|
|
45
45
|
on:mouseout={onMouseOut}
|
|
46
46
|
on:blur={onMouseOut}
|
|
47
|
+
on:focusin={onMouseOver}
|
|
48
|
+
on:focusout={onMouseOut}
|
|
49
|
+
|
|
47
50
|
>
|
|
48
51
|
<label class="label w-full flex" for="{id}">
|
|
49
52
|
<span class="grow"
|
package/src/lib/index.ts
CHANGED
|
@@ -75,7 +75,7 @@ export { Spinner, Page, Alert, Menu, ErrorMessage };
|
|
|
75
75
|
|
|
76
76
|
//Api
|
|
77
77
|
export { Api } from './services/Api.js';
|
|
78
|
-
export { host, username, password, setApiConfig } from './stores/apiStores.js';
|
|
78
|
+
export { host, username, password,errorStore, setApiConfig } from './stores/apiStores.js';
|
|
79
79
|
|
|
80
80
|
//Type
|
|
81
81
|
export type {
|
package/src/lib/services/Api.ts
CHANGED
|
@@ -21,6 +21,7 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
//using the axios instance to perform the request that received from each http method
|
|
24
|
+
|
|
24
25
|
return axiosAPI({
|
|
25
26
|
method,
|
|
26
27
|
url,
|
|
@@ -35,9 +36,11 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
|
|
|
35
36
|
|
|
36
37
|
})
|
|
37
38
|
.catch((er) => {
|
|
38
|
-
|
|
39
|
+
console.log("🚀 ~ apiRequest ~ err:", er)
|
|
39
40
|
const err = er.response;
|
|
40
41
|
|
|
42
|
+
|
|
43
|
+
|
|
41
44
|
let error:errorType = {
|
|
42
45
|
status: err.status,
|
|
43
46
|
statusText: err.statusText,
|
|
@@ -46,8 +49,9 @@ const apiRequest = (method, url, request, customHeaders = {}, customConfig = {})
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
errorStore.set(error);
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
console.log("🚀 ~ apiRequest ~ error:", error)
|
|
53
|
+
|
|
54
|
+
return Promise.reject(new Error(error.error));
|
|
51
55
|
});
|
|
52
56
|
};
|
|
53
57
|
|