@touchvue/ui 0.0.1-alpha.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/README.md +70 -0
- package/es/components/article/index.js +66 -0
- package/es/components/article/index.js.map +1 -0
- package/es/components/box/index.js +98 -0
- package/es/components/box/index.js.map +1 -0
- package/es/components/button/index.js +96 -0
- package/es/components/button/index.js.map +1 -0
- package/es/components/calendar/index.js +44 -0
- package/es/components/calendar/index.js.map +1 -0
- package/es/components/card/index.js +290 -0
- package/es/components/card/index.js.map +1 -0
- package/es/components/checkbox/index.js +97 -0
- package/es/components/checkbox/index.js.map +1 -0
- package/es/components/datepicker/index.js +44 -0
- package/es/components/datepicker/index.js.map +1 -0
- package/es/components/form/index.js +303 -0
- package/es/components/form/index.js.map +1 -0
- package/es/components/grid/index.js +253 -0
- package/es/components/grid/index.js.map +1 -0
- package/es/components/header/index.js +233 -0
- package/es/components/header/index.js.map +1 -0
- package/es/components/icon/index.js +98 -0
- package/es/components/icon/index.js.map +1 -0
- package/es/components/input/index.js +436 -0
- package/es/components/input/index.js.map +1 -0
- package/es/components/line/index.js +100 -0
- package/es/components/line/index.js.map +1 -0
- package/es/components/msg/index.js +322 -0
- package/es/components/msg/index.js.map +1 -0
- package/es/components/padding/index.js +92 -0
- package/es/components/padding/index.js.map +1 -0
- package/es/components/page/index.js +334 -0
- package/es/components/page/index.js.map +1 -0
- package/es/components/select/index.js +218 -0
- package/es/components/select/index.js.map +1 -0
- package/es/components/space/index.js +88 -0
- package/es/components/space/index.js.map +1 -0
- package/es/components/step/index.js +127 -0
- package/es/components/step/index.js.map +1 -0
- package/es/components/switch/index.js +120 -0
- package/es/components/switch/index.js.map +1 -0
- package/es/components/tab/index.js +227 -0
- package/es/components/tab/index.js.map +1 -0
- package/es/components/table/index.js +893 -0
- package/es/components/table/index.js.map +1 -0
- package/es/directives/dis/index.js +32 -0
- package/es/directives/dis/index.js.map +1 -0
- package/es/directives/size/index.js +23 -0
- package/es/directives/size/index.js.map +1 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/index.js.map +1 -0
- package/es/index.js +4209 -0
- package/es/index.js.map +1 -0
- package/es/utils/index.js +90 -0
- package/es/utils/index.js.map +1 -0
- package/lib/components/article/index.js +70 -0
- package/lib/components/article/index.js.map +1 -0
- package/lib/components/box/index.js +102 -0
- package/lib/components/box/index.js.map +1 -0
- package/lib/components/button/index.js +98 -0
- package/lib/components/button/index.js.map +1 -0
- package/lib/components/calendar/index.js +46 -0
- package/lib/components/calendar/index.js.map +1 -0
- package/lib/components/card/index.js +292 -0
- package/lib/components/card/index.js.map +1 -0
- package/lib/components/checkbox/index.js +99 -0
- package/lib/components/checkbox/index.js.map +1 -0
- package/lib/components/datepicker/index.js +46 -0
- package/lib/components/datepicker/index.js.map +1 -0
- package/lib/components/form/index.js +306 -0
- package/lib/components/form/index.js.map +1 -0
- package/lib/components/grid/index.js +256 -0
- package/lib/components/grid/index.js.map +1 -0
- package/lib/components/header/index.js +235 -0
- package/lib/components/header/index.js.map +1 -0
- package/lib/components/icon/index.js +101 -0
- package/lib/components/icon/index.js.map +1 -0
- package/lib/components/input/index.js +438 -0
- package/lib/components/input/index.js.map +1 -0
- package/lib/components/line/index.js +102 -0
- package/lib/components/line/index.js.map +1 -0
- package/lib/components/msg/index.js +324 -0
- package/lib/components/msg/index.js.map +1 -0
- package/lib/components/padding/index.js +94 -0
- package/lib/components/padding/index.js.map +1 -0
- package/lib/components/page/index.js +336 -0
- package/lib/components/page/index.js.map +1 -0
- package/lib/components/select/index.js +220 -0
- package/lib/components/select/index.js.map +1 -0
- package/lib/components/space/index.js +90 -0
- package/lib/components/space/index.js.map +1 -0
- package/lib/components/step/index.js +129 -0
- package/lib/components/step/index.js.map +1 -0
- package/lib/components/switch/index.js +122 -0
- package/lib/components/switch/index.js.map +1 -0
- package/lib/components/tab/index.js +230 -0
- package/lib/components/tab/index.js.map +1 -0
- package/lib/components/table/index.js +898 -0
- package/lib/components/table/index.js.map +1 -0
- package/lib/directives/dis/index.js +34 -0
- package/lib/directives/dis/index.js.map +1 -0
- package/lib/directives/size/index.js +25 -0
- package/lib/directives/size/index.js.map +1 -0
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/index.js +4251 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/index.js +99 -0
- package/lib/utils/index.js.map +1 -0
- package/package.json +35 -0
- package/theme/components/article/index.css +1 -0
- package/theme/components/box/index.css +1 -0
- package/theme/components/button/index.css +1 -0
- package/theme/components/calendar/index.css +0 -0
- package/theme/components/card/index.css +1 -0
- package/theme/components/checkbox/index.css +1 -0
- package/theme/components/datepicker/index.css +0 -0
- package/theme/components/form/index.css +1 -0
- package/theme/components/grid/index.css +1 -0
- package/theme/components/header/index.css +1 -0
- package/theme/components/icon/index.css +1 -0
- package/theme/components/input/index.css +1 -0
- package/theme/components/line/index.css +1 -0
- package/theme/components/msg/index.css +1 -0
- package/theme/components/padding/index.css +1 -0
- package/theme/components/space/index.css +1 -0
- package/theme/components/step/index.css +1 -0
- package/theme/components/switch/index.css +1 -0
- package/theme/components/tab/index.css +1 -0
- package/theme/components/table/index.css +1 -0
- 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 +1 -0
- package/theme/skin/default.css +1 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
|
|
5
|
+
const _hoisted_1 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "to-input-prefix"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_2 = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "to-input-text"
|
|
12
|
+
};
|
|
13
|
+
const _hoisted_3 = ["autocomplete", "maxlength", "placeholder", "readonly", "tabindex"];
|
|
14
|
+
const _hoisted_4 = {
|
|
15
|
+
key: 2,
|
|
16
|
+
class: "to-input-html"
|
|
17
|
+
};
|
|
18
|
+
const _hoisted_5 = ["autocomplete", "tabindex", "maxlength", "placeholder", "type", "readonly"];
|
|
19
|
+
const _hoisted_6 = {
|
|
20
|
+
key: 4,
|
|
21
|
+
class: "to-input-suffix"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_7 = {
|
|
24
|
+
key: 2,
|
|
25
|
+
class: "to-input-text"
|
|
26
|
+
};
|
|
27
|
+
const _hoisted_8 = {
|
|
28
|
+
key: 3,
|
|
29
|
+
class: "to-input-suggestion"
|
|
30
|
+
};
|
|
31
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
32
|
+
...{
|
|
33
|
+
name: "ToInput"
|
|
34
|
+
},
|
|
35
|
+
__name: "input",
|
|
36
|
+
props: {
|
|
37
|
+
id: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "\u8BF7\u8F93\u5165"
|
|
44
|
+
},
|
|
45
|
+
type: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "text"
|
|
48
|
+
},
|
|
49
|
+
tabindex: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "1"
|
|
52
|
+
},
|
|
53
|
+
autocomplete: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
readonly: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
max: {
|
|
62
|
+
type: [String, Number],
|
|
63
|
+
default: Infinity
|
|
64
|
+
},
|
|
65
|
+
min: {
|
|
66
|
+
type: [String, Number],
|
|
67
|
+
default: -Infinity
|
|
68
|
+
},
|
|
69
|
+
maxlength: {
|
|
70
|
+
type: [String, Number],
|
|
71
|
+
default: Infinity
|
|
72
|
+
},
|
|
73
|
+
dot: {
|
|
74
|
+
type: [String, Number],
|
|
75
|
+
default: 0
|
|
76
|
+
},
|
|
77
|
+
step: {
|
|
78
|
+
type: [String, Number],
|
|
79
|
+
default: null
|
|
80
|
+
},
|
|
81
|
+
stepIconMode: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: ""
|
|
84
|
+
},
|
|
85
|
+
spChars: {
|
|
86
|
+
type: [String, Boolean],
|
|
87
|
+
default: '/,\\,[,],{,},"'
|
|
88
|
+
},
|
|
89
|
+
prefix: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: ""
|
|
92
|
+
},
|
|
93
|
+
suffix: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: ""
|
|
96
|
+
},
|
|
97
|
+
suggestion: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: ""
|
|
100
|
+
},
|
|
101
|
+
suggestionType: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: ""
|
|
104
|
+
},
|
|
105
|
+
suggestionSymbol: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: "\u3001"
|
|
108
|
+
},
|
|
109
|
+
clearable: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false
|
|
112
|
+
},
|
|
113
|
+
preventFocus: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: false
|
|
116
|
+
},
|
|
117
|
+
comparable: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: false
|
|
120
|
+
},
|
|
121
|
+
modelValue: {
|
|
122
|
+
type: [String, Number],
|
|
123
|
+
default: () => ""
|
|
124
|
+
},
|
|
125
|
+
html: {
|
|
126
|
+
type: [String, Number],
|
|
127
|
+
default: ""
|
|
128
|
+
},
|
|
129
|
+
trim: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: true
|
|
132
|
+
},
|
|
133
|
+
fillet: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: "normal"
|
|
136
|
+
},
|
|
137
|
+
filletPosition: {
|
|
138
|
+
type: String,
|
|
139
|
+
default: ""
|
|
140
|
+
},
|
|
141
|
+
color: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: "default"
|
|
144
|
+
},
|
|
145
|
+
placeholderColor: {
|
|
146
|
+
type: String,
|
|
147
|
+
default: ""
|
|
148
|
+
},
|
|
149
|
+
mode: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: ""
|
|
152
|
+
},
|
|
153
|
+
width: {
|
|
154
|
+
type: [Number, String],
|
|
155
|
+
default: ""
|
|
156
|
+
},
|
|
157
|
+
height: {
|
|
158
|
+
type: [Number, String],
|
|
159
|
+
default: ""
|
|
160
|
+
},
|
|
161
|
+
link: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
164
|
+
},
|
|
165
|
+
conversionType: {
|
|
166
|
+
type: [String, Number],
|
|
167
|
+
default: 0
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
emits: ["update:modelValue", "click", "clear"],
|
|
171
|
+
setup(__props, { emit: __emit }) {
|
|
172
|
+
const props = __props;
|
|
173
|
+
const emit = __emit;
|
|
174
|
+
const focused = vue.ref(false);
|
|
175
|
+
const data = vue.ref(props.modelValue);
|
|
176
|
+
const clearVisible = vue.ref(false);
|
|
177
|
+
const itype = vue.ref("text");
|
|
178
|
+
const disabled = vue.computed(() => props.readonly);
|
|
179
|
+
vue.watch(
|
|
180
|
+
() => props.modelValue,
|
|
181
|
+
(val) => {
|
|
182
|
+
data.value = val;
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
const iPlaceholder = vue.computed(() => {
|
|
186
|
+
if (!disabled.value && !props.placeholder && props.placeholder !== "") {
|
|
187
|
+
return "\u8BF7\u586B\u5199";
|
|
188
|
+
} else {
|
|
189
|
+
return props.placeholder;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const iconMode = vue.computed(() => {
|
|
193
|
+
if (props.mode === "none" || props.mode === "line" || focused.value)
|
|
194
|
+
return "none";
|
|
195
|
+
if (props.mode === "fill")
|
|
196
|
+
return "fill";
|
|
197
|
+
return "plain";
|
|
198
|
+
});
|
|
199
|
+
const setClass = vue.computed(() => {
|
|
200
|
+
const arr = [];
|
|
201
|
+
if (props.mode) {
|
|
202
|
+
arr.push(`mode-${props.mode}`);
|
|
203
|
+
}
|
|
204
|
+
if (props.type) {
|
|
205
|
+
arr.push(`type-${props.type}`);
|
|
206
|
+
}
|
|
207
|
+
if (props.readonly) {
|
|
208
|
+
arr.push(`is-readonly`);
|
|
209
|
+
}
|
|
210
|
+
return arr;
|
|
211
|
+
});
|
|
212
|
+
const setStyle = vue.computed(() => {
|
|
213
|
+
const obj = {};
|
|
214
|
+
if (props.width) {
|
|
215
|
+
if (!isNaN(Number(props.width))) {
|
|
216
|
+
obj.width = props.width + "em";
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (props.height) {
|
|
220
|
+
if (!isNaN(Number(props.height))) {
|
|
221
|
+
obj.height = props.height + "em";
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return obj;
|
|
225
|
+
});
|
|
226
|
+
const inputRef = vue.ref(null);
|
|
227
|
+
function inputKeyup() {
|
|
228
|
+
}
|
|
229
|
+
function inputChange() {
|
|
230
|
+
}
|
|
231
|
+
function inputKeydown() {
|
|
232
|
+
}
|
|
233
|
+
function inputCut() {
|
|
234
|
+
}
|
|
235
|
+
function inputFocus() {
|
|
236
|
+
focused.value = true;
|
|
237
|
+
}
|
|
238
|
+
function inputBlur() {
|
|
239
|
+
focused.value = false;
|
|
240
|
+
}
|
|
241
|
+
function inputPaste() {
|
|
242
|
+
}
|
|
243
|
+
function inputKeyPress() {
|
|
244
|
+
}
|
|
245
|
+
function inputInput() {
|
|
246
|
+
emit("update:modelValue", data.value);
|
|
247
|
+
}
|
|
248
|
+
function clear() {
|
|
249
|
+
data.value = "";
|
|
250
|
+
emit("clear");
|
|
251
|
+
}
|
|
252
|
+
function reduce() {
|
|
253
|
+
}
|
|
254
|
+
function increase() {
|
|
255
|
+
}
|
|
256
|
+
function addSuggestion(item) {
|
|
257
|
+
data.value += item;
|
|
258
|
+
}
|
|
259
|
+
function click() {
|
|
260
|
+
emit("click");
|
|
261
|
+
}
|
|
262
|
+
return (_ctx, _cache) => {
|
|
263
|
+
const _component_ToIcon = vue.resolveComponent("ToIcon");
|
|
264
|
+
const _component_ToButton = vue.resolveComponent("ToButton");
|
|
265
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
266
|
+
"span",
|
|
267
|
+
{
|
|
268
|
+
class: vue.normalizeClass(["to-input", setClass.value]),
|
|
269
|
+
style: vue.normalizeStyle(setStyle.value),
|
|
270
|
+
onClick: click
|
|
271
|
+
},
|
|
272
|
+
[
|
|
273
|
+
vue.createCommentVNode(" \u524D\u7F00 "),
|
|
274
|
+
props.prefix || _ctx.$slots.prefix || props.step ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, [
|
|
275
|
+
vue.renderSlot(_ctx.$slots, "prefix"),
|
|
276
|
+
props.prefix ? (vue.openBlock(), vue.createElementBlock(
|
|
277
|
+
"span",
|
|
278
|
+
_hoisted_2,
|
|
279
|
+
vue.toDisplayString(props.prefix),
|
|
280
|
+
1
|
|
281
|
+
/* TEXT */
|
|
282
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
283
|
+
props.step ? (vue.openBlock(), vue.createBlock(_component_ToIcon, {
|
|
284
|
+
key: 1,
|
|
285
|
+
value: props.stepIconMode ? "unfold" : "reduce",
|
|
286
|
+
link: "",
|
|
287
|
+
color: "primary",
|
|
288
|
+
mode: "none",
|
|
289
|
+
disabled: Number(data.value) === Number(props.min) || props.readonly,
|
|
290
|
+
onMousedown: reduce
|
|
291
|
+
}, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true)
|
|
292
|
+
])) : vue.createCommentVNode("v-if", true),
|
|
293
|
+
vue.createCommentVNode(" \u8F93\u5165\u6846\u90E8\u5206 "),
|
|
294
|
+
props.type === "textarea" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("textarea", {
|
|
295
|
+
key: 1,
|
|
296
|
+
ref_key: "inputRef",
|
|
297
|
+
ref: inputRef,
|
|
298
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => data.value = $event),
|
|
299
|
+
class: "to-input-textarea",
|
|
300
|
+
autocomplete: props.autocomplete ? "on" : "new-password",
|
|
301
|
+
maxlength: props.maxlength,
|
|
302
|
+
placeholder: iPlaceholder.value,
|
|
303
|
+
readonly: disabled.value,
|
|
304
|
+
tabindex: props.tabindex,
|
|
305
|
+
onKeyup: inputKeyup,
|
|
306
|
+
onKeydown: inputKeydown,
|
|
307
|
+
onCut: inputCut,
|
|
308
|
+
onFocus: inputFocus,
|
|
309
|
+
onBlur: inputBlur,
|
|
310
|
+
onPaste: inputPaste,
|
|
311
|
+
onKeypress: inputKeyPress
|
|
312
|
+
}, null, 40, _hoisted_3)), [
|
|
313
|
+
[vue.vModelText, data.value]
|
|
314
|
+
]) : props.type === "html" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, [
|
|
315
|
+
vue.createTextVNode(
|
|
316
|
+
vue.toDisplayString(props.html) + " ",
|
|
317
|
+
1
|
|
318
|
+
/* TEXT */
|
|
319
|
+
),
|
|
320
|
+
vue.renderSlot(_ctx.$slots, "html")
|
|
321
|
+
])) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
|
|
322
|
+
key: 3,
|
|
323
|
+
ref_key: "inputRef",
|
|
324
|
+
ref: inputRef,
|
|
325
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => data.value = $event),
|
|
326
|
+
class: "to-input-content",
|
|
327
|
+
autocomplete: props.autocomplete ? "on" : "new-password",
|
|
328
|
+
tabindex: props.tabindex,
|
|
329
|
+
maxlength: props.maxlength,
|
|
330
|
+
placeholder: iPlaceholder.value,
|
|
331
|
+
type: itype.value,
|
|
332
|
+
readonly: disabled.value,
|
|
333
|
+
onKeyup: inputKeyup,
|
|
334
|
+
onKeydown: inputKeydown,
|
|
335
|
+
onCut: inputCut,
|
|
336
|
+
onFocus: inputFocus,
|
|
337
|
+
onBlur: inputBlur,
|
|
338
|
+
onPaste: inputPaste,
|
|
339
|
+
onKeypress: inputKeyPress,
|
|
340
|
+
onChange: inputChange,
|
|
341
|
+
onInput: inputInput
|
|
342
|
+
}, null, 40, _hoisted_5)), [
|
|
343
|
+
[vue.vModelDynamic, data.value]
|
|
344
|
+
]),
|
|
345
|
+
vue.createCommentVNode(" \u540E\u7F00\u533A "),
|
|
346
|
+
props.clearable || props.suggestion || _ctx.$slots.default || _ctx.$slots.suffix || props.suffix || props.step ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6, [
|
|
347
|
+
!props.readonly && props.clearable ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_ToIcon, {
|
|
348
|
+
key: 0,
|
|
349
|
+
class: "to-input-clear",
|
|
350
|
+
mode: iconMode.value,
|
|
351
|
+
link: "",
|
|
352
|
+
value: "close",
|
|
353
|
+
onClick: vue.withModifiers(clear, ["stop"])
|
|
354
|
+
}, null, 8, ["mode"])), [
|
|
355
|
+
[vue.vShow, clearVisible.value]
|
|
356
|
+
]) : vue.createCommentVNode("v-if", true),
|
|
357
|
+
props.step ? (vue.openBlock(), vue.createBlock(_component_ToIcon, {
|
|
358
|
+
key: 1,
|
|
359
|
+
value: props.stepIconMode ? "fold" : "add",
|
|
360
|
+
link: "",
|
|
361
|
+
disabled: Number(data.value) === Number(props.max) || props.readonly,
|
|
362
|
+
onMousedown: increase
|
|
363
|
+
}, null, 8, ["value", "disabled"])) : vue.createCommentVNode("v-if", true),
|
|
364
|
+
props.suffix ? (vue.openBlock(), vue.createElementBlock(
|
|
365
|
+
"span",
|
|
366
|
+
_hoisted_7,
|
|
367
|
+
vue.toDisplayString(props.suffix),
|
|
368
|
+
1
|
|
369
|
+
/* TEXT */
|
|
370
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
371
|
+
vue.renderSlot(_ctx.$slots, "suffix"),
|
|
372
|
+
vue.renderSlot(_ctx.$slots, "default"),
|
|
373
|
+
props.suggestion ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8, [
|
|
374
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
375
|
+
vue.Fragment,
|
|
376
|
+
null,
|
|
377
|
+
vue.renderList(props.suggestion.split(","), (item, i) => {
|
|
378
|
+
return vue.openBlock(), vue.createBlock(_component_ToButton, {
|
|
379
|
+
key: i,
|
|
380
|
+
fillet: true,
|
|
381
|
+
color: "info",
|
|
382
|
+
mode: "text",
|
|
383
|
+
onClick: ($event) => addSuggestion(item)
|
|
384
|
+
}, {
|
|
385
|
+
default: vue.withCtx(() => [
|
|
386
|
+
vue.createTextVNode(
|
|
387
|
+
vue.toDisplayString(item),
|
|
388
|
+
1
|
|
389
|
+
/* TEXT */
|
|
390
|
+
)
|
|
391
|
+
]),
|
|
392
|
+
_: 2
|
|
393
|
+
/* DYNAMIC */
|
|
394
|
+
}, 1032, ["onClick"]);
|
|
395
|
+
}),
|
|
396
|
+
128
|
|
397
|
+
/* KEYED_FRAGMENT */
|
|
398
|
+
))
|
|
399
|
+
])) : vue.createCommentVNode("v-if", true)
|
|
400
|
+
])) : vue.createCommentVNode("v-if", true)
|
|
401
|
+
],
|
|
402
|
+
6
|
|
403
|
+
/* CLASS, STYLE */
|
|
404
|
+
);
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
var _export_sfc = (sfc, props) => {
|
|
410
|
+
const target = sfc.__vccOpts || sfc;
|
|
411
|
+
for (const [key, val] of props) {
|
|
412
|
+
target[key] = val;
|
|
413
|
+
}
|
|
414
|
+
return target;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
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"]]);
|
|
418
|
+
|
|
419
|
+
const withInstall = (main, extra) => {
|
|
420
|
+
main.install = (app) => {
|
|
421
|
+
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
422
|
+
app.component(comp.name, comp);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
if (extra) {
|
|
426
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
427
|
+
main[key] = comp;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return main;
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
navigator.userAgent.toLowerCase();
|
|
434
|
+
|
|
435
|
+
const ToInput = withInstall(Input);
|
|
436
|
+
|
|
437
|
+
exports.ToInput = ToInput;
|
|
438
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":["ref","computed","watch","_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,GAAUA,QAAI,KAAK,CAAA,CAAA;AACzB,IAAM,MAAA,IAAA,GAAOA,OAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACjC,IAAM,MAAA,YAAA,GAAeA,QAAI,KAAK,CAAA,CAAA;AAC9B,IAAM,MAAA,KAAA,GAAQA,QAAI,MAAM,CAAA,CAAA;AACxB,IAAA,MAAM,QAAW,GAAAC,YAAA,CAAS,MAAM,KAAA,CAAM,QAAQ,CAAA,CAAA;AAG9C,IAAAC,SAAA;AAAA,MACE,MAAM,KAAM,CAAA,UAAA;AAAA,MACZ,CAAO,GAAA,KAAA;AACL,QAAA,IAAA,CAAK,KAAQ,GAAA,GAAA,CA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AAA;AACxD,MAAI,GAAA,CAAA,SAAA,CAAU,IAAK,CAAA,IAAA,EAAM,IAAI,CAAA,CAAA;AAAA,KAC/B;AAAA,GACF,CAAA;AAEA,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,KAAA,MAAW,CAAC,GAAK,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;;;;"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
|
|
5
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
6
|
+
__name: "line",
|
|
7
|
+
props: {
|
|
8
|
+
height: { type: String, required: false, default: "" },
|
|
9
|
+
mode: { type: String, required: false, default: "default" },
|
|
10
|
+
type: { type: String, required: false, default: "default" },
|
|
11
|
+
color: { type: String, required: false, default: "" },
|
|
12
|
+
marginX: { type: [String, Number], required: false, default: 0 },
|
|
13
|
+
marginY: { type: [String, Number], required: false, default: 0 }
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const setClass = vue.computed(() => {
|
|
18
|
+
let arr = [];
|
|
19
|
+
if (props.mode) {
|
|
20
|
+
arr.push(`mode-${props.mode}`);
|
|
21
|
+
}
|
|
22
|
+
if (props.type) {
|
|
23
|
+
arr.push(`type-${props.type}`);
|
|
24
|
+
}
|
|
25
|
+
if (props.color) {
|
|
26
|
+
arr.push(`color-${props.color}`);
|
|
27
|
+
}
|
|
28
|
+
return arr;
|
|
29
|
+
});
|
|
30
|
+
const setStyle = vue.computed(() => {
|
|
31
|
+
const obj = {};
|
|
32
|
+
if (props.marginX) {
|
|
33
|
+
if (!isNaN(Number(props.marginX))) {
|
|
34
|
+
obj.marginLeft = props.marginX + "em";
|
|
35
|
+
obj.marginRight = props.marginX + "em";
|
|
36
|
+
} else {
|
|
37
|
+
obj.marginLeft = props.marginX;
|
|
38
|
+
obj.marginRight = props.marginX + "em";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (props.marginY) {
|
|
42
|
+
if (!isNaN(Number(props.marginY))) {
|
|
43
|
+
obj.marginTop = props.marginY + "em";
|
|
44
|
+
obj.marginBottom = props.marginY + "em";
|
|
45
|
+
} else {
|
|
46
|
+
obj.marginTop = props.marginY;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (props.height) {
|
|
50
|
+
if (!isNaN(Number(props.height))) {
|
|
51
|
+
obj.height = props.height + "em";
|
|
52
|
+
} else {
|
|
53
|
+
obj.height = props.height;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return obj;
|
|
57
|
+
});
|
|
58
|
+
return (_ctx, _cache) => {
|
|
59
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
class: vue.normalizeClass(["to-line", setClass.value]),
|
|
63
|
+
style: vue.normalizeStyle(setStyle.value)
|
|
64
|
+
},
|
|
65
|
+
null,
|
|
66
|
+
6
|
|
67
|
+
/* CLASS, STYLE */
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
var _export_sfc = (sfc, props) => {
|
|
74
|
+
const target = sfc.__vccOpts || sfc;
|
|
75
|
+
for (const [key, val] of props) {
|
|
76
|
+
target[key] = val;
|
|
77
|
+
}
|
|
78
|
+
return target;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
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"]]);
|
|
82
|
+
|
|
83
|
+
const withInstall = (main, extra) => {
|
|
84
|
+
main.install = (app) => {
|
|
85
|
+
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
86
|
+
app.component(comp.name, comp);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
if (extra) {
|
|
90
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
91
|
+
main[key] = comp;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return main;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
navigator.userAgent.toLowerCase();
|
|
98
|
+
|
|
99
|
+
const ToLine = withInstall(Line);
|
|
100
|
+
|
|
101
|
+
exports.ToLine = ToLine;
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":["computed","_createElementBlock","_normalizeClass"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AASd,IAAM,MAAA,QAAA,GAAWA,aAAS,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,K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