bpm-core 0.0.126 → 0.0.128

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.
@@ -6,6 +6,7 @@ export * from './date-range-picker/date-range-picker.component';
6
6
  export * from './form-label/form-label.component';
7
7
  export * from './info-item/info-item.component';
8
8
  export * from './input/input.component';
9
+ export * from './input/input-map-filter';
9
10
  export * from './input-number/input-number.component';
10
11
  export * from './input-email/input-email.component';
11
12
  export * from './input-mask/input-mask.component';
@@ -0,0 +1,4 @@
1
+ export * from './input-filters';
2
+ export * from './input-map-filter.directive';
3
+ export * from './input-mappers';
4
+ export * from './types';
@@ -0,0 +1,63 @@
1
+ import { InputFilterFn } from "./types";
2
+ export declare class InputFilters {
3
+ /**
4
+ * A filter that allows only Arabic characters (letters, punctuation) and Arabic-Indic digits (٠–٩),
5
+ * as well as basic common symbols and spaces.
6
+ *
7
+ * @returns `true` if the character should be allowed; otherwise, `false`
8
+ */
9
+ static arabicOnly(char: string, current: string, next: string, event: KeyboardEvent | ClipboardEvent | DragEvent): boolean;
10
+ /**
11
+ * A filter that allows only English letters (A–Z, a–z), digits (0–9), common symbols, and space.
12
+ *
13
+ * @returns `true` if the character should be allowed; otherwise, `false`
14
+ */
15
+ static englishOnly(char: string, current: string, next: string, event: KeyboardEvent | ClipboardEvent | DragEvent): boolean;
16
+ /**
17
+ * A filter that allows only digits (0–9).
18
+ *
19
+ * @returns `true` if the character is a digit; otherwise, `false`
20
+ */
21
+ static digitsOnly(char: string, current: string, next: string, event: KeyboardEvent | ClipboardEvent | DragEvent): boolean;
22
+ /**
23
+ * Creates a new `PatternBuilder` instance for building a custom input filter.
24
+ *
25
+ * The builder allows chaining methods like `.allowArabicAlphabets()`, `.allowDigits()`, `.allowSpace()`, etc.
26
+ * Once configured, call `.build()` to generate the `InputFilterFn`.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * this.filterFn = InputFilters.buildPattern()
31
+ * .allowArabicAlphabets()
32
+ * .allowArabicDigits()
33
+ * .allowSpace()
34
+ * .build();
35
+ * ```
36
+ *
37
+ * @returns An instance of `PatternBuilder` for building a custom filter
38
+ */
39
+ static buildPattern(): PatternBuilder;
40
+ }
41
+ declare class PatternBuilder {
42
+ private patternParts;
43
+ /**
44
+ * Allow Arabic letters and Arabic symbols (e.g., Tatweel, diacritics, Arabic punctuation).
45
+ */
46
+ allowArabicAlphabets(): this;
47
+ /**
48
+ * Allow Arabic-Indic digits: ٠١٢٣٤٥٦٧٨٩
49
+ */
50
+ allowArabicDigits(): this;
51
+ /**
52
+ * Allow English letters A–Z (uppercase/lowercase).
53
+ */
54
+ allowEnglishAlphabets(): this;
55
+ allowDigits(): this;
56
+ allowSpace(): this;
57
+ allowSymbols(): this;
58
+ /**
59
+ * Builds and returns the filter function.
60
+ */
61
+ build(): InputFilterFn;
62
+ }
63
+ export {};
@@ -0,0 +1,15 @@
1
+ import { NgControl } from "@angular/forms";
2
+ import type { InputFilterFn, InputMapFn } from "./types";
3
+ import * as i0 from "@angular/core";
4
+ export declare class InputMapFilterDirective {
5
+ private ngControl;
6
+ mapFn: InputMapFn;
7
+ filterFn: InputFilterFn;
8
+ constructor(ngControl: NgControl);
9
+ handleKeydown(event: KeyboardEvent): boolean;
10
+ handlePaste(event: ClipboardEvent): void;
11
+ handleDrop(event: DragEvent): void;
12
+ private updateValue;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<InputMapFilterDirective, [{ optional: true; self: true; }]>;
14
+ static ɵdir: i0.ɵɵDirectiveDeclaration<InputMapFilterDirective, "[inputMapFilter]", never, { "mapFn": { "alias": "mapFn"; "required": false; }; "filterFn": { "alias": "filterFn"; "required": false; }; }, {}, never, never, true, never>;
15
+ }
@@ -0,0 +1,10 @@
1
+ export declare class InputMappers {
2
+ /**
3
+ * A mapping function that transforms all input to UPPERCASE.
4
+ */
5
+ static toUpperCase(char: string, currentValue: string, nextValue: string): string;
6
+ /**
7
+ * A mapping function that transforms all input to lowercase.
8
+ */
9
+ static toLowerCase(char: string, currentValue: string, nextValue: string): string;
10
+ }
@@ -0,0 +1,2 @@
1
+ export type InputMapFn = (char: string, currentValue: string, nextValue: string) => string;
2
+ export type InputFilterFn = (char: string, currentValue: string, nextValue: string, event: KeyboardEvent | ClipboardEvent | DragEvent) => boolean;
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter, DestroyRef } from '@angular/core';
2
2
  import { ControlValueAccessorDirective } from '../control-value-accessor.directive';
