ngwr 0.0.13 → 0.0.15

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