Our application features a KeypadComponent
that showcases keyboard layout based on JSON input, for example: {'Q', 'W', 'E', 'R'...}
.
Currently, we have approximately 100 predefined keyboard layouts. However, the potential number of layouts is infinite (depending on language specifics), making it challenging to register all of them as providers.
What approach would you take in terms of architecture for this situation?
As of now, I am considering a method similar to the following (storing one layout per file):
interface LayoutInterface {
getLayout();
}
class LayoutEnglish implements LayoutInterface {
getLayout() {
return {'Q', 'W', 'E', 'R'...};
}
}
class LayoutNumeric implements LayoutInterface {
getLayout() {
return {'1', '2', '3', ...};
}
}
class LayoutComponent {
@Input
type: 'english';
getLayout(type) {
// how could dynamic import be implemented here?
return new {Layout+type};
}
}
keypad.component.html
<app-keypad type="english"></app-keypad>