@touchvue/ui 0.0.1-alpha.2 → 1.0.0-beta.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/package.json +82 -34
- package/README.md +0 -70
- package/es/components/article/index.js +0 -66
- package/es/components/article/index.js.map +0 -1
- package/es/components/box/index.js +0 -98
- package/es/components/box/index.js.map +0 -1
- package/es/components/button/index.js +0 -96
- package/es/components/button/index.js.map +0 -1
- package/es/components/calendar/index.js +0 -44
- package/es/components/calendar/index.js.map +0 -1
- package/es/components/card/index.js +0 -290
- package/es/components/card/index.js.map +0 -1
- package/es/components/checkbox/index.js +0 -97
- package/es/components/checkbox/index.js.map +0 -1
- package/es/components/datepicker/index.js +0 -44
- package/es/components/datepicker/index.js.map +0 -1
- package/es/components/form/index.js +0 -303
- package/es/components/form/index.js.map +0 -1
- package/es/components/grid/index.js +0 -253
- package/es/components/grid/index.js.map +0 -1
- package/es/components/header/index.js +0 -233
- package/es/components/header/index.js.map +0 -1
- package/es/components/icon/index.js +0 -98
- package/es/components/icon/index.js.map +0 -1
- package/es/components/input/index.js +0 -436
- package/es/components/input/index.js.map +0 -1
- package/es/components/line/index.js +0 -100
- package/es/components/line/index.js.map +0 -1
- package/es/components/msg/index.js +0 -322
- package/es/components/msg/index.js.map +0 -1
- package/es/components/padding/index.js +0 -92
- package/es/components/padding/index.js.map +0 -1
- package/es/components/page/index.js +0 -334
- package/es/components/page/index.js.map +0 -1
- package/es/components/select/index.js +0 -218
- package/es/components/select/index.js.map +0 -1
- package/es/components/space/index.js +0 -88
- package/es/components/space/index.js.map +0 -1
- package/es/components/step/index.js +0 -127
- package/es/components/step/index.js.map +0 -1
- package/es/components/switch/index.js +0 -120
- package/es/components/switch/index.js.map +0 -1
- package/es/components/tab/index.js +0 -227
- package/es/components/tab/index.js.map +0 -1
- package/es/components/table/index.js +0 -893
- package/es/components/table/index.js.map +0 -1
- package/es/directives/dis/index.js +0 -32
- package/es/directives/dis/index.js.map +0 -1
- package/es/directives/size/index.js +0 -23
- package/es/directives/size/index.js.map +0 -1
- package/es/hooks/index.js +0 -2
- package/es/hooks/index.js.map +0 -1
- package/es/index.js +0 -4209
- package/es/index.js.map +0 -1
- package/es/utils/index.js +0 -90
- package/es/utils/index.js.map +0 -1
- package/lib/components/article/index.js +0 -70
- package/lib/components/article/index.js.map +0 -1
- package/lib/components/box/index.js +0 -102
- package/lib/components/box/index.js.map +0 -1
- package/lib/components/button/index.js +0 -98
- package/lib/components/button/index.js.map +0 -1
- package/lib/components/calendar/index.js +0 -46
- package/lib/components/calendar/index.js.map +0 -1
- package/lib/components/card/index.js +0 -292
- package/lib/components/card/index.js.map +0 -1
- package/lib/components/checkbox/index.js +0 -99
- package/lib/components/checkbox/index.js.map +0 -1
- package/lib/components/datepicker/index.js +0 -46
- package/lib/components/datepicker/index.js.map +0 -1
- package/lib/components/form/index.js +0 -306
- package/lib/components/form/index.js.map +0 -1
- package/lib/components/grid/index.js +0 -256
- package/lib/components/grid/index.js.map +0 -1
- package/lib/components/header/index.js +0 -235
- package/lib/components/header/index.js.map +0 -1
- package/lib/components/icon/index.js +0 -101
- package/lib/components/icon/index.js.map +0 -1
- package/lib/components/input/index.js +0 -438
- package/lib/components/input/index.js.map +0 -1
- package/lib/components/line/index.js +0 -102
- package/lib/components/line/index.js.map +0 -1
- package/lib/components/msg/index.js +0 -324
- package/lib/components/msg/index.js.map +0 -1
- package/lib/components/padding/index.js +0 -94
- package/lib/components/padding/index.js.map +0 -1
- package/lib/components/page/index.js +0 -336
- package/lib/components/page/index.js.map +0 -1
- package/lib/components/select/index.js +0 -220
- package/lib/components/select/index.js.map +0 -1
- package/lib/components/space/index.js +0 -90
- package/lib/components/space/index.js.map +0 -1
- package/lib/components/step/index.js +0 -129
- package/lib/components/step/index.js.map +0 -1
- package/lib/components/switch/index.js +0 -122
- package/lib/components/switch/index.js.map +0 -1
- package/lib/components/tab/index.js +0 -230
- package/lib/components/tab/index.js.map +0 -1
- package/lib/components/table/index.js +0 -898
- package/lib/components/table/index.js.map +0 -1
- package/lib/directives/dis/index.js +0 -34
- package/lib/directives/dis/index.js.map +0 -1
- package/lib/directives/size/index.js +0 -25
- package/lib/directives/size/index.js.map +0 -1
- package/lib/hooks/index.js +0 -3
- package/lib/hooks/index.js.map +0 -1
- package/lib/index.js +0 -4251
- package/lib/index.js.map +0 -1
- package/lib/utils/index.js +0 -99
- package/lib/utils/index.js.map +0 -1
- package/theme/components/article/index.css +0 -1
- package/theme/components/box/index.css +0 -1
- package/theme/components/button/index.css +0 -1
- package/theme/components/calendar/index.css +0 -0
- package/theme/components/card/index.css +0 -1
- package/theme/components/checkbox/index.css +0 -1
- package/theme/components/datepicker/index.css +0 -0
- package/theme/components/form/index.css +0 -1
- package/theme/components/grid/index.css +0 -1
- package/theme/components/header/index.css +0 -1
- package/theme/components/icon/index.css +0 -1
- package/theme/components/input/index.css +0 -1
- package/theme/components/line/index.css +0 -1
- package/theme/components/msg/index.css +0 -1
- package/theme/components/padding/index.css +0 -1
- package/theme/components/space/index.css +0 -1
- package/theme/components/step/index.css +0 -1
- package/theme/components/switch/index.css +0 -1
- package/theme/components/tab/index.css +0 -1
- package/theme/components/table/index.css +0 -1
- package/theme/img/default.png +0 -0
- package/theme/img/icon-type-fill.ttf +0 -0
- package/theme/img/icon.ttf +0 -0
- package/theme/img/loading-in.png +0 -0
- package/theme/img/loading-out.png +0 -0
- package/theme/img/msg/error-bg.png +0 -0
- package/theme/img/msg/error-icon.png +0 -0
- package/theme/img/msg/success-bg.png +0 -0
- package/theme/img/msg/success-icon.png +0 -0
- package/theme/index.css +0 -1
- package/theme/skin/default.css +0 -1
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createCommentVNode, renderSlot, toDisplayString, createBlock, withDirectives, vModelText, createTextVNode, vModelDynamic, withModifiers, vShow, Fragment, renderList, withCtx } from 'vue';
|
|
2
|
-
|
|
3
|
-
const _hoisted_1 = {
|
|
4
|
-
key: 0,
|
|
5
|
-
class: "to-input-prefix"
|
|
6
|
-
};
|
|
7
|
-
const _hoisted_2 = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "to-input-text"
|
|
10
|
-
};
|
|
11
|
-
const _hoisted_3 = ["autocomplete", "maxlength", "placeholder", "readonly", "tabindex"];
|
|
12
|
-
const _hoisted_4 = {
|
|
13
|
-
key: 2,
|
|
14
|
-
class: "to-input-html"
|
|
15
|
-
};
|
|
16
|
-
const _hoisted_5 = ["autocomplete", "tabindex", "maxlength", "placeholder", "type", "readonly"];
|
|
17
|
-
const _hoisted_6 = {
|
|
18
|
-
key: 4,
|
|
19
|
-
class: "to-input-suffix"
|
|
20
|
-
};
|
|
21
|
-
const _hoisted_7 = {
|
|
22
|
-
key: 2,
|
|
23
|
-
class: "to-input-text"
|
|
24
|
-
};
|
|
25
|
-
const _hoisted_8 = {
|
|
26
|
-
key: 3,
|
|
27
|
-
class: "to-input-suggestion"
|
|
28
|
-
};
|
|
29
|
-
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
30
|
-
...{
|
|
31
|
-
name: "ToInput"
|
|
32
|
-
},
|
|
33
|
-
__name: "input",
|
|
34
|
-
props: {
|
|
35
|
-
id: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: ""
|
|
38
|
-
},
|
|
39
|
-
placeholder: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: "\u8BF7\u8F93\u5165"
|
|
42
|
-
},
|
|
43
|
-
type: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: "text"
|
|
46
|
-
},
|
|
47
|
-
tabindex: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: "1"
|
|
50
|
-
},
|
|
51
|
-
autocomplete: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
readonly: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: false
|
|
58
|
-
},
|
|
59
|
-
max: {
|
|
60
|
-
type: [String, Number],
|
|
61
|
-
default: Infinity
|
|
62
|
-
},
|
|
63
|
-
min: {
|
|
64
|
-
type: [String, Number],
|
|
65
|
-
default: -Infinity
|
|
66
|
-
},
|
|
67
|
-
maxlength: {
|
|
68
|
-
type: [String, Number],
|
|
69
|
-
default: Infinity
|
|
70
|
-
},
|
|
71
|
-
dot: {
|
|
72
|
-
type: [String, Number],
|
|
73
|
-
default: 0
|
|
74
|
-
},
|
|
75
|
-
step: {
|
|
76
|
-
type: [String, Number],
|
|
77
|
-
default: null
|
|
78
|
-
},
|
|
79
|
-
stepIconMode: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: ""
|
|
82
|
-
},
|
|
83
|
-
spChars: {
|
|
84
|
-
type: [String, Boolean],
|
|
85
|
-
default: '/,\\,[,],{,},"'
|
|
86
|
-
},
|
|
87
|
-
prefix: {
|
|
88
|
-
type: String,
|
|
89
|
-
default: ""
|
|
90
|
-
},
|
|
91
|
-
suffix: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: ""
|
|
94
|
-
},
|
|
95
|
-
suggestion: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: ""
|
|
98
|
-
},
|
|
99
|
-
suggestionType: {
|
|
100
|
-
type: String,
|
|
101
|
-
default: ""
|
|
102
|
-
},
|
|
103
|
-
suggestionSymbol: {
|
|
104
|
-
type: String,
|
|
105
|
-
default: "\u3001"
|
|
106
|
-
},
|
|
107
|
-
clearable: {
|
|
108
|
-
type: Boolean,
|
|
109
|
-
default: false
|
|
110
|
-
},
|
|
111
|
-
preventFocus: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
default: false
|
|
114
|
-
},
|
|
115
|
-
comparable: {
|
|
116
|
-
type: Boolean,
|
|
117
|
-
default: false
|
|
118
|
-
},
|
|
119
|
-
modelValue: {
|
|
120
|
-
type: [String, Number],
|
|
121
|
-
default: () => ""
|
|
122
|
-
},
|
|
123
|
-
html: {
|
|
124
|
-
type: [String, Number],
|
|
125
|
-
default: ""
|
|
126
|
-
},
|
|
127
|
-
trim: {
|
|
128
|
-
type: Boolean,
|
|
129
|
-
default: true
|
|
130
|
-
},
|
|
131
|
-
fillet: {
|
|
132
|
-
type: String,
|
|
133
|
-
default: "normal"
|
|
134
|
-
},
|
|
135
|
-
filletPosition: {
|
|
136
|
-
type: String,
|
|
137
|
-
default: ""
|
|
138
|
-
},
|
|
139
|
-
color: {
|
|
140
|
-
type: String,
|
|
141
|
-
default: "default"
|
|
142
|
-
},
|
|
143
|
-
placeholderColor: {
|
|
144
|
-
type: String,
|
|
145
|
-
default: ""
|
|
146
|
-
},
|
|
147
|
-
mode: {
|
|
148
|
-
type: String,
|
|
149
|
-
default: ""
|
|
150
|
-
},
|
|
151
|
-
width: {
|
|
152
|
-
type: [Number, String],
|
|
153
|
-
default: ""
|
|
154
|
-
},
|
|
155
|
-
height: {
|
|
156
|
-
type: [Number, String],
|
|
157
|
-
default: ""
|
|
158
|
-
},
|
|
159
|
-
link: {
|
|
160
|
-
type: Boolean,
|
|
161
|
-
default: false
|
|
162
|
-
},
|
|
163
|
-
conversionType: {
|
|
164
|
-
type: [String, Number],
|
|
165
|
-
default: 0
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
emits: ["update:modelValue", "click", "clear"],
|
|
169
|
-
setup(__props, { emit: __emit }) {
|
|
170
|
-
const props = __props;
|
|
171
|
-
const emit = __emit;
|
|
172
|
-
const focused = ref(false);
|
|
173
|
-
const data = ref(props.modelValue);
|
|
174
|
-
const clearVisible = ref(false);
|
|
175
|
-
const itype = ref("text");
|
|
176
|
-
const disabled = computed(() => props.readonly);
|
|
177
|
-
watch(
|
|
178
|
-
() => props.modelValue,
|
|
179
|
-
(val) => {
|
|
180
|
-
data.value = val;
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
const iPlaceholder = computed(() => {
|
|
184
|
-
if (!disabled.value && !props.placeholder && props.placeholder !== "") {
|
|
185
|
-
return "\u8BF7\u586B\u5199";
|
|
186
|
-
} else {
|
|
187
|
-
return props.placeholder;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
const iconMode = computed(() => {
|
|
191
|
-
if (props.mode === "none" || props.mode === "line" || focused.value)
|
|
192
|
-
return "none";
|
|
193
|
-
if (props.mode === "fill")
|
|
194
|
-
return "fill";
|
|
195
|
-
return "plain";
|
|
196
|
-
});
|
|
197
|
-
const setClass = computed(() => {
|
|
198
|
-
const arr = [];
|
|
199
|
-
if (props.mode) {
|
|
200
|
-
arr.push(`mode-${props.mode}`);
|
|
201
|
-
}
|
|
202
|
-
if (props.type) {
|
|
203
|
-
arr.push(`type-${props.type}`);
|
|
204
|
-
}
|
|
205
|
-
if (props.readonly) {
|
|
206
|
-
arr.push(`is-readonly`);
|
|
207
|
-
}
|
|
208
|
-
return arr;
|
|
209
|
-
});
|
|
210
|
-
const setStyle = computed(() => {
|
|
211
|
-
const obj = {};
|
|
212
|
-
if (props.width) {
|
|
213
|
-
if (!isNaN(Number(props.width))) {
|
|
214
|
-
obj.width = props.width + "em";
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (props.height) {
|
|
218
|
-
if (!isNaN(Number(props.height))) {
|
|
219
|
-
obj.height = props.height + "em";
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return obj;
|
|
223
|
-
});
|
|
224
|
-
const inputRef = ref(null);
|
|
225
|
-
function inputKeyup() {
|
|
226
|
-
}
|
|
227
|
-
function inputChange() {
|
|
228
|
-
}
|
|
229
|
-
function inputKeydown() {
|
|
230
|
-
}
|
|
231
|
-
function inputCut() {
|
|
232
|
-
}
|
|
233
|
-
function inputFocus() {
|
|
234
|
-
focused.value = true;
|
|
235
|
-
}
|
|
236
|
-
function inputBlur() {
|
|
237
|
-
focused.value = false;
|
|
238
|
-
}
|
|
239
|
-
function inputPaste() {
|
|
240
|
-
}
|
|
241
|
-
function inputKeyPress() {
|
|
242
|
-
}
|
|
243
|
-
function inputInput() {
|
|
244
|
-
emit("update:modelValue", data.value);
|
|
245
|
-
}
|
|
246
|
-
function clear() {
|
|
247
|
-
data.value = "";
|
|
248
|
-
emit("clear");
|
|
249
|
-
}
|
|
250
|
-
function reduce() {
|
|
251
|
-
}
|
|
252
|
-
function increase() {
|
|
253
|
-
}
|
|
254
|
-
function addSuggestion(item) {
|
|
255
|
-
data.value += item;
|
|
256
|
-
}
|
|
257
|
-
function click() {
|
|
258
|
-
emit("click");
|
|
259
|
-
}
|
|
260
|
-
return (_ctx, _cache) => {
|
|
261
|
-
const _component_ToIcon = resolveComponent("ToIcon");
|
|
262
|
-
const _component_ToButton = resolveComponent("ToButton");
|
|
263
|
-
return openBlock(), createElementBlock(
|
|
264
|
-
"span",
|
|
265
|
-
{
|
|
266
|
-
class: normalizeClass(["to-input", setClass.value]),
|
|
267
|
-
style: normalizeStyle(setStyle.value),
|
|
268
|
-
onClick: click
|
|
269
|
-
},
|
|
270
|
-
[
|
|
271
|
-
createCommentVNode(" \u524D\u7F00 "),
|
|
272
|
-
props.prefix || _ctx.$slots.prefix || props.step ? (openBlock(), createElementBlock("span", _hoisted_1, [
|
|
273
|
-
renderSlot(_ctx.$slots, "prefix"),
|
|
274
|
-
props.prefix ? (openBlock(), createElementBlock(
|
|
275
|
-
"span",
|
|
276
|
-
_hoisted_2,
|
|
277
|
-
toDisplayString(props.prefix),
|
|
278
|
-
1
|
|
279
|
-
/* TEXT */
|
|
280
|
-
)) : createCommentVNode("v-if", true),
|
|
281
|
-
props.step ? (openBlock(), createBlock(_component_ToIcon, {
|
|
282
|
-
key: 1,
|
|
283
|
-
value: props.stepIconMode ? "unfold" : "reduce",
|
|
284
|
-
link: "",
|
|
285
|
-
color: "primary",
|
|
286
|
-
mode: "none",
|
|
287
|
-
disabled: Number(data.value) === Number(props.min) || props.readonly,
|
|
288
|
-
onMousedown: reduce
|
|
289
|
-
}, null, 8, ["value", "disabled"])) : createCommentVNode("v-if", true)
|
|
290
|
-
])) : createCommentVNode("v-if", true),
|
|
291
|
-
createCommentVNode(" \u8F93\u5165\u6846\u90E8\u5206 "),
|
|
292
|
-
props.type === "textarea" ? withDirectives((openBlock(), createElementBlock("textarea", {
|
|
293
|
-
key: 1,
|
|
294
|
-
ref_key: "inputRef",
|
|
295
|
-
ref: inputRef,
|
|
296
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => data.value = $event),
|
|
297
|
-
class: "to-input-textarea",
|
|
298
|
-
autocomplete: props.autocomplete ? "on" : "new-password",
|
|
299
|
-
maxlength: props.maxlength,
|
|
300
|
-
placeholder: iPlaceholder.value,
|
|
301
|
-
readonly: disabled.value,
|
|
302
|
-
tabindex: props.tabindex,
|
|
303
|
-
onKeyup: inputKeyup,
|
|
304
|
-
onKeydown: inputKeydown,
|
|
305
|
-
onCut: inputCut,
|
|
306
|
-
onFocus: inputFocus,
|
|
307
|
-
onBlur: inputBlur,
|
|
308
|
-
onPaste: inputPaste,
|
|
309
|
-
onKeypress: inputKeyPress
|
|
310
|
-
}, null, 40, _hoisted_3)), [
|
|
311
|
-
[vModelText, data.value]
|
|
312
|
-
]) : props.type === "html" ? (openBlock(), createElementBlock("span", _hoisted_4, [
|
|
313
|
-
createTextVNode(
|
|
314
|
-
toDisplayString(props.html) + " ",
|
|
315
|
-
1
|
|
316
|
-
/* TEXT */
|
|
317
|
-
),
|
|
318
|
-
renderSlot(_ctx.$slots, "html")
|
|
319
|
-
])) : withDirectives((openBlock(), createElementBlock("input", {
|
|
320
|
-
key: 3,
|
|
321
|
-
ref_key: "inputRef",
|
|
322
|
-
ref: inputRef,
|
|
323
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => data.value = $event),
|
|
324
|
-
class: "to-input-content",
|
|
325
|
-
autocomplete: props.autocomplete ? "on" : "new-password",
|
|
326
|
-
tabindex: props.tabindex,
|
|
327
|
-
maxlength: props.maxlength,
|
|
328
|
-
placeholder: iPlaceholder.value,
|
|
329
|
-
type: itype.value,
|
|
330
|
-
readonly: disabled.value,
|
|
331
|
-
onKeyup: inputKeyup,
|
|
332
|
-
onKeydown: inputKeydown,
|
|
333
|
-
onCut: inputCut,
|
|
334
|
-
onFocus: inputFocus,
|
|
335
|
-
onBlur: inputBlur,
|
|
336
|
-
onPaste: inputPaste,
|
|
337
|
-
onKeypress: inputKeyPress,
|
|
338
|
-
onChange: inputChange,
|
|
339
|
-
onInput: inputInput
|
|
340
|
-
}, null, 40, _hoisted_5)), [
|
|
341
|
-
[vModelDynamic, data.value]
|
|
342
|
-
]),
|
|
343
|
-
createCommentVNode(" \u540E\u7F00\u533A "),
|
|
344
|
-
props.clearable || props.suggestion || _ctx.$slots.default || _ctx.$slots.suffix || props.suffix || props.step ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
|
345
|
-
!props.readonly && props.clearable ? withDirectives((openBlock(), createBlock(_component_ToIcon, {
|
|
346
|
-
key: 0,
|
|
347
|
-
class: "to-input-clear",
|
|
348
|
-
mode: iconMode.value,
|
|
349
|
-
link: "",
|
|
350
|
-
value: "close",
|
|
351
|
-
onClick: withModifiers(clear, ["stop"])
|
|
352
|
-
}, null, 8, ["mode"])), [
|
|
353
|
-
[vShow, clearVisible.value]
|
|
354
|
-
]) : createCommentVNode("v-if", true),
|
|
355
|
-
props.step ? (openBlock(), createBlock(_component_ToIcon, {
|
|
356
|
-
key: 1,
|
|
357
|
-
value: props.stepIconMode ? "fold" : "add",
|
|
358
|
-
link: "",
|
|
359
|
-
disabled: Number(data.value) === Number(props.max) || props.readonly,
|
|
360
|
-
onMousedown: increase
|
|
361
|
-
}, null, 8, ["value", "disabled"])) : createCommentVNode("v-if", true),
|
|
362
|
-
props.suffix ? (openBlock(), createElementBlock(
|
|
363
|
-
"span",
|
|
364
|
-
_hoisted_7,
|
|
365
|
-
toDisplayString(props.suffix),
|
|
366
|
-
1
|
|
367
|
-
/* TEXT */
|
|
368
|
-
)) : createCommentVNode("v-if", true),
|
|
369
|
-
renderSlot(_ctx.$slots, "suffix"),
|
|
370
|
-
renderSlot(_ctx.$slots, "default"),
|
|
371
|
-
props.suggestion ? (openBlock(), createElementBlock("span", _hoisted_8, [
|
|
372
|
-
(openBlock(true), createElementBlock(
|
|
373
|
-
Fragment,
|
|
374
|
-
null,
|
|
375
|
-
renderList(props.suggestion.split(","), (item, i) => {
|
|
376
|
-
return openBlock(), createBlock(_component_ToButton, {
|
|
377
|
-
key: i,
|
|
378
|
-
fillet: true,
|
|
379
|
-
color: "info",
|
|
380
|
-
mode: "text",
|
|
381
|
-
onClick: ($event) => addSuggestion(item)
|
|
382
|
-
}, {
|
|
383
|
-
default: withCtx(() => [
|
|
384
|
-
createTextVNode(
|
|
385
|
-
toDisplayString(item),
|
|
386
|
-
1
|
|
387
|
-
/* TEXT */
|
|
388
|
-
)
|
|
389
|
-
]),
|
|
390
|
-
_: 2
|
|
391
|
-
/* DYNAMIC */
|
|
392
|
-
}, 1032, ["onClick"]);
|
|
393
|
-
}),
|
|
394
|
-
128
|
|
395
|
-
/* KEYED_FRAGMENT */
|
|
396
|
-
))
|
|
397
|
-
])) : createCommentVNode("v-if", true)
|
|
398
|
-
])) : createCommentVNode("v-if", true)
|
|
399
|
-
],
|
|
400
|
-
6
|
|
401
|
-
/* CLASS, STYLE */
|
|
402
|
-
);
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
var _export_sfc = (sfc, props) => {
|
|
408
|
-
const target = sfc.__vccOpts || sfc;
|
|
409
|
-
for (const [key, val] of props) {
|
|
410
|
-
target[key] = val;
|
|
411
|
-
}
|
|
412
|
-
return target;
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
var Input = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/wangding/WorkSpace/AsiaInfo/projects/\u524D\u7AEF\u6846\u67B6/touch-vue3-ui/packages/components/input/src/input.vue"]]);
|
|
416
|
-
|
|
417
|
-
const withInstall = (main, extra) => {
|
|
418
|
-
main.install = (app) => {
|
|
419
|
-
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
420
|
-
app.component(comp.name, comp);
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
if (extra) {
|
|
424
|
-
for (const [key, comp] of Object.entries(extra)) {
|
|
425
|
-
main[key] = comp;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return main;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
navigator.userAgent.toLowerCase();
|
|
432
|
-
|
|
433
|
-
const ToInput = withInstall(Input);
|
|
434
|
-
|
|
435
|
-
export { ToInput };
|
|
436
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../packages/components/input/src/input.vue","../../../../packages/utils/types.ts","../../../../packages/utils/ratio.ts","../../../../packages/components/input/index.ts"],"sourcesContent":["<template>\n <span class=\"to-input\" :class=\"setClass\" :style=\"setStyle\" @click=\"click\">\n <!-- 前缀 -->\n <span v-if=\"props.prefix || $slots.prefix || props.step\" class=\"to-input-prefix\">\n <slot name=\"prefix\" />\n <span v-if=\"props.prefix\" class=\"to-input-text\">{{ props.prefix }}</span>\n <ToIcon\n v-if=\"props.step\"\n :value=\"props.stepIconMode ? 'unfold' : 'reduce'\"\n link\n color=\"primary\"\n mode=\"none\"\n :disabled=\"Number(data) === Number(props.min) || props.readonly\"\n @mousedown=\"reduce\"\n />\n </span>\n\n <!-- 输入框部分 -->\n <textarea\n v-if=\"props.type === 'textarea'\"\n ref=\"inputRef\"\n v-model=\"data\"\n class=\"to-input-textarea\"\n :autocomplete=\"props.autocomplete ? 'on' : 'new-password'\"\n :maxlength=\"props.maxlength\"\n :placeholder=\"iPlaceholder\"\n :readonly=\"disabled\"\n :tabindex=\"props.tabindex\"\n @keyup=\"inputKeyup\"\n @keydown=\"inputKeydown\"\n @cut=\"inputCut\"\n @focus=\"inputFocus\"\n @blur=\"inputBlur\"\n @paste=\"inputPaste\"\n @keypress=\"inputKeyPress\"\n />\n\n <span v-else-if=\"props.type === 'html'\" class=\"to-input-html\"\n >{{ props.html }}\n <slot name=\"html\" />\n </span>\n\n <input\n v-else\n ref=\"inputRef\"\n v-model=\"data\"\n class=\"to-input-content\"\n :autocomplete=\"props.autocomplete ? 'on' : 'new-password'\"\n :tabindex=\"props.tabindex\"\n :maxlength=\"props.maxlength\"\n :placeholder=\"iPlaceholder\"\n :type=\"itype\"\n :readonly=\"disabled\"\n @keyup=\"inputKeyup\"\n @keydown=\"inputKeydown\"\n @cut=\"inputCut\"\n @focus=\"inputFocus\"\n @blur=\"inputBlur\"\n @paste=\"inputPaste\"\n @keypress=\"inputKeyPress\"\n @change=\"inputChange\"\n @input=\"inputInput\"\n />\n\n <!-- 后缀区 -->\n <span\n v-if=\"\n props.clearable ||\n props.suggestion ||\n $slots.default ||\n $slots.suffix ||\n props.suffix ||\n props.step\n \"\n class=\"to-input-suffix\"\n >\n <ToIcon\n v-if=\"!props.readonly && props.clearable\"\n v-show=\"clearVisible\"\n class=\"to-input-clear\"\n :mode=\"iconMode\"\n link\n value=\"close\"\n @click.stop=\"clear\"\n />\n <ToIcon\n v-if=\"props.step\"\n :value=\"props.stepIconMode ? 'fold' : 'add'\"\n link\n :disabled=\"Number(data) === Number(props.max) || props.readonly\"\n @mousedown=\"increase\"\n />\n <span v-if=\"props.suffix\" class=\"to-input-text\">{{ props.suffix }}</span>\n <slot name=\"suffix\" />\n <slot />\n <span v-if=\"props.suggestion\" class=\"to-input-suggestion\">\n <ToButton\n v-for=\"(item, i) in props.suggestion.split(',')\"\n :key=\"i\"\n :fillet=\"true\"\n color=\"info\"\n mode=\"text\"\n @click=\"addSuggestion(item)\"\n >{{ item }}</ToButton\n >\n </span>\n </span>\n </span>\n</template>\n<script lang=\"ts\" setup>\nimport { ref, computed, watch, CSSProperties } from 'vue';\ndefineOptions({\n name: 'ToInput',\n});\nconst props = defineProps({\n id: {\n type: String,\n default: '',\n },\n placeholder: {\n type: String,\n default: '请输入',\n },\n type: {\n type: String,\n default: 'text',\n },\n tabindex: {\n type: String,\n default: '1',\n },\n autocomplete: {\n type: Boolean,\n default: false,\n },\n readonly: {\n type: Boolean,\n default: false,\n },\n max: {\n type: [String, Number],\n default: Infinity,\n },\n min: {\n type: [String, Number],\n default: -Infinity,\n },\n maxlength: {\n type: [String, Number],\n default: Infinity,\n },\n dot: {\n type: [String, Number],\n default: 0,\n },\n step: {\n type: [String, Number],\n default: null,\n },\n stepIconMode: {\n type: String,\n default: '',\n },\n spChars: {\n type: [String, Boolean],\n default: '/,\\\\,[,],{,},\"',\n },\n prefix: {\n type: String,\n default: '',\n },\n suffix: {\n type: String,\n default: '',\n },\n suggestion: {\n type: String,\n default: '',\n },\n suggestionType: {\n type: String,\n default: '',\n },\n suggestionSymbol: {\n type: String,\n default: '、',\n },\n clearable: {\n type: Boolean,\n default: false,\n },\n preventFocus: {\n type: Boolean,\n default: false,\n },\n comparable: {\n type: Boolean,\n default: false,\n },\n modelValue: {\n type: [String, Number],\n default: () => '',\n },\n html: {\n type: [String, Number],\n default: '',\n },\n trim: {\n type: Boolean,\n default: true,\n },\n fillet: {\n type: String,\n default: 'normal',\n },\n filletPosition: {\n type: String,\n default: '',\n },\n color: {\n type: String,\n default: 'default',\n },\n placeholderColor: {\n type: String,\n default: '',\n },\n mode: {\n type: String,\n default: '',\n },\n width: {\n type: [Number, String],\n default: '',\n },\n height: {\n type: [Number, String],\n default: '',\n },\n link: {\n type: Boolean,\n default: false,\n },\n conversionType: {\n type: [String, Number],\n default: 0,\n },\n});\ninterface styleProps extends CSSProperties {\n width?: string | number;\n height?: string | number;\n}\nconst emit = defineEmits(['update:modelValue', 'click', 'clear']);\n// const errorTip = ref('')\n// const errorType = ref('rule')\n// const valueStore = ref([])\n// const prevent = ref(false)\n// const inited = ref(false)\nconst focused = ref(false);\nconst data = ref(props.modelValue);\nconst clearVisible = ref(false);\nconst itype = ref('text');\nconst disabled = computed(() => props.readonly);\n// const multipleNumber = ref(1)\n\nwatch(\n () => props.modelValue,\n val => {\n data.value = val;\n }\n);\n\nconst iPlaceholder = computed(() => {\n if (!disabled.value && !props.placeholder && props.placeholder !== '') {\n return '请填写';\n } else {\n return props.placeholder;\n }\n});\n\nconst iconMode = computed(() => {\n if (props.mode === 'none' || props.mode === 'line' || focused.value) return 'none';\n if (props.mode === 'fill') return 'fill';\n return 'plain';\n});\n\nconst setClass = computed(() => {\n const arr = [];\n if (props.mode) {\n arr.push(`mode-${props.mode}`);\n }\n if (props.type) {\n arr.push(`type-${props.type}`);\n }\n if (props.readonly) {\n arr.push(`is-readonly`);\n }\n return arr;\n});\n\nconst setStyle = computed(() => {\n const obj: styleProps = {};\n if (props.width) {\n if (!isNaN(Number(props.width))) {\n obj.width = props.width + 'em';\n }\n }\n if (props.height) {\n if (!isNaN(Number(props.height))) {\n obj.height = props.height + 'em';\n }\n }\n return obj;\n});\nconst inputRef = ref(null);\n\nfunction inputKeyup() {}\nfunction inputChange() {}\nfunction inputKeydown() {}\nfunction inputCut() {}\nfunction inputFocus() {\n focused.value = true;\n}\nfunction inputBlur() {\n focused.value = false;\n}\nfunction inputPaste() {}\nfunction inputKeyPress() {}\nfunction inputInput() {\n // emit('input', data.value)\n emit('update:modelValue', data.value);\n}\nfunction clear() {\n data.value = '';\n emit('clear');\n}\nfunction reduce() {}\nfunction increase() {}\nfunction addSuggestion(item: any) {\n data.value += item;\n}\n\nfunction click() {\n emit('click');\n}\n</script>\n","import type { App, Plugin } from 'vue';\n\n/* 生成install函数 */\n\nexport type SFCWithInstall<T> = T & Plugin;\n\nexport type SFCInstallWithContext<T> = SFCWithInstall<T> & {\n _context: App | null;\n};\n\nexport const withInstall = <T, E extends Record<string, any>>(main: T, extra?: E) => {\n (main as SFCWithInstall<T>).install = (app: App): void => {\n for (const comp of [main, ...Object.values(extra ?? {})]) {\n app.component(comp.name, comp);\n }\n };\n\n if (extra) {\n for (const [key, comp] of Object.entries(extra)) {\n (main as any)[key] = comp;\n }\n }\n return main as SFCWithInstall<T> & E;\n};\n\nexport const withInstallFunction = <T>(fn: T, name: string) => {\n (fn as SFCWithInstall<T>).install = (app: App) => {\n (fn as SFCInstallWithContext<T>)._context = app;\n app.config.globalProperties[name] = fn;\n };\n\n return fn as SFCInstallWithContext<T>;\n};\n","interface Options {\n ratio?: {\n base?: {\n pc?: number;\n pad?: number;\n phone?: number;\n };\n };\n}\n\nconst ua = navigator.userAgent.toLowerCase();\n\nexport function setRatio(options: Options = {}) {\n const ua = navigator.userAgent.toLowerCase();\n const base = options?.ratio?.base ?? {};\n\n const baseSize = /iphone|android.*mobile|windows phone|ipod/i.test(ua)\n ? (base.phone ?? 375)\n : /ipad|android(?!.*mobile)|tablet/i.test(ua)\n ? (base.pad ?? 1100)\n : (base.pc ?? 1366);\n\n const updateFontSize = () => {\n const width = window.innerWidth || document.documentElement.clientWidth;\n document.documentElement.style.fontSize = (width / baseSize) * 100 + 'px';\n };\n\n updateFontSize();\n window.addEventListener('resize', updateFontSize);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function getMedia(options: Options = {}) {\n const isMobile = /iphone|android.*mobile|windows phone|ipod/i.test(ua);\n const isTablet = /ipad|android(?!.*mobile)|tablet/i.test(ua);\n\n return isMobile ? 'phone' : isTablet ? 'pad' : 'pc';\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function setMedia(options: Options = {}) {\n const html = document.documentElement;\n const classList: string[] = [];\n\n // 判断操作系统\n if (/windows/i.test(ua)) {\n classList.push('os-windows');\n } else if (/macintosh|mac os x/i.test(ua)) {\n classList.push('os-macos');\n } else if (/android/i.test(ua)) {\n classList.push('os-android');\n } else if (/iphone|ipad|ipod/i.test(ua)) {\n classList.push('os-ios');\n }\n\n // 判断设备类型\n const media = getMedia();\n if (media === 'pad') {\n classList.push('media-pad');\n } else if (media === 'phone') {\n classList.push('media-phone');\n } else {\n classList.push('media-pc');\n }\n\n // 添加 class 到 <html>\n html.className += ' ' + classList.join(' ');\n}\n\nexport function getEm() {\n const el = document.createElement('div');\n el.style.width = '1em';\n el.style.height = '1em';\n el.style.position = 'absolute';\n document.body.appendChild(el);\n const size = el.getBoundingClientRect().height;\n document.body.removeChild(el);\n return size;\n}\n","import Input from './src/input.vue';\nimport { SFCWithInstall, withInstall } from '@touchvue/utils';\nexport const ToInput: SFCWithInstall<typeof Input> = withInstall(Input);\nexport * from './src/instance';\n"],"names":["_createElementBlock","_normalizeClass","_createCommentVNode","$slots","_openBlock","_renderSlot","_toDisplayString","_createBlock","_Fragment","_renderList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AA0Id,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AAMb,IAAM,MAAA,OAAA,GAAU,IAAI,KAAK,CAAA,CAAA;AACzB,IAAM,MAAA,IAAA,GAAO,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACjC,IAAM,MAAA,YAAA,GAAe,IAAI,KAAK,CAAA,CAAA;AAC9B,IAAM,MAAA,KAAA,GAAQ,IAAI,MAAM,CAAA,CAAA;AACxB,IAAA,MAAM,QAAW,GAAA,QAAA,CAAS,MAAM,KAAA,CAAM,QAAQ,CAAA,CAAA;AAG9C,IAAA,KAAA;AAAA,MACE,MAAM,KAAM,CAAA,UAAA;AAAA,MACZ,CAAO,GAAA,KAAA;AACL,QAAA,IAAA,CAAK,KAAQ,GAAA,GAAA,CAAA;AAAA,OACf;AAAA,KACF,CAAA;AAEA,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM;AAClC,MAAI,IAAA,CAAC,SAAS,KAAS,IAAA,CAAC,MAAM,WAAe,IAAA,KAAA,CAAM,gBAAgB,EAA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K,EAAA,IAAI,KAAK,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA;AAC/C,MAAC,IAAA,CAAa,GAAG,CAAI,GAAA,IAAA,CAAA;AAAA,KACvB;AAAA,GACF;AACA,EAAO,OAAA,IAAA,CAAA;AACT,CAAA;;ACbW,SAAU,CAAA,SAAA,CAAU,WAAY;;ACR9B,MAAA,OAAA,GAAwC,YAAY,KAAK;;;;"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle } from 'vue';
|
|
2
|
-
|
|
3
|
-
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
-
__name: "line",
|
|
5
|
-
props: {
|
|
6
|
-
height: { type: String, required: false, default: "" },
|
|
7
|
-
mode: { type: String, required: false, default: "default" },
|
|
8
|
-
type: { type: String, required: false, default: "default" },
|
|
9
|
-
color: { type: String, required: false, default: "" },
|
|
10
|
-
marginX: { type: [String, Number], required: false, default: 0 },
|
|
11
|
-
marginY: { type: [String, Number], required: false, default: 0 }
|
|
12
|
-
},
|
|
13
|
-
setup(__props) {
|
|
14
|
-
const props = __props;
|
|
15
|
-
const setClass = computed(() => {
|
|
16
|
-
let arr = [];
|
|
17
|
-
if (props.mode) {
|
|
18
|
-
arr.push(`mode-${props.mode}`);
|
|
19
|
-
}
|
|
20
|
-
if (props.type) {
|
|
21
|
-
arr.push(`type-${props.type}`);
|
|
22
|
-
}
|
|
23
|
-
if (props.color) {
|
|
24
|
-
arr.push(`color-${props.color}`);
|
|
25
|
-
}
|
|
26
|
-
return arr;
|
|
27
|
-
});
|
|
28
|
-
const setStyle = computed(() => {
|
|
29
|
-
const obj = {};
|
|
30
|
-
if (props.marginX) {
|
|
31
|
-
if (!isNaN(Number(props.marginX))) {
|
|
32
|
-
obj.marginLeft = props.marginX + "em";
|
|
33
|
-
obj.marginRight = props.marginX + "em";
|
|
34
|
-
} else {
|
|
35
|
-
obj.marginLeft = props.marginX;
|
|
36
|
-
obj.marginRight = props.marginX + "em";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (props.marginY) {
|
|
40
|
-
if (!isNaN(Number(props.marginY))) {
|
|
41
|
-
obj.marginTop = props.marginY + "em";
|
|
42
|
-
obj.marginBottom = props.marginY + "em";
|
|
43
|
-
} else {
|
|
44
|
-
obj.marginTop = props.marginY;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (props.height) {
|
|
48
|
-
if (!isNaN(Number(props.height))) {
|
|
49
|
-
obj.height = props.height + "em";
|
|
50
|
-
} else {
|
|
51
|
-
obj.height = props.height;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return obj;
|
|
55
|
-
});
|
|
56
|
-
return (_ctx, _cache) => {
|
|
57
|
-
return openBlock(), createElementBlock(
|
|
58
|
-
"div",
|
|
59
|
-
{
|
|
60
|
-
class: normalizeClass(["to-line", setClass.value]),
|
|
61
|
-
style: normalizeStyle(setStyle.value)
|
|
62
|
-
},
|
|
63
|
-
null,
|
|
64
|
-
6
|
|
65
|
-
/* CLASS, STYLE */
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
var _export_sfc = (sfc, props) => {
|
|
72
|
-
const target = sfc.__vccOpts || sfc;
|
|
73
|
-
for (const [key, val] of props) {
|
|
74
|
-
target[key] = val;
|
|
75
|
-
}
|
|
76
|
-
return target;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
var Line = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/wangding/WorkSpace/AsiaInfo/projects/\u524D\u7AEF\u6846\u67B6/touch-vue3-ui/packages/components/line/src/line.vue"]]);
|
|
80
|
-
|
|
81
|
-
const withInstall = (main, extra) => {
|
|
82
|
-
main.install = (app) => {
|
|
83
|
-
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
84
|
-
app.component(comp.name, comp);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
if (extra) {
|
|
88
|
-
for (const [key, comp] of Object.entries(extra)) {
|
|
89
|
-
main[key] = comp;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return main;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
navigator.userAgent.toLowerCase();
|
|
96
|
-
|
|
97
|
-
const ToLine = withInstall(Line);
|
|
98
|
-
|
|
99
|
-
export { ToLine };
|
|
100
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../packages/components/line/src/line.vue","../../../../packages/utils/types.ts","../../../../packages/utils/ratio.ts","../../../../packages/components/line/index.ts"],"sourcesContent":["<template>\n <div class=\"to-line\" :class=\"setClass\" :style=\"setStyle\"></div>\n</template>\n<script setup lang=\"ts\">\nimport { computed, CSSProperties } from 'vue';\n\ninterface Props {\n height?: string;\n mode?: string;\n type?: string;\n color?: string;\n marginX?: string | number;\n marginY?: string | number;\n}\n\nconst props = withDefaults(defineProps<Props>(), {\n mode: 'default',\n type: 'default',\n color: '',\n height: '',\n marginX: 0,\n marginY: 0,\n});\n\nconst setClass = computed(() => {\n let arr: string[] = [];\n if (props.mode) {\n arr.push(`mode-${props.mode}`);\n }\n if (props.type) {\n arr.push(`type-${props.type}`);\n }\n if (props.color) {\n arr.push(`color-${props.color}`);\n }\n return arr;\n});\n\nconst setStyle = computed(() => {\n const obj: CSSProperties = {};\n if (props.marginX) {\n if (!isNaN(Number(props.marginX))) {\n obj.marginLeft = props.marginX + 'em';\n obj.marginRight = props.marginX + 'em';\n } else {\n obj.marginLeft = props.marginX;\n obj.marginRight = props.marginX + 'em';\n }\n }\n if (props.marginY) {\n if (!isNaN(Number(props.marginY))) {\n obj.marginTop = props.marginY + 'em';\n obj.marginBottom = props.marginY + 'em';\n } else {\n obj.marginTop = props.marginY;\n }\n }\n if (props.height) {\n if (!isNaN(Number(props.height))) {\n obj.height = props.height + 'em';\n } else {\n obj.height = props.height;\n }\n }\n return obj;\n});\n</script>\n","import type { App, Plugin } from 'vue';\n\n/* 生成install函数 */\n\nexport type SFCWithInstall<T> = T & Plugin;\n\nexport type SFCInstallWithContext<T> = SFCWithInstall<T> & {\n _context: App | null;\n};\n\nexport const withInstall = <T, E extends Record<string, any>>(main: T, extra?: E) => {\n (main as SFCWithInstall<T>).install = (app: App): void => {\n for (const comp of [main, ...Object.values(extra ?? {})]) {\n app.component(comp.name, comp);\n }\n };\n\n if (extra) {\n for (const [key, comp] of Object.entries(extra)) {\n (main as any)[key] = comp;\n }\n }\n return main as SFCWithInstall<T> & E;\n};\n\nexport const withInstallFunction = <T>(fn: T, name: string) => {\n (fn as SFCWithInstall<T>).install = (app: App) => {\n (fn as SFCInstallWithContext<T>)._context = app;\n app.config.globalProperties[name] = fn;\n };\n\n return fn as SFCInstallWithContext<T>;\n};\n","interface Options {\n ratio?: {\n base?: {\n pc?: number;\n pad?: number;\n phone?: number;\n };\n };\n}\n\nconst ua = navigator.userAgent.toLowerCase();\n\nexport function setRatio(options: Options = {}) {\n const ua = navigator.userAgent.toLowerCase();\n const base = options?.ratio?.base ?? {};\n\n const baseSize = /iphone|android.*mobile|windows phone|ipod/i.test(ua)\n ? (base.phone ?? 375)\n : /ipad|android(?!.*mobile)|tablet/i.test(ua)\n ? (base.pad ?? 1100)\n : (base.pc ?? 1366);\n\n const updateFontSize = () => {\n const width = window.innerWidth || document.documentElement.clientWidth;\n document.documentElement.style.fontSize = (width / baseSize) * 100 + 'px';\n };\n\n updateFontSize();\n window.addEventListener('resize', updateFontSize);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function getMedia(options: Options = {}) {\n const isMobile = /iphone|android.*mobile|windows phone|ipod/i.test(ua);\n const isTablet = /ipad|android(?!.*mobile)|tablet/i.test(ua);\n\n return isMobile ? 'phone' : isTablet ? 'pad' : 'pc';\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function setMedia(options: Options = {}) {\n const html = document.documentElement;\n const classList: string[] = [];\n\n // 判断操作系统\n if (/windows/i.test(ua)) {\n classList.push('os-windows');\n } else if (/macintosh|mac os x/i.test(ua)) {\n classList.push('os-macos');\n } else if (/android/i.test(ua)) {\n classList.push('os-android');\n } else if (/iphone|ipad|ipod/i.test(ua)) {\n classList.push('os-ios');\n }\n\n // 判断设备类型\n const media = getMedia();\n if (media === 'pad') {\n classList.push('media-pad');\n } else if (media === 'phone') {\n classList.push('media-phone');\n } else {\n classList.push('media-pc');\n }\n\n // 添加 class 到 <html>\n html.className += ' ' + classList.join(' ');\n}\n\nexport function getEm() {\n const el = document.createElement('div');\n el.style.width = '1em';\n el.style.height = '1em';\n el.style.position = 'absolute';\n document.body.appendChild(el);\n const size = el.getBoundingClientRect().height;\n document.body.removeChild(el);\n return size;\n}\n","import Line from './src/line.vue';\nimport { SFCWithInstall, withInstall } from '@touchvue/utils';\nexport const ToLine: SFCWithInstall<typeof Line> = withInstall(Line);\nexport * from './src/instance';\n"],"names":["_createElementBlock","_normalizeClass"],"mappings":";;;;;;;;;;;;;AAeA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AASd,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC9B,MAAA,IAAI,MAAgB,EAAC,CAAA;AACrB,MAAA,IAAI,MAAM,IAAM,EAAA;AACd,QAAI,GAAA,CAAA,IAAA,CAAK,CAAQ,KAAA,EAAA,KAAA,CAAM,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,OAC/B;AACA,MAAA,IAAI,MAAM,IAAM,EAAA;AACd,QAAI,GAAA,CAAA,IAAA,CAAK,CAAQ,KAAA,EAAA,KAAA,CAAM,IAAM,CAAA,CAAA,CAAA,CAAA;AAAA,OAC/B;AACA,MAAA,IAAI,MAAM,KAAO,EAAA;AACf,QAAI,GAAA,CAAA,IAAA,CAAK,CAAS,MAAA,EAAA,KAAA,CAAM,KAAO,CAAA,CAAA,CAAA,CAAA;AAAA,OAC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