ngx-material-keyboard / core

Onscreen virtual keyboard for Angular ≥ 5 (https://angular.io/) using Angular Material (https://material.angular.io/).
https://ngx-material-keyboard.github.io/core/
98 stars 120 forks source link

Numpad #5

Closed offwork closed 7 years ago

offwork commented 7 years ago

How do I make the NumPad appears only on the keyboard layout?

davidenke commented 7 years ago

You're right, we have no documentation for this. A custom layout can be provided by extending the existing config in your app module:

import {MdKeyboardModule, MD_KEYBOARD_LAYOUTS, IKeyboardLayouts, keyboardLayouts} from '@ngx-material-keyboard/core';

const customKeyboardLayouts: IKeyboardLayouts = keyboardLayouts;
customKeyboardLayouts.numpad = {
  'name': 'Numpad', 'keys': [
    [['1', '1'], ['2', '2'], ['3', '3']],
    [['4', '4'], ['5', '5'], ['6', '6']],
    [['7', '7'], ['8', '8'], ['9', '9']],
    [['Bksp', 'Bksp'], ['0', '0'], ['Enter', 'Enter']]
  ]
};

@NgModule({
  imports: [
    MdKeyboardModule
  ],
  providers: [
    { provide: MD_KEYBOARD_LAYOUTS, useValue: customKeyboardLayouts }
  ]
})
export class AppModule {}

Have a look at this Plunker.

offwork commented 7 years ago

thanks for your quick reply