sveltacular 0.0.54 → 0.0.55
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.
|
@@ -11,11 +11,8 @@ export let nullable = false;
|
|
|
11
11
|
export let enabled = true;
|
|
12
12
|
export let type = "date";
|
|
13
13
|
export let required = false;
|
|
14
|
-
const _defaultValue = defaultValue
|
|
14
|
+
const _defaultValue = defaultValue || value || currentDateTime();
|
|
15
15
|
const getDefaultValue = () => {
|
|
16
|
-
if (nullable && !isDateOrDateTime(String(_defaultValue))) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
16
|
if (type === "date") {
|
|
20
17
|
return isDate(String(_defaultValue)) ? _defaultValue : currentDateTime().substring(0, 10);
|
|
21
18
|
}
|
|
@@ -27,9 +24,10 @@ const checkChanged = () => {
|
|
|
27
24
|
}
|
|
28
25
|
};
|
|
29
26
|
if (!value) {
|
|
30
|
-
|
|
31
|
-
if (nullable && !value)
|
|
27
|
+
if (nullable)
|
|
32
28
|
enabled = false;
|
|
29
|
+
else
|
|
30
|
+
value = getDefaultValue();
|
|
33
31
|
}
|
|
34
32
|
$:
|
|
35
33
|
disabled = !enabled;
|
|
@@ -3,7 +3,7 @@ import type { FormFieldSizeOptions } from '../../index.js';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
value?: string | undefined | null;
|
|
6
|
-
defaultValue?: string | undefined
|
|
6
|
+
defaultValue?: string | undefined;
|
|
7
7
|
size?: FormFieldSizeOptions | undefined;
|
|
8
8
|
placeholder?: string | undefined;
|
|
9
9
|
nullable?: boolean | undefined;
|