sykj 0.1.0 → 0.1.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 +0 -13
- package/lib/{common.js → common.ts} +5 -5
- package/lib/focus.ts +35 -0
- package/package.json +1 -1
- package/packages/keyboard/{index.js → index.ts} +2 -2
- package/packages/keyboard/src/Keyboardcon.vue +944 -987
- package/packages/loading/{index.js → index.ts} +2 -2
- package/types/global.d.ts +11 -0
- package/types/index.d.ts +4 -0
- package/lib/focus.js +0 -34
- /package/lib/{store.js → store.ts} +0 -0
|
@@ -1,158 +1,130 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
>
|
|
18
|
-
<div>
|
|
19
|
-
<span>{{ cn_input }}</span>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="wenzi" v-if="cn_list_str.length >= 1">
|
|
23
|
-
<div
|
|
24
|
-
class="wenzi_box"
|
|
25
|
-
:class="showMore ? 'wenzi_box_more' : ''"
|
|
26
|
-
:style="huanhang ? `flex-wrap: wrap;` : ''"
|
|
27
|
-
>
|
|
28
|
-
<span
|
|
29
|
-
@click="chineseCli(item)"
|
|
30
|
-
v-for="(item, index) in cn_list_str"
|
|
31
|
-
:key="index"
|
|
32
|
-
>{{ item }}</span
|
|
33
|
-
>
|
|
34
|
-
</div>
|
|
35
|
-
<div class="moreText" @click="moreTextCli">
|
|
36
|
-
<el-icon
|
|
37
|
-
:style="`transform: rotateZ(${showMore ? 180 : 0}deg)`"
|
|
38
|
-
>
|
|
39
|
-
<ArrowDownBold />
|
|
40
|
-
</el-icon>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
2
|
+
<div
|
|
3
|
+
@click="makeFocus"
|
|
4
|
+
class="keyboardcon defaultCss"
|
|
5
|
+
:class="[keyStore.keyboardcon ? 'show' : '', toUpKeyCase ? 'upKeyCase' : '']"
|
|
6
|
+
@contextmenu.prevent="makeFocus"
|
|
7
|
+
>
|
|
8
|
+
<!-- 中文拼音列表 -->
|
|
9
|
+
<div class="chinese">
|
|
10
|
+
<div
|
|
11
|
+
v-if="keyStore.isChinese === true && cn_input?.length"
|
|
12
|
+
class="pinyin"
|
|
13
|
+
@touchmove.stop.prevent
|
|
14
|
+
>
|
|
15
|
+
<div>
|
|
16
|
+
<span>{{ cn_input }}</span>
|
|
43
17
|
</div>
|
|
44
|
-
|
|
18
|
+
</div>
|
|
19
|
+
<div class="wenzi" v-if="cn_list_str.length >= 1">
|
|
45
20
|
<div
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
21
|
+
class="wenzi_box"
|
|
22
|
+
:class="showMore ? 'wenzi_box_more' : ''"
|
|
23
|
+
:style="huanhang ? `flex-wrap: wrap;` : ''"
|
|
49
24
|
>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}}</span>
|
|
62
|
-
<span @click.stop="choosekey(item[1], index)">{{
|
|
63
|
-
item[1]
|
|
64
|
-
}}</span>
|
|
65
|
-
</div>
|
|
66
|
-
<div
|
|
67
|
-
class="key del"
|
|
68
|
-
@click.stop="choosekey(item, index)"
|
|
69
|
-
v-if="index == '11'"
|
|
70
|
-
>
|
|
71
|
-
<img src="./static/key/del.svg" alt="" />
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
25
|
+
<span
|
|
26
|
+
@click="chineseCli(item)"
|
|
27
|
+
v-for="(item, index) in cn_list_str"
|
|
28
|
+
:key="index"
|
|
29
|
+
>{{ item }}</span
|
|
30
|
+
>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="moreText" @click="moreTextCli">
|
|
33
|
+
<el-icon :style="`transform: rotateZ(${showMore ? 180 : 0}deg)`">
|
|
34
|
+
<ArrowDownBold />
|
|
35
|
+
</el-icon>
|
|
74
36
|
</div>
|
|
75
|
-
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<!-- 纯数字 -->
|
|
40
|
+
<div
|
|
41
|
+
class="number_list"
|
|
42
|
+
@touchmove.stop.prevent
|
|
43
|
+
v-show="keyStore.inputType == 'number'"
|
|
44
|
+
>
|
|
45
|
+
<div class="key_item" v-for="(item, index) in lists" :key="item">
|
|
76
46
|
<div
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
v-show="keyStore.inputType != 'number'"
|
|
81
|
-
ref="pressArea"
|
|
47
|
+
class="key"
|
|
48
|
+
@click.stop="choosekey(item, index)"
|
|
49
|
+
v-if="!Array.isArray(item) && index < 11"
|
|
82
50
|
>
|
|
83
|
-
|
|
84
|
-
class="key_item_row"
|
|
85
|
-
v-for="(item, index) in lists"
|
|
86
|
-
:key="index"
|
|
87
|
-
>
|
|
88
|
-
<div
|
|
89
|
-
class="key_item_column"
|
|
90
|
-
@touchstart="startPress"
|
|
91
|
-
@touchend="endPress"
|
|
92
|
-
@touchcancel="cancelPress"
|
|
93
|
-
v-for="(item1, index1) in item"
|
|
94
|
-
@click.stop="choosekey(item1, index1)"
|
|
95
|
-
:key="item1"
|
|
96
|
-
>
|
|
97
|
-
<div class="key" v-if="item1.length == 1">
|
|
98
|
-
<span>{{ item1 }}</span>
|
|
99
|
-
</div>
|
|
100
|
-
<div
|
|
101
|
-
class="key"
|
|
102
|
-
:class="toUpKeyCase ? 'toUpKeyCase' : ''"
|
|
103
|
-
v-else
|
|
104
|
-
>
|
|
105
|
-
<!-- {{ item1 }} -->
|
|
106
|
-
<img
|
|
107
|
-
v-if="item1 == 'del'"
|
|
108
|
-
:class="item1"
|
|
109
|
-
src="./static/key/del.svg"
|
|
110
|
-
alt=""
|
|
111
|
-
/>
|
|
112
|
-
<img
|
|
113
|
-
v-else-if="item1 == 'shift'"
|
|
114
|
-
:class="item1"
|
|
115
|
-
src="./static/key/shift.svg"
|
|
116
|
-
alt=""
|
|
117
|
-
/>
|
|
118
|
-
<img
|
|
119
|
-
v-else-if="item1 == 'space'"
|
|
120
|
-
:class="item1"
|
|
121
|
-
src="./static/key/space.svg"
|
|
122
|
-
alt=""
|
|
123
|
-
/>
|
|
124
|
-
<img
|
|
125
|
-
v-else-if="item1 == 'enter'"
|
|
126
|
-
:class="item1"
|
|
127
|
-
src="./static/key/enter.svg"
|
|
128
|
-
alt=""
|
|
129
|
-
/>
|
|
130
|
-
<span v-else-if="item1.length > 1" :class="item1">{{
|
|
131
|
-
item1
|
|
132
|
-
}}</span>
|
|
133
|
-
<span v-else :class="item1">{{ item1 }}</span>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
51
|
+
<span>{{ item }}</span>
|
|
137
52
|
</div>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<!-- <el-icon><Switch /></el-icon -->
|
|
142
|
-
<span :class="keyStore.isChinese ? 'ch' : ''">中</span>/<span
|
|
143
|
-
:class="keyStore.isChinese ? '' : 'ch'"
|
|
144
|
-
>英</span
|
|
145
|
-
>
|
|
146
|
-
</div>
|
|
147
|
-
<span @click.stop>确认</span>
|
|
53
|
+
<div class="keys" v-else-if="index < 11">
|
|
54
|
+
<span @click.stop="choosekey(item[0], index)">{{ item[0] }}</span>
|
|
55
|
+
<span @click.stop="choosekey(item[1], index)">{{ item[1] }}</span>
|
|
148
56
|
</div>
|
|
149
|
-
|
|
57
|
+
<div class="key del" @click.stop="choosekey(item, index)" v-if="index == '11'">
|
|
58
|
+
<img src="./static/key/del.svg" alt="" />
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
150
61
|
</div>
|
|
62
|
+
<!-- 26键 -->
|
|
63
|
+
<div
|
|
64
|
+
class="text_list"
|
|
65
|
+
:class="[isSymbol ? 'isSymbol' : '']"
|
|
66
|
+
@touchmove.stop.prevent
|
|
67
|
+
v-show="keyStore.inputType != 'number'"
|
|
68
|
+
ref="pressArea"
|
|
69
|
+
>
|
|
70
|
+
<div class="key_item_row" v-for="(item, index) in lists" :key="index">
|
|
71
|
+
<div
|
|
72
|
+
class="key_item_column"
|
|
73
|
+
@touchstart="startPress"
|
|
74
|
+
@touchend="endPress"
|
|
75
|
+
@touchcancel="cancelPress"
|
|
76
|
+
v-for="(item1, index1) in item"
|
|
77
|
+
@click.stop="choosekey(item1, index1)"
|
|
78
|
+
:key="item1"
|
|
79
|
+
>
|
|
80
|
+
<div class="key" v-if="item1.length == 1">
|
|
81
|
+
<span>{{ item1 }}</span>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="key" :class="toUpKeyCase ? 'toUpKeyCase' : ''" v-else>
|
|
84
|
+
<!-- {{ item1 }} -->
|
|
85
|
+
<img v-if="item1 == 'del'" :class="item1" src="./static/key/del.svg" alt="" />
|
|
86
|
+
<img
|
|
87
|
+
v-else-if="item1 == 'shift'"
|
|
88
|
+
:class="item1"
|
|
89
|
+
src="./static/key/shift.svg"
|
|
90
|
+
alt=""
|
|
91
|
+
/>
|
|
92
|
+
<img
|
|
93
|
+
v-else-if="item1 == 'space'"
|
|
94
|
+
:class="item1"
|
|
95
|
+
src="./static/key/space.svg"
|
|
96
|
+
alt=""
|
|
97
|
+
/>
|
|
98
|
+
<img
|
|
99
|
+
v-else-if="item1 == 'enter'"
|
|
100
|
+
:class="item1"
|
|
101
|
+
src="./static/key/enter.svg"
|
|
102
|
+
alt=""
|
|
103
|
+
/>
|
|
104
|
+
<span v-else-if="item1.length > 1" :class="item1">{{ item1 }}</span>
|
|
105
|
+
<span v-else :class="item1">{{ item1 }}</span>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<!-- 中英文切换 -->
|
|
111
|
+
<div class="btns" @touchmove.stop.prevent>
|
|
112
|
+
<div v-show="keyStore.showCheckChinese" @click="checkChinese">
|
|
113
|
+
<!-- <el-icon><Switch /></el-icon -->
|
|
114
|
+
<span :class="keyStore.isChinese ? 'ch' : ''">中</span>/<span
|
|
115
|
+
:class="keyStore.isChinese ? '' : 'ch'"
|
|
116
|
+
>英</span
|
|
117
|
+
>
|
|
118
|
+
</div>
|
|
119
|
+
<span @click.stop>确认</span>
|
|
120
|
+
</div>
|
|
121
|
+
<!-- <div class="symbol_list" v-show="keyStore.inputType == 'symbol'"></div> -->
|
|
122
|
+
</div>
|
|
151
123
|
</template>
|
|
152
124
|
|
|
153
125
|
<script>
|
|
154
126
|
export default {
|
|
155
|
-
|
|
127
|
+
name: "SyKeyboard",
|
|
156
128
|
};
|
|
157
129
|
</script>
|
|
158
130
|
|
|
@@ -162,11 +134,11 @@ import { onMounted, reactive, ref, onBeforeUnmount, watchEffect } from "vue";
|
|
|
162
134
|
//#region init ------------------------------------------------------------
|
|
163
135
|
const globalKey = window.globalThis.$sy.key;
|
|
164
136
|
const keyStore = reactive({
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
137
|
+
keyboardcon: false,
|
|
138
|
+
currentElement: null,
|
|
139
|
+
inputType: true ? "text" : "number",
|
|
140
|
+
showCheckChinese: !false, //是否展示中文输入切换
|
|
141
|
+
isChinese: false,
|
|
170
142
|
});
|
|
171
143
|
const isSymbol = ref(false);
|
|
172
144
|
//#endregion -----------------------------------------------------------
|
|
@@ -177,117 +149,113 @@ const isSymbol = ref(false);
|
|
|
177
149
|
|
|
178
150
|
let st = null;
|
|
179
151
|
watchEffect(() => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
152
|
+
if (keyStore.keyboardcon) {
|
|
153
|
+
clearTimeout(st);
|
|
154
|
+
document.body.style = "padding-bottom:30vh;";
|
|
155
|
+
} else {
|
|
156
|
+
st = setTimeout(() => {
|
|
157
|
+
document.body.style = "padding:0;";
|
|
158
|
+
}, 0);
|
|
159
|
+
}
|
|
188
160
|
});
|
|
189
161
|
|
|
190
162
|
const numberKeyBoradMap = [1, 2, 3, 4, 5, 6, 7, 8, 9, [".", ":"], 0, "del"];
|
|
191
163
|
const textKeyMap = [
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
164
|
+
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
|
|
165
|
+
["a", "s", "d", "f", "g", "h", "j", "k", "l"],
|
|
166
|
+
["shift", "z", "x", "c", "v", "b", "n", "m", "del"],
|
|
167
|
+
["&123", "space", "enter"],
|
|
196
168
|
];
|
|
197
169
|
|
|
198
170
|
const symbolMap1 = [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
171
|
+
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
|
|
172
|
+
["-", "/", ":", ";", "(", ")", "$", "&", "@", '"'],
|
|
173
|
+
["#+=", ".", ",", "?", "!", "'", "del"],
|
|
174
|
+
["ABC", "space", "enter"],
|
|
203
175
|
];
|
|
204
176
|
|
|
205
177
|
const symbolMap2 = [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
178
|
+
["[", "]", "{", "}", "#", "%", "^", "*", "+", "="],
|
|
179
|
+
["_", "\\", "|", "~", "<", ">", "€", "£", "¥", "·"],
|
|
180
|
+
["123", ".", ",", "?", "!", "'", "del"],
|
|
181
|
+
["ABC", "space", "enter"],
|
|
210
182
|
];
|
|
211
183
|
|
|
212
184
|
const showMore = ref(false);
|
|
213
185
|
const huanhang = ref(false);
|
|
214
186
|
const moreTextCli = () => {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
187
|
+
// keyStore.currentElement.focus();
|
|
188
|
+
globalKey.currentElement.focus();
|
|
189
|
+
|
|
190
|
+
showMore.value = !showMore.value;
|
|
191
|
+
if (showMore.value) {
|
|
192
|
+
huanhang.value = true;
|
|
193
|
+
} else {
|
|
194
|
+
setTimeout(() => {
|
|
195
|
+
huanhang.value = false;
|
|
196
|
+
}, 500);
|
|
197
|
+
}
|
|
226
198
|
};
|
|
227
199
|
const chineseCli = (item) => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
200
|
+
// keyStore.currentElement.focus();
|
|
201
|
+
globalKey.currentElement.focus();
|
|
202
|
+
setInputValue(item);
|
|
203
|
+
selectCN(item);
|
|
204
|
+
console.log(cn_input.value);
|
|
205
|
+
if (!cn_input.value) {
|
|
206
|
+
showMore.value = false;
|
|
207
|
+
}
|
|
236
208
|
};
|
|
237
209
|
|
|
238
210
|
//选择中文
|
|
239
211
|
const selectCN = (text) => {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
212
|
+
let strList = cn_input.value.split("'");
|
|
213
|
+
if (strList.length === 1 || text.length >= strList.length) {
|
|
214
|
+
cn_input.value = "";
|
|
215
|
+
cn_list_str.value = [];
|
|
216
|
+
// l_min.value = 0;
|
|
217
|
+
// l_max.value = 10;
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
setCn_input(text);
|
|
249
221
|
};
|
|
250
222
|
//设置中文输入
|
|
251
223
|
const setCn_input = (text) => {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
224
|
+
const singleDict = dict;
|
|
225
|
+
let itemList = [];
|
|
226
|
+
for (let key in singleDict) {
|
|
227
|
+
let value = singleDict[key];
|
|
228
|
+
if (typeof value === "string") {
|
|
229
|
+
let valueList = value.split("");
|
|
230
|
+
let item = valueList.find((item) => item === text);
|
|
231
|
+
if (item) {
|
|
232
|
+
itemList.push(key);
|
|
233
|
+
}
|
|
263
234
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
if (count === list.length) {
|
|
284
|
-
str = item;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
235
|
+
}
|
|
236
|
+
let str = "";
|
|
237
|
+
const cn_inputList = cn_input.value.split("'");
|
|
238
|
+
for (let i = 0; i < cn_inputList.length; i++) {
|
|
239
|
+
let item = cn_inputList[i];
|
|
240
|
+
for (let key of itemList) {
|
|
241
|
+
let list = key.split("");
|
|
242
|
+
let count = 0;
|
|
243
|
+
for (let k = 0; k < list.length; k++) {
|
|
244
|
+
if (key.charAt(k) === item.charAt(k)) {
|
|
245
|
+
count += 1;
|
|
246
|
+
if (k === 0 && item.length != key.length && key.length > item.length) {
|
|
247
|
+
// 用于处理首单词缩写法
|
|
248
|
+
str = item;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (count === list.length) {
|
|
252
|
+
str = item;
|
|
287
253
|
}
|
|
254
|
+
}
|
|
288
255
|
}
|
|
289
|
-
|
|
290
|
-
|
|
256
|
+
}
|
|
257
|
+
cn_input.value = cn_inputList.filter((item) => item != str).join("'");
|
|
258
|
+
findChinese();
|
|
291
259
|
};
|
|
292
260
|
|
|
293
261
|
let lists = ref([]);
|
|
@@ -296,175 +264,174 @@ let active = ref(1);
|
|
|
296
264
|
let toUpKeyCase = ref(false);
|
|
297
265
|
|
|
298
266
|
const choosekey = (item) => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
267
|
+
try {
|
|
268
|
+
// keyStore.currentElement.focus();
|
|
269
|
+
globalKey.currentElement.focus();
|
|
270
|
+
} catch (error) {}
|
|
271
|
+
|
|
272
|
+
switch (item) {
|
|
273
|
+
case "del":
|
|
274
|
+
if (keyStore.isChinese && cn_input.value?.length) {
|
|
275
|
+
// 处理拼音删除
|
|
276
|
+
delPinyin();
|
|
277
|
+
} else {
|
|
278
|
+
// 普通删除
|
|
279
|
+
delInputText();
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
break;
|
|
283
|
+
case "shift":
|
|
284
|
+
toUpKeyCase.value = !toUpKeyCase.value;
|
|
285
|
+
lists.value = lists.value.map((i) => {
|
|
286
|
+
i = i.map((j) => {
|
|
287
|
+
if (j.length == 1) {
|
|
288
|
+
if (toUpKeyCase.value) return j.toUpperCase();
|
|
289
|
+
else return j.toLowerCase();
|
|
290
|
+
} else {
|
|
291
|
+
return j;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
return i;
|
|
295
|
+
});
|
|
296
|
+
break;
|
|
297
|
+
case "space":
|
|
298
|
+
// keyStore.currentElement.value += " ";
|
|
299
|
+
setInputValue(" ");
|
|
300
|
+
break;
|
|
301
|
+
case "&123":
|
|
302
|
+
lists.value = symbolMap1;
|
|
303
|
+
toUpKeyCase.value = false;
|
|
304
|
+
isSymbol.value = true;
|
|
305
|
+
|
|
306
|
+
break;
|
|
307
|
+
case "ABC":
|
|
308
|
+
lists.value = textKeyMap;
|
|
309
|
+
isSymbol.value = false;
|
|
310
|
+
break;
|
|
311
|
+
case "#+=":
|
|
312
|
+
lists.value = symbolMap2;
|
|
313
|
+
break;
|
|
314
|
+
case "123":
|
|
315
|
+
lists.value = symbolMap1;
|
|
316
|
+
|
|
317
|
+
break;
|
|
318
|
+
case "enter":
|
|
319
|
+
// keyStore.currentElement.value += "\n";
|
|
320
|
+
globalKey.currentElement.value += "\n";
|
|
321
|
+
break;
|
|
322
|
+
default:
|
|
323
|
+
if (keyStore.isChinese && !toUpKeyCase.value) {
|
|
324
|
+
chinese(item);
|
|
325
|
+
} else {
|
|
326
|
+
setInputValue(item);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
363
331
|
};
|
|
364
332
|
|
|
365
333
|
/**删除字符串的某个字符*/
|
|
366
334
|
const delStringLast = (text, index) => {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
335
|
+
if (index < 0) return;
|
|
336
|
+
let arrText = text.split("");
|
|
337
|
+
if (index > 0) {
|
|
338
|
+
arrText[index - 1] = "";
|
|
339
|
+
} else {
|
|
340
|
+
arrText[index] = "";
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
arrText = arrText.filter((item) => item);
|
|
344
|
+
const endIndex = arrText.length - 1;
|
|
345
|
+
if (arrText[endIndex] === "'") {
|
|
346
|
+
arrText[endIndex] = "";
|
|
347
|
+
}
|
|
348
|
+
let result = arrText.join("");
|
|
349
|
+
|
|
350
|
+
return result;
|
|
383
351
|
};
|
|
384
352
|
// 拼音删除
|
|
385
353
|
const delPinyin = () => {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
findChinese("del");
|
|
354
|
+
cn_input.value = delStringLast(cn_input.value, cn_input.value.length);
|
|
355
|
+
if (cn_input.value === "") {
|
|
356
|
+
cn_list_str.value = [];
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const specialPinYin = ["u", "v", "i"].includes(cn_input.value.split("")[0]);
|
|
360
|
+
if (cn_list_str.value && cn_list_str.value.length === 1 && specialPinYin) {
|
|
361
|
+
//@ts-ignore
|
|
362
|
+
cn_list_str.value = [cn_input.value];
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
let re = new RegExp(`^${cn_input.value}\\w*`);
|
|
366
|
+
let keys = Object.keys(dict)
|
|
367
|
+
.filter((key) => {
|
|
368
|
+
const result = re.test(key);
|
|
369
|
+
return result;
|
|
370
|
+
})
|
|
371
|
+
.sort();
|
|
372
|
+
|
|
373
|
+
cn_list_str.value =
|
|
374
|
+
(keys.length > 1 ? keys.reduce((a, b) => a + dict[b], "") : dict[keys[0]]) ||
|
|
375
|
+
"".split("");
|
|
376
|
+
|
|
377
|
+
findChinese("del");
|
|
411
378
|
};
|
|
412
379
|
|
|
413
380
|
// 普通删除字符
|
|
414
381
|
const delInputText = () => {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
triggerModel();
|
|
382
|
+
// let carePos = getCaretPosition(keyStore.currentElement);
|
|
383
|
+
let carePos = getCaretPosition(globalKey.currentElement);
|
|
384
|
+
// let text = keyStore.currentElement.value;
|
|
385
|
+
let text = globalKey.currentElement.value;
|
|
386
|
+
if (carePos <= 0 || carePos > text.length) {
|
|
387
|
+
// keyStore.currentElement.value = text;
|
|
388
|
+
globalKey.currentElement.value = text;
|
|
389
|
+
} else {
|
|
390
|
+
// keyStore.currentElement.value =
|
|
391
|
+
// text.slice(0, carePos - 1) + text.slice(carePos);
|
|
392
|
+
globalKey.currentElement.value = text.slice(0, carePos - 1) + text.slice(carePos);
|
|
393
|
+
}
|
|
394
|
+
// keyStore.currentElement.setSelectionRange(carePos - 1, carePos - 1);
|
|
395
|
+
globalKey.currentElement.setSelectionRange(carePos - 1, carePos - 1);
|
|
396
|
+
triggerModel();
|
|
431
397
|
};
|
|
432
398
|
|
|
433
399
|
// 输入内容
|
|
434
400
|
const setInputValue = (item) => {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
401
|
+
item = `${item}`;
|
|
402
|
+
// let carePos = getCaretPosition(keyStore.currentElement);
|
|
403
|
+
let carePos = getCaretPosition(globalKey.currentElement);
|
|
404
|
+
|
|
405
|
+
// let text = keyStore.currentElement.value;
|
|
406
|
+
let text = globalKey.currentElement.value;
|
|
407
|
+
|
|
408
|
+
if (carePos <= 0) {
|
|
409
|
+
text = item + text;
|
|
410
|
+
} else if (carePos > text.length) {
|
|
411
|
+
text = text + item;
|
|
412
|
+
} else {
|
|
413
|
+
text = text.slice(0, carePos) + item + text.slice(carePos);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// if (toUpKeyCase.value) {
|
|
417
|
+
// // keyStore.currentElement.value = `${text}`.toUpperCase();
|
|
418
|
+
// globalKey.currentElement.value = `${text}`.toUpperCase();
|
|
419
|
+
// } else {
|
|
420
|
+
// // keyStore.currentElement.value = text;
|
|
421
|
+
// globalKey.currentElement.value = text;
|
|
422
|
+
// }
|
|
423
|
+
globalKey.currentElement.value = text;
|
|
424
|
+
carePos += item.length + 1;
|
|
425
|
+
|
|
426
|
+
// keyStore.currentElement.setSelectionRange(carePos - 1, carePos - 1);
|
|
427
|
+
globalKey.currentElement.setSelectionRange(carePos - 1, carePos - 1);
|
|
428
|
+
triggerModel();
|
|
429
|
+
// const reg = /^[a-zA-Z]$/;
|
|
430
|
+
// if (toUpKeyCase.value && reg.test(item)) {
|
|
431
|
+
// keyStore.currentElement.value += item.toUpperCase();
|
|
432
|
+
// } else {
|
|
433
|
+
// keyStore.currentElement.value += item;
|
|
434
|
+
// }
|
|
468
435
|
};
|
|
469
436
|
|
|
470
437
|
const cn_input = ref("");
|
|
@@ -478,244 +445,236 @@ let doubleSpell = {};
|
|
|
478
445
|
|
|
479
446
|
// 获取词库
|
|
480
447
|
const getChinese = () => {
|
|
481
|
-
|
|
482
|
-
|
|
448
|
+
const promise = import("./static/dict/baseDict.json").then((res) => {
|
|
449
|
+
dict = res;
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
const promise1 = import("./static/dict/chowder.json").then((res) => {
|
|
453
|
+
doubleSpell = res;
|
|
454
|
+
});
|
|
455
|
+
promiseList.push(promise1);
|
|
456
|
+
Promise.all(promiseList)
|
|
457
|
+
.then(() => {
|
|
458
|
+
console.log("加载完成");
|
|
459
|
+
})
|
|
460
|
+
.catch((err) => {
|
|
461
|
+
console.error("词库错误", err);
|
|
483
462
|
});
|
|
484
|
-
|
|
485
|
-
const promise1 = import("./static/dict/chowder.json").then((res) => {
|
|
486
|
-
doubleSpell = res;
|
|
487
|
-
});
|
|
488
|
-
promiseList.push(promise1);
|
|
489
|
-
Promise.all(promiseList)
|
|
490
|
-
.then(() => {
|
|
491
|
-
console.log("加载完成");
|
|
492
|
-
})
|
|
493
|
-
.catch((err) => {
|
|
494
|
-
console.error("词库错误", err);
|
|
495
|
-
});
|
|
496
463
|
};
|
|
497
464
|
getChinese();
|
|
498
465
|
|
|
499
466
|
// 中文输入
|
|
500
467
|
const chinese = (key) => {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
return;
|
|
468
|
+
const reg = /^[a-zA-Z]$/;
|
|
469
|
+
if (!reg.test(key)) {
|
|
470
|
+
setInputValue(key);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
cn_input.value += key; //拼音输入框添加拼音
|
|
474
|
+
if (cn_input.value[0] == "'") {
|
|
475
|
+
cn_input.value = cn_input.value.slice(1);
|
|
476
|
+
}
|
|
477
|
+
const specialPinYin = ["u", "v", "i"].includes(cn_input.value.split("")[0]); //判断是否是特殊拼音
|
|
478
|
+
if (specialPinYin) {
|
|
479
|
+
//如果是特殊拼音
|
|
480
|
+
if (!cn_list_str.value.length) {
|
|
481
|
+
//如果没有拼音列表
|
|
482
|
+
//@ts-ignore
|
|
483
|
+
cn_list_str.value = [key]; //拼音列表添加拼音
|
|
484
|
+
} else {
|
|
485
|
+
const value = cn_list_str.value[0] + key; //拼音列表第一个拼音加上当前拼音
|
|
486
|
+
//@ts-ignore
|
|
487
|
+
cn_list_str.value[0] = value; //拼音列表第一个拼音替换为新的拼音
|
|
523
488
|
}
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
524
491
|
|
|
525
|
-
|
|
492
|
+
findChinese("add", key); //查找中文
|
|
526
493
|
};
|
|
527
494
|
|
|
528
495
|
// 查字典
|
|
529
496
|
const findChinese = (type, key) => {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
if (!cn_list_str.value && !Array.isArray(cn_list_str.value)) {
|
|
569
|
-
cn_list_str.value = [];
|
|
570
|
-
}
|
|
497
|
+
// type = del key不需要传,type = add key必须要传
|
|
498
|
+
l_min.value = 0; //最小值
|
|
499
|
+
l_max.value = 10; //最大值
|
|
500
|
+
const pinYinList = cn_input.value.split("'"); //拼音列表
|
|
501
|
+
let pinYin = pinYinList[pinYinList.length - 1]; //当前拼音
|
|
502
|
+
|
|
503
|
+
let re = new RegExp(`^${pinYin}\\w*`); //正则,匹配当前拼音开头的拼音
|
|
504
|
+
let keys = Object.keys(dict) //获取拼音字典的key
|
|
505
|
+
.filter((item) => {
|
|
506
|
+
//过滤
|
|
507
|
+
let strList = pinYin.split(""); //当前拼音转数组
|
|
508
|
+
|
|
509
|
+
const temp = ["h", "o", "n", "a", "e"].includes(
|
|
510
|
+
strList[strList.length - 1] //判断是否是特殊拼音
|
|
511
|
+
);
|
|
512
|
+
if (pinYin.length >= 2 && !temp) {
|
|
513
|
+
//如果是特殊拼音
|
|
514
|
+
if (item === pinYin) return true; //如果拼音字典的key等于当前拼音,返回true
|
|
515
|
+
} else {
|
|
516
|
+
let result = re.test(item); //如果不是特殊拼音,返回正则匹配结果
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
})
|
|
520
|
+
.sort();
|
|
521
|
+
cn_list_str.value =
|
|
522
|
+
keys.length > 1 ? keys.reduce((a, b) => a + dict[b], "") : dict[keys[0]]; //如果拼音列表大于1,拼接拼音列表,否则直接赋值
|
|
523
|
+
// cn_list_str.value = cn_list_str.value.replaceAll("[object Object]", "");
|
|
524
|
+
|
|
525
|
+
if (!cn_list_str.value || (!cn_list_str.value.length && type === "del")) {
|
|
526
|
+
//如果拼音列表不存在或者拼音列表长度为0并且type为del
|
|
527
|
+
cn_input.value = cn_input.value.replace(new RegExp(`(.*)${key}`), `$1'${key}`);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (!cn_list_str.value && !Array.isArray(cn_list_str.value)) {
|
|
531
|
+
cn_list_str.value = [];
|
|
532
|
+
}
|
|
571
533
|
|
|
572
|
-
|
|
534
|
+
keys = cn_input.value.split("'");
|
|
573
535
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
536
|
+
if (keys.length >= 2) {
|
|
537
|
+
cn_list_str.value = [];
|
|
538
|
+
findDoubleSpell();
|
|
539
|
+
}
|
|
578
540
|
};
|
|
579
541
|
|
|
580
542
|
// 连续输入
|
|
581
543
|
const findDoubleSpell = () => {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
tempStr.slice(tempStr.length - 1) + keys[keys.length - 1],
|
|
592
|
-
];
|
|
593
|
-
cn_input.value = keys.join("'");
|
|
594
|
-
}
|
|
544
|
+
let keys = cn_input.value.split("'");
|
|
545
|
+
const partDict = doubleSpell[cn_input.value.charAt(0)];
|
|
546
|
+
if (!partDict) return;
|
|
547
|
+
if (["an"].includes(keys[keys.length - 1])) {
|
|
548
|
+
let tempStr = keys[keys.length - 2];
|
|
549
|
+
if (["n"].includes(tempStr.charAt(tempStr.length - 1))) {
|
|
550
|
+
let newTempStr = tempStr.slice(0, tempStr.length - 1);
|
|
551
|
+
keys = [newTempStr, tempStr.slice(tempStr.length - 1) + keys[keys.length - 1]];
|
|
552
|
+
cn_input.value = keys.join("'");
|
|
595
553
|
}
|
|
554
|
+
}
|
|
596
555
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
if (result && isLen) {
|
|
618
|
-
return partDict[key];
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
let strList = [];
|
|
623
|
-
let singleDictList = [];
|
|
624
|
-
const singleDict = dict;
|
|
625
|
-
for (let key of keyResult) {
|
|
626
|
-
let keyList = key.split("'");
|
|
627
|
-
strList.push(partDict[key].split(","));
|
|
628
|
-
for (let item of keyList) {
|
|
629
|
-
if (singleDict[item]) {
|
|
630
|
-
singleDictList.push(singleDict[item].split(""));
|
|
631
|
-
}
|
|
556
|
+
let keyResult = Object.keys(partDict).filter((key) => {
|
|
557
|
+
const keys = key.split("'");
|
|
558
|
+
const cn_inputList = cn_input.value.split("'");
|
|
559
|
+
const isLen = cn_inputList.length === keys.length;
|
|
560
|
+
if (!isLen) return;
|
|
561
|
+
let result = true;
|
|
562
|
+
for (let i = 0; i < keys.length; i++) {
|
|
563
|
+
if (keys[i].charAt(0) != cn_inputList[i].charAt(0)) {
|
|
564
|
+
result = false;
|
|
565
|
+
} else {
|
|
566
|
+
const keyItemList = keys[i].split("");
|
|
567
|
+
const strList = cn_inputList[i].split("");
|
|
568
|
+
for (let j = 0; j < strList.length; j++) {
|
|
569
|
+
if (!strList[j]) break;
|
|
570
|
+
if (keyItemList[j] != strList[j]) {
|
|
571
|
+
result = false;
|
|
572
|
+
}
|
|
632
573
|
}
|
|
574
|
+
}
|
|
633
575
|
}
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
576
|
+
if (result && isLen) {
|
|
577
|
+
return partDict[key];
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
let strList = [];
|
|
582
|
+
let singleDictList = [];
|
|
583
|
+
const singleDict = dict;
|
|
584
|
+
for (let key of keyResult) {
|
|
585
|
+
let keyList = key.split("'");
|
|
586
|
+
strList.push(partDict[key].split(","));
|
|
587
|
+
for (let item of keyList) {
|
|
588
|
+
if (singleDict[item]) {
|
|
589
|
+
singleDictList.push(singleDict[item].split(""));
|
|
590
|
+
}
|
|
640
591
|
}
|
|
592
|
+
}
|
|
593
|
+
if (!keyResult.length && keys.length) {
|
|
594
|
+
for (let item of keys) {
|
|
595
|
+
if (singleDict[item]) {
|
|
596
|
+
singleDictList.push(singleDict[item].split(""));
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
641
600
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
//@ts-ignore
|
|
646
|
-
.sort((a, b) => {
|
|
647
|
-
if (b.length > a.length) return -1;
|
|
648
|
-
})
|
|
649
|
-
.reverse();
|
|
601
|
+
singleDictList = Array.from(new Set(singleDictList.flat(2)));
|
|
602
|
+
strList = strList
|
|
603
|
+
.flat(2)
|
|
650
604
|
//@ts-ignore
|
|
651
|
-
|
|
605
|
+
.sort((a, b) => {
|
|
606
|
+
if (b.length > a.length) return -1;
|
|
607
|
+
})
|
|
608
|
+
.reverse();
|
|
609
|
+
//@ts-ignore
|
|
610
|
+
cn_list_str.value = strList.concat(singleDictList);
|
|
652
611
|
};
|
|
653
612
|
|
|
654
613
|
//获取光标位置
|
|
655
614
|
const getCaretPosition = (element) => {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
615
|
+
let carePos = 0;
|
|
616
|
+
try {
|
|
617
|
+
carePos = element.selectionStart;
|
|
618
|
+
} catch (error) {}
|
|
619
|
+
cursorPosition.value = carePos;
|
|
620
|
+
return carePos;
|
|
621
|
+
// sel,
|
|
622
|
+
// range;
|
|
623
|
+
|
|
624
|
+
// if (window.getSelection) {
|
|
625
|
+
// sel = window.getSelection();
|
|
626
|
+
|
|
627
|
+
// if (sel?.rangeCount) {
|
|
628
|
+
// range = sel.getRangeAt(0);
|
|
629
|
+
// console.log(
|
|
630
|
+
// "🚀 ~ file: Keyboardcon.vue:459 ~ getCaretPosition ~ range:",
|
|
631
|
+
// range
|
|
632
|
+
// );
|
|
633
|
+
// if (range.commonAncestorContainer.children[0] == element) {
|
|
634
|
+
// // carePos = range.endOffset;
|
|
635
|
+
// carePos = range.endOffset;
|
|
636
|
+
|
|
637
|
+
// if (
|
|
638
|
+
// range.commonAncestorContainer
|
|
639
|
+
// // range.commonAncestorContainer.length !=
|
|
640
|
+
// // range.commonAncestorContainer.data.trim().length
|
|
641
|
+
// ) {
|
|
642
|
+
// carePos -= 1;
|
|
643
|
+
// }
|
|
644
|
+
// }
|
|
645
|
+
// }
|
|
646
|
+
// }
|
|
688
647
|
};
|
|
689
648
|
|
|
690
649
|
// 符号切换
|
|
691
650
|
const checkChinese = (item) => {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
651
|
+
console.log(cn_list_str.value);
|
|
652
|
+
cn_input.value = "";
|
|
653
|
+
cn_list_str.value = [];
|
|
654
|
+
showMore.value = false;
|
|
655
|
+
// keyStore.currentElement.focus();
|
|
656
|
+
// keyStore.isChinese = !keyStore.isChinese;
|
|
657
|
+
globalKey.currentElement.focus();
|
|
658
|
+
keyStore.isChinese = !keyStore.isChinese;
|
|
700
659
|
};
|
|
701
660
|
|
|
702
661
|
// 类型
|
|
703
662
|
watchEffect(() => {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
663
|
+
if (keyStore.inputType == "number") {
|
|
664
|
+
lists.value = numberKeyBoradMap;
|
|
665
|
+
} else {
|
|
666
|
+
lists.value = textKeyMap;
|
|
667
|
+
}
|
|
709
668
|
});
|
|
710
669
|
|
|
711
670
|
//#endregion -----------------------------------------------------------
|
|
712
671
|
|
|
713
672
|
//#region $sy global ------------------------------------------------------------
|
|
714
673
|
const showKeyboard = () => {
|
|
715
|
-
|
|
674
|
+
keyStore.keyboardcon = true;
|
|
716
675
|
};
|
|
717
676
|
const hideKeyboard = () => {
|
|
718
|
-
|
|
677
|
+
keyStore.keyboardcon = false;
|
|
719
678
|
};
|
|
720
679
|
window.globalThis.$sy.key.open = showKeyboard;
|
|
721
680
|
window.globalThis.$sy.key.close = hideKeyboard;
|
|
@@ -724,11 +683,11 @@ window.globalThis.$sy.key.close = hideKeyboard;
|
|
|
724
683
|
//#region input ⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
|
|
725
684
|
// 手动触发input事件
|
|
726
685
|
const triggerModel = () => {
|
|
727
|
-
|
|
686
|
+
globalKey.currentElement.dispatchEvent(new Event("input"));
|
|
728
687
|
};
|
|
729
688
|
|
|
730
689
|
const makeFocus = (e) => {
|
|
731
|
-
|
|
690
|
+
globalKey.currentElement.focus();
|
|
732
691
|
};
|
|
733
692
|
|
|
734
693
|
//#endregion ⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
|
|
@@ -744,33 +703,32 @@ const longpressSt = ref(false);
|
|
|
744
703
|
|
|
745
704
|
// 定义长按事件逻辑
|
|
746
705
|
const onLongPress = (t) => {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
706
|
+
// alert("长按事件触发");
|
|
707
|
+
longpressSt.value = setInterval(() => {
|
|
708
|
+
// console.log("长按触发", t);
|
|
709
|
+
choosekey(t);
|
|
710
|
+
}, 50);
|
|
752
711
|
};
|
|
753
712
|
|
|
754
713
|
// 开始按压的处理函数
|
|
755
714
|
const startPress = (e) => {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}, 500); // 设置长按时间为500毫秒
|
|
715
|
+
let value = e.target.children[0]?.innerText || e.target.children[0].className;
|
|
716
|
+
if (value != "del") return;
|
|
717
|
+
pressTimer.value = setTimeout(() => {
|
|
718
|
+
onLongPress(value);
|
|
719
|
+
}, 500); // 设置长按时间为500毫秒
|
|
762
720
|
};
|
|
763
721
|
|
|
764
722
|
// 结束按压的处理函数
|
|
765
723
|
const endPress = () => {
|
|
766
|
-
|
|
767
|
-
|
|
724
|
+
clearTimeout(pressTimer.value);
|
|
725
|
+
clearInterval(longpressSt.value);
|
|
768
726
|
};
|
|
769
727
|
|
|
770
728
|
// 取消按压的处理函数
|
|
771
729
|
const cancelPress = () => {
|
|
772
|
-
|
|
773
|
-
|
|
730
|
+
clearTimeout(pressTimer.value);
|
|
731
|
+
clearInterval(longpressSt.value);
|
|
774
732
|
};
|
|
775
733
|
|
|
776
734
|
// 添加和清理事件监听器
|
|
@@ -784,446 +742,445 @@ const cancelPress = () => {
|
|
|
784
742
|
@import "./theme.scss";
|
|
785
743
|
|
|
786
744
|
.defaultCss {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
745
|
+
--h: 4vh;
|
|
746
|
+
--gap: 0.6vh;
|
|
747
|
+
--fontSize: 2vh;
|
|
748
|
+
--borra: 0.4vh;
|
|
791
749
|
}
|
|
792
750
|
|
|
793
751
|
.upKeyCase {
|
|
794
|
-
|
|
752
|
+
--fontSize: 2vh;
|
|
795
753
|
}
|
|
796
754
|
|
|
797
755
|
.keyboardcon {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
756
|
+
position: fixed;
|
|
757
|
+
background-color: #212123;
|
|
758
|
+
width: 100%;
|
|
759
|
+
max-width: 1280px;
|
|
760
|
+
margin: auto;
|
|
761
|
+
left: 0;
|
|
762
|
+
right: 0;
|
|
763
|
+
bottom: 0;
|
|
764
|
+
font-size: var(--fontSize);
|
|
765
|
+
padding: 1.2vh 1.2vh 0.6vh;
|
|
766
|
+
box-sizing: border-box;
|
|
767
|
+
box-shadow: 0 0 1.5vh 0 rgb(117, 117, 117);
|
|
768
|
+
z-index: 10000;
|
|
769
|
+
// // @include key_background("keyboard_background");
|
|
770
|
+
background: var(--keyboard_background);
|
|
771
|
+
border-radius: 1.2vh 1.2vh 0 0;
|
|
772
|
+
transition: all 0.2s;
|
|
773
|
+
& * {
|
|
808
774
|
box-sizing: border-box;
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
775
|
+
}
|
|
776
|
+
.btns {
|
|
777
|
+
color: rgb(0, 123, 255);
|
|
778
|
+
display: flex;
|
|
779
|
+
justify-content: space-between;
|
|
780
|
+
align-items: center;
|
|
781
|
+
margin: 1.2vh 0;
|
|
782
|
+
font-size: 1.2vh;
|
|
783
|
+
cursor: pointer;
|
|
784
|
+
> div {
|
|
785
|
+
height: 1.2vh;
|
|
786
|
+
span {
|
|
787
|
+
color: gainsboro;
|
|
788
|
+
transition: all 0.3s;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.ch {
|
|
793
|
+
font-size: 1.4vh;
|
|
794
|
+
color: rgb(0, 123, 255);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
.chinese {
|
|
799
|
+
// border: 1px solid red;
|
|
800
|
+
|
|
801
|
+
.pinyin {
|
|
802
|
+
padding: 4px;
|
|
803
|
+
box-sizing: border-box;
|
|
804
|
+
// border: 1px solid red;
|
|
817
805
|
}
|
|
818
|
-
|
|
819
|
-
|
|
806
|
+
|
|
807
|
+
.wenzi {
|
|
808
|
+
position: relative;
|
|
809
|
+
height: 3.6vh;
|
|
810
|
+
|
|
811
|
+
// border: 1px solid red;
|
|
812
|
+
background: var(--keyboard_background);
|
|
813
|
+
margin-bottom: 0.6vh;
|
|
814
|
+
.wenzi_box {
|
|
820
815
|
display: flex;
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
height: 1.2vh;
|
|
828
|
-
span {
|
|
829
|
-
color: gainsboro;
|
|
830
|
-
transition: all 0.3s;
|
|
831
|
-
}
|
|
816
|
+
// flex-wrap: wrap;
|
|
817
|
+
gap: 10px;
|
|
818
|
+
padding: 5px;
|
|
819
|
+
overflow: auto;
|
|
820
|
+
&::-webkit-scrollbar {
|
|
821
|
+
display: none; /* 适用于 Chrome, Safari 和 Opera */
|
|
832
822
|
}
|
|
823
|
+
scrollbar-width: none; /* 适用于 Firefox */
|
|
824
|
+
position: absolute;
|
|
825
|
+
left: 0;
|
|
826
|
+
top: 0;
|
|
827
|
+
width: 98%;
|
|
828
|
+
height: 100%;
|
|
829
|
+
background: var(--keyboard_background);
|
|
830
|
+
z-index: 1;
|
|
831
|
+
transition: all 0.5s;
|
|
832
|
+
box-sizing: border-box;
|
|
833
833
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
834
|
+
span {
|
|
835
|
+
flex-shrink: 0;
|
|
836
|
+
padding: 0.24vh 0.48vh;
|
|
837
|
+
border-radius: 6px;
|
|
838
|
+
// border: 1px solid red;
|
|
839
|
+
height: fit-content;
|
|
840
|
+
|
|
841
|
+
&:active {
|
|
842
|
+
// @include key_background("key_active_background");
|
|
843
|
+
background: var(--key_active_background);
|
|
844
|
+
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
845
|
+
transform: scale(0.99);
|
|
846
|
+
}
|
|
837
847
|
}
|
|
838
|
-
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
.wenzi_box_more {
|
|
851
|
+
// flex-wrap: wrap;
|
|
852
|
+
padding-right: 1.8vh;
|
|
853
|
+
box-sizing: border-box;
|
|
854
|
+
width: 102%;
|
|
855
|
+
left: -0.18vh;
|
|
856
|
+
// height: 31vh;
|
|
857
|
+
height: 25vh;
|
|
839
858
|
|
|
840
|
-
|
|
859
|
+
// border: 1px solid red;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
.moreText {
|
|
863
|
+
position: absolute;
|
|
864
|
+
height: 3.5vh;
|
|
865
|
+
top: 0;
|
|
866
|
+
right: -5px;
|
|
867
|
+
z-index: 100;
|
|
868
|
+
padding: 0 0.3vh;
|
|
869
|
+
display: flex;
|
|
870
|
+
justify-content: center;
|
|
871
|
+
align-items: center;
|
|
872
|
+
border-radius: var(--borra);
|
|
841
873
|
// border: 1px solid red;
|
|
842
874
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
875
|
+
// @include key_background("keyboard_background");
|
|
876
|
+
background: var(--keyboard_background);
|
|
877
|
+
|
|
878
|
+
&:active {
|
|
879
|
+
// @include key_background("key_active_background");
|
|
880
|
+
background: var(--key_active_background);
|
|
881
|
+
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
882
|
+
transform: scale(0.99);
|
|
847
883
|
}
|
|
848
884
|
|
|
849
|
-
.
|
|
850
|
-
|
|
851
|
-
|
|
885
|
+
.el-icon {
|
|
886
|
+
transition: all 0.4s ease;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.number_list {
|
|
893
|
+
display: grid;
|
|
894
|
+
grid-template-columns: repeat(3, 1fr);
|
|
895
|
+
text-align: center;
|
|
896
|
+
gap: var(--gap);
|
|
897
|
+
|
|
898
|
+
.key_item {
|
|
899
|
+
border-radius: 3px;
|
|
900
|
+
font-weight: bold;
|
|
901
|
+
overflow: hidden;
|
|
902
|
+
user-select: none;
|
|
903
|
+
// @include key_color("key_color");
|
|
904
|
+
color: var(--key_color);
|
|
905
|
+
.key {
|
|
906
|
+
box-shadow: inset 0px 0px 2px 0px #8f9eae;
|
|
907
|
+
// @include key_background("key_background");
|
|
908
|
+
border-radius: var(--borra);
|
|
909
|
+
|
|
910
|
+
background: var(--keyboard_background);
|
|
911
|
+
height: var(--h);
|
|
912
|
+
display: flex;
|
|
913
|
+
justify-content: center;
|
|
914
|
+
align-items: center;
|
|
915
|
+
// padding: 6px 0;
|
|
852
916
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
padding: 5px;
|
|
861
|
-
overflow: auto;
|
|
862
|
-
&::-webkit-scrollbar {
|
|
863
|
-
display: none; /* 适用于 Chrome, Safari 和 Opera */
|
|
864
|
-
}
|
|
865
|
-
scrollbar-width: none; /* 适用于 Firefox */
|
|
866
|
-
position: absolute;
|
|
867
|
-
left: 0;
|
|
868
|
-
top: 0;
|
|
869
|
-
width: 98%;
|
|
870
|
-
height: 100%;
|
|
871
|
-
background: var(--keyboard_background);
|
|
872
|
-
z-index: 1;
|
|
873
|
-
transition: all 0.5s;
|
|
874
|
-
box-sizing: border-box;
|
|
875
|
-
|
|
876
|
-
span {
|
|
877
|
-
flex-shrink: 0;
|
|
878
|
-
padding: 0.24vh 0.48vh;
|
|
879
|
-
border-radius: 6px;
|
|
880
|
-
// border: 1px solid red;
|
|
881
|
-
height: fit-content;
|
|
882
|
-
|
|
883
|
-
&:active {
|
|
884
|
-
// @include key_background("key_active_background");
|
|
885
|
-
background: var(--key_active_background);
|
|
886
|
-
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
887
|
-
transform: scale(0.99);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
917
|
+
&:active {
|
|
918
|
+
// @include key_background("key_active_background");
|
|
919
|
+
background: var(--key_active_background);
|
|
920
|
+
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
921
|
+
transform: scale(0.99);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
891
924
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
height: 25vh;
|
|
925
|
+
.keys {
|
|
926
|
+
display: flex;
|
|
927
|
+
gap: 4px;
|
|
928
|
+
height: var(--h);
|
|
929
|
+
display: flex;
|
|
930
|
+
justify-content: center;
|
|
931
|
+
align-items: center;
|
|
900
932
|
|
|
901
|
-
|
|
902
|
-
|
|
933
|
+
span {
|
|
934
|
+
flex: 1;
|
|
935
|
+
box-shadow: inset 0px 0px 2px 0px #8f9eae;
|
|
936
|
+
// @include key_background("key_background");
|
|
937
|
+
background: var(--key_background);
|
|
938
|
+
border-radius: 3px;
|
|
939
|
+
height: 100%;
|
|
940
|
+
display: flex;
|
|
941
|
+
justify-content: center;
|
|
942
|
+
align-items: center;
|
|
943
|
+
|
|
944
|
+
&:active {
|
|
945
|
+
// @include key_background("key_active_background");
|
|
946
|
+
background: var(--key_active_background);
|
|
947
|
+
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
948
|
+
transform: scale(0.99);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
903
952
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
// border: 1px solid red;
|
|
916
|
-
|
|
917
|
-
// @include key_background("keyboard_background");
|
|
918
|
-
background: var(--keyboard_background);
|
|
919
|
-
|
|
920
|
-
&:active {
|
|
921
|
-
// @include key_background("key_active_background");
|
|
922
|
-
background: var(--key_active_background);
|
|
923
|
-
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
924
|
-
transform: scale(0.99);
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
.el-icon {
|
|
928
|
-
transition: all 0.4s ease;
|
|
929
|
-
}
|
|
930
|
-
}
|
|
953
|
+
.del {
|
|
954
|
+
display: flex;
|
|
955
|
+
justify-content: center;
|
|
956
|
+
align-items: center;
|
|
957
|
+
height: var(--h);
|
|
958
|
+
|
|
959
|
+
img {
|
|
960
|
+
transform: scale(0.9);
|
|
961
|
+
// @include filter("key_filter");
|
|
962
|
+
height: 100%;
|
|
963
|
+
filter: var(--key_filter);
|
|
931
964
|
}
|
|
965
|
+
}
|
|
932
966
|
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.text_list {
|
|
970
|
+
--symbolP: 0 5%;
|
|
971
|
+
}
|
|
972
|
+
.isSymbol {
|
|
973
|
+
--symbolP: 0;
|
|
974
|
+
}
|
|
975
|
+
.text_list {
|
|
976
|
+
display: grid;
|
|
977
|
+
grid-template-columns: repeat(1, 1fr);
|
|
978
|
+
text-align: center;
|
|
979
|
+
gap: var(--gap);
|
|
980
|
+
color: rgb(238, 238, 238);
|
|
981
|
+
|
|
982
|
+
.key_item_row {
|
|
983
|
+
display: flex;
|
|
984
|
+
gap: var(--gap);
|
|
985
|
+
width: 100%;
|
|
986
|
+
// border: 1px solid red;
|
|
987
|
+
// 全部
|
|
988
|
+
.key_item_column {
|
|
989
|
+
// flex: 1;
|
|
990
|
+
font-weight: bold;
|
|
991
|
+
color: var(--key_color);
|
|
992
|
+
overflow: hidden;
|
|
993
|
+
user-select: none;
|
|
994
|
+
box-sizing: border-box;
|
|
995
|
+
display: flex;
|
|
996
|
+
justify-content: center;
|
|
997
|
+
align-items: center;
|
|
998
|
+
height: var(--h);
|
|
999
|
+
& span,
|
|
1000
|
+
& img {
|
|
1001
|
+
pointer-events: none;
|
|
1002
|
+
}
|
|
1003
|
+
.key {
|
|
1004
|
+
border-radius: var(--borra);
|
|
1005
|
+
display: flex;
|
|
1006
|
+
justify-content: center;
|
|
1007
|
+
align-items: center;
|
|
1008
|
+
height: 100%;
|
|
1009
|
+
width: 100%;
|
|
1010
|
+
font-size: var(--fontSize);
|
|
1011
|
+
box-shadow: inset 0px 0px 2px 0px #8f9eae;
|
|
1012
|
+
|
|
1013
|
+
background: var(--key_background);
|
|
1014
|
+
span {
|
|
1015
|
+
height: fit-content;
|
|
1016
|
+
line-height: 1.2vh;
|
|
1017
|
+
// border: 1px solid red;
|
|
1018
|
+
}
|
|
933
1019
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1020
|
+
&:active {
|
|
1021
|
+
background: var(--key_active_background);
|
|
1022
|
+
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
1023
|
+
transform: scale(0.99);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// 单独第一行
|
|
1029
|
+
&:nth-child(1) {
|
|
1030
|
+
// justify-content: center;
|
|
1031
|
+
.key_item_column {
|
|
1032
|
+
// border: 1px solid red;
|
|
1033
|
+
flex: 1;
|
|
1034
|
+
flex-shrink: 0;
|
|
1035
|
+
.key {
|
|
1036
|
+
padding: 0;
|
|
1037
|
+
box-sizing: border-box;
|
|
1038
|
+
}
|
|
1039
|
+
// flex: 1;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
939
1042
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1043
|
+
// 单独第2行
|
|
1044
|
+
&:nth-child(2) {
|
|
1045
|
+
display: flex;
|
|
1046
|
+
justify-content: center;
|
|
1047
|
+
padding: var(--symbolP);
|
|
1048
|
+
.key_item_column {
|
|
1049
|
+
flex-shrink: 0;
|
|
1050
|
+
flex: 1;
|
|
1051
|
+
.key {
|
|
1052
|
+
padding: 0;
|
|
1053
|
+
box-sizing: border-box;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
// grid-template-columns: repeat(9, 1fr);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
--flw: 10%; // 3 4 头尾
|
|
1061
|
+
--mflw: 60px;
|
|
1062
|
+
// 单独第3行
|
|
1063
|
+
&:nth-child(3) {
|
|
1064
|
+
justify-self: center;
|
|
1065
|
+
display: flex;
|
|
1066
|
+
|
|
1067
|
+
.key_item_column {
|
|
1068
|
+
// flex: 1;
|
|
1069
|
+
&:nth-child(1) {
|
|
1070
|
+
padding: 0;
|
|
947
1071
|
.key {
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
&:active {
|
|
960
|
-
// @include key_background("key_active_background");
|
|
961
|
-
background: var(--key_active_background);
|
|
962
|
-
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
963
|
-
transform: scale(0.99);
|
|
964
|
-
}
|
|
1072
|
+
box-sizing: border-box;
|
|
1073
|
+
display: flex;
|
|
1074
|
+
justify-content: center;
|
|
1075
|
+
align-items: center;
|
|
1076
|
+
font-size: 1.8vh;
|
|
1077
|
+
// border: 1px solid red;
|
|
1078
|
+
img {
|
|
1079
|
+
transform: scale(0.7);
|
|
1080
|
+
// @include filter("key_filter");
|
|
1081
|
+
filter: var(--key_filter);
|
|
1082
|
+
}
|
|
965
1083
|
}
|
|
966
1084
|
|
|
967
|
-
.
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
align-items: center;
|
|
974
|
-
|
|
975
|
-
span {
|
|
976
|
-
flex: 1;
|
|
977
|
-
box-shadow: inset 0px 0px 2px 0px #8f9eae;
|
|
978
|
-
// @include key_background("key_background");
|
|
979
|
-
background: var(--key_background);
|
|
980
|
-
border-radius: 3px;
|
|
981
|
-
height: 100%;
|
|
982
|
-
display: flex;
|
|
983
|
-
justify-content: center;
|
|
984
|
-
align-items: center;
|
|
985
|
-
|
|
986
|
-
&:active {
|
|
987
|
-
// @include key_background("key_active_background");
|
|
988
|
-
background: var(--key_active_background);
|
|
989
|
-
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
990
|
-
transform: scale(0.99);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
1085
|
+
.toUpKeyCase {
|
|
1086
|
+
// box-shadow: none;
|
|
1087
|
+
// border: 1px solid red; ´
|
|
1088
|
+
img {
|
|
1089
|
+
// filter: invert(100%);
|
|
1090
|
+
}
|
|
993
1091
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
&:first-child,
|
|
1095
|
+
&:last-child {
|
|
1096
|
+
width: var(--flw);
|
|
1097
|
+
min-width: var(--mflw);
|
|
1098
|
+
|
|
1099
|
+
img {
|
|
1100
|
+
transform: scale(0.8);
|
|
1101
|
+
height: 80%;
|
|
1102
|
+
// @include filter("key_filter");
|
|
1103
|
+
filter: var(--key_filter);
|
|
1007
1104
|
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
&:not(&:first-child, &:last-child) {
|
|
1108
|
+
flex: 1;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
.key {
|
|
1112
|
+
padding: 0;
|
|
1113
|
+
box-sizing: border-box;
|
|
1114
|
+
}
|
|
1008
1115
|
}
|
|
1009
|
-
|
|
1116
|
+
}
|
|
1010
1117
|
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
.isSymbol {
|
|
1015
|
-
--symbolP: 0;
|
|
1016
|
-
}
|
|
1017
|
-
.text_list {
|
|
1018
|
-
display: grid;
|
|
1019
|
-
grid-template-columns: repeat(1, 1fr);
|
|
1020
|
-
text-align: center;
|
|
1021
|
-
gap: var(--gap);
|
|
1022
|
-
color: rgb(238, 238, 238);
|
|
1023
|
-
|
|
1024
|
-
.key_item_row {
|
|
1025
|
-
display: flex;
|
|
1026
|
-
gap: var(--gap);
|
|
1027
|
-
width: 100%;
|
|
1028
|
-
// border: 1px solid red;
|
|
1029
|
-
// 全部
|
|
1030
|
-
.key_item_column {
|
|
1031
|
-
// flex: 1;
|
|
1032
|
-
font-weight: bold;
|
|
1033
|
-
color: var(--key_color);
|
|
1034
|
-
overflow: hidden;
|
|
1035
|
-
user-select: none;
|
|
1036
|
-
box-sizing: border-box;
|
|
1037
|
-
display: flex;
|
|
1038
|
-
justify-content: center;
|
|
1039
|
-
align-items: center;
|
|
1040
|
-
height: var(--h);
|
|
1041
|
-
& span,
|
|
1042
|
-
& img {
|
|
1043
|
-
pointer-events: none;
|
|
1044
|
-
}
|
|
1045
|
-
.key {
|
|
1046
|
-
border-radius: var(--borra);
|
|
1047
|
-
display: flex;
|
|
1048
|
-
justify-content: center;
|
|
1049
|
-
align-items: center;
|
|
1050
|
-
height: 100%;
|
|
1051
|
-
width: 100%;
|
|
1052
|
-
font-size: var(--fontSize);
|
|
1053
|
-
box-shadow: inset 0px 0px 2px 0px #8f9eae;
|
|
1054
|
-
|
|
1055
|
-
background: var(--key_background);
|
|
1056
|
-
span {
|
|
1057
|
-
height: fit-content;
|
|
1058
|
-
line-height: 1.2vh;
|
|
1059
|
-
// border: 1px solid red;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
&:active {
|
|
1063
|
-
background: var(--key_active_background);
|
|
1064
|
-
box-shadow: inset 0px 0px 2px 2px #65708220;
|
|
1065
|
-
transform: scale(0.99);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1118
|
+
// 单独第4行
|
|
1119
|
+
&:nth-child(4) {
|
|
1120
|
+
grid-template-columns: 0.3fr 1fr 0.3fr;
|
|
1069
1121
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
// flex: 1;
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1122
|
+
.key_item_column {
|
|
1123
|
+
flex-shrink: 0;
|
|
1124
|
+
|
|
1125
|
+
// flex: 1;
|
|
1126
|
+
font-weight: 400;
|
|
1127
|
+
// border: 1px solid red;
|
|
1128
|
+
.key {
|
|
1129
|
+
padding: 0;
|
|
1130
|
+
box-sizing: border-box;
|
|
1131
|
+
font-size: 1.8vh;
|
|
1132
|
+
font-weight: bold;
|
|
1084
1133
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
display: flex;
|
|
1088
|
-
justify-content: center;
|
|
1089
|
-
padding: var(--symbolP);
|
|
1090
|
-
.key_item_column {
|
|
1091
|
-
flex-shrink: 0;
|
|
1092
|
-
flex: 1;
|
|
1093
|
-
.key {
|
|
1094
|
-
padding: 0;
|
|
1095
|
-
box-sizing: border-box;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
// grid-template-columns: repeat(9, 1fr);
|
|
1134
|
+
img {
|
|
1135
|
+
height: 100%;
|
|
1100
1136
|
}
|
|
1137
|
+
}
|
|
1101
1138
|
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
transform: scale(0.7);
|
|
1122
|
-
// @include filter("key_filter");
|
|
1123
|
-
filter: var(--key_filter);
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
.toUpKeyCase {
|
|
1128
|
-
box-shadow: none;
|
|
1129
|
-
// border: 1px solid red; ´
|
|
1130
|
-
|
|
1131
|
-
img {
|
|
1132
|
-
filter: invert(100%);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
&:first-child,
|
|
1138
|
-
&:last-child {
|
|
1139
|
-
width: var(--flw);
|
|
1140
|
-
min-width: var(--mflw);
|
|
1141
|
-
|
|
1142
|
-
img {
|
|
1143
|
-
transform: scale(0.8);
|
|
1144
|
-
height: 80%;
|
|
1145
|
-
// @include filter("key_filter");
|
|
1146
|
-
filter: var(--key_filter);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
&:not(&:first-child, &:last-child) {
|
|
1151
|
-
flex: 1;
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
.key {
|
|
1155
|
-
padding: 0;
|
|
1156
|
-
box-sizing: border-box;
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1139
|
+
&:first-child,
|
|
1140
|
+
&:last-child {
|
|
1141
|
+
width: var(--flw);
|
|
1142
|
+
min-width: var(--mflw);
|
|
1143
|
+
// font-size: 14px;
|
|
1144
|
+
|
|
1145
|
+
display: flex;
|
|
1146
|
+
justify-content: center;
|
|
1147
|
+
align-items: center;
|
|
1148
|
+
|
|
1149
|
+
.key {
|
|
1150
|
+
display: flex;
|
|
1151
|
+
justify-content: center;
|
|
1152
|
+
align-items: center;
|
|
1153
|
+
|
|
1154
|
+
img {
|
|
1155
|
+
transform: scale(0.8);
|
|
1156
|
+
filter: var(--key_filter);
|
|
1157
|
+
}
|
|
1159
1158
|
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
&:nth-child(2) {
|
|
1162
|
+
flex: 1;
|
|
1160
1163
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
.key_item_column {
|
|
1166
|
-
flex-shrink: 0;
|
|
1167
|
-
|
|
1168
|
-
// flex: 1;
|
|
1169
|
-
font-weight: 400;
|
|
1170
|
-
// border: 1px solid red;
|
|
1171
|
-
.key {
|
|
1172
|
-
padding: 0;
|
|
1173
|
-
box-sizing: border-box;
|
|
1174
|
-
font-size: 1.8vh;
|
|
1175
|
-
font-weight: bold;
|
|
1176
|
-
|
|
1177
|
-
img {
|
|
1178
|
-
height: 100%;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
&:first-child,
|
|
1183
|
-
&:last-child {
|
|
1184
|
-
width: var(--flw);
|
|
1185
|
-
min-width: var(--mflw);
|
|
1186
|
-
// font-size: 14px;
|
|
1187
|
-
|
|
1188
|
-
display: flex;
|
|
1189
|
-
justify-content: center;
|
|
1190
|
-
align-items: center;
|
|
1191
|
-
|
|
1192
|
-
.key {
|
|
1193
|
-
display: flex;
|
|
1194
|
-
justify-content: center;
|
|
1195
|
-
align-items: center;
|
|
1196
|
-
|
|
1197
|
-
img {
|
|
1198
|
-
transform: scale(0.8);
|
|
1199
|
-
filter: var(--key_filter);
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
&:nth-child(2) {
|
|
1205
|
-
flex: 1;
|
|
1206
|
-
|
|
1207
|
-
img {
|
|
1208
|
-
transform: scale(0.8);
|
|
1209
|
-
filter: var(--key_filter);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1164
|
+
img {
|
|
1165
|
+
transform: scale(0.8);
|
|
1166
|
+
filter: var(--key_filter);
|
|
1213
1167
|
}
|
|
1168
|
+
}
|
|
1214
1169
|
}
|
|
1170
|
+
}
|
|
1215
1171
|
}
|
|
1172
|
+
}
|
|
1216
1173
|
}
|
|
1217
1174
|
|
|
1218
1175
|
// 显示动画
|
|
1219
1176
|
.keyboardcon {
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1177
|
+
transition: all 0.3s ease-in-out;
|
|
1178
|
+
transform: translateY(100%);
|
|
1179
|
+
opacity: 0;
|
|
1223
1180
|
}
|
|
1224
1181
|
|
|
1225
1182
|
.show {
|
|
1226
|
-
|
|
1227
|
-
|
|
1183
|
+
transform: translateY(0%);
|
|
1184
|
+
opacity: 1;
|
|
1228
1185
|
}
|
|
1229
1186
|
</style>
|