ngwr 0.0.3 → 0.0.4
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/button/button.component.d.ts +28 -0
- package/button/button.module.d.ts +9 -0
- package/button/{index.ts → index.d.ts} +0 -0
- package/core/util/convert.d.ts +18 -0
- package/core/util/{index.ts → index.d.ts} +0 -0
- package/divider/divider.component.d.ts +6 -0
- package/divider/divider.module.d.ts +8 -0
- package/divider/{index.ts → index.d.ts} +0 -0
- package/esm2020/button/button.component.mjs +138 -0
- package/esm2020/button/button.module.mjs +19 -0
- package/esm2020/button/index.mjs +3 -0
- package/esm2020/core/util/convert.mjs +50 -0
- package/esm2020/core/util/index.mjs +2 -0
- package/esm2020/divider/divider.component.mjs +24 -0
- package/esm2020/divider/divider.module.mjs +18 -0
- package/esm2020/divider/index.mjs +3 -0
- package/esm2020/extended-input/extended-input.component.mjs +67 -0
- package/esm2020/extended-input/extended-input.module.mjs +28 -0
- package/esm2020/extended-input/index.mjs +3 -0
- package/esm2020/form/form-error.component.mjs +29 -0
- package/esm2020/form/form-item.component.mjs +57 -0
- package/esm2020/form/form.module.mjs +27 -0
- package/esm2020/form/index.mjs +4 -0
- package/esm2020/icon/index.mjs +5 -0
- package/esm2020/icon/wr-icon.component.mjs +51 -0
- package/esm2020/icon/wr-icon.module.mjs +21 -0
- package/esm2020/icon/wr-icon.service.mjs +30 -0
- package/esm2020/icon/wr-icons.mjs +224 -0
- package/esm2020/input/index.mjs +3 -0
- package/esm2020/input/input.directive.mjs +66 -0
- package/esm2020/input/input.module.mjs +23 -0
- package/esm2020/ngwr.mjs +5 -0
- package/esm2020/password-input/index.mjs +3 -0
- package/esm2020/password-input/password-input.component.mjs +56 -0
- package/esm2020/password-input/password-input.module.mjs +36 -0
- package/esm2020/public-api.mjs +11 -0
- package/esm2020/skeleton/index.mjs +3 -0
- package/esm2020/skeleton/skeleton.component.mjs +38 -0
- package/esm2020/skeleton/skeleton.module.mjs +19 -0
- package/esm2020/spinner/index.mjs +3 -0
- package/esm2020/spinner/spinner.component.mjs +22 -0
- package/esm2020/spinner/spinner.module.mjs +18 -0
- package/esm2020/tag/index.mjs +3 -0
- package/esm2020/tag/tag.component.mjs +99 -0
- package/esm2020/tag/tag.module.mjs +19 -0
- package/extended-input/extended-input.component.d.ts +25 -0
- package/extended-input/extended-input.module.d.ts +10 -0
- package/extended-input/{index.ts → index.d.ts} +0 -0
- package/fesm2015/ngwr.mjs +1102 -0
- package/fesm2015/ngwr.mjs.map +1 -0
- package/fesm2020/ngwr.mjs +1092 -0
- package/fesm2020/ngwr.mjs.map +1 -0
- package/form/form-error.component.d.ts +9 -0
- package/form/form-item.component.d.ts +16 -0
- package/form/form.module.d.ts +9 -0
- package/form/{index.ts → index.d.ts} +0 -0
- package/icon/{index.ts → index.d.ts} +0 -0
- package/icon/wr-icon.component.d.ts +16 -0
- package/icon/wr-icon.module.d.ts +9 -0
- package/icon/wr-icon.service.d.ts +17 -0
- package/icon/wr-icons.d.ts +315 -0
- package/index.d.ts +5 -0
- package/input/{index.ts → index.d.ts} +0 -0
- package/input/input.directive.d.ts +19 -0
- package/input/input.module.d.ts +9 -0
- package/package.json +23 -3
- package/password-input/{index.ts → index.d.ts} +0 -0
- package/password-input/password-input.component.d.ts +21 -0
- package/password-input/password-input.module.d.ts +11 -0
- package/{public-api.ts → public-api.d.ts} +0 -0
- package/skeleton/{index.ts → index.d.ts} +0 -0
- package/skeleton/skeleton.component.d.ts +13 -0
- package/skeleton/skeleton.module.d.ts +9 -0
- package/spinner/{index.ts → index.d.ts} +0 -0
- package/spinner/spinner.component.d.ts +6 -0
- package/spinner/spinner.module.d.ts +8 -0
- package/tag/{index.ts → index.d.ts} +0 -0
- package/tag/tag.component.d.ts +21 -0
- package/tag/tag.module.d.ts +9 -0
- package/button/button.component.ts +0 -132
- package/button/button.module.ts +0 -11
- package/core/types/convert-input.ts +0 -2
- package/core/types/index.ts +0 -3
- package/core/types/indexable.ts +0 -3
- package/core/types/ng-class.ts +0 -11
- package/core/util/convert.ts +0 -63
- package/divider/divider.component.ts +0 -13
- package/divider/divider.module.ts +0 -10
- package/extended-input/extended-input.component.html +0 -13
- package/extended-input/extended-input.component.ts +0 -77
- package/extended-input/extended-input.module.ts +0 -17
- package/form/form-error.component.ts +0 -20
- package/form/form-item.component.ts +0 -60
- package/form/form.module.ts +0 -17
- package/icon/svg/aab.svg +0 -1
- package/icon/svg/add.svg +0 -1
- package/icon/svg/alert.svg +0 -1
- package/icon/svg/apk.svg +0 -1
- package/icon/svg/arrow-back.svg +0 -1
- package/icon/svg/bug.svg +0 -1
- package/icon/svg/caret-back.svg +0 -1
- package/icon/svg/caret-forward.svg +0 -1
- package/icon/svg/checkmark-circle.svg +0 -1
- package/icon/svg/chevron-down.svg +0 -1
- package/icon/svg/chevron-up.svg +0 -1
- package/icon/svg/clock.svg +0 -1
- package/icon/svg/close-circle.svg +0 -1
- package/icon/svg/copy.svg +0 -1
- package/icon/svg/document.svg +0 -1
- package/icon/svg/dots-horizontal.svg +0 -1
- package/icon/svg/dots-vertical.svg +0 -1
- package/icon/svg/download.svg +0 -1
- package/icon/svg/eye-off.svg +0 -1
- package/icon/svg/eye.svg +0 -1
- package/icon/svg/flash.svg +0 -1
- package/icon/svg/folder.svg +0 -1
- package/icon/svg/help.svg +0 -1
- package/icon/svg/info-circle-outline.svg +0 -1
- package/icon/svg/ipa.svg +0 -1
- package/icon/svg/logo-android.svg +0 -1
- package/icon/svg/logo-apple.svg +0 -1
- package/icon/svg/logo-appscreener.svg +0 -1
- package/icon/svg/logo-oversecured.svg +0 -1
- package/icon/svg/logo-stingray.svg +0 -1
- package/icon/svg/modules.svg +0 -1
- package/icon/svg/play-back.svg +0 -1
- package/icon/svg/play-circle.svg +0 -1
- package/icon/svg/play-forward.svg +0 -1
- package/icon/svg/play.svg +0 -1
- package/icon/svg/reader.svg +0 -1
- package/icon/svg/repeat.svg +0 -1
- package/icon/svg/search.svg +0 -1
- package/icon/svg/stop-circle.svg +0 -1
- package/icon/svg/stop.svg +0 -1
- package/icon/svg/trash.svg +0 -1
- package/icon/svg/user.svg +0 -1
- package/icon/svg/warning.svg +0 -1
- package/icon/svg/zip.svg +0 -1
- package/icon/wr-icon.component.ts +0 -52
- package/icon/wr-icon.module.ts +0 -14
- package/icon/wr-icon.service.ts +0 -28
- package/icon/wr-icons.ts +0 -405
- package/index.ts +0 -1
- package/input/input.directive.ts +0 -65
- package/input/input.module.ts +0 -16
- package/ng-package.json +0 -11
- package/password-input/password-input.component.html +0 -10
- package/password-input/password-input.component.ts +0 -56
- package/password-input/password-input.module.ts +0 -23
- package/skeleton/skeleton.component.ts +0 -38
- package/skeleton/skeleton.module.ts +0 -11
- package/spinner/spinner.component.ts +0 -11
- package/spinner/spinner.module.ts +0 -10
- package/tag/tag.component.ts +0 -92
- package/tag/tag.module.ts +0 -11
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { NgControl } from '@angular/forms';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class WalrusInputDirective implements OnChanges, OnInit, OnDestroy {
|
|
6
|
+
ngControl: NgControl;
|
|
7
|
+
class: string;
|
|
8
|
+
get disabled(): boolean;
|
|
9
|
+
set disabled(value: boolean);
|
|
10
|
+
_disabled: boolean;
|
|
11
|
+
disabled$: Subject<boolean>;
|
|
12
|
+
private destroy$;
|
|
13
|
+
constructor(ngControl: NgControl);
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
16
|
+
ngOnDestroy(): void;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusInputDirective, [{ optional: true; self: true; }]>;
|
|
18
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<WalrusInputDirective, "wr-input, input[wr-input], textarea[wr-input]", ["wrInput"], { "disabled": "disabled"; }, {}, never, never, false>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./input.directive";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/cdk/platform";
|
|
5
|
+
export declare class WalrusInputModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusInputModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WalrusInputModule, [typeof i1.WalrusInputDirective], [typeof i2.CommonModule, typeof i3.PlatformModule], [typeof i1.WalrusInputDirective]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WalrusInputModule>;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngwr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "NGWR – Angular UI library",
|
|
5
5
|
"author": "Roman Khegay",
|
|
6
6
|
"keywords": [
|
|
@@ -23,5 +23,25 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"tslib": "^2.3.0"
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
},
|
|
27
|
+
"module": "fesm2015/ngwr.mjs",
|
|
28
|
+
"es2020": "fesm2020/ngwr.mjs",
|
|
29
|
+
"esm2020": "esm2020/ngwr.mjs",
|
|
30
|
+
"fesm2020": "fesm2020/ngwr.mjs",
|
|
31
|
+
"fesm2015": "fesm2015/ngwr.mjs",
|
|
32
|
+
"typings": "index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
"./package.json": {
|
|
35
|
+
"default": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./index.d.ts",
|
|
39
|
+
"esm2020": "./esm2020/ngwr.mjs",
|
|
40
|
+
"es2020": "./fesm2020/ngwr.mjs",
|
|
41
|
+
"es2015": "./fesm2015/ngwr.mjs",
|
|
42
|
+
"node": "./fesm2015/ngwr.mjs",
|
|
43
|
+
"default": "./fesm2020/ngwr.mjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"sideEffects": false
|
|
47
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ControlValueAccessor, NgControl } from '@angular/forms';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class WalrusPasswordInputComponent implements ControlValueAccessor {
|
|
4
|
+
ngControl: NgControl;
|
|
5
|
+
class: string;
|
|
6
|
+
type: 'input' | 'password';
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
value: string | null;
|
|
9
|
+
touched: boolean;
|
|
10
|
+
constructor(ngControl: NgControl);
|
|
11
|
+
onVisibilityClick($event: any): void;
|
|
12
|
+
onInput($event: any): void;
|
|
13
|
+
onChange: (value: any) => void;
|
|
14
|
+
onTouched: () => void;
|
|
15
|
+
onFocusOut(): void;
|
|
16
|
+
registerOnChange(fn: any): void;
|
|
17
|
+
registerOnTouched(fn: any): void;
|
|
18
|
+
writeValue(obj: any): void;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusPasswordInputComponent, [{ optional: true; self: true; }]>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalrusPasswordInputComponent, "wr-password-input", never, {}, {}, never, never, false>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./password-input.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/cdk/platform";
|
|
5
|
+
import * as i4 from "../input/input.module";
|
|
6
|
+
import * as i5 from "../icon/wr-icon.module";
|
|
7
|
+
export declare class WalrusPasswordInputModule {
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusPasswordInputModule, never>;
|
|
9
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WalrusPasswordInputModule, [typeof i1.WalrusPasswordInputComponent], [typeof i2.CommonModule, typeof i3.PlatformModule, typeof i4.WalrusInputModule, typeof i5.WrIconModule], [typeof i1.WalrusPasswordInputComponent]>;
|
|
10
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WalrusPasswordInputModule>;
|
|
11
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AfterViewInit, ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class WalrusSkeletonComponent implements AfterViewInit, OnDestroy {
|
|
4
|
+
private readonly el;
|
|
5
|
+
color: 'light' | 'dark';
|
|
6
|
+
classes: string;
|
|
7
|
+
private destroy$;
|
|
8
|
+
constructor(el: ElementRef);
|
|
9
|
+
ngAfterViewInit(): void;
|
|
10
|
+
ngOnDestroy(): void;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusSkeletonComponent, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalrusSkeletonComponent, "wr-skeleton", ["wrSkeleton"], { "color": "color"; }, {}, never, never, false>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./skeleton.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "../spinner/spinner.module";
|
|
5
|
+
export declare class WalrusSkeletonModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusSkeletonModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WalrusSkeletonModule, [typeof i1.WalrusSkeletonComponent], [typeof i2.CommonModule, typeof i3.WalrusSpinnerModule], [typeof i1.WalrusSkeletonComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WalrusSkeletonModule>;
|
|
9
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class WalrusSpinnerComponent {
|
|
3
|
+
class: string;
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusSpinnerComponent, never>;
|
|
5
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalrusSpinnerComponent, "wr-spin", never, {}, {}, never, never, false>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./spinner.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
export declare class WalrusSpinnerModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusSpinnerModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WalrusSpinnerModule, [typeof i1.WalrusSpinnerComponent], [typeof i2.CommonModule], [typeof i1.WalrusSpinnerComponent]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WalrusSpinnerModule>;
|
|
8
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ElementRef, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare type WalrusTagColor = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'dark';
|
|
4
|
+
export declare class WalrusTagComponent implements OnInit, OnDestroy, OnChanges {
|
|
5
|
+
private readonly elementRef;
|
|
6
|
+
private readonly r2;
|
|
7
|
+
color: WalrusTagColor;
|
|
8
|
+
transparent: boolean;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
outline: boolean;
|
|
11
|
+
round: boolean;
|
|
12
|
+
hoverable: boolean;
|
|
13
|
+
private destroy$;
|
|
14
|
+
constructor(elementRef: ElementRef, r2: Renderer2);
|
|
15
|
+
ngOnInit(): void;
|
|
16
|
+
ngOnDestroy(): void;
|
|
17
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
18
|
+
private setClasses;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusTagComponent, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WalrusTagComponent, "wr-tag", ["wrTag"], { "color": "color"; "transparent": "transparent"; "loading": "loading"; "outline": "outline"; "round": "round"; "hoverable": "hoverable"; }, {}, never, ["*"], false>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./tag.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "../spinner/spinner.module";
|
|
5
|
+
export declare class WalrusTagModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WalrusTagModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WalrusTagModule, [typeof i1.WalrusTagComponent], [typeof i2.CommonModule, typeof i3.WalrusSpinnerModule], [typeof i1.WalrusTagComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WalrusTagModule>;
|
|
9
|
+
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterViewInit,
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
ChangeDetectorRef,
|
|
5
|
-
Component,
|
|
6
|
-
ElementRef,
|
|
7
|
-
Input,
|
|
8
|
-
NgZone, OnChanges,
|
|
9
|
-
OnDestroy,
|
|
10
|
-
OnInit,
|
|
11
|
-
Renderer2, SimpleChanges,
|
|
12
|
-
ViewEncapsulation
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import { fromEvent, Subject } from 'rxjs';
|
|
15
|
-
import { takeUntil } from 'rxjs/operators';
|
|
16
|
-
import { InputBoolean } from '../core/util';
|
|
17
|
-
|
|
18
|
-
export type WalrusButtonColor = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
19
|
-
export type WalrusButtonSize = 'default' | 'small';
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'wr-btn, [wr-btn]',
|
|
23
|
-
exportAs: 'wrButton',
|
|
24
|
-
preserveWhitespaces: false,
|
|
25
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
-
encapsulation: ViewEncapsulation.None,
|
|
27
|
-
template: `<ng-content></ng-content><wr-spin *ngIf="loading"></wr-spin>`
|
|
28
|
-
})
|
|
29
|
-
export class WalrusButtonComponent implements OnInit, OnDestroy, AfterViewInit, OnChanges {
|
|
30
|
-
@Input() color: WalrusButtonColor = 'primary';
|
|
31
|
-
@Input() size: WalrusButtonSize = 'default';
|
|
32
|
-
|
|
33
|
-
@Input() @InputBoolean() disabled: boolean | string = false;
|
|
34
|
-
@Input() @InputBoolean() outlined: boolean | string = false;
|
|
35
|
-
@Input() @InputBoolean() rounded: boolean | string = false;
|
|
36
|
-
@Input() @InputBoolean() loading: boolean | string = false;
|
|
37
|
-
@Input() @InputBoolean() block: boolean | string = false;
|
|
38
|
-
|
|
39
|
-
private readonly baseClass: string = 'wr-btn';
|
|
40
|
-
private destroy$: Subject<void> = new Subject<void>();
|
|
41
|
-
|
|
42
|
-
constructor(
|
|
43
|
-
private readonly cdr: ChangeDetectorRef,
|
|
44
|
-
private readonly elRef: ElementRef,
|
|
45
|
-
private readonly ngZone: NgZone,
|
|
46
|
-
private readonly r2: Renderer2,
|
|
47
|
-
) {}
|
|
48
|
-
|
|
49
|
-
ngOnInit(): void {
|
|
50
|
-
this.setClasses();
|
|
51
|
-
|
|
52
|
-
this.ngZone.runOutsideAngular(() => {
|
|
53
|
-
/**
|
|
54
|
-
* Caretaker note: this event listener could've been added through `host.click` or `HostListener`.
|
|
55
|
-
* The compiler generates the `ɵɵlistener` instruction which wraps the actual listener internally into the
|
|
56
|
-
* function, which runs `markDirty()` before running the actual listener (the decorated class method).
|
|
57
|
-
* Since we're preventing the default behavior and stopping event propagation
|
|
58
|
-
* this doesn't require Angular to run the change detection.
|
|
59
|
-
*/
|
|
60
|
-
fromEvent<MouseEvent>(this.elRef.nativeElement, 'click')
|
|
61
|
-
.pipe(takeUntil(this.destroy$))
|
|
62
|
-
.subscribe(event => {
|
|
63
|
-
if (this.disabled && (event.target as HTMLElement)?.tagName === 'A') {
|
|
64
|
-
event.preventDefault();
|
|
65
|
-
event.stopImmediatePropagation();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
ngAfterViewInit(): void {
|
|
72
|
-
this.insertSpan(this.elRef.nativeElement.childNodes, this.r2);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
ngOnDestroy(): void {
|
|
76
|
-
this.destroy$.next();
|
|
77
|
-
this.destroy$.complete();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
81
|
-
if (!changes['disabled']?.currentValue) {
|
|
82
|
-
this.r2.removeClass(this.elRef.nativeElement, `${this.baseClass}--disabled`);
|
|
83
|
-
}
|
|
84
|
-
if (!changes['disabled']?.currentValue) {
|
|
85
|
-
this.r2.removeClass(this.elRef.nativeElement, `${this.baseClass}--loading`);
|
|
86
|
-
}
|
|
87
|
-
this.setClasses();
|
|
88
|
-
this.cdr.detectChanges();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private insertSpan(nodes: NodeList, renderer: Renderer2): void {
|
|
92
|
-
nodes.forEach(node => {
|
|
93
|
-
if (node.nodeName === '#text') {
|
|
94
|
-
const span = renderer.createElement('span');
|
|
95
|
-
renderer.addClass(span, 'wr-btn__text');
|
|
96
|
-
const parent = renderer.parentNode(node);
|
|
97
|
-
renderer.insertBefore(parent, span, node);
|
|
98
|
-
renderer.appendChild(span, node);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
private setClasses() {
|
|
104
|
-
const el = this.elRef.nativeElement;
|
|
105
|
-
const add = (klass: string) => this.r2.addClass(el, `${this.baseClass}-${klass}`);
|
|
106
|
-
|
|
107
|
-
this.r2.addClass(el, this.baseClass);
|
|
108
|
-
add(this.color);
|
|
109
|
-
|
|
110
|
-
if (this.rounded) {
|
|
111
|
-
add(`-rounded`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (this.loading) {
|
|
115
|
-
add(`-loading`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (this.block) {
|
|
119
|
-
add(`-block`);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
add(`-${this.size}`);
|
|
123
|
-
|
|
124
|
-
if (this.outlined) {
|
|
125
|
-
add(`-outlined`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (this.disabled) {
|
|
129
|
-
add('-disabled');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
package/button/button.module.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { WalrusSpinnerModule } from '../spinner';
|
|
4
|
-
import { WalrusButtonComponent } from './button.component';
|
|
5
|
-
|
|
6
|
-
@NgModule({
|
|
7
|
-
imports: [CommonModule, WalrusSpinnerModule],
|
|
8
|
-
declarations: [WalrusButtonComponent],
|
|
9
|
-
exports: [WalrusButtonComponent],
|
|
10
|
-
})
|
|
11
|
-
export class WalrusButtonModule {}
|
package/core/types/index.ts
DELETED
package/core/types/indexable.ts
DELETED
package/core/types/ng-class.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type NgClassType = string | string[] | Set<string> | NgClassInterface;
|
|
2
|
-
|
|
3
|
-
// use klass vs class
|
|
4
|
-
export interface NgClassInterface {
|
|
5
|
-
[klass: string]: any;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// use klass vs class
|
|
9
|
-
export interface NgStyleInterface {
|
|
10
|
-
[klass: string]: any;
|
|
11
|
-
}
|
package/core/util/convert.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
|
-
|
|
3
|
-
export function toBoolean(value: boolean | string): boolean {
|
|
4
|
-
return coerceBooleanProperty(value);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function propDecoratorFactory<T, D>(
|
|
8
|
-
name: string,
|
|
9
|
-
fallback: (v: T) => D
|
|
10
|
-
): (target: any, propName: string) => void {
|
|
11
|
-
function propDecorator(
|
|
12
|
-
target: any,
|
|
13
|
-
propName: string,
|
|
14
|
-
originalDescriptor?: TypedPropertyDescriptor<any>
|
|
15
|
-
): any {
|
|
16
|
-
const privatePropName = `$$__walrusPropDecorator__${propName}`;
|
|
17
|
-
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
|
|
19
|
-
console.warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(target, privatePropName, {
|
|
23
|
-
configurable: true,
|
|
24
|
-
writable: true
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
get(): string {
|
|
29
|
-
return originalDescriptor && originalDescriptor.get
|
|
30
|
-
? originalDescriptor.get.bind(this)()
|
|
31
|
-
: this[privatePropName];
|
|
32
|
-
},
|
|
33
|
-
set(value: T): void {
|
|
34
|
-
if (originalDescriptor && originalDescriptor.set) {
|
|
35
|
-
originalDescriptor.set.bind(this)(fallback(value));
|
|
36
|
-
}
|
|
37
|
-
this[privatePropName] = fallback(value);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return propDecorator;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Input decorator that handle a prop to do get/set automatically with toBoolean
|
|
47
|
-
*
|
|
48
|
-
* Why not using @InputBoolean alone without @Input? AOT needs @Input to be visible
|
|
49
|
-
*
|
|
50
|
-
* @howToUse
|
|
51
|
-
* ```
|
|
52
|
-
* @Input() @InputBoolean() visible: boolean = false;
|
|
53
|
-
*
|
|
54
|
-
* // Act as below:
|
|
55
|
-
* // @Input()
|
|
56
|
-
* // get visible() { return this.__visible; }
|
|
57
|
-
* // set visible(value) { this.__visible = value; }
|
|
58
|
-
* // __visible = false;
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export function InputBoolean(): any {
|
|
62
|
-
return propDecoratorFactory('InputBoolean', toBoolean);
|
|
63
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, HostBinding, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'wr-divider',
|
|
5
|
-
exportAs: 'wrDivider',
|
|
6
|
-
preserveWhitespaces: false,
|
|
7
|
-
template: '',
|
|
8
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
-
encapsulation: ViewEncapsulation.None
|
|
10
|
-
})
|
|
11
|
-
export class WalrusDividerComponent {
|
|
12
|
-
@HostBinding('class') classes = `wr-divider`;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { WalrusDividerComponent } from './divider.component';
|
|
4
|
-
|
|
5
|
-
@NgModule({
|
|
6
|
-
imports: [CommonModule],
|
|
7
|
-
declarations: [WalrusDividerComponent],
|
|
8
|
-
exports: [WalrusDividerComponent]
|
|
9
|
-
})
|
|
10
|
-
export class WalrusDividerModule {}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<div class="wr-extended-input-prefix" *ngIf="prefix">
|
|
2
|
-
<span class="wr-extended-input-prefix__text" >{{ prefix }}</span>
|
|
3
|
-
</div>
|
|
4
|
-
<input
|
|
5
|
-
wr-input
|
|
6
|
-
[disabled]="disabled"
|
|
7
|
-
[value]="value"
|
|
8
|
-
(focusout)="onFocusOut()"
|
|
9
|
-
(input)="onInput($event)"
|
|
10
|
-
>
|
|
11
|
-
<div class="wr-extended-input-suffix" *ngIf="suffix">
|
|
12
|
-
<span class="wr-extended-input-suffix__text" >{{ suffix }}</span>
|
|
13
|
-
</div>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
ElementRef,
|
|
4
|
-
HostBinding,
|
|
5
|
-
Input,
|
|
6
|
-
OnInit,
|
|
7
|
-
Optional,
|
|
8
|
-
Renderer2,
|
|
9
|
-
Self,
|
|
10
|
-
ViewEncapsulation
|
|
11
|
-
} from '@angular/core';
|
|
12
|
-
import { ControlValueAccessor, NgControl } from '@angular/forms';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'wr-extended-input',
|
|
16
|
-
templateUrl: './extended-input.component.html',
|
|
17
|
-
encapsulation: ViewEncapsulation.None
|
|
18
|
-
})
|
|
19
|
-
export class WalrusExtendedInputComponent implements ControlValueAccessor, OnInit {
|
|
20
|
-
@HostBinding('class') class = 'wr-extended-input';
|
|
21
|
-
@Input() suffix?: string;
|
|
22
|
-
@Input() prefix?: string;
|
|
23
|
-
|
|
24
|
-
public disabled: boolean = false;
|
|
25
|
-
public value: string | undefined = undefined;
|
|
26
|
-
public touched = false;
|
|
27
|
-
|
|
28
|
-
constructor(
|
|
29
|
-
@Optional() @Self() public ngControl: NgControl,
|
|
30
|
-
private readonly elRef: ElementRef,
|
|
31
|
-
private readonly r2: Renderer2
|
|
32
|
-
) {
|
|
33
|
-
if (ngControl !== null) {
|
|
34
|
-
ngControl.valueAccessor = this;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public ngOnInit(): void {
|
|
39
|
-
const el = this.elRef.nativeElement;
|
|
40
|
-
const add = (klass: string) => this.r2.addClass(el, `${this.class}-${klass}`);
|
|
41
|
-
|
|
42
|
-
if (this.suffix) {
|
|
43
|
-
add('-has-suffix')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (this.prefix) {
|
|
47
|
-
add('-has-prefix')
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onInput($event: any): void {
|
|
52
|
-
this.value = $event.currentTarget.value;
|
|
53
|
-
this.touched = true;
|
|
54
|
-
this.onChange(this.value);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
onChange = (value: any) => {};
|
|
58
|
-
|
|
59
|
-
onTouched = () => {};
|
|
60
|
-
|
|
61
|
-
onFocusOut(): void {
|
|
62
|
-
this.touched = true;
|
|
63
|
-
this.onTouched();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
registerOnChange(fn: any) {
|
|
67
|
-
this.onChange = fn;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
registerOnTouched(fn: any) {
|
|
71
|
-
this.onTouched = fn;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
writeValue(obj: any): void {
|
|
75
|
-
this.value = obj;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PlatformModule } from '@angular/cdk/platform';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { NgModule } from '@angular/core';
|
|
4
|
-
|
|
5
|
-
import { WalrusInputModule } from '../input';
|
|
6
|
-
import { WalrusExtendedInputComponent } from './extended-input.component';
|
|
7
|
-
|
|
8
|
-
@NgModule({
|
|
9
|
-
imports: [
|
|
10
|
-
CommonModule,
|
|
11
|
-
PlatformModule,
|
|
12
|
-
WalrusInputModule,
|
|
13
|
-
],
|
|
14
|
-
declarations: [WalrusExtendedInputComponent],
|
|
15
|
-
exports: [WalrusExtendedInputComponent]
|
|
16
|
-
})
|
|
17
|
-
export class WalrusExtendedInputModule {}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, HostBinding, OnDestroy, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'wr-form-error',
|
|
6
|
-
exportAs: 'wrFormError',
|
|
7
|
-
preserveWhitespaces: false,
|
|
8
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
-
encapsulation: ViewEncapsulation.None,
|
|
10
|
-
template: `<ng-content></ng-content>`
|
|
11
|
-
})
|
|
12
|
-
export class WalrusFormErrorComponent implements OnDestroy {
|
|
13
|
-
@HostBinding() class = 'wr-form-error';
|
|
14
|
-
private destroy$ = new Subject();
|
|
15
|
-
|
|
16
|
-
ngOnDestroy(): void {
|
|
17
|
-
this.destroy$.next(null);
|
|
18
|
-
this.destroy$.complete();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
ChangeDetectorRef,
|
|
4
|
-
Component,
|
|
5
|
-
ElementRef, Input, OnChanges,
|
|
6
|
-
OnDestroy, OnInit, Renderer2, SimpleChanges,
|
|
7
|
-
ViewEncapsulation
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { Subject } from 'rxjs';
|
|
10
|
-
import { InputBoolean } from '../core/util';
|
|
11
|
-
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'wr-form-item',
|
|
14
|
-
exportAs: 'wrFormItem',
|
|
15
|
-
preserveWhitespaces: false,
|
|
16
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
-
encapsulation: ViewEncapsulation.None,
|
|
18
|
-
template: `<ng-content></ng-content>`
|
|
19
|
-
})
|
|
20
|
-
export class WalrusFormItemComponent implements OnInit, OnDestroy, OnChanges {
|
|
21
|
-
@Input() @InputBoolean() hasError: boolean = false;
|
|
22
|
-
|
|
23
|
-
private readonly destroy$ = new Subject();
|
|
24
|
-
|
|
25
|
-
constructor(
|
|
26
|
-
private readonly cdr: ChangeDetectorRef,
|
|
27
|
-
private readonly el: ElementRef,
|
|
28
|
-
private readonly r2: Renderer2,
|
|
29
|
-
) {}
|
|
30
|
-
|
|
31
|
-
public ngOnInit(): void {
|
|
32
|
-
this.setClasses();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public ngOnDestroy(): void {
|
|
36
|
-
this.destroy$.next(null);
|
|
37
|
-
this.destroy$.complete();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public ngOnChanges(changes: SimpleChanges): void {
|
|
41
|
-
const baseClass = 'wr-form-item';
|
|
42
|
-
if (!changes['hasError']?.currentValue) {
|
|
43
|
-
this.r2.removeClass(this.el.nativeElement, `${baseClass}--has-error`);
|
|
44
|
-
}
|
|
45
|
-
this.setClasses();
|
|
46
|
-
this.cdr.detectChanges();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private setClasses(): void {
|
|
50
|
-
const baseClass = 'wr-form-item';
|
|
51
|
-
const el = this.el.nativeElement;
|
|
52
|
-
const add = (klass: string) => this.r2.addClass(el, `${baseClass}-${klass}`);
|
|
53
|
-
|
|
54
|
-
this.r2.addClass(el, baseClass);
|
|
55
|
-
|
|
56
|
-
if (this.hasError) {
|
|
57
|
-
add('-has-error');
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
package/form/form.module.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { WalrusFormItemComponent } from './form-item.component';
|
|
4
|
-
import { WalrusFormErrorComponent } from './form-error.component';
|
|
5
|
-
|
|
6
|
-
@NgModule({
|
|
7
|
-
imports: [CommonModule],
|
|
8
|
-
declarations: [
|
|
9
|
-
WalrusFormItemComponent,
|
|
10
|
-
WalrusFormErrorComponent
|
|
11
|
-
],
|
|
12
|
-
exports: [
|
|
13
|
-
WalrusFormItemComponent,
|
|
14
|
-
WalrusFormErrorComponent
|
|
15
|
-
]
|
|
16
|
-
})
|
|
17
|
-
export class WalrusFormModule {}
|