@composy/keyboard-core 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -37
- package/dist/index.js +1540 -1395
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2981 -1
- package/dist/index.min.js.map +1 -0
- package/es/.dts-output-manifest.json +1 -0
- package/es/.dts.tsbuildinfo +1 -0
- package/es/icons.d.ts +0 -1
- package/es/icons.js +1 -1
- package/es/icons.js.map +1 -1
- package/es/index.d.ts +3 -4
- package/es/index.js +15 -15
- package/es/layouts/amount.d.ts +0 -1
- package/es/layouts/amount.js +1 -1
- package/es/layouts/amount.js.map +1 -1
- package/es/layouts/bankcard.d.ts +0 -1
- package/es/layouts/bankcard.js +1 -1
- package/es/layouts/bankcard.js.map +1 -1
- package/es/layouts/email.d.ts +0 -1
- package/es/layouts/email.js +1 -1
- package/es/layouts/email.js.map +1 -1
- package/es/layouts/idcard.d.ts +0 -1
- package/es/layouts/idcard.js +1 -1
- package/es/layouts/idcard.js.map +1 -1
- package/es/layouts/index.d.ts +11 -12
- package/es/layouts/index.js +23 -23
- package/es/layouts/index.js.map +1 -1
- package/es/layouts/license-plate.d.ts +0 -1
- package/es/layouts/license-plate.js +1 -1
- package/es/layouts/license-plate.js.map +1 -1
- package/es/layouts/number.d.ts +0 -1
- package/es/layouts/number.js +1 -1
- package/es/layouts/number.js.map +1 -1
- package/es/layouts/phone.d.ts +0 -1
- package/es/layouts/phone.js +1 -1
- package/es/layouts/phone.js.map +1 -1
- package/es/layouts/punct.d.ts +0 -1
- package/es/layouts/punct.js +1 -1
- package/es/layouts/punct.js.map +1 -1
- package/es/layouts/qwerty.d.ts +0 -1
- package/es/layouts/qwerty.js +1 -1
- package/es/layouts/qwerty.js.map +1 -1
- package/es/layouts/search.d.ts +0 -1
- package/es/layouts/search.js +1 -1
- package/es/layouts/search.js.map +1 -1
- package/es/layouts/symbol.d.ts +0 -1
- package/es/layouts/symbol.js +1 -1
- package/es/layouts/symbol.js.map +1 -1
- package/es/layouts/url.d.ts +0 -1
- package/es/layouts/url.js +1 -1
- package/es/layouts/url.js.map +1 -1
- package/es/layouts/verifycode.d.ts +0 -1
- package/es/layouts/verifycode.js +1 -1
- package/es/layouts/verifycode.js.map +1 -1
- package/es/managers/index.d.ts +1 -2
- package/es/managers/index.js +1 -1
- package/es/managers/keyboard-manager.d.ts +2 -1
- package/es/managers/keyboard-manager.js +79 -22
- package/es/managers/keyboard-manager.js.map +1 -1
- package/es/managers/keyboard-renderer.d.ts +3 -2
- package/es/managers/keyboard-renderer.js +81 -39
- package/es/managers/keyboard-renderer.js.map +1 -1
- package/es/managers/position-manager.d.ts +4 -3
- package/es/managers/position-manager.js +42 -21
- package/es/managers/position-manager.js.map +1 -1
- package/es/themes/index.d.ts +1 -2
- package/es/themes/index.js +2 -1
- package/es/themes/index.js.map +1 -1
- package/es/themes/presets.d.ts +0 -1
- package/es/themes/presets.js +1 -1
- package/es/themes/presets.js.map +1 -1
- package/es/themes/types.d.ts +1 -1
- package/es/themes/types.js +1 -1
- package/es/types/index.d.ts +0 -1
- package/es/types/index.js +1 -1
- package/es/types/keyboard.d.ts +0 -1
- package/es/types/keyboard.js +1 -1
- package/es/types/position.d.ts +0 -1
- package/es/types/position.js +1 -1
- package/es/utils/device.d.ts +0 -1
- package/es/utils/device.js +11 -7
- package/es/utils/device.js.map +1 -1
- package/es/utils/dom.d.ts +4 -1
- package/es/utils/dom.js +25 -7
- package/es/utils/dom.js.map +1 -1
- package/es/utils/event-emitter.d.ts +0 -1
- package/es/utils/event-emitter.js +2 -1
- package/es/utils/event-emitter.js.map +1 -1
- package/es/utils/formatters.d.ts +0 -1
- package/es/utils/formatters.js +4 -4
- package/es/utils/formatters.js.map +1 -1
- package/es/utils/index.d.ts +2 -3
- package/es/utils/index.js +5 -5
- package/es/utils/random.d.ts +4 -1
- package/es/utils/random.js +2 -2
- package/es/utils/random.js.map +1 -1
- package/esm/icons.js +1 -1
- package/esm/icons.js.map +1 -1
- package/esm/index.js +15 -15
- package/esm/layouts/amount.js +1 -1
- package/esm/layouts/amount.js.map +1 -1
- package/esm/layouts/bankcard.js +1 -1
- package/esm/layouts/bankcard.js.map +1 -1
- package/esm/layouts/email.js +1 -1
- package/esm/layouts/email.js.map +1 -1
- package/esm/layouts/idcard.js +1 -1
- package/esm/layouts/idcard.js.map +1 -1
- package/esm/layouts/index.js +23 -23
- package/esm/layouts/index.js.map +1 -1
- package/esm/layouts/license-plate.js +1 -1
- package/esm/layouts/license-plate.js.map +1 -1
- package/esm/layouts/number.js +1 -1
- package/esm/layouts/number.js.map +1 -1
- package/esm/layouts/phone.js +1 -1
- package/esm/layouts/phone.js.map +1 -1
- package/esm/layouts/punct.js +1 -1
- package/esm/layouts/punct.js.map +1 -1
- package/esm/layouts/qwerty.js +1 -1
- package/esm/layouts/qwerty.js.map +1 -1
- package/esm/layouts/search.js +1 -1
- package/esm/layouts/search.js.map +1 -1
- package/esm/layouts/symbol.js +1 -1
- package/esm/layouts/symbol.js.map +1 -1
- package/esm/layouts/url.js +1 -1
- package/esm/layouts/url.js.map +1 -1
- package/esm/layouts/verifycode.js +1 -1
- package/esm/layouts/verifycode.js.map +1 -1
- package/esm/managers/index.js +1 -1
- package/esm/managers/keyboard-manager.js +79 -22
- package/esm/managers/keyboard-manager.js.map +1 -1
- package/esm/managers/keyboard-renderer.js +81 -39
- package/esm/managers/keyboard-renderer.js.map +1 -1
- package/esm/managers/position-manager.js +42 -21
- package/esm/managers/position-manager.js.map +1 -1
- package/esm/themes/index.js +2 -1
- package/esm/themes/index.js.map +1 -1
- package/esm/themes/presets.js +1 -1
- package/esm/themes/presets.js.map +1 -1
- package/esm/utils/device.js +11 -7
- package/esm/utils/device.js.map +1 -1
- package/esm/utils/dom.js +25 -7
- package/esm/utils/dom.js.map +1 -1
- package/esm/utils/event-emitter.js +2 -1
- package/esm/utils/event-emitter.js.map +1 -1
- package/esm/utils/formatters.js +4 -4
- package/esm/utils/formatters.js.map +1 -1
- package/esm/utils/random.js +2 -2
- package/esm/utils/random.js.map +1 -1
- package/lib/icons.cjs +1 -1
- package/lib/icons.cjs.map +1 -1
- package/{esm/icons.d.ts → lib/icons.d.cts} +0 -1
- package/lib/index.cjs +14 -13
- package/{esm/index.d.ts → lib/index.d.cts} +3 -4
- package/lib/layouts/amount.cjs +1 -1
- package/lib/layouts/amount.cjs.map +1 -1
- package/{esm/layouts/amount.d.ts → lib/layouts/amount.d.cts} +0 -1
- package/lib/layouts/bankcard.cjs +1 -1
- package/lib/layouts/bankcard.cjs.map +1 -1
- package/{esm/layouts/bankcard.d.ts → lib/layouts/bankcard.d.cts} +0 -1
- package/lib/layouts/email.cjs +1 -1
- package/lib/layouts/email.cjs.map +1 -1
- package/lib/layouts/{email.d.ts → email.d.cts} +0 -1
- package/lib/layouts/idcard.cjs +1 -1
- package/lib/layouts/idcard.cjs.map +1 -1
- package/{esm/layouts/idcard.d.ts → lib/layouts/idcard.d.cts} +0 -1
- package/lib/layouts/index.cjs +23 -23
- package/lib/layouts/index.cjs.map +1 -1
- package/{esm/layouts/index.d.ts → lib/layouts/index.d.cts} +11 -12
- package/lib/layouts/license-plate.cjs +1 -1
- package/lib/layouts/license-plate.cjs.map +1 -1
- package/{esm/layouts/license-plate.d.ts → lib/layouts/license-plate.d.cts} +0 -1
- package/lib/layouts/number.cjs +1 -1
- package/lib/layouts/number.cjs.map +1 -1
- package/{esm/layouts/number.d.ts → lib/layouts/number.d.cts} +0 -1
- package/lib/layouts/phone.cjs +1 -1
- package/lib/layouts/phone.cjs.map +1 -1
- package/lib/layouts/{phone.d.ts → phone.d.cts} +0 -1
- package/lib/layouts/punct.cjs +1 -1
- package/lib/layouts/punct.cjs.map +1 -1
- package/lib/layouts/{punct.d.ts → punct.d.cts} +0 -1
- package/lib/layouts/qwerty.cjs +1 -1
- package/lib/layouts/qwerty.cjs.map +1 -1
- package/{esm/layouts/qwerty.d.ts → lib/layouts/qwerty.d.cts} +0 -1
- package/lib/layouts/search.cjs +1 -1
- package/lib/layouts/search.cjs.map +1 -1
- package/{esm/layouts/search.d.ts → lib/layouts/search.d.cts} +0 -1
- package/lib/layouts/symbol.cjs +1 -1
- package/lib/layouts/symbol.cjs.map +1 -1
- package/{esm/layouts/symbol.d.ts → lib/layouts/symbol.d.cts} +0 -1
- package/lib/layouts/url.cjs +1 -1
- package/lib/layouts/url.cjs.map +1 -1
- package/{esm/layouts/url.d.ts → lib/layouts/url.d.cts} +0 -1
- package/lib/layouts/verifycode.cjs +1 -1
- package/lib/layouts/verifycode.cjs.map +1 -1
- package/lib/layouts/{verifycode.d.ts → verifycode.d.cts} +0 -1
- package/lib/managers/index.cjs +1 -1
- package/lib/managers/{index.d.ts → index.d.cts} +1 -2
- package/lib/managers/keyboard-manager.cjs +79 -22
- package/lib/managers/keyboard-manager.cjs.map +1 -1
- package/lib/managers/{keyboard-manager.d.ts → keyboard-manager.d.cts} +2 -1
- package/lib/managers/keyboard-renderer.cjs +80 -38
- package/lib/managers/keyboard-renderer.cjs.map +1 -1
- package/lib/managers/{keyboard-renderer.d.ts → keyboard-renderer.d.cts} +3 -2
- package/lib/managers/position-manager.cjs +42 -21
- package/lib/managers/position-manager.cjs.map +1 -1
- package/lib/managers/{position-manager.d.ts → position-manager.d.cts} +4 -3
- package/lib/themes/index.cjs +2 -1
- package/lib/themes/index.cjs.map +1 -1
- package/lib/themes/{index.d.ts → index.d.cts} +1 -2
- package/lib/themes/presets.cjs +1 -1
- package/lib/themes/presets.cjs.map +1 -1
- package/lib/themes/{presets.d.ts → presets.d.cts} +0 -1
- package/lib/themes/types.cjs +1 -1
- package/{esm/themes/types.d.ts → lib/themes/types.d.cts} +1 -1
- package/lib/types/index.cjs +1 -1
- package/{esm/types/index.d.ts → lib/types/index.d.cts} +0 -1
- package/lib/types/keyboard.cjs +1 -1
- package/{esm/types/keyboard.d.ts → lib/types/keyboard.d.cts} +0 -1
- package/lib/types/position.cjs +1 -1
- package/lib/types/{position.d.ts → position.d.cts} +0 -1
- package/lib/utils/device.cjs +11 -7
- package/lib/utils/device.cjs.map +1 -1
- package/{esm/utils/device.d.ts → lib/utils/device.d.cts} +0 -1
- package/lib/utils/dom.cjs +25 -6
- package/lib/utils/dom.cjs.map +1 -1
- package/{esm/utils/dom.d.ts → lib/utils/dom.d.cts} +4 -1
- package/lib/utils/event-emitter.cjs +2 -1
- package/lib/utils/event-emitter.cjs.map +1 -1
- package/{esm/utils/event-emitter.d.ts → lib/utils/event-emitter.d.cts} +0 -1
- package/lib/utils/formatters.cjs +4 -4
- package/lib/utils/formatters.cjs.map +1 -1
- package/{esm/utils/formatters.d.ts → lib/utils/formatters.d.cts} +0 -1
- package/lib/utils/index.cjs +4 -3
- package/{esm/utils/index.d.ts → lib/utils/index.d.cts} +2 -3
- package/lib/utils/random.cjs +2 -2
- package/lib/utils/random.cjs.map +1 -1
- package/{esm/utils/random.d.ts → lib/utils/random.d.cts} +4 -1
- package/package.json +28 -14
- package/es/icons.d.ts.map +0 -1
- package/es/index.d.ts.map +0 -1
- package/es/layouts/amount.d.ts.map +0 -1
- package/es/layouts/bankcard.d.ts.map +0 -1
- package/es/layouts/email.d.ts.map +0 -1
- package/es/layouts/idcard.d.ts.map +0 -1
- package/es/layouts/index.d.ts.map +0 -1
- package/es/layouts/license-plate.d.ts.map +0 -1
- package/es/layouts/number.d.ts.map +0 -1
- package/es/layouts/phone.d.ts.map +0 -1
- package/es/layouts/punct.d.ts.map +0 -1
- package/es/layouts/qwerty.d.ts.map +0 -1
- package/es/layouts/search.d.ts.map +0 -1
- package/es/layouts/symbol.d.ts.map +0 -1
- package/es/layouts/url.d.ts.map +0 -1
- package/es/layouts/verifycode.d.ts.map +0 -1
- package/es/managers/index.d.ts.map +0 -1
- package/es/managers/keyboard-manager.d.ts.map +0 -1
- package/es/managers/keyboard-renderer.d.ts.map +0 -1
- package/es/managers/position-manager.d.ts.map +0 -1
- package/es/themes/index.d.ts.map +0 -1
- package/es/themes/presets.d.ts.map +0 -1
- package/es/themes/types.d.ts.map +0 -1
- package/es/types/index.d.ts.map +0 -1
- package/es/types/keyboard.d.ts.map +0 -1
- package/es/types/position.d.ts.map +0 -1
- package/es/utils/device.d.ts.map +0 -1
- package/es/utils/dom.d.ts.map +0 -1
- package/es/utils/event-emitter.d.ts.map +0 -1
- package/es/utils/formatters.d.ts.map +0 -1
- package/es/utils/index.d.ts.map +0 -1
- package/es/utils/random.d.ts.map +0 -1
- package/esm/icons.d.ts.map +0 -1
- package/esm/index.d.ts.map +0 -1
- package/esm/layouts/amount.d.ts.map +0 -1
- package/esm/layouts/bankcard.d.ts.map +0 -1
- package/esm/layouts/email.d.ts +0 -11
- package/esm/layouts/email.d.ts.map +0 -1
- package/esm/layouts/idcard.d.ts.map +0 -1
- package/esm/layouts/index.d.ts.map +0 -1
- package/esm/layouts/license-plate.d.ts.map +0 -1
- package/esm/layouts/number.d.ts.map +0 -1
- package/esm/layouts/phone.d.ts +0 -15
- package/esm/layouts/phone.d.ts.map +0 -1
- package/esm/layouts/punct.d.ts +0 -7
- package/esm/layouts/punct.d.ts.map +0 -1
- package/esm/layouts/qwerty.d.ts.map +0 -1
- package/esm/layouts/search.d.ts.map +0 -1
- package/esm/layouts/symbol.d.ts.map +0 -1
- package/esm/layouts/url.d.ts.map +0 -1
- package/esm/layouts/verifycode.d.ts +0 -15
- package/esm/layouts/verifycode.d.ts.map +0 -1
- package/esm/managers/index.d.ts +0 -8
- package/esm/managers/index.d.ts.map +0 -1
- package/esm/managers/keyboard-manager.d.ts +0 -130
- package/esm/managers/keyboard-manager.d.ts.map +0 -1
- package/esm/managers/keyboard-renderer.d.ts +0 -115
- package/esm/managers/keyboard-renderer.d.ts.map +0 -1
- package/esm/managers/position-manager.d.ts +0 -72
- package/esm/managers/position-manager.d.ts.map +0 -1
- package/esm/themes/index.d.ts +0 -70
- package/esm/themes/index.d.ts.map +0 -1
- package/esm/themes/presets.d.ts +0 -39
- package/esm/themes/presets.d.ts.map +0 -1
- package/esm/themes/types.d.ts.map +0 -1
- package/esm/themes/types.js +0 -10
- package/esm/types/index.d.ts.map +0 -1
- package/esm/types/index.js +0 -10
- package/esm/types/keyboard.d.ts.map +0 -1
- package/esm/types/keyboard.js +0 -10
- package/esm/types/position.d.ts +0 -139
- package/esm/types/position.d.ts.map +0 -1
- package/esm/types/position.js +0 -10
- package/esm/utils/device.d.ts.map +0 -1
- package/esm/utils/dom.d.ts.map +0 -1
- package/esm/utils/event-emitter.d.ts.map +0 -1
- package/esm/utils/formatters.d.ts.map +0 -1
- package/esm/utils/index.d.ts.map +0 -1
- package/esm/utils/index.js +0 -16
- package/esm/utils/random.d.ts.map +0 -1
- package/lib/icons.d.ts +0 -58
- package/lib/index.d.ts +0 -12
- package/lib/layouts/amount.d.ts +0 -14
- package/lib/layouts/bankcard.d.ts +0 -15
- package/lib/layouts/idcard.d.ts +0 -16
- package/lib/layouts/index.d.ts +0 -54
- package/lib/layouts/license-plate.d.ts +0 -35
- package/lib/layouts/number.d.ts +0 -14
- package/lib/layouts/qwerty.d.ts +0 -10
- package/lib/layouts/search.d.ts +0 -7
- package/lib/layouts/symbol.d.ts +0 -14
- package/lib/layouts/url.d.ts +0 -7
- package/lib/themes/types.d.ts +0 -118
- package/lib/types/index.d.ts +0 -7
- package/lib/types/keyboard.d.ts +0 -253
- package/lib/utils/device.d.ts +0 -45
- package/lib/utils/dom.d.ts +0 -69
- package/lib/utils/event-emitter.d.ts +0 -52
- package/lib/utils/formatters.d.ts +0 -51
- package/lib/utils/index.d.ts +0 -10
- package/lib/utils/random.d.ts +0 -71
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amount.cjs","names":[],"sources":["../../src/layouts/amount.ts"],"sourcesContent":["/**\n * 金额键盘布局\n * @module layouts/amount\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport {
|
|
1
|
+
{"version":3,"file":"amount.cjs","names":[],"sources":["../../src/layouts/amount.ts"],"sourcesContent":["/**\r\n * 金额键盘布局\r\n * @module layouts/amount\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `amount-${num}`,\r\n type: 'char',\r\n label: num,\r\n value: num,\r\n className: 'key-num',\r\n }\r\n}\r\n\r\n/**\r\n * 金额键盘配置 - 紧凑4x4布局\r\n */\r\nexport const amountLayout: KeyboardConfig = {\r\n type: 'amount',\r\n name: '金额键盘',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'double-zero',\r\n type: 'char',\r\n label: '00',\r\n value: '00',\r\n className: 'key-num',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'decimal',\r\n type: 'char',\r\n label: '.',\r\n value: '.',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n inputType: 'amount',\r\n decimalPlaces: 2,\r\n },\r\n}\r\n\r\n/**\r\n * 简洁金额键盘 - 紧凑4x4布局\r\n */\r\nexport const amountSimpleLayout: KeyboardConfig = {\r\n type: 'amount-simple',\r\n name: '金额键盘',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'close',\r\n type: 'close',\r\n label: '关闭',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'decimal',\r\n type: 'char',\r\n label: '.',\r\n value: '.',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n inputType: 'amount',\r\n decimalPlaces: 2,\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAKO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAA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,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,eAAe;CACjB;AACF"}
|
package/lib/layouts/bankcard.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bankcard.cjs","names":[],"sources":["../../src/layouts/bankcard.ts"],"sourcesContent":["/**\n * 银行卡键盘布局\n * @module layouts/bankcard\n */\n\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 从图标模块中导入删除键图标和清除键图标\nimport {
|
|
1
|
+
{"version":3,"file":"bankcard.cjs","names":[],"sources":["../../src/layouts/bankcard.ts"],"sourcesContent":["/**\r\n * 银行卡键盘布局\r\n * @module layouts/bankcard\r\n */\r\n\r\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\n// 从图标模块中导入删除键图标和清除键图标\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n * @param num - 数字字符串(如 '0'-'9')\r\n * @returns 返回一个按键定义对象\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `bankcard-${num}`, // 按键唯一标识符,格式为 bankcard-数字\r\n type: 'char', // 按键类型为字符键\r\n label: num, // 按键上显示的文本\r\n value: num, // 按键按下后输出的值\r\n className: 'key-num', // 按键的 CSS 类名,用于样式定制\r\n }\r\n}\r\n\r\n/**\r\n * 银行卡键盘配置 - 紧凑4x4布局\r\n * 布局结构:\r\n * 第1行: 1 2 3 [退格]\r\n * 第2行: 4 5 6 [清除]\r\n * 第3行: 7 8 9 [关闭]\r\n * 第4行: [ABC] 0 [确定(占2格)]\r\n */\r\nexport const bankcardLayout: KeyboardConfig = {\r\n type: 'bankcard', // 键盘类型标识\r\n name: '银行卡键盘', // 键盘的显示名称\r\n supportShift: false, // 不支持 Shift 切换(纯数字键盘无需切换)\r\n rows: [\r\n // 键盘的行数组\r\n // ---- 第1行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n // 该行包含的按键数组\r\n createNumberKey('1'), // 数字键 1\r\n createNumberKey('2'), // 数字键 2\r\n createNumberKey('3'), // 数字键 3\r\n {\r\n id: 'backspace', // 退格键的唯一标识\r\n type: 'backspace', // 按键类型为退格,删除最后一个字符\r\n icon: ICON_DELETE, // 使用删除图标作为显示内容\r\n label: '', // 无文本标签(由图标替代)\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第2行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('4'), // 数字键 4\r\n createNumberKey('5'), // 数字键 5\r\n createNumberKey('6'), // 数字键 6\r\n {\r\n id: 'clear', // 清除键的唯一标识\r\n type: 'clear', // 按键类型为清除,清空所有输入\r\n icon: ICON_CLEAR, // 使用清除图标作为显示内容\r\n label: '', // 无文本标签\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第3行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('7'), // 数字键 7\r\n createNumberKey('8'), // 数字键 8\r\n createNumberKey('9'), // 数字键 9\r\n {\r\n id: 'close', // 关闭键的唯一标识\r\n type: 'close', // 按键类型为关闭,收起键盘\r\n label: '关闭', // 按钮上显示的文本\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第4行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n {\r\n id: 'switch-qwerty', // 切换到全键盘的按键唯一标识\r\n type: 'tab', // 按键类型为标签页切换\r\n label: 'ABC', // 按钮上显示的文本,提示可切换到字母键盘\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n data: { targetType: 'qwerty' }, // 附加数据,指定切换目标为 QWERTY 全键盘\r\n },\r\n createNumberKey('0'), // 数字键 0\r\n {\r\n id: 'done', // 确定键的唯一标识\r\n type: 'done', // 按键类型为确定,完成输入\r\n label: '确定', // 按钮上显示的文本\r\n width: 2, // 占据 2 个键的宽度\r\n className: 'key-numpad-done', // 确定键的 CSS 类名\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n // 键盘的附加数据\r\n maxLength: 19, // 银行卡号最大输入长度为 19 位\r\n inputType: 'bankcard', // 输入类型标识,用于外部判断\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAeA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAUO,MAAM,iBAAiC;CAC5C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EAGJ;GACE,WAAW;GACX,MAAM;IAEJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,SAAS;IAC/B;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EAEJ,WAAW;EACX,WAAW;CACb;AACF"}
|
package/lib/layouts/email.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.cjs","names":[],"sources":["../../src/layouts/email.ts"],"sourcesContent":["/**\n * 邮箱键盘布局\n * @module layouts/email\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport { ICON_DELETE, ICON_SHIFT } from '../icons'\n\n/**\n * 创建字符按键(支持大小写)\n */\nfunction createCharKey(char: string): KeyDefinition {\n return {\n id: `email-char-${char.toLowerCase()}`,\n type: 'char',\n label: { lower: char.toLowerCase(), upper: char.toUpperCase() },\n value: { lower: char.toLowerCase(), upper: char.toUpperCase() },\n }\n}\n\n/**\n * 创建快捷片段按键\n */\nfunction snippet(label: string, id?: string): KeyDefinition {\n return {\n id: id || `email-snippet-${label.replace(/[^a-z0-9]/gi, '')}`,\n type: 'char',\n label,\n value: label,\n className: 'key-snippet',\n }\n}\n\n/**\n * 常见邮箱后缀列表\n */\nexport const EMAIL_SUFFIXES = [\n '@qq.com',\n '@163.com',\n '@126.com',\n '@gmail.com',\n '@outlook.com',\n '@hotmail.com',\n '@sina.com',\n '@sohu.com',\n '@icloud.com',\n '@foxmail.com',\n '@yeah.net',\n '@139.com',\n]\n\nexport const emailLayout: KeyboardConfig = {\n type: 'email',\n name: '邮箱键盘',\n supportShift: true,\n defaultUpperCase: false,\n switchable: ['symbol', 'number'],\n rows: [\n // QWERTY 第一行\n {\n keys: 'qwertyuiop'.split('').map(createCharKey),\n },\n // QWERTY 第二行\n {\n keys: 'asdfghjkl'.split('').map(createCharKey),\n },\n // QWERTY 第三行 + Shift + 退格\n {\n keys: [\n {\n id: 'shift',\n type: 'shift',\n icon: ICON_SHIFT,\n label: '',\n width: 1.5,\n className: 'key-shift',\n },\n ...'zxcvbnm'.split('').map(createCharKey),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 1.5,\n className: 'key-backspace',\n },\n ],\n },\n // 底部行:切换 + @ + 常用邮箱 + 符号 + 空格 + 完成\n {\n keys: [\n {
|
|
1
|
+
{"version":3,"file":"email.cjs","names":[],"sources":["../../src/layouts/email.ts"],"sourcesContent":["/**\r\n * 邮箱键盘布局\r\n * @module layouts/email\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_DELETE, ICON_SHIFT } from '../icons'\r\n\r\n/**\r\n * 创建字符按键(支持大小写)\r\n */\r\nfunction createCharKey(char: string): KeyDefinition {\r\n return {\r\n id: `email-char-${char.toLowerCase()}`,\r\n type: 'char',\r\n label: { lower: char.toLowerCase(), upper: char.toUpperCase() },\r\n value: { lower: char.toLowerCase(), upper: char.toUpperCase() },\r\n }\r\n}\r\n\r\n/**\r\n * 创建快捷片段按键\r\n */\r\nfunction snippet(label: string, id?: string): KeyDefinition {\r\n return {\r\n id: id || `email-snippet-${label.replace(/[^a-z0-9]/gi, '')}`,\r\n type: 'char',\r\n label,\r\n value: label,\r\n className: 'key-snippet',\r\n }\r\n}\r\n\r\n/**\r\n * 常见邮箱后缀列表\r\n */\r\nexport const EMAIL_SUFFIXES = [\r\n '@qq.com',\r\n '@163.com',\r\n '@126.com',\r\n '@gmail.com',\r\n '@outlook.com',\r\n '@hotmail.com',\r\n '@sina.com',\r\n '@sohu.com',\r\n '@icloud.com',\r\n '@foxmail.com',\r\n '@yeah.net',\r\n '@139.com',\r\n]\r\n\r\nexport const emailLayout: KeyboardConfig = {\r\n type: 'email',\r\n name: '邮箱键盘',\r\n supportShift: true,\r\n defaultUpperCase: false,\r\n switchable: ['symbol', 'number'],\r\n rows: [\r\n // QWERTY 第一行\r\n {\r\n keys: 'qwertyuiop'.split('').map(createCharKey),\r\n },\r\n // QWERTY 第二行\r\n {\r\n keys: 'asdfghjkl'.split('').map(createCharKey),\r\n },\r\n // QWERTY 第三行 + Shift + 退格\r\n {\r\n keys: [\r\n {\r\n id: 'shift',\r\n type: 'shift',\r\n icon: ICON_SHIFT,\r\n label: '',\r\n width: 1.5,\r\n className: 'key-shift',\r\n },\r\n ...'zxcvbnm'.split('').map(createCharKey),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n width: 1.5,\r\n className: 'key-backspace',\r\n },\r\n ],\r\n },\r\n // 底部行:切换 + @ + 常用邮箱 + 符号 + 空格 + 完成\r\n {\r\n keys: [\r\n {\r\n id: 'switch-number',\r\n type: 'tab',\r\n label: '123',\r\n width: 1.25,\r\n className: 'key-switch',\r\n data: { targetType: 'number' },\r\n },\r\n {\r\n id: 'email-at',\r\n type: 'char',\r\n label: '@',\r\n value: '@',\r\n className: 'key-at',\r\n },\r\n {\r\n id: 'email-suffix',\r\n type: 'char',\r\n label: '.com',\r\n value: '',\r\n width: 1.5,\r\n className: 'key-suffix',\r\n options: EMAIL_SUFFIXES,\r\n },\r\n snippet('.', 'email-dot'),\r\n snippet('-', 'email-dash'),\r\n snippet('_', 'email-underscore'),\r\n {\r\n id: 'space',\r\n type: 'space',\r\n label: '',\r\n value: ' ',\r\n width: 2,\r\n className: 'key-space',\r\n },\r\n {\r\n id: 'email-done',\r\n type: 'done',\r\n label: '确定',\r\n width: 1.5,\r\n className: 'key-done',\r\n },\r\n ],\r\n },\r\n ],\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,cAAc,MAA6B;CAClD,OAAO;EACL,IAAI,cAAc,KAAK,YAAY;EACnC,MAAM;EACN,OAAO;GAAE,OAAO,KAAK,YAAY;GAAG,OAAO,KAAK,YAAY;EAAE;EAC9D,OAAO;GAAE,OAAO,KAAK,YAAY;GAAG,OAAO,KAAK,YAAY;EAAE;CAChE;AACF;AAKA,SAAS,QAAQ,O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ANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idcard.cjs","names":[],"sources":["../../src/layouts/idcard.ts"],"sourcesContent":["/**\n * 身份证号键盘布局\n * @module layouts/idcard\n */\n\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 从图标模块中导入删除键图标和清除键图标\nimport {
|
|
1
|
+
{"version":3,"file":"idcard.cjs","names":[],"sources":["../../src/layouts/idcard.ts"],"sourcesContent":["/**\r\n * 身份证号键盘布局\r\n * @module layouts/idcard\r\n */\r\n\r\n// 从类型定义文件中导入 KeyboardConfig(键盘配置)和 KeyDefinition(按键定义)类型\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\n// 从图标模块中导入删除键图标和清除键图标\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n * @param num - 数字字符串(如 '0'-'9')\r\n * @returns 返回一个按键定义对象\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `idcard-${num}`, // 按键唯一标识符,格式为 idcard-数字\r\n type: 'char', // 按键类型为字符键\r\n label: num, // 按键上显示的文本\r\n value: num, // 按键按下后输出的值\r\n className: 'key-num', // 按键的 CSS 类名,用于样式定制\r\n }\r\n}\r\n\r\n/**\r\n * 身份证号键盘配置\r\n * 紧凑3x4布局,无空白位置\r\n * 布局结构:\r\n * 第1行: 1 2 3 [退格]\r\n * 第2行: 4 5 6 [清除]\r\n * 第3行: 7 8 9 X\r\n * 第4行: [关闭] 0 [确定(占2格)]\r\n */\r\nexport const idcardLayout: KeyboardConfig = {\r\n type: 'idcard', // 键盘类型标识\r\n name: '身份证键盘', // 键盘的显示名称\r\n supportShift: false, // 不支持 Shift 切换(纯数字+X键盘无需切换)\r\n rows: [\r\n // 键盘的行数组\r\n // ---- 第1行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n // 该行包含的按键数组\r\n createNumberKey('1'), // 数字键 1\r\n createNumberKey('2'), // 数字键 2\r\n createNumberKey('3'), // 数字键 3\r\n {\r\n id: 'backspace', // 退格键的唯一标识\r\n type: 'backspace', // 按键类型为退格,删除最后一个字符\r\n icon: ICON_DELETE, // 使用删除图标作为显示内容\r\n label: '', // 无文本标签(由图标替代)\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第2行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('4'), // 数字键 4\r\n createNumberKey('5'), // 数字键 5\r\n createNumberKey('6'), // 数字键 6\r\n {\r\n id: 'clear', // 清除键的唯一标识\r\n type: 'clear', // 按键类型为清除,清空所有输入\r\n icon: ICON_CLEAR, // 使用清除图标作为显示内容\r\n label: '', // 无文本标签\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n ],\r\n },\r\n // ---- 第3行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n createNumberKey('7'), // 数字键 7\r\n createNumberKey('8'), // 数字键 8\r\n createNumberKey('9'), // 数字键 9\r\n {\r\n id: 'idcard-x', // X 键的唯一标识\r\n type: 'char', // 按键类型为字符\r\n label: 'X', // 按钮上显示的文本(身份证尾号可能是X)\r\n value: 'X', // 按下后输出的值\r\n className: 'key-num', // 使用数字键的 CSS 类名,保持外观一致\r\n },\r\n ],\r\n },\r\n // ---- 第4行 ----\r\n {\r\n className: 'numpad-row', // 行的 CSS 类名\r\n keys: [\r\n {\r\n id: 'close', // 关闭键的唯一标识\r\n type: 'close', // 按键类型为关闭,收起键盘\r\n label: '关闭', // 按钮上显示的文本\r\n className: 'key-numpad-fn', // 功能键的 CSS 类名\r\n },\r\n createNumberKey('0'), // 数字键 0\r\n {\r\n id: 'done', // 确定键的唯一标识\r\n type: 'done', // 按键类型为确定,完成输入\r\n label: '确定', // 按钮上显示的文本\r\n width: 2, // 占据 2 个键的宽度\r\n className: 'key-numpad-done', // 确定键的 CSS 类名\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n // 键盘的附加数据\r\n maxLength: 18, // 身份证号最大输入长度为 18 位\r\n inputType: 'idcard', // 输入类型标识,用于外部判断\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAeA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAWO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EAGJ;GACE,WAAW;GACX,MAAM;IAEJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EAEJ,WAAW;EACX,WAAW;CACb;AACF"}
|
package/lib/layouts/index.cjs
CHANGED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-core v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:29:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
-
const require_qwerty = require("./qwerty.cjs");
|
|
12
|
-
const require_number = require("./number.cjs");
|
|
13
|
-
const require_symbol = require("./symbol.cjs");
|
|
14
|
-
const require_license_plate = require("./license-plate.cjs");
|
|
15
|
-
const require_idcard = require("./idcard.cjs");
|
|
16
|
-
const require_phone = require("./phone.cjs");
|
|
17
11
|
const require_amount = require("./amount.cjs");
|
|
18
12
|
const require_bankcard = require("./bankcard.cjs");
|
|
19
|
-
const require_verifycode = require("./verifycode.cjs");
|
|
20
13
|
const require_email = require("./email.cjs");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
14
|
+
const require_idcard = require("./idcard.cjs");
|
|
15
|
+
const require_license_plate = require("./license-plate.cjs");
|
|
16
|
+
const require_number = require("./number.cjs");
|
|
17
|
+
const require_phone = require("./phone.cjs");
|
|
23
18
|
const require_punct = require("./punct.cjs");
|
|
19
|
+
const require_qwerty = require("./qwerty.cjs");
|
|
20
|
+
const require_search = require("./search.cjs");
|
|
21
|
+
const require_symbol = require("./symbol.cjs");
|
|
22
|
+
const require_url = require("./url.cjs");
|
|
23
|
+
const require_verifycode = require("./verifycode.cjs");
|
|
24
24
|
//#region src/layouts/index.ts
|
|
25
25
|
const builtinLayouts = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
qwerty: require_qwerty.qwertyLayout,
|
|
27
|
+
number: require_number.numberLayout,
|
|
28
|
+
integer: require_number.integerLayout,
|
|
29
|
+
symbol: require_symbol.symbolLayout,
|
|
30
30
|
"symbol-2": require_symbol.symbolLayout2,
|
|
31
31
|
"license-plate": require_license_plate.licensePlateLayout,
|
|
32
32
|
"license-plate-province": require_license_plate.licensePlateProvinceLayout,
|
|
33
33
|
"license-plate-letter": require_license_plate.licensePlateLetterLayout,
|
|
34
34
|
"license-plate-alphanumeric": require_license_plate.licensePlateAlphanumericLayout,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
idcard: require_idcard.idcardLayout,
|
|
36
|
+
phone: require_phone.phoneLayout,
|
|
37
37
|
"phone-simple": require_phone.phoneSimpleLayout,
|
|
38
|
-
|
|
38
|
+
amount: require_amount.amountLayout,
|
|
39
39
|
"amount-simple": require_amount.amountSimpleLayout,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
bankcard: require_bankcard.bankcardLayout,
|
|
41
|
+
verifycode: require_verifycode.verifycodeLayout,
|
|
42
|
+
email: require_email.emailLayout,
|
|
43
|
+
url: require_url.urlLayout,
|
|
44
|
+
search: require_search.searchLayout,
|
|
45
|
+
punct: require_punct.punctLayout
|
|
46
46
|
};
|
|
47
47
|
const customLayouts = {};
|
|
48
48
|
function registerLayout(name, layout) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/layouts/index.ts"],"sourcesContent":["/**\n * 键盘布局管理\n * @module layouts\n */\n\nimport type { KeyboardConfig, KeyboardType } from '../types'\nimport {
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/layouts/index.ts"],"sourcesContent":["/**\r\n * 键盘布局管理\r\n * @module layouts\r\n */\r\n\r\nimport type { KeyboardConfig, KeyboardType } from '../types'\r\nimport { amountLayout, amountSimpleLayout } from './amount'\r\nimport { bankcardLayout } from './bankcard'\r\nimport { EMAIL_SUFFIXES, emailLayout } from './email'\r\nimport { idcardLayout } from './idcard'\r\nimport {\r\n licensePlateAlphanumericLayout,\r\n licensePlateLayout,\r\n licensePlateLetterLayout,\r\n licensePlateProvinceLayout,\r\n PLATE_LETTERS,\r\n PROVINCES,\r\n} from './license-plate'\r\nimport { integerLayout, numberLayout } from './number'\r\nimport { phoneLayout, phoneSimpleLayout } from './phone'\r\nimport { punctLayout } from './punct'\r\nimport { qwertyLayout } from './qwerty'\r\nimport { searchLayout } from './search'\r\nimport { symbolLayout, symbolLayout2 } from './symbol'\r\nimport { urlLayout } from './url'\r\nimport { verifycodeLayout } from './verifycode'\r\n\r\n// 导出所有布局\r\nexport {\r\n amountLayout,\r\n amountSimpleLayout,\r\n bankcardLayout,\r\n EMAIL_SUFFIXES,\r\n // 输入场景键盘\r\n emailLayout,\r\n // 场景化键盘\r\n idcardLayout,\r\n integerLayout,\r\n licensePlateAlphanumericLayout,\r\n licensePlateLayout,\r\n licensePlateLetterLayout,\r\n licensePlateProvinceLayout,\r\n numberLayout,\r\n phoneLayout,\r\n phoneSimpleLayout,\r\n PLATE_LETTERS,\r\n PROVINCES,\r\n // 标点键盘\r\n punctLayout,\r\n qwertyLayout,\r\n searchLayout,\r\n symbolLayout,\r\n symbolLayout2,\r\n urlLayout,\r\n verifycodeLayout,\r\n}\r\n\r\n/**\r\n * 内置布局映射\r\n */\r\nconst builtinLayouts: Record<string, KeyboardConfig> = {\r\n qwerty: qwertyLayout,\r\n number: numberLayout,\r\n integer: integerLayout,\r\n symbol: symbolLayout,\r\n 'symbol-2': symbolLayout2,\r\n 'license-plate': licensePlateLayout,\r\n 'license-plate-province': licensePlateProvinceLayout,\r\n 'license-plate-letter': licensePlateLetterLayout,\r\n 'license-plate-alphanumeric': licensePlateAlphanumericLayout,\r\n // 场景化键盘\r\n idcard: idcardLayout,\r\n phone: phoneLayout,\r\n 'phone-simple': phoneSimpleLayout,\r\n amount: amountLayout,\r\n 'amount-simple': amountSimpleLayout,\r\n bankcard: bankcardLayout,\r\n verifycode: verifycodeLayout,\r\n // 输入场景键盘\r\n email: emailLayout,\r\n url: urlLayout,\r\n search: searchLayout,\r\n // 标点键盘\r\n punct: punctLayout,\r\n}\r\n\r\n/**\r\n * 自定义布局存储\r\n */\r\nconst customLayouts: Record<string, KeyboardConfig> = {}\r\n\r\n/**\r\n * 注册自定义布局\r\n * @param name - 布局名称\r\n * @param layout - 布局配置\r\n */\r\nexport function registerLayout(name: string, layout: KeyboardConfig): void {\r\n if (builtinLayouts[name]) {\r\n console.warn(`[Keyboard] Cannot override builtin layout \"${name}\"`)\r\n return\r\n }\r\n customLayouts[name] = layout\r\n}\r\n\r\n/**\r\n * 获取布局配置\r\n * @param type - 键盘类型或布局名称\r\n * @returns 布局配置,如果不存在则返回 undefined\r\n */\r\nexport function getLayout(\r\n type: KeyboardType | string\r\n): KeyboardConfig | undefined {\r\n return customLayouts[type] || builtinLayouts[type]\r\n}\r\n\r\n/**\r\n * 获取所有可用布局名称\r\n * @returns 布局名称数组\r\n */\r\nexport function getAvailableLayouts(): string[] {\r\n return [...Object.keys(builtinLayouts), ...Object.keys(customLayouts)]\r\n}\r\n\r\n/**\r\n * 检查布局是否存在\r\n * @param name - 布局名称\r\n * @returns 是否存在\r\n */\r\nexport function hasLayout(name: string): boolean {\r\n return name in builtinLayouts || name in customLayouts\r\n}\r\n\r\n/**\r\n * 移除自定义布局\r\n * @param name - 布局名称\r\n * @returns 是否成功移除\r\n */\r\nexport function unregisterLayout(name: string): boolean {\r\n if (name in customLayouts) {\r\n delete customLayouts[name]\r\n return true\r\n }\r\n return false\r\n}\r\n\r\n/**\r\n * 批量注册布局\r\n * @param layouts - 布局映射对象\r\n */\r\nexport function registerLayouts(layouts: Record<string, KeyboardConfig>): void {\r\n Object.entries(layouts).forEach(([name, layout]) => {\r\n registerLayout(name, layout)\r\n })\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,iBAAiD;CACrD,QAAQ,eAAA;CACR,QAAQ,eAAA;CACR,SAAS,eAAA;CACT,QAAQ,eAAA;CACR,YAAY,eAAA;CACZ,iBAAiB,sBAAA;CACjB,0BAA0B,sBAAA;CAC1B,wBAAwB,sBAAA;CACxB,8BAA8B,sBAAA;CAE9B,QAAQ,eAAA;CACR,OAAO,cAAA;CACP,gBAAgB,cAAA;CAChB,QAAQ,eAAA;CACR,iBAAiB,eAAA;CACjB,UAAU,iBAAA;CACV,YAAY,mBAAA;CAEZ,OAAO,cAAA;CACP,KAAK,YAAA;CACL,QAAQ,eAAA;CAER,OAAO,cAAA;AACT;AAKA,MAAM,gBAAgD,CAAC;AAOhD,SAAS,eAAe,MAAc,QAA8B;CACzE,IAAI,eAAe,OAAO;EACxB,QAAQ,KAAK,8CAA8C,KAAI,EAAG;EAClE;CACF;CACA,cAAc,QAAQ;AACxB;AAOO,SAAS,UACd,MAC4B;CAC5B,OAAO,cAAc,SAAS,eAAe;AAC/C;AAMO,SAAS,sBAAgC;CAC9C,OAAO,CAAC,GAAG,OAAO,KAAK,cAAc,GAAG,GAAG,OAAO,KAAK,aAAa,CAAC;AACvE;AAOO,SAAS,UAAU,MAAuB;CAC/C,OAAO,QAAQ,kBAAkB,QAAQ;AAC3C;AAOO,SAAS,iBAAiB,MAAuB;CACtD,IAAI,QAAQ,eAAe;EACzB,OAAO,cAAc;EACrB,OAAO;CACT;CACA,OAAO;AACT;AAMO,SAAS,gBAAgB,SAA+C;CAC7E,OAAO,QAAQ,OAAO,CAAA,CAAE,SAAS,CAAC,MAAM,YAAY;EAClD,eAAe,MAAM,MAAM;CAC7B,CAAC;AACH"}
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* @module layouts
|
|
4
4
|
*/
|
|
5
5
|
import type { KeyboardConfig, KeyboardType } from '../types';
|
|
6
|
-
import { qwertyLayout } from './qwerty';
|
|
7
|
-
import { integerLayout, numberLayout } from './number';
|
|
8
|
-
import { symbolLayout, symbolLayout2 } from './symbol';
|
|
9
|
-
import { licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, PLATE_LETTERS, PROVINCES } from './license-plate';
|
|
10
|
-
import { idcardLayout } from './idcard';
|
|
11
|
-
import { phoneLayout, phoneSimpleLayout } from './phone';
|
|
12
6
|
import { amountLayout, amountSimpleLayout } from './amount';
|
|
13
7
|
import { bankcardLayout } from './bankcard';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
8
|
+
import { EMAIL_SUFFIXES, emailLayout } from './email';
|
|
9
|
+
import { idcardLayout } from './idcard';
|
|
10
|
+
import { licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, PLATE_LETTERS, PROVINCES } from './license-plate';
|
|
11
|
+
import { integerLayout, numberLayout } from './number';
|
|
12
|
+
import { phoneLayout, phoneSimpleLayout } from './phone';
|
|
18
13
|
import { punctLayout } from './punct';
|
|
19
|
-
|
|
14
|
+
import { qwertyLayout } from './qwerty';
|
|
15
|
+
import { searchLayout } from './search';
|
|
16
|
+
import { symbolLayout, symbolLayout2 } from './symbol';
|
|
17
|
+
import { urlLayout } from './url';
|
|
18
|
+
import { verifycodeLayout } from './verifycode';
|
|
19
|
+
export { amountLayout, amountSimpleLayout, bankcardLayout, EMAIL_SUFFIXES, emailLayout, idcardLayout, integerLayout, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, numberLayout, phoneLayout, phoneSimpleLayout, PLATE_LETTERS, PROVINCES, punctLayout, qwertyLayout, searchLayout, symbolLayout, symbolLayout2, urlLayout, verifycodeLayout, };
|
|
20
20
|
/**
|
|
21
21
|
* 注册自定义布局
|
|
22
22
|
* @param name - 布局名称
|
|
@@ -51,4 +51,3 @@ export declare function unregisterLayout(name: string): boolean;
|
|
|
51
51
|
* @param layouts - 布局映射对象
|
|
52
52
|
*/
|
|
53
53
|
export declare function registerLayouts(layouts: Record<string, KeyboardConfig>): void;
|
|
54
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"license-plate.cjs","names":[],"sources":["../../src/layouts/license-plate.ts"],"sourcesContent":["/**\n * 车牌号键盘布局\n * @module layouts/license-plate\n * 省份键盘类似26键布局,点击省份后自动切换到字母数字键盘\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport { ICON_DELETE } from '../icons'\n\n/**\n * 省份简称列表(按地理区域排列,10列布局)\n */\nexport const PROVINCES = [\n '京', '津', '沪', '渝', '冀', '豫', '云', '辽', '黑', '湘',\n '皖', '鲁', '新', '苏', '浙', '赣', '鄂', '桂', '甘', '晋',\n '蒙', '陕', '吉', '闽', '贵', '粤', '青', '藏', '川', '宁',\n '琼', '港', '澳',\n]\n\n/**\n * 车牌字母(排除 I 和 O,避免与数字混淆)\n */\nexport const PLATE_LETTERS = [\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',\n 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',\n 'W', 'X', 'Y', 'Z',\n]\n\n/**\n * 创建省份按键(点击后自动切换到字母数字键盘)\n */\nfunction createProvinceKey(province: string): KeyDefinition {\n return {\n id: `province-${province}`,\n type: 'char',\n label: province,\n value: province,\n className: 'key-plate-province',\n data: { switchAfterInput: 'license-plate-alphanumeric' },\n }\n}\n\n/**\n * 创建字母按键\n */\nfunction createLetterKey(letter: string): KeyDefinition {\n return {\n id: `letter-${letter}`,\n type: 'char',\n label: letter,\n value: letter,\n className: 'key-plate-letter',\n }\n}\n\n/**\n * 创建数字按键\n */\nfunction createNumberKey(num: string): KeyDefinition {\n return {\n id: `num-${num}`,\n type: 'char',\n label: num,\n value: num,\n className: 'key-plate-number',\n }\n}\n\n/**\n * 省份键盘配置 - 类似26键布局\n * 10列布局,更紧凑美观\n */\nexport const licensePlateProvinceLayout: KeyboardConfig = {\n type: 'license-plate-province',\n name: '省份简称',\n supportShift: false,\n rows: [\n {\n className: 'plate-keyboard-row',\n keys: PROVINCES.slice(0, 10).map(createProvinceKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PROVINCES.slice(10, 20).map(createProvinceKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PROVINCES.slice(20, 30).map(createProvinceKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n ...PROVINCES.slice(30, 33).map(createProvinceKey),\n {\n id: 'plate-xue',\n type: 'char',\n label: '学',\n value: '学',\n className: 'key-plate-special',\n data: { switchAfterInput: 'license-plate-alphanumeric' },\n },\n {\n id: 'plate-jing',\n type: 'char',\n label: '警',\n value: '警',\n className: 'key-plate-special',\n data: { switchAfterInput: 'license-plate-alphanumeric' },\n },\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 1.5,\n className: 'key-plate-fn',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 2.5,\n className: 'key-plate-done',\n },\n ],\n },\n ],\n data: {\n maxLength: 8,\n inputType: 'license-plate',\n },\n}\n\n/**\n * 字母数字键盘配置(车牌第2-8位)\n * 10列布局\n */\nexport const licensePlateAlphanumericLayout: KeyboardConfig = {\n type: 'license-plate-alphanumeric',\n name: '字母数字',\n supportShift: false,\n rows: [\n {\n className: 'plate-keyboard-row',\n keys: '1234567890'.split('').map(createNumberKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PLATE_LETTERS.slice(0, 10).map(createLetterKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n ...PLATE_LETTERS.slice(10, 19).map(createLetterKey),\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n className: 'key-plate-fn',\n },\n ],\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n {\n id: 'switch-province',\n type: 'tab',\n label: '省份',\n width: 1.5,\n className: 'key-plate-switch',\n data: { targetType: 'license-plate-province' },\n },\n ...PLATE_LETTERS.slice(19, 24).map(createLetterKey),\n {\n id: 'plate-xue',\n type: 'char',\n label: '学',\n value: '学',\n className: 'key-plate-special',\n },\n {\n id: 'plate-jing',\n type: 'char',\n label: '警',\n value: '警',\n className: 'key-plate-special',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 1.5,\n className: 'key-plate-done',\n },\n ],\n },\n ],\n data: {\n maxLength: 8,\n inputType: 'license-plate',\n },\n}\n\n/**\n * 纯字母键盘配置(车牌第2位,只能输入字母)\n * 6列布局,排除 I 和 O\n */\nexport const licensePlateLetterLayout: KeyboardConfig = {\n type: 'license-plate-letter',\n name: '字母',\n supportShift: false,\n rows: [\n {\n className: 'plate-keyboard-row',\n keys: PLATE_LETTERS.slice(0, 8).map(createLetterKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: PLATE_LETTERS.slice(8, 16).map(createLetterKey),\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n ...PLATE_LETTERS.slice(16, 24).map(createLetterKey),\n ],\n },\n {\n className: 'plate-keyboard-row',\n keys: [\n {\n id: 'switch-province',\n type: 'tab',\n label: '省份',\n width: 2,\n className: 'key-plate-switch',\n data: { targetType: 'license-plate-province' },\n },\n {\n id: 'backspace',\n type: 'backspace',\n icon: ICON_DELETE,\n label: '',\n width: 2,\n className: 'key-plate-fn',\n },\n {\n id: 'done',\n type: 'done',\n label: '确定',\n width: 2,\n className: 'key-plate-done',\n },\n ],\n },\n ],\n data: {\n maxLength: 8,\n inputType: 'license-plate',\n },\n}\n\n/**\n * 完整车牌号键盘(自动切换模式)\n * 默认显示省份键盘,点击省份后自动切换到字母数字键盘\n */\nexport const licensePlateLayout: KeyboardConfig = {\n type: 'license-plate',\n name: '车牌号键盘',\n supportShift: false,\n data: {\n autoSwitch: true,\n maxLength: 8,\n inputType: 'license-plate',\n },\n rows: licensePlateProvinceLayout.rows,\n}\n"],"mappings":";;;;;;;;;;;;AAYO,MAAM,YAAY;CACvB;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAC7C;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAC7C;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAC7C;CAAK;CAAK;AACZ;AAKO,MAA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A,CAAE,IAAI,eAAe,CACpD;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,yBAAyB;IAC/C;IACA;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF;AAMO,MAAM,qBAAqC;CAChD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,WAAW;CACb;CACA,MAAM,2BAA2B;AACnC"}
|
|
1
|
+
{"version":3,"file":"license-plate.cjs","names":[],"sources":["../../src/layouts/license-plate.ts"],"sourcesContent":["/**\r\n * 车牌号键盘布局\r\n * @module layouts/license-plate\r\n * 省份键盘类似26键布局,点击省份后自动切换到字母数字键盘\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 省份简称列表(按地理区域排列,10列布局)\r\n */\r\nexport const PROVINCES = [\r\n '京',\r\n '津',\r\n '沪',\r\n '渝',\r\n '冀',\r\n '豫',\r\n '云',\r\n '辽',\r\n '黑',\r\n '湘',\r\n '皖',\r\n '鲁',\r\n '新',\r\n '苏',\r\n '浙',\r\n '赣',\r\n '鄂',\r\n '桂',\r\n '甘',\r\n '晋',\r\n '蒙',\r\n '陕',\r\n '吉',\r\n '闽',\r\n '贵',\r\n '粤',\r\n '青',\r\n '藏',\r\n '川',\r\n '宁',\r\n '琼',\r\n '港',\r\n '澳',\r\n]\r\n\r\n/**\r\n * 车牌字母(排除 I 和 O,避免与数字混淆)\r\n */\r\nexport const PLATE_LETTERS = [\r\n 'A',\r\n 'B',\r\n 'C',\r\n 'D',\r\n 'E',\r\n 'F',\r\n 'G',\r\n 'H',\r\n 'J',\r\n 'K',\r\n 'L',\r\n 'M',\r\n 'N',\r\n 'P',\r\n 'Q',\r\n 'R',\r\n 'S',\r\n 'T',\r\n 'U',\r\n 'V',\r\n 'W',\r\n 'X',\r\n 'Y',\r\n 'Z',\r\n]\r\n\r\n/**\r\n * 创建省份按键(点击后自动切换到字母数字键盘)\r\n */\r\nfunction createProvinceKey(province: string): KeyDefinition {\r\n return {\r\n id: `province-${province}`,\r\n type: 'char',\r\n label: province,\r\n value: province,\r\n className: 'key-plate-province',\r\n data: { switchAfterInput: 'license-plate-alphanumeric' },\r\n }\r\n}\r\n\r\n/**\r\n * 创建字母按键\r\n */\r\nfunction createLetterKey(letter: string): KeyDefinition {\r\n return {\r\n id: `letter-${letter}`,\r\n type: 'char',\r\n label: letter,\r\n value: letter,\r\n className: 'key-plate-letter',\r\n }\r\n}\r\n\r\n/**\r\n * 创建数字按键\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `num-${num}`,\r\n type: 'char',\r\n label: num,\r\n value: num,\r\n className: 'key-plate-number',\r\n }\r\n}\r\n\r\n/**\r\n * 省份键盘配置 - 类似26键布局\r\n * 10列布局,更紧凑美观\r\n */\r\nexport const licensePlateProvinceLayout: KeyboardConfig = {\r\n type: 'license-plate-province',\r\n name: '省份简称',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PROVINCES.slice(0, 10).map(createProvinceKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PROVINCES.slice(10, 20).map(createProvinceKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PROVINCES.slice(20, 30).map(createProvinceKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n ...PROVINCES.slice(30, 33).map(createProvinceKey),\r\n {\r\n id: 'plate-xue',\r\n type: 'char',\r\n label: '学',\r\n value: '学',\r\n className: 'key-plate-special',\r\n data: { switchAfterInput: 'license-plate-alphanumeric' },\r\n },\r\n {\r\n id: 'plate-jing',\r\n type: 'char',\r\n label: '警',\r\n value: '警',\r\n className: 'key-plate-special',\r\n data: { switchAfterInput: 'license-plate-alphanumeric' },\r\n },\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n width: 1.5,\r\n className: 'key-plate-fn',\r\n },\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2.5,\r\n className: 'key-plate-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n}\r\n\r\n/**\r\n * 字母数字键盘配置(车牌第2-8位)\r\n * 10列布局\r\n */\r\nexport const licensePlateAlphanumericLayout: KeyboardConfig = {\r\n type: 'license-plate-alphanumeric',\r\n name: '字母数字',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: '1234567890'.split('').map(createNumberKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PLATE_LETTERS.slice(0, 10).map(createLetterKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n ...PLATE_LETTERS.slice(10, 19).map(createLetterKey),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-plate-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n {\r\n id: 'switch-province',\r\n type: 'tab',\r\n label: '省份',\r\n width: 1.5,\r\n className: 'key-plate-switch',\r\n data: { targetType: 'license-plate-province' },\r\n },\r\n ...PLATE_LETTERS.slice(19, 24).map(createLetterKey),\r\n {\r\n id: 'plate-xue',\r\n type: 'char',\r\n label: '学',\r\n value: '学',\r\n className: 'key-plate-special',\r\n },\r\n {\r\n id: 'plate-jing',\r\n type: 'char',\r\n label: '警',\r\n value: '警',\r\n className: 'key-plate-special',\r\n },\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 1.5,\r\n className: 'key-plate-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n}\r\n\r\n/**\r\n * 纯字母键盘配置(车牌第2位,只能输入字母)\r\n * 6列布局,排除 I 和 O\r\n */\r\nexport const licensePlateLetterLayout: KeyboardConfig = {\r\n type: 'license-plate-letter',\r\n name: '字母',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PLATE_LETTERS.slice(0, 8).map(createLetterKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: PLATE_LETTERS.slice(8, 16).map(createLetterKey),\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [...PLATE_LETTERS.slice(16, 24).map(createLetterKey)],\r\n },\r\n {\r\n className: 'plate-keyboard-row',\r\n keys: [\r\n {\r\n id: 'switch-province',\r\n type: 'tab',\r\n label: '省份',\r\n width: 2,\r\n className: 'key-plate-switch',\r\n data: { targetType: 'license-plate-province' },\r\n },\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n width: 2,\r\n className: 'key-plate-fn',\r\n },\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-plate-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n}\r\n\r\n/**\r\n * 完整车牌号键盘(自动切换模式)\r\n * 默认显示省份键盘,点击省份后自动切换到字母数字键盘\r\n */\r\nexport const licensePlateLayout: KeyboardConfig = {\r\n type: 'license-plate',\r\n name: '车牌号键盘',\r\n supportShift: false,\r\n data: {\r\n autoSwitch: true,\r\n maxLength: 8,\r\n inputType: 'license-plate',\r\n },\r\n rows: licensePlateProvinceLayout.rows,\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAYO,MAAM,YAAY;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKO,MAAM,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,SAAS,kBAAkB,UAAiC;CAC1D,OAAO;EACL,IAAI,YAAY;EAChB,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;EACX,MAAM,EAAE,kBAAkB,6BAA6B;CACzD;AACF;AAKA,SAAS,gBAAgB,QAA+B;CACtD,OAAO;EACL,IAAI,UAAU;EACd,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAKA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,OAAO;EACX,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAMO,MAAM,6BAA6C;CACxD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ;GACE,WAAW;GACX,MAAM,UAAU,MAAM,GAAG,EAAE,CAAA,CAAE,IAAI,iBAAiB;EACpD;EACA;GACE,WAAW;GACX,MAAM,UAAU,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,iBAAiB;EACrD;EACA;GACE,WAAW;GACX,MAAM,UAAU,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,iBAAiB;EACrD;EACA;GACE,WAAW;GACX,MAAM;IACJ,GAAG,UAAU,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,iBAAiB;IAChD;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;KACX,MAAM,EAAE,kBAAkB,6BAA6B;IACzD;IACA;KACE,IAAI;KACJ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CAAA,CAAE,IAAI,eAAe;EACrD;EACA;GACE,WAAW;GACX,MAAM,cAAc,MAAM,GAAG,EAAE,CAAA,CAAE,IAAI,eAAe;EACtD;EACA;GACE,WAAW;GACX,MAAM,CAAC,GAAG,cAAc,MAAM,IAAI,EAAE,CAAA,CAAE,IAAI,eAAe,CAAC;EAC5D;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,yBAAyB;IAC/C;IACA;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF;AAMO,MAAM,qBAAqC;CAChD,MAAM;CACN,MAAM;CACN,cAAc;CACd,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,WAAW;CACb;CACA,MAAM,2BAA2B;AACnC"}
|
package/lib/layouts/number.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.cjs","names":[],"sources":["../../src/layouts/number.ts"],"sourcesContent":["/**\n * 数字键盘布局\n * @module layouts/number\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport {
|
|
1
|
+
{"version":3,"file":"number.cjs","names":[],"sources":["../../src/layouts/number.ts"],"sourcesContent":["/**\r\n * 数字键盘布局\r\n * @module layouts/number\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `num-${num}`,\r\n type: 'char',\r\n label: num,\r\n value: num,\r\n className: 'key-num',\r\n }\r\n}\r\n\r\n/**\r\n * 数字键盘配置 - 紧凑4x4布局\r\n */\r\nexport const numberLayout: KeyboardConfig = {\r\n type: 'number',\r\n name: '数字键盘',\r\n supportShift: false,\r\n switchable: ['qwerty', 'symbol'],\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'close',\r\n type: 'close',\r\n label: '关闭',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'decimal',\r\n type: 'char',\r\n label: '.',\r\n value: '.',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n}\r\n\r\n/**\r\n * 纯整数键盘 - 紧凑4x4布局\r\n */\r\nexport const integerLayout: KeyboardConfig = {\r\n type: 'integer',\r\n name: '整数键盘',\r\n supportShift: false,\r\n switchable: ['qwerty'],\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'close',\r\n type: 'close',\r\n label: '关闭',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'switch-qwerty',\r\n type: 'tab',\r\n label: 'ABC',\r\n className: 'key-numpad-fn',\r\n data: { targetType: 'qwerty' },\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,OAAO;EACX,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAKO,MAAM,eAA+B;CAC1C,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY,CAAC,UAAU,QAAQ;CAC/B,MAAM;EACJ;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;AACF;AAKO,MAAM,gBAAgC;CAC3C,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY,CAAC,QAAQ;CACrB,MAAM;EACJ;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,WAAW;KACX,MAAM,EAAE,YAAY,SAAS;IAC/B;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;AACF"}
|
package/lib/layouts/phone.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone.cjs","names":[],"sources":["../../src/layouts/phone.ts"],"sourcesContent":["/**\n * 手机号键盘布局\n * @module layouts/phone\n */\n\nimport type { KeyboardConfig, KeyDefinition } from '../types'\nimport {
|
|
1
|
+
{"version":3,"file":"phone.cjs","names":[],"sources":["../../src/layouts/phone.ts"],"sourcesContent":["/**\r\n * 手机号键盘布局\r\n * @module layouts/phone\r\n */\r\n\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\nimport { ICON_CLEAR, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建数字按键\r\n */\r\nfunction createNumberKey(num: string): KeyDefinition {\r\n return {\r\n id: `phone-${num}`,\r\n type: 'char',\r\n label: num,\r\n value: num,\r\n className: 'key-num',\r\n }\r\n}\r\n\r\n/**\r\n * 手机号键盘配置\r\n * 紧凑4x4布局\r\n */\r\nexport const phoneLayout: KeyboardConfig = {\r\n type: 'phone',\r\n name: '手机号键盘',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'close',\r\n type: 'close',\r\n label: '关闭',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'phone-plus',\r\n type: 'char',\r\n label: '+',\r\n value: '+',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '确定',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 11,\r\n inputType: 'phone',\r\n },\r\n}\r\n\r\n/**\r\n * 简洁版拨号键盘(带 * #)\r\n */\r\nexport const phoneSimpleLayout: KeyboardConfig = {\r\n type: 'phone-simple',\r\n name: '拨号键盘',\r\n supportShift: false,\r\n rows: [\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('1'),\r\n createNumberKey('2'),\r\n createNumberKey('3'),\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('4'),\r\n createNumberKey('5'),\r\n createNumberKey('6'),\r\n {\r\n id: 'clear',\r\n type: 'clear',\r\n icon: ICON_CLEAR,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n createNumberKey('7'),\r\n createNumberKey('8'),\r\n createNumberKey('9'),\r\n {\r\n id: 'phone-hash',\r\n type: 'char',\r\n label: '#',\r\n value: '#',\r\n className: 'key-num',\r\n },\r\n ],\r\n },\r\n {\r\n className: 'numpad-row',\r\n keys: [\r\n {\r\n id: 'phone-star',\r\n type: 'char',\r\n label: '*',\r\n value: '*',\r\n className: 'key-num',\r\n },\r\n createNumberKey('0'),\r\n {\r\n id: 'done',\r\n type: 'done',\r\n label: '拨打',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n },\r\n ],\r\n },\r\n ],\r\n data: {\r\n maxLength: 13,\r\n inputType: 'phone',\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAWA,SAAS,gBAAgB,KAA4B;CACnD,OAAO;EACL,IAAI,SAAS;EACb,MAAM;EACN,OAAO;EACP,OAAO;EACP,WAAW;CACb;AACF;AAMO,MAAM,cAA8B;CACzC,M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B,GAAG;IACnB,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;EACA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA,gBAAgB,GAAG;IACnB;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;CACA,MAAM;EACJ,WAAW;EACX,WAAW;CACb;AACF"}
|
package/lib/layouts/punct.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"punct.cjs","names":[],"sources":["../../src/layouts/punct.ts"],"sourcesContent":["/**\n * 标点符号键盘布局 (中文)\n * @module layouts/punct\n */\n\n// 导入键盘配置和按键定义的类型\nimport type { KeyboardConfig, KeyDefinition } from '../types'\n// 导入删除和确认图标资源\nimport {
|
|
1
|
+
{"version":3,"file":"punct.cjs","names":[],"sources":["../../src/layouts/punct.ts"],"sourcesContent":["/**\r\n * 标点符号键盘布局 (中文)\r\n * @module layouts/punct\r\n */\r\n\r\n// 导入键盘配置和按键定义的类型\r\nimport type { KeyboardConfig, KeyDefinition } from '../types'\r\n// 导入删除和确认图标资源\r\nimport { ICON_CHECK, ICON_DELETE } from '../icons'\r\n\r\n/**\r\n * 创建标点符号按键的快捷函数\r\n * @param label - 按键显示文本(同时也是默认输出值)\r\n * @param value - 可选,按键输出值,不传则与label相同\r\n * @returns 返回一个标点按键定义对象\r\n */\r\nfunction p(label: string, value?: string): KeyDefinition {\r\n return {\r\n id: `punct-${label}`,\r\n type: 'char',\r\n label,\r\n value: value ?? label,\r\n className: 'key-num',\r\n }\r\n}\r\n\r\n// 导出中文标点键盘布局配置\r\nexport const punctLayout: KeyboardConfig = {\r\n type: 'punct', // 布局类型标识为 punct\r\n name: '中文标点', // 布局显示名称\r\n supportShift: false, // 不支持Shift切换(标点键盘无需大小写)\r\n switchable: ['qwerty', 'punct-en'], // 可切换到QWERTY键盘和英文标点键盘\r\n rows: [\r\n // 第一行:常用中文标点符号\r\n {\r\n className: 'virtual-keyboard__row', // 行的CSS类名\r\n keys: [',', '。', '?', '!', ':', ';', '\"', '\"'].map(s => p(s)), // 逗号、句号、问号、感叹号、冒号、分号、左右双引号\r\n },\r\n // 第二行:括号类标点符号\r\n {\r\n className: 'virtual-keyboard__row', // 行的CSS类名\r\n keys: ['(', ')', '【', '】', '《', '》', '……', '——'].map(s => p(s)), // 小括号、中括号、书名号、省略号、破折号\r\n },\r\n // 第三行:其他标点 + 退格键\r\n {\r\n className: 'virtual-keyboard__row', // 行的CSS类名\r\n keys: [\r\n p('·'), // 间隔号(中间点)\r\n p('、'), // 顿号\r\n p('「'), // 左单书名号\r\n p('」'), // 右单书名号\r\n p('『'), // 左双书名号\r\n p('』'), // 右双书名号\r\n p('~'), // 波浪号\r\n {\r\n id: 'backspace',\r\n type: 'backspace',\r\n icon: ICON_DELETE,\r\n label: '',\r\n className: 'key-numpad-fn',\r\n }, // 退格键\r\n ],\r\n },\r\n // 底部行:切换键盘 + 空格 + 确认\r\n {\r\n className: 'virtual-keyboard__row', // 行的CSS类名\r\n keys: [\r\n {\r\n id: 'switch-punct-en',\r\n type: 'tab',\r\n label: '英',\r\n data: { targetType: 'punct-en' },\r\n className: 'key-numpad-fn',\r\n }, // 切换到英文标点键盘\r\n {\r\n id: 'switch-qwerty',\r\n type: 'tab',\r\n label: 'ABC',\r\n data: { targetType: 'qwerty' },\r\n className: 'key-numpad-fn',\r\n }, // 切换到QWERTY字母键盘\r\n {\r\n id: 'space',\r\n type: 'space',\r\n label: '空格',\r\n value: ' ',\r\n width: 4,\r\n className: 'key-num',\r\n }, // 空格键,宽度4倍\r\n {\r\n id: 'done',\r\n type: 'done',\r\n icon: ICON_CHECK,\r\n label: '',\r\n width: 2,\r\n className: 'key-numpad-done',\r\n }, // 确认/完成按钮,宽度2倍\r\n ],\r\n },\r\n ],\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAS,EAAE,OAAe,OAA+B;CACvD,OAAO;EACL,IAAI,SAAS;EACb,MAAM;EACN;EACA,OAAO,SAAS;EAChB,WAAW;CACb;AACF;AAGO,MAAM,cAA8B;CACzC,MAAM;CACN,MAAM;CACN,cAAc;CACd,YAAY,CAAC,UAAU,UAAU;CACjC,MAAM;EAEJ;GACE,WAAW;GACX,MAAM;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;GAAG,CAAA,CAAE,KAAI,MAAK,EAAE,CAAC,CAAC;EAC9D;EAEA;GACE,WAAW;GACX,MAAM;IAAC;IAAK;IAAK;IAAK;IAAK;IAAK;IAAK;IAAM;GAAI,CAAA,CAAE,KAAI,MAAK,EAAE,CAAC,CAAC;EAChE;EAEA;GACE,WAAW;GACX,MAAM;IACJ,EAAE,GAAG;IACL,EAAE,GAAG;IACL,EAAE,GAAG;IACL,EAAE,GAAG;IACL,EAAE,GAAG;IACL,EAAE,GAAG;IACL,EAAE,GAAG;IACL;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,WAAW;IACb;GACF;EACF;EAEA;GACE,WAAW;GACX,MAAM;IACJ;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,MAAM,EAAE,YAAY,WAAW;KAC/B,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,MAAM,EAAE,YAAY,SAAS;KAC7B,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,OAAO;KACP,OAAO;KACP,OAAO;KACP,WAAW;IACb;IACA;KACE,IAAI;KACJ,MAAM;KACN,MAAM,cAAA;KACN,OAAO;KACP,OAAO;KACP,WAAW;IACb;GACF;EACF;CACF;AACF"}
|
package/lib/layouts/qwerty.cjs
CHANGED