@composy/keyboard-vue 0.0.1
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 +46 -0
- package/dist/index.css +797 -0
- package/dist/index.js +1250 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/es/components/KeyboardKey.js +17 -0
- package/es/components/KeyboardKey.js.map +1 -0
- package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js +131 -0
- package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/KeyboardPopup.js +17 -0
- package/es/components/KeyboardPopup.js.map +1 -0
- package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js +164 -0
- package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/LicensePlateKeyboard.js +17 -0
- package/es/components/LicensePlateKeyboard.js.map +1 -0
- package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js +97 -0
- package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/VirtualKeyboard.js +17 -0
- package/es/components/VirtualKeyboard.js.map +1 -0
- package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js +127 -0
- package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/es/components/index.d.ts +9 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +15 -0
- package/es/composables/index.d.ts +7 -0
- package/es/composables/index.d.ts.map +1 -0
- package/es/composables/index.js +13 -0
- package/es/composables/useKeyboard.d.ts +113 -0
- package/es/composables/useKeyboard.d.ts.map +1 -0
- package/es/composables/useKeyboard.js +75 -0
- package/es/composables/useKeyboard.js.map +1 -0
- package/es/composables/useKeyboardPopup.d.ts +73 -0
- package/es/composables/useKeyboardPopup.d.ts.map +1 -0
- package/es/composables/useKeyboardPopup.js +119 -0
- package/es/composables/useKeyboardPopup.js.map +1 -0
- package/es/directives/index.d.ts +6 -0
- package/es/directives/index.d.ts.map +1 -0
- package/es/directives/index.js +12 -0
- package/es/directives/v-keyboard.d.ts +36 -0
- package/es/directives/v-keyboard.d.ts.map +1 -0
- package/es/directives/v-keyboard.js +65 -0
- package/es/directives/v-keyboard.js.map +1 -0
- package/es/index.d.ts +42 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +34 -0
- package/es/index.js.map +1 -0
- package/es/plugins/engine-plugin.d.ts +37 -0
- package/es/plugins/engine-plugin.d.ts.map +1 -0
- package/es/plugins/engine-plugin.js +37 -0
- package/es/plugins/engine-plugin.js.map +1 -0
- package/es/plugins/index.d.ts +6 -0
- package/es/plugins/index.d.ts.map +1 -0
- package/es/plugins/index.js +12 -0
- package/es/style/css.js +1 -0
- package/es/style/index.js +1 -0
- package/es/style/index.less +1 -0
- package/es/styles/index.less +267 -0
- package/es/styles/keyboard.less +399 -0
- package/es/styles/themes.less +233 -0
- package/lib/components/KeyboardKey.cjs +21 -0
- package/lib/components/KeyboardKey.cjs.map +1 -0
- package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs +131 -0
- package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/KeyboardPopup.cjs +21 -0
- package/lib/components/KeyboardPopup.cjs.map +1 -0
- package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs +164 -0
- package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/LicensePlateKeyboard.cjs +21 -0
- package/lib/components/LicensePlateKeyboard.cjs.map +1 -0
- package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs +97 -0
- package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/VirtualKeyboard.cjs +21 -0
- package/lib/components/VirtualKeyboard.cjs.map +1 -0
- package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs +127 -0
- package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/lib/components/index.cjs +19 -0
- package/lib/components/index.d.ts +9 -0
- package/lib/composables/index.cjs +15 -0
- package/lib/composables/index.d.ts +7 -0
- package/lib/composables/useKeyboard.cjs +76 -0
- package/lib/composables/useKeyboard.cjs.map +1 -0
- package/lib/composables/useKeyboard.d.ts +113 -0
- package/lib/composables/useKeyboardPopup.cjs +120 -0
- package/lib/composables/useKeyboardPopup.cjs.map +1 -0
- package/lib/composables/useKeyboardPopup.d.ts +73 -0
- package/lib/directives/index.cjs +13 -0
- package/lib/directives/index.d.ts +6 -0
- package/lib/directives/v-keyboard.cjs +66 -0
- package/lib/directives/v-keyboard.cjs.map +1 -0
- package/lib/directives/v-keyboard.d.ts +36 -0
- package/lib/index.cjs +537 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.ts +42 -0
- package/lib/package.json +3 -0
- package/lib/plugins/engine-plugin.cjs +37 -0
- package/lib/plugins/engine-plugin.cjs.map +1 -0
- package/lib/plugins/engine-plugin.d.ts +37 -0
- package/lib/plugins/index.cjs +13 -0
- package/lib/plugins/index.d.ts +6 -0
- package/lib/style/css.js +1 -0
- package/lib/style/index.css +2 -0
- package/lib/style/index.js +1 -0
- package/lib/styles/index.css +229 -0
- package/lib/styles/keyboard.css +346 -0
- package/lib/styles/themes.css +213 -0
- package/package.json +141 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import VirtualKeyboard_default from "./VirtualKeyboard.js";
|
|
11
|
+
import { useKeyboard } from "../composables/useKeyboard.js";
|
|
12
|
+
import { useKeyboardPopup } from "../composables/useKeyboardPopup.js";
|
|
13
|
+
import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, openBlock, ref, unref, watch, withCtx, withModifiers } from "vue";
|
|
14
|
+
import { isMobile } from "@composy/keyboard-core";
|
|
15
|
+
//#region src/components/KeyboardPopup.vue?vue&type=script&setup=true&lang.ts
|
|
16
|
+
var KeyboardPopup_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
17
|
+
__name: "KeyboardPopup",
|
|
18
|
+
props: {
|
|
19
|
+
modelValue: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: false,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
type: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: false,
|
|
27
|
+
default: "qwerty"
|
|
28
|
+
},
|
|
29
|
+
value: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
default: ""
|
|
33
|
+
},
|
|
34
|
+
target: {
|
|
35
|
+
type: null,
|
|
36
|
+
required: false,
|
|
37
|
+
default: null
|
|
38
|
+
},
|
|
39
|
+
maxLength: {
|
|
40
|
+
type: Number,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
closeOnClickOutside: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
required: false,
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
48
|
+
enableVibrate: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
required: false,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
teleportTo: {
|
|
54
|
+
type: null,
|
|
55
|
+
required: false,
|
|
56
|
+
default: "body"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
emits: [
|
|
60
|
+
"update:modelValue",
|
|
61
|
+
"update:value",
|
|
62
|
+
"confirm",
|
|
63
|
+
"keypress"
|
|
64
|
+
],
|
|
65
|
+
setup(__props, { emit: __emit }) {
|
|
66
|
+
const props = __props;
|
|
67
|
+
const emit = __emit;
|
|
68
|
+
const popupRef = ref(null);
|
|
69
|
+
const targetRef = computed(() => props.target);
|
|
70
|
+
const isMobileDevice = ref(isMobile());
|
|
71
|
+
const keyboard = useKeyboard({
|
|
72
|
+
type: props.type,
|
|
73
|
+
value: props.value,
|
|
74
|
+
maxLength: props.maxLength || (props.type.startsWith("license-plate") ? 7 : void 0),
|
|
75
|
+
enableVibrate: props.enableVibrate
|
|
76
|
+
});
|
|
77
|
+
const { popupStyles, maskStyles, placement, showMask, updatePosition, close: closePopup } = useKeyboardPopup({
|
|
78
|
+
visible: computed(() => props.modelValue),
|
|
79
|
+
target: targetRef,
|
|
80
|
+
popup: popupRef,
|
|
81
|
+
closeOnClickOutside: props.closeOnClickOutside,
|
|
82
|
+
onClose: () => {
|
|
83
|
+
emit("update:modelValue", false);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
watch(() => props.type, (newType) => {
|
|
87
|
+
keyboard.switchType(newType);
|
|
88
|
+
if (newType.startsWith("license-plate") && !props.maxLength) keyboard.setMaxLength(7);
|
|
89
|
+
});
|
|
90
|
+
watch(() => props.value, (newValue) => {
|
|
91
|
+
if (newValue !== keyboard.value.value) keyboard.setValue(newValue);
|
|
92
|
+
});
|
|
93
|
+
watch(keyboard.value, (newValue) => {
|
|
94
|
+
emit("update:value", newValue);
|
|
95
|
+
});
|
|
96
|
+
watch(() => props.modelValue, (visible) => {
|
|
97
|
+
if (visible) {
|
|
98
|
+
isMobileDevice.value = isMobile();
|
|
99
|
+
if (props.target) keyboard.bindInput(props.target);
|
|
100
|
+
keyboard.show(props.target ?? void 0);
|
|
101
|
+
nextTick(() => {
|
|
102
|
+
updatePosition();
|
|
103
|
+
});
|
|
104
|
+
} else keyboard.hide();
|
|
105
|
+
});
|
|
106
|
+
keyboard.on("confirm", ({ value }) => {
|
|
107
|
+
emit("confirm", value);
|
|
108
|
+
emit("update:modelValue", false);
|
|
109
|
+
});
|
|
110
|
+
const handleKeyPress = (key) => {
|
|
111
|
+
keyboard.handleKey(key);
|
|
112
|
+
emit("keypress", key);
|
|
113
|
+
};
|
|
114
|
+
const handleSelectOption = (option) => {
|
|
115
|
+
let valueToAppend = option;
|
|
116
|
+
if (option.startsWith("@") && keyboard.value.value.endsWith("@")) valueToAppend = option.slice(1);
|
|
117
|
+
keyboard.appendValue(valueToAppend);
|
|
118
|
+
};
|
|
119
|
+
const handleMaskClick = () => {
|
|
120
|
+
if (props.closeOnClickOutside) emit("update:modelValue", false);
|
|
121
|
+
};
|
|
122
|
+
const popupClass = computed(() => {
|
|
123
|
+
return [
|
|
124
|
+
"keyboard-popup",
|
|
125
|
+
`keyboard-popup--${placement.value}`,
|
|
126
|
+
{
|
|
127
|
+
"keyboard-popup--mobile": isMobileDevice.value,
|
|
128
|
+
"keyboard-popup--desktop": !isMobileDevice.value
|
|
129
|
+
}
|
|
130
|
+
];
|
|
131
|
+
});
|
|
132
|
+
return (_ctx, _cache) => {
|
|
133
|
+
return openBlock(), createBlock(Teleport, { to: __props.teleportTo }, [createVNode(Transition, { name: "keyboard-mask" }, {
|
|
134
|
+
default: withCtx(() => [__props.modelValue && unref(showMask) ? (openBlock(), createElementBlock("div", {
|
|
135
|
+
key: 0,
|
|
136
|
+
class: "keyboard-mask",
|
|
137
|
+
style: normalizeStyle(unref(maskStyles)),
|
|
138
|
+
onClick: handleMaskClick
|
|
139
|
+
}, null, 4)) : createCommentVNode("v-if", true)]),
|
|
140
|
+
_: 1
|
|
141
|
+
}), createVNode(Transition, { name: isMobileDevice.value ? "keyboard-slide" : "keyboard-fade" }, {
|
|
142
|
+
default: withCtx(() => [__props.modelValue ? (openBlock(), createElementBlock("div", {
|
|
143
|
+
key: 0,
|
|
144
|
+
ref_key: "popupRef",
|
|
145
|
+
ref: popupRef,
|
|
146
|
+
class: normalizeClass(popupClass.value),
|
|
147
|
+
style: normalizeStyle(unref(popupStyles)),
|
|
148
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"])),
|
|
149
|
+
onTouchstart: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"]))
|
|
150
|
+
}, [createVNode(VirtualKeyboard_default, {
|
|
151
|
+
type: unref(keyboard).type.value,
|
|
152
|
+
"is-upper-case": unref(keyboard).isUpperCase.value,
|
|
153
|
+
onKeypress: handleKeyPress,
|
|
154
|
+
onSelectOption: handleSelectOption
|
|
155
|
+
}, null, 8, ["type", "is-upper-case"])], 38)) : createCommentVNode("v-if", true)]),
|
|
156
|
+
_: 1
|
|
157
|
+
}, 8, ["name"])], 8, ["to"]);
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
//#endregion
|
|
162
|
+
export { KeyboardPopup_vue_vue_type_script_setup_true_lang_default as default };
|
|
163
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
164
|
+
//# sourceMappingURL=KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardPopup.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/KeyboardPopup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch, Teleport, Transition, onMounted, onBeforeUnmount, nextTick } from 'vue'\nimport type { KeyboardType, KeyDefinition, KeyboardOptions } from '@composy/keyboard-core'\nimport { isMobile } from '@composy/keyboard-core'\nimport { useKeyboard } from '../composables/useKeyboard'\nimport { useKeyboardPopup } from '../composables/useKeyboardPopup'\nimport VirtualKeyboard from './VirtualKeyboard.vue'\n\nconst props = withDefaults(defineProps<{\n /**\n * 是否显示 (v-model)\n */\n modelValue?: boolean\n /**\n * 键盘类型\n */\n type?: KeyboardType | string\n /**\n * 绑定的输入值 (v-model:value)\n */\n value?: string\n /**\n * 目标输入框元素\n */\n target?: HTMLInputElement | HTMLTextAreaElement | null\n /**\n * 最大输入长度\n */\n maxLength?: number\n /**\n * 点击外部是否关闭\n */\n closeOnClickOutside?: boolean\n /**\n * 是否启用震动反馈\n */\n enableVibrate?: boolean\n /**\n * 挂载目标\n */\n teleportTo?: string | HTMLElement\n}>(), {\n modelValue: false,\n type: 'qwerty',\n value: '',\n target: null,\n closeOnClickOutside: true,\n enableVibrate: true,\n teleportTo: 'body',\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [visible: boolean]\n 'update:value': [value: string]\n 'confirm': [value: string]\n 'keypress': [key: KeyDefinition]\n}>()\n\n// 弹出层 DOM 引用\nconst popupRef = ref<HTMLElement | null>(null)\n\n// 目标元素引用\nconst targetRef = computed(() => props.target as HTMLElement | null)\n\n// 是否移动端\nconst isMobileDevice = ref(isMobile())\n\n// 创建键盘管理器\nconst keyboard = useKeyboard({\n type: props.type as KeyboardType,\n value: props.value,\n maxLength: props.maxLength || (props.type.startsWith('license-plate') ? 7 : undefined),\n enableVibrate: props.enableVibrate,\n})\n\n// 创建弹出层管理\nconst {\n popupStyles,\n maskStyles,\n placement,\n showMask,\n updatePosition,\n close: closePopup,\n} = useKeyboardPopup({\n visible: computed(() => props.modelValue),\n target: targetRef,\n popup: popupRef,\n closeOnClickOutside: props.closeOnClickOutside,\n onClose: () => {\n emit('update:modelValue', false)\n },\n})\n\n// 监听键盘类型变化\nwatch(() => props.type, (newType) => {\n keyboard.switchType(newType as KeyboardType)\n \n // 车牌键盘需要设置默认 maxLength\n if (newType.startsWith('license-plate') && !props.maxLength) {\n keyboard.setMaxLength(7)\n }\n})\n\n// 监听外部 value 变化\nwatch(() => props.value, (newValue) => {\n if (newValue !== keyboard.value.value) {\n keyboard.setValue(newValue)\n }\n})\n\n// 监听键盘内部 value 变化\nwatch(keyboard.value, (newValue) => {\n emit('update:value', newValue)\n})\n\n// 监听可见性变化\nwatch(() => props.modelValue, (visible) => {\n if (visible) {\n isMobileDevice.value = isMobile()\n if (props.target) {\n keyboard.bindInput(props.target)\n }\n keyboard.show(props.target ?? undefined)\n \n nextTick(() => {\n updatePosition()\n })\n } else {\n keyboard.hide()\n }\n})\n\n// 监听确认事件\nkeyboard.on('confirm', ({ value }) => {\n emit('confirm', value)\n emit('update:modelValue', false)\n})\n\n/**\n * 处理按键\n */\nconst handleKeyPress = (key: KeyDefinition) => {\n keyboard.handleKey(key)\n emit('keypress', key)\n}\n\n/**\n * 处理下拉选项选择(如邮箱后缀)\n */\nconst handleSelectOption = (option: string) => {\n let valueToAppend = option\n \n // 智能处理邮箱后缀:如果当前值已以 @ 结尾,而选项以 @ 开头,则去掉选项的 @\n if (option.startsWith('@') && keyboard.value.value.endsWith('@')) {\n valueToAppend = option.slice(1) // 去掉开头的 @\n }\n \n keyboard.appendValue(valueToAppend)\n}\n\n/**\n * 处理遮罩点击\n */\nconst handleMaskClick = () => {\n if (props.closeOnClickOutside) {\n emit('update:modelValue', false)\n }\n}\n\n/**\n * 计算弹出层类名\n */\nconst popupClass = computed(() => {\n return [\n 'keyboard-popup',\n `keyboard-popup--${placement.value}`,\n {\n 'keyboard-popup--mobile': isMobileDevice.value,\n 'keyboard-popup--desktop': !isMobileDevice.value,\n },\n ]\n})\n</script>\n\n<template>\n <Teleport :to=\"teleportTo\">\n <Transition name=\"keyboard-mask\">\n <div\n v-if=\"modelValue && showMask\"\n class=\"keyboard-mask\"\n :style=\"maskStyles\"\n @click=\"handleMaskClick\"\n />\n </Transition>\n\n <Transition :name=\"isMobileDevice ? 'keyboard-slide' : 'keyboard-fade'\">\n <div\n v-if=\"modelValue\"\n ref=\"popupRef\"\n :class=\"popupClass\"\n :style=\"popupStyles\"\n @mousedown.prevent\n @touchstart.prevent\n >\n <VirtualKeyboard\n :type=\"keyboard.type.value\"\n :is-upper-case=\"keyboard.isUpperCase.value\"\n @keypress=\"handleKeyPress\"\n @select-option=\"handleSelectOption\"\n />\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style>\n.keyboard-popup {\n background-color: var(--keyboard-bg, #d1d5db);\n box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n}\n\n.keyboard-popup--desktop {\n border-radius: 12px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);\n min-width: 320px;\n}\n\n.keyboard-popup--mobile {\n border-radius: 0;\n padding-bottom: env(safe-area-inset-bottom, 0);\n}\n\n.keyboard-popup--bottom-sheet {\n border-top-left-radius: 16px;\n border-top-right-radius: 16px;\n}\n\n.keyboard-mask {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.5);\n z-index: 999;\n}\n\n/* 遮罩动画 */\n.keyboard-mask-enter-active,\n.keyboard-mask-leave-active {\n transition: opacity 0.3s ease;\n}\n\n.keyboard-mask-enter-from,\n.keyboard-mask-leave-to {\n opacity: 0;\n}\n\n/* PC 端淡入淡出动画 */\n.keyboard-fade-enter-active,\n.keyboard-fade-leave-active {\n transition: opacity 0.2s ease, transform 0.2s ease;\n}\n\n.keyboard-fade-enter-from,\n.keyboard-fade-leave-to {\n opacity: 0;\n transform: translateY(-10px);\n}\n\n/* 移动端滑入滑出动画 */\n.keyboard-slide-enter-active,\n.keyboard-slide-leave-active {\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.keyboard-slide-enter-from,\n.keyboard-slide-leave-to {\n transform: translateY(100%);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA,MAAM,QAAQ;EA2Cd,MAAM,OAAO;EAQb,MAAM,WAAW,IAAwB,IAAI;EAG7C,MAAM,YAAY,eAAe,MAAM,MAA4B;EAGnE,MAAM,iBAAiB,IAAI,SAAS,CAAC;EAGrC,MAAM,WAAW,YAAY;GAC3B,MAAM,MAAM;GACZ,OAAO,MAAM;GACb,WAAW,MAAM,cAAc,MAAM,KAAK,WAAW,eAAe,IAAI,IAAI,KAAA;GAC5E,eAAe,MAAM;EACvB,CAAC;EAGD,MAAM,EACJ,aACA,YACA,WACA,UACA,gBACA,OAAO,eACL,iBAAiB;GACnB,SAAS,eAAe,MAAM,UAAU;GACxC,QAAQ;GACR,OAAO;GACP,qBAAqB,MAAM;GAC3B,eAAe;IACb,KAAK,qBAAqB,KAAK;GACjC;EACF,CAAC;EAGD,YAAY,MAAM,OAAO,YAAY;GACnC,SAAS,WAAW,OAAuB;GAG3C,IAAI,QAAQ,WAAW,eAAe,KAAK,CAAC,MAAM,WAChD,SAAS,aAAa,CAAC;EAE3B,CAAC;EAGD,YAAY,MAAM,QAAQ,aAAa;GACrC,IAAI,aAAa,SAAS,MAAM,OAC9B,SAAS,SAAS,QAAQ;EAE9B,CAAC;EAGD,MAAM,SAAS,QAAQ,aAAa;GAClC,KAAK,gBAAgB,QAAQ;EAC/B,CAAC;EAGD,YAAY,MAAM,aAAa,YAAY;GACzC,IAAI,SAAS;IACX,eAAe,QAAQ,SAAS;IAChC,IAAI,MAAM,QACR,SAAS,UAAU,MAAM,MAAM;IAEjC,SAAS,KAAK,MAAM,UAAU,KAAA,CAAS;IAEvC,eAAe;KACb,eAAe;IACjB,CAAC;GACH,OACE,SAAS,KAAK;EAElB,CAAC;EAGD,SAAS,GAAG,YAAY,EAAE,YAAY;GACpC,KAAK,WAAW,KAAK;GACrB,KAAK,qBAAqB,KAAK;EACjC,CAAC;EAKD,MAAM,kBAAkB,QAAuB;GAC7C,SAAS,UAAU,GAAG;GACtB,KAAK,YAAY,GAAG;EACtB;EAKA,MAAM,sBAAsB,WAAmB;GAC7C,IAAI,gBAAgB;GAGpB,IAAI,OAAO,WAAW,GAAG,KAAK,SAAS,MAAM,MAAM,SAAS,GAAG,GAC7D,gBAAgB,OAAO,MAAM,CAAC;GAGhC,SAAS,YAAY,aAAa;EACpC;EAKA,MAAM,wBAAwB;GAC5B,IAAI,MAAM,qBACR,KAAK,qBAAqB,KAAK;EAEnC;EAKA,MAAM,aAAa,eAAe;GAChC,OAAO;IACL;IACA,mBAAmB,UAAU;IAC7B;KACE,0BAA0B,eAAe;KACzC,2BAA2B,CAAC,eAAe;IAC7C;GACF;EACF,CAAC;;uBAIC,YA2BW,UAAA,EA3BA,IAAI,QAAA,WAAU,GAAA,CACvB,YAOa,YAAA,EAPD,MAAK,gBAAe,GAAA;2BAM5B,CAJM,QAAA,cAAc,MAAA,QAAA,KAAA,UAAA,GADtB,mBAKE,OAAA;;KAHA,OAAM;KACL,OAAK,eAAE,MAAA,UAAA,CAAU;KACjB,SAAO;;;OAIZ,YAgBa,YAAA,EAhBA,MAAM,eAAA,QAAc,mBAAA,gBAAA,GAAA;2BAezB,CAbE,QAAA,cAAA,UAAA,GADR,mBAcM,OAAA;;cAZA;KAAJ,KAAI;KACH,OAAK,eAAE,WAAA,KAAU;KACjB,OAAK,eAAE,MAAA,WAAA,CAAW;KAClB,aAAS,OAAA,OAAA,OAAA,KAAA,oBAAV,CAAA,GAAkB,CAAA,SAAA,CAAA;KACjB,cAAU,OAAA,OAAA,OAAA,KAAA,oBAAX,CAAA,GAAmB,CAAA,SAAA,CAAA;QAEnB,YAKE,yBAAA;KAJC,MAAM,MAAA,QAAA,CAAA,CAAS,KAAK;KACpB,iBAAe,MAAA,QAAA,CAAA,CAAS,YAAY;KACpC,YAAU;KACV,gBAAe"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import LicensePlateKeyboard_vue_vue_type_script_setup_true_lang_default from "./LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js";
|
|
11
|
+
//#region src/components/LicensePlateKeyboard.vue
|
|
12
|
+
LicensePlateKeyboard_vue_vue_type_script_setup_true_lang_default.__file = "src/components/LicensePlateKeyboard.vue";
|
|
13
|
+
var LicensePlateKeyboard_default = LicensePlateKeyboard_vue_vue_type_script_setup_true_lang_default;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { LicensePlateKeyboard_default as default };
|
|
16
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
17
|
+
//# sourceMappingURL=LicensePlateKeyboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LicensePlateKeyboard.js","names":[],"sources":["../../src/components/LicensePlateKeyboard.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * 智能车牌号键盘组件\n * 核心逻辑在 KeyboardManager 中实现自动切换\n * Vue 组件只负责 UI 展示和状态同步\n */\nimport { computed, watch } from 'vue'\nimport type { KeyDefinition } from '@composy/keyboard-core'\nimport { useKeyboard } from '../composables/useKeyboard'\nimport VirtualKeyboard from './VirtualKeyboard.vue'\n\nconst props = withDefaults(defineProps<{\n /**\n * 当前车牌号值(双向绑定)\n */\n modelValue?: string\n /**\n * 是否新能源车牌(8位)\n * @default false\n */\n newEnergy?: boolean\n}>(), {\n modelValue: '',\n newEnergy: false,\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n done: [value: string]\n}>()\n\n/**\n * 最大长度\n */\nconst maxLength = computed(() => props.newEnergy ? 8 : 7)\n\n/**\n * 使用 KeyboardManager 管理键盘状态\n */\nconst keyboard = useKeyboard({\n type: 'license-plate-province',\n value: props.modelValue,\n maxLength: maxLength.value,\n enableVibrate: true,\n})\n\n// 监听外部 value 变化\nwatch(() => props.modelValue, (newValue) => {\n if (newValue !== keyboard.value.value) {\n keyboard.setValue(newValue)\n }\n})\n\n// 监听键盘内部 value 变化\nwatch(keyboard.value, (newValue) => {\n emit('update:modelValue', newValue)\n})\n\n// 监听 maxLength 变化\nwatch(maxLength, (newMaxLength) => {\n keyboard.setMaxLength(newMaxLength)\n \n // 如果当前值超过新的最大长度,截断\n if (props.modelValue.length > newMaxLength) {\n const truncated = props.modelValue.slice(0, newMaxLength)\n keyboard.setValue(truncated)\n emit('update:modelValue', truncated)\n }\n})\n\n// 监听确认事件\nkeyboard.on('confirm', ({ value }) => {\n emit('done', value)\n})\n\n/**\n * 处理按键\n */\nconst handleKeyPress = (key: KeyDefinition) => {\n keyboard.handleKey(key)\n}\n\n/**\n * 当前位置提示\n */\nconst positionHint = computed(() => {\n const len = props.modelValue.length\n if (len === 0) return '请选择省份'\n if (len === 1) return '请输入字母'\n if (len < maxLength.value) return `第${len + 1}位`\n return '已完成'\n})\n</script>\n\n<template>\n <div class=\"license-plate-keyboard\">\n <!-- 输入显示区 -->\n <div class=\"license-plate-keyboard__display\">\n <div class=\"license-plate-keyboard__value\">\n <span\n v-for=\"(char, index) in modelValue.padEnd(maxLength, ' ').split('')\"\n :key=\"index\"\n class=\"license-plate-keyboard__char\"\n :class=\"{\n 'license-plate-keyboard__char--filled': char !== ' ',\n 'license-plate-keyboard__char--current': index === modelValue.length,\n 'license-plate-keyboard__char--province': index === 0,\n 'license-plate-keyboard__char--new-energy': newEnergy && index === 7\n }\"\n >\n {{ char === ' ' ? '' : char }}\n </span>\n </div>\n <div class=\"license-plate-keyboard__hint\">{{ positionHint }}</div>\n </div>\n \n <!-- 键盘区 - 由 core 的 KeyboardManager 自动切换布局 -->\n <VirtualKeyboard\n :type=\"keyboard.type.value\"\n :is-upper-case=\"keyboard.isUpperCase.value\"\n @keypress=\"handleKeyPress\"\n />\n </div>\n</template>\n\n<style>\n.license-plate-keyboard {\n display: flex;\n flex-direction: column;\n background: var(--keyboard-bg, #d1d5db);\n}\n\n.license-plate-keyboard__display {\n padding: 14px 20px;\n background: var(--keyboard-display-bg, #f5f5f5);\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n}\n\n.license-plate-keyboard__value {\n display: flex;\n justify-content: center;\n gap: 8px;\n margin-bottom: 8px;\n}\n\n.license-plate-keyboard__char {\n width: 40px;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #fff;\n border: 2px solid #e0e0e0;\n border-radius: 8px;\n font-size: 20px;\n font-weight: 600;\n color: var(--keyboard-key-color, #333);\n transition: border-color 0.2s, background-color 0.2s;\n}\n\n.license-plate-keyboard__char--filled {\n border-color: var(--keyboard-primary-bg, #007aff);\n background: rgba(0, 122, 255, 0.05);\n}\n\n.license-plate-keyboard__char--current {\n border-color: var(--keyboard-primary-bg, #007aff);\n background: rgba(0, 122, 255, 0.1);\n animation: plate-char-pulse 1s infinite;\n}\n\n.license-plate-keyboard__char--province {\n background: rgba(255, 193, 7, 0.1);\n}\n\n.license-plate-keyboard__char--province.license-plate-keyboard__char--filled {\n background: rgba(255, 193, 7, 0.15);\n border-color: #ffc107;\n}\n\n.license-plate-keyboard__char--new-energy {\n background: rgba(34, 197, 94, 0.1);\n}\n\n.license-plate-keyboard__char--new-energy.license-plate-keyboard__char--filled {\n background: rgba(34, 197, 94, 0.15);\n border-color: #22c55e;\n}\n\n@keyframes plate-char-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.6; }\n}\n\n.license-plate-keyboard__hint {\n text-align: center;\n font-size: 12px;\n color: #888;\n}\n\n/* 车牌键盘专用样式 */\n.license-plate-keyboard :deep(.plate-keyboard-row) {\n gap: 4px;\n}\n\n.license-plate-keyboard :deep(.key-plate-province),\n.license-plate-keyboard :deep(.key-plate-letter),\n.license-plate-keyboard :deep(.key-plate-number) {\n min-width: 30px;\n height: 40px;\n font-size: 15px;\n border-radius: var(--keyboard-key-radius, 6px);\n}\n\n.license-plate-keyboard :deep(.key-plate-special) {\n background: rgba(255, 193, 7, 0.2);\n color: #b8860b;\n}\n\n.license-plate-keyboard :deep(.key-plate-fn) {\n background: var(--keyboard-fn-key-bg, #d4d6dc);\n}\n\n.license-plate-keyboard :deep(.key-plate-switch) {\n background: var(--keyboard-fn-key-bg, #d4d6dc);\n font-size: 13px;\n}\n\n.license-plate-keyboard :deep(.key-plate-done) {\n background: var(--keyboard-primary-bg, #007aff);\n color: #fff;\n font-size: 13px;\n}\n</style>\n"],"mappings":""}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import VirtualKeyboard_default from "./VirtualKeyboard.js";
|
|
11
|
+
import { useKeyboard } from "../composables/useKeyboard.js";
|
|
12
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref, watch } from "vue";
|
|
13
|
+
//#region src/components/LicensePlateKeyboard.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
+
const _hoisted_1 = { class: "license-plate-keyboard" };
|
|
15
|
+
const _hoisted_2 = { class: "license-plate-keyboard__display" };
|
|
16
|
+
const _hoisted_3 = { class: "license-plate-keyboard__value" };
|
|
17
|
+
const _hoisted_4 = { class: "license-plate-keyboard__hint" };
|
|
18
|
+
var LicensePlateKeyboard_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "LicensePlateKeyboard",
|
|
20
|
+
props: {
|
|
21
|
+
modelValue: {
|
|
22
|
+
type: String,
|
|
23
|
+
required: false,
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
newEnergy: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
required: false,
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
emits: ["update:modelValue", "done"],
|
|
33
|
+
setup(__props, { emit: __emit }) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const emit = __emit;
|
|
36
|
+
const maxLength = computed(() => props.newEnergy ? 8 : 7);
|
|
37
|
+
const keyboard = useKeyboard({
|
|
38
|
+
type: "license-plate-province",
|
|
39
|
+
value: props.modelValue,
|
|
40
|
+
maxLength: maxLength.value,
|
|
41
|
+
enableVibrate: true
|
|
42
|
+
});
|
|
43
|
+
watch(() => props.modelValue, (newValue) => {
|
|
44
|
+
if (newValue !== keyboard.value.value) keyboard.setValue(newValue);
|
|
45
|
+
});
|
|
46
|
+
watch(keyboard.value, (newValue) => {
|
|
47
|
+
emit("update:modelValue", newValue);
|
|
48
|
+
});
|
|
49
|
+
watch(maxLength, (newMaxLength) => {
|
|
50
|
+
keyboard.setMaxLength(newMaxLength);
|
|
51
|
+
if (props.modelValue.length > newMaxLength) {
|
|
52
|
+
const truncated = props.modelValue.slice(0, newMaxLength);
|
|
53
|
+
keyboard.setValue(truncated);
|
|
54
|
+
emit("update:modelValue", truncated);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
keyboard.on("confirm", ({ value }) => {
|
|
58
|
+
emit("done", value);
|
|
59
|
+
});
|
|
60
|
+
const handleKeyPress = (key) => {
|
|
61
|
+
keyboard.handleKey(key);
|
|
62
|
+
};
|
|
63
|
+
const positionHint = computed(() => {
|
|
64
|
+
const len = props.modelValue.length;
|
|
65
|
+
if (len === 0) return "请选择省份";
|
|
66
|
+
if (len === 1) return "请输入字母";
|
|
67
|
+
if (len < maxLength.value) return `\u7B2C${len + 1}\u4F4D`;
|
|
68
|
+
return "已完成";
|
|
69
|
+
});
|
|
70
|
+
return (_ctx, _cache) => {
|
|
71
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
72
|
+
createCommentVNode(" 输入显示区 "),
|
|
73
|
+
createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.modelValue.padEnd(maxLength.value, " ").split(""), (char, index) => {
|
|
74
|
+
return openBlock(), createElementBlock("span", {
|
|
75
|
+
key: index,
|
|
76
|
+
class: normalizeClass(["license-plate-keyboard__char", {
|
|
77
|
+
"license-plate-keyboard__char--filled": char !== " ",
|
|
78
|
+
"license-plate-keyboard__char--current": index === __props.modelValue.length,
|
|
79
|
+
"license-plate-keyboard__char--province": index === 0,
|
|
80
|
+
"license-plate-keyboard__char--new-energy": __props.newEnergy && index === 7
|
|
81
|
+
}])
|
|
82
|
+
}, toDisplayString(char === " " ? "" : char), 3);
|
|
83
|
+
}), 128))]), createElementVNode("div", _hoisted_4, toDisplayString(positionHint.value), 1)]),
|
|
84
|
+
createCommentVNode(" 键盘区 - 由 core 的 KeyboardManager 自动切换布局 "),
|
|
85
|
+
createVNode(VirtualKeyboard_default, {
|
|
86
|
+
type: unref(keyboard).type.value,
|
|
87
|
+
"is-upper-case": unref(keyboard).isUpperCase.value,
|
|
88
|
+
onKeypress: handleKeyPress
|
|
89
|
+
}, null, 8, ["type", "is-upper-case"])
|
|
90
|
+
]);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
//#endregion
|
|
95
|
+
export { LicensePlateKeyboard_vue_vue_type_script_setup_true_lang_default as default };
|
|
96
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
97
|
+
//# sourceMappingURL=LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/LicensePlateKeyboard.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * 智能车牌号键盘组件\n * 核心逻辑在 KeyboardManager 中实现自动切换\n * Vue 组件只负责 UI 展示和状态同步\n */\nimport { computed, watch } from 'vue'\nimport type { KeyDefinition } from '@composy/keyboard-core'\nimport { useKeyboard } from '../composables/useKeyboard'\nimport VirtualKeyboard from './VirtualKeyboard.vue'\n\nconst props = withDefaults(defineProps<{\n /**\n * 当前车牌号值(双向绑定)\n */\n modelValue?: string\n /**\n * 是否新能源车牌(8位)\n * @default false\n */\n newEnergy?: boolean\n}>(), {\n modelValue: '',\n newEnergy: false,\n})\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n done: [value: string]\n}>()\n\n/**\n * 最大长度\n */\nconst maxLength = computed(() => props.newEnergy ? 8 : 7)\n\n/**\n * 使用 KeyboardManager 管理键盘状态\n */\nconst keyboard = useKeyboard({\n type: 'license-plate-province',\n value: props.modelValue,\n maxLength: maxLength.value,\n enableVibrate: true,\n})\n\n// 监听外部 value 变化\nwatch(() => props.modelValue, (newValue) => {\n if (newValue !== keyboard.value.value) {\n keyboard.setValue(newValue)\n }\n})\n\n// 监听键盘内部 value 变化\nwatch(keyboard.value, (newValue) => {\n emit('update:modelValue', newValue)\n})\n\n// 监听 maxLength 变化\nwatch(maxLength, (newMaxLength) => {\n keyboard.setMaxLength(newMaxLength)\n \n // 如果当前值超过新的最大长度,截断\n if (props.modelValue.length > newMaxLength) {\n const truncated = props.modelValue.slice(0, newMaxLength)\n keyboard.setValue(truncated)\n emit('update:modelValue', truncated)\n }\n})\n\n// 监听确认事件\nkeyboard.on('confirm', ({ value }) => {\n emit('done', value)\n})\n\n/**\n * 处理按键\n */\nconst handleKeyPress = (key: KeyDefinition) => {\n keyboard.handleKey(key)\n}\n\n/**\n * 当前位置提示\n */\nconst positionHint = computed(() => {\n const len = props.modelValue.length\n if (len === 0) return '请选择省份'\n if (len === 1) return '请输入字母'\n if (len < maxLength.value) return `第${len + 1}位`\n return '已完成'\n})\n</script>\n\n<template>\n <div class=\"license-plate-keyboard\">\n <!-- 输入显示区 -->\n <div class=\"license-plate-keyboard__display\">\n <div class=\"license-plate-keyboard__value\">\n <span\n v-for=\"(char, index) in modelValue.padEnd(maxLength, ' ').split('')\"\n :key=\"index\"\n class=\"license-plate-keyboard__char\"\n :class=\"{\n 'license-plate-keyboard__char--filled': char !== ' ',\n 'license-plate-keyboard__char--current': index === modelValue.length,\n 'license-plate-keyboard__char--province': index === 0,\n 'license-plate-keyboard__char--new-energy': newEnergy && index === 7\n }\"\n >\n {{ char === ' ' ? '' : char }}\n </span>\n </div>\n <div class=\"license-plate-keyboard__hint\">{{ positionHint }}</div>\n </div>\n \n <!-- 键盘区 - 由 core 的 KeyboardManager 自动切换布局 -->\n <VirtualKeyboard\n :type=\"keyboard.type.value\"\n :is-upper-case=\"keyboard.isUpperCase.value\"\n @keypress=\"handleKeyPress\"\n />\n </div>\n</template>\n\n<style>\n.license-plate-keyboard {\n display: flex;\n flex-direction: column;\n background: var(--keyboard-bg, #d1d5db);\n}\n\n.license-plate-keyboard__display {\n padding: 14px 20px;\n background: var(--keyboard-display-bg, #f5f5f5);\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n}\n\n.license-plate-keyboard__value {\n display: flex;\n justify-content: center;\n gap: 8px;\n margin-bottom: 8px;\n}\n\n.license-plate-keyboard__char {\n width: 40px;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #fff;\n border: 2px solid #e0e0e0;\n border-radius: 8px;\n font-size: 20px;\n font-weight: 600;\n color: var(--keyboard-key-color, #333);\n transition: border-color 0.2s, background-color 0.2s;\n}\n\n.license-plate-keyboard__char--filled {\n border-color: var(--keyboard-primary-bg, #007aff);\n background: rgba(0, 122, 255, 0.05);\n}\n\n.license-plate-keyboard__char--current {\n border-color: var(--keyboard-primary-bg, #007aff);\n background: rgba(0, 122, 255, 0.1);\n animation: plate-char-pulse 1s infinite;\n}\n\n.license-plate-keyboard__char--province {\n background: rgba(255, 193, 7, 0.1);\n}\n\n.license-plate-keyboard__char--province.license-plate-keyboard__char--filled {\n background: rgba(255, 193, 7, 0.15);\n border-color: #ffc107;\n}\n\n.license-plate-keyboard__char--new-energy {\n background: rgba(34, 197, 94, 0.1);\n}\n\n.license-plate-keyboard__char--new-energy.license-plate-keyboard__char--filled {\n background: rgba(34, 197, 94, 0.15);\n border-color: #22c55e;\n}\n\n@keyframes plate-char-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.6; }\n}\n\n.license-plate-keyboard__hint {\n text-align: center;\n font-size: 12px;\n color: #888;\n}\n\n/* 车牌键盘专用样式 */\n.license-plate-keyboard :deep(.plate-keyboard-row) {\n gap: 4px;\n}\n\n.license-plate-keyboard :deep(.key-plate-province),\n.license-plate-keyboard :deep(.key-plate-letter),\n.license-plate-keyboard :deep(.key-plate-number) {\n min-width: 30px;\n height: 40px;\n font-size: 15px;\n border-radius: var(--keyboard-key-radius, 6px);\n}\n\n.license-plate-keyboard :deep(.key-plate-special) {\n background: rgba(255, 193, 7, 0.2);\n color: #b8860b;\n}\n\n.license-plate-keyboard :deep(.key-plate-fn) {\n background: var(--keyboard-fn-key-bg, #d4d6dc);\n}\n\n.license-plate-keyboard :deep(.key-plate-switch) {\n background: var(--keyboard-fn-key-bg, #d4d6dc);\n font-size: 13px;\n}\n\n.license-plate-keyboard :deep(.key-plate-done) {\n background: var(--keyboard-primary-bg, #007aff);\n color: #fff;\n font-size: 13px;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EAed,MAAM,OAAO;EAQb,MAAM,YAAY,eAAe,MAAM,YAAY,IAAI,CAAC;EAKxD,MAAM,WAAW,YAAY;GAC3B,MAAM;GACN,OAAO,MAAM;GACb,WAAW,UAAU;GACrB,eAAe;EACjB,CAAC;EAGD,YAAY,MAAM,aAAa,aAAa;GAC1C,IAAI,aAAa,SAAS,MAAM,OAC9B,SAAS,SAAS,QAAQ;EAE9B,CAAC;EAGD,MAAM,SAAS,QAAQ,aAAa;GAClC,KAAK,qBAAqB,QAAQ;EACpC,CAAC;EAGD,MAAM,YAAY,iBAAiB;GACjC,SAAS,aAAa,YAAY;GAGlC,IAAI,MAAM,WAAW,SAAS,cAAc;IAC1C,MAAM,YAAY,MAAM,WAAW,MAAM,GAAG,YAAY;IACxD,SAAS,SAAS,SAAS;IAC3B,KAAK,qBAAqB,SAAS;GACrC;EACF,CAAC;EAGD,SAAS,GAAG,YAAY,EAAE,YAAY;GACpC,KAAK,QAAQ,KAAK;EACpB,CAAC;EAKD,MAAM,kBAAkB,QAAuB;GAC7C,SAAS,UAAU,GAAG;EACxB;EAKA,MAAM,eAAe,eAAe;GAClC,MAAM,MAAM,MAAM,WAAW;GAC7B,IAAI,QAAQ,GAAG,OAAO;GACtB,IAAI,QAAQ,GAAG,OAAO;GACtB,IAAI,MAAM,UAAU,OAAO,OAAO,SAAI,MAAM,EAAC;GAC7C,OAAO;EACT,CAAC;;uBAIC,mBA2BM,OA3BN,YA2BM;IA1BJ,mBAAA,SAAA;IACA,mBAiBM,OAjBN,YAiBM,CAhBJ,mBAcM,OAdN,YAcM,EAAA,UAAA,IAAA,GAbJ,mBAYO,UAAA,MAAA,WAXmB,QAAA,WAAW,OAAO,UAAA,OAAS,GAAA,CAAA,CAAO,MAAK,EAAA,IAAvD,MAAM,UAAK;yBADrB,mBAYO,QAAA;MAVJ,KAAK;MACN,OAAK,eAAA,CAAC,gCAA8B;+CAC0B,SAAI;gDAA+D,UAAU,QAAA,WAAW;iDAA8D,UAAK;mDAAgE,QAAA,aAAa,UAAK;;wBAOxS,SAAI,MAAA,KAAgB,IAAI,GAAA,CAAA;iBAG/B,mBAAkE,OAAlE,YAAkE,gBAArB,aAAA,KAAY,GAAA,CAAA,CAAA,CAAA;IAG3D,mBAAA,yCAAA;IACA,YAIE,yBAAA;KAHC,MAAM,MAAA,QAAA,CAAA,CAAS,KAAK;KACpB,iBAAe,MAAA,QAAA,CAAA,CAAS,YAAY;KACpC,YAAU"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import VirtualKeyboard_vue_vue_type_script_setup_true_lang_default from "./VirtualKeyboard.vue_vue_type_script_setup_true_lang.js";
|
|
11
|
+
//#region src/components/VirtualKeyboard.vue
|
|
12
|
+
VirtualKeyboard_vue_vue_type_script_setup_true_lang_default.__file = "src/components/VirtualKeyboard.vue";
|
|
13
|
+
var VirtualKeyboard_default = VirtualKeyboard_vue_vue_type_script_setup_true_lang_default;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { VirtualKeyboard_default as default };
|
|
16
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
17
|
+
//# sourceMappingURL=VirtualKeyboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualKeyboard.js","names":[],"sources":["../../src/components/VirtualKeyboard.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\nimport type {\n KeyboardConfig,\n KeyboardType,\n KeyDefinition,\n} from '@composy/keyboard-core'\nimport { getLayout } from '@composy/keyboard-core'\nimport KeyboardKey from './KeyboardKey.vue'\n\nconst props = withDefaults(defineProps<{\n /**\n * 键盘类型\n */\n type?: KeyboardType | string\n /**\n * 是否大写状态\n */\n isUpperCase?: boolean\n /**\n * 自定义布局配置\n */\n layout?: KeyboardConfig\n /**\n * 按键基础宽度\n */\n keyWidth?: number\n}>(), {\n type: 'qwerty',\n isUpperCase: false,\n keyWidth: 36,\n})\n\nconst emit = defineEmits<{\n keypress: [key: KeyDefinition]\n selectOption: [option: string]\n}>()\n\n/**\n * 选项面板状态\n */\nconst showOptionsPanel = ref(false)\nconst currentOptions = ref<string[]>([])\n\n/**\n * 当前布局配置\n */\nconst currentLayout = computed(() => {\n if (props.layout) {\n return props.layout\n }\n return getLayout(props.type) ?? null\n})\n\n/**\n * 处理按键\n */\nconst handleKeyPress = (key: KeyDefinition) => {\n emit('keypress', key)\n}\n\n/**\n * 显示选项面板\n */\nconst handleShowOptions = (options: string[]) => {\n currentOptions.value = options\n showOptionsPanel.value = true\n}\n\n/**\n * 处理选项选择\n */\nconst handleSelectOption = (option: string, event: MouseEvent | TouchEvent) => {\n event.preventDefault()\n event.stopPropagation()\n showOptionsPanel.value = false\n emit('selectOption', option)\n}\n\n/**\n * 关闭选项面板\n */\nconst closeOptionsPanel = () => {\n showOptionsPanel.value = false\n}\n\n/**\n * 计算每行的总宽度,用于居中对齐\n */\nconst getRowStyle = (rowIndex: number) => {\n // 可以根据需要添加行样式\n return {}\n}\n</script>\n\n<template>\n <div class=\"virtual-keyboard\">\n <template v-if=\"currentLayout\">\n <div\n v-for=\"(row, rowIndex) in currentLayout.rows\"\n :key=\"rowIndex\"\n class=\"virtual-keyboard__row\"\n :class=\"row.className\"\n :style=\"getRowStyle(rowIndex)\"\n >\n <KeyboardKey\n v-for=\"key in row.keys\"\n :key=\"key.id\"\n :key-def=\"key\"\n :is-upper-case=\"isUpperCase\"\n :base-width=\"keyWidth\"\n :use-flex=\"row.className === 'numpad-row'\"\n @press=\"handleKeyPress\"\n @show-options=\"handleShowOptions\"\n />\n </div>\n </template>\n <div v-else class=\"virtual-keyboard__empty\">\n 键盘布局未找到\n </div>\n\n <!-- 选项面板 -->\n <Transition name=\"options-panel\">\n <div v-if=\"showOptionsPanel\" class=\"keyboard-options-panel\">\n <div class=\"keyboard-options-panel__header\">\n <span class=\"keyboard-options-panel__title\">选择邮箱后缀</span>\n <button class=\"keyboard-options-panel__close\" type=\"button\" @click=\"closeOptionsPanel\" @touchstart.prevent=\"closeOptionsPanel\">\n ×\n </button>\n </div>\n <div class=\"keyboard-options-panel__grid\">\n <button\n v-for=\"option in currentOptions\"\n :key=\"option\"\n class=\"keyboard-options-panel__item\"\n type=\"button\"\n @mousedown.prevent=\"(e) => handleSelectOption(option, e)\"\n @touchstart.prevent=\"(e) => handleSelectOption(option, e)\"\n >\n {{ option }}\n </button>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<style>\n.virtual-keyboard {\n --key-gap: var(--keyboard-key-gap, 6px);\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--key-gap);\n padding: var(--keyboard-padding, 6px);\n background-color: var(--keyboard-bg, #d1d5db);\n border-radius: 0;\n user-select: none;\n -webkit-user-select: none;\n overflow: hidden;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;\n}\n\n.virtual-keyboard__row {\n display: flex;\n justify-content: center;\n gap: var(--key-gap);\n width: 100%;\n padding: 0 2px;\n}\n\n/* 数字键盘行样式 - 按钮均匀分布填满宽度 */\n.virtual-keyboard__row.numpad-row {\n justify-content: stretch;\n}\n\n.virtual-keyboard__row.numpad-row .keyboard-key-wrapper {\n flex: 1;\n}\n\n.virtual-keyboard__empty {\n padding: 20px;\n color: #999;\n text-align: center;\n}\n\n/* 全屏选项面板 */\n.keyboard-options-panel {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background: var(--keyboard-bg, #d1d5db);\n z-index: 10;\n display: flex;\n flex-direction: column;\n padding: 8px;\n}\n\n.keyboard-options-panel__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 8px 12px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n margin-bottom: 8px;\n}\n\n.keyboard-options-panel__title {\n font-size: 14px;\n font-weight: 600;\n color: var(--keyboard-key-color, #333);\n}\n\n.keyboard-options-panel__close {\n width: 28px;\n height: 28px;\n border: none;\n border-radius: 50%;\n background: var(--keyboard-fn-key-bg, #d4d6dc);\n color: var(--keyboard-key-color, #666);\n font-size: 18px;\n line-height: 1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.keyboard-options-panel__close:active {\n background: var(--keyboard-fn-key-active-bg, #b8bac0);\n}\n\n.keyboard-options-panel__grid {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 8px;\n flex: 1;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.keyboard-options-panel__item {\n padding: 14px 8px;\n border: none;\n border-radius: 8px;\n background: var(--keyboard-key-bg, #fff);\n color: var(--keyboard-key-color, #333);\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: background-color 0.15s, transform 0.1s;\n}\n\n.keyboard-options-panel__item:active {\n background: var(--keyboard-option-active-bg, #e8e8e8);\n transform: scale(0.96);\n}\n\n/* 面板动画 */\n.options-panel-enter-active,\n.options-panel-leave-active {\n transition: opacity 0.2s ease, transform 0.2s ease;\n}\n\n.options-panel-enter-from,\n.options-panel-leave-to {\n opacity: 0;\n transform: translateY(20px);\n}\n</style>\n"],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import KeyboardKey_default from "./KeyboardKey.js";
|
|
11
|
+
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, ref, renderList, toDisplayString, withCtx, withModifiers } from "vue";
|
|
12
|
+
import { getLayout } from "@composy/keyboard-core";
|
|
13
|
+
//#region src/components/VirtualKeyboard.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
+
const _hoisted_1 = { class: "virtual-keyboard" };
|
|
15
|
+
const _hoisted_2 = {
|
|
16
|
+
key: 1,
|
|
17
|
+
class: "virtual-keyboard__empty"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_3 = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "keyboard-options-panel"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_4 = { class: "keyboard-options-panel__header" };
|
|
24
|
+
const _hoisted_5 = { class: "keyboard-options-panel__grid" };
|
|
25
|
+
const _hoisted_6 = ["onMousedown", "onTouchstart"];
|
|
26
|
+
var VirtualKeyboard_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
27
|
+
__name: "VirtualKeyboard",
|
|
28
|
+
props: {
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
default: "qwerty"
|
|
33
|
+
},
|
|
34
|
+
isUpperCase: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
required: false,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
layout: {
|
|
40
|
+
type: Object,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
keyWidth: {
|
|
44
|
+
type: Number,
|
|
45
|
+
required: false,
|
|
46
|
+
default: 36
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
emits: ["keypress", "selectOption"],
|
|
50
|
+
setup(__props, { emit: __emit }) {
|
|
51
|
+
const props = __props;
|
|
52
|
+
const emit = __emit;
|
|
53
|
+
const showOptionsPanel = ref(false);
|
|
54
|
+
const currentOptions = ref([]);
|
|
55
|
+
const currentLayout = computed(() => {
|
|
56
|
+
if (props.layout) return props.layout;
|
|
57
|
+
return getLayout(props.type) ?? null;
|
|
58
|
+
});
|
|
59
|
+
const handleKeyPress = (key) => {
|
|
60
|
+
emit("keypress", key);
|
|
61
|
+
};
|
|
62
|
+
const handleShowOptions = (options) => {
|
|
63
|
+
currentOptions.value = options;
|
|
64
|
+
showOptionsPanel.value = true;
|
|
65
|
+
};
|
|
66
|
+
const handleSelectOption = (option, event) => {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
showOptionsPanel.value = false;
|
|
70
|
+
emit("selectOption", option);
|
|
71
|
+
};
|
|
72
|
+
const closeOptionsPanel = () => {
|
|
73
|
+
showOptionsPanel.value = false;
|
|
74
|
+
};
|
|
75
|
+
const getRowStyle = (rowIndex) => {
|
|
76
|
+
return {};
|
|
77
|
+
};
|
|
78
|
+
return (_ctx, _cache) => {
|
|
79
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
80
|
+
currentLayout.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(currentLayout.value.rows, (row, rowIndex) => {
|
|
81
|
+
return openBlock(), createElementBlock("div", {
|
|
82
|
+
key: rowIndex,
|
|
83
|
+
class: normalizeClass(["virtual-keyboard__row", row.className]),
|
|
84
|
+
style: normalizeStyle(getRowStyle(rowIndex))
|
|
85
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(row.keys, (key) => {
|
|
86
|
+
return openBlock(), createBlock(KeyboardKey_default, {
|
|
87
|
+
key: key.id,
|
|
88
|
+
"key-def": key,
|
|
89
|
+
"is-upper-case": __props.isUpperCase,
|
|
90
|
+
"base-width": __props.keyWidth,
|
|
91
|
+
"use-flex": row.className === "numpad-row",
|
|
92
|
+
onPress: handleKeyPress,
|
|
93
|
+
onShowOptions: handleShowOptions
|
|
94
|
+
}, null, 8, [
|
|
95
|
+
"key-def",
|
|
96
|
+
"is-upper-case",
|
|
97
|
+
"base-width",
|
|
98
|
+
"use-flex"
|
|
99
|
+
]);
|
|
100
|
+
}), 128))], 6);
|
|
101
|
+
}), 128)) : (openBlock(), createElementBlock("div", _hoisted_2, " 键盘布局未找到 ")),
|
|
102
|
+
createCommentVNode(" 选项面板 "),
|
|
103
|
+
createVNode(Transition, { name: "options-panel" }, {
|
|
104
|
+
default: withCtx(() => [showOptionsPanel.value ? (openBlock(), createElementBlock("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "keyboard-options-panel__title" }, "选择邮箱后缀", -1)), createElementVNode("button", {
|
|
105
|
+
class: "keyboard-options-panel__close",
|
|
106
|
+
type: "button",
|
|
107
|
+
onClick: closeOptionsPanel,
|
|
108
|
+
onTouchstart: withModifiers(closeOptionsPanel, ["prevent"])
|
|
109
|
+
}, " × ", 32)]), createElementVNode("div", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(currentOptions.value, (option) => {
|
|
110
|
+
return openBlock(), createElementBlock("button", {
|
|
111
|
+
key: option,
|
|
112
|
+
class: "keyboard-options-panel__item",
|
|
113
|
+
type: "button",
|
|
114
|
+
onMousedown: withModifiers((e) => handleSelectOption(option, e), ["prevent"]),
|
|
115
|
+
onTouchstart: withModifiers((e) => handleSelectOption(option, e), ["prevent"])
|
|
116
|
+
}, toDisplayString(option), 41, _hoisted_6);
|
|
117
|
+
}), 128))])])) : createCommentVNode("v-if", true)]),
|
|
118
|
+
_: 1
|
|
119
|
+
})
|
|
120
|
+
]);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
//#endregion
|
|
125
|
+
export { VirtualKeyboard_vue_vue_type_script_setup_true_lang_default as default };
|
|
126
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
127
|
+
//# sourceMappingURL=VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirtualKeyboard.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/VirtualKeyboard.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue'\nimport type {\n KeyboardConfig,\n KeyboardType,\n KeyDefinition,\n} from '@composy/keyboard-core'\nimport { getLayout } from '@composy/keyboard-core'\nimport KeyboardKey from './KeyboardKey.vue'\n\nconst props = withDefaults(defineProps<{\n /**\n * 键盘类型\n */\n type?: KeyboardType | string\n /**\n * 是否大写状态\n */\n isUpperCase?: boolean\n /**\n * 自定义布局配置\n */\n layout?: KeyboardConfig\n /**\n * 按键基础宽度\n */\n keyWidth?: number\n}>(), {\n type: 'qwerty',\n isUpperCase: false,\n keyWidth: 36,\n})\n\nconst emit = defineEmits<{\n keypress: [key: KeyDefinition]\n selectOption: [option: string]\n}>()\n\n/**\n * 选项面板状态\n */\nconst showOptionsPanel = ref(false)\nconst currentOptions = ref<string[]>([])\n\n/**\n * 当前布局配置\n */\nconst currentLayout = computed(() => {\n if (props.layout) {\n return props.layout\n }\n return getLayout(props.type) ?? null\n})\n\n/**\n * 处理按键\n */\nconst handleKeyPress = (key: KeyDefinition) => {\n emit('keypress', key)\n}\n\n/**\n * 显示选项面板\n */\nconst handleShowOptions = (options: string[]) => {\n currentOptions.value = options\n showOptionsPanel.value = true\n}\n\n/**\n * 处理选项选择\n */\nconst handleSelectOption = (option: string, event: MouseEvent | TouchEvent) => {\n event.preventDefault()\n event.stopPropagation()\n showOptionsPanel.value = false\n emit('selectOption', option)\n}\n\n/**\n * 关闭选项面板\n */\nconst closeOptionsPanel = () => {\n showOptionsPanel.value = false\n}\n\n/**\n * 计算每行的总宽度,用于居中对齐\n */\nconst getRowStyle = (rowIndex: number) => {\n // 可以根据需要添加行样式\n return {}\n}\n</script>\n\n<template>\n <div class=\"virtual-keyboard\">\n <template v-if=\"currentLayout\">\n <div\n v-for=\"(row, rowIndex) in currentLayout.rows\"\n :key=\"rowIndex\"\n class=\"virtual-keyboard__row\"\n :class=\"row.className\"\n :style=\"getRowStyle(rowIndex)\"\n >\n <KeyboardKey\n v-for=\"key in row.keys\"\n :key=\"key.id\"\n :key-def=\"key\"\n :is-upper-case=\"isUpperCase\"\n :base-width=\"keyWidth\"\n :use-flex=\"row.className === 'numpad-row'\"\n @press=\"handleKeyPress\"\n @show-options=\"handleShowOptions\"\n />\n </div>\n </template>\n <div v-else class=\"virtual-keyboard__empty\">\n 键盘布局未找到\n </div>\n\n <!-- 选项面板 -->\n <Transition name=\"options-panel\">\n <div v-if=\"showOptionsPanel\" class=\"keyboard-options-panel\">\n <div class=\"keyboard-options-panel__header\">\n <span class=\"keyboard-options-panel__title\">选择邮箱后缀</span>\n <button class=\"keyboard-options-panel__close\" type=\"button\" @click=\"closeOptionsPanel\" @touchstart.prevent=\"closeOptionsPanel\">\n ×\n </button>\n </div>\n <div class=\"keyboard-options-panel__grid\">\n <button\n v-for=\"option in currentOptions\"\n :key=\"option\"\n class=\"keyboard-options-panel__item\"\n type=\"button\"\n @mousedown.prevent=\"(e) => handleSelectOption(option, e)\"\n @touchstart.prevent=\"(e) => handleSelectOption(option, e)\"\n >\n {{ option }}\n </button>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<style>\n.virtual-keyboard {\n --key-gap: var(--keyboard-key-gap, 6px);\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: var(--key-gap);\n padding: var(--keyboard-padding, 6px);\n background-color: var(--keyboard-bg, #d1d5db);\n border-radius: 0;\n user-select: none;\n -webkit-user-select: none;\n overflow: hidden;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;\n}\n\n.virtual-keyboard__row {\n display: flex;\n justify-content: center;\n gap: var(--key-gap);\n width: 100%;\n padding: 0 2px;\n}\n\n/* 数字键盘行样式 - 按钮均匀分布填满宽度 */\n.virtual-keyboard__row.numpad-row {\n justify-content: stretch;\n}\n\n.virtual-keyboard__row.numpad-row .keyboard-key-wrapper {\n flex: 1;\n}\n\n.virtual-keyboard__empty {\n padding: 20px;\n color: #999;\n text-align: center;\n}\n\n/* 全屏选项面板 */\n.keyboard-options-panel {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background: var(--keyboard-bg, #d1d5db);\n z-index: 10;\n display: flex;\n flex-direction: column;\n padding: 8px;\n}\n\n.keyboard-options-panel__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 8px 12px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n margin-bottom: 8px;\n}\n\n.keyboard-options-panel__title {\n font-size: 14px;\n font-weight: 600;\n color: var(--keyboard-key-color, #333);\n}\n\n.keyboard-options-panel__close {\n width: 28px;\n height: 28px;\n border: none;\n border-radius: 50%;\n background: var(--keyboard-fn-key-bg, #d4d6dc);\n color: var(--keyboard-key-color, #666);\n font-size: 18px;\n line-height: 1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.keyboard-options-panel__close:active {\n background: var(--keyboard-fn-key-active-bg, #b8bac0);\n}\n\n.keyboard-options-panel__grid {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 8px;\n flex: 1;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.keyboard-options-panel__item {\n padding: 14px 8px;\n border: none;\n border-radius: 8px;\n background: var(--keyboard-key-bg, #fff);\n color: var(--keyboard-key-color, #333);\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: background-color 0.15s, transform 0.1s;\n}\n\n.keyboard-options-panel__item:active {\n background: var(--keyboard-option-active-bg, #e8e8e8);\n transform: scale(0.96);\n}\n\n/* 面板动画 */\n.options-panel-enter-active,\n.options-panel-leave-active {\n transition: opacity 0.2s ease, transform 0.2s ease;\n}\n\n.options-panel-enter-from,\n.options-panel-leave-to {\n opacity: 0;\n transform: translateY(20px);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUA,MAAM,QAAQ;EAuBd,MAAM,OAAO;EAQb,MAAM,mBAAmB,IAAI,KAAK;EAClC,MAAM,iBAAiB,IAAc,CAAC,CAAC;EAKvC,MAAM,gBAAgB,eAAe;GACnC,IAAI,MAAM,QACR,OAAO,MAAM;GAEf,OAAO,UAAU,MAAM,IAAI,KAAK;EAClC,CAAC;EAKD,MAAM,kBAAkB,QAAuB;GAC7C,KAAK,YAAY,GAAG;EACtB;EAKA,MAAM,qBAAqB,YAAsB;GAC/C,eAAe,QAAQ;GACvB,iBAAiB,QAAQ;EAC3B;EAKA,MAAM,sBAAsB,QAAgB,UAAmC;GAC7E,MAAM,eAAe;GACrB,MAAM,gBAAgB;GACtB,iBAAiB,QAAQ;GACzB,KAAK,gBAAgB,MAAM;EAC7B;EAKA,MAAM,0BAA0B;GAC9B,iBAAiB,QAAQ;EAC3B;EAKA,MAAM,eAAe,aAAqB;GAExC,OAAO,CAAC;EACV;;uBAIE,mBAgDM,OAhDN,YAgDM;IA/CY,cAAA,SAAA,UAAA,IAAA,GACd,mBAiBM,UAAA,EAAA,KAAA,EAAA,GAAA,WAhBsB,cAAA,MAAc,OAAhC,KAAK,aAAQ;yBADvB,mBAiBM,OAAA;MAfH,KAAK;MACN,OAAK,eAAA,CAAC,yBACE,IAAI,SAAS,CAAA;MACpB,OAAK,eAAE,YAAY,QAAQ,CAAA;2BAE5B,mBASE,UAAA,MAAA,WARc,IAAI,OAAX,QAAG;0BADZ,YASE,qBAAA;OAPC,KAAK,IAAI;OACT,WAAS;OACT,iBAAe,QAAA;OACf,cAAY,QAAA;OACZ,YAAU,IAAI,cAAS;OACvB,SAAO;OACP,eAAc;;;;;;;;8BAIrB,mBAEM,OAFN,YAA4C,WAE5C;IAEA,mBAAA,QAAA;IACA,YAqBa,YAAA,EArBD,MAAK,gBAAe,GAAA;4BAoBxB,CAnBK,iBAAA,SAAA,UAAA,GAAX,mBAmBM,OAnBN,YAmBM,CAlBJ,mBAKM,OALN,YAKM,CAAA,OAAA,OAAA,OAAA,KAJJ,mBAAyD,QAAA,EAAnD,OAAM,gCAA+B,GAAC,UAAM,EAAA,IAClD,mBAES,UAAA;MAFD,OAAM;MAAgC,MAAK;MAAU,SAAO;MAAoB,cAAU,cAAU,mBAAiB,CAAA,SAAA,CAAA;QAAE,OAE/H,EAAA,CAAA,CAAA,GAEF,mBAWM,OAXN,YAWM,EAAA,UAAA,IAAA,GAVJ,mBASS,UAAA,MAAA,WARU,eAAA,QAAV,WAAM;0BADf,mBASS,UAAA;OAPN,KAAK;OACN,OAAM;OACN,MAAK;OACJ,aAAS,eAAW,MAAM,mBAAmB,QAAQ,CAAC,GAAA,CAAA,SAAA,CAAA;OACtD,cAAU,eAAW,MAAM,mBAAmB,QAAQ,CAAC,GAAA,CAAA,SAAA,CAAA;yBAErD,MAAM,GAAA,IAAA,UAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 组件导出
|
|
3
|
+
* @module components
|
|
4
|
+
*/
|
|
5
|
+
export { default as VirtualKeyboard } from './VirtualKeyboard.vue';
|
|
6
|
+
export { default as KeyboardKey } from './KeyboardKey.vue';
|
|
7
|
+
export { default as KeyboardPopup } from './KeyboardPopup.vue';
|
|
8
|
+
export { default as LicensePlateKeyboard } from './LicensePlateKeyboard.vue';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import KeyboardKey_default from "./KeyboardKey.js";
|
|
11
|
+
import VirtualKeyboard_default from "./VirtualKeyboard.js";
|
|
12
|
+
import KeyboardPopup_default from "./KeyboardPopup.js";
|
|
13
|
+
import LicensePlateKeyboard_default from "./LicensePlateKeyboard.js";
|
|
14
|
+
export { KeyboardKey_default as KeyboardKey, KeyboardPopup_default as KeyboardPopup, LicensePlateKeyboard_default as LicensePlateKeyboard, VirtualKeyboard_default as VirtualKeyboard };
|
|
15
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/keyboard-vue v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:42:14 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
import { useKeyboard } from "./useKeyboard.js";
|
|
11
|
+
import { useKeyboardPopup } from "./useKeyboardPopup.js";
|
|
12
|
+
export { useKeyboard, useKeyboardPopup };
|
|
13
|
+
/*! End of @composy/keyboard-vue | Powered by @composy/builder */
|