Skip to content

Commit 9daeead

Browse files
authored
Merge pull request #26 from mohsen77sk/v4
V4
2 parents 7c3643a + 271d813 commit 9daeead

25 files changed

+9158
-7643
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ indent_style = space
77
indent_size = 2
88
insert_final_newline = true
99
trim_trailing_whitespace = true
10+
max_line_length = 120
1011

1112
[*.ts]
1213
quote_type = single

.github/workflows/main.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,46 @@ jobs:
1010
build:
1111
name: Build
1212
runs-on: ubuntu-latest
13-
13+
1414
steps:
1515
- name: Syncing repository
16-
uses: actions/checkout@v3
17-
16+
uses: actions/checkout@v4
17+
1818
- name: Setup Node.js
19-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v4
2020
with:
21+
node-version: 20.14.0
2122
cache: 'npm'
22-
23+
2324
- name: Install Dependencies
2425
run: npm ci
25-
26+
2627
- name: Build Application
2728
run: npm run build-demo
28-
29+
2930
- name: Upload artifact
30-
uses: actions/upload-artifact@v3
31+
uses: actions/upload-artifact@v4
3132
with:
3233
name: dist
3334
path: dist/
34-
35+
3536
test:
3637
name: Test
3738
runs-on: ubuntu-latest
38-
39+
3940
steps:
4041
- name: Syncing repository
41-
uses: actions/checkout@v3
42-
42+
uses: actions/checkout@v4
43+
4344
- name: Setup Node.js
44-
uses: actions/setup-node@v3
45+
uses: actions/setup-node@v4
4546
with:
47+
node-version: 20.14.0
4648
cache: 'npm'
47-
49+
4850
- name: Install Dependencies
4951
run: npm ci
50-
52+
5153
- name: Test Lib
5254
run: npm run test-lib
5355
- name: Test Demo
@@ -63,13 +65,13 @@ jobs:
6365

6466
steps:
6567
- name: Download artifact
66-
uses: actions/download-artifact@v3
68+
uses: actions/download-artifact@v4
6769
with:
6870
name: dist
6971
path: dist/
7072

7173
- name: Deploy demo
72-
uses: peaceiris/actions-gh-pages@v3
74+
uses: peaceiris/actions-gh-pages@v4
7375
with:
7476
github_token: ${{ secrets.GITHUB_TOKEN }}
7577
publish_dir: dist/angular-touch-keyboard

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.0.0] - 2025-03-04
9+
10+
### Changed
11+
12+
- Updated to Angular 18
13+
- Updated documentation
14+
15+
### Added
16+
17+
- Support custom position origin
18+
- Support change default locale
19+
820
## [3.3.0] - 2024-09-19
921

1022
### Added

README.md

Lines changed: 94 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,141 @@
11
# AngularTouchKeyboard
22

