@bexis2/bexis2-core-ui 0.4.101 → 0.4.102
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
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<script>import InputContainer from "./InputContainer.svelte";
|
|
2
|
-
import { helpStore } from "../../stores/pageStores";
|
|
3
|
-
import { convertServerColumns } from "../Table/utils";
|
|
4
2
|
export let id = "";
|
|
5
3
|
export let label = "";
|
|
6
4
|
export let title = "";
|
|
@@ -17,6 +15,7 @@ export let showDescription = false;
|
|
|
17
15
|
export let showIcon = false;
|
|
18
16
|
export let min = void 0;
|
|
19
17
|
export let max = void 0;
|
|
18
|
+
export let integerOnly = false;
|
|
20
19
|
$: {
|
|
21
20
|
if ((!label || label.trim() === "") && title && title.trim() !== "") {
|
|
22
21
|
label = title;
|
|
@@ -30,6 +29,14 @@ $: if (max != void 0 && parseInt(value) > max) {
|
|
|
30
29
|
$: if (min != void 0 && parseInt(value) < min) {
|
|
31
30
|
value = min.toString();
|
|
32
31
|
}
|
|
32
|
+
function keyDownFn(event) {
|
|
33
|
+
if (integerOnly) {
|
|
34
|
+
if (event.key === "." || event.key === ",") {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
33
40
|
</script>
|
|
34
41
|
|
|
35
42
|
<InputContainer
|
|
@@ -56,6 +63,7 @@ $: if (min != void 0 && parseInt(value) < min) {
|
|
|
56
63
|
{max}
|
|
57
64
|
on:input
|
|
58
65
|
on:change
|
|
66
|
+
on:keydown={keyDownFn}
|
|
59
67
|
{placeholder}
|
|
60
68
|
{disabled}
|
|
61
69
|
/>
|
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.102",
|
|
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,7 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import InputContainer from './InputContainer.svelte';
|
|
3
|
-
import { helpStore } from '$store/pageStores';
|
|
4
|
-
import { convertServerColumns } from '../Table/utils';
|
|
5
3
|
|
|
6
4
|
export let id: string = '';
|
|
7
5
|
export let label: string = '';
|
|
@@ -20,6 +18,7 @@
|
|
|
20
18
|
export let showIcon: boolean = false;
|
|
21
19
|
export let min: number | undefined = undefined;
|
|
22
20
|
export let max: number | undefined = undefined;
|
|
21
|
+
export let integerOnly: boolean = false;
|
|
23
22
|
|
|
24
23
|
$: {
|
|
25
24
|
if ((!label || label.trim() === '') && title && title.trim() !== '') {
|
|
@@ -37,6 +36,17 @@
|
|
|
37
36
|
$: if (min != undefined && parseInt(value) < min) {
|
|
38
37
|
value = min.toString();
|
|
39
38
|
}
|
|
39
|
+
|
|
40
|
+
function keyDownFn(event: KeyboardEvent) {
|
|
41
|
+
if (integerOnly) {
|
|
42
|
+
// 1. Block decimals explicitly (, and .)
|
|
43
|
+
if (event.key === '.' || event.key === ',') {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
</script>
|
|
41
51
|
|
|
42
52
|
<InputContainer
|
|
@@ -63,6 +73,7 @@
|
|
|
63
73
|
{max}
|
|
64
74
|
on:input
|
|
65
75
|
on:change
|
|
76
|
+
on:keydown={keyDownFn}
|
|
66
77
|
{placeholder}
|
|
67
78
|
{disabled}
|
|
68
79
|
/>
|