intelliwaketssveltekitv25 0.1.81 → 0.1.83
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/dist/Functions.d.ts +15 -0
- package/dist/InputCurrency.svelte +4 -47
- package/dist/InputCurrency.svelte.d.ts +2 -20
- package/dist/InputNumber.svelte +21 -45
- package/dist/InputNumber.svelte.d.ts +2 -23
- package/dist/InputPercent.svelte +4 -47
- package/dist/InputPercent.svelte.d.ts +2 -20
- package/package.json +1 -1
package/dist/Functions.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ActionArray } from './useActions';
|
|
1
3
|
export declare const KEY_UP_ARROW = 38;
|
|
2
4
|
export declare const KEY_DOWN_ARROW = 40;
|
|
3
5
|
export declare const KEY_LEFT_ARROW = 37;
|
|
@@ -190,3 +192,16 @@ export declare function IsMobileOrTablet(): boolean;
|
|
|
190
192
|
*/
|
|
191
193
|
export declare function DownloadString(filename: string, text: string): void;
|
|
192
194
|
export declare function HandleKeyDownNumerics(event: KeyboardEvent, allowDecimals?: boolean): void;
|
|
195
|
+
export type TInputNumberAttributes = HTMLInputAttributes & {
|
|
196
|
+
value: number | null;
|
|
197
|
+
onchange?: (value: number | null) => void;
|
|
198
|
+
inputClass?: string;
|
|
199
|
+
decimals?: number;
|
|
200
|
+
decimalsMax?: number;
|
|
201
|
+
min?: number | null;
|
|
202
|
+
max?: number | null;
|
|
203
|
+
prefix?: string;
|
|
204
|
+
suffix?: string;
|
|
205
|
+
shiftDigits?: number;
|
|
206
|
+
use?: ActionArray;
|
|
207
|
+
};
|
|
@@ -1,60 +1,17 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import InputNumber from './InputNumber.svelte'
|
|
3
|
-
import type {
|
|
3
|
+
import type { TInputNumberAttributes } from './Functions'
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
value = $bindable(),
|
|
7
|
-
class: clazz = '',
|
|
8
|
-
inputClass = '',
|
|
9
|
-
id,
|
|
10
|
-
name,
|
|
11
|
-
placeholder,
|
|
12
|
-
title,
|
|
13
|
-
onchange,
|
|
14
7
|
decimals = 2,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
max = null,
|
|
18
|
-
readonly,
|
|
19
|
-
disabled,
|
|
20
|
-
required,
|
|
21
|
-
use = []
|
|
22
|
-
}: {
|
|
23
|
-
value: number | null,
|
|
24
|
-
class?: string,
|
|
25
|
-
inputClass?: string,
|
|
26
|
-
id?: string,
|
|
27
|
-
name?: string
|
|
28
|
-
placeholder?: string
|
|
29
|
-
title?: string
|
|
30
|
-
onchange?: (value: number | null) => void
|
|
31
|
-
decimals?: number
|
|
32
|
-
decimalsMax?: number
|
|
33
|
-
min?: number | null
|
|
34
|
-
max?: number | null
|
|
35
|
-
readonly?: boolean
|
|
36
|
-
disabled?: boolean
|
|
37
|
-
required?: boolean
|
|
38
|
-
use?: ActionArray
|
|
39
|
-
} = $props()
|
|
8
|
+
...otherProps
|
|
9
|
+
}: TInputNumberAttributes = $props()
|
|
40
10
|
|
|
41
11
|
</script>
|
|
42
12
|
|
|
43
13
|
<InputNumber bind:value
|
|
44
|
-
class={clazz}
|
|
45
|
-
{inputClass}
|
|
46
|
-
{id}
|
|
47
|
-
{name}
|
|
48
|
-
{placeholder}
|
|
49
|
-
{title}
|
|
50
|
-
{onchange}
|
|
51
14
|
{decimals}
|
|
52
|
-
{
|
|
53
|
-
{min}
|
|
54
|
-
{max}
|
|
55
|
-
{readonly}
|
|
56
|
-
{disabled}
|
|
57
|
-
{required}
|
|
58
|
-
{use}
|
|
15
|
+
{...otherProps}
|
|
59
16
|
prefix="$"
|
|
60
17
|
/>
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
value: number | null;
|
|
4
|
-
class?: string;
|
|
5
|
-
inputClass?: string;
|
|
6
|
-
id?: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
title?: string;
|
|
10
|
-
onchange?: (value: number | null) => void;
|
|
11
|
-
decimals?: number;
|
|
12
|
-
decimalsMax?: number;
|
|
13
|
-
min?: number | null;
|
|
14
|
-
max?: number | null;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
required?: boolean;
|
|
18
|
-
use?: ActionArray;
|
|
19
|
-
};
|
|
20
|
-
declare const InputCurrency: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
1
|
+
import type { TInputNumberAttributes } from './Functions';
|
|
2
|
+
declare const InputCurrency: import("svelte").Component<TInputNumberAttributes, {}, "value">;
|
|
21
3
|
type InputCurrency = ReturnType<typeof InputCurrency>;
|
|
22
4
|
export default InputCurrency;
|
package/dist/InputNumber.svelte
CHANGED
|
@@ -1,51 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { CleanNumber, CleanNumberNull, CleanNumbers } from '@solidbasisventures/intelliwaketsfoundation'
|
|
3
3
|
import { tick } from 'svelte'
|
|
4
|
-
import { HandleKeyDownNumerics } from './Functions'
|
|
5
|
-
import {
|
|
4
|
+
import { HandleKeyDownNumerics, type TInputNumberAttributes } from './Functions'
|
|
5
|
+
import { useActions } from './useActions'
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
8
|
value = $bindable(),
|
|
9
9
|
class: clazz = '',
|
|
10
10
|
inputClass = '',
|
|
11
|
-
id,
|
|
12
|
-
name,
|
|
13
|
-
placeholder,
|
|
14
|
-
title,
|
|
15
11
|
onchange,
|
|
16
12
|
decimals,
|
|
17
13
|
decimalsMax,
|
|
18
14
|
min = null,
|
|
19
15
|
max = null,
|
|
20
|
-
readonly,
|
|
21
|
-
disabled,
|
|
22
|
-
required,
|
|
23
16
|
prefix,
|
|
24
17
|
suffix,
|
|
25
18
|
shiftDigits = 0,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}:
|
|
29
|
-
value: number | null,
|
|
30
|
-
class?: string,
|
|
31
|
-
inputClass?: string,
|
|
32
|
-
id?: string,
|
|
33
|
-
name?: string
|
|
34
|
-
placeholder?: string,
|
|
35
|
-
title?: string,
|
|
36
|
-
onchange?: (value: number | null) => void
|
|
37
|
-
decimals?: number
|
|
38
|
-
decimalsMax?: number
|
|
39
|
-
min?: number | null
|
|
40
|
-
max?: number | null
|
|
41
|
-
readonly?: boolean
|
|
42
|
-
disabled?: boolean
|
|
43
|
-
required?: boolean
|
|
44
|
-
prefix?: string
|
|
45
|
-
suffix?: string
|
|
46
|
-
shiftDigits?: number
|
|
47
|
-
use?: ActionArray
|
|
48
|
-
} = $props()
|
|
19
|
+
use = [],
|
|
20
|
+
...otherProps
|
|
21
|
+
}: TInputNumberAttributes = $props()
|
|
49
22
|
|
|
50
23
|
let displayValue = $state('')
|
|
51
24
|
let isFocused = $state(false)
|
|
@@ -57,7 +30,7 @@
|
|
|
57
30
|
if (!isFocused) {
|
|
58
31
|
tick()
|
|
59
32
|
.then(() => {
|
|
60
|
-
let newDisplayValue = useValue != null ? CleanNumber(useValue * displayMultiplier, constrainDecimals).toFixed(constrainDecimals) : !!required ? '0' : ''
|
|
33
|
+
let newDisplayValue = useValue != null ? CleanNumber(useValue * displayMultiplier, constrainDecimals).toFixed(constrainDecimals) : !!otherProps.required ? '0' : ''
|
|
61
34
|
if (!!decimalsMax && newDisplayValue.includes('.')) {
|
|
62
35
|
newDisplayValue = newDisplayValue.replace(/\.?0+$/, '')
|
|
63
36
|
}
|
|
@@ -79,7 +52,7 @@
|
|
|
79
52
|
|
|
80
53
|
let numericValue = CleanNumberNull(cleanValue, constrainDecimals)
|
|
81
54
|
if (numericValue === null) {
|
|
82
|
-
value = !!required ? 0 : null
|
|
55
|
+
value = !!otherProps.required ? 0 : null
|
|
83
56
|
if (onchange) onchange(numericValue)
|
|
84
57
|
} else if (!isNaN(numericValue)) {
|
|
85
58
|
numericValue /= displayMultiplier
|
|
@@ -102,19 +75,22 @@
|
|
|
102
75
|
type="text"
|
|
103
76
|
inputmode={!!constrainDecimals ? "decimal" : "numeric"}
|
|
104
77
|
pattern={!!constrainDecimals ? "[0-9]*[.,]?[0-9]+" : "[0-9]*"}
|
|
105
|
-
class="text-right {inputClass}"
|
|
106
78
|
style={inputStyle}
|
|
107
|
-
{
|
|
108
|
-
{
|
|
109
|
-
{placeholder}
|
|
110
|
-
{title}
|
|
111
|
-
{readonly}
|
|
112
|
-
{disabled}
|
|
113
|
-
{required}
|
|
79
|
+
{...otherProps}
|
|
80
|
+
class="text-right {inputClass}"
|
|
114
81
|
value={displayValue}
|
|
115
|
-
oninput={
|
|
116
|
-
|
|
117
|
-
|
|
82
|
+
oninput={e => {
|
|
83
|
+
handleInput(e)
|
|
84
|
+
if (otherProps.oninput) otherProps.oninput(e)
|
|
85
|
+
}}
|
|
86
|
+
onkeydown={e => {
|
|
87
|
+
HandleKeyDownNumerics(e, !!constrainDecimals)
|
|
88
|
+
if (otherProps.onkeydown) otherProps.onkeydown(e)
|
|
89
|
+
}}
|
|
90
|
+
onblur={e => {
|
|
91
|
+
refreshDisplayValue(value)
|
|
92
|
+
if (otherProps.onblur) otherProps.onblur(e)
|
|
93
|
+
}}
|
|
118
94
|
bind:focused={isFocused}
|
|
119
95
|
use:useActions={use}
|
|
120
96
|
/>
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
value: number | null;
|
|
4
|
-
class?: string;
|
|
5
|
-
inputClass?: string;
|
|
6
|
-
id?: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
title?: string;
|
|
10
|
-
onchange?: (value: number | null) => void;
|
|
11
|
-
decimals?: number;
|
|
12
|
-
decimalsMax?: number;
|
|
13
|
-
min?: number | null;
|
|
14
|
-
max?: number | null;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
required?: boolean;
|
|
18
|
-
prefix?: string;
|
|
19
|
-
suffix?: string;
|
|
20
|
-
shiftDigits?: number;
|
|
21
|
-
use?: ActionArray;
|
|
22
|
-
};
|
|
23
|
-
declare const InputNumber: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
1
|
+
import { type TInputNumberAttributes } from './Functions';
|
|
2
|
+
declare const InputNumber: import("svelte").Component<TInputNumberAttributes, {}, "value">;
|
|
24
3
|
type InputNumber = ReturnType<typeof InputNumber>;
|
|
25
4
|
export default InputNumber;
|
package/dist/InputPercent.svelte
CHANGED
|
@@ -1,61 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import InputNumber from './InputNumber.svelte'
|
|
3
|
-
import type {
|
|
3
|
+
import type { TInputNumberAttributes } from './Functions'
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
value = $bindable(),
|
|
7
|
-
class: clazz = '',
|
|
8
|
-
inputClass = '',
|
|
9
|
-
id,
|
|
10
|
-
name,
|
|
11
|
-
placeholder,
|
|
12
|
-
title,
|
|
13
|
-
onchange,
|
|
14
7
|
decimals = 0,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
max = null,
|
|
18
|
-
readonly,
|
|
19
|
-
disabled,
|
|
20
|
-
required,
|
|
21
|
-
use = []
|
|
22
|
-
}: {
|
|
23
|
-
value: number | null,
|
|
24
|
-
class?: string,
|
|
25
|
-
inputClass?: string,
|
|
26
|
-
id?: string,
|
|
27
|
-
name?: string
|
|
28
|
-
placeholder?: string
|
|
29
|
-
title?: string
|
|
30
|
-
onchange?: (value: number | null) => void
|
|
31
|
-
decimals?: number
|
|
32
|
-
decimalsMax?: number
|
|
33
|
-
min?: number | null
|
|
34
|
-
max?: number | null
|
|
35
|
-
readonly?: boolean
|
|
36
|
-
disabled?: boolean
|
|
37
|
-
required?: boolean
|
|
38
|
-
use?: ActionArray
|
|
39
|
-
} = $props()
|
|
8
|
+
...otherProps
|
|
9
|
+
}: TInputNumberAttributes = $props()
|
|
40
10
|
|
|
41
11
|
</script>
|
|
42
12
|
|
|
43
13
|
<InputNumber bind:value
|
|
44
|
-
class={clazz}
|
|
45
|
-
{inputClass}
|
|
46
|
-
{id}
|
|
47
|
-
{name}
|
|
48
|
-
{placeholder}
|
|
49
|
-
{title}
|
|
50
|
-
{onchange}
|
|
51
14
|
{decimals}
|
|
52
|
-
{
|
|
53
|
-
{min}
|
|
54
|
-
{max}
|
|
55
|
-
{readonly}
|
|
56
|
-
{disabled}
|
|
57
|
-
{required}
|
|
58
|
-
{use}
|
|
15
|
+
{...otherProps}
|
|
59
16
|
shiftDigits={2}
|
|
60
17
|
suffix="%"
|
|
61
18
|
/>
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
value: number | null;
|
|
4
|
-
class?: string;
|
|
5
|
-
inputClass?: string;
|
|
6
|
-
id?: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
title?: string;
|
|
10
|
-
onchange?: (value: number | null) => void;
|
|
11
|
-
decimals?: number;
|
|
12
|
-
decimalsMax?: number;
|
|
13
|
-
min?: number | null;
|
|
14
|
-
max?: number | null;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
required?: boolean;
|
|
18
|
-
use?: ActionArray;
|
|
19
|
-
};
|
|
20
|
-
declare const InputPercent: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
1
|
+
import type { TInputNumberAttributes } from './Functions';
|
|
2
|
+
declare const InputPercent: import("svelte").Component<TInputNumberAttributes, {}, "value">;
|
|
21
3
|
type InputPercent = ReturnType<typeof InputPercent>;
|
|
22
4
|
export default InputPercent;
|