@ukho/admiralty-angular 0.0.0

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,45 @@
1
+
2
+ import * as d from './components';
3
+
4
+ export const DIRECTIVES = [
5
+ d.AdmiraltyBreadcrumb,
6
+ d.AdmiraltyBreadcrumbs,
7
+ d.AdmiraltyButton,
8
+ d.AdmiraltyCard,
9
+ d.AdmiraltyCheckbox,
10
+ d.AdmiraltyColourBlock,
11
+ d.AdmiraltyDialogue,
12
+ d.AdmiraltyExpansion,
13
+ d.AdmiraltyFileInput,
14
+ d.AdmiraltyFilter,
15
+ d.AdmiraltyFilterGroup,
16
+ d.AdmiraltyFooter,
17
+ d.AdmiraltyHeader,
18
+ d.AdmiraltyHeaderMenuItem,
19
+ d.AdmiraltyHeaderProfile,
20
+ d.AdmiraltyHeaderSubMenuItem,
21
+ d.AdmiraltyHint,
22
+ d.AdmiraltyHr,
23
+ d.AdmiraltyIcon,
24
+ d.AdmiraltyInput,
25
+ d.AdmiraltyInputError,
26
+ d.AdmiraltyLabel,
27
+ d.AdmiraltyLink,
28
+ d.AdmiraltyPaginator,
29
+ d.AdmiraltyPhaseBanner,
30
+ d.AdmiraltyProgressBar,
31
+ d.AdmiraltyRadio,
32
+ d.AdmiraltyRadioGroup,
33
+ d.AdmiraltySelect,
34
+ d.AdmiraltySideNav,
35
+ d.AdmiraltySideNavItem,
36
+ d.AdmiraltyTable,
37
+ d.AdmiraltyTableBody,
38
+ d.AdmiraltyTableCell,
39
+ d.AdmiraltyTableHeader,
40
+ d.AdmiraltyTableHeaderCell,
41
+ d.AdmiraltyTableRow,
42
+ d.AdmiraltyTextarea,
43
+ d.AdmiraltyTypeAhead,
44
+ d.AdmiraltyTypeAheadItem
45
+ ];
@@ -0,0 +1,24 @@
1
+ import { Directive, ElementRef } from '@angular/core';
2
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
+
4
+ import { ValueAccessor } from './value-accessor';
5
+
6
+ @Directive({
7
+ /* tslint:disable-next-line:directive-selector */
8
+ selector: 'admiralty-radio',
9
+ host: {
10
+ '(admiraltyRadioChange)': 'handleChangeEvent($event.target.value)'
11
+ },
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: RadioValueAccessor,
16
+ multi: true
17
+ }
18
+ ]
19
+ })
20
+ export class RadioValueAccessor extends ValueAccessor {
21
+ constructor(el: ElementRef) {
22
+ super(el);
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import { Directive, ElementRef } from '@angular/core';
2
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
+
4
+ import { ValueAccessor } from './value-accessor';
5
+
6
+ @Directive({
7
+ /* tslint:disable-next-line:directive-selector */
8
+ selector: 'admiralty-input[type=text]',
9
+ host: {
10
+ '(admiraltyChange)': 'handleChangeEvent($event.target.value)'
11
+ },
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: TextValueAccessor,
16
+ multi: true
17
+ }
18
+ ]
19
+ })
20
+ export class TextValueAccessor extends ValueAccessor {
21
+ constructor(el: ElementRef) {
22
+ super(el);
23
+ }
24
+ }
@@ -0,0 +1,39 @@
1
+ import { Directive, ElementRef, HostListener } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+
4
+ @Directive({})
5
+ export class ValueAccessor implements ControlValueAccessor {
6
+
7
+ private onChange: (value: any) => void = () => {/**/};
8
+ private onTouched: () => void = () => {/**/};
9
+ protected lastValue: any;
10
+
11
+ constructor(protected el: ElementRef) {}
12
+
13
+ writeValue(value: any) {
14
+ this.el.nativeElement.value = this.lastValue = value == null ? '' : value;
15
+ }
16
+
17
+ handleChangeEvent(value: any) {
18
+ if (value !== this.lastValue) {
19
+ this.lastValue = value;
20
+ this.onChange(value);
21
+ }
22
+ }
23
+
24
+ @HostListener('focusout')
25
+ _handleBlurEvent() {
26
+ this.onTouched();
27
+ }
28
+
29
+ registerOnChange(fn: (value: any) => void) {
30
+ this.onChange = fn;
31
+ }
32
+ registerOnTouched(fn: () => void) {
33
+ this.onTouched = fn;
34
+ }
35
+
36
+ setDisabledState(isDisabled: boolean) {
37
+ this.el.nativeElement.disabled = isDisabled;
38
+ }
39
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,39 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "compileOnSave": false,
4
+ "compilerOptions": {
5
+ "baseUrl": "./",
6
+ "paths": {
7
+ "component-library": [
8
+ "dist/component-library/component-library",
9
+ "dist/component-library"
10
+ ]
11
+ },
12
+ "outDir": "./dist/out-tsc",
13
+ "forceConsistentCasingInFileNames": true,
14
+ "strict": true,
15
+ "noImplicitOverride": true,
16
+ "noPropertyAccessFromIndexSignature": true,
17
+ "noImplicitReturns": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "sourceMap": true,
20
+ "declaration": false,
21
+ "downlevelIteration": true,
22
+ "experimentalDecorators": true,
23
+ "moduleResolution": "node",
24
+ "importHelpers": true,
25
+ "target": "es2017",
26
+ "module": "es2020",
27
+ "lib": [
28
+ "es2020",
29
+ "dom"
30
+ ],
31
+ "skipLibCheck": true
32
+ },
33
+ "angularCompilerOptions": {
34
+ "enableI18nLegacyMessageIdFormat": false,
35
+ "strictInjectionParameters": true,
36
+ "strictInputAccessModifiers": true,
37
+ "strictTemplates": true
38
+ }
39
+ }