framework7-svelte 8.3.4 → 9.0.0
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/components/accordion-content.d.ts +11 -5
- package/components/accordion-content.svelte +8 -6
- package/components/accordion-item.d.ts +23 -11
- package/components/accordion-item.svelte +27 -25
- package/components/accordion-toggle.d.ts +11 -5
- package/components/accordion-toggle.svelte +8 -6
- package/components/accordion.d.ts +11 -5
- package/components/accordion.svelte +11 -10
- package/components/actions-button.d.ts +14 -6
- package/components/actions-button.svelte +21 -19
- package/components/actions-group.d.ts +11 -5
- package/components/actions-group.svelte +4 -7
- package/components/actions-label.d.ts +11 -5
- package/components/actions-label.svelte +13 -23
- package/components/actions.d.ts +31 -21
- package/components/actions.svelte +50 -54
- package/components/app.d.ts +11 -5
- package/components/app.svelte +6 -7
- package/components/area-chart.d.ts +13 -6
- package/components/area-chart.svelte +42 -46
- package/components/badge.d.ts +11 -5
- package/components/badge.svelte +10 -9
- package/components/block-footer.d.ts +11 -5
- package/components/block-footer.svelte +8 -6
- package/components/block-header.d.ts +11 -5
- package/components/block-header.svelte +8 -6
- package/components/block-title.d.ts +11 -5
- package/components/block-title.svelte +12 -10
- package/components/block.d.ts +11 -5
- package/components/block.svelte +76 -76
- package/components/breadcrumbs-collapsed.d.ts +12 -6
- package/components/breadcrumbs-collapsed.svelte +10 -15
- package/components/breadcrumbs-item.d.ts +12 -6
- package/components/breadcrumbs-item.svelte +9 -8
- package/components/breadcrumbs-separator.d.ts +10 -5
- package/components/breadcrumbs-separator.svelte +9 -5
- package/components/breadcrumbs.d.ts +11 -6
- package/components/breadcrumbs.svelte +8 -6
- package/components/button.d.ts +44 -37
- package/components/button.svelte +107 -103
- package/components/card-content.d.ts +11 -5
- package/components/card-content.svelte +11 -10
- package/components/card-footer.d.ts +11 -5
- package/components/card-footer.svelte +8 -6
- package/components/card-header.d.ts +11 -5
- package/components/card-header.svelte +8 -6
- package/components/card.d.ts +43 -31
- package/components/card.svelte +78 -67
- package/components/checkbox.d.ts +20 -13
- package/components/checkbox.svelte +32 -30
- package/components/chip.d.ts +22 -15
- package/components/chip.svelte +54 -60
- package/components/fab-backdrop.d.ts +10 -5
- package/components/fab-backdrop.svelte +5 -7
- package/components/fab-button.d.ts +17 -11
- package/components/fab-button.svelte +20 -29
- package/components/fab-buttons.d.ts +11 -5
- package/components/fab-buttons.svelte +5 -12
- package/components/fab.d.ts +22 -13
- package/components/fab.svelte +55 -51
- package/components/gauge.d.ts +24 -19
- package/components/gauge.svelte +25 -25
- package/components/icon.d.ts +19 -13
- package/components/icon.svelte +65 -63
- package/components/input.d.ts +78 -61
- package/components/input.svelte +171 -154
- package/components/link.d.ts +28 -21
- package/components/link.svelte +67 -65
- package/components/list-button.d.ts +22 -15
- package/components/list-button.svelte +56 -44
- package/components/list-group.d.ts +16 -10
- package/components/list-group.svelte +38 -34
- package/components/list-index.d.ts +20 -13
- package/components/list-index.svelte +23 -24
- package/components/list-input.d.ts +91 -64
- package/components/list-input.svelte +254 -205
- package/components/list-item.d.ts +98 -63
- package/components/list-item.svelte +412 -439
- package/components/list.d.ts +72 -54
- package/components/list.svelte +151 -147
- package/components/login-screen-title.d.ts +11 -5
- package/components/login-screen-title.svelte +4 -6
- package/components/login-screen.d.ts +20 -10
- package/components/login-screen.svelte +39 -42
- package/components/message.d.ts +48 -29
- package/components/message.svelte +123 -88
- package/components/messagebar-attachment.d.ts +17 -9
- package/components/messagebar-attachment.svelte +16 -18
- package/components/messagebar-attachments.d.ts +11 -5
- package/components/messagebar-attachments.svelte +6 -6
- package/components/messagebar-sheet-image.d.ts +19 -10
- package/components/messagebar-sheet-image.svelte +30 -22
- package/components/messagebar-sheet-item.d.ts +11 -5
- package/components/messagebar-sheet-item.svelte +4 -6
- package/components/messagebar-sheet.d.ts +11 -5
- package/components/messagebar-sheet.svelte +4 -6
- package/components/messagebar.d.ts +53 -31
- package/components/messagebar.svelte +100 -77
- package/components/messages-title.d.ts +11 -5
- package/components/messages-title.svelte +4 -6
- package/components/messages.d.ts +26 -20
- package/components/messages.svelte +32 -32
- package/components/nav-left.d.ts +19 -12
- package/components/nav-left.svelte +23 -39
- package/components/nav-right.d.ts +11 -6
- package/components/nav-right.svelte +4 -15
- package/components/nav-title-large.d.ts +11 -5
- package/components/nav-title-large.svelte +4 -6
- package/components/nav-title.d.ts +13 -8
- package/components/nav-title.svelte +25 -20
- package/components/navbar.d.ts +47 -28
- package/components/navbar.svelte +100 -111
- package/components/page-content.d.ts +41 -29
- package/components/page-content.svelte +58 -50
- package/components/page.d.ts +71 -46
- package/components/page.svelte +102 -82
- package/components/panel.d.ts +51 -35
- package/components/panel.svelte +94 -99
- package/components/photo-browser.d.ts +50 -41
- package/components/photo-browser.svelte +48 -47
- package/components/pie-chart.d.ts +13 -6
- package/components/pie-chart.svelte +29 -27
- package/components/popover.d.ts +28 -19
- package/components/popover.svelte +45 -48
- package/components/popup.d.ts +37 -23
- package/components/popup.svelte +68 -57
- package/components/preloader.d.ts +10 -5
- package/components/preloader.svelte +30 -31
- package/components/progressbar.d.ts +11 -6
- package/components/progressbar.svelte +13 -17
- package/components/radio.d.ts +19 -12
- package/components/radio.svelte +19 -23
- package/components/range.d.ts +35 -27
- package/components/range.svelte +47 -44
- package/components/routable-modals.d.ts +9 -4
- package/components/routable-modals.svelte +9 -8
- package/components/router-context-provider.d.ts +11 -6
- package/components/router-context-provider.svelte +2 -4
- package/components/searchbar.d.ts +60 -43
- package/components/searchbar.svelte +115 -104
- package/components/segmented.d.ts +21 -15
- package/components/segmented.svelte +38 -35
- package/components/sheet.d.ts +47 -30
- package/components/sheet.svelte +94 -76
- package/components/snippet-render.d.ts +24 -0
- package/components/snippet-render.svelte +9 -0
- package/components/stepper.d.ts +53 -43
- package/components/stepper.svelte +83 -79
- package/components/subnavbar.d.ts +13 -8
- package/components/subnavbar.svelte +12 -20
- package/components/swipeout-actions.d.ts +14 -8
- package/components/swipeout-actions.svelte +14 -13
- package/components/swipeout-button.d.ts +20 -13
- package/components/swipeout-button.svelte +31 -31
- package/components/tab.d.ts +14 -8
- package/components/tab.svelte +20 -28
- package/components/tabs.d.ts +15 -9
- package/components/tabs.svelte +27 -26
- package/components/text-editor.d.ts +44 -24
- package/components/text-editor.svelte +56 -41
- package/components/toggle.d.ts +22 -15
- package/components/toggle.svelte +33 -37
- package/components/toolbar-pane.d.ts +24 -0
- package/components/toolbar-pane.svelte +14 -0
- package/components/toolbar.d.ts +30 -20
- package/components/toolbar.svelte +61 -53
- package/components/treeview-item.d.ts +36 -17
- package/components/treeview-item.svelte +101 -81
- package/components/treeview.d.ts +11 -5
- package/components/treeview.svelte +4 -6
- package/components/use-icon.d.ts +9 -4
- package/components/use-icon.svelte +1 -1
- package/components/view.d.ts +76 -65
- package/components/view.svelte +66 -48
- package/components/views.d.ts +11 -5
- package/components/views.svelte +12 -15
- package/framework7-svelte.d.ts +3 -1
- package/framework7-svelte.js +6 -4
- package/package.json +2 -2
- package/shared/components-router.js +28 -25
- package/shared/f7.js +1 -7
- package/shared/mixins.js +5 -5
- package/shared/modal-state-classes.js +4 -5
- package/shared/plugin.js +1 -4
- package/shared/rest-props.js +1 -4
- package/shared/use-icon.js +2 -5
- package/shared/use-store.js +9 -9
- package/shared/use-tab.js +3 -3
- package/shared/use-tooltip.js +3 -4
- package/shared/utils.js +2 -8
- package/shared/get-reactive-context.js +0 -16
- package/shared/list-context.js +0 -10
- package/shared/router-context.js +0 -8
- package/shared/set-reactive-context.js +0 -26
package/components/input.d.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
|
|
2
|
-
import { SvelteComponent } from 'svelte';
|
|
2
|
+
import { SvelteComponent, Snippet } from 'svelte';
|
|
3
3
|
import { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
|
|
5
5
|
import { Calendar, ColorPicker, TextEditor } from 'framework7/types';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
interface
|
|
9
|
-
type
|
|
10
|
-
name
|
|
11
|
-
value
|
|
12
|
-
defaultValue
|
|
13
|
-
inputmode
|
|
14
|
-
placeholder
|
|
15
|
-
inputId
|
|
16
|
-
size
|
|
17
|
-
accept
|
|
18
|
-
autocomplete
|
|
19
|
-
autocorrect
|
|
20
|
-
autocapitalize
|
|
21
|
-
spellcheck
|
|
22
|
-
autofocus
|
|
23
|
-
autosave
|
|
24
|
-
checked
|
|
25
|
-
disabled
|
|
26
|
-
max
|
|
27
|
-
min
|
|
28
|
-
step
|
|
29
|
-
maxlength
|
|
30
|
-
minlength
|
|
31
|
-
multiple
|
|
32
|
-
readonly
|
|
33
|
-
required
|
|
34
|
-
pattern
|
|
35
|
-
validate
|
|
36
|
-
validateOnBlur
|
|
37
|
-
onValidate
|
|
38
|
-
tabindex
|
|
39
|
-
resizable
|
|
40
|
-
clearButton
|
|
41
|
-
noFormStoreData
|
|
42
|
-
noStoreData
|
|
43
|
-
ignoreStoreData
|
|
44
|
-
errorMessage
|
|
45
|
-
errorMessageForce
|
|
46
|
-
info
|
|
47
|
-
outline
|
|
48
|
-
wrap
|
|
49
|
-
dropdown
|
|
50
|
-
calendarParams
|
|
51
|
-
colorPickerParams
|
|
52
|
-
textEditorParams
|
|
53
|
-
inputStyle
|
|
8
|
+
interface Props {
|
|
9
|
+
type?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
value?: string | number | Array<any> | Date | Object;
|
|
12
|
+
defaultValue?: string | number | Array<any>;
|
|
13
|
+
inputmode?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
inputId?: string | number;
|
|
16
|
+
size?: string | number;
|
|
17
|
+
accept?: string | number;
|
|
18
|
+
autocomplete?: string;
|
|
19
|
+
autocorrect?: string;
|
|
20
|
+
autocapitalize?: string;
|
|
21
|
+
spellcheck?: string;
|
|
22
|
+
autofocus?: boolean;
|
|
23
|
+
autosave?: string;
|
|
24
|
+
checked?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
max?: string | number;
|
|
27
|
+
min?: string | number;
|
|
28
|
+
step?: string | number;
|
|
29
|
+
maxlength?: string | number;
|
|
30
|
+
minlength?: string | number;
|
|
31
|
+
multiple?: boolean;
|
|
32
|
+
readonly?: boolean;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
pattern?: string;
|
|
35
|
+
validate?: boolean | string;
|
|
36
|
+
validateOnBlur?: boolean;
|
|
37
|
+
onValidate?: Function;
|
|
38
|
+
tabindex?: string | number;
|
|
39
|
+
resizable?: boolean;
|
|
40
|
+
clearButton?: boolean;
|
|
41
|
+
noFormStoreData?: boolean;
|
|
42
|
+
noStoreData?: boolean;
|
|
43
|
+
ignoreStoreData?: boolean;
|
|
44
|
+
errorMessage?: string | Snippet;
|
|
45
|
+
errorMessageForce?: boolean;
|
|
46
|
+
info?: string | Snippet;
|
|
47
|
+
outline?: boolean;
|
|
48
|
+
wrap?: boolean;
|
|
49
|
+
dropdown?: string | boolean;
|
|
50
|
+
calendarParams?: Calendar.Parameters;
|
|
51
|
+
colorPickerParams?: ColorPicker.Parameters;
|
|
52
|
+
textEditorParams?: TextEditor.Parameters;
|
|
53
|
+
inputStyle?: string;
|
|
54
54
|
color?: string;
|
|
55
55
|
colorTheme?: string;
|
|
56
56
|
textColor?: string;
|
|
@@ -58,25 +58,42 @@ interface InputProps {
|
|
|
58
58
|
borderColor?: string;
|
|
59
59
|
rippleColor?: string;
|
|
60
60
|
dark?: boolean;
|
|
61
|
-
onCalendarChange
|
|
62
|
-
onColorPickerChange
|
|
63
|
-
onTextareaResize
|
|
64
|
-
onInputNotEmpty
|
|
65
|
-
onInputEmpty
|
|
66
|
-
onInputClear
|
|
67
|
-
onInput
|
|
68
|
-
onFocus
|
|
69
|
-
onBlur
|
|
70
|
-
onChange
|
|
71
|
-
onTextEditorChange
|
|
61
|
+
onCalendarChange?: (calendarValue?: any) => void;
|
|
62
|
+
onColorPickerChange?: (colorPickerValue?: any) => void;
|
|
63
|
+
onTextareaResize?: (event?: any) => void;
|
|
64
|
+
onInputNotEmpty?: (event?: any) => void;
|
|
65
|
+
onInputEmpty?: (event?: any) => void;
|
|
66
|
+
onInputClear?: (event?: any) => void;
|
|
67
|
+
onInput?: (...args: any[]) => void;
|
|
68
|
+
onFocus?: (...args: any[]) => void;
|
|
69
|
+
onBlur?: (...args: any[]) => void;
|
|
70
|
+
onChange?: (...args: any[]) => void;
|
|
71
|
+
onTextEditorChange?: (...args: any[]) => void;
|
|
72
|
+
children?: Snippet;
|
|
73
|
+
ontextarearesize?: () => void;
|
|
74
|
+
oninputnotempty?: () => void;
|
|
75
|
+
oninputempty?: () => void;
|
|
76
|
+
oninputclear?: () => void;
|
|
77
|
+
oninput?: () => void;
|
|
78
|
+
onfocus?: () => void;
|
|
79
|
+
onblur?: () => void;
|
|
80
|
+
onchange?: () => void;
|
|
81
|
+
ontexteditorchange?: () => void;
|
|
82
|
+
oncalendarchange?: () => void;
|
|
83
|
+
oncolorpickerchange?: () => void;
|
|
72
84
|
}
|
|
73
85
|
|
|
86
|
+
interface InputProps {}
|
|
87
|
+
interface InputProps extends Props {}
|
|
88
|
+
|
|
89
|
+
interface InputEvents extends Record<'',{}>{}
|
|
90
|
+
|
|
74
91
|
|
|
75
92
|
|
|
76
93
|
declare class Input extends SvelteComponent<
|
|
77
|
-
InputProps
|
|
78
|
-
|
|
79
|
-
{
|
|
94
|
+
InputProps,
|
|
95
|
+
InputEvents,
|
|
96
|
+
{ }
|
|
80
97
|
> {}
|
|
81
98
|
|
|
82
99
|
export { InputProps };
|
package/components/input.svelte
CHANGED
|
@@ -1,81 +1,80 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { onMount, onDestroy } from 'svelte';
|
|
3
3
|
import { colorClasses } from '../shared/mixins.js';
|
|
4
|
-
import { classNames
|
|
5
|
-
import { restProps } from '../shared/rest-props.js';
|
|
4
|
+
import { classNames } from '../shared/utils.js';
|
|
6
5
|
import { app, f7ready } from '../shared/f7.js';
|
|
7
6
|
import Toggle from './toggle.svelte';
|
|
8
7
|
import Range from './range.svelte';
|
|
9
8
|
import TextEditor from './text-editor.svelte';
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
10
|
+
let {
|
|
11
|
+
class: className,
|
|
12
|
+
type = undefined,
|
|
13
|
+
name = undefined,
|
|
14
|
+
value = undefined,
|
|
15
|
+
placeholder = undefined,
|
|
16
|
+
inputId = undefined,
|
|
17
|
+
size = undefined,
|
|
18
|
+
accept = undefined,
|
|
19
|
+
autocomplete = undefined,
|
|
20
|
+
autocorrect = undefined,
|
|
21
|
+
autocapitalize = undefined,
|
|
22
|
+
spellcheck = undefined,
|
|
23
|
+
autofocus = undefined,
|
|
24
|
+
autosave = undefined,
|
|
25
|
+
checked = undefined,
|
|
26
|
+
disabled = undefined,
|
|
27
|
+
max = undefined,
|
|
28
|
+
min = undefined,
|
|
29
|
+
step = undefined,
|
|
30
|
+
maxlength = undefined,
|
|
31
|
+
minlength = undefined,
|
|
32
|
+
multiple = undefined,
|
|
33
|
+
readonly = undefined,
|
|
34
|
+
required = undefined,
|
|
35
|
+
inputStyle = undefined,
|
|
36
|
+
pattern = undefined,
|
|
37
|
+
validate = undefined,
|
|
38
|
+
validateOnBlur = undefined,
|
|
39
|
+
onValidate = undefined,
|
|
40
|
+
tabindex = undefined,
|
|
41
|
+
resizable = undefined,
|
|
42
|
+
clearButton = undefined,
|
|
43
|
+
|
|
44
|
+
// Form
|
|
45
|
+
noFormStoreData = undefined,
|
|
46
|
+
noStoreData = undefined,
|
|
47
|
+
ignoreStoreData = undefined,
|
|
48
|
+
|
|
49
|
+
// Error, Info
|
|
50
|
+
errorMessage = undefined,
|
|
51
|
+
errorMessageForce = undefined,
|
|
52
|
+
info = undefined,
|
|
53
|
+
|
|
54
|
+
// Outline
|
|
55
|
+
outline = undefined,
|
|
56
|
+
|
|
57
|
+
// Components
|
|
58
|
+
wrap = true,
|
|
59
|
+
dropdown = 'auto',
|
|
60
|
+
|
|
61
|
+
// Datepicker
|
|
62
|
+
calendarParams = undefined,
|
|
63
|
+
// Colorpicker
|
|
64
|
+
colorPickerParams = undefined,
|
|
65
|
+
// Text editor
|
|
66
|
+
textEditorParams = undefined,
|
|
67
|
+
|
|
68
|
+
...restProps
|
|
69
|
+
} = $props();
|
|
71
70
|
|
|
72
71
|
// State
|
|
73
|
-
let inputEl;
|
|
74
|
-
let inputFocused = false;
|
|
75
|
-
let inputInvalid = false;
|
|
76
|
-
let updateInputOnDidUpdate = false;
|
|
77
|
-
let f7Calendar;
|
|
78
|
-
let f7ColorPicker;
|
|
72
|
+
let inputEl = $state(null);
|
|
73
|
+
let inputFocused = $state(false);
|
|
74
|
+
let inputInvalid = $state(false);
|
|
75
|
+
let updateInputOnDidUpdate = $state(false);
|
|
76
|
+
let f7Calendar = $state(null);
|
|
77
|
+
let f7ColorPicker = $state(null);
|
|
79
78
|
|
|
80
79
|
function domValue() {
|
|
81
80
|
if (!inputEl) return undefined;
|
|
@@ -125,14 +124,16 @@
|
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
$effect(() => {
|
|
128
|
+
watchValue(value);
|
|
129
|
+
});
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
const inputType = $derived(type === 'datepicker' || type === 'colorpicker' ? 'text' : type);
|
|
131
132
|
|
|
132
133
|
// eslint-disable-next-line
|
|
133
|
-
|
|
134
|
+
const needsValue = $derived(type !== 'file' && type !== 'datepicker' && type !== 'colorpicker');
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
const inputValue = $derived.by(() => {
|
|
136
137
|
let v;
|
|
137
138
|
if (typeof value !== 'undefined') {
|
|
138
139
|
v = value;
|
|
@@ -141,50 +142,54 @@
|
|
|
141
142
|
}
|
|
142
143
|
if (typeof v === 'undefined' || v === null) return '';
|
|
143
144
|
return v;
|
|
144
|
-
})();
|
|
145
|
-
|
|
146
|
-
$: wrapClasses = classNames(
|
|
147
|
-
className,
|
|
148
|
-
'input',
|
|
149
|
-
{
|
|
150
|
-
'input-outline': outline,
|
|
151
|
-
'input-dropdown': dropdown === 'auto' ? type === 'select' : dropdown,
|
|
152
|
-
'input-invalid': (errorMessage && errorMessageForce) || inputInvalid,
|
|
153
|
-
},
|
|
154
|
-
colorClasses($$props),
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
$: inputClassName = classNames(!wrap && className, {
|
|
158
|
-
resizable: inputType === 'textarea' && resizable,
|
|
159
|
-
'no-store-data': noFormStoreData || noStoreData || ignoreStoreData,
|
|
160
|
-
'input-invalid': (errorMessage && errorMessageForce) || inputInvalid,
|
|
161
|
-
'input-with-value': inputHasValue(),
|
|
162
|
-
'input-focused': inputFocused,
|
|
163
145
|
});
|
|
164
146
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
147
|
+
const wrapClasses = $derived(
|
|
148
|
+
classNames(
|
|
149
|
+
className,
|
|
150
|
+
'input',
|
|
151
|
+
{
|
|
152
|
+
'input-outline': outline,
|
|
153
|
+
'input-dropdown': dropdown === 'auto' ? type === 'select' : dropdown,
|
|
154
|
+
'input-invalid': (errorMessage && errorMessageForce) || inputInvalid,
|
|
155
|
+
},
|
|
156
|
+
colorClasses(restProps),
|
|
157
|
+
),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const inputClassName = $derived(
|
|
161
|
+
classNames(!wrap && className, {
|
|
162
|
+
resizable: inputType === 'textarea' && resizable,
|
|
163
|
+
'no-store-data': noFormStoreData || noStoreData || ignoreStoreData,
|
|
164
|
+
'input-invalid': (errorMessage && errorMessageForce) || inputInvalid,
|
|
165
|
+
'input-with-value': inputHasValue(),
|
|
166
|
+
'input-focused': inputFocused,
|
|
167
|
+
}),
|
|
168
|
+
);
|
|
169
169
|
|
|
170
170
|
function onTextareaResize(event) {
|
|
171
|
-
|
|
171
|
+
restProps.ontextarearesize?.(event);
|
|
172
|
+
restProps.onTextareaResize?.(event);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
function onInputNotEmpty(event) {
|
|
175
|
-
|
|
176
|
+
restProps.onInputNotEmpty?.(event);
|
|
177
|
+
restProps.oninputnotempty?.(event);
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
function onInputEmpty(event) {
|
|
179
|
-
|
|
181
|
+
restProps.onInputEmpty?.(event);
|
|
182
|
+
restProps.oninputempty?.(event);
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
function onInputClear(event) {
|
|
183
|
-
|
|
186
|
+
restProps.onInputClear?.(event);
|
|
187
|
+
restProps.oninputclear?.(event);
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
function onInput(...args) {
|
|
187
|
-
|
|
191
|
+
restProps.onInput?.(...args);
|
|
192
|
+
restProps.oninput?.(...args);
|
|
188
193
|
|
|
189
194
|
if (!(validateOnBlur || validateOnBlur === '') && (validate || validate === '') && inputEl) {
|
|
190
195
|
validateInput(inputEl);
|
|
@@ -195,13 +200,15 @@
|
|
|
195
200
|
}
|
|
196
201
|
|
|
197
202
|
function onFocus(...args) {
|
|
198
|
-
|
|
203
|
+
restProps.onFocus?.(...args);
|
|
204
|
+
restProps.onfocus?.(...args);
|
|
199
205
|
|
|
200
206
|
inputFocused = true;
|
|
201
207
|
}
|
|
202
208
|
|
|
203
209
|
function onBlur(...args) {
|
|
204
|
-
|
|
210
|
+
restProps.onBlur?.(...args);
|
|
211
|
+
restProps.onblur?.(...args);
|
|
205
212
|
|
|
206
213
|
if ((validate || validate === '' || validateOnBlur || validateOnBlur === '') && inputEl) {
|
|
207
214
|
validateInput();
|
|
@@ -210,10 +217,12 @@
|
|
|
210
217
|
}
|
|
211
218
|
|
|
212
219
|
function onChange(...args) {
|
|
213
|
-
|
|
220
|
+
restProps.onChange?.(...args);
|
|
221
|
+
restProps.onchange?.(...args);
|
|
214
222
|
|
|
215
223
|
if (type === 'texteditor') {
|
|
216
|
-
|
|
224
|
+
restProps.ontexteditorchange?.(args[1]);
|
|
225
|
+
restProps.onTextEditorChange?.(args[1]);
|
|
217
226
|
value = args[1];
|
|
218
227
|
}
|
|
219
228
|
}
|
|
@@ -238,7 +247,8 @@
|
|
|
238
247
|
value,
|
|
239
248
|
on: {
|
|
240
249
|
change(calendar, calendarValue) {
|
|
241
|
-
|
|
250
|
+
restProps.onCalendarChange?.(calendarValue);
|
|
251
|
+
restProps.oncalendarchange?.(calendarValue);
|
|
242
252
|
value = calendarValue;
|
|
243
253
|
},
|
|
244
254
|
},
|
|
@@ -251,7 +261,8 @@
|
|
|
251
261
|
value,
|
|
252
262
|
on: {
|
|
253
263
|
change(colorPicker, colorPickerValue) {
|
|
254
|
-
|
|
264
|
+
restProps.onColorPickerChange?.(colorPickerValue);
|
|
265
|
+
restProps.oncolorpickerchange?.(colorPickerValue);
|
|
255
266
|
value = colorPickerValue;
|
|
256
267
|
},
|
|
257
268
|
},
|
|
@@ -277,7 +288,7 @@
|
|
|
277
288
|
});
|
|
278
289
|
});
|
|
279
290
|
|
|
280
|
-
|
|
291
|
+
$effect(() => {
|
|
281
292
|
if (!app.f7) return;
|
|
282
293
|
if (updateInputOnDidUpdate) {
|
|
283
294
|
if (!inputEl) return;
|
|
@@ -317,7 +328,7 @@
|
|
|
317
328
|
|
|
318
329
|
<!-- svelte-ignore a11y-autofocus -->
|
|
319
330
|
{#if wrap}
|
|
320
|
-
<div class={wrapClasses} {...restProps
|
|
331
|
+
<div class={wrapClasses} {...restProps}>
|
|
321
332
|
{#if type === 'select'}
|
|
322
333
|
<select
|
|
323
334
|
bind:this={inputEl}
|
|
@@ -355,13 +366,13 @@
|
|
|
355
366
|
{tabindex}
|
|
356
367
|
data-error-message={errorMessageForce ? undefined : errorMessage}
|
|
357
368
|
class={inputClassName}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
369
|
+
onfocus={onFocus}
|
|
370
|
+
onblur={onBlur}
|
|
371
|
+
oninput={onInput}
|
|
372
|
+
onchange={onChange}
|
|
362
373
|
value={inputValue}
|
|
363
374
|
>
|
|
364
|
-
|
|
375
|
+
{@render children?.()}
|
|
365
376
|
</select>
|
|
366
377
|
{:else if type === 'textarea'}
|
|
367
378
|
<textarea
|
|
@@ -400,14 +411,14 @@
|
|
|
400
411
|
{tabindex}
|
|
401
412
|
data-error-message={errorMessageForce ? undefined : errorMessage}
|
|
402
413
|
class={inputClassName}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
414
|
+
onfocus={onFocus}
|
|
415
|
+
onblur={onBlur}
|
|
416
|
+
oninput={onInput}
|
|
417
|
+
onchange={onChange}
|
|
407
418
|
value={inputValue}
|
|
408
|
-
|
|
419
|
+
></textarea>
|
|
409
420
|
{:else if type === 'toggle'}
|
|
410
|
-
<Toggle {checked} {readonly} {name} {value} {disabled} id={inputId}
|
|
421
|
+
<Toggle {checked} {readonly} {name} {value} {disabled} id={inputId} onchange={onChange} />
|
|
411
422
|
{:else if type === 'range'}
|
|
412
423
|
<Range
|
|
413
424
|
{value}
|
|
@@ -418,7 +429,7 @@
|
|
|
418
429
|
{name}
|
|
419
430
|
id={inputId}
|
|
420
431
|
input={true}
|
|
421
|
-
|
|
432
|
+
onRangeChange={onChange}
|
|
422
433
|
/>
|
|
423
434
|
{:else if type === 'texteditor'}
|
|
424
435
|
<TextEditor
|
|
@@ -469,24 +480,30 @@
|
|
|
469
480
|
tabIndex={tabindex}
|
|
470
481
|
data-error-message={errorMessageForce ? undefined : errorMessage}
|
|
471
482
|
class={inputClassName}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
483
|
+
onfocus={onFocus}
|
|
484
|
+
onblur={onBlur}
|
|
485
|
+
oninput={onInput}
|
|
486
|
+
onchange={onChange}
|
|
476
487
|
value={type === 'datepicker' || type === 'colorpicker' || type === 'file' ? '' : inputValue}
|
|
477
488
|
/>
|
|
478
489
|
{/if}
|
|
479
|
-
{#if
|
|
490
|
+
{#if errorMessage && errorMessageForce}
|
|
480
491
|
<div class="input-error-message">
|
|
481
|
-
{errorMessage}
|
|
482
|
-
|
|
492
|
+
{#if typeof errorMessage === 'function'}
|
|
493
|
+
{@render errorMessage?.()}
|
|
494
|
+
{:else}
|
|
495
|
+
{errorMessage}
|
|
496
|
+
{/if}
|
|
483
497
|
</div>
|
|
484
498
|
{/if}
|
|
485
|
-
{#if clearButton}<span class="input-clear-button"
|
|
486
|
-
{#if info
|
|
499
|
+
{#if clearButton}<span class="input-clear-button"></span>{/if}
|
|
500
|
+
{#if info}
|
|
487
501
|
<div class="input-info">
|
|
488
|
-
{info}
|
|
489
|
-
|
|
502
|
+
{#if typeof info === 'function'}
|
|
503
|
+
{@render info?.()}
|
|
504
|
+
{:else}
|
|
505
|
+
{info}
|
|
506
|
+
{/if}
|
|
490
507
|
</div>
|
|
491
508
|
{/if}
|
|
492
509
|
</div>
|
|
@@ -527,14 +544,14 @@
|
|
|
527
544
|
{tabindex}
|
|
528
545
|
data-error-message={errorMessageForce ? undefined : errorMessage}
|
|
529
546
|
class={inputClassName}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
547
|
+
onfocus={onFocus}
|
|
548
|
+
onblur={onBlur}
|
|
549
|
+
oninput={onInput}
|
|
550
|
+
onchange={onChange}
|
|
534
551
|
value={inputValue}
|
|
535
|
-
{...restProps
|
|
552
|
+
{...restProps}
|
|
536
553
|
>
|
|
537
|
-
|
|
554
|
+
{@render children?.()}
|
|
538
555
|
</select>
|
|
539
556
|
{:else if type === 'textarea'}
|
|
540
557
|
<textarea
|
|
@@ -573,13 +590,13 @@
|
|
|
573
590
|
{tabindex}
|
|
574
591
|
data-error-message={errorMessageForce ? undefined : errorMessage}
|
|
575
592
|
class={inputClassName}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
593
|
+
onfocus={onFocus}
|
|
594
|
+
onblur={onBlur}
|
|
595
|
+
oninput={onInput}
|
|
596
|
+
onchange={onChange}
|
|
580
597
|
value={inputValue}
|
|
581
|
-
{...restProps
|
|
582
|
-
|
|
598
|
+
{...restProps}
|
|
599
|
+
></textarea>
|
|
583
600
|
{:else if type === 'toggle'}
|
|
584
601
|
<Toggle
|
|
585
602
|
{checked}
|
|
@@ -588,8 +605,8 @@
|
|
|
588
605
|
{value}
|
|
589
606
|
{disabled}
|
|
590
607
|
id={inputId}
|
|
591
|
-
|
|
592
|
-
{...restProps
|
|
608
|
+
onchange={onChange}
|
|
609
|
+
{...restProps}
|
|
593
610
|
/>
|
|
594
611
|
{:else if type === 'range'}
|
|
595
612
|
<Range
|
|
@@ -601,8 +618,8 @@
|
|
|
601
618
|
{name}
|
|
602
619
|
id={inputId}
|
|
603
620
|
input={true}
|
|
604
|
-
|
|
605
|
-
{...restProps
|
|
621
|
+
onRangeChange={onChange}
|
|
622
|
+
{...restProps}
|
|
606
623
|
/>
|
|
607
624
|
{:else if type === 'texteditor'}
|
|
608
625
|
<TextEditor
|
|
@@ -614,7 +631,7 @@
|
|
|
614
631
|
onTextEditorInput={onInput}
|
|
615
632
|
onTextEditorChange={onChange}
|
|
616
633
|
{...textEditorParams}
|
|
617
|
-
{...restProps
|
|
634
|
+
{...restProps}
|
|
618
635
|
/>
|
|
619
636
|
{:else}
|
|
620
637
|
<input
|
|
@@ -654,11 +671,11 @@
|
|
|
654
671
|
tabIndex={tabindex}
|
|
655
672
|
data-error-message={errorMessageForce ? undefined : errorMessage}
|
|
656
673
|
class={inputClassName}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
674
|
+
onfocus={onFocus}
|
|
675
|
+
onblur={onBlur}
|
|
676
|
+
oninput={onInput}
|
|
677
|
+
onchange={onChange}
|
|
661
678
|
value={type === 'datepicker' || type === 'colorpicker' || type === 'file' ? '' : inputValue}
|
|
662
|
-
{...restProps
|
|
679
|
+
{...restProps}
|
|
663
680
|
/>
|
|
664
681
|
{/if}
|