sveltacular 0.0.50 → 0.0.52
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/forms/combo/new-or-existing-combo.svelte.d.ts +2 -2
- package/dist/forms/date-box/date-box.svelte.d.ts +1 -1
- package/dist/forms/info-box/info-box.svelte.d.ts +1 -1
- package/dist/forms/money-box/money-box.svelte.d.ts +1 -1
- package/dist/forms/number-box/number-box.svelte +6 -0
- package/dist/forms/number-box/number-box.svelte.d.ts +1 -1
- package/dist/forms/phone-box/phone-box.svelte +1 -1
- package/dist/forms/phone-box/phone-box.svelte.d.ts +1 -1
- package/dist/forms/radio-group/radio-box.svelte.d.ts +1 -1
- package/dist/forms/radio-group/radio-group.svelte +2 -2
- package/dist/forms/radio-group/radio-group.svelte.d.ts +1 -1
- package/dist/forms/text-area/text-area.svelte.d.ts +1 -1
- package/dist/forms/text-box/text-box.svelte +7 -6
- package/dist/forms/text-box/text-box.svelte.d.ts +1 -1
- package/dist/forms/url-box/url-box.svelte +2 -1
- package/dist/forms/url-box/url-box.svelte.d.ts +1 -1
- package/dist/tables/data-grid.svelte +4 -0
- package/dist/types/data.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,8 +4,8 @@ import type { SearchFunction } from '../list-box/list-box.js';
|
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
mode?: "new" | "existing" | undefined;
|
|
7
|
-
newValue?: string | undefined;
|
|
8
|
-
existingValue?: string | undefined;
|
|
7
|
+
newValue?: string | null | undefined;
|
|
8
|
+
existingValue?: string | null | undefined;
|
|
9
9
|
items?: DropdownOption[] | undefined;
|
|
10
10
|
size?: FormFieldSizeOptions | undefined;
|
|
11
11
|
disabled?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { FormFieldSizeOptions } from '../../index.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
value?: string | undefined;
|
|
5
|
+
value?: string | undefined | null;
|
|
6
6
|
size?: FormFieldSizeOptions | undefined;
|
|
7
7
|
placeholder?: string | undefined;
|
|
8
8
|
nullable?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { FormFieldSizeOptions } from '../../index.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
value: number;
|
|
5
|
+
value: number | null;
|
|
6
6
|
symbol?: string | undefined;
|
|
7
7
|
allowCents?: boolean | undefined;
|
|
8
8
|
placeholder?: string | undefined;
|
|
@@ -14,6 +14,12 @@ export let prefix = null;
|
|
|
14
14
|
export let suffix = null;
|
|
15
15
|
export let step = 1;
|
|
16
16
|
const valueChanged = () => {
|
|
17
|
+
if (value === null || value === void 0)
|
|
18
|
+
return;
|
|
19
|
+
if (value < min)
|
|
20
|
+
value = min;
|
|
21
|
+
if (value > max)
|
|
22
|
+
value = max;
|
|
17
23
|
value = roundToDecimals(value, decimals);
|
|
18
24
|
};
|
|
19
25
|
</script>
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { FormFieldSizeOptions } from '../../types/form.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
value?: number | undefined;
|
|
5
|
+
value?: number | null | undefined;
|
|
6
6
|
placeholder?: string | undefined;
|
|
7
7
|
size?: FormFieldSizeOptions | undefined;
|
|
8
8
|
type?: ("number" | "currency") | undefined;
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import { type FormFieldSizeOptions } from '../../index.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
value?: string | undefined;
|
|
5
|
+
value?: string | null | undefined;
|
|
6
6
|
size?: FormFieldSizeOptions | undefined;
|
|
7
7
|
};
|
|
8
8
|
events: {
|
|
@@ -3,7 +3,7 @@ import FormLabel from "../form-label.svelte";
|
|
|
3
3
|
import { uniqueId } from "../../helpers/unique-id.js";
|
|
4
4
|
import RadioBox from "./radio-box.svelte";
|
|
5
5
|
const id = uniqueId();
|
|
6
|
-
export let
|
|
6
|
+
export let group = "";
|
|
7
7
|
export let items = [];
|
|
8
8
|
export let size = "full";
|
|
9
9
|
export let disabled = false;
|
|
@@ -16,7 +16,7 @@ export let required = false;
|
|
|
16
16
|
{/if}
|
|
17
17
|
<div>
|
|
18
18
|
{#each items as item}
|
|
19
|
-
<RadioBox bind:group={
|
|
19
|
+
<RadioBox bind:group={group} {disabled} value={item.value}>{item.name}</RadioBox>
|
|
20
20
|
{/each}
|
|
21
21
|
</div>
|
|
22
22
|
</FormField>
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { DropdownOption, FormFieldSizeOptions } from '../../types/form.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
|
|
5
|
+
group?: string | undefined;
|
|
6
6
|
items?: DropdownOption[] | undefined;
|
|
7
7
|
size?: FormFieldSizeOptions | undefined;
|
|
8
8
|
disabled?: boolean | undefined;
|
|
@@ -3,7 +3,7 @@ import type { FormFieldSizeOptions } from '../../types/form.js';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
size?: FormFieldSizeOptions | undefined;
|
|
6
|
-
value?: string | undefined;
|
|
6
|
+
value?: string | null | undefined;
|
|
7
7
|
placeholder?: string | undefined;
|
|
8
8
|
rows?: number | undefined;
|
|
9
9
|
disabled?: boolean | undefined;
|
|
@@ -33,21 +33,22 @@ const onKeyPress = (e) => {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const onInput = (e) => {
|
|
36
|
+
const cleanValue = String(value);
|
|
36
37
|
if (textCase === "lower") {
|
|
37
|
-
value =
|
|
38
|
+
value = cleanValue.toLowerCase();
|
|
38
39
|
} else if (textCase === "upper") {
|
|
39
|
-
value =
|
|
40
|
+
value = cleanValue.toUpperCase();
|
|
40
41
|
}
|
|
41
42
|
if (type === "email") {
|
|
42
|
-
value =
|
|
43
|
+
value = cleanValue.replace(/\s/g, "");
|
|
43
44
|
}
|
|
44
45
|
if (type === "tel") {
|
|
45
|
-
value =
|
|
46
|
+
value = cleanValue.replace(/[^0-9]/g, "");
|
|
46
47
|
}
|
|
47
48
|
if (type === "url") {
|
|
48
|
-
value =
|
|
49
|
+
value = cleanValue.replace(/\s/g, "");
|
|
49
50
|
}
|
|
50
|
-
dipatch("input",
|
|
51
|
+
dipatch("input", cleanValue);
|
|
51
52
|
};
|
|
52
53
|
</script>
|
|
53
54
|
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { AllowedTextInputTypes, FormFieldSizeOptions } from '../../types/form.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
value?: string | undefined;
|
|
5
|
+
value?: string | null | undefined;
|
|
6
6
|
placeholder?: string | undefined;
|
|
7
7
|
helperText?: string | undefined;
|
|
8
8
|
size?: FormFieldSizeOptions | undefined;
|
|
@@ -4,7 +4,8 @@ export let value = "";
|
|
|
4
4
|
export let size = "lg";
|
|
5
5
|
export let placeholder = "example.com";
|
|
6
6
|
const onInput = () => {
|
|
7
|
-
const
|
|
7
|
+
const cleanValue = value ?? "";
|
|
8
|
+
const urlParts = cleanValue.split("://");
|
|
8
9
|
if (["http", "https"].includes(urlParts[0])) {
|
|
9
10
|
protocol = urlParts[0];
|
|
10
11
|
value = urlParts[1];
|
|
@@ -4,7 +4,7 @@ import type { HttpProtocol } from '../../types/generic.js';
|
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
protocol?: HttpProtocol | undefined;
|
|
7
|
-
value?: string | undefined;
|
|
7
|
+
value?: string | null | undefined;
|
|
8
8
|
size?: FormFieldSizeOptions | undefined;
|
|
9
9
|
placeholder?: string | undefined;
|
|
10
10
|
};
|
|
@@ -39,6 +39,10 @@ const format = (row, key) => {
|
|
|
39
39
|
const col = cols.find((col2) => col2.key === key);
|
|
40
40
|
if (!col)
|
|
41
41
|
return row[key];
|
|
42
|
+
if ((row[key] === null || row[key] === void 0) && col.nullText)
|
|
43
|
+
return col.nullText;
|
|
44
|
+
if (String(row[key]).trim() === "" && col.emptyText)
|
|
45
|
+
return col.emptyText;
|
|
42
46
|
if (col.format)
|
|
43
47
|
return col.format(row, key);
|
|
44
48
|
return row[key];
|
package/dist/types/data.d.ts
CHANGED