fuma 0.3.42 → 0.3.43
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/ui/form/FormInput.svelte.d.ts +2 -2
- package/dist/ui/form/formInput.d.ts +1 -1
- package/dist/ui/form/formInput.js +1 -1
- package/dist/ui/input/{InputDatetime.svelte.d.ts → InputDateTime.svelte.d.ts} +4 -4
- package/dist/ui/input/InputTime.svelte +27 -7
- package/dist/ui/input/InputTime.svelte.d.ts +2 -2
- package/dist/ui/input/index.d.ts +1 -1
- package/dist/ui/input/index.js +1 -1
- package/package.json +1 -1
- /package/dist/ui/input/{InputDatetime.svelte → InputDateTime.svelte} +0 -0
|
@@ -7,7 +7,7 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
|
|
|
7
7
|
readonly textrich: typeof import("../index.js").InputTextRich;
|
|
8
8
|
readonly boolean: typeof import("../index.js").InputBoolean;
|
|
9
9
|
readonly date: typeof import("../index.js").InputDate;
|
|
10
|
-
readonly datetime: typeof import("../index.js").
|
|
10
|
+
readonly datetime: typeof import("../index.js").InputDateTime;
|
|
11
11
|
readonly number: typeof import("../index.js").InputNumber;
|
|
12
12
|
readonly password: typeof import("../index.js").InputPassword;
|
|
13
13
|
readonly select: typeof import("../index.js").InputSelect;
|
|
@@ -76,7 +76,7 @@ declare class __sveltets_Render<InputType extends FormInputsType> {
|
|
|
76
76
|
readonly textrich: typeof import("../index.js").InputTextRich;
|
|
77
77
|
readonly boolean: typeof import("../index.js").InputBoolean;
|
|
78
78
|
readonly date: typeof import("../index.js").InputDate;
|
|
79
|
-
readonly datetime: typeof import("../index.js").
|
|
79
|
+
readonly datetime: typeof import("../index.js").InputDateTime;
|
|
80
80
|
readonly number: typeof import("../index.js").InputNumber;
|
|
81
81
|
readonly password: typeof import("../index.js").InputPassword;
|
|
82
82
|
readonly select: typeof import("../index.js").InputSelect;
|
|
@@ -3,7 +3,7 @@ import InputText from '../input/InputText.svelte';
|
|
|
3
3
|
import InputTextarea from '../input/InputTextarea.svelte';
|
|
4
4
|
import InputBoolean from '../input/InputBoolean.svelte';
|
|
5
5
|
import InputDate from '../input/InputDate.svelte';
|
|
6
|
-
import InputDatetime from '../input/
|
|
6
|
+
import InputDatetime from '../input/InputDateTime.svelte';
|
|
7
7
|
import InputNumber from '../input/InputNumber.svelte';
|
|
8
8
|
import InputPassword from '../input/InputPassword.svelte';
|
|
9
9
|
import InputRadio from '../input/InputRadio.svelte';
|
|
@@ -2,7 +2,7 @@ import InputText from '../input/InputText.svelte';
|
|
|
2
2
|
import InputTextarea from '../input/InputTextarea.svelte';
|
|
3
3
|
import InputBoolean from '../input/InputBoolean.svelte';
|
|
4
4
|
import InputDate from '../input/InputDate.svelte';
|
|
5
|
-
import InputDatetime from '../input/
|
|
5
|
+
import InputDatetime from '../input/InputDateTime.svelte';
|
|
6
6
|
import InputNumber from '../input/InputNumber.svelte';
|
|
7
7
|
import InputPassword from '../input/InputPassword.svelte';
|
|
8
8
|
import InputRadio from '../input/InputRadio.svelte';
|
|
@@ -11,9 +11,9 @@ declare const __propDef: {
|
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
export type
|
|
17
|
-
export default class
|
|
14
|
+
export type InputDateTimeProps = typeof __propDef.props;
|
|
15
|
+
export type InputDateTimeEvents = typeof __propDef.events;
|
|
16
|
+
export type InputDateTimeSlots = typeof __propDef.slots;
|
|
17
|
+
export default class InputDateTime extends SvelteComponent<InputDateTimeProps, InputDateTimeEvents, InputDateTimeSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
<script>import { FormControl } from "./index.js";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
export let value = void 0;
|
|
4
|
+
export let input = {};
|
|
2
5
|
$:
|
|
3
|
-
({
|
|
6
|
+
({ class: inputClass = "", ...inputProps } = input);
|
|
7
|
+
let valueAsNumber = value;
|
|
8
|
+
let valueAsString = msToString(value);
|
|
4
9
|
$:
|
|
5
|
-
(
|
|
6
|
-
|
|
10
|
+
if (value !== valueAsNumber)
|
|
11
|
+
valueAsString = msToString(value);
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
13
|
+
function msToString(ms) {
|
|
14
|
+
if (ms === null || ms === void 0)
|
|
15
|
+
return "";
|
|
16
|
+
const hours = Math.floor(ms / (1e3 * 60 * 60));
|
|
17
|
+
const minutes = Math.floor(ms / (1e3 * 60) - hours * 60);
|
|
18
|
+
const secondes = Math.floor(ms / 1e3 - minutes * 60);
|
|
19
|
+
const format = (n) => n.toString().padStart(2, "0");
|
|
20
|
+
return [format(hours), format(minutes), format(secondes)].join(":");
|
|
21
|
+
}
|
|
22
|
+
const onInput = (event) => {
|
|
23
|
+
valueAsNumber = event.currentTarget.valueAsNumber;
|
|
24
|
+
value = valueAsNumber;
|
|
25
|
+
dispatch("input", valueAsNumber);
|
|
26
|
+
};
|
|
7
27
|
</script>
|
|
8
28
|
|
|
9
|
-
<FormControl {
|
|
29
|
+
<FormControl {...$$restProps} let:key>
|
|
10
30
|
<input
|
|
11
|
-
|
|
12
|
-
on:input
|
|
31
|
+
value={valueAsString}
|
|
32
|
+
on:input={onInput}
|
|
13
33
|
on:focus
|
|
14
34
|
on:blur
|
|
15
35
|
type="time"
|
|
16
36
|
name={key}
|
|
17
37
|
id={key}
|
|
18
|
-
class="input input-bordered {inputClass
|
|
38
|
+
class="input input-bordered {inputClass}"
|
|
19
39
|
{...inputProps}
|
|
20
40
|
/>
|
|
21
41
|
</FormControl>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { type InputProps } from './index.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
|
-
props: InputProps
|
|
4
|
+
props: InputProps<number>;
|
|
5
5
|
events: {
|
|
6
|
-
input: Event;
|
|
7
6
|
focus: FocusEvent;
|
|
8
7
|
blur: FocusEvent;
|
|
8
|
+
input: CustomEvent<number>;
|
|
9
9
|
} & {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
package/dist/ui/input/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { default as InputTextarea } from './InputTextarea.svelte';
|
|
|
8
8
|
export { default as InputRelations } from './InputRelations.svelte';
|
|
9
9
|
export { default as InputRelation } from './InputRelation.svelte';
|
|
10
10
|
export { default as InputDate } from './InputDate.svelte';
|
|
11
|
-
export { default as
|
|
11
|
+
export { default as InputDateTime } from './InputDateTime.svelte';
|
|
12
12
|
export { default as InputTime } from './InputTime.svelte';
|
|
13
13
|
export { default as InputNumber } from './InputNumber.svelte';
|
|
14
14
|
export { default as InputBoolean } from './InputBoolean.svelte';
|
package/dist/ui/input/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { default as InputTextarea } from './InputTextarea.svelte';
|
|
|
8
8
|
export { default as InputRelations } from './InputRelations.svelte';
|
|
9
9
|
export { default as InputRelation } from './InputRelation.svelte';
|
|
10
10
|
export { default as InputDate } from './InputDate.svelte';
|
|
11
|
-
export { default as
|
|
11
|
+
export { default as InputDateTime } from './InputDateTime.svelte';
|
|
12
12
|
export { default as InputTime } from './InputTime.svelte';
|
|
13
13
|
export { default as InputNumber } from './InputNumber.svelte';
|
|
14
14
|
export { default as InputBoolean } from './InputBoolean.svelte';
|
package/package.json
CHANGED
|
File without changes
|