@bexis2/bexis2-core-ui 0.4.87 → 0.4.89
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 +2 -1
- package/dist/components/form/DatePickerInput.svelte +48 -0
- package/dist/components/form/DatePickerInput.svelte.d.ts +34 -0
- package/dist/components/form/MultiSelect.svelte +7 -7
- package/dist/components/page/menu/Menu.svelte +3 -0
- package/package.json +2 -1
- package/src/lib/components/form/DatePickerInput.svelte +53 -0
- package/src/lib/components/form/MultiSelect.svelte +7 -7
- package/src/lib/components/page/menu/Menu.svelte +6 -0
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# bexis-core-ui
|
|
2
|
+
|
|
3
|
+
|
|
2
4
|
## 0.4.87
|
|
3
5
|
- Input
|
|
4
6
|
- add show description to all form components
|
|
@@ -22,7 +24,6 @@
|
|
|
22
24
|
- MultiSelect
|
|
23
25
|
- fix itemGroup was not working
|
|
24
26
|
|
|
25
|
-
|
|
26
27
|
## 0.4.83
|
|
27
28
|
- InputContainer
|
|
28
29
|
- error message position and basic styling of input fields
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script>import InputContainer from "./InputContainer.svelte";
|
|
2
|
+
import SveltyPicker from "svelty-picker";
|
|
3
|
+
export let id = "";
|
|
4
|
+
export let label = "";
|
|
5
|
+
export let value = "";
|
|
6
|
+
export let valid = false;
|
|
7
|
+
export let invalid = false;
|
|
8
|
+
export let required = false;
|
|
9
|
+
export let feedback = [""];
|
|
10
|
+
export let placeholder = "";
|
|
11
|
+
export let help = false;
|
|
12
|
+
export let disabled = false;
|
|
13
|
+
export let description = "";
|
|
14
|
+
export let showDescription = false;
|
|
15
|
+
export let mode = "date";
|
|
16
|
+
export let initialDate = "";
|
|
17
|
+
export let format = "yyyy-mm-dd";
|
|
18
|
+
export let displayFormat = "yyyy-mm-dd";
|
|
19
|
+
export let onChangeHandler = () => {
|
|
20
|
+
};
|
|
21
|
+
let width = "w-32";
|
|
22
|
+
if (mode !== "date" && mode !== "time" && mode !== "datetime") {
|
|
23
|
+
throw new Error(`Invalid mode: ${mode}. Valid modes are 'date', 'time', and 'datetime'.`);
|
|
24
|
+
}
|
|
25
|
+
if (mode === "datetime" && (format === "yyyy-mm-dd" || displayFormat === "yyyy-mm-dd")) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
`Invalid format for datetime mode. Please use a format that includes both date and time.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
if (mode === "datetime") {
|
|
31
|
+
width = "w-64";
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription}>
|
|
36
|
+
<SveltyPicker
|
|
37
|
+
{mode}
|
|
38
|
+
name={label}
|
|
39
|
+
{format}
|
|
40
|
+
{displayFormat}
|
|
41
|
+
{initialDate}
|
|
42
|
+
bind:value
|
|
43
|
+
inputClasses="input variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400 {width}"
|
|
44
|
+
on:change={onChangeHandler}
|
|
45
|
+
{disabled}
|
|
46
|
+
{placeholder}
|
|
47
|
+
/>
|
|
48
|
+
</InputContainer>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
valid?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
feedback?: string[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
help?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
description?: string;
|
|
15
|
+
showDescription?: boolean;
|
|
16
|
+
mode?: "date" | "time" | "datetime";
|
|
17
|
+
initialDate?: string;
|
|
18
|
+
format?: string;
|
|
19
|
+
displayFormat?: string;
|
|
20
|
+
onChangeHandler?: (event: CustomEvent) => void;
|
|
21
|
+
};
|
|
22
|
+
events: {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
};
|
|
25
|
+
slots: {};
|
|
26
|
+
exports?: {} | undefined;
|
|
27
|
+
bindings?: string | undefined;
|
|
28
|
+
};
|
|
29
|
+
export type DatePickerInputProps = typeof __propDef.props;
|
|
30
|
+
export type DatePickerInputEvents = typeof __propDef.events;
|
|
31
|
+
export type DatePickerInputSlots = typeof __propDef.slots;
|
|
32
|
+
export default class DatePickerInput extends SvelteComponent<DatePickerInputProps, DatePickerInputEvents, DatePickerInputSlots> {
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
$: target, setValue(target);
|
|
35
35
|
|
|
36
36
|
let groupBy;
|
|
37
|
-
$: groupBy;
|
|
37
|
+
$: groupBy = itemGroup ? (item) => item[itemGroup] : undefined;
|
|
38
38
|
|
|
39
39
|
const dispatch = createEventDispatcher();
|
|
40
40
|
|
|
@@ -121,17 +121,17 @@
|
|
|
121
121
|
value = items;
|
|
122
122
|
}
|
|
123
123
|
//console.log(value);
|
|
124
|
-
if (itemGroup) {
|
|
125
|
-
|
|
126
|
-
}
|
|
124
|
+
// if (itemGroup) {
|
|
125
|
+
// groupBy = (item) => item[itemGroup];
|
|
126
|
+
// }
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (complexSource && complexTarget && isMulti) {
|
|
130
130
|
value = t;
|
|
131
131
|
isLoaded = true;
|
|
132
|
-
if (itemGroup) {
|
|
133
|
-
|
|
134
|
-
}
|
|
132
|
+
// if (itemGroup) {
|
|
133
|
+
// groupBy = (item) => item[itemGroup];
|
|
134
|
+
// }
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
//b) simple liust and simple model
|
|
@@ -15,6 +15,7 @@ onMount(async () => {
|
|
|
15
15
|
const storedFontSize = localStorage.getItem("fontSize");
|
|
16
16
|
if (storedFontSize) {
|
|
17
17
|
document.documentElement.style.fontSize = storedFontSize;
|
|
18
|
+
document.documentElement.style.setProperty("--font-size", storedFontSize);
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
let hamburger = true;
|
|
@@ -22,11 +23,13 @@ const theme = writable("light");
|
|
|
22
23
|
function increaseFontSize() {
|
|
23
24
|
const currentFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
24
25
|
document.documentElement.style.fontSize = currentFontSize + 1 + "px";
|
|
26
|
+
document.documentElement.style.setProperty("--font-size", document.documentElement.style.fontSize);
|
|
25
27
|
localStorage.setItem("fontSize", document.documentElement.style.fontSize);
|
|
26
28
|
}
|
|
27
29
|
function decreaseFontSize() {
|
|
28
30
|
const currentFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
29
31
|
document.documentElement.style.fontSize = currentFontSize - 1 + "px";
|
|
32
|
+
document.documentElement.style.setProperty("--font-size", document.documentElement.style.fontSize);
|
|
30
33
|
localStorage.setItem("fontSize", document.documentElement.style.fontSize);
|
|
31
34
|
}
|
|
32
35
|
function toggleDarkMode() {
|
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.89",
|
|
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": [
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"svelte-fa": "^4.0.2",
|
|
82
82
|
"svelte-file-dropzone": "^2.0.7",
|
|
83
83
|
"svelte-headless-table": "^0.18.2",
|
|
84
|
+
"svelty-picker": "^5.2.12",
|
|
84
85
|
"svelte-select": "5.8.3",
|
|
85
86
|
"vest": "^5.4.0"
|
|
86
87
|
},
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import InputContainer from './InputContainer.svelte';
|
|
3
|
+
import SveltyPicker from 'svelty-picker';
|
|
4
|
+
|
|
5
|
+
export let id: string = '';
|
|
6
|
+
export let label: string = '';
|
|
7
|
+
export let value: string = '';
|
|
8
|
+
export let valid: boolean = false;
|
|
9
|
+
export let invalid: boolean = false;
|
|
10
|
+
export let required: boolean = false;
|
|
11
|
+
export let feedback: string[] = [''];
|
|
12
|
+
export let placeholder: string = '';
|
|
13
|
+
export let help: boolean = false;
|
|
14
|
+
export let disabled: boolean = false;
|
|
15
|
+
export let description: string = '';
|
|
16
|
+
export let showDescription: boolean = false;
|
|
17
|
+
export let mode: 'date' | 'time' | 'datetime' = 'date';
|
|
18
|
+
export let initialDate: string = '';
|
|
19
|
+
export let format: string = 'yyyy-mm-dd';
|
|
20
|
+
export let displayFormat: string = 'yyyy-mm-dd';
|
|
21
|
+
export let onChangeHandler: (event: CustomEvent) => void = () => {};
|
|
22
|
+
|
|
23
|
+
let width = 'w-32';
|
|
24
|
+
|
|
25
|
+
if (mode !== 'date' && mode !== 'time' && mode !== 'datetime') {
|
|
26
|
+
throw new Error(`Invalid mode: ${mode}. Valid modes are 'date', 'time', and 'datetime'.`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (mode === 'datetime' && (format === 'yyyy-mm-dd' || displayFormat === 'yyyy-mm-dd')) {
|
|
30
|
+
throw new Error(
|
|
31
|
+
`Invalid format for datetime mode. Please use a format that includes both date and time.`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (mode === 'datetime') {
|
|
36
|
+
width = 'w-64';
|
|
37
|
+
}
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<InputContainer {id} {label} {feedback} {required} {help} {description} {showDescription}>
|
|
41
|
+
<SveltyPicker
|
|
42
|
+
{mode}
|
|
43
|
+
name={label}
|
|
44
|
+
{format}
|
|
45
|
+
{displayFormat}
|
|
46
|
+
{initialDate}
|
|
47
|
+
bind:value
|
|
48
|
+
inputClasses="input variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400 {width}"
|
|
49
|
+
on:change={onChangeHandler}
|
|
50
|
+
{disabled}
|
|
51
|
+
{placeholder}
|
|
52
|
+
/>
|
|
53
|
+
</InputContainer>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
$: target, setValue(target);
|
|
35
35
|
|
|
36
36
|
let groupBy;
|
|
37
|
-
$: groupBy;
|
|
37
|
+
$: groupBy = itemGroup ? (item) => item[itemGroup] : undefined;
|
|
38
38
|
|
|
39
39
|
const dispatch = createEventDispatcher();
|
|
40
40
|
|
|
@@ -121,17 +121,17 @@
|
|
|
121
121
|
value = items;
|
|
122
122
|
}
|
|
123
123
|
//console.log(value);
|
|
124
|
-
if (itemGroup) {
|
|
125
|
-
|
|
126
|
-
}
|
|
124
|
+
// if (itemGroup) {
|
|
125
|
+
// groupBy = (item) => item[itemGroup];
|
|
126
|
+
// }
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (complexSource && complexTarget && isMulti) {
|
|
130
130
|
value = t;
|
|
131
131
|
isLoaded = true;
|
|
132
|
-
if (itemGroup) {
|
|
133
|
-
|
|
134
|
-
}
|
|
132
|
+
// if (itemGroup) {
|
|
133
|
+
// groupBy = (item) => item[itemGroup];
|
|
134
|
+
// }
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
//b) simple liust and simple model
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
const storedFontSize = localStorage.getItem('fontSize');
|
|
21
21
|
if (storedFontSize) {
|
|
22
22
|
document.documentElement.style.fontSize = storedFontSize;
|
|
23
|
+
// set CSS variable --font-size to the new font size
|
|
24
|
+
document.documentElement.style.setProperty('--font-size', storedFontSize);
|
|
23
25
|
}
|
|
24
26
|
});
|
|
25
27
|
|
|
@@ -30,12 +32,16 @@
|
|
|
30
32
|
function increaseFontSize() {
|
|
31
33
|
const currentFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
32
34
|
document.documentElement.style.fontSize = currentFontSize + 1 + 'px';
|
|
35
|
+
// set CSS variable --font-size to the new font size
|
|
36
|
+
document.documentElement.style.setProperty('--font-size', document.documentElement.style.fontSize);
|
|
33
37
|
localStorage.setItem('fontSize', document.documentElement.style.fontSize);
|
|
34
38
|
}
|
|
35
39
|
// function to decrease the current font size by 1 step
|
|
36
40
|
function decreaseFontSize() {
|
|
37
41
|
const currentFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
38
42
|
document.documentElement.style.fontSize = currentFontSize - 1 + 'px';
|
|
43
|
+
// set CSS variable --font-size to the new font size
|
|
44
|
+
document.documentElement.style.setProperty('--font-size', document.documentElement.style.fontSize);
|
|
39
45
|
localStorage.setItem('fontSize', document.documentElement.style.fontSize);
|
|
40
46
|
}
|
|
41
47
|
|