3
+ import type { InputMapFn, InputFilterFn } from './input-map-filter/types';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class InputComponent<Type> extends ControlValueAccessorDirective<Type> {
5
6
  floatLabel: any;
@@ -7,8 +8,82 @@ export declare class InputComponent<Type> extends ControlValueAccessorDirective<
7
8
  iconPrefixName: string;
8
9
  iconSuffixName: string;
9
10
  emitedChangedValue1: EventEmitter<any>;
11
+ /**
12
+ * A mapping function that modifies the input value during typing, pasting, or dropping text.
13
+ * You can use it to modify the full input value **before it appears** (e.g., for auto-capitalization,
14
+ * formatting, or custom replacements).
15
+ *
16
+ * This function is called:
17
+ * - On each **key press**, to determine how the input value should change when a character is typed.
18
+ * - On **paste**, to transform the pasted content before it’s applied.
19
+ * - On **drop**, to transform the dropped text before it’s applied.
20
+ *
21
+ * **Built-in mappers are available via the `InputMappers` utility class:**
22
+ *
23
+ * - `InputMappers.toUpperCase` — Transforms all input to UPPERCASE.
24
+ * - `InputMappers.toLowerCase` — Transforms all input to lowercase.
25
+ *
26
+ * @param char - The character(s) being inserted. This is:
27
+ * - A single character (e.g., `'a'`) during typing.
28
+ * - The full pasted string during paste events.
29
+ * - The full dropped string during drop events.
30
+ * @param currentValue - The current value of the input **before** the change is applied.
31
+ * @param nextValue - The simulated value of the input **after** the character, paste, or drop is inserted, but before transformation.
32
+ *
33
+ * @returns The final string to use as the new input value.
34
+ *
35
+ * @example
36
+ * // Use a built-in mapper to force UPPERCASE input:
37
+ * this.mapFn = InputMappers.toUpperCase;
38
+ *
39
+ * @example
40
+ * // Custom mapper: Capitalize the first letter of each word
41
+ * this.mapFn = (char, current, next) =>
42
+ * typeof next === 'string' ? next.replace(/\b\w/g, c => c.toUpperCase()) : next;
43
+ */
44
+ mapFn: InputMapFn;
45
+ /**
46
+ * A filtering function that determines whether a character or string should be allowed into the input.
47
+ *
48
+ * This function is called during:
49
+ * - **Typing**: When a key is pressed to decide if the character should be accepted.
50
+ * - **Paste**: When text is pasted to decide if the entire pasted string should be accepted.
51
+ * - **Drop**: When text is dropped into the input to decide if it should be allowed.
52
+ *
53
+ * You can use it to reject unwanted characters (e.g. numbers, symbols) or block input entirely based
54
+ * on the current or predicted value.
55
+ *
56
+ * **Built-in filters are available via the `InputFilters` utility class:**
57
+ *
58
+ * - `InputFilters.arabicOnly` — Allows Arabic letters and digits, as well as common symbols.
59
+ * - `InputFilters.englishOnly` — Allows English letters and digits, as well as common symbols.
60
+ * - `InputFilters.digitsOnly` — Allows digits only (`0–9`), no letters or symbols.
61
+ * - You can also use `InputFilters.buildPattern()` to define a custom filter.
62
+ *
63
+ * @param char - The character(s) being inserted:
64
+ * - A single typed character (e.g., `'a'`) during key presses
65
+ * - The full pasted or dropped string during paste/drop
66
+ * @param currentValue - The current value of the input before the character or string is applied.
67
+ * @param nextValue - The simulated next value if the character or string were applied.
68
+ * @param event - The originating event triggering the input change. This can be a
69
+ * `KeyboardEvent` (for typing), `ClipboardEvent` (for paste), or `DragEvent` (for drop).
70
+ *
71
+ * @returns `true` to allow the input, or `false` to block it.
72
+ *
73
+ *
74
+ * @example
75
+ * // Use a built-in filter to restrict to digits only
76
+ * this.filterFn = InputFilters.digitsOnly;
77
+ *
78
+ * @example
79
+ * // Custom filter: Allow only letters (no numbers or symbols)
80
+ * this.filterFn = (char, current, next, event) => {
81
+ * return /^[a-zA-Z]+$/.test(char);
82
+ * };
83
+ */
84
+ filterFn: InputFilterFn;
10
85
  destroyRef: DestroyRef;
11
86
  ngOnInit(): void;
12
87
  static ɵfac: i0.ɵɵFactoryDeclaration<InputComponent<any>, never>;
13
- static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent<any>, "app-input", never, { "floatLabel": { "alias": "floatLabel"; "required": false; }; "className": { "alias": "className"; "required": false; }; "iconPrefixName": { "alias": "iconPrefixName"; "required": false; }; "iconSuffixName": { "alias": "iconSuffixName"; "required": false; }; "emitedChangedValue1": { "alias": "emitedChangedValue1"; "required": false; }; }, {}, never, never, true, never>;
88
+ static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent<any>, "app-input", never, { "floatLabel": { "alias": "floatLabel"; "required": false; }; "className": { "alias": "className"; "required": false; }; "iconPrefixName": { "alias": "iconPrefixName"; "required": false; }; "iconSuffixName": { "alias": "iconSuffixName"; "required": false; }; "emitedChangedValue1": { "alias": "emitedChangedValue1"; "required": false; }; "mapFn": { "alias": "mapFn"; "required": false; }; "filterFn": { "alias": "filterFn"; "required": false; }; }, {}, never, never, true, never>;
14
89
  }
@@ -11,5 +11,5 @@ import { NgClass } from "@angular/common";
11
11
  import { TranslatePipe } from "../../../pipes/translate.pipe";
12
12
  export declare const MatDatePickerImports: (typeof MatDatepickerInput | typeof MatDatepickerToggle | typeof MatDatepickerModule)[];
13
13
  export declare const MatFormImports: (typeof MatInput | typeof MatFormFieldModule | typeof MatFormField)[];
14
- export declare const Shareds: (typeof TranslatePipe | typeof NgClass | typeof FormLabelComponent | typeof ReactiveFormsModule | typeof ValidationErrorsComponent | typeof InfoItemComponent)[];
14
+ export declare const Shareds: (typeof NgClass | typeof ReactiveFormsModule | typeof TranslatePipe | typeof FormLabelComponent | typeof ValidationErrorsComponent | typeof InfoItemComponent)[];
15
15
  export declare const TextLanguageDirectives: (typeof EnOnlyDirective | typeof ArOnlyDirective)[];
@@ -2,6 +2,7 @@ import { DestroyRef, OnInit } from '@angular/core';
2
2
  import { Form, Section } from "../../interfaces";
3
3
  import { ActionStateService, CoreI18nService } from "../../services";
4
4
  import { FormBuilder, FormGroup, ValidatorFn } from "@angular/forms";
5
+ import { InputMappers } from '../../components/shared-components/form-field/input/input-map-filter/input-mappers';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class RequestDetailsSectionComponent implements OnInit {
7
8
  i18n: CoreI18nService;
@@ -67,6 +68,8 @@ export declare class RequestDetailsSectionComponent implements OnInit {
67
68
  customCallSubmit(action: string): void;
68
69
  resetForm(): void;
69
70
  pageChanged(event: any): void;
71
+ mapFn: typeof InputMappers.toLowerCase;
72
+ filterFn: import("../../components/shared-components").InputFilterFn;
70
73
  static ɵfac: i0.ɵɵFactoryDeclaration<RequestDetailsSectionComponent, never>;
71
74
  static ɵcmp: i0.ɵɵComponentDeclaration<RequestDetailsSectionComponent, "app-request-details-section", never, { "isReadOnly": { "alias": "isReadOnly"; "required": false; }; "section": { "alias": "section"; "required": false; }; "form": { "alias": "form"; "required": false; }; "lov": { "alias": "lov"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, never, true, never>;
72
75
  }
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "bpm-core",
3
- "version": "0.0.126",
3
+ "version": "0.0.128",
4
+ "bin": {
5
+ "bpm-core": "./cli/index.js"
6
+ },
4
7
  "peerDependencies": {
5
8
  "@angular/common": "^19.0.0",
6
9
  "@angular/core": "^19.0.0",