3+
An Angular touch keyboard component that provides a customizable on-screen keyboard for input elements.
4+
35
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![npm version](https://badge.fury.io/js/ngx-touch-keyboard.svg)](http://badge.fury.io/js/ngx-touch-keyboard) [![Build Status](https://github.com/mohsen77sk/angular-touch-keyboard/workflows/main/badge.svg)](https://github.com/mohsen77sk/angular-touch-keyboard/actions)
46

5-
## What is this?
7+
![angular touch keyboard](https://mohsen77sk.github.io/angular-touch-keyboard/assets/images/angularTouchKeyboard.png)
68

7-
Virtual Keyboard for Angular applications.
9+
## Features
810

9-
![angular touch keyboard](https://mohsen77sk.github.io/angular-touch-keyboard/assets/images/angularTouchKeyboard.png)
11+
- 📱 Responsive virtual keyboard
12+
- 🌐 Multiple locale support
13+
- 🎯 Flexible positioning
14+
- 🖥️ Full-screen mode support
15+
- 🎨 Customizable appearance
16+
- 🔧 Material Design integration
1017

1118
## Demo
1219

1320
[https://mohsen77sk.github.io/angular-touch-keyboard/](https://mohsen77sk.github.io/angular-touch-keyboard/)
1421

15-
## Install
16-
17-
### Step 1: Install [ngx-touch-keyboard](https://www.npmjs.com/package/ngx-touch-keyboard)
22+
## Installation
1823

19-
```sh
24+
```bash
2025
npm install @angular/cdk ngx-touch-keyboard
2126
```
2227

23-
### Step 2: Import the module
28+
## Compatibility
29+
30+
The version of this library is synchronized with the major version of Angular to ensure compatibility.
31+
32+
| Angular Version | Package Version |
33+
| --------------- | --------------- |
34+
| >= 18.0.0 | 4.x |
35+
| >= 16.0.0 | 3.x |
36+
| >= 14.0.0 | 2.x |
37+
38+
## Basic Usage
2439

25-
Add `ngxTouchKeyboardModule` as an import in your app's root NgModule.
40+
Import the `NgxTouchKeyboardModule` in your app.module.ts:
2641

2742
```typescript
28-
import { ngxTouchKeyboardModule } from 'ngx-touch-keyboard';
43+
import { NgxTouchKeyboardModule } from 'ngx-touch-keyboard';
44+
2945
@NgModule({
30-
...
3146
imports: [
32-
...
33-
ngxTouchKeyboardModule,
47+
NgxTouchKeyboardModule
3448
],
35-
...
3649
})
3750
export class AppModule { }
3851
```
3952

40-
### Compatibility
41-
42-
#### Version [`3.0.0`]
53+
If you want to set the custom locale, provide `NGX_TOUCH_KEYBOARD_LOCALE` by custom locale
4354

44-
* `@angular/core`: `^16.0.0` || `^17.0.0` || `^18.0.0`
45-
* `@angular/cdk`: `^16.0.0` || `^17.0.0` || `^18.0.0`
55+
- default locale is `enUS`
4656

47-
#### Version [`2.0.0`]
57+
```typescript
58+
import { NGX_TOUCH_KEYBOARD_LOCALE, faIR } from 'ngx-touch-keyboard';
4859

49-
* `@angular/core`: `^14.0.0` || `^15.0.0`
50-
* `@angular/cdk`: `^14.0.0` || `^15.0.0`
60+
@NgModule({
61+
providers: [
62+
{ provide: NGX_TOUCH_KEYBOARD_LOCALE, useValue: faIR }
63+
],
64+
})
65+
export class AppModule { }
66+
```
5167

52-
## Localization
68+
Add the directive to your input elements:
5369

54-
AngularTouchKeyboard is localized in 7 keyboard-specific locales:
70+
```html
71+
<input ngxTouchKeyboard [(ngxTouchKeyboardOpen)]="isOpen">
72+
```
5573

56-
* `en-US` English (United States) (default)
57-
* `en-UK` English (United Kingdom)
58-
* `fa-IR` Persian (Iran)
59-
* `he-IL` Hebrew (Israel)
60-
* `ka-GE` Georgian (Georgia)
61-
* `ru-RU` Russian (Russia)
62-
* `sv-SE` Swedish (Sweden)
74+
## API Reference
6375

64-
## Usage
76+
### Directives
6577

66-
Simple usage example
78+
#### NgxTouchKeyboard
6779

68-
```html
69-
<input
70-
type="text"
71-
ngxTouchKeyboard
72-
#touchKeyboard="ngxTouchKeyboard"
73-
(focus)="touchKeyboard.openPanel()"
74-
/>
80+
```typescript
81+
@Directive({
82+
selector: 'input[ngxTouchKeyboard], textarea[ngxTouchKeyboard]'
83+
})
7584
```
7685

77-
Locale usage example
86+
### Inputs
87+
88+
| Name | Type | Default | Description |
89+
| --------------------------------- | ------------------------ | ------- | ---------------------------------------------- |
90+
| `ngxTouchKeyboardOpen` | `boolean` | `false` | Controls the visibility of the keyboard |
91+
| `ngxTouchKeyboardLocale` | `Locale` | `enUS` | Sets the keyboard locale |
92+
| `ngxTouchKeyboardFullScreen` | `boolean` | `false` | Enables full-screen mode |
93+
| `ngxTouchKeyboardDebug` | `boolean` | `false` | Enables debug mode |
94+
| `ngxConnectedTouchKeyboardOrigin` | `NgxTouchKeyboardOrigin` | `null` | Sets a custom origin for the keyboard position |
95+
96+
### Methods
97+
98+
- `openPanel()`: Opens the keyboard panel
99+
- `closePanel()`: Closes the keyboard panel
100+
- `togglePanel()`: Toggles the keyboard panel visibility
101+
102+
## Material Design Integration
103+
104+
The component automatically detects and integrates with Angular Material form fields, providing proper positioning and styling.
105+
106+
## Advanced Usage
107+
108+
### Custom locale
78109

79110
```html
80-
<input
81-
type="text"
82-
ngxTouchKeyboard="fa-IR"
83-
#touchKeyboard="ngxTouchKeyboard"
84-
(focus)="touchKeyboard.openPanel()"
85-
/>
111+
<input ngxTouchKeyboard [ngxTouchKeyboardLocale]="faIR">
86112
```
87113

88-
Material usage example
114+
### Full-Screen Mode
89115

90116
```html
91-
<mat-form-field>
92-
<mat-label>Default</mat-label>
93-
<input
94-
matInput
95-
type="text"
96-
ngxTouchKeyboard
97-
#touchKeyboard="ngxTouchKeyboard"
98-
/>
99-
<button
100-
mat-icon-button
101-
matSuffix
102-
type="button"
103-
(click)="touchKeyboard.togglePanel()"
104-
>
105-
<mat-icon> keyboard </mat-icon>
106-
</button>
107-
</mat-form-field>
117+
<input ngxTouchKeyboard [ngxTouchKeyboardFullScreen]="true">
108118
```
109119

110-
### Properties
120+
### Custom Position Origin
111121

112-
| Property | Description |
113-
| ---------------------------- | ----------------------------------------------------------- |
114-
| `ngxTouchKeyboard` | Required to initialize Virtual Keyboard to specified input. |
115-
| `ngxTouchKeyboardDebug` | Debug mode is on. |
116-
| `ngxTouchKeyboardFullScreen` | Full screen mode is on. |
122+
```html
123+
<div ngxTouchKeyboardOrigin #origin="ngxTouchKeyboardOrigin">
124+
<input ngxTouchKeyboard [ngxConnectedTouchKeyboardOrigin]="origin">
125+
</div>
126+
```
117127

118-
### Methods
128+
## Localization
119129

120-
Here's the list of all available methods:
130+
AngularTouchKeyboard is localized in 7 keyboard-specific locales:
121131

122-
| Methods | Description |
123-
| --------------------- | --------------------- |
124-
| `openPanel(): void` | Open keyboard panel |
125-
| `closePanel(): void` | Close keyboard panel |
126-
| `togglePanel(): void` | Toggle keyboard panel |
132+
* `en-US` English (United States) (default)
133+
* `en-UK` English (United Kingdom)
134+
* `fa-IR` Persian (Iran)
135+
* `he-IL` Hebrew (Israel)
136+
* `ka-GE` Georgian (Georgia)
137+
* `ru-RU` Russian (Russia)
138+
* `sv-SE` Swedish (Sweden)
127139

128140
## Themes
129141

@@ -167,6 +179,10 @@ The most useful commands for development are:
167179
* `npm run start` to start a development server
168180
* `npm run build-demo` to build the demo locally (it will be published automatically by GitHub Actions)
169181

182+
## Contributing
183+
184+
Contributions are welcome! Please feel free to submit a Pull Request.
185+
170186
## License
171187

172188
[The MIT License (MIT)](LICENSE)

angular.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@
6969
"builder": "@angular-devkit/build-angular:dev-server",
7070
"configurations": {
7171
"production": {
72-
"browserTarget": "angular-touch-keyboard:build:production"
72+
"buildTarget": "angular-touch-keyboard:build:production"
7373
},
7474
"development": {
75-
"browserTarget": "angular-touch-keyboard:build:development"
75+
"buildTarget": "angular-touch-keyboard:build:development"
7676
}
7777
},
7878
"defaultConfiguration": "development"
7979
},
8080
"extract-i18n": {
8181
"builder": "@angular-devkit/build-angular:extract-i18n",
8282
"options": {
83-
"browserTarget": "angular-touch-keyboard:build"
83+
"buildTarget": "angular-touch-keyboard:build"
8484
}
8585
},
8686
"test": {

0 commit comments

Comments
 (0)