@festo-ui/angular 3.1.0-pre-20220203.2 → 3.1.0-pre-20220217.1
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/esm2020/festo-ui-angular.mjs +5 -0
- package/esm2020/index.mjs +18 -0
- package/esm2020/lib/components/breadcrumb/breadcrumb.component.mjs +23 -0
- package/esm2020/lib/components/buttons/button/button.component.mjs +41 -0
- package/esm2020/lib/components/buttons/link-button/link-button.component.mjs +33 -0
- package/esm2020/lib/components/chips/chip/chip.component.mjs +37 -0
- package/esm2020/lib/components/chips/chip-container/chip-container.component.mjs +16 -0
- package/esm2020/lib/components/click-outside.directive.mjs +28 -0
- package/esm2020/lib/components/components.module.mjs +155 -0
- package/esm2020/lib/components/loading-indicator/loading-indicator.component.mjs +16 -0
- package/esm2020/lib/components/modals/alert/alert.component.mjs +52 -0
- package/esm2020/lib/components/modals/confirm/confirm.component.mjs +67 -0
- package/esm2020/lib/components/modals/index.mjs +2 -0
- package/esm2020/lib/components/modals/modal.service.mjs +112 -0
- package/esm2020/lib/components/modals/modals.module.mjs +28 -0
- package/esm2020/lib/components/modals/prompt/prompt.component.mjs +102 -0
- package/esm2020/lib/components/pagination/pagination.component.mjs +55 -0
- package/esm2020/lib/components/popovers/legend/legend.component.mjs +42 -0
- package/esm2020/lib/components/popovers/legend/legend.directive.mjs +31 -0
- package/esm2020/lib/components/popovers/popover/popover.component.mjs +31 -0
- package/esm2020/lib/components/popovers/popover-content/popover-content.component.mjs +82 -0
- package/esm2020/lib/components/popovers/popover-content/popover-content.directive.mjs +39 -0
- package/esm2020/lib/components/popovers/popover-menu/popover-menu.component.mjs +68 -0
- package/esm2020/lib/components/popovers/popover-ref.mjs +25 -0
- package/esm2020/lib/components/popovers/popover.defaults.mjs +60 -0
- package/esm2020/lib/components/popovers/popover.models.mjs +23 -0
- package/esm2020/lib/components/popovers/popover.service.mjs +123 -0
- package/esm2020/lib/components/popovers/tooltip/tooltip.directive.mjs +94 -0
- package/esm2020/lib/components/progress/progress.component.mjs +20 -0
- package/esm2020/lib/components/scroll/index.mjs +2 -0
- package/esm2020/lib/components/scroll/scrollable.directive.mjs +72 -0
- package/esm2020/lib/components/search-input/search-input.component.mjs +150 -0
- package/esm2020/lib/components/snackbar/snackbar-container.component.mjs +21 -0
- package/esm2020/lib/components/snackbar/snackbar-container.directive.mjs +83 -0
- package/esm2020/lib/components/snackbar/snackbar.component.mjs +79 -0
- package/esm2020/lib/components/snackbar/snackbar.models.mjs +2 -0
- package/esm2020/lib/components/snackbar/snackbar.module.mjs +26 -0
- package/esm2020/lib/components/snackbar/snackbar.service.mjs +23 -0
- package/esm2020/lib/components/stepper/stepper.component.mjs +22 -0
- package/esm2020/lib/components/table-header-cell/table-header-cell.directive.mjs +58 -0
- package/esm2020/lib/components/tabs/tab-pane/tab-pane.component.mjs +31 -0
- package/esm2020/lib/components/tabs/tabs.component.mjs +355 -0
- package/esm2020/lib/content/content.module.mjs +20 -0
- package/esm2020/lib/content/icon/icon.component.mjs +17 -0
- package/esm2020/lib/festo-angular.module.mjs +58 -0
- package/esm2020/lib/forms/checkbox/checkbox.component.mjs +149 -0
- package/esm2020/lib/forms/color-indicator/color-indicator.component.mjs +68 -0
- package/esm2020/lib/forms/color-picker/color-helper.mjs +121 -0
- package/esm2020/lib/forms/color-picker/color-picker.component.mjs +273 -0
- package/esm2020/lib/forms/container-host.mjs +27 -0
- package/esm2020/lib/forms/date-picker/date-picker.component.mjs +199 -0
- package/esm2020/lib/forms/date-range-picker/date-range-picker.component.mjs +224 -0
- package/esm2020/lib/forms/forms.module.mjs +146 -0
- package/esm2020/lib/forms/radio/radio.component.mjs +346 -0
- package/esm2020/lib/forms/segment/segment-control/segment-control.component.mjs +52 -0
- package/esm2020/lib/forms/segment/segment.component.mjs +109 -0
- package/esm2020/lib/forms/select/chip-text.pipe.mjs +34 -0
- package/esm2020/lib/forms/select/select-option/select-option.component.mjs +22 -0
- package/esm2020/lib/forms/select/select.component.mjs +257 -0
- package/esm2020/lib/forms/slider/slider.component.mjs +110 -0
- package/esm2020/lib/forms/switch/switch.component.mjs +120 -0
- package/esm2020/lib/forms/text-area/text-area.component.mjs +180 -0
- package/esm2020/lib/forms/text-editor/text-editor.component.mjs +286 -0
- package/esm2020/lib/forms/text-input/text-input.component.mjs +183 -0
- package/esm2020/lib/forms/time-picker/time-picker-dropdown/time-picker-dropdown.component.mjs +89 -0
- package/esm2020/lib/forms/time-picker/time-picker.component.mjs +188 -0
- package/esm2020/lib/forms/unique-selection-dispatcher.mjs +39 -0
- package/esm2020/lib/forms/value-accessor-base.mjs +41 -0
- package/esm2020/lib/layout/layout.module.mjs +18 -0
- package/esm2020/lib/wrappers/flatpickr/flatpickr.component.mjs +59 -0
- package/fesm2015/{festo-ui-angular.js → festo-ui-angular.mjs} +317 -521
- package/fesm2015/festo-ui-angular.mjs.map +1 -0
- package/fesm2020/festo-ui-angular.mjs +5383 -0
- package/fesm2020/festo-ui-angular.mjs.map +1 -0
- package/package.json +31 -16
- package/scss/base/components/breadcrumb/breadcrumb.component.scss +0 -1
- package/scss/base/components/modals/prompt/prompt.component.scss +0 -1
- package/scss/base/components/popovers/legend/legend.component.scss +2 -2
- package/scss/base/components/popovers/popover/styles.scss +3 -3
- package/scss/base/components/popovers/popover-content/popover-content.component.scss +1 -1
- package/scss/base/components/scroll/scroll-story-helper.scss +1 -3
- package/scss/base/components/snackbar/snackbar.component.scss +1 -1
- package/scss/base/components/stepper/stepper.component.scss +16 -15
- package/scss/base/forms/color-picker/color-picker.component.scss +12 -12
- package/scss/base/forms/date-picker/date-picker.component.scss +1 -1
- package/scss/base/forms/date-range-picker/date-range-picker.component.scss +1 -1
- package/scss/base/forms/time-picker/time-picker-dropdown/time-picker-dropdown.component.scss +1 -1
- package/scss/styles.scss +2 -2
- package/bundles/festo-ui-angular.umd.js +0 -6429
- package/bundles/festo-ui-angular.umd.js.map +0 -1
- package/esm2015/festo-ui-angular.js +0 -5
- package/esm2015/festo-ui-angular.js.map +0 -1
- package/esm2015/index.js +0 -18
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/components/breadcrumb/breadcrumb.component.js +0 -27
- package/esm2015/lib/components/breadcrumb/breadcrumb.component.js.map +0 -1
- package/esm2015/lib/components/buttons/button/button.component.js +0 -46
- package/esm2015/lib/components/buttons/button/button.component.js.map +0 -1
- package/esm2015/lib/components/buttons/link-button/link-button.component.js +0 -38
- package/esm2015/lib/components/buttons/link-button/link-button.component.js.map +0 -1
- package/esm2015/lib/components/chips/chip/chip.component.js +0 -42
- package/esm2015/lib/components/chips/chip/chip.component.js.map +0 -1
- package/esm2015/lib/components/chips/chip-container/chip-container.component.js +0 -21
- package/esm2015/lib/components/chips/chip-container/chip-container.component.js.map +0 -1
- package/esm2015/lib/components/click-outside.directive.js +0 -28
- package/esm2015/lib/components/click-outside.directive.js.map +0 -1
- package/esm2015/lib/components/components.module.js +0 -155
- package/esm2015/lib/components/components.module.js.map +0 -1
- package/esm2015/lib/components/loading-indicator/loading-indicator.component.js +0 -21
- package/esm2015/lib/components/loading-indicator/loading-indicator.component.js.map +0 -1
- package/esm2015/lib/components/modals/alert/alert.component.js +0 -57
- package/esm2015/lib/components/modals/alert/alert.component.js.map +0 -1
- package/esm2015/lib/components/modals/confirm/confirm.component.js +0 -73
- package/esm2015/lib/components/modals/confirm/confirm.component.js.map +0 -1
- package/esm2015/lib/components/modals/index.js +0 -2
- package/esm2015/lib/components/modals/index.js.map +0 -1
- package/esm2015/lib/components/modals/modal.service.js +0 -91
- package/esm2015/lib/components/modals/modal.service.js.map +0 -1
- package/esm2015/lib/components/modals/modals.module.js +0 -28
- package/esm2015/lib/components/modals/modals.module.js.map +0 -1
- package/esm2015/lib/components/modals/prompt/prompt.component.js +0 -110
- package/esm2015/lib/components/modals/prompt/prompt.component.js.map +0 -1
- package/esm2015/lib/components/pagination/pagination.component.js +0 -60
- package/esm2015/lib/components/pagination/pagination.component.js.map +0 -1
- package/esm2015/lib/components/popovers/legend/legend.component.js +0 -46
- package/esm2015/lib/components/popovers/legend/legend.component.js.map +0 -1
- package/esm2015/lib/components/popovers/legend/legend.directive.js +0 -31
- package/esm2015/lib/components/popovers/legend/legend.directive.js.map +0 -1
- package/esm2015/lib/components/popovers/popover/popover.component.js +0 -35
- package/esm2015/lib/components/popovers/popover/popover.component.js.map +0 -1
- package/esm2015/lib/components/popovers/popover-content/popover-content.component.js +0 -86
- package/esm2015/lib/components/popovers/popover-content/popover-content.component.js.map +0 -1
- package/esm2015/lib/components/popovers/popover-content/popover-content.directive.js +0 -39
- package/esm2015/lib/components/popovers/popover-content/popover-content.directive.js.map +0 -1
- package/esm2015/lib/components/popovers/popover-menu/popover-menu.component.js +0 -72
- package/esm2015/lib/components/popovers/popover-menu/popover-menu.component.js.map +0 -1
- package/esm2015/lib/components/popovers/popover-ref.js +0 -25
- package/esm2015/lib/components/popovers/popover-ref.js.map +0 -1
- package/esm2015/lib/components/popovers/popover.defaults.js +0 -60
- package/esm2015/lib/components/popovers/popover.defaults.js.map +0 -1
- package/esm2015/lib/components/popovers/popover.models.js +0 -23
- package/esm2015/lib/components/popovers/popover.models.js.map +0 -1
- package/esm2015/lib/components/popovers/popover.service.js +0 -117
- package/esm2015/lib/components/popovers/popover.service.js.map +0 -1
- package/esm2015/lib/components/popovers/tooltip/tooltip.directive.js +0 -96
- package/esm2015/lib/components/popovers/tooltip/tooltip.directive.js.map +0 -1
- package/esm2015/lib/components/progress/progress.component.js +0 -23
- package/esm2015/lib/components/progress/progress.component.js.map +0 -1
- package/esm2015/lib/components/scroll/index.js +0 -2
- package/esm2015/lib/components/scroll/index.js.map +0 -1
- package/esm2015/lib/components/scroll/scrollable.directive.js +0 -73
- package/esm2015/lib/components/scroll/scrollable.directive.js.map +0 -1
- package/esm2015/lib/components/search-input/search-input.component.js +0 -155
- package/esm2015/lib/components/search-input/search-input.component.js.map +0 -1
- package/esm2015/lib/components/snackbar/snackbar-container.component.js +0 -26
- package/esm2015/lib/components/snackbar/snackbar-container.component.js.map +0 -1
- package/esm2015/lib/components/snackbar/snackbar-container.directive.js +0 -83
- package/esm2015/lib/components/snackbar/snackbar-container.directive.js.map +0 -1
- package/esm2015/lib/components/snackbar/snackbar.component.js +0 -85
- package/esm2015/lib/components/snackbar/snackbar.component.js.map +0 -1
- package/esm2015/lib/components/snackbar/snackbar.models.js +0 -2
- package/esm2015/lib/components/snackbar/snackbar.models.js.map +0 -1
- package/esm2015/lib/components/snackbar/snackbar.module.js +0 -26
- package/esm2015/lib/components/snackbar/snackbar.module.js.map +0 -1
- package/esm2015/lib/components/snackbar/snackbar.service.js +0 -23
- package/esm2015/lib/components/snackbar/snackbar.service.js.map +0 -1
- package/esm2015/lib/components/stepper/stepper.component.js +0 -28
- package/esm2015/lib/components/stepper/stepper.component.js.map +0 -1
- package/esm2015/lib/components/table-header-cell/table-header-cell.directive.js +0 -58
- package/esm2015/lib/components/table-header-cell/table-header-cell.directive.js.map +0 -1
- package/esm2015/lib/components/tabs/tab-pane/tab-pane.component.js +0 -35
- package/esm2015/lib/components/tabs/tab-pane/tab-pane.component.js.map +0 -1
- package/esm2015/lib/components/tabs/tabs.component.js +0 -362
- package/esm2015/lib/components/tabs/tabs.component.js.map +0 -1
- package/esm2015/lib/content/content.module.js +0 -24
- package/esm2015/lib/content/content.module.js.map +0 -1
- package/esm2015/lib/content/icon/icon.component.js +0 -23
- package/esm2015/lib/content/icon/icon.component.js.map +0 -1
- package/esm2015/lib/festo-angular.module.js +0 -58
- package/esm2015/lib/festo-angular.module.js.map +0 -1
- package/esm2015/lib/forms/checkbox/checkbox.component.js +0 -156
- package/esm2015/lib/forms/checkbox/checkbox.component.js.map +0 -1
- package/esm2015/lib/forms/color-indicator/color-indicator.component.js +0 -72
- package/esm2015/lib/forms/color-indicator/color-indicator.component.js.map +0 -1
- package/esm2015/lib/forms/color-picker/color-helper.js +0 -121
- package/esm2015/lib/forms/color-picker/color-helper.js.map +0 -1
- package/esm2015/lib/forms/color-picker/color-picker.component.js +0 -280
- package/esm2015/lib/forms/color-picker/color-picker.component.js.map +0 -1
- package/esm2015/lib/forms/container-host.js +0 -27
- package/esm2015/lib/forms/container-host.js.map +0 -1
- package/esm2015/lib/forms/date-picker/date-picker.component.js +0 -205
- package/esm2015/lib/forms/date-picker/date-picker.component.js.map +0 -1
- package/esm2015/lib/forms/date-range-picker/date-range-picker.component.js +0 -230
- package/esm2015/lib/forms/date-range-picker/date-range-picker.component.js.map +0 -1
- package/esm2015/lib/forms/forms.module.js +0 -146
- package/esm2015/lib/forms/forms.module.js.map +0 -1
- package/esm2015/lib/forms/radio/radio.component.js +0 -353
- package/esm2015/lib/forms/radio/radio.component.js.map +0 -1
- package/esm2015/lib/forms/segment/segment-control/segment-control.component.js +0 -58
- package/esm2015/lib/forms/segment/segment-control/segment-control.component.js.map +0 -1
- package/esm2015/lib/forms/segment/segment.component.js +0 -116
- package/esm2015/lib/forms/segment/segment.component.js.map +0 -1
- package/esm2015/lib/forms/select/chip-text.pipe.js +0 -34
- package/esm2015/lib/forms/select/chip-text.pipe.js.map +0 -1
- package/esm2015/lib/forms/select/select-option/select-option.component.js +0 -29
- package/esm2015/lib/forms/select/select-option/select-option.component.js.map +0 -1
- package/esm2015/lib/forms/select/select.component.js +0 -265
- package/esm2015/lib/forms/select/select.component.js.map +0 -1
- package/esm2015/lib/forms/slider/slider.component.js +0 -116
- package/esm2015/lib/forms/slider/slider.component.js.map +0 -1
- package/esm2015/lib/forms/switch/switch.component.js +0 -127
- package/esm2015/lib/forms/switch/switch.component.js.map +0 -1
- package/esm2015/lib/forms/text-area/text-area.component.js +0 -186
- package/esm2015/lib/forms/text-area/text-area.component.js.map +0 -1
- package/esm2015/lib/forms/text-editor/text-editor.component.js +0 -294
- package/esm2015/lib/forms/text-editor/text-editor.component.js.map +0 -1
- package/esm2015/lib/forms/text-input/text-input.component.js +0 -189
- package/esm2015/lib/forms/text-input/text-input.component.js.map +0 -1
- package/esm2015/lib/forms/time-picker/time-picker-dropdown/time-picker-dropdown.component.js +0 -103
- package/esm2015/lib/forms/time-picker/time-picker-dropdown/time-picker-dropdown.component.js.map +0 -1
- package/esm2015/lib/forms/time-picker/time-picker.component.js +0 -194
- package/esm2015/lib/forms/time-picker/time-picker.component.js.map +0 -1
- package/esm2015/lib/forms/unique-selection-dispatcher.js +0 -39
- package/esm2015/lib/forms/unique-selection-dispatcher.js.map +0 -1
- package/esm2015/lib/forms/value-accessor-base.js +0 -41
- package/esm2015/lib/forms/value-accessor-base.js.map +0 -1
- package/esm2015/lib/layout/layout.module.js +0 -18
- package/esm2015/lib/layout/layout.module.js.map +0 -1
- package/esm2015/lib/wrappers/flatpickr/flatpickr.component.js +0 -63
- package/esm2015/lib/wrappers/flatpickr/flatpickr.component.js.map +0 -1
- package/fesm2015/festo-ui-angular.js.map +0 -1
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import { Component, Input, ChangeDetectionStrategy, Optional, EventEmitter, Output, ChangeDetectorRef, ViewEncapsulation, Directive, forwardRef, ContentChildren, HostBinding } from '@angular/core';
|
|
2
|
-
import { UniqueSelectionDispatcher } from '../unique-selection-dispatcher';
|
|
3
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "../unique-selection-dispatcher";
|
|
7
|
-
import * as i2 from "@angular/common";
|
|
8
|
-
export class RadioChange {
|
|
9
|
-
constructor(source, value) {
|
|
10
|
-
this.source = source;
|
|
11
|
-
this.value = value;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
let nextUniqueId = 0;
|
|
15
|
-
export class RadioGroupDirective {
|
|
16
|
-
constructor(changeDetector) {
|
|
17
|
-
this.changeDetector = changeDetector;
|
|
18
|
-
this.hostClass = true;
|
|
19
|
-
this.role = 'radiogroup';
|
|
20
|
-
this.change = new EventEmitter();
|
|
21
|
-
this.isLarge = false;
|
|
22
|
-
this.isDisabled = false;
|
|
23
|
-
this.isRequired = false;
|
|
24
|
-
this.innerValue = null;
|
|
25
|
-
this.isInitialized = false;
|
|
26
|
-
this.isSelected = null;
|
|
27
|
-
this.innerName = `fngRadioGroup-${nextUniqueId++}`;
|
|
28
|
-
this.innerLabelPosition = 'before';
|
|
29
|
-
}
|
|
30
|
-
get name() {
|
|
31
|
-
return this.innerName;
|
|
32
|
-
}
|
|
33
|
-
set name(value) {
|
|
34
|
-
this.innerName = value;
|
|
35
|
-
this.updateRadioButtonNames();
|
|
36
|
-
}
|
|
37
|
-
get large() {
|
|
38
|
-
return this.isLarge;
|
|
39
|
-
}
|
|
40
|
-
set large(v) {
|
|
41
|
-
this.isLarge = v;
|
|
42
|
-
this.updateRadioButtonSize();
|
|
43
|
-
}
|
|
44
|
-
get labelPosition() {
|
|
45
|
-
return this.innerLabelPosition;
|
|
46
|
-
}
|
|
47
|
-
set labelPosition(v) {
|
|
48
|
-
this.innerLabelPosition = v;
|
|
49
|
-
this.markRadiosForCheck();
|
|
50
|
-
}
|
|
51
|
-
get value() {
|
|
52
|
-
return this.innerValue;
|
|
53
|
-
}
|
|
54
|
-
set value(newValue) {
|
|
55
|
-
if (this.innerValue !== newValue) {
|
|
56
|
-
this.innerValue = newValue;
|
|
57
|
-
this.updateSelectedRadioFromValue();
|
|
58
|
-
this.checkSelectedRadioButton();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
get selected() {
|
|
62
|
-
return this.isSelected;
|
|
63
|
-
}
|
|
64
|
-
set selected(selected) {
|
|
65
|
-
this.isSelected = selected;
|
|
66
|
-
this.value = selected ? selected.value : null;
|
|
67
|
-
this.checkSelectedRadioButton();
|
|
68
|
-
}
|
|
69
|
-
get disabled() {
|
|
70
|
-
return this.isDisabled;
|
|
71
|
-
}
|
|
72
|
-
set disabled(value) {
|
|
73
|
-
this.isDisabled = coerceBooleanProperty(value);
|
|
74
|
-
this.markRadiosForCheck();
|
|
75
|
-
}
|
|
76
|
-
get required() {
|
|
77
|
-
return this.isRequired;
|
|
78
|
-
}
|
|
79
|
-
set required(value) {
|
|
80
|
-
this.isRequired = coerceBooleanProperty(value);
|
|
81
|
-
this.markRadiosForCheck();
|
|
82
|
-
}
|
|
83
|
-
ngAfterContentInit() {
|
|
84
|
-
this.isInitialized = true;
|
|
85
|
-
}
|
|
86
|
-
checkSelectedRadioButton() {
|
|
87
|
-
if (this.isSelected && !this.isSelected.checked) {
|
|
88
|
-
this.isSelected.checked = true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
touch() {
|
|
92
|
-
if (this.onTouched != null) {
|
|
93
|
-
this.onTouched();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
emitChangeEvent() {
|
|
97
|
-
if (this.isInitialized) {
|
|
98
|
-
this.change.emit(new RadioChange(this.isSelected, this.innerValue));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
markRadiosForCheck() {
|
|
102
|
-
if (this.radios) {
|
|
103
|
-
this.radios.forEach(radio => radio.markForCheck());
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
writeValue(value) {
|
|
107
|
-
this.value = value;
|
|
108
|
-
this.changeDetector.markForCheck();
|
|
109
|
-
}
|
|
110
|
-
registerOnChange(fn) {
|
|
111
|
-
this.controlValueAccessorChangeFn = fn;
|
|
112
|
-
}
|
|
113
|
-
registerOnTouched(fn) {
|
|
114
|
-
this.onTouched = fn;
|
|
115
|
-
}
|
|
116
|
-
setDisabledState(isDisabled) {
|
|
117
|
-
this.disabled = isDisabled;
|
|
118
|
-
this.changeDetector.markForCheck();
|
|
119
|
-
}
|
|
120
|
-
updateRadioButtonSize() {
|
|
121
|
-
if (this.radios) {
|
|
122
|
-
this.radios.forEach(radio => {
|
|
123
|
-
radio.large = this.large;
|
|
124
|
-
radio.markForCheck();
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
updateRadioButtonNames() {
|
|
129
|
-
if (this.radios) {
|
|
130
|
-
this.radios.forEach(radio => {
|
|
131
|
-
radio.name = this.name;
|
|
132
|
-
radio.markForCheck();
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
updateSelectedRadioFromValue() {
|
|
137
|
-
const isAlreadySelected = this.isSelected !== null && this.isSelected.value === this.innerValue;
|
|
138
|
-
if (this.radios && !isAlreadySelected) {
|
|
139
|
-
this.isSelected = null;
|
|
140
|
-
this.radios.forEach(radio => {
|
|
141
|
-
radio.checked = this.value === radio.value;
|
|
142
|
-
if (radio.checked) {
|
|
143
|
-
this.isSelected = radio;
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
RadioGroupDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: RadioGroupDirective, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
150
|
-
RadioGroupDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.0", type: RadioGroupDirective, selector: "[fngRadioGroup]", inputs: { name: "name", large: "large", labelPosition: "labelPosition", value: "value", selected: "selected", disabled: "disabled", required: "required" }, outputs: { change: "change" }, host: { properties: { "class.fwe-radio-group": "this.hostClass", "attr.role": "this.role" } }, providers: [
|
|
151
|
-
{
|
|
152
|
-
provide: NG_VALUE_ACCESSOR,
|
|
153
|
-
useExisting: forwardRef(() => RadioGroupDirective),
|
|
154
|
-
multi: true
|
|
155
|
-
}
|
|
156
|
-
], queries: [{ propertyName: "radios", predicate: RadioComponent, descendants: true }], ngImport: i0 });
|
|
157
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: RadioGroupDirective, decorators: [{
|
|
158
|
-
type: Directive,
|
|
159
|
-
args: [{
|
|
160
|
-
selector: '[fngRadioGroup]',
|
|
161
|
-
providers: [
|
|
162
|
-
{
|
|
163
|
-
provide: NG_VALUE_ACCESSOR,
|
|
164
|
-
useExisting: forwardRef(() => RadioGroupDirective),
|
|
165
|
-
multi: true
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
}]
|
|
169
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { hostClass: [{
|
|
170
|
-
type: HostBinding,
|
|
171
|
-
args: ['class.fwe-radio-group']
|
|
172
|
-
}], role: [{
|
|
173
|
-
type: HostBinding,
|
|
174
|
-
args: ['attr.role']
|
|
175
|
-
}], change: [{
|
|
176
|
-
type: Output
|
|
177
|
-
}], radios: [{
|
|
178
|
-
type: ContentChildren,
|
|
179
|
-
args: [forwardRef(() => RadioComponent), { descendants: true }]
|
|
180
|
-
}], name: [{
|
|
181
|
-
type: Input
|
|
182
|
-
}], large: [{
|
|
183
|
-
type: Input
|
|
184
|
-
}], labelPosition: [{
|
|
185
|
-
type: Input
|
|
186
|
-
}], value: [{
|
|
187
|
-
type: Input
|
|
188
|
-
}], selected: [{
|
|
189
|
-
type: Input
|
|
190
|
-
}], disabled: [{
|
|
191
|
-
type: Input
|
|
192
|
-
}], required: [{
|
|
193
|
-
type: Input
|
|
194
|
-
}] } });
|
|
195
|
-
export class RadioComponent {
|
|
196
|
-
constructor(radioGroup, changeDetector, radioDispatcher) {
|
|
197
|
-
this.changeDetector = changeDetector;
|
|
198
|
-
this.radioDispatcher = radioDispatcher;
|
|
199
|
-
this.innerId = `fng-radio-${++nextUniqueId}`;
|
|
200
|
-
this.change = new EventEmitter();
|
|
201
|
-
this.isLarge = false;
|
|
202
|
-
this.isChecked = false;
|
|
203
|
-
this.innerValue = null;
|
|
204
|
-
this.radioGroup = radioGroup;
|
|
205
|
-
this.removeUniqueSelectionListener = radioDispatcher.listen((id, name) => {
|
|
206
|
-
if (id !== this.id && name === this.name) {
|
|
207
|
-
this.checked = false;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
get id() {
|
|
212
|
-
return this.innerId;
|
|
213
|
-
}
|
|
214
|
-
set id(value) {
|
|
215
|
-
this.innerId = value ? `${value}-${++nextUniqueId}` : `fng-radio-${++nextUniqueId}`;
|
|
216
|
-
}
|
|
217
|
-
get inputId() {
|
|
218
|
-
return `${this.innerId}-input`;
|
|
219
|
-
}
|
|
220
|
-
get checked() {
|
|
221
|
-
return this.isChecked;
|
|
222
|
-
}
|
|
223
|
-
set checked(value) {
|
|
224
|
-
const newCheckedState = coerceBooleanProperty(value);
|
|
225
|
-
if (this.isChecked !== newCheckedState) {
|
|
226
|
-
this.isChecked = newCheckedState;
|
|
227
|
-
if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) {
|
|
228
|
-
this.radioGroup.selected = this;
|
|
229
|
-
}
|
|
230
|
-
else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) {
|
|
231
|
-
this.radioGroup.selected = null;
|
|
232
|
-
}
|
|
233
|
-
if (newCheckedState) {
|
|
234
|
-
this.radioDispatcher.notify(this.id, this.name);
|
|
235
|
-
}
|
|
236
|
-
this.changeDetector.markForCheck();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
get value() {
|
|
240
|
-
return this.innerValue;
|
|
241
|
-
}
|
|
242
|
-
set value(value) {
|
|
243
|
-
if (this.innerValue !== value) {
|
|
244
|
-
this.innerValue = value;
|
|
245
|
-
if (this.radioGroup !== null) {
|
|
246
|
-
if (!this.checked) {
|
|
247
|
-
this.checked = this.radioGroup.value === value;
|
|
248
|
-
}
|
|
249
|
-
if (this.checked) {
|
|
250
|
-
this.radioGroup.selected = this;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
get large() {
|
|
256
|
-
return this.isLarge || (this.radioGroup != null && this.radioGroup.large);
|
|
257
|
-
}
|
|
258
|
-
set large(value) {
|
|
259
|
-
this.isLarge = value;
|
|
260
|
-
}
|
|
261
|
-
get labelPosition() {
|
|
262
|
-
return this.innerLabelPosition || (this.radioGroup && this.radioGroup.labelPosition) || 'before';
|
|
263
|
-
}
|
|
264
|
-
set labelPosition(value) {
|
|
265
|
-
this.innerLabelPosition = value;
|
|
266
|
-
}
|
|
267
|
-
get disabled() {
|
|
268
|
-
return this.isDisabled || (this.radioGroup != null && this.radioGroup.disabled);
|
|
269
|
-
}
|
|
270
|
-
set disabled(value) {
|
|
271
|
-
const newDisabledState = coerceBooleanProperty(value);
|
|
272
|
-
if (this.isDisabled !== newDisabledState) {
|
|
273
|
-
this.isDisabled = newDisabledState;
|
|
274
|
-
this.changeDetector.markForCheck();
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
get required() {
|
|
278
|
-
return this.isRequired || (this.radioGroup && this.radioGroup.required);
|
|
279
|
-
}
|
|
280
|
-
set required(value) {
|
|
281
|
-
this.isRequired = coerceBooleanProperty(value);
|
|
282
|
-
}
|
|
283
|
-
ngOnInit() {
|
|
284
|
-
if (this.radioGroup) {
|
|
285
|
-
this.checked = this.radioGroup.value === this.innerValue;
|
|
286
|
-
this.name = this.radioGroup.name;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
ngOnDestroy() {
|
|
290
|
-
if (this.removeUniqueSelectionListener != null) {
|
|
291
|
-
this.removeUniqueSelectionListener();
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
onInputClick(event) {
|
|
295
|
-
event.stopPropagation();
|
|
296
|
-
}
|
|
297
|
-
onInputChange(event) {
|
|
298
|
-
var _a, _b;
|
|
299
|
-
event.stopPropagation();
|
|
300
|
-
if (!this.disabled) {
|
|
301
|
-
const groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value;
|
|
302
|
-
this.checked = true;
|
|
303
|
-
this.emitChangeEvent();
|
|
304
|
-
if (this.radioGroup) {
|
|
305
|
-
if (typeof ((_a = this.radioGroup) === null || _a === void 0 ? void 0 : _a.controlValueAccessorChangeFn) === 'function') {
|
|
306
|
-
(_b = this.radioGroup) === null || _b === void 0 ? void 0 : _b.controlValueAccessorChangeFn(this.value);
|
|
307
|
-
}
|
|
308
|
-
if (groupValueChanged) {
|
|
309
|
-
this.radioGroup.emitChangeEvent();
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
markForCheck() {
|
|
315
|
-
this.changeDetector.markForCheck();
|
|
316
|
-
}
|
|
317
|
-
emitChangeEvent() {
|
|
318
|
-
this.change.emit(new RadioChange(this, this.innerValue));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
RadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: RadioComponent, deps: [{ token: RadioGroupDirective, optional: true }, { token: i0.ChangeDetectorRef }, { token: i1.UniqueSelectionDispatcher }], target: i0.ɵɵFactoryTarget.Component });
|
|
322
|
-
RadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", type: RadioComponent, selector: "fng-radio", inputs: { name: "name", id: "id", checked: "checked", value: "value", large: "large", labelPosition: "labelPosition", disabled: "disabled", required: "required" }, outputs: { change: "change" }, ngImport: i0, template: "<label\n [attr.for]=\"inputId\"\n [ngClass]=\"{\n 'fwe-radio': true,\n 'fwe-radio-label-below': labelPosition == 'below',\n 'fwe-radio-label-before': labelPosition == 'before',\n 'fwe-radio-lg': large\n }\"\n>\n <input\n type=\"radio\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [attr.name]=\"name\"\n [attr.value]=\"value\"\n [required]=\"required\"\n (change)=\"onInputChange($event)\"\n (click)=\"onInputClick($event)\"\n />\n <div class=\"fwe-radio-checkmark\"></div>\n <div class=\"fwe-radio-label-content\">\n <ng-content></ng-content>\n </div>\n</label>\n", styles: [".fwe-radio:hover .fwe-radio-checkmark{background-color:var(--fwe-control)}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
323
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: RadioComponent, decorators: [{
|
|
324
|
-
type: Component,
|
|
325
|
-
args: [{
|
|
326
|
-
selector: 'fng-radio',
|
|
327
|
-
templateUrl: './radio.component.html',
|
|
328
|
-
styleUrls: ['./radio.component.scss'],
|
|
329
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
330
|
-
encapsulation: ViewEncapsulation.None
|
|
331
|
-
}]
|
|
332
|
-
}], ctorParameters: function () { return [{ type: RadioGroupDirective, decorators: [{
|
|
333
|
-
type: Optional
|
|
334
|
-
}] }, { type: i0.ChangeDetectorRef }, { type: i1.UniqueSelectionDispatcher }]; }, propDecorators: { name: [{
|
|
335
|
-
type: Input
|
|
336
|
-
}], id: [{
|
|
337
|
-
type: Input
|
|
338
|
-
}], checked: [{
|
|
339
|
-
type: Input
|
|
340
|
-
}], value: [{
|
|
341
|
-
type: Input
|
|
342
|
-
}], large: [{
|
|
343
|
-
type: Input
|
|
344
|
-
}], labelPosition: [{
|
|
345
|
-
type: Input
|
|
346
|
-
}], disabled: [{
|
|
347
|
-
type: Input
|
|
348
|
-
}], required: [{
|
|
349
|
-
type: Input
|
|
350
|
-
}], change: [{
|
|
351
|
-
type: Output
|
|
352
|
-
}] } });
|
|
353
|
-
//# sourceMappingURL=radio.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../../../../../libs/angular/src/lib/forms/radio/radio.component.ts","../../../../../../../libs/angular/src/lib/forms/radio/radio.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,KAAK,EACL,uBAAuB,EACvB,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,iBAAiB,EAEjB,iBAAiB,EACjB,SAAS,EACT,UAAU,EAEV,eAAe,EACf,WAAW,EACZ,M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CAAC;;2GA/JU,cAAc,kBAwGC,mBAAmB;+FAxGlC,cAAc,oPCvN3B,koBAyBA;2FD8La,cAAc;kBAP1B,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,WAAW,EAAE,wBAAwB;oBACrC,SAAS,EAAE,CAAC,wBAAwB,CAAC;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;0DAyG2B,mBAAmB;0BAA1C,QAAQ;oHAvGF,IAAI;sBAAZ,KAAK;gBAOF,EAAE;sBADL,KAAK;gBAUF,OAAO;sBADV,KAAK;gBAsBF,KAAK;sBADR,KAAK;gBAmBF,KAAK;sBADR,KAAK;gBASF,aAAa;sBADhB,KAAK;gBASF,QAAQ;sBADX,KAAK;gBAaF,QAAQ;sBADX,KAAK;gBAQa,MAAM;sBAAxB,MAAM","sourcesContent":["import {\n Component,\n OnInit,\n Input,\n ChangeDetectionStrategy,\n Optional,\n EventEmitter,\n Output,\n ChangeDetectorRef,\n OnDestroy,\n ViewEncapsulation,\n Directive,\n forwardRef,\n AfterContentInit,\n ContentChildren,\n HostBinding\n} from '@angular/core';\nimport type { QueryList } from '@angular/core';\nimport { UniqueSelectionDispatcher } from '../unique-selection-dispatcher';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\n\nexport class RadioChange {\n constructor(public source: RadioComponent, public value: any) {}\n}\n\nlet nextUniqueId = 0;\n\n@Directive({\n selector: '[fngRadioGroup]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RadioGroupDirective),\n multi: true\n }\n ]\n})\nexport class RadioGroupDirective implements AfterContentInit, ControlValueAccessor {\n @HostBinding('class.fwe-radio-group') hostClass = true;\n @HostBinding('attr.role') role = 'radiogroup';\n\n @Output()\n readonly change = new EventEmitter<RadioChange>();\n\n @ContentChildren(forwardRef(() => RadioComponent), { descendants: true })\n radios: QueryList<RadioComponent>;\n\n @Input()\n get name(): string {\n return this.innerName;\n }\n set name(value: string) {\n this.innerName = value;\n this.updateRadioButtonNames();\n }\n\n @Input()\n get large() {\n return this.isLarge;\n }\n set large(v) {\n this.isLarge = v;\n this.updateRadioButtonSize();\n }\n\n @Input()\n get labelPosition() {\n return this.innerLabelPosition;\n }\n set labelPosition(v) {\n this.innerLabelPosition = v;\n this.markRadiosForCheck();\n }\n\n @Input()\n get value(): any {\n return this.innerValue;\n }\n set value(newValue: any) {\n if (this.innerValue !== newValue) {\n this.innerValue = newValue;\n this.updateSelectedRadioFromValue();\n this.checkSelectedRadioButton();\n }\n }\n\n @Input()\n get selected() {\n return this.isSelected;\n }\n set selected(selected: any | null) {\n this.isSelected = selected;\n this.value = selected ? selected.value : null;\n this.checkSelectedRadioButton();\n }\n\n @Input()\n get disabled(): boolean {\n return this.isDisabled;\n }\n set disabled(value) {\n this.isDisabled = coerceBooleanProperty(value);\n this.markRadiosForCheck();\n }\n\n @Input()\n get required(): boolean {\n return this.isRequired;\n }\n set required(value: boolean) {\n this.isRequired = coerceBooleanProperty(value);\n this.markRadiosForCheck();\n }\n\n private isLarge = false;\n private isDisabled = false;\n private isRequired = false;\n private innerValue: any = null;\n private isInitialized = false;\n private isSelected: RadioComponent | null = null;\n private innerName = `fngRadioGroup-${nextUniqueId++}`;\n private innerLabelPosition: 'before' | 'after' | 'below' = 'before';\n\n constructor(private changeDetector: ChangeDetectorRef) {}\n\n controlValueAccessorChangeFn: (value: any) => void;\n\n onTouched: () => void;\n\n ngAfterContentInit() {\n this.isInitialized = true;\n }\n\n checkSelectedRadioButton() {\n if (this.isSelected && !this.isSelected.checked) {\n this.isSelected.checked = true;\n }\n }\n\n touch() {\n if (this.onTouched != null) {\n this.onTouched();\n }\n }\n\n emitChangeEvent(): void {\n if (this.isInitialized) {\n this.change.emit(new RadioChange(this.isSelected, this.innerValue));\n }\n }\n\n markRadiosForCheck() {\n if (this.radios) {\n this.radios.forEach(radio => radio.markForCheck());\n }\n }\n\n writeValue(value: any) {\n this.value = value;\n this.changeDetector.markForCheck();\n }\n\n registerOnChange(fn: (value: any) => void) {\n this.controlValueAccessorChangeFn = fn;\n }\n\n registerOnTouched(fn: any) {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n this.changeDetector.markForCheck();\n }\n\n private updateRadioButtonSize(): void {\n if (this.radios) {\n this.radios.forEach(radio => {\n radio.large = this.large;\n radio.markForCheck();\n });\n }\n }\n\n private updateRadioButtonNames(): void {\n if (this.radios) {\n this.radios.forEach(radio => {\n radio.name = this.name;\n radio.markForCheck();\n });\n }\n }\n\n private updateSelectedRadioFromValue(): void {\n const isAlreadySelected = this.isSelected !== null && this.isSelected.value === this.innerValue;\n if (this.radios && !isAlreadySelected) {\n this.isSelected = null;\n this.radios.forEach(radio => {\n radio.checked = this.value === radio.value;\n if (radio.checked) {\n this.isSelected = radio;\n }\n });\n }\n }\n}\n\n@Component({\n selector: 'fng-radio',\n templateUrl: './radio.component.html',\n styleUrls: ['./radio.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class RadioComponent implements OnInit, OnDestroy {\n @Input() name: string;\n\n private innerId = `fng-radio-${++nextUniqueId}`;\n get id(): string {\n return this.innerId;\n }\n @Input()\n set id(value: string) {\n this.innerId = value ? `${value}-${++nextUniqueId}` : `fng-radio-${++nextUniqueId}`;\n }\n\n get inputId(): string {\n return `${this.innerId}-input`;\n }\n\n @Input()\n get checked(): boolean {\n return this.isChecked;\n }\n set checked(value: boolean) {\n const newCheckedState = coerceBooleanProperty(value);\n if (this.isChecked !== newCheckedState) {\n this.isChecked = newCheckedState;\n if (newCheckedState && this.radioGroup && this.radioGroup.value !== this.value) {\n this.radioGroup.selected = this;\n } else if (!newCheckedState && this.radioGroup && this.radioGroup.value === this.value) {\n this.radioGroup.selected = null;\n }\n\n if (newCheckedState) {\n this.radioDispatcher.notify(this.id, this.name);\n }\n this.changeDetector.markForCheck();\n }\n }\n\n @Input()\n get value(): any {\n return this.innerValue;\n }\n set value(value: any) {\n if (this.innerValue !== value) {\n this.innerValue = value;\n if (this.radioGroup !== null) {\n if (!this.checked) {\n this.checked = this.radioGroup.value === value;\n }\n if (this.checked) {\n this.radioGroup.selected = this;\n }\n }\n }\n }\n\n @Input()\n get large() {\n return this.isLarge || (this.radioGroup != null && this.radioGroup.large);\n }\n set large(value) {\n this.isLarge = value;\n }\n\n @Input()\n get labelPosition() {\n return this.innerLabelPosition || (this.radioGroup && this.radioGroup.labelPosition) || 'before';\n }\n set labelPosition(value) {\n this.innerLabelPosition = value;\n }\n\n @Input()\n get disabled(): boolean {\n return this.isDisabled || (this.radioGroup != null && this.radioGroup.disabled);\n }\n set disabled(value: boolean) {\n const newDisabledState = coerceBooleanProperty(value);\n if (this.isDisabled !== newDisabledState) {\n this.isDisabled = newDisabledState;\n this.changeDetector.markForCheck();\n }\n }\n\n @Input()\n get required(): boolean {\n return this.isRequired || (this.radioGroup && this.radioGroup.required);\n }\n set required(value: boolean) {\n this.isRequired = coerceBooleanProperty(value);\n }\n\n @Output() readonly change = new EventEmitter<RadioChange>();\n\n radioGroup: RadioGroupDirective;\n\n private isLarge = false;\n private isChecked = false;\n private isDisabled: boolean;\n private isRequired: boolean;\n private innerValue: any = null;\n private innerLabelPosition: 'before' | 'after' | 'below';\n private removeUniqueSelectionListener: () => void;\n\n constructor(\n @Optional() radioGroup: RadioGroupDirective,\n private changeDetector: ChangeDetectorRef,\n private radioDispatcher: UniqueSelectionDispatcher\n ) {\n this.radioGroup = radioGroup;\n this.removeUniqueSelectionListener = radioDispatcher.listen((id: string, name: string) => {\n if (id !== this.id && name === this.name) {\n this.checked = false;\n }\n });\n }\n\n ngOnInit() {\n if (this.radioGroup) {\n this.checked = this.radioGroup.value === this.innerValue;\n this.name = this.radioGroup.name;\n }\n }\n\n ngOnDestroy() {\n if (this.removeUniqueSelectionListener != null) {\n this.removeUniqueSelectionListener();\n }\n }\n\n onInputClick(event: Event) {\n event.stopPropagation();\n }\n\n onInputChange(event: Event) {\n event.stopPropagation();\n\n if (!this.disabled) {\n const groupValueChanged = this.radioGroup && this.value !== this.radioGroup.value;\n this.checked = true;\n this.emitChangeEvent();\n\n if (this.radioGroup) {\n if (typeof this.radioGroup?.controlValueAccessorChangeFn === 'function') {\n this.radioGroup?.controlValueAccessorChangeFn(this.value);\n }\n\n if (groupValueChanged) {\n this.radioGroup.emitChangeEvent();\n }\n }\n }\n }\n\n markForCheck() {\n this.changeDetector.markForCheck();\n }\n\n private emitChangeEvent(): void {\n this.change.emit(new RadioChange(this, this.innerValue));\n }\n}\n","<label\n [attr.for]=\"inputId\"\n [ngClass]=\"{\n 'fwe-radio': true,\n 'fwe-radio-label-below': labelPosition == 'below',\n 'fwe-radio-label-before': labelPosition == 'before',\n 'fwe-radio-lg': large\n }\"\n>\n <input\n type=\"radio\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [attr.name]=\"name\"\n [attr.value]=\"value\"\n [required]=\"required\"\n (change)=\"onInputChange($event)\"\n (click)=\"onInputClick($event)\"\n />\n <div class=\"fwe-radio-checkmark\"></div>\n <div class=\"fwe-radio-label-content\">\n <ng-content></ng-content>\n </div>\n</label>\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Component, Input, ViewChild, TemplateRef, ChangeDetectionStrategy, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
import * as i1 from "@angular/common";
|
|
4
|
-
export class SegmentControlComponent {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.change = new EventEmitter();
|
|
7
|
-
}
|
|
8
|
-
ngOnInit() {
|
|
9
|
-
this.id = (Math.random() * Date.now()).toString().replace('.', '-');
|
|
10
|
-
this.viewMode = 'text';
|
|
11
|
-
}
|
|
12
|
-
ngOnChanges(changes) {
|
|
13
|
-
if (null != changes.icon && null != changes.icon.currentValue) {
|
|
14
|
-
this.icon = `fwe-icon-${this.icon}`;
|
|
15
|
-
}
|
|
16
|
-
if (null != changes.iconOnly && null != changes.iconOnly.currentValue) {
|
|
17
|
-
this.viewMode = changes.iconOnly.currentValue === true ? 'icon' : 'icon-text';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
ngAfterViewInit() {
|
|
21
|
-
this.view = this.tpl.createEmbeddedView(null);
|
|
22
|
-
}
|
|
23
|
-
onChange(event) {
|
|
24
|
-
this.change.emit(event.target.value);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
SegmentControlComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: SegmentControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28
|
-
SegmentControlComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", type: SegmentControlComponent, selector: "fng-segment-control", inputs: { name: "name", value: "value", label: "label", icon: "icon", iconOnly: "iconOnly", checked: "checked", disabled: "disabled" }, outputs: { change: "change" }, viewQueries: [{ propertyName: "tpl", first: true, predicate: ["tpl"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template #tpl>\n <input\n (change)=\"onChange($event)\"\n class=\"fwe-segment-input\"\n type=\"radio\"\n [id]=\"id\"\n [name]=\"name\"\n [value]=\"value\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n />\n <label class=\"fwe-segment-label\" [for]=\"id\">\n <ng-container [ngSwitch]=\"viewMode\">\n <ng-container *ngSwitchCase=\"'icon'\">\n <span class=\"fwe-sr-only\">{{ label }}</span>\n <i aria-hidden=\"true\" class=\"fwe-icon\" [ngClass]=\"icon\"></i>\n </ng-container>\n <ng-container *ngSwitchCase=\"'text'\">\n {{ label }}\n </ng-container>\n <ng-container *ngSwitchCase=\"'icon-text'\">\n <i aria-hidden=\"true\" class=\"fwe-icon\" [ngClass]=\"icon\"></i>{{ label }}\n </ng-container>\n </ng-container>\n </label>\n</ng-template>\n", styles: [""], directives: [{ type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: SegmentControlComponent, decorators: [{
|
|
30
|
-
type: Component,
|
|
31
|
-
args: [{
|
|
32
|
-
selector: 'fng-segment-control',
|
|
33
|
-
templateUrl: './segment-control.component.html',
|
|
34
|
-
styleUrls: ['./segment-control.component.scss'],
|
|
35
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
36
|
-
encapsulation: ViewEncapsulation.None
|
|
37
|
-
}]
|
|
38
|
-
}], propDecorators: { name: [{
|
|
39
|
-
type: Input
|
|
40
|
-
}], value: [{
|
|
41
|
-
type: Input
|
|
42
|
-
}], label: [{
|
|
43
|
-
type: Input
|
|
44
|
-
}], icon: [{
|
|
45
|
-
type: Input
|
|
46
|
-
}], iconOnly: [{
|
|
47
|
-
type: Input
|
|
48
|
-
}], checked: [{
|
|
49
|
-
type: Input
|
|
50
|
-
}], disabled: [{
|
|
51
|
-
type: Input
|
|
52
|
-
}], change: [{
|
|
53
|
-
type: Output
|
|
54
|
-
}], tpl: [{
|
|
55
|
-
type: ViewChild,
|
|
56
|
-
args: ['tpl']
|
|
57
|
-
}] } });
|
|
58
|
-
//# sourceMappingURL=segment-control.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"segment-control.component.js","sourceRoot":"","sources":["../../../../../../../../libs/angular/src/lib/forms/segment/segment-control/segment-control.component.ts","../../../../../../../../libs/angular/src/lib/forms/segment/segment-control/segment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C;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,WAAW,EAAE,kCAAkC;oBAC/C,SAAS,EAAE,CAAC,kCAAkC,CAAC;oBAC/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;8BAMU,IAAI;sBAAZ,KAAK;gBACG,KAAK;sBAAb,KAAK;gBACG,KAAK;sBAAb,KAAK;gBACG,IAAI;sBAAZ,KAAK;gBACG,QAAQ;sBAAhB,KAAK;gBACG,OAAO;sBAAf,KAAK;gBACG,QAAQ;sBAAhB,KAAK;gBACI,MAAM;sBAAf,MAAM;gBAEW,GAAG;sBAApB,SAAS;uBAAC,KAAK","sourcesContent":["import {\n Component,\n Input,\n OnInit,\n SimpleChanges,\n OnChanges,\n ViewChild,\n TemplateRef,\n AfterViewInit,\n ViewRef,\n ChangeDetectionStrategy,\n Output,\n EventEmitter,\n ViewEncapsulation\n} from '@angular/core';\n\n@Component({\n selector: 'fng-segment-control',\n templateUrl: './segment-control.component.html',\n styleUrls: ['./segment-control.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class SegmentControlComponent implements OnInit, OnChanges, AfterViewInit {\n id: string;\n view: ViewRef;\n viewMode: 'text' | 'icon' | 'icon-text';\n\n @Input() name: string;\n @Input() value: any;\n @Input() label: string;\n @Input() icon: string;\n @Input() iconOnly: boolean;\n @Input() checked: boolean;\n @Input() disabled: boolean;\n @Output() change: EventEmitter<any> = new EventEmitter();\n\n @ViewChild('tpl') tpl: TemplateRef<any>;\n\n ngOnInit(): void {\n this.id = (Math.random() * Date.now()).toString().replace('.', '-');\n this.viewMode = 'text';\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (null != changes.icon && null != changes.icon.currentValue) {\n this.icon = `fwe-icon-${this.icon}`;\n }\n\n if (null != changes.iconOnly && null != changes.iconOnly.currentValue) {\n this.viewMode = changes.iconOnly.currentValue === true ? 'icon' : 'icon-text';\n }\n }\n\n ngAfterViewInit(): void {\n this.view = this.tpl.createEmbeddedView(null);\n }\n\n onChange(event: { target: HTMLInputElement }) {\n this.change.emit(event.target.value);\n }\n}\n","<ng-template #tpl>\n <input\n (change)=\"onChange($event)\"\n class=\"fwe-segment-input\"\n type=\"radio\"\n [id]=\"id\"\n [name]=\"name\"\n [value]=\"value\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n />\n <label class=\"fwe-segment-label\" [for]=\"id\">\n <ng-container [ngSwitch]=\"viewMode\">\n <ng-container *ngSwitchCase=\"'icon'\">\n <span class=\"fwe-sr-only\">{{ label }}</span>\n <i aria-hidden=\"true\" class=\"fwe-icon\" [ngClass]=\"icon\"></i>\n </ng-container>\n <ng-container *ngSwitchCase=\"'text'\">\n {{ label }}\n </ng-container>\n <ng-container *ngSwitchCase=\"'icon-text'\">\n <i aria-hidden=\"true\" class=\"fwe-icon\" [ngClass]=\"icon\"></i>{{ label }}\n </ng-container>\n </ng-container>\n </label>\n</ng-template>\n"]}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Component, ContentChildren, Input, ViewChild, ViewContainerRef, ChangeDetectorRef, ChangeDetectionStrategy, Output, EventEmitter, forwardRef, ViewEncapsulation, SimpleChange } from '@angular/core';
|
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { takeUntil } from 'rxjs/operators';
|
|
5
|
-
import { ValueAccessorBaseDirective } from '../value-accessor-base';
|
|
6
|
-
import { SegmentControlComponent } from './segment-control/segment-control.component';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "@angular/common";
|
|
9
|
-
export class SegmentComponent extends ValueAccessorBaseDirective {
|
|
10
|
-
constructor(cd) {
|
|
11
|
-
super();
|
|
12
|
-
this.cd = cd;
|
|
13
|
-
this.complete = new Subject();
|
|
14
|
-
this.defaultConfig = {
|
|
15
|
-
outline: true,
|
|
16
|
-
iconOnly: true
|
|
17
|
-
};
|
|
18
|
-
this.useIcon = false;
|
|
19
|
-
this.useIconAndText = false;
|
|
20
|
-
this.legend = '';
|
|
21
|
-
this.config = this.defaultConfig;
|
|
22
|
-
this.fngChange = new EventEmitter();
|
|
23
|
-
this.change = new EventEmitter();
|
|
24
|
-
}
|
|
25
|
-
set value(value) {
|
|
26
|
-
if (this.innerValue !== value) {
|
|
27
|
-
this.innerValue = value;
|
|
28
|
-
this.changed.forEach(f => {
|
|
29
|
-
this.fngChange.emit(this.innerValue);
|
|
30
|
-
this.change.emit(this.innerValue);
|
|
31
|
-
return f(value);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
ngOnChanges(changes) {
|
|
36
|
-
if (null != changes.config && null != changes.config.currentValue) {
|
|
37
|
-
this.config = Object.assign({}, this.defaultConfig, changes.config.currentValue);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
ngAfterContentInit() {
|
|
41
|
-
if (this.controls.length > 0) {
|
|
42
|
-
this.controls.forEach(component => {
|
|
43
|
-
component.change.pipe(takeUntil(this.complete)).subscribe(val => {
|
|
44
|
-
this.value = val;
|
|
45
|
-
});
|
|
46
|
-
if (component.icon != null && this.config.iconOnly === true) {
|
|
47
|
-
this.useIcon = true;
|
|
48
|
-
component.ngOnChanges({
|
|
49
|
-
iconOnly: new SimpleChange(null, true, false)
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (component.icon != null && this.config.iconOnly !== true) {
|
|
53
|
-
this.useIconAndText = true;
|
|
54
|
-
component.ngOnChanges({
|
|
55
|
-
iconOnly: new SimpleChange(null, false, false)
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
ngAfterViewInit() {
|
|
62
|
-
this.html();
|
|
63
|
-
this.cd.detectChanges();
|
|
64
|
-
}
|
|
65
|
-
ngOnDestroy() {
|
|
66
|
-
this.complete.next(true);
|
|
67
|
-
this.complete.unsubscribe();
|
|
68
|
-
}
|
|
69
|
-
html() {
|
|
70
|
-
this.controls.forEach(component => {
|
|
71
|
-
this.vc.insert(component.view);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
SegmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: SegmentComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
76
|
-
SegmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.0", type: SegmentComponent, selector: "fng-segment", inputs: { legend: "legend", config: "config", value: "value" }, outputs: { fngChange: "fngChange", change: "change" }, providers: [
|
|
77
|
-
{
|
|
78
|
-
provide: NG_VALUE_ACCESSOR,
|
|
79
|
-
useExisting: forwardRef(() => SegmentComponent),
|
|
80
|
-
multi: true
|
|
81
|
-
}
|
|
82
|
-
], queries: [{ propertyName: "controls", predicate: SegmentControlComponent, descendants: true }], viewQueries: [{ propertyName: "vc", first: true, predicate: ["vc"], descendants: true, read: ViewContainerRef }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<fieldset\n class=\"fwe-segment\"\n [ngClass]=\"{\n 'fwe-segment-outline': config.outline,\n 'fwe-segment-icon': useIcon,\n 'fwe-segment-icon-text': useIconAndText\n }\"\n>\n <legend>{{ legend }}</legend>\n <div class=\"fwe-segment-group\">\n <ng-container #vc></ng-container>\n </div>\n</fieldset>\n", styles: [""], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
83
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: SegmentComponent, decorators: [{
|
|
84
|
-
type: Component,
|
|
85
|
-
args: [{
|
|
86
|
-
selector: 'fng-segment',
|
|
87
|
-
templateUrl: './segment.component.html',
|
|
88
|
-
styleUrls: ['./segment.component.scss'],
|
|
89
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
90
|
-
encapsulation: ViewEncapsulation.None,
|
|
91
|
-
providers: [
|
|
92
|
-
{
|
|
93
|
-
provide: NG_VALUE_ACCESSOR,
|
|
94
|
-
useExisting: forwardRef(() => SegmentComponent),
|
|
95
|
-
multi: true
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
}]
|
|
99
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { legend: [{
|
|
100
|
-
type: Input
|
|
101
|
-
}], config: [{
|
|
102
|
-
type: Input
|
|
103
|
-
}], controls: [{
|
|
104
|
-
type: ContentChildren,
|
|
105
|
-
args: [SegmentControlComponent, { descendants: true }]
|
|
106
|
-
}], vc: [{
|
|
107
|
-
type: ViewChild,
|
|
108
|
-
args: ['vc', { read: ViewContainerRef }]
|
|
109
|
-
}], fngChange: [{
|
|
110
|
-
type: Output
|
|
111
|
-
}], change: [{
|
|
112
|
-
type: Output
|
|
113
|
-
}], value: [{
|
|
114
|
-
type: Input
|
|
115
|
-
}] } });
|
|
116
|
-
//# sourceMappingURL=segment.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"segment.component.js","sourceRoot":"","sources":["../../../../../../../libs/angular/src/lib/forms/segment/segment.component.ts","../../../../../../../libs/angular/src/lib/forms/segment/segment.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,EAKL,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,MAAM,EACN,YAAY,EAEZ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/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E,CAAC;IAC9B,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAChC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;;6GA9EU,gBAAgB;iGAAhB,gBAAgB,6JARhB;QACT;YACE,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC;YAC/C,KAAK,EAAE,IAAI;SACZ;KACF,mDAcgB,uBAAuB,qHACf,gBAAgB,yEC3D3C,gUAaA;2FDiCa,gBAAgB;kBAd5B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;oBACvB,WAAW,EAAE,0BAA0B;oBACvC,SAAS,EAAE,CAAC,0BAA0B,CAAC;oBACvC,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,iBAAiB,CAAC;4BAC/C,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF;wGAWU,MAAM;sBAAd,KAAK;gBACG,MAAM;sBAAd,KAAK;gBAC2D,QAAQ;sBAAxE,eAAe;uBAAC,uBAAuB,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;gBAClB,EAAE;sBAA9C,SAAS;uBAAC,IAAI,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;gBAEjC,SAAS;sBAAlB,MAAM;gBACG,MAAM;sBAAf,MAAM;gBAGH,KAAK;sBADR,KAAK","sourcesContent":["import {\n Component,\n ContentChildren,\n Input,\n AfterContentInit,\n SimpleChanges,\n OnChanges,\n AfterViewInit,\n ViewChild,\n ViewContainerRef,\n ChangeDetectorRef,\n ChangeDetectionStrategy,\n Output,\n EventEmitter,\n OnDestroy,\n forwardRef,\n ViewEncapsulation,\n SimpleChange\n} from '@angular/core';\nimport type { QueryList } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { ValueAccessorBaseDirective } from '../value-accessor-base';\nimport { SegmentControlComponent } from './segment-control/segment-control.component';\n\nexport interface SegmentComponentConfiguration {\n outline: boolean;\n iconOnly: boolean;\n}\n\n@Component({\n selector: 'fng-segment',\n templateUrl: './segment.component.html',\n styleUrls: ['./segment.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SegmentComponent),\n multi: true\n }\n ]\n})\nexport class SegmentComponent extends ValueAccessorBaseDirective<any> implements OnChanges, AfterContentInit, AfterViewInit, OnDestroy {\n private complete: Subject<boolean> = new Subject();\n\n defaultConfig: SegmentComponentConfiguration = {\n outline: true,\n iconOnly: true\n };\n useIcon = false;\n useIconAndText = false;\n\n @Input() legend = '';\n @Input() config: SegmentComponentConfiguration = this.defaultConfig;\n @ContentChildren(SegmentControlComponent, { descendants: true }) controls: QueryList<SegmentControlComponent>;\n @ViewChild('vc', { read: ViewContainerRef }) vc: ViewContainerRef;\n\n @Output() fngChange = new EventEmitter<any>();\n @Output() change = new EventEmitter<any>();\n\n @Input()\n set value(value: string) {\n if (this.innerValue !== value) {\n this.innerValue = value;\n this.changed.forEach(f => {\n this.fngChange.emit(this.innerValue);\n this.change.emit(this.innerValue);\n return f(value);\n });\n }\n }\n\n constructor(private cd: ChangeDetectorRef) {\n super();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (null != changes.config && null != changes.config.currentValue) {\n this.config = Object.assign({}, this.defaultConfig, changes.config.currentValue);\n }\n }\n\n ngAfterContentInit(): void {\n if (this.controls.length > 0) {\n this.controls.forEach(component => {\n component.change.pipe(takeUntil(this.complete)).subscribe(val => {\n this.value = val;\n });\n\n if (component.icon != null && this.config.iconOnly === true) {\n this.useIcon = true;\n component.ngOnChanges({\n iconOnly: new SimpleChange(null, true, false)\n });\n }\n\n if (component.icon != null && this.config.iconOnly !== true) {\n this.useIconAndText = true;\n component.ngOnChanges({\n iconOnly: new SimpleChange(null, false, false)\n });\n }\n });\n }\n }\n\n ngAfterViewInit(): void {\n this.html();\n this.cd.detectChanges();\n }\n\n ngOnDestroy(): void {\n this.complete.next(true);\n this.complete.unsubscribe();\n }\n\n private html() {\n this.controls.forEach(component => {\n this.vc.insert(component.view);\n });\n }\n}\n","<fieldset\n class=\"fwe-segment\"\n [ngClass]=\"{\n 'fwe-segment-outline': config.outline,\n 'fwe-segment-icon': useIcon,\n 'fwe-segment-icon-text': useIconAndText\n }\"\n>\n <legend>{{ legend }}</legend>\n <div class=\"fwe-segment-group\">\n <ng-container #vc></ng-container>\n </div>\n</fieldset>\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Pipe } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
function defaultValueKey(key) {
|
|
4
|
-
return key == null ? 'value' : key;
|
|
5
|
-
}
|
|
6
|
-
function defaultTextKey(key) {
|
|
7
|
-
return key == null ? 'text' : key;
|
|
8
|
-
}
|
|
9
|
-
export class ChipTextPipe {
|
|
10
|
-
transform(value, options, optionsValueKey, optionsTextKey) {
|
|
11
|
-
let chipText = '';
|
|
12
|
-
optionsValueKey = defaultValueKey(optionsValueKey);
|
|
13
|
-
optionsTextKey = defaultTextKey(optionsTextKey);
|
|
14
|
-
options.forEach((_, index) => {
|
|
15
|
-
if (JSON.stringify(options[index][optionsValueKey]) === JSON.stringify(value[optionsValueKey])) {
|
|
16
|
-
chipText = options[index][optionsTextKey];
|
|
17
|
-
}
|
|
18
|
-
if (JSON.stringify(options[index][optionsValueKey]) === JSON.stringify(value)) {
|
|
19
|
-
chipText = options[index][optionsTextKey];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return chipText;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
ChipTextPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChipTextPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
26
|
-
ChipTextPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChipTextPipe, name: "fngChipText", pure: false });
|
|
27
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.0", ngImport: i0, type: ChipTextPipe, decorators: [{
|
|
28
|
-
type: Pipe,
|
|
29
|
-
args: [{
|
|
30
|
-
name: 'fngChipText',
|
|
31
|
-
pure: false
|
|
32
|
-
}]
|
|
33
|
-
}] });
|
|
34
|
-
//# sourceMappingURL=chip-text.pipe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chip-text.pipe.js","sourceRoot":"","sources":["../../../../../../../libs/angular/src/lib/forms/select/chip-text.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;;AAEpD,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACrC,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AACpC,CAAC;AAMD,MAAM,OAAO,YAAY;IACvB,SAAS,CAAC,KAAU,EAAE,OAAc,EAAE,eAAwB,EAAE,cAAuB;QACrF,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,eAAe,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;QACnD,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;QAEhD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,KAAa,EAAE,EAAE;YACxC,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,EAAE;gBAC9F,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC;aAC3C;YAED,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;gBAC7E,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC;aAC3C;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;;yGAjBU,YAAY;uGAAZ,YAAY;2FAAZ,YAAY;kBAJxB,IAAI;mBAAC;oBACJ,IAAI,EAAE,aAAa;oBACnB,IAAI,EAAE,KAAK;iBACZ","sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\nfunction defaultValueKey(key: string): string {\n return key == null ? 'value' : key;\n}\n\nfunction defaultTextKey(key: string): string {\n return key == null ? 'text' : key;\n}\n\n@Pipe({\n name: 'fngChipText',\n pure: false\n})\nexport class ChipTextPipe implements PipeTransform {\n transform(value: any, options: any[], optionsValueKey?: string, optionsTextKey?: string): string {\n let chipText = '';\n optionsValueKey = defaultValueKey(optionsValueKey);\n optionsTextKey = defaultTextKey(optionsTextKey);\n\n options.forEach((_: any, index: number) => {\n if (JSON.stringify(options[index][optionsValueKey]) === JSON.stringify(value[optionsValueKey])) {\n chipText = options[index][optionsTextKey];\n }\n\n if (JSON.stringify(options[index][optionsValueKey]) === JSON.stringify(value)) {\n chipText = options[index][optionsTextKey];\n }\n });\n\n return chipText;\n }\n}\n"]}
|