@hmcts/opal-frontend-common 0.0.97 → 0.0.98
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.
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { HostListener, Input, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class TrimLeadingTrailingWhitespaceDirective {
|
|
5
|
+
control;
|
|
6
|
+
onFocusOut() {
|
|
7
|
+
if (!this.control)
|
|
8
|
+
return;
|
|
9
|
+
const value = this.control.value;
|
|
10
|
+
if (typeof value !== 'string') {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const trimmedValue = value.trim();
|
|
14
|
+
if (trimmedValue === value) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.control.setValue(trimmedValue);
|
|
18
|
+
}
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: TrimLeadingTrailingWhitespaceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
20
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.19", type: TrimLeadingTrailingWhitespaceDirective, isStandalone: true, selector: "[opalLibTrimLeadingTrailingWhitespace]", inputs: { control: ["opalLibTrimLeadingTrailingWhitespace", "control"] }, host: { listeners: { "focusout": "onFocusOut()" } }, ngImport: i0 });
|
|
21
|
+
}
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: TrimLeadingTrailingWhitespaceDirective, decorators: [{
|
|
23
|
+
type: Directive,
|
|
24
|
+
args: [{
|
|
25
|
+
selector: '[opalLibTrimLeadingTrailingWhitespace]',
|
|
26
|
+
standalone: true,
|
|
27
|
+
}]
|
|
28
|
+
}], propDecorators: { control: [{
|
|
29
|
+
type: Input,
|
|
30
|
+
args: ['opalLibTrimLeadingTrailingWhitespace']
|
|
31
|
+
}], onFocusOut: [{
|
|
32
|
+
type: HostListener,
|
|
33
|
+
args: ['focusout']
|
|
34
|
+
}] } });
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Generated bundle index. Do not edit.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export { TrimLeadingTrailingWhitespaceDirective };
|
|
41
|
+
//# sourceMappingURL=hmcts-opal-frontend-common-directives-trim-leading-trailing-whitespace.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmcts/opal-frontend-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.98",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -601,6 +601,11 @@
|
|
|
601
601
|
"types": "./types/hmcts-opal-frontend-common-directives-govuk-button.d.ts",
|
|
602
602
|
"default": "./fesm2022/hmcts-opal-frontend-common-directives-govuk-button.mjs"
|
|
603
603
|
},
|
|
604
|
+
"./directives/trim-leading-trailing-whitespace": {
|
|
605
|
+
"import": "./fesm2022/hmcts-opal-frontend-common-directives-trim-leading-trailing-whitespace.mjs",
|
|
606
|
+
"types": "./types/hmcts-opal-frontend-common-directives-trim-leading-trailing-whitespace.d.ts",
|
|
607
|
+
"default": "./fesm2022/hmcts-opal-frontend-common-directives-trim-leading-trailing-whitespace.mjs"
|
|
608
|
+
},
|
|
604
609
|
"./directives/moj-multi-select": {
|
|
605
610
|
"import": "./fesm2022/hmcts-opal-frontend-common-directives-moj-multi-select.mjs",
|
|
606
611
|
"types": "./types/hmcts-opal-frontend-common-directives-moj-multi-select.d.ts",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare class TrimLeadingTrailingWhitespaceDirective {
|
|
5
|
+
control: AbstractControl;
|
|
6
|
+
onFocusOut(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TrimLeadingTrailingWhitespaceDirective, never>;
|
|
8
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TrimLeadingTrailingWhitespaceDirective, "[opalLibTrimLeadingTrailingWhitespace]", never, { "control": { "alias": "opalLibTrimLeadingTrailingWhitespace"; "required": false; }; }, {}, never, never, true, never>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { TrimLeadingTrailingWhitespaceDirective };
|
|
@@ -50,7 +50,7 @@ declare class DateService {
|
|
|
50
50
|
* @param format - The format of the string value.
|
|
51
51
|
* @returns A DateTime object representing the parsed value.
|
|
52
52
|
*/
|
|
53
|
-
getFromFormat(value: string, format: string): DateTime<
|
|
53
|
+
getFromFormat(value: string, format: string): DateTime<boolean>;
|
|
54
54
|
/**
|
|
55
55
|
* Returns an object containing the age and age group based on the date of birth.
|
|
56
56
|
* @param dateOfBirth - The date of birth to calculate the age from.
|
|
@@ -85,7 +85,7 @@ declare class DateService {
|
|
|
85
85
|
* @param value - The string value in ISO format.
|
|
86
86
|
* @returns A DateTime object representing the given value.
|
|
87
87
|
*/
|
|
88
|
-
getFromIso(value: string): DateTime<
|
|
88
|
+
getFromIso(value: string): DateTime<boolean>;
|
|
89
89
|
/**
|
|
90
90
|
* Returns the current date and time.
|
|
91
91
|
* @returns {DateTime} The current date and time.
|