ngwr 0.0.13 → 0.0.14

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/fesm2015/ngwr.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as i2 from '@angular/common';
2
- import { CommonModule, DOCUMENT } from '@angular/common';
2
+ import { DOCUMENT, CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Directive, Component, ViewEncapsulation, ChangeDetectionStrategy, HostBinding, NgModule, Input, EventEmitter, forwardRef, ViewChild, Output, Optional, Self, Injectable, Inject } from '@angular/core';
4
+ import { Injectable, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Inject, HostBinding, Input, NgModule, Directive, EventEmitter, forwardRef, ViewChild, Output, Self } from '@angular/core';
5
5
  import { Subject, fromEvent } from 'rxjs';
6
6
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
7
7
  import { __decorate } from 'tslib';
@@ -12,644 +12,6 @@ import * as i1$1 from '@angular/forms';
12
12
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
13
13
  import { PlatformModule } from '@angular/cdk/platform';
14
14
 
15
- class BaseComponent {
16
- constructor() {
17
- this.ngUnsubscribe = new Subject();
18
- this._isDestroyed = false;
19
- }
20
- get isDestroyed() {
21
- return this._isDestroyed;
22
- }
23
- ngOnDestroy() {
24
- this._isDestroyed = true;
25
- this.ngUnsubscribe.next(undefined);
26
- this.ngUnsubscribe.complete();
27
- }
28
- }
29
- BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
30
- BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: BaseComponent, ngImport: i0 });
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: BaseComponent, decorators: [{
32
- type: Directive
33
- }] });
34
-
35
- const stylePrefix = 'wr';
36
-
37
- function toBoolean(value) {
38
- return coerceBooleanProperty(value);
39
- }
40
- // eslint-disable
41
- function propDecoratorFactory(name, fallback) {
42
- function propDecorator(target, propName, originalDescriptor) {
43
- const privatePropName = `$$__wrPropDecorator__${propName}`;
44
- if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
45
- console.warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
46
- }
47
- Object.defineProperty(target, privatePropName, {
48
- configurable: true,
49
- writable: true
50
- });
51
- return {
52
- get() {
53
- return originalDescriptor && originalDescriptor.get
54
- ? originalDescriptor.get.bind(this)()
55
- : this[privatePropName];
56
- },
57
- set(value) {
58
- if (originalDescriptor && originalDescriptor.set) {
59
- originalDescriptor.set.bind(this)(fallback(value));
60
- }
61
- this[privatePropName] = fallback(value);
62
- }
63
- };
64
- }
65
- return propDecorator;
66
- }
67
- /**
68
- * Input decorator that handle a prop to do get/set automatically with toBoolean
69
- *
70
- * Why not using @InputBoolean alone without @Input? AOT needs @Input to be visible
71
- *
72
- * @howToUse
73
- * ```
74
- * @Input() @InputBoolean() visible: boolean = false;
75
- *
76
- * // Act as below:
77
- * // @Input()
78
- * // get visible() { return this.__visible; }
79
- * // set visible(value) { this.__visible = value; }
80
- * // __visible = false;
81
- * ```
82
- */
83
- function InputBoolean() {
84
- return propDecoratorFactory('InputBoolean', toBoolean);
85
- }
86
-
87
- // Components
88
-
89
- class WrSpinnerComponent {
90
- constructor() {
91
- this.class = `${stylePrefix}-spin`;
92
- }
93
- }
94
- WrSpinnerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
95
- WrSpinnerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrSpinnerComponent, selector: "wr-spin", host: { properties: { "class": "this.class" } }, ngImport: i0, template: '<svg viewBox="0 0 50 50"><circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5"></circle></svg>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerComponent, decorators: [{
97
- type: Component,
98
- args: [{
99
- selector: 'wr-spin',
100
- template: '<svg viewBox="0 0 50 50"><circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5"></circle></svg>',
101
- encapsulation: ViewEncapsulation.None,
102
- changeDetection: ChangeDetectionStrategy.OnPush
103
- }]
104
- }], propDecorators: { class: [{
105
- type: HostBinding,
106
- args: ['class']
107
- }] } });
108
-
109
- class WrSpinnerModule {
110
- }
111
- WrSpinnerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
112
- WrSpinnerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule, declarations: [WrSpinnerComponent], exports: [WrSpinnerComponent] });
113
- WrSpinnerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule });
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule, decorators: [{
115
- type: NgModule,
116
- args: [{
117
- declarations: [WrSpinnerComponent],
118
- exports: [WrSpinnerComponent]
119
- }]
120
- }] });
121
-
122
- class WrButtonComponent extends BaseComponent {
123
- constructor(cdr, elRef, ngZone, r2) {
124
- super();
125
- this.cdr = cdr;
126
- this.elRef = elRef;
127
- this.ngZone = ngZone;
128
- this.r2 = r2;
129
- this.color = 'primary';
130
- this.size = 'default';
131
- this.disabled = false;
132
- this.outlined = false;
133
- this.rounded = false;
134
- this.loading = false;
135
- this.block = false;
136
- this.baseClass = `${stylePrefix}-btn`;
137
- }
138
- ngOnInit() {
139
- this.setClasses();
140
- this.ngZone.runOutsideAngular(() => {
141
- /**
142
- * Caretaker note: this event listener could've been added through `host.click` or `HostListener`.
143
- * The compiler generates the `ɵɵlistener` instruction which wraps the actual listener internally into the
144
- * function, which runs `markDirty()` before running the actual listener (the decorated class method).
145
- * Since we're preventing the default behavior and stopping event propagation
146
- * this doesn't require Angular to run the change detection.
147
- */
148
- fromEvent(this.elRef.nativeElement, 'click')
149
- .pipe(takeUntil(this.ngUnsubscribe))
150
- .subscribe(event => {
151
- var _a;
152
- if (this.disabled && ((_a = event.target) === null || _a === void 0 ? void 0 : _a.tagName) === 'A') {
153
- event.preventDefault();
154
- event.stopImmediatePropagation();
155
- }
156
- });
157
- });
158
- }
159
- ngAfterViewInit() {
160
- this.insertSpan(this.elRef.nativeElement.childNodes, this.r2);
161
- }
162
- ngOnChanges(changes) {
163
- var _a, _b;
164
- if (!((_a = changes['disabled']) === null || _a === void 0 ? void 0 : _a.currentValue)) {
165
- this.r2.removeClass(this.elRef.nativeElement, `${this.baseClass}--disabled`);
166
- }
167
- if (!((_b = changes['disabled']) === null || _b === void 0 ? void 0 : _b.currentValue)) {
168
- this.r2.removeClass(this.elRef.nativeElement, `${this.baseClass}--loading`);
169
- }
170
- this.setClasses();
171
- this.cdr.detectChanges();
172
- }
173
- insertSpan(nodes, renderer) {
174
- nodes.forEach(node => {
175
- if (node.nodeName === '#text') {
176
- const span = renderer.createElement('span');
177
- renderer.addClass(span, `${this.baseClass}__text`);
178
- const parent = renderer.parentNode(node);
179
- renderer.insertBefore(parent, span, node);
180
- renderer.appendChild(span, node);
181
- }
182
- });
183
- }
184
- setClasses() {
185
- const el = this.elRef.nativeElement;
186
- const add = (klass) => this.r2.addClass(el, `${this.baseClass}-${klass}`);
187
- this.r2.addClass(el, this.baseClass);
188
- add(this.color);
189
- if (this.rounded) {
190
- add(`-rounded`);
191
- }
192
- if (this.loading) {
193
- add(`-loading`);
194
- }
195
- if (this.block) {
196
- add(`-block`);
197
- }
198
- add(`-${this.size}`);
199
- if (this.outlined) {
200
- add(`-outlined`);
201
- }
202
- if (this.disabled) {
203
- add('-disabled');
204
- }
205
- }
206
- }
207
- WrButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
208
- WrButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrButtonComponent, selector: "wr-btn, [wr-btn]", inputs: { color: "color", size: "size", disabled: "disabled", outlined: "outlined", rounded: "rounded", loading: "loading", block: "block" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content><wr-spin *ngIf="loading"></wr-spin>`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: WrSpinnerComponent, selector: "wr-spin" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
209
- __decorate([
210
- InputBoolean()
211
- ], WrButtonComponent.prototype, "disabled", void 0);
212
- __decorate([
213
- InputBoolean()
214
- ], WrButtonComponent.prototype, "outlined", void 0);
215
- __decorate([
216
- InputBoolean()
217
- ], WrButtonComponent.prototype, "rounded", void 0);
218
- __decorate([
219
- InputBoolean()
220
- ], WrButtonComponent.prototype, "loading", void 0);
221
- __decorate([
222
- InputBoolean()
223
- ], WrButtonComponent.prototype, "block", void 0);
224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonComponent, decorators: [{
225
- type: Component,
226
- args: [{
227
- selector: 'wr-btn, [wr-btn]',
228
- changeDetection: ChangeDetectionStrategy.OnPush,
229
- encapsulation: ViewEncapsulation.None,
230
- template: `<ng-content></ng-content><wr-spin *ngIf="loading"></wr-spin>`
231
- }]
232
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { color: [{
233
- type: Input
234
- }], size: [{
235
- type: Input
236
- }], disabled: [{
237
- type: Input
238
- }], outlined: [{
239
- type: Input
240
- }], rounded: [{
241
- type: Input
242
- }], loading: [{
243
- type: Input
244
- }], block: [{
245
- type: Input
246
- }] } });
247
-
248
- class WrButtonModule {
249
- }
250
- WrButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
251
- WrButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, declarations: [WrButtonComponent], imports: [CommonModule, WrSpinnerModule], exports: [WrButtonComponent] });
252
- WrButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, imports: [CommonModule, WrSpinnerModule] });
253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, decorators: [{
254
- type: NgModule,
255
- args: [{
256
- imports: [CommonModule, WrSpinnerModule],
257
- declarations: [WrButtonComponent],
258
- exports: [WrButtonComponent]
259
- }]
260
- }] });
261
-
262
- class WrCheckboxComponent extends BaseComponent {
263
- constructor(cdr, elRef, focusMonitor, ngZone) {
264
- super();
265
- this.cdr = cdr;
266
- this.elRef = elRef;
267
- this.focusMonitor = focusMonitor;
268
- this.ngZone = ngZone;
269
- this.onChange = () => { };
270
- this.onTouch = () => { };
271
- this.checked = false;
272
- this.disabled = false;
273
- this.autoFocus = false;
274
- this.checkedChange = new EventEmitter();
275
- this.class = `${stylePrefix}-checkbox`;
276
- }
277
- ngOnInit() {
278
- this.ngZone.runOutsideAngular(() => {
279
- fromEvent(this.elRef.nativeElement, 'click')
280
- .pipe(takeUntil(this.ngUnsubscribe))
281
- .subscribe(event => {
282
- event.preventDefault();
283
- this.focus();
284
- if (this.disabled) {
285
- return;
286
- }
287
- this.ngZone.run(() => {
288
- this.onModelChange(!this.checked);
289
- this.cdr.markForCheck();
290
- });
291
- });
292
- fromEvent(this.inputElement.nativeElement, 'click')
293
- .pipe(takeUntil(this.ngUnsubscribe))
294
- .subscribe(event => event.stopPropagation());
295
- });
296
- }
297
- ngAfterViewInit() {
298
- if (this.autoFocus) {
299
- this.focus();
300
- }
301
- }
302
- ngOnDestroy() {
303
- super.ngOnDestroy();
304
- this.focusMonitor.stopMonitoring(this.elRef);
305
- }
306
- writeValue(value) {
307
- this.checked = value;
308
- this.cdr.markForCheck();
309
- }
310
- registerOnChange(fn) {
311
- this.onChange = fn;
312
- }
313
- registerOnTouched(fn) {
314
- this.onTouch = fn;
315
- }
316
- setDisabledState(isDisabled) {
317
- this.disabled = isDisabled;
318
- this.cdr.markForCheck();
319
- }
320
- focus() {
321
- this.focusMonitor.focusVia(this.inputElement, 'keyboard');
322
- }
323
- blur() {
324
- this.inputElement.nativeElement.blur();
325
- }
326
- onModelChange(checked) {
327
- if (!this.disabled) {
328
- this.checked = checked;
329
- this.onChange(this.checked);
330
- this.checkedChange.emit(this.checked);
331
- }
332
- }
333
- }
334
- WrCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.FocusMonitor }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
335
- WrCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrCheckboxComponent, selector: "wr-checkbox", inputs: { checked: "checked", disabled: "disabled", autoFocus: "autoFocus" }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class": "this.class" } }, providers: [
336
- {
337
- provide: NG_VALUE_ACCESSOR,
338
- useExisting: forwardRef(() => WrCheckboxComponent),
339
- multi: true
340
- }
341
- ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<label\n class=\"wr-checkbox-container\"\n [class.wr-checkbox-container--checked]=\"this.checked\"\n [class.wr-checkbox-container--disabled]=\"this.disabled\"\n>\n <input\n #inputElement\n type=\"checkbox\"\n class=\"wr-checkbox-container__input\"\n [attr.autofocus]=\"autoFocus ? 'autofocus' : null\"\n [checked]=\"checked\"\n [ngModel]=\"checked\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"onModelChange($event)\"\n />\n <div class=\"wr-checkbox-container-inner\">\n <div class=\"wr-checkbox-container-inner__mark\"></div>\n </div>\n <ng-content></ng-content>\n</label>\n", dependencies: [{ kind: "directive", type: i1$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
342
- __decorate([
343
- InputBoolean()
344
- ], WrCheckboxComponent.prototype, "checked", void 0);
345
- __decorate([
346
- InputBoolean()
347
- ], WrCheckboxComponent.prototype, "disabled", void 0);
348
- __decorate([
349
- InputBoolean()
350
- ], WrCheckboxComponent.prototype, "autoFocus", void 0);
351
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxComponent, decorators: [{
352
- type: Component,
353
- args: [{ selector: 'wr-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
354
- {
355
- provide: NG_VALUE_ACCESSOR,
356
- useExisting: forwardRef(() => WrCheckboxComponent),
357
- multi: true
358
- }
359
- ], template: "<label\n class=\"wr-checkbox-container\"\n [class.wr-checkbox-container--checked]=\"this.checked\"\n [class.wr-checkbox-container--disabled]=\"this.disabled\"\n>\n <input\n #inputElement\n type=\"checkbox\"\n class=\"wr-checkbox-container__input\"\n [attr.autofocus]=\"autoFocus ? 'autofocus' : null\"\n [checked]=\"checked\"\n [ngModel]=\"checked\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"onModelChange($event)\"\n />\n <div class=\"wr-checkbox-container-inner\">\n <div class=\"wr-checkbox-container-inner__mark\"></div>\n </div>\n <ng-content></ng-content>\n</label>\n" }]
360
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.FocusMonitor }, { type: i0.NgZone }]; }, propDecorators: { inputElement: [{
361
- type: ViewChild,
362
- args: ['inputElement', { static: true }]
363
- }], checked: [{
364
- type: Input
365
- }], disabled: [{
366
- type: Input
367
- }], autoFocus: [{
368
- type: Input
369
- }], checkedChange: [{
370
- type: Output
371
- }], class: [{
372
- type: HostBinding,
373
- args: ['class']
374
- }] } });
375
-
376
- class WrCheckboxModule {
377
- }
378
- WrCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
379
- WrCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, declarations: [WrCheckboxComponent], imports: [CommonModule, FormsModule, A11yModule], exports: [WrCheckboxComponent] });
380
- WrCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, imports: [CommonModule, FormsModule, A11yModule] });
381
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, decorators: [{
382
- type: NgModule,
383
- args: [{
384
- imports: [CommonModule, FormsModule, A11yModule],
385
- declarations: [WrCheckboxComponent],
386
- exports: [WrCheckboxComponent]
387
- }]
388
- }] });
389
-
390
- class WrDividerComponent {
391
- constructor() {
392
- this.class = `${stylePrefix}-divider`;
393
- }
394
- }
395
- WrDividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
396
- WrDividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrDividerComponent, selector: "wr-divider", host: { properties: { "class": "this.class" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
397
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerComponent, decorators: [{
398
- type: Component,
399
- args: [{
400
- selector: 'wr-divider',
401
- template: '',
402
- changeDetection: ChangeDetectionStrategy.OnPush,
403
- encapsulation: ViewEncapsulation.None
404
- }]
405
- }], propDecorators: { class: [{
406
- type: HostBinding,
407
- args: ['class']
408
- }] } });
409
-
410
- class WrDividerModule {
411
- }
412
- WrDividerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
413
- WrDividerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule, declarations: [WrDividerComponent], exports: [WrDividerComponent] });
414
- WrDividerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule });
415
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule, decorators: [{
416
- type: NgModule,
417
- args: [{
418
- declarations: [WrDividerComponent],
419
- exports: [WrDividerComponent]
420
- }]
421
- }] });
422
-
423
- class WrInputDirective extends BaseComponent {
424
- constructor(ngControl) {
425
- super();
426
- this.ngControl = ngControl;
427
- this.class = `${stylePrefix}-input`;
428
- this._disabled = false;
429
- this.disabled$ = new Subject();
430
- }
431
- get disabled() {
432
- if (this.ngControl && this.ngControl.disabled !== null) {
433
- return this.ngControl.disabled;
434
- }
435
- return this._disabled;
436
- }
437
- set disabled(value) {
438
- this._disabled = value != null && `${value}` !== 'false';
439
- }
440
- ngOnInit() {
441
- var _a;
442
- if (this.ngControl) {
443
- (_a = this.ngControl.statusChanges) === null || _a === void 0 ? void 0 : _a.pipe(filter(() => this.ngControl.disabled !== null), takeUntil(this.ngUnsubscribe)).subscribe(() => this.disabled$.next(this.ngControl.disabled));
444
- }
445
- }
446
- ngOnChanges(changes) {
447
- const { disabled } = changes;
448
- if (disabled) {
449
- this.disabled$.next(this.disabled);
450
- }
451
- }
452
- }
453
- WrInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputDirective, deps: [{ token: i1$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
454
- WrInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: WrInputDirective, selector: "wr-input, input[wr-input], textarea[wr-input]", inputs: { disabled: "disabled" }, host: { properties: { "class": "this.class", "class.wr-input--disabled": "this.disabled", "disabled": "this.disabled" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
455
- __decorate([
456
- InputBoolean()
457
- ], WrInputDirective.prototype, "disabled", null);
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputDirective, decorators: [{
459
- type: Directive,
460
- args: [{
461
- selector: 'wr-input, input[wr-input], textarea[wr-input]'
462
- }]
463
- }], ctorParameters: function () {
464
- return [{ type: i1$1.NgControl, decorators: [{
465
- type: Optional
466
- }, {
467
- type: Self
468
- }] }];
469
- }, propDecorators: { class: [{
470
- type: HostBinding,
471
- args: ['class']
472
- }], disabled: [{
473
- type: HostBinding,
474
- args: [`class.${stylePrefix}-input--disabled`]
475
- }, {
476
- type: HostBinding,
477
- args: ['disabled']
478
- }, {
479
- type: Input
480
- }] } });
481
-
482
- class WrInputModule {
483
- }
484
- WrInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
485
- WrInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, declarations: [WrInputDirective], imports: [CommonModule, PlatformModule], exports: [WrInputDirective] });
486
- WrInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, imports: [CommonModule, PlatformModule] });
487
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, decorators: [{
488
- type: NgModule,
489
- args: [{
490
- imports: [CommonModule, PlatformModule],
491
- declarations: [WrInputDirective],
492
- exports: [WrInputDirective]
493
- }]
494
- }] });
495
-
496
- class WrExtendedInputComponent {
497
- constructor(ngControl, elRef, r2) {
498
- this.ngControl = ngControl;
499
- this.elRef = elRef;
500
- this.r2 = r2;
501
- this.class = `${stylePrefix}-extended-input`;
502
- this.disabled = false;
503
- this.value = undefined;
504
- this.touched = false;
505
- this.onChange = (value) => { };
506
- this.onTouched = () => { };
507
- if (ngControl !== null) {
508
- ngControl.valueAccessor = this;
509
- }
510
- }
511
- ngOnInit() {
512
- const el = this.elRef.nativeElement;
513
- const add = (klass) => this.r2.addClass(el, `${this.class}-${klass}`);
514
- if (this.suffix) {
515
- add('-has-suffix');
516
- }
517
- if (this.prefix) {
518
- add('-has-prefix');
519
- }
520
- }
521
- onInput($event) {
522
- this.value = $event.currentTarget.value;
523
- this.touched = true;
524
- this.onChange(this.value);
525
- }
526
- onFocusOut() {
527
- this.touched = true;
528
- this.onTouched();
529
- }
530
- registerOnChange(fn) {
531
- this.onChange = fn;
532
- }
533
- registerOnTouched(fn) {
534
- this.onTouched = fn;
535
- }
536
- writeValue(obj) {
537
- this.value = obj;
538
- }
539
- }
540
- WrExtendedInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputComponent, deps: [{ token: i1$1.NgControl, optional: true, self: true }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
541
- WrExtendedInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrExtendedInputComponent, selector: "wr-extended-input", inputs: { suffix: "suffix", prefix: "prefix" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: "<div class=\"wr-extended-input-prefix\" *ngIf=\"prefix\">\n <span class=\"wr-extended-input-prefix__text\">{{ prefix }}</span>\n</div>\n<input wr-input [disabled]=\"disabled\" [value]=\"value\" (focusout)=\"onFocusOut()\" (input)=\"onInput($event)\" />\n<div class=\"wr-extended-input-suffix\" *ngIf=\"suffix\">\n <span class=\"wr-extended-input-suffix__text\">{{ suffix }}</span>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: WrInputDirective, selector: "wr-input, input[wr-input], textarea[wr-input]", inputs: ["disabled"] }], encapsulation: i0.ViewEncapsulation.None });
542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputComponent, decorators: [{
543
- type: Component,
544
- args: [{ selector: 'wr-extended-input', encapsulation: ViewEncapsulation.None, template: "<div class=\"wr-extended-input-prefix\" *ngIf=\"prefix\">\n <span class=\"wr-extended-input-prefix__text\">{{ prefix }}</span>\n</div>\n<input wr-input [disabled]=\"disabled\" [value]=\"value\" (focusout)=\"onFocusOut()\" (input)=\"onInput($event)\" />\n<div class=\"wr-extended-input-suffix\" *ngIf=\"suffix\">\n <span class=\"wr-extended-input-suffix__text\">{{ suffix }}</span>\n</div>\n" }]
545
- }], ctorParameters: function () {
546
- return [{ type: i1$1.NgControl, decorators: [{
547
- type: Optional
548
- }, {
549
- type: Self
550
- }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }];
551
- }, propDecorators: { class: [{
552
- type: HostBinding,
553
- args: ['class']
554
- }], suffix: [{
555
- type: Input
556
- }], prefix: [{
557
- type: Input
558
- }] } });
559
-
560
- class WrExtendedInputModule {
561
- }
562
- WrExtendedInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
563
- WrExtendedInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, declarations: [WrExtendedInputComponent], imports: [CommonModule, PlatformModule, WrInputModule], exports: [WrExtendedInputComponent] });
564
- WrExtendedInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, imports: [CommonModule, PlatformModule, WrInputModule] });
565
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, decorators: [{
566
- type: NgModule,
567
- args: [{
568
- imports: [CommonModule, PlatformModule, WrInputModule],
569
- declarations: [WrExtendedInputComponent],
570
- exports: [WrExtendedInputComponent]
571
- }]
572
- }] });
573
-
574
- class WrFormErrorComponent {
575
- constructor() {
576
- this.class = `${stylePrefix}-form-error`;
577
- }
578
- }
579
- WrFormErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
580
- WrFormErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrFormErrorComponent, selector: "wr-form-error", host: { properties: { "class": "this.class" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
581
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormErrorComponent, decorators: [{
582
- type: Component,
583
- args: [{
584
- selector: 'wr-form-error',
585
- changeDetection: ChangeDetectionStrategy.OnPush,
586
- encapsulation: ViewEncapsulation.None,
587
- template: `<ng-content></ng-content>`
588
- }]
589
- }], propDecorators: { class: [{
590
- type: HostBinding,
591
- args: ['class']
592
- }] } });
593
-
594
- class WrFormItemComponent {
595
- constructor(cdr, elRef, r2) {
596
- this.cdr = cdr;
597
- this.elRef = elRef;
598
- this.r2 = r2;
599
- this.hasError = false;
600
- this.baseClass = `${stylePrefix}-form-item`;
601
- }
602
- ngOnInit() {
603
- this.setClasses();
604
- }
605
- ngOnChanges(changes) {
606
- var _a;
607
- if (!((_a = changes['hasError']) === null || _a === void 0 ? void 0 : _a.currentValue)) {
608
- this.r2.removeClass(this.elRef.nativeElement, `${this.baseClass}--has-error`);
609
- }
610
- this.setClasses();
611
- this.cdr.detectChanges();
612
- }
613
- setClasses() {
614
- const el = this.elRef.nativeElement;
615
- const add = (klass) => this.r2.addClass(el, `${this.baseClass}-${klass}`);
616
- this.r2.addClass(el, this.baseClass);
617
- if (this.hasError) {
618
- add('-has-error');
619
- }
620
- }
621
- }
622
- WrFormItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
623
- WrFormItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrFormItemComponent, selector: "wr-form-item", inputs: { hasError: "hasError" }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
624
- __decorate([
625
- InputBoolean()
626
- ], WrFormItemComponent.prototype, "hasError", void 0);
627
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormItemComponent, decorators: [{
628
- type: Component,
629
- args: [{
630
- selector: 'wr-form-item',
631
- changeDetection: ChangeDetectionStrategy.OnPush,
632
- encapsulation: ViewEncapsulation.None,
633
- template: `<ng-content></ng-content>`
634
- }]
635
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { hasError: [{
636
- type: Input
637
- }] } });
638
-
639
- class WrFormModule {
640
- }
641
- WrFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
642
- WrFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, declarations: [WrFormItemComponent, WrFormErrorComponent], imports: [CommonModule], exports: [WrFormItemComponent, WrFormErrorComponent] });
643
- WrFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, imports: [CommonModule] });
644
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, decorators: [{
645
- type: NgModule,
646
- args: [{
647
- imports: [CommonModule],
648
- declarations: [WrFormItemComponent, WrFormErrorComponent],
649
- exports: [WrFormItemComponent, WrFormErrorComponent]
650
- }]
651
- }] });
652
-
653
15
  /* 🤖 this file was generated by svg-to-ts */
654
16
  const wrIconAddCircleOutline = {
655
17
  name: 'add-circle-outline',
@@ -1034,96 +396,729 @@ const wrIconSet = [
1034
396
  wrIconWarning
1035
397
  ];
1036
398
 
1037
- class WrIconService {
399
+ class WrIconService {
400
+ /**
401
+ * Access icons registry
402
+ */
403
+ get registry() {
404
+ return WrIconService.registry;
405
+ }
406
+ /**
407
+ * Register all icons
408
+ */
409
+ static registerIcons() {
410
+ wrIconSet.forEach((icon) => WrIconService.registry.set(icon.name, icon.data));
411
+ }
412
+ }
413
+ /**
414
+ * Icons registry
415
+ */
416
+ WrIconService.registry = new Map();
417
+ WrIconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
418
+ WrIconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconService, providedIn: 'root' });
419
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconService, decorators: [{
420
+ type: Injectable,
421
+ args: [{
422
+ providedIn: 'root'
423
+ }]
424
+ }] });
425
+
426
+ class WrIconComponent {
427
+ constructor(elRef, iconService, doc) {
428
+ this.elRef = elRef;
429
+ this.iconService = iconService;
430
+ this.doc = doc;
431
+ this.class = 'wr-icon';
432
+ }
433
+ set name(name) {
434
+ if (!this.iconService.registry.has(name)) {
435
+ console.warn(`Icon ${name} was not found`);
436
+ return;
437
+ }
438
+ if (this.svgIcon) {
439
+ this.elRef.nativeElement.removeChild(this.svgIcon);
440
+ }
441
+ const svgData = this.iconService.registry.get(name) || '';
442
+ this.svgIcon = this.svgElementFromString(svgData);
443
+ this.elRef.nativeElement.appendChild(this.svgIcon);
444
+ }
445
+ svgElementFromString(svgContent) {
446
+ const div = this.doc.createElement('div');
447
+ div.innerHTML = svgContent;
448
+ return div.querySelector('svg') || this.doc.createElementNS('http://www.w3.org/2000/svg', 'path');
449
+ }
450
+ }
451
+ WrIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconComponent, deps: [{ token: i0.ElementRef }, { token: WrIconService }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
452
+ WrIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrIconComponent, selector: "wr-icon[name]", inputs: { name: "name" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
453
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconComponent, decorators: [{
454
+ type: Component,
455
+ args: [{
456
+ selector: 'wr-icon[name]',
457
+ template: '',
458
+ encapsulation: ViewEncapsulation.None,
459
+ changeDetection: ChangeDetectionStrategy.OnPush
460
+ }]
461
+ }], ctorParameters: function () {
462
+ return [{ type: i0.ElementRef }, { type: WrIconService }, { type: undefined, decorators: [{
463
+ type: Optional
464
+ }, {
465
+ type: Inject,
466
+ args: [DOCUMENT]
467
+ }] }];
468
+ }, propDecorators: { class: [{
469
+ type: HostBinding,
470
+ args: ['class']
471
+ }], name: [{
472
+ type: Input
473
+ }] } });
474
+
475
+ class WrIconModule {
476
+ static forRoot() {
477
+ WrIconService.registerIcons();
478
+ return { ngModule: WrIconModule };
479
+ }
480
+ }
481
+ WrIconModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
482
+ WrIconModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule, declarations: [WrIconComponent], exports: [WrIconComponent] });
483
+ WrIconModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule });
484
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule, decorators: [{
485
+ type: NgModule,
486
+ args: [{
487
+ declarations: [WrIconComponent],
488
+ exports: [WrIconComponent]
489
+ }]
490
+ }] });
491
+
492
+ class BaseComponent {
493
+ constructor() {
494
+ this.ngUnsubscribe = new Subject();
495
+ }
496
+ ngOnDestroy() {
497
+ this.ngUnsubscribe.next();
498
+ this.ngUnsubscribe.complete();
499
+ }
500
+ }
501
+ BaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
502
+ BaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: BaseComponent, ngImport: i0 });
503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: BaseComponent, decorators: [{
504
+ type: Directive
505
+ }] });
506
+
507
+ const stylePrefix = 'wr';
508
+
509
+ function toBoolean(value) {
510
+ return coerceBooleanProperty(value);
511
+ }
512
+ // eslint-disable
513
+ function propDecoratorFactory(name, fallback) {
514
+ function propDecorator(target, propName, originalDescriptor) {
515
+ const privatePropName = `$$__wrPropDecorator__${propName}`;
516
+ if (Object.prototype.hasOwnProperty.call(target, privatePropName)) {
517
+ console.warn(`The prop "${privatePropName}" is already exist, it will be overrided by ${name} decorator.`);
518
+ }
519
+ Object.defineProperty(target, privatePropName, {
520
+ configurable: true,
521
+ writable: true
522
+ });
523
+ return {
524
+ get() {
525
+ return originalDescriptor && originalDescriptor.get
526
+ ? originalDescriptor.get.bind(this)()
527
+ : this[privatePropName];
528
+ },
529
+ set(value) {
530
+ if (originalDescriptor && originalDescriptor.set) {
531
+ originalDescriptor.set.bind(this)(fallback(value));
532
+ }
533
+ this[privatePropName] = fallback(value);
534
+ }
535
+ };
536
+ }
537
+ return propDecorator;
538
+ }
539
+ /**
540
+ * Input decorator that handle a prop to do get/set automatically with toBoolean
541
+ *
542
+ * Why not using @InputBoolean alone without @Input? AOT needs @Input to be visible
543
+ *
544
+ * @howToUse
545
+ * ```
546
+ * @Input() @InputBoolean() visible: boolean = false;
547
+ *
548
+ * // Act as below:
549
+ * // @Input()
550
+ * // get visible() { return this.__visible; }
551
+ * // set visible(value) { this.__visible = value; }
552
+ * // __visible = false;
553
+ * ```
554
+ */
555
+ function InputBoolean() {
556
+ return propDecoratorFactory('InputBoolean', toBoolean);
557
+ }
558
+
559
+ // Components
560
+
561
+ class WrSpinnerComponent {
562
+ constructor() {
563
+ this.class = `${stylePrefix}-spin`;
564
+ }
565
+ }
566
+ WrSpinnerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
567
+ WrSpinnerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrSpinnerComponent, selector: "wr-spin", host: { properties: { "class": "this.class" } }, ngImport: i0, template: '<svg viewBox="0 0 50 50"><circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5"></circle></svg>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerComponent, decorators: [{
569
+ type: Component,
570
+ args: [{
571
+ selector: 'wr-spin',
572
+ template: '<svg viewBox="0 0 50 50"><circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5"></circle></svg>',
573
+ encapsulation: ViewEncapsulation.None,
574
+ changeDetection: ChangeDetectionStrategy.OnPush
575
+ }]
576
+ }], propDecorators: { class: [{
577
+ type: HostBinding,
578
+ args: ['class']
579
+ }] } });
580
+
581
+ class WrSpinnerModule {
582
+ }
583
+ WrSpinnerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
584
+ WrSpinnerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule, declarations: [WrSpinnerComponent], exports: [WrSpinnerComponent] });
585
+ WrSpinnerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule });
586
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrSpinnerModule, decorators: [{
587
+ type: NgModule,
588
+ args: [{
589
+ declarations: [WrSpinnerComponent],
590
+ exports: [WrSpinnerComponent]
591
+ }]
592
+ }] });
593
+
594
+ class WrButtonComponent extends BaseComponent {
595
+ constructor(cdr, elRef, ngZone, r2) {
596
+ super();
597
+ this.cdr = cdr;
598
+ this.elRef = elRef;
599
+ this.ngZone = ngZone;
600
+ this.r2 = r2;
601
+ this.color = 'primary';
602
+ this.size = 'default';
603
+ this.icon = null;
604
+ this.iconPosition = 'start';
605
+ this.disabled = false;
606
+ this.outlined = false;
607
+ this.rounded = false;
608
+ this.loading = false;
609
+ this.fullwidth = false;
610
+ this._disabled = this.disabled || null;
611
+ }
612
+ get elClasses() {
613
+ return {
614
+ 'wr-btn': true,
615
+ 'wr-btn--primary': this.color === 'primary',
616
+ 'wr-btn--secondary': this.color === 'secondary',
617
+ 'wr-btn--success': this.color === 'success',
618
+ 'wr-btn--warning': this.color === 'warning',
619
+ 'wr-btn--danger': this.color === 'danger',
620
+ 'wr-btn--light': this.color === 'light',
621
+ 'wr-btn--medium': this.color === 'medium',
622
+ 'wr-btn--dark': this.color === 'dark',
623
+ 'wr-btn--default': this.size === 'default',
624
+ 'wr-btn--small': this.size === 'small',
625
+ 'wr-btn--icon-start': this.icon && this.iconPosition === 'start',
626
+ 'wr-btn--icon-end': this.icon && this.iconPosition === 'end',
627
+ 'wr-btn--outlined': this.outlined,
628
+ 'wr-btn--rounded': this.rounded,
629
+ 'wr-btn--loading': this.loading,
630
+ 'wr-btn--full': this.fullwidth
631
+ };
632
+ }
633
+ ngOnInit() {
634
+ /**
635
+ * Event listener added to prevent default behavior, so we don't need to call change detection
636
+ * By default, compiler wraps HostListener to `ɵɵlistener`, which call `markDirty()` before running actual listener.
637
+ */
638
+ this.ngZone.runOutsideAngular(() => {
639
+ fromEvent(this.elRef.nativeElement, 'click')
640
+ .pipe(takeUntil(this.ngUnsubscribe))
641
+ .subscribe(event => {
642
+ var _a;
643
+ if (this.disabled && ((_a = event.target) === null || _a === void 0 ? void 0 : _a.tagName) === 'A') {
644
+ event.preventDefault();
645
+ event.stopImmediatePropagation();
646
+ }
647
+ });
648
+ });
649
+ }
650
+ ngAfterViewInit() {
651
+ this.insertSpan(this.elRef.nativeElement.childNodes, this.r2);
652
+ }
1038
653
  /**
1039
- * Access icons registry
654
+ * Sanitizing `<ng-content></ng-content>` from other content except #text
655
+ *
656
+ * {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName}
657
+ *
658
+ * @param {NodeList} nodes List of nodes from `nativeElement.childNodes`
659
+ * @param {Renderer2} r2 Renderer2 from `@angular/core`
1040
660
  */
1041
- get registry() {
1042
- return WrIconService.registry;
661
+ insertSpan(nodes, r2) {
662
+ nodes.forEach(node => {
663
+ if (node.nodeName === '#text') {
664
+ const span = r2.createElement('span');
665
+ r2.addClass(span, `wr-btn__text`);
666
+ const parent = r2.parentNode(node);
667
+ r2.insertBefore(parent, span, node);
668
+ r2.appendChild(span, node);
669
+ }
670
+ });
671
+ }
672
+ }
673
+ WrButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
674
+ WrButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrButtonComponent, selector: "wr-btn, button[wr-btn], a[wr-btn]", inputs: { color: "color", size: "size", icon: "icon", iconPosition: "iconPosition", disabled: "disabled", outlined: "outlined", rounded: "rounded", loading: "loading", fullwidth: "fullwidth" }, host: { properties: { "class": "this.elClasses", "disabled": "this._disabled" } }, exportAs: ["wrBtn"], usesInheritance: true, ngImport: i0, template: "<wr-spin class=\"wr-btn__spin\" *ngIf=\"loading\"></wr-spin>\n<wr-icon class=\"wr-btn__icon\" *ngIf=\"icon && iconPosition === 'start'\" [name]=\"icon\"></wr-icon>\n<ng-content></ng-content>\n<wr-icon class=\"wr-btn__icon\" *ngIf=\"icon && iconPosition === 'end'\" [name]=\"icon\"></wr-icon>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: WrSpinnerComponent, selector: "wr-spin" }, { kind: "component", type: WrIconComponent, selector: "wr-icon[name]", inputs: ["name"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
675
+ __decorate([
676
+ InputBoolean()
677
+ ], WrButtonComponent.prototype, "disabled", void 0);
678
+ __decorate([
679
+ InputBoolean()
680
+ ], WrButtonComponent.prototype, "outlined", void 0);
681
+ __decorate([
682
+ InputBoolean()
683
+ ], WrButtonComponent.prototype, "rounded", void 0);
684
+ __decorate([
685
+ InputBoolean()
686
+ ], WrButtonComponent.prototype, "loading", void 0);
687
+ __decorate([
688
+ InputBoolean()
689
+ ], WrButtonComponent.prototype, "fullwidth", void 0);
690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonComponent, decorators: [{
691
+ type: Component,
692
+ args: [{ selector: 'wr-btn, button[wr-btn], a[wr-btn]', exportAs: 'wrBtn', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<wr-spin class=\"wr-btn__spin\" *ngIf=\"loading\"></wr-spin>\n<wr-icon class=\"wr-btn__icon\" *ngIf=\"icon && iconPosition === 'start'\" [name]=\"icon\"></wr-icon>\n<ng-content></ng-content>\n<wr-icon class=\"wr-btn__icon\" *ngIf=\"icon && iconPosition === 'end'\" [name]=\"icon\"></wr-icon>\n" }]
693
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { color: [{
694
+ type: Input
695
+ }], size: [{
696
+ type: Input
697
+ }], icon: [{
698
+ type: Input
699
+ }], iconPosition: [{
700
+ type: Input
701
+ }], disabled: [{
702
+ type: Input
703
+ }], outlined: [{
704
+ type: Input
705
+ }], rounded: [{
706
+ type: Input
707
+ }], loading: [{
708
+ type: Input
709
+ }], fullwidth: [{
710
+ type: Input
711
+ }], elClasses: [{
712
+ type: HostBinding,
713
+ args: ['class']
714
+ }], _disabled: [{
715
+ type: HostBinding,
716
+ args: ['disabled']
717
+ }] } });
718
+
719
+ class WrButtonModule {
720
+ }
721
+ WrButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
722
+ WrButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, declarations: [WrButtonComponent], imports: [CommonModule, WrSpinnerModule, WrIconModule], exports: [WrButtonComponent] });
723
+ WrButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, imports: [CommonModule, WrSpinnerModule, WrIconModule] });
724
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrButtonModule, decorators: [{
725
+ type: NgModule,
726
+ args: [{
727
+ imports: [CommonModule, WrSpinnerModule, WrIconModule],
728
+ declarations: [WrButtonComponent],
729
+ exports: [WrButtonComponent]
730
+ }]
731
+ }] });
732
+
733
+ class WrCheckboxComponent extends BaseComponent {
734
+ constructor(cdr, elRef, focusMonitor, ngZone) {
735
+ super();
736
+ this.cdr = cdr;
737
+ this.elRef = elRef;
738
+ this.focusMonitor = focusMonitor;
739
+ this.ngZone = ngZone;
740
+ this.onChange = () => { };
741
+ this.onTouch = () => { };
742
+ this.checked = false;
743
+ this.disabled = false;
744
+ this.autoFocus = false;
745
+ this.checkedChange = new EventEmitter();
746
+ this.class = `${stylePrefix}-checkbox`;
747
+ }
748
+ ngOnInit() {
749
+ this.ngZone.runOutsideAngular(() => {
750
+ fromEvent(this.elRef.nativeElement, 'click')
751
+ .pipe(takeUntil(this.ngUnsubscribe))
752
+ .subscribe(event => {
753
+ event.preventDefault();
754
+ this.focus();
755
+ if (this.disabled) {
756
+ event.stopImmediatePropagation();
757
+ return;
758
+ }
759
+ this.ngZone.run(() => {
760
+ this.onModelChange(!this.checked);
761
+ this.cdr.markForCheck();
762
+ });
763
+ });
764
+ fromEvent(this.inputElement.nativeElement, 'click')
765
+ .pipe(takeUntil(this.ngUnsubscribe))
766
+ .subscribe(event => event.stopPropagation());
767
+ });
768
+ }
769
+ ngAfterViewInit() {
770
+ if (this.autoFocus) {
771
+ this.focus();
772
+ }
773
+ }
774
+ ngOnDestroy() {
775
+ super.ngOnDestroy();
776
+ this.focusMonitor.stopMonitoring(this.elRef);
777
+ }
778
+ writeValue(value) {
779
+ this.checked = value;
780
+ this.cdr.markForCheck();
781
+ }
782
+ registerOnChange(fn) {
783
+ this.onChange = fn;
784
+ }
785
+ registerOnTouched(fn) {
786
+ this.onTouch = fn;
787
+ }
788
+ setDisabledState(isDisabled) {
789
+ this.disabled = isDisabled;
790
+ this.cdr.markForCheck();
791
+ }
792
+ focus() {
793
+ this.focusMonitor.focusVia(this.inputElement, 'keyboard');
794
+ }
795
+ blur() {
796
+ this.inputElement.nativeElement.blur();
797
+ }
798
+ onModelChange(checked) {
799
+ if (!this.disabled) {
800
+ this.checked = checked;
801
+ this.onChange(this.checked);
802
+ this.checkedChange.emit(this.checked);
803
+ }
804
+ }
805
+ }
806
+ WrCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1.FocusMonitor }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
807
+ WrCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrCheckboxComponent, selector: "wr-checkbox", inputs: { checked: "checked", disabled: "disabled", autoFocus: "autoFocus" }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class": "this.class" } }, providers: [
808
+ {
809
+ provide: NG_VALUE_ACCESSOR,
810
+ useExisting: forwardRef(() => WrCheckboxComponent),
811
+ multi: true
812
+ }
813
+ ], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<label\n class=\"wr-checkbox-container\"\n [class.wr-checkbox-container--checked]=\"this.checked\"\n [class.wr-checkbox-container--disabled]=\"this.disabled\"\n>\n <input\n #inputElement\n type=\"checkbox\"\n class=\"wr-checkbox-container__input\"\n [attr.autofocus]=\"autoFocus ? 'autofocus' : null\"\n [checked]=\"checked\"\n [ngModel]=\"checked\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"onModelChange($event)\"\n />\n <div class=\"wr-checkbox-container-inner\">\n <div class=\"wr-checkbox-container-inner__mark\"></div>\n </div>\n <ng-content></ng-content>\n</label>\n", dependencies: [{ kind: "directive", type: i1$1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
814
+ __decorate([
815
+ InputBoolean()
816
+ ], WrCheckboxComponent.prototype, "checked", void 0);
817
+ __decorate([
818
+ InputBoolean()
819
+ ], WrCheckboxComponent.prototype, "disabled", void 0);
820
+ __decorate([
821
+ InputBoolean()
822
+ ], WrCheckboxComponent.prototype, "autoFocus", void 0);
823
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxComponent, decorators: [{
824
+ type: Component,
825
+ args: [{ selector: 'wr-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
826
+ {
827
+ provide: NG_VALUE_ACCESSOR,
828
+ useExisting: forwardRef(() => WrCheckboxComponent),
829
+ multi: true
830
+ }
831
+ ], template: "<label\n class=\"wr-checkbox-container\"\n [class.wr-checkbox-container--checked]=\"this.checked\"\n [class.wr-checkbox-container--disabled]=\"this.disabled\"\n>\n <input\n #inputElement\n type=\"checkbox\"\n class=\"wr-checkbox-container__input\"\n [attr.autofocus]=\"autoFocus ? 'autofocus' : null\"\n [checked]=\"checked\"\n [ngModel]=\"checked\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"onModelChange($event)\"\n />\n <div class=\"wr-checkbox-container-inner\">\n <div class=\"wr-checkbox-container-inner__mark\"></div>\n </div>\n <ng-content></ng-content>\n</label>\n" }]
832
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1.FocusMonitor }, { type: i0.NgZone }]; }, propDecorators: { inputElement: [{
833
+ type: ViewChild,
834
+ args: ['inputElement', { static: true }]
835
+ }], checked: [{
836
+ type: Input
837
+ }], disabled: [{
838
+ type: Input
839
+ }], autoFocus: [{
840
+ type: Input
841
+ }], checkedChange: [{
842
+ type: Output
843
+ }], class: [{
844
+ type: HostBinding,
845
+ args: ['class']
846
+ }] } });
847
+
848
+ class WrCheckboxModule {
849
+ }
850
+ WrCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
851
+ WrCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, declarations: [WrCheckboxComponent], imports: [CommonModule, FormsModule, A11yModule], exports: [WrCheckboxComponent] });
852
+ WrCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, imports: [CommonModule, FormsModule, A11yModule] });
853
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrCheckboxModule, decorators: [{
854
+ type: NgModule,
855
+ args: [{
856
+ imports: [CommonModule, FormsModule, A11yModule],
857
+ declarations: [WrCheckboxComponent],
858
+ exports: [WrCheckboxComponent]
859
+ }]
860
+ }] });
861
+
862
+ class WrDividerComponent {
863
+ constructor() {
864
+ this.class = `${stylePrefix}-divider`;
865
+ }
866
+ }
867
+ WrDividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
868
+ WrDividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrDividerComponent, selector: "wr-divider", host: { properties: { "class": "this.class" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
869
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerComponent, decorators: [{
870
+ type: Component,
871
+ args: [{
872
+ selector: 'wr-divider',
873
+ template: '',
874
+ changeDetection: ChangeDetectionStrategy.OnPush,
875
+ encapsulation: ViewEncapsulation.None
876
+ }]
877
+ }], propDecorators: { class: [{
878
+ type: HostBinding,
879
+ args: ['class']
880
+ }] } });
881
+
882
+ class WrDividerModule {
883
+ }
884
+ WrDividerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
885
+ WrDividerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule, declarations: [WrDividerComponent], exports: [WrDividerComponent] });
886
+ WrDividerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule });
887
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrDividerModule, decorators: [{
888
+ type: NgModule,
889
+ args: [{
890
+ declarations: [WrDividerComponent],
891
+ exports: [WrDividerComponent]
892
+ }]
893
+ }] });
894
+
895
+ class WrInputDirective extends BaseComponent {
896
+ constructor(ngControl) {
897
+ super();
898
+ this.ngControl = ngControl;
899
+ this.class = `${stylePrefix}-input`;
900
+ this._disabled = false;
901
+ this.disabled$ = new Subject();
1043
902
  }
1044
- /**
1045
- * Register all icons
1046
- */
1047
- static registerIcons() {
1048
- wrIconSet.forEach((icon) => WrIconService.registry.set(icon.name, icon.data));
903
+ get disabled() {
904
+ if (this.ngControl && this.ngControl.disabled !== null) {
905
+ return this.ngControl.disabled;
906
+ }
907
+ return this._disabled;
908
+ }
909
+ set disabled(value) {
910
+ this._disabled = value != null && `${value}` !== 'false';
911
+ }
912
+ ngOnInit() {
913
+ var _a;
914
+ if (this.ngControl) {
915
+ (_a = this.ngControl.statusChanges) === null || _a === void 0 ? void 0 : _a.pipe(filter(() => this.ngControl.disabled !== null), takeUntil(this.ngUnsubscribe)).subscribe(() => this.disabled$.next(this.ngControl.disabled));
916
+ }
917
+ }
918
+ ngOnChanges(changes) {
919
+ const { disabled } = changes;
920
+ if (disabled) {
921
+ this.disabled$.next(this.disabled);
922
+ }
1049
923
  }
1050
924
  }
1051
- /**
1052
- * Icons registry
1053
- */
1054
- WrIconService.registry = new Map();
1055
- WrIconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1056
- WrIconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconService, providedIn: 'root' });
1057
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconService, decorators: [{
1058
- type: Injectable,
925
+ WrInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputDirective, deps: [{ token: i1$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
926
+ WrInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: WrInputDirective, selector: "wr-input, input[wr-input], textarea[wr-input]", inputs: { disabled: "disabled" }, host: { properties: { "class": "this.class", "class.wr-input--disabled": "this.disabled", "disabled": "this.disabled" } }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
927
+ __decorate([
928
+ InputBoolean()
929
+ ], WrInputDirective.prototype, "disabled", null);
930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputDirective, decorators: [{
931
+ type: Directive,
1059
932
  args: [{
1060
- providedIn: 'root'
933
+ selector: 'wr-input, input[wr-input], textarea[wr-input]'
934
+ }]
935
+ }], ctorParameters: function () {
936
+ return [{ type: i1$1.NgControl, decorators: [{
937
+ type: Optional
938
+ }, {
939
+ type: Self
940
+ }] }];
941
+ }, propDecorators: { class: [{
942
+ type: HostBinding,
943
+ args: ['class']
944
+ }], disabled: [{
945
+ type: HostBinding,
946
+ args: [`class.${stylePrefix}-input--disabled`]
947
+ }, {
948
+ type: HostBinding,
949
+ args: ['disabled']
950
+ }, {
951
+ type: Input
952
+ }] } });
953
+
954
+ class WrInputModule {
955
+ }
956
+ WrInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
957
+ WrInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, declarations: [WrInputDirective], imports: [CommonModule, PlatformModule], exports: [WrInputDirective] });
958
+ WrInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, imports: [CommonModule, PlatformModule] });
959
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrInputModule, decorators: [{
960
+ type: NgModule,
961
+ args: [{
962
+ imports: [CommonModule, PlatformModule],
963
+ declarations: [WrInputDirective],
964
+ exports: [WrInputDirective]
1061
965
  }]
1062
966
  }] });
1063
967
 
1064
- class WrIconComponent {
1065
- constructor(elRef, iconService, doc) {
968
+ class WrExtendedInputComponent {
969
+ constructor(ngControl, elRef, r2) {
970
+ this.ngControl = ngControl;
1066
971
  this.elRef = elRef;
1067
- this.iconService = iconService;
1068
- this.doc = doc;
1069
- this.class = 'wr-icon';
972
+ this.r2 = r2;
973
+ this.class = `${stylePrefix}-extended-input`;
974
+ this.disabled = false;
975
+ this.value = undefined;
976
+ this.touched = false;
977
+ this.onChange = (value) => { };
978
+ this.onTouched = () => { };
979
+ if (ngControl !== null) {
980
+ ngControl.valueAccessor = this;
981
+ }
1070
982
  }
1071
- set name(name) {
1072
- if (!this.iconService.registry.has(name)) {
1073
- console.warn(`Icon ${name} was not found`);
1074
- return;
983
+ ngOnInit() {
984
+ const el = this.elRef.nativeElement;
985
+ const add = (klass) => this.r2.addClass(el, `${this.class}-${klass}`);
986
+ if (this.suffix) {
987
+ add('-has-suffix');
1075
988
  }
1076
- if (this.svgIcon) {
1077
- this.elRef.nativeElement.removeChild(this.svgIcon);
989
+ if (this.prefix) {
990
+ add('-has-prefix');
1078
991
  }
1079
- const svgData = this.iconService.registry.get(name) || '';
1080
- this.svgIcon = this.svgElementFromString(svgData);
1081
- this.elRef.nativeElement.appendChild(this.svgIcon);
1082
992
  }
1083
- svgElementFromString(svgContent) {
1084
- const div = this.doc.createElement('div');
1085
- div.innerHTML = svgContent;
1086
- return div.querySelector('svg') || this.doc.createElementNS('http://www.w3.org/2000/svg', 'path');
993
+ onInput($event) {
994
+ this.value = $event.currentTarget.value;
995
+ this.touched = true;
996
+ this.onChange(this.value);
997
+ }
998
+ onFocusOut() {
999
+ this.touched = true;
1000
+ this.onTouched();
1001
+ }
1002
+ registerOnChange(fn) {
1003
+ this.onChange = fn;
1004
+ }
1005
+ registerOnTouched(fn) {
1006
+ this.onTouched = fn;
1007
+ }
1008
+ writeValue(obj) {
1009
+ this.value = obj;
1087
1010
  }
1088
1011
  }
1089
- WrIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconComponent, deps: [{ token: i0.ElementRef }, { token: WrIconService }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1090
- WrIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrIconComponent, selector: "wr-icon[name]", inputs: { name: "name" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1091
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconComponent, decorators: [{
1012
+ WrExtendedInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputComponent, deps: [{ token: i1$1.NgControl, optional: true, self: true }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1013
+ WrExtendedInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrExtendedInputComponent, selector: "wr-extended-input", inputs: { suffix: "suffix", prefix: "prefix" }, host: { properties: { "class": "this.class" } }, ngImport: i0, template: "<div class=\"wr-extended-input-prefix\" *ngIf=\"prefix\">\n <span class=\"wr-extended-input-prefix__text\">{{ prefix }}</span>\n</div>\n<input wr-input [disabled]=\"disabled\" [value]=\"value\" (focusout)=\"onFocusOut()\" (input)=\"onInput($event)\" />\n<div class=\"wr-extended-input-suffix\" *ngIf=\"suffix\">\n <span class=\"wr-extended-input-suffix__text\">{{ suffix }}</span>\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: WrInputDirective, selector: "wr-input, input[wr-input], textarea[wr-input]", inputs: ["disabled"] }], encapsulation: i0.ViewEncapsulation.None });
1014
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputComponent, decorators: [{
1092
1015
  type: Component,
1093
- args: [{
1094
- selector: 'wr-icon[name]',
1095
- template: '',
1096
- encapsulation: ViewEncapsulation.None,
1097
- changeDetection: ChangeDetectionStrategy.OnPush
1098
- }]
1016
+ args: [{ selector: 'wr-extended-input', encapsulation: ViewEncapsulation.None, template: "<div class=\"wr-extended-input-prefix\" *ngIf=\"prefix\">\n <span class=\"wr-extended-input-prefix__text\">{{ prefix }}</span>\n</div>\n<input wr-input [disabled]=\"disabled\" [value]=\"value\" (focusout)=\"onFocusOut()\" (input)=\"onInput($event)\" />\n<div class=\"wr-extended-input-suffix\" *ngIf=\"suffix\">\n <span class=\"wr-extended-input-suffix__text\">{{ suffix }}</span>\n</div>\n" }]
1099
1017
  }], ctorParameters: function () {
1100
- return [{ type: i0.ElementRef }, { type: WrIconService }, { type: undefined, decorators: [{
1018
+ return [{ type: i1$1.NgControl, decorators: [{
1101
1019
  type: Optional
1102
1020
  }, {
1103
- type: Inject,
1104
- args: [DOCUMENT]
1105
- }] }];
1021
+ type: Self
1022
+ }] }, { type: i0.ElementRef }, { type: i0.Renderer2 }];
1106
1023
  }, propDecorators: { class: [{
1107
1024
  type: HostBinding,
1108
1025
  args: ['class']
1109
- }], name: [{
1026
+ }], suffix: [{
1027
+ type: Input
1028
+ }], prefix: [{
1110
1029
  type: Input
1111
1030
  }] } });
1112
1031
 
1113
- class WrIconModule {
1114
- static forRoot() {
1115
- WrIconService.registerIcons();
1116
- return { ngModule: WrIconModule };
1032
+ class WrExtendedInputModule {
1033
+ }
1034
+ WrExtendedInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1035
+ WrExtendedInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, declarations: [WrExtendedInputComponent], imports: [CommonModule, PlatformModule, WrInputModule], exports: [WrExtendedInputComponent] });
1036
+ WrExtendedInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, imports: [CommonModule, PlatformModule, WrInputModule] });
1037
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrExtendedInputModule, decorators: [{
1038
+ type: NgModule,
1039
+ args: [{
1040
+ imports: [CommonModule, PlatformModule, WrInputModule],
1041
+ declarations: [WrExtendedInputComponent],
1042
+ exports: [WrExtendedInputComponent]
1043
+ }]
1044
+ }] });
1045
+
1046
+ class WrFormErrorComponent {
1047
+ constructor() {
1048
+ this.class = `${stylePrefix}-form-error`;
1117
1049
  }
1118
1050
  }
1119
- WrIconModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1120
- WrIconModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule, declarations: [WrIconComponent], exports: [WrIconComponent] });
1121
- WrIconModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule });
1122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrIconModule, decorators: [{
1051
+ WrFormErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1052
+ WrFormErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrFormErrorComponent, selector: "wr-form-error", host: { properties: { "class": "this.class" } }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1053
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormErrorComponent, decorators: [{
1054
+ type: Component,
1055
+ args: [{
1056
+ selector: 'wr-form-error',
1057
+ changeDetection: ChangeDetectionStrategy.OnPush,
1058
+ encapsulation: ViewEncapsulation.None,
1059
+ template: `<ng-content></ng-content>`
1060
+ }]
1061
+ }], propDecorators: { class: [{
1062
+ type: HostBinding,
1063
+ args: ['class']
1064
+ }] } });
1065
+
1066
+ class WrFormItemComponent {
1067
+ constructor(cdr, elRef, r2) {
1068
+ this.cdr = cdr;
1069
+ this.elRef = elRef;
1070
+ this.r2 = r2;
1071
+ this.hasError = false;
1072
+ this.baseClass = `${stylePrefix}-form-item`;
1073
+ }
1074
+ ngOnInit() {
1075
+ this.setClasses();
1076
+ }
1077
+ ngOnChanges(changes) {
1078
+ var _a;
1079
+ if (!((_a = changes['hasError']) === null || _a === void 0 ? void 0 : _a.currentValue)) {
1080
+ this.r2.removeClass(this.elRef.nativeElement, `${this.baseClass}--has-error`);
1081
+ }
1082
+ this.setClasses();
1083
+ this.cdr.detectChanges();
1084
+ }
1085
+ setClasses() {
1086
+ const el = this.elRef.nativeElement;
1087
+ const add = (klass) => this.r2.addClass(el, `${this.baseClass}-${klass}`);
1088
+ this.r2.addClass(el, this.baseClass);
1089
+ if (this.hasError) {
1090
+ add('-has-error');
1091
+ }
1092
+ }
1093
+ }
1094
+ WrFormItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormItemComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1095
+ WrFormItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WrFormItemComponent, selector: "wr-form-item", inputs: { hasError: "hasError" }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1096
+ __decorate([
1097
+ InputBoolean()
1098
+ ], WrFormItemComponent.prototype, "hasError", void 0);
1099
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormItemComponent, decorators: [{
1100
+ type: Component,
1101
+ args: [{
1102
+ selector: 'wr-form-item',
1103
+ changeDetection: ChangeDetectionStrategy.OnPush,
1104
+ encapsulation: ViewEncapsulation.None,
1105
+ template: `<ng-content></ng-content>`
1106
+ }]
1107
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { hasError: [{
1108
+ type: Input
1109
+ }] } });
1110
+
1111
+ class WrFormModule {
1112
+ }
1113
+ WrFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1114
+ WrFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, declarations: [WrFormItemComponent, WrFormErrorComponent], imports: [CommonModule], exports: [WrFormItemComponent, WrFormErrorComponent] });
1115
+ WrFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, imports: [CommonModule] });
1116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WrFormModule, decorators: [{
1123
1117
  type: NgModule,
1124
1118
  args: [{
1125
- declarations: [WrIconComponent],
1126
- exports: [WrIconComponent]
1119
+ imports: [CommonModule],
1120
+ declarations: [WrFormItemComponent, WrFormErrorComponent],
1121
+ exports: [WrFormItemComponent, WrFormErrorComponent]
1127
1122
  }]
1128
1123
  }] });
1129
1124