bpm-core 0.0.126 → 0.0.127

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 CHANGED
@@ -3,10 +3,107 @@
3
3
 
4
4
  > Ensure your project is updated to Angular 19 to avoid compatibility issues.
5
5
 
6
- ## Recently Added Features
7
- - ### Time Picker
6
+ ## [Recently Added Features](#recently-added-features)
7
+ - ### [Input Mapping and Filtering](#input-mapping-and-filtering)
8
+ The `app-input` component now supports two powerful inputs:
9
+
10
+ - **`[mapFn]`** — A function that modifies the input value **before it's rendered**, allowing for transformations like uppercase conversion, formatting, or character replacement.
11
+ - **`[filterFn]`** — A function that validates or restricts what characters can be typed, pasted, or dropped into the input.
12
+
13
+ **Built-in Utility Classes Provided:**
14
+ >
15
+ > - `InputFilters`:
16
+ > - `InputFilters.arabicOnly`
17
+ > - `InputFilters.englishOnly`
18
+ > - `InputFilters.digitsOnly`
19
+ > - `InputFilters.buildPattern()`
20
+ >
21
+ > - `InputMappers`:
22
+ > - `InputMappers.toUpperCase`
23
+ > - `InputMappers.toLowerCase`
24
+
25
+ **Example 1: Custom filter – Allow only numbers**
26
+ ```ts
27
+ numbersOnlyFilter: InputFilterFn = (char, current, next, keyType) => {
28
+ if (keyType !== 'character') return true;
29
+ return /^[0-9]+$/.test(char);
30
+ };
31
+ ```
32
+ ```html
33
+ <app-input
34
+ label="Phone Number"
35
+ [filterFn]="numbersOnlyFilter"
36
+ ></app-input>
37
+ ```
38
+
39
+ **Example 2: Built-in filter – Arabic-only characters**
40
+ ```ts
41
+ import { InputFilters } from 'bpm-core';
42
+
43
+ class MyComponent {
44
+ InputFilters = InputFilters;
45
+ }
46
+ ```
47
+ ```html
48
+ <app-input
49
+ label="الاسم بالعربية"
50
+ [filterFn]="InputFilters.arabicOnly"
51
+ ></app-input>
52
+ ```
53
+ > 💡 **Hint:** Use `InputFilters.buildPattern()` when you need to **customize exactly which characters are allowed** in an input.
54
+ > You can combine multiple character groups like Arabic letters, digits, symbols, and spaces then generate a custom filter function using `.build()`.
55
+
56
+ **Example 3: Custom filter using `buildPattern()` — Allow English letters, digits, spaces, and symbols**
57
+
58
+ ```ts
59
+ import { InputFilters } from 'bpm-core';
60
+
61
+ class MyComponent {
62
+ customEnglishFilter = InputFilters.buildPattern()
63
+ .allowEnglishAlphabets()
64
+ .allowDigits()
65
+ .allowSpace()
66
+ .allowSymbols()
67
+ .build();
68
+ }
69
+ ```
70
+ ```html
71
+ <app-input
72
+ label="Username"
73
+ [filterFn]="customEnglishFilter"
74
+ ></app-input>
75
+ ```
76
+ **Example 4: Custom map — Capitalize first letter of each word**
77
+ ```ts
78
+ capitalizeWordsMapFn: InputMapFn = (char, current, next) => {
79
+ return next.replace(/\b\w/g, (match) => match.toUpperCase());
80
+ };
81
+ ```
82
+ ```html
83
+ <app-input
84
+ label="Full Name"
85
+ [mapFn]="capitalizeWordsMapFn"
86
+ ></app-input>
87
+ ```
88
+
89
+ **Example 5: Built-in map — Force lowercase:**
90
+ ```ts
91
+ import { InputMappers } from 'bpm-core';
92
+
93
+ class MyComponent {
94
+ InputMappers = InputMappers;
95
+ }
96
+ ```
97
+ ```html
98
+ <app-input
99
+ label="Email"
100
+ [mapFn]="InputMappers.toLowercase"
101
+ ></app-input>
102
+ ```
103
+
104
+ - ### [Time Picker](#time-picker)
8
105
  To use it, import `TimepickerComponent` in your TypeScript file and add `<app-timepicker>` to your template. For more information, hover over the selector after adding it to your template.
9
- - ### Summary Section / Stage
106
+ - ### [Summary Section](#summary-section)
10
107
  This is a stage that appears before the request stage.
11
108
 
12
109
  To enable this feature:
@@ -63,17 +160,23 @@
63
160
  ```
64
161
  </details>
65
162
 
66
- ## Changes Log
163
+ ## [Changes Log](#changes-log)
164
+
165
+ <a id="bpm-core00127-2025-08-06"></a>
166
+ ### [bpm-core@0.0.127 — 2025-08-06](#bpm-core00127-2025-08-06)
167
+ - feat(app-input): `app-input` now supports `filterFn` and `mapFn` inputs.
168
+ - feat(validation-errors): Added default error messages for `max` and `min` validators.
169
+
67
170
 
68
171
  <a id="bpm-core00126-2025-07-30"></a>
69
172
  ### [bpm-core@0.0.126 — 2025-07-30](#bpm-core00126-2025-07-30)
70
- - Fix (file-uploader): avoid clearing attachments with multiple enabled.
71
- - Fix (file-uploader): activate "maxLength" input to specify maximum number of files
72
- - Fix (attachment-section): resolve _intl console error and translate MatPaginator labels to Arabic.
173
+ - fix(file-uploader): avoid clearing attachments with multiple enabled.
174
+ - fix(file-uploader): activate "maxLength" input to specify maximum number of files
175
+ - fix(attachment-section): resolve _intl console error and translate MatPaginator labels to Arabic.
73
176
 
74
177
  <a id="bpm-core00125-2025-07-23"></a>
75
178
  ### [bpm-core@0.0.125 — 2025-07-23](#bpm-core00125-2025-07-23)
76
- - Fix: resolve issue with downloading attachments from comments history.
179
+ - fix: resolve issue with downloading attachments from comments history.
77
180
 
78
181
  <a id="bpm-core00124-2025-07-17"></a>
79
182
  ### [bpm-core@0.0.124 — 2025-07-17](#bpm-core00124-2025-07-17)