moqui / moqui-runtime

The default runtime directory for Moqui Framework
Other
37 stars 79 forks source link

added support for hot-key function #224

Open newmann opened 1 year ago

newmann commented 1 year ago

增加支持热键功能。热键定义范围:字母A-Z,数字0-9

1、alt+热键,定位到输入字段,字段包括text-line、drop-down、date-time、check、radio、textarea 2、ctrl+热键,点击按钮,包括container-dialog、dynamic-dialog、button-menu、link 3、在同一个form里面按回车键,会循环找输入框焦点 4、如果多个输入字段的热键一样,按alt+热键会在这些字段中循环

现在发现:ctrl+n、ctrl+w是浏览器缺省热键,无法使用

方案的基本是思路是通过自定义的moqui-key,在界面渲染的时候,绑定到对应的控件上,然后监控全局的键盘事件,进行相应的处理。不影响控件自己的按键处理逻辑。

如何使用: a、输入字段在中增加moqui-key属性 b、按钮字段在自己的属性增加moqui-key属性, c、基本是title或button-text在哪里定义,moqui-key就在哪里定义 d、无论大小写,系统自动转化为大写

特别定义: ctrl+· (Backquote),qapps下,open/close 左边主菜单;vapps/apps下,返回主菜单界面

关于screen和form 的xsd文件修改,需要在framework库中提交,如果本PR审核通过,再提交PR


Added support for hotkey function. Hotkeys define scope: letters A-Z, numbers 0-9

  1. alt+ hotkey, focus to the input field, includes text-line、drop-down、date-time、check、radio、textarea
  2. ctrl+ hotkey, click button, includes container-dialog、dynamic-dialog、button-menu、link
  3. Pressing the Enter key in the same form will cycle through the focus of the input field.
  4. If multiple input fields have the same hotkey, pressing alt+hotkey will cycle through those fields

Now I found that Ctrl+N, Ctrl+W are the default hotkeys of the browser and cannot be used

The basic idea of the solution is to bind to the corresponding control when the interface is rendered through a custom moqui-key, and then monitor the global keyboard events for corresponding processing. It does not affect the control's own keyboard processing logic.

How to use: a. For input fields, add the moqui-key attribute to the b. For buttons, add the moqui-key attribute to itself c. Basically, where the title or button-text is defined, moqui-key is defined d. Regardless of the case, the system automatically converts to uppercase

Special Definitions: ctrl+· (Backquote),in qapps mode,open/close left main menu;in vapps/apps mode,return to main menu screen

For changes to the XSD files of screen and form, need to submit them in the moqui/Framework library.If this PR is approved, submit that PR again

newmann commented 1 year ago

补充一点:增加必填字段在label后显示红色星号


To add: add a red star after the label of the required field