@xenknight/framework7-vue 0.0.2
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/LICENSE +20 -0
- package/README.md +33 -0
- package/components/accordion-content.d.ts +46 -0
- package/components/accordion-content.js +22 -0
- package/components/accordion-item.d.ts +51 -0
- package/components/accordion-item.js +77 -0
- package/components/accordion-toggle.d.ts +46 -0
- package/components/accordion-toggle.js +22 -0
- package/components/accordion.d.ts +50 -0
- package/components/accordion.js +23 -0
- package/components/actions-button.d.ts +56 -0
- package/components/actions-button.js +58 -0
- package/components/actions-group.d.ts +46 -0
- package/components/actions-group.js +22 -0
- package/components/actions-label.d.ts +51 -0
- package/components/actions-label.js +36 -0
- package/components/actions.d.ts +109 -0
- package/components/actions.js +157 -0
- package/components/app.d.ts +310 -0
- package/components/app.js +267 -0
- package/components/area-chart.d.ts +88 -0
- package/components/area-chart.js +364 -0
- package/components/badge.d.ts +54 -0
- package/components/badge.js +29 -0
- package/components/block-footer.d.ts +46 -0
- package/components/block-footer.js +22 -0
- package/components/block-header.d.ts +46 -0
- package/components/block-header.js +22 -0
- package/components/block-title.d.ts +54 -0
- package/components/block-title.js +35 -0
- package/components/block.d.ts +163 -0
- package/components/block.js +123 -0
- package/components/breadcrumbs-collapsed.d.ts +19 -0
- package/components/breadcrumbs-collapsed.js +21 -0
- package/components/breadcrumbs-item.d.ts +22 -0
- package/components/breadcrumbs-item.js +24 -0
- package/components/breadcrumbs-separator.d.ts +19 -0
- package/components/breadcrumbs-separator.js +20 -0
- package/components/breadcrumbs.d.ts +19 -0
- package/components/breadcrumbs.js +20 -0
- package/components/button.d.ts +371 -0
- package/components/button.js +182 -0
- package/components/card-content.d.ts +51 -0
- package/components/card-content.js +28 -0
- package/components/card-footer.d.ts +46 -0
- package/components/card-footer.js +22 -0
- package/components/card-header.d.ts +46 -0
- package/components/card-header.js +22 -0
- package/components/card.d.ts +145 -0
- package/components/card.js +192 -0
- package/components/checkbox.d.ts +72 -0
- package/components/checkbox.js +70 -0
- package/components/chip.d.ts +107 -0
- package/components/chip.js +81 -0
- package/components/fab-backdrop.d.ts +46 -0
- package/components/fab-backdrop.js +22 -0
- package/components/fab-button.d.ts +67 -0
- package/components/fab-button.js +52 -0
- package/components/fab-buttons.d.ts +51 -0
- package/components/fab-buttons.js +26 -0
- package/components/fab.d.ts +76 -0
- package/components/fab.js +78 -0
- package/components/gauge.d.ts +91 -0
- package/components/gauge.js +151 -0
- package/components/icon.d.ts +78 -0
- package/components/icon.js +100 -0
- package/components/input.d.ts +226 -0
- package/components/input.js +409 -0
- package/components/link.d.ts +287 -0
- package/components/link.js +129 -0
- package/components/list-button.d.ts +239 -0
- package/components/list-button.js +71 -0
- package/components/list-group.d.ts +71 -0
- package/components/list-group.js +53 -0
- package/components/list-index.d.ts +81 -0
- package/components/list-index.js +96 -0
- package/components/list-input.d.ts +245 -0
- package/components/list-input.js +415 -0
- package/components/list-item.d.ts +370 -0
- package/components/list-item.js +451 -0
- package/components/list.d.ts +236 -0
- package/components/list.js +222 -0
- package/components/login-screen-title.d.ts +46 -0
- package/components/login-screen-title.js +22 -0
- package/components/login-screen.d.ts +61 -0
- package/components/login-screen.js +104 -0
- package/components/message.d.ts +116 -0
- package/components/message.js +169 -0
- package/components/messagebar-attachment.d.ts +56 -0
- package/components/messagebar-attachment.js +52 -0
- package/components/messagebar-attachments.d.ts +46 -0
- package/components/messagebar-attachments.js +22 -0
- package/components/messagebar-sheet-image.d.ts +55 -0
- package/components/messagebar-sheet-image.js +48 -0
- package/components/messagebar-sheet-item.d.ts +46 -0
- package/components/messagebar-sheet-item.js +22 -0
- package/components/messagebar-sheet.d.ts +46 -0
- package/components/messagebar-sheet.js +22 -0
- package/components/messagebar.d.ts +117 -0
- package/components/messagebar.js +193 -0
- package/components/messages-title.d.ts +46 -0
- package/components/messages-title.js +22 -0
- package/components/messages.d.ts +116 -0
- package/components/messages.js +134 -0
- package/components/nav-left.d.ts +68 -0
- package/components/nav-left.js +66 -0
- package/components/nav-right.d.ts +50 -0
- package/components/nav-right.js +25 -0
- package/components/nav-title-large.d.ts +46 -0
- package/components/nav-title-large.js +25 -0
- package/components/nav-title.d.ts +58 -0
- package/components/nav-title.js +31 -0
- package/components/navbar.d.ts +110 -0
- package/components/navbar.js +248 -0
- package/components/page-content.d.ts +113 -0
- package/components/page-content.js +147 -0
- package/components/page.d.ts +150 -0
- package/components/page.js +331 -0
- package/components/panel.d.ts +139 -0
- package/components/panel.js +198 -0
- package/components/photo-browser.d.ts +164 -0
- package/components/photo-browser.js +181 -0
- package/components/pie-chart.d.ts +37 -0
- package/components/pie-chart.js +172 -0
- package/components/popover.d.ts +101 -0
- package/components/popover.js +157 -0
- package/components/popup.d.ts +99 -0
- package/components/popup.js +161 -0
- package/components/preloader.d.ts +50 -0
- package/components/preloader.js +65 -0
- package/components/progressbar.d.ts +54 -0
- package/components/progressbar.js +44 -0
- package/components/radio.d.ts +68 -0
- package/components/radio.js +59 -0
- package/components/range.d.ts +141 -0
- package/components/range.js +139 -0
- package/components/routable-modals.d.ts +19 -0
- package/components/routable-modals.js +58 -0
- package/components/searchbar.d.ts +182 -0
- package/components/searchbar.js +285 -0
- package/components/segmented.d.ts +87 -0
- package/components/segmented.js +53 -0
- package/components/sheet.d.ts +132 -0
- package/components/sheet.js +213 -0
- package/components/skeleton-avatar.d.ts +6 -0
- package/components/skeleton-avatar.js +3 -0
- package/components/skeleton-block.d.ts +6 -0
- package/components/skeleton-block.js +3 -0
- package/components/skeleton-image.d.ts +6 -0
- package/components/skeleton-image.js +3 -0
- package/components/skeleton-text.d.ts +6 -0
- package/components/skeleton-text.js +3 -0
- package/components/stepper.d.ts +197 -0
- package/components/stepper.js +230 -0
- package/components/subnavbar.d.ts +59 -0
- package/components/subnavbar.js +40 -0
- package/components/swipeout-actions.d.ts +58 -0
- package/components/swipeout-actions.js +33 -0
- package/components/swipeout-button.d.ts +75 -0
- package/components/swipeout-button.js +48 -0
- package/components/tab.d.ts +51 -0
- package/components/tab.js +128 -0
- package/components/tabs.d.ts +63 -0
- package/components/tabs.js +59 -0
- package/components/text-editor.d.ts +95 -0
- package/components/text-editor.js +147 -0
- package/components/toggle.d.ts +80 -0
- package/components/toggle.js +89 -0
- package/components/toolbar.d.ts +108 -0
- package/components/toolbar.js +135 -0
- package/components/treeview-item.d.ts +265 -0
- package/components/treeview-item.js +140 -0
- package/components/treeview.d.ts +46 -0
- package/components/treeview.js +22 -0
- package/components/use-icon.d.ts +19 -0
- package/components/use-icon.js +27 -0
- package/components/view.d.ts +296 -0
- package/components/view.js +373 -0
- package/components/views.d.ts +50 -0
- package/components/views.js +25 -0
- package/framework7-vue-bundle.js +190 -0
- package/framework7-vue.d.ts +121 -0
- package/framework7-vue.js +108 -0
- package/package.json +65 -0
- package/shared/components-router.js +203 -0
- package/shared/f7.js +71 -0
- package/shared/get-router-initial-component.js +35 -0
- package/shared/mixins.js +233 -0
- package/shared/modal-state-classes.js +10 -0
- package/shared/plugin.js +37 -0
- package/shared/router-open-in.js +105 -0
- package/shared/use-icon.js +37 -0
- package/shared/use-route-props.js +18 -0
- package/shared/use-smart-select.js +24 -0
- package/shared/use-store.js +24 -0
- package/shared/use-tab.js +24 -0
- package/shared/use-theme.js +11 -0
- package/shared/use-tooltip.js +43 -0
- package/shared/utils.js +110 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { computed, ref, onMounted, onBeforeUnmount, h, watch, onUpdated } from 'vue';
|
|
2
|
+
import { classNames, extend, noUndefinedProps } from '../shared/utils.js';
|
|
3
|
+
import { colorClasses, colorProps } from '../shared/mixins.js';
|
|
4
|
+
import { f7ready, f7 } from '../shared/f7.js';
|
|
5
|
+
import f7Toggle from './toggle.js';
|
|
6
|
+
import f7Range from './range.js';
|
|
7
|
+
import f7TextEditor from './text-editor.js';
|
|
8
|
+
export default {
|
|
9
|
+
name: 'f7-input',
|
|
10
|
+
props: {
|
|
11
|
+
type: String,
|
|
12
|
+
name: String,
|
|
13
|
+
value: {
|
|
14
|
+
type: [String, Number, Array, Date, Object],
|
|
15
|
+
default: undefined
|
|
16
|
+
},
|
|
17
|
+
inputmode: String,
|
|
18
|
+
placeholder: String,
|
|
19
|
+
inputId: [String, Number],
|
|
20
|
+
size: [String, Number],
|
|
21
|
+
accept: [String, Number],
|
|
22
|
+
autocomplete: [String],
|
|
23
|
+
autocorrect: [String],
|
|
24
|
+
autocapitalize: [String],
|
|
25
|
+
spellcheck: [String],
|
|
26
|
+
autofocus: Boolean,
|
|
27
|
+
autosave: String,
|
|
28
|
+
checked: Boolean,
|
|
29
|
+
disabled: Boolean,
|
|
30
|
+
max: [String, Number],
|
|
31
|
+
min: [String, Number],
|
|
32
|
+
step: [String, Number],
|
|
33
|
+
maxlength: [String, Number],
|
|
34
|
+
minlength: [String, Number],
|
|
35
|
+
multiple: Boolean,
|
|
36
|
+
readonly: Boolean,
|
|
37
|
+
required: Boolean,
|
|
38
|
+
inputStyle: [String, Object],
|
|
39
|
+
pattern: String,
|
|
40
|
+
validate: [Boolean, String],
|
|
41
|
+
validateOnBlur: Boolean,
|
|
42
|
+
onValidate: Function,
|
|
43
|
+
tabindex: [String, Number],
|
|
44
|
+
resizable: Boolean,
|
|
45
|
+
clearButton: Boolean,
|
|
46
|
+
// Form
|
|
47
|
+
noFormStoreData: Boolean,
|
|
48
|
+
noStoreData: Boolean,
|
|
49
|
+
ignoreStoreData: Boolean,
|
|
50
|
+
// Error, Info
|
|
51
|
+
errorMessage: String,
|
|
52
|
+
errorMessageForce: Boolean,
|
|
53
|
+
info: String,
|
|
54
|
+
// Outline
|
|
55
|
+
outline: Boolean,
|
|
56
|
+
// Components
|
|
57
|
+
wrap: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: true
|
|
60
|
+
},
|
|
61
|
+
dropdown: {
|
|
62
|
+
type: [String, Boolean],
|
|
63
|
+
default: 'auto'
|
|
64
|
+
},
|
|
65
|
+
// Datepicker
|
|
66
|
+
calendarParams: Object,
|
|
67
|
+
// Colorpicker
|
|
68
|
+
colorPickerParams: Object,
|
|
69
|
+
// Text editor
|
|
70
|
+
textEditorParams: Object,
|
|
71
|
+
...colorProps
|
|
72
|
+
},
|
|
73
|
+
emits: ['input', 'focus', 'blur', 'change', 'textarea:resize', 'input:notempty', 'input:empty', 'input:clear', 'texteditor:change', 'calendar:change', 'colorpicker:change', 'update:value'],
|
|
74
|
+
setup(props, _ref) {
|
|
75
|
+
let {
|
|
76
|
+
emit,
|
|
77
|
+
slots
|
|
78
|
+
} = _ref;
|
|
79
|
+
let f7Calendar = null;
|
|
80
|
+
let f7ColorPicker = null;
|
|
81
|
+
const inputInvalid = ref(false);
|
|
82
|
+
const inputFocused = ref(false);
|
|
83
|
+
const elRef = ref(null);
|
|
84
|
+
const inputElRef = ref(null);
|
|
85
|
+
let updateInputOnDidUpdate = false;
|
|
86
|
+
const getDomValue = () => {
|
|
87
|
+
if (!inputElRef.value) return undefined;
|
|
88
|
+
return inputElRef.value.value;
|
|
89
|
+
};
|
|
90
|
+
const domValue = ref(getDomValue());
|
|
91
|
+
const inputHasValue = computed(() => {
|
|
92
|
+
if (props.type === 'datepicker' && Array.isArray(props.value) && props.value.length === 0) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
return typeof props.value === 'undefined' ? domValue.value || domValue.value === 0 : props.value || props.value === 0;
|
|
96
|
+
});
|
|
97
|
+
const validateInput = () => {
|
|
98
|
+
if (!f7 || !inputElRef.value) return;
|
|
99
|
+
const validity = inputElRef.value.validity;
|
|
100
|
+
if (!validity) return;
|
|
101
|
+
if (!validity.valid) {
|
|
102
|
+
if (props.onValidate) props.onValidate(false);
|
|
103
|
+
if (inputInvalid.value !== true) {
|
|
104
|
+
inputInvalid.value = true;
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
if (props.onValidate) props.onValidate(true);
|
|
108
|
+
if (inputInvalid.value !== false) {
|
|
109
|
+
inputInvalid.value = false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const onTextareaResize = event => {
|
|
114
|
+
emit('textarea:resize', event);
|
|
115
|
+
};
|
|
116
|
+
const onInputNotEmpty = event => {
|
|
117
|
+
emit('input:notempty', event);
|
|
118
|
+
};
|
|
119
|
+
const onInputEmpty = event => {
|
|
120
|
+
emit('input:empty', event);
|
|
121
|
+
};
|
|
122
|
+
const onInputClear = event => {
|
|
123
|
+
emit('input:clear', event);
|
|
124
|
+
};
|
|
125
|
+
const onInput = function () {
|
|
126
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
127
|
+
args[_key] = arguments[_key];
|
|
128
|
+
}
|
|
129
|
+
emit('input', ...args);
|
|
130
|
+
if (inputElRef.value) {
|
|
131
|
+
domValue.value = inputElRef.value.value;
|
|
132
|
+
}
|
|
133
|
+
if (!(props.validateOnBlur || props.validateOnBlur === '') && (props.validate || props.validate === '') && inputElRef.value) {
|
|
134
|
+
validateInput();
|
|
135
|
+
}
|
|
136
|
+
if (inputElRef.value && props.type !== 'texteditor' && props.type !== 'colorpicker' && props.type !== 'datepicker') {
|
|
137
|
+
emit('update:value', inputElRef.value.value);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const onFocus = function () {
|
|
141
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
142
|
+
args[_key2] = arguments[_key2];
|
|
143
|
+
}
|
|
144
|
+
emit('focus', ...args);
|
|
145
|
+
inputFocused.value = true;
|
|
146
|
+
};
|
|
147
|
+
const onBlur = function () {
|
|
148
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
149
|
+
args[_key3] = arguments[_key3];
|
|
150
|
+
}
|
|
151
|
+
emit('blur', ...args);
|
|
152
|
+
if ((props.validate || props.validate === '' || props.validateOnBlur || props.validateOnBlur === '') && inputElRef.value) {
|
|
153
|
+
validateInput();
|
|
154
|
+
}
|
|
155
|
+
inputFocused.value = false;
|
|
156
|
+
};
|
|
157
|
+
const onChange = function () {
|
|
158
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
159
|
+
args[_key4] = arguments[_key4];
|
|
160
|
+
}
|
|
161
|
+
emit('change', ...args);
|
|
162
|
+
if (props.type === 'texteditor') {
|
|
163
|
+
emit('texteditor:change', args[1]);
|
|
164
|
+
emit('update:value', args[1]);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
onMounted(() => {
|
|
168
|
+
const {
|
|
169
|
+
type,
|
|
170
|
+
resizable,
|
|
171
|
+
clearButton,
|
|
172
|
+
value,
|
|
173
|
+
calendarParams,
|
|
174
|
+
colorPickerParams,
|
|
175
|
+
validate,
|
|
176
|
+
validateOnBlur
|
|
177
|
+
} = props;
|
|
178
|
+
f7ready(() => {
|
|
179
|
+
if (type === 'range' || type === 'toggle') return;
|
|
180
|
+
if (!inputElRef.value) return;
|
|
181
|
+
inputElRef.value.addEventListener('input:notempty', onInputNotEmpty, false);
|
|
182
|
+
if (type === 'textarea' && resizable) {
|
|
183
|
+
inputElRef.value.addEventListener('textarea:resize', onTextareaResize, false);
|
|
184
|
+
}
|
|
185
|
+
if (clearButton) {
|
|
186
|
+
inputElRef.value.addEventListener('input:empty', onInputEmpty, false);
|
|
187
|
+
inputElRef.value.addEventListener('input:clear', onInputClear, false);
|
|
188
|
+
}
|
|
189
|
+
if (type === 'datepicker') {
|
|
190
|
+
f7Calendar = f7.calendar.create({
|
|
191
|
+
inputEl: inputElRef.value,
|
|
192
|
+
value,
|
|
193
|
+
on: {
|
|
194
|
+
change(calendar, calendarValue) {
|
|
195
|
+
emit('calendar:change', calendarValue);
|
|
196
|
+
emit('update:value', calendarValue);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
...(calendarParams || {})
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (type === 'colorpicker') {
|
|
203
|
+
f7ColorPicker = f7.colorPicker.create({
|
|
204
|
+
inputEl: inputElRef.value,
|
|
205
|
+
value,
|
|
206
|
+
on: {
|
|
207
|
+
change(colorPicker, colorPickerValue) {
|
|
208
|
+
emit('colorpicker:change', colorPickerValue);
|
|
209
|
+
emit('update:value', colorPickerValue);
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
...(colorPickerParams || {})
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
f7.input.checkEmptyState(inputElRef.value);
|
|
216
|
+
if (!(validateOnBlur || validateOnBlur === '') && (validate || validate === '') && typeof value !== 'undefined' && value !== null && value !== '') {
|
|
217
|
+
setTimeout(() => {
|
|
218
|
+
validateInput();
|
|
219
|
+
}, 0);
|
|
220
|
+
}
|
|
221
|
+
if (resizable) {
|
|
222
|
+
f7.input.resizeTextarea(inputElRef.value);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
onBeforeUnmount(() => {
|
|
227
|
+
if (props.type === 'range' || props.type === 'toggle') return;
|
|
228
|
+
if (!inputElRef.value) return;
|
|
229
|
+
inputElRef.value.removeEventListener('input:notempty', onInputNotEmpty, false);
|
|
230
|
+
if (props.type === 'textarea' && props.resizable) {
|
|
231
|
+
inputElRef.value.removeEventListener('textarea:resize', onTextareaResize, false);
|
|
232
|
+
}
|
|
233
|
+
if (props.clearButton) {
|
|
234
|
+
inputElRef.value.removeEventListener('input:empty', onInputEmpty, false);
|
|
235
|
+
inputElRef.value.removeEventListener('input:clear', onInputClear, false);
|
|
236
|
+
}
|
|
237
|
+
if (f7Calendar && f7Calendar.destroy) {
|
|
238
|
+
f7Calendar.destroy();
|
|
239
|
+
f7Calendar = null;
|
|
240
|
+
}
|
|
241
|
+
if (f7ColorPicker && f7ColorPicker.destroy) {
|
|
242
|
+
f7ColorPicker.destroy();
|
|
243
|
+
f7ColorPicker = null;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
onUpdated(() => {
|
|
247
|
+
if (!f7) return;
|
|
248
|
+
if (updateInputOnDidUpdate) {
|
|
249
|
+
if (!inputElRef.value) return;
|
|
250
|
+
updateInputOnDidUpdate = false;
|
|
251
|
+
f7.input.checkEmptyState(inputElRef.value);
|
|
252
|
+
if (props.validate && !props.validateOnBlur) {
|
|
253
|
+
validateInput();
|
|
254
|
+
}
|
|
255
|
+
if (props.resizable) {
|
|
256
|
+
f7.input.resizeTextarea(inputElRef.value);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
watch(() => props.colorPickerParams, newValue => {
|
|
261
|
+
if (!f7 || !f7ColorPicker) return;
|
|
262
|
+
extend(f7ColorPicker.params, newValue || {});
|
|
263
|
+
});
|
|
264
|
+
watch(() => props.calendarParams, newValue => {
|
|
265
|
+
if (!f7 || !f7Calendar) return;
|
|
266
|
+
extend(f7Calendar.params, newValue || {});
|
|
267
|
+
});
|
|
268
|
+
watch(() => props.value, newValue => {
|
|
269
|
+
if (props.type === 'range' || props.type === 'toggle' || !f7) return;
|
|
270
|
+
updateInputOnDidUpdate = true;
|
|
271
|
+
if (f7Calendar) {
|
|
272
|
+
f7Calendar.setValue(newValue);
|
|
273
|
+
}
|
|
274
|
+
if (f7ColorPicker) {
|
|
275
|
+
f7ColorPicker.setValue(newValue);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
const createInput = (InputTag, children) => {
|
|
279
|
+
const needsValue = props.type !== 'file' && props.type !== 'datepicker' && props.type !== 'colorpicker';
|
|
280
|
+
const needsType = InputTag === 'input';
|
|
281
|
+
let inputType = props.type;
|
|
282
|
+
if (inputType === 'datepicker' || inputType === 'colorpicker') {
|
|
283
|
+
inputType = 'text';
|
|
284
|
+
}
|
|
285
|
+
const inputClassName = classNames({
|
|
286
|
+
resizable: inputType === 'textarea' && props.resizable,
|
|
287
|
+
'no-store-data': props.noFormStoreData || props.noStoreData || props.ignoreStoreData,
|
|
288
|
+
'input-invalid': props.errorMessage && props.errorMessageForce || inputInvalid.value,
|
|
289
|
+
'input-with-value': inputHasValue.value,
|
|
290
|
+
'input-focused': inputFocused.value
|
|
291
|
+
});
|
|
292
|
+
let inputValue;
|
|
293
|
+
if (needsValue) {
|
|
294
|
+
if (typeof props.value !== 'undefined') inputValue = props.value;else inputValue = domValue.value;
|
|
295
|
+
}
|
|
296
|
+
const valueProps = {};
|
|
297
|
+
if (props.type !== 'datepicker' && props.type !== 'colorpicker') {
|
|
298
|
+
if ('value' in props) valueProps.value = inputValue;
|
|
299
|
+
}
|
|
300
|
+
const inputProps = noUndefinedProps({
|
|
301
|
+
name: props.name,
|
|
302
|
+
type: needsType ? inputType : undefined,
|
|
303
|
+
placeholder: props.placeholder,
|
|
304
|
+
inputmode: props.inputmode,
|
|
305
|
+
id: props.inputId,
|
|
306
|
+
size: props.size,
|
|
307
|
+
accept: props.accept,
|
|
308
|
+
autocomplete: props.autocomplete,
|
|
309
|
+
autoCorrect: props.autocorrect,
|
|
310
|
+
autocapitalize: props.autocapitalize,
|
|
311
|
+
spellcheck: props.spellcheck,
|
|
312
|
+
autofocus: props.autofocus,
|
|
313
|
+
autoSave: props.autosave,
|
|
314
|
+
checked: props.checked,
|
|
315
|
+
disabled: props.disabled,
|
|
316
|
+
max: props.max,
|
|
317
|
+
maxlength: props.maxlength,
|
|
318
|
+
min: props.min,
|
|
319
|
+
minlength: props.minlength,
|
|
320
|
+
step: props.step,
|
|
321
|
+
multiple: props.multiple,
|
|
322
|
+
readonly: props.readonly,
|
|
323
|
+
required: props.required,
|
|
324
|
+
pattern: props.pattern,
|
|
325
|
+
validate: typeof props.validate === 'string' && props.validate.length ? props.validate : undefined,
|
|
326
|
+
tabindex: props.tabindex
|
|
327
|
+
});
|
|
328
|
+
return h(InputTag, {
|
|
329
|
+
ref: inputElRef,
|
|
330
|
+
style: props.inputStyle,
|
|
331
|
+
...inputProps,
|
|
332
|
+
'data-validate': props.validate === true || props.validate === '' || props.validateOnBlur === true || props.validateOnBlur === '' ? true : undefined,
|
|
333
|
+
'data-validate-on-blur': props.validateOnBlur === true || props.validateOnBlur === '' ? true : undefined,
|
|
334
|
+
'data-error-message': props.errorMessageForce ? undefined : props.errorMessage,
|
|
335
|
+
class: inputClassName,
|
|
336
|
+
onFocus,
|
|
337
|
+
onBlur,
|
|
338
|
+
onInput,
|
|
339
|
+
onChange,
|
|
340
|
+
...valueProps
|
|
341
|
+
}, [children]);
|
|
342
|
+
};
|
|
343
|
+
const wrapClasses = computed(() => classNames('input', {
|
|
344
|
+
'input-outline': props.outline,
|
|
345
|
+
'input-dropdown': props.dropdown === 'auto' ? props.type === 'select' : props.dropdown,
|
|
346
|
+
'input-invalid': props.errorMessage && props.errorMessageForce || inputInvalid.value
|
|
347
|
+
}, colorClasses(props)));
|
|
348
|
+
return () => {
|
|
349
|
+
let inputEl;
|
|
350
|
+
if (props.type === 'select' || props.type === 'textarea' || props.type === 'file') {
|
|
351
|
+
if (props.type === 'select') {
|
|
352
|
+
inputEl = createInput('select', slots.default && slots.default());
|
|
353
|
+
} else if (props.type === 'file') {
|
|
354
|
+
inputEl = createInput('input');
|
|
355
|
+
} else {
|
|
356
|
+
inputEl = createInput('textarea');
|
|
357
|
+
}
|
|
358
|
+
} else if (slots.default || !props.type) {
|
|
359
|
+
inputEl = slots.default();
|
|
360
|
+
} else if (props.type === 'toggle') {
|
|
361
|
+
inputEl = h(f7Toggle, {
|
|
362
|
+
checked: props.checked,
|
|
363
|
+
readonly: props.readonly,
|
|
364
|
+
name: props.name,
|
|
365
|
+
value: props.value,
|
|
366
|
+
disabled: props.disabled,
|
|
367
|
+
id: props.inputId,
|
|
368
|
+
onChange
|
|
369
|
+
});
|
|
370
|
+
} else if (props.type === 'range') {
|
|
371
|
+
inputEl = h(f7Range, {
|
|
372
|
+
value: props.value,
|
|
373
|
+
disabled: props.disabled,
|
|
374
|
+
min: props.min,
|
|
375
|
+
max: props.max,
|
|
376
|
+
step: props.step,
|
|
377
|
+
name: props.name,
|
|
378
|
+
id: props.inputId,
|
|
379
|
+
input: true,
|
|
380
|
+
onRangeChange: onChange
|
|
381
|
+
});
|
|
382
|
+
} else if (props.type === 'texteditor') {
|
|
383
|
+
inputEl = h(f7TextEditor, {
|
|
384
|
+
value: props.value,
|
|
385
|
+
resizable: props.resizable,
|
|
386
|
+
placeholder: props.placeholder,
|
|
387
|
+
onTextEditorFocus: onFocus,
|
|
388
|
+
onTextEditorBlur: onBlur,
|
|
389
|
+
onTextEditorInput: onInput,
|
|
390
|
+
onTextEditorChange: onChange,
|
|
391
|
+
...(props.textEditorParams || {})
|
|
392
|
+
});
|
|
393
|
+
} else {
|
|
394
|
+
inputEl = createInput('input');
|
|
395
|
+
}
|
|
396
|
+
if (!props.wrap) return inputEl;
|
|
397
|
+
return h('div', {
|
|
398
|
+
class: wrapClasses.value,
|
|
399
|
+
ref: elRef
|
|
400
|
+
}, [inputEl, (props.errorMessage || slots['error-message']) && props.errorMessageForce && h('div', {
|
|
401
|
+
class: 'input-error-message'
|
|
402
|
+
}, [props.errorMessage, slots['error-message'] && slots['error-message']()]), props.clearButton && h('span', {
|
|
403
|
+
class: 'input-clear-button'
|
|
404
|
+
}), (props.info || slots.info) && h('div', {
|
|
405
|
+
class: 'input-info'
|
|
406
|
+
}, [props.info, slots.info && slots.info()])]);
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
|
|
2
|
+
import { ComponentOptionsMixin, DefineComponent, PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
declare const Link: DefineComponent<
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
noLinkClass: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
text: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
tabLink: {
|
|
17
|
+
type: BooleanConstructor | StringConstructor;
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
tabLinkActive: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
tabbarLabel: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
iconOnly: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
badge: {
|
|
33
|
+
type: StringConstructor | NumberConstructor;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
badgeColor: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
target: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
tooltip: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
tooltipTrigger: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
smartSelect: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
smartSelectParams: {
|
|
57
|
+
type: ObjectConstructor;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
href: {
|
|
61
|
+
type: StringConstructor | BooleanConstructor;
|
|
62
|
+
default: string;
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
icon: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
iconMaterial: {
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
iconF7: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
iconIos: {
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
iconMd: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
iconColor: {
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
iconSize: {
|
|
90
|
+
type: StringConstructor | NumberConstructor;
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
color: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
colorTheme: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
textColor: {
|
|
102
|
+
type: StringConstructor;
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
bgColor: {
|
|
106
|
+
type: StringConstructor;
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
borderColor: {
|
|
110
|
+
type: StringConstructor;
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
rippleColor: {
|
|
114
|
+
type: StringConstructor;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
dark: {
|
|
118
|
+
type: BooleanConstructor;
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
searchbarEnable: {
|
|
122
|
+
type: BooleanConstructor | StringConstructor;
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
searchbarDisable: {
|
|
126
|
+
type: BooleanConstructor | StringConstructor;
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
searchbarClear: {
|
|
130
|
+
type: BooleanConstructor | StringConstructor;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
searchbarToggle: {
|
|
134
|
+
type: BooleanConstructor | StringConstructor;
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
panelOpen: {
|
|
138
|
+
type: BooleanConstructor | StringConstructor;
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
panelClose: {
|
|
142
|
+
type: BooleanConstructor | StringConstructor;
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
panelToggle: {
|
|
146
|
+
type: BooleanConstructor | StringConstructor;
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
popupOpen: {
|
|
150
|
+
type: BooleanConstructor | StringConstructor;
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
popupClose: {
|
|
154
|
+
type: BooleanConstructor | StringConstructor;
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
actionsOpen: {
|
|
158
|
+
type: BooleanConstructor | StringConstructor;
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
actionsClose: {
|
|
162
|
+
type: BooleanConstructor | StringConstructor;
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
popoverOpen: {
|
|
166
|
+
type: BooleanConstructor | StringConstructor;
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
popoverClose: {
|
|
170
|
+
type: BooleanConstructor | StringConstructor;
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
loginScreenOpen: {
|
|
174
|
+
type: BooleanConstructor | StringConstructor;
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
loginScreenClose: {
|
|
178
|
+
type: BooleanConstructor | StringConstructor;
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
sheetOpen: {
|
|
182
|
+
type: BooleanConstructor | StringConstructor;
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
sheetClose: {
|
|
186
|
+
type: BooleanConstructor | StringConstructor;
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
sortableEnable: {
|
|
190
|
+
type: BooleanConstructor | StringConstructor;
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
sortableDisable: {
|
|
194
|
+
type: BooleanConstructor | StringConstructor;
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
sortableToggle: {
|
|
198
|
+
type: BooleanConstructor | StringConstructor;
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
cardOpen: {
|
|
202
|
+
type: BooleanConstructor | StringConstructor;
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
cardPreventOpen: {
|
|
206
|
+
type: BooleanConstructor | StringConstructor;
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
cardClose: {
|
|
210
|
+
type: BooleanConstructor | StringConstructor;
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
menuClose: {
|
|
214
|
+
type: BooleanConstructor | StringConstructor;
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
back: {
|
|
218
|
+
type: BooleanConstructor;
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
external: {
|
|
222
|
+
type: BooleanConstructor;
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
force: {
|
|
226
|
+
type: BooleanConstructor;
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
animate: {
|
|
230
|
+
type: BooleanConstructor;
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
ignoreCache: {
|
|
234
|
+
type: BooleanConstructor;
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
reloadCurrent: {
|
|
238
|
+
type: BooleanConstructor;
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
reloadAll: {
|
|
242
|
+
type: BooleanConstructor;
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
reloadPrevious: {
|
|
246
|
+
type: BooleanConstructor;
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
reloadDetail: {
|
|
250
|
+
type: BooleanConstructor;
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
routeTabId: {
|
|
254
|
+
type: StringConstructor;
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
view: {
|
|
258
|
+
type: StringConstructor;
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
routeProps: {
|
|
262
|
+
type: ObjectConstructor;
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
preventRouter: {
|
|
266
|
+
type: BooleanConstructor;
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
transition: {
|
|
270
|
+
type: StringConstructor;
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
openIn: {
|
|
274
|
+
type: StringConstructor;
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
() => JSX.Element,
|
|
278
|
+
unknown,
|
|
279
|
+
{},
|
|
280
|
+
{},
|
|
281
|
+
ComponentOptionsMixin,
|
|
282
|
+
ComponentOptionsMixin,
|
|
283
|
+
|
|
284
|
+
>;
|
|
285
|
+
|
|
286
|
+
export default Link;
|
|
287
|
+
|