@bravobit/bb-foundation 0.16.1 → 0.16.2
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/controls/lib/checkbox/checkbox/checkbox.component.d.ts +47 -0
- package/controls/lib/checkbox/checkbox-group/checkbox-group.component.d.ts +18 -0
- package/controls/lib/checkbox/checkbox.module.d.ts +4 -4
- package/controls/public_api.d.ts +2 -1
- package/esm2020/collections/lib/providers/api-collection.provider.mjs +4 -1
- package/esm2020/controls/lib/checkbox/checkbox/checkbox.component.mjs +153 -0
- package/esm2020/controls/lib/checkbox/checkbox-group/checkbox-group.component.mjs +48 -0
- package/esm2020/controls/lib/checkbox/checkbox.module.mjs +8 -8
- package/esm2020/controls/public_api.mjs +3 -2
- package/esm2020/elements/lib/checkbox/checkbox.component.mjs +2 -2
- package/esm2020/elements/lib/directives/input.directive.mjs +2 -2
- package/esm2020/elements/lib/icon/icon.component.mjs +2 -2
- package/esm2020/lib/core/mixins/can-disable.mjs +2 -2
- package/esm2020/lib/core/mixins/can-hide-errors.mjs +2 -2
- package/esm2020/lib/core/mixins/can-load.mjs +2 -2
- package/esm2020/lib/core/mixins/has-error.mjs +2 -2
- package/esm2020/lib/core/mixins/is-focused.mjs +2 -2
- package/esm2020/lib/core/mixins/is-grouped.mjs +2 -2
- package/esm2020/lib/core/mixins/is-readonly.mjs +2 -2
- package/esm2020/lib/core/mixins/is-required.mjs +2 -2
- package/esm2020/public_api.mjs +1 -2
- package/fesm2015/bravobit-bb-foundation-collections.mjs +3 -0
- package/fesm2015/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-controls.mjs +152 -40
- package/fesm2015/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation-elements.mjs +2 -1
- package/fesm2015/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2015/bravobit-bb-foundation.mjs +2 -5
- package/fesm2015/bravobit-bb-foundation.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-collections.mjs +3 -0
- package/fesm2020/bravobit-bb-foundation-collections.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-controls.mjs +152 -40
- package/fesm2020/bravobit-bb-foundation-controls.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation-elements.mjs +2 -1
- package/fesm2020/bravobit-bb-foundation-elements.mjs.map +1 -1
- package/fesm2020/bravobit-bb-foundation.mjs +2 -5
- package/fesm2020/bravobit-bb-foundation.mjs.map +1 -1
- package/package.json +4 -3
- package/public_api.d.ts +0 -1
- package/controls/lib/checkbox/checkbox.component.d.ts +0 -27
- package/esm2020/controls/lib/checkbox/checkbox.component.mjs +0 -86
- package/esm2020/lib/core/coercions/boolean-coercion.mjs +0 -4
- package/lib/core/coercions/boolean-coercion.d.ts +0 -1
|
@@ -1,38 +1,117 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, EventEmitter, forwardRef, ViewChild, Output, NgModule } from '@angular/core';
|
|
3
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
4
|
+
import * as i1 from '@angular/common';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
6
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
|
|
8
|
+
class BbiCheckboxGroup {
|
|
9
|
+
constructor(_changeDetectorRef) {
|
|
10
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
11
|
+
// Inputs.
|
|
12
|
+
this.label = null; // TODO(Stan): Add template possibilities here.
|
|
13
|
+
this._grouped = false;
|
|
14
|
+
this._required = false;
|
|
15
|
+
}
|
|
16
|
+
// Grouped.
|
|
17
|
+
get grouped() { return this._grouped; }
|
|
18
|
+
set grouped(value) {
|
|
19
|
+
const newValue = coerceBooleanProperty(value);
|
|
20
|
+
if (newValue !== this.grouped) {
|
|
21
|
+
this._grouped = newValue;
|
|
22
|
+
this._changeDetectorRef.markForCheck();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Required.
|
|
26
|
+
get required() { return this._required; }
|
|
27
|
+
set required(value) {
|
|
28
|
+
const newValue = coerceBooleanProperty(value);
|
|
29
|
+
if (newValue !== this.required) {
|
|
30
|
+
this._required = newValue;
|
|
31
|
+
this._changeDetectorRef.markForCheck();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
BbiCheckboxGroup.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbiCheckboxGroup, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
36
|
+
BbiCheckboxGroup.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbiCheckboxGroup, selector: "bbi-checkbox-group", inputs: { label: "label", grouped: "grouped", required: "required" }, host: { properties: { "class.grouped": "grouped", "class.required": "required" }, classAttribute: "bbi-checkbox-group" }, ngImport: i0, template: "<label *ngIf=\"label as label\"\n class=\"bbi-checkbox-group-label\">\n {{ label }}\n</label>\n\n<div class=\"bbi-checkbox-group-items\">\n <ng-content select=\"bbi-checkbox\"></ng-content>\n</div>\n", styles: [".bbi-checkbox-group{display:block}.bbi-checkbox-group.grouped{margin-bottom:20px}.bbi-checkbox-group.required>.bbi-checkbox-group-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bbi-checkbox-group-label{border:0;padding:0;line-height:1.33;margin-bottom:4px;font-family:inherit;display:inline-block;box-sizing:border-box;vertical-align:initial;color:var(--checkbox-group-label-color, #525252);font-size:var(--checkbox-group-label-size, 14px);font-weight:var(--checkbox-group-label-weight, 400)}.bbi-checkbox-group-items{display:flex;flex-direction:column}.bbi-checkbox-group-items:not(:empty){margin-bottom:-4px}.bbi-checkbox-group-items>*{margin-bottom:4px}@media only screen and (min-width: 768px){.bbi-checkbox-group:not(.vertical)>.bbi-checkbox-group-items{flex-wrap:wrap;flex-direction:row}.bbi-checkbox-group:not(.vertical)>.bbi-checkbox-group-items>*:not(:last-child){margin-right:10px}}\n"], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbiCheckboxGroup, decorators: [{
|
|
38
|
+
type: Component,
|
|
39
|
+
args: [{ selector: 'bbi-checkbox-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
40
|
+
'class': 'bbi-checkbox-group',
|
|
41
|
+
'[class.grouped]': 'grouped',
|
|
42
|
+
'[class.required]': 'required'
|
|
43
|
+
}, preserveWhitespaces: false, template: "<label *ngIf=\"label as label\"\n class=\"bbi-checkbox-group-label\">\n {{ label }}\n</label>\n\n<div class=\"bbi-checkbox-group-items\">\n <ng-content select=\"bbi-checkbox\"></ng-content>\n</div>\n", styles: [".bbi-checkbox-group{display:block}.bbi-checkbox-group.grouped{margin-bottom:20px}.bbi-checkbox-group.required>.bbi-checkbox-group-label:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5}.bbi-checkbox-group-label{border:0;padding:0;line-height:1.33;margin-bottom:4px;font-family:inherit;display:inline-block;box-sizing:border-box;vertical-align:initial;color:var(--checkbox-group-label-color, #525252);font-size:var(--checkbox-group-label-size, 14px);font-weight:var(--checkbox-group-label-weight, 400)}.bbi-checkbox-group-items{display:flex;flex-direction:column}.bbi-checkbox-group-items:not(:empty){margin-bottom:-4px}.bbi-checkbox-group-items>*{margin-bottom:4px}@media only screen and (min-width: 768px){.bbi-checkbox-group:not(.vertical)>.bbi-checkbox-group-items{flex-wrap:wrap;flex-direction:row}.bbi-checkbox-group:not(.vertical)>.bbi-checkbox-group-items>*:not(:last-child){margin-right:10px}}\n"] }]
|
|
44
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { label: [{
|
|
45
|
+
type: Input
|
|
46
|
+
}], grouped: [{
|
|
47
|
+
type: Input
|
|
48
|
+
}], required: [{
|
|
49
|
+
type: Input
|
|
50
|
+
}] } });
|
|
6
51
|
|
|
7
52
|
let nextUniqueId = 0;
|
|
8
53
|
class BbiCheckbox {
|
|
9
|
-
constructor(_renderer) {
|
|
54
|
+
constructor(_renderer, _changeDetectorRef) {
|
|
10
55
|
this._renderer = _renderer;
|
|
56
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
11
57
|
// Readonly data.
|
|
12
58
|
this.labelId = `bbi-checkbox-${nextUniqueId++}`;
|
|
59
|
+
// Outputs.
|
|
60
|
+
this.checkedChange = new EventEmitter();
|
|
61
|
+
this.indeterminateChange = new EventEmitter();
|
|
62
|
+
this._checked = false;
|
|
63
|
+
this._disabled = false;
|
|
64
|
+
this._grouped = false;
|
|
65
|
+
this._indeterminate = false;
|
|
66
|
+
this._required = false;
|
|
13
67
|
// Methods.
|
|
14
68
|
this.onChange = () => ({});
|
|
15
69
|
this.onTouched = () => ({});
|
|
16
|
-
// State.
|
|
17
|
-
this._grouped = false;
|
|
18
|
-
this._disabled = false;
|
|
19
|
-
this._indeterminate = false;
|
|
20
70
|
}
|
|
21
|
-
//
|
|
71
|
+
// Checked.
|
|
72
|
+
get checked() { return this._checked; }
|
|
73
|
+
set checked(value) {
|
|
74
|
+
const newValue = coerceBooleanProperty(value);
|
|
75
|
+
if (newValue !== this.checked) {
|
|
76
|
+
this._checked = newValue;
|
|
77
|
+
this._changeDetectorRef.markForCheck();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Disabled.
|
|
81
|
+
get disabled() { return this._disabled; }
|
|
22
82
|
set disabled(value) {
|
|
23
|
-
const
|
|
24
|
-
this.
|
|
83
|
+
const newValue = coerceBooleanProperty(value);
|
|
84
|
+
if (newValue !== this.disabled) {
|
|
85
|
+
this._disabled = newValue;
|
|
86
|
+
this._changeDetectorRef.markForCheck();
|
|
87
|
+
}
|
|
25
88
|
}
|
|
89
|
+
// Grouped.
|
|
90
|
+
get grouped() { return this._grouped; }
|
|
26
91
|
set grouped(value) {
|
|
27
|
-
|
|
92
|
+
const newValue = coerceBooleanProperty(value);
|
|
93
|
+
if (newValue !== this.grouped) {
|
|
94
|
+
this._grouped = newValue;
|
|
95
|
+
this._changeDetectorRef.markForCheck();
|
|
96
|
+
}
|
|
28
97
|
}
|
|
98
|
+
// Indeterminate.
|
|
99
|
+
get indeterminate() { return this._indeterminate; }
|
|
29
100
|
set indeterminate(value) {
|
|
30
|
-
|
|
31
|
-
this.
|
|
101
|
+
this._indeterminate = coerceBooleanProperty(value);
|
|
102
|
+
this.syncField('indeterminate', this._indeterminate);
|
|
103
|
+
}
|
|
104
|
+
// Required.
|
|
105
|
+
get required() { return this._required; }
|
|
106
|
+
set required(value) {
|
|
107
|
+
const newValue = coerceBooleanProperty(value);
|
|
108
|
+
if (newValue !== this.required) {
|
|
109
|
+
this._required = newValue;
|
|
110
|
+
this._changeDetectorRef.markForCheck();
|
|
111
|
+
}
|
|
32
112
|
}
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
this.setIndeterminateState(this._indeterminate);
|
|
113
|
+
ngAfterViewInit() {
|
|
114
|
+
this.syncField('indeterminate', this._indeterminate);
|
|
36
115
|
}
|
|
37
116
|
registerOnChange(fn) {
|
|
38
117
|
this.onChange = fn;
|
|
@@ -41,62 +120,95 @@ class BbiCheckbox {
|
|
|
41
120
|
this.onTouched = fn;
|
|
42
121
|
}
|
|
43
122
|
setDisabledState(isDisabled) {
|
|
44
|
-
this.
|
|
45
|
-
this.setProperty('disabled', this._disabled);
|
|
46
|
-
}
|
|
47
|
-
setIndeterminateState(indeterminate) {
|
|
48
|
-
this._indeterminate = indeterminate;
|
|
49
|
-
this.setProperty('indeterminate', this._indeterminate);
|
|
123
|
+
this.disabled = isDisabled;
|
|
50
124
|
}
|
|
51
125
|
writeValue(newValue) {
|
|
52
|
-
this.
|
|
126
|
+
this.checked = !!newValue;
|
|
127
|
+
}
|
|
128
|
+
toggle() {
|
|
129
|
+
this.checked = !this.checked;
|
|
130
|
+
}
|
|
131
|
+
onClickEvent(event) {
|
|
132
|
+
event.stopPropagation();
|
|
133
|
+
if (this.disabled) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
// When user manually click on the checkbox, `indeterminate` is set to false.
|
|
137
|
+
if (this.indeterminate) {
|
|
138
|
+
Promise.resolve().then(() => {
|
|
139
|
+
this._indeterminate = false;
|
|
140
|
+
this.indeterminateChange.emit(this._indeterminate);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
this.toggle();
|
|
144
|
+
// Emit our custom change event if the native input emitted one.
|
|
145
|
+
// It is important to only emit it, if the native input triggered one, because
|
|
146
|
+
// we don't want to trigger a change event, when the `checked` variable changes for example.
|
|
147
|
+
this.emitChangeEvent();
|
|
53
148
|
}
|
|
54
149
|
onChangeEvent(event) {
|
|
55
|
-
|
|
150
|
+
// We always have to stop propagation on the change event.
|
|
151
|
+
// Otherwise the change event, from the input element, will bubble up and
|
|
152
|
+
// emit its event object to the `change` output.
|
|
153
|
+
event.stopPropagation();
|
|
154
|
+
}
|
|
155
|
+
emitChangeEvent() {
|
|
156
|
+
this.onChange?.(this.checked);
|
|
157
|
+
this.checkedChange.emit(this.checked);
|
|
158
|
+
this.syncField('checked', this.checked);
|
|
56
159
|
}
|
|
57
|
-
|
|
160
|
+
syncField(field, value) {
|
|
58
161
|
const element = this.inputElementRef?.nativeElement;
|
|
59
162
|
if (!element) {
|
|
60
163
|
return;
|
|
61
164
|
}
|
|
62
|
-
this._renderer.setProperty(element,
|
|
165
|
+
this._renderer.setProperty(element, field, value);
|
|
63
166
|
}
|
|
64
167
|
}
|
|
65
|
-
BbiCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbiCheckbox, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
66
|
-
BbiCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbiCheckbox, selector: "bbi-checkbox", inputs: {
|
|
168
|
+
BbiCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbiCheckbox, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
169
|
+
BbiCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.0", type: BbiCheckbox, selector: "bbi-checkbox", inputs: { checked: "checked", disabled: "disabled", grouped: "grouped", indeterminate: "indeterminate", required: "required" }, outputs: { checkedChange: "checkedChange", indeterminateChange: "indeterminateChange" }, host: { properties: { "class.grouped": "grouped", "class.indeterminate": "indeterminate", "class.required": "required" }, classAttribute: "bbi-checkbox" }, providers: [
|
|
67
170
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbiCheckbox), multi: true }
|
|
68
|
-
], viewQueries: [{ propertyName: "inputElementRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<input #input\n [id]=\"labelId\"\n (change)=\"onChangeEvent($event)\"\n (blur)=\"onTouched()\"\n class=\"bbi-checkbox-input\"\n type=\"checkbox\">\n<label [attr.for]=\"labelId\"\n class=\"bbi-checkbox-label\">\n <span class=\"bbi-checkbox-text\"
|
|
171
|
+
], viewQueries: [{ propertyName: "inputElementRef", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<input #input\n [id]=\"labelId\"\n [disabled]=\"disabled\"\n [checked]=\"checked\"\n (change)=\"onChangeEvent($event)\"\n (click)=\"onClickEvent($event)\"\n (blur)=\"onTouched()\"\n class=\"bbi-checkbox-input\"\n type=\"checkbox\">\n<label [attr.for]=\"labelId\"\n class=\"bbi-checkbox-label\">\n <span class=\"bbi-checkbox-text\"><ng-content></ng-content></span>\n</label>\n", styles: [".bbi-checkbox{display:block}.bbi-checkbox.grouped{margin-bottom:20px}.bbi-checkbox.required>.bbi-checkbox-label>.bbi-checkbox-text:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5;margin-left:3px}.bbi-checkbox-input{border:0;width:1px;padding:0;height:1px;margin:-1px;overflow:hidden;position:absolute;visibility:inherit;white-space:nowrap;clip:rect(0,0,0,0)}.bbi-checkbox-input:checked+.bbi-checkbox-label:before,.bbi-checkbox-input:indeterminate+.bbi-checkbox-label:before{border:1px solid var(--checkbox-accent-color, #1565c0);background-color:var(--checkbox-accent-color, #1565c0)}.bbi-checkbox-input:checked+.bbi-checkbox-label:after,.bbi-checkbox-input:indeterminate+.bbi-checkbox-label:after{opacity:1;transform:scale(1) rotate(-45deg)}.bbi-checkbox-input:indeterminate+.bbi-checkbox-label:after{top:-1px;left:5px;width:10px;transform:scale(1) rotate(0);border-left:0 solid var(--checkbox-check-color, white);border-bottom:2px solid var(--checkbox-check-color, white)}.bbi-checkbox-input:focus+.bbi-checkbox-label:before{outline-color:var(--checkbox-accent-color, #1565c0)}.bbi-checkbox-input:disabled+.bbi-checkbox-label{cursor:not-allowed;color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-input:disabled+.bbi-checkbox-label:before{border-color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-input:disabled+.bbi-checkbox-label>.bbi-checkbox-text{color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-input:checked:disabled+.bbi-checkbox-label:before,.bbi-checkbox-input:indeterminate:disabled+.bbi-checkbox-label:before{background-color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-label{border:0;margin:0;display:flex;cursor:pointer;font-size:16px;font-weight:400;line-height:1.28;-webkit-user-select:none;user-select:none;position:relative;padding-left:20px;font-family:inherit;vertical-align:initial}.bbi-checkbox-label:before{left:0;width:20px;content:\"\";height:20px;position:absolute;border-radius:4px;outline-offset:1px;background-color:initial;outline:2px solid transparent;border:1px solid var(--checkbox-border-color, #111111);transition:outline-color .2s cubic-bezier(0,0,.2,1),background-color .18s cubic-bezier(0,0,.2,1),border-color .18s cubic-bezier(0,0,.2,1)}.bbi-checkbox-label:after{left:4px;opacity:0;width:12px;height:6px;content:\"\";margin-top:6px;background:none;position:absolute;transform-origin:center;transform:scale(.85) rotate(-60deg);border-left:2px solid var(--checkbox-check-color, white);border-bottom:2px solid var(--checkbox-check-color, white);transition:opacity .12s cubic-bezier(0,0,.2,1),transform .18s cubic-bezier(0,0,.2,1)}.bbi-checkbox-text{padding-left:6px;color:var(--checkbox-label-color, #111111)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
69
172
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: BbiCheckbox, decorators: [{
|
|
70
173
|
type: Component,
|
|
71
174
|
args: [{ selector: 'bbi-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
72
175
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbiCheckbox), multi: true }
|
|
73
176
|
], host: {
|
|
74
177
|
'class': 'bbi-checkbox',
|
|
75
|
-
'[class.grouped]': '
|
|
76
|
-
'[class.indeterminate]': '
|
|
77
|
-
|
|
78
|
-
|
|
178
|
+
'[class.grouped]': 'grouped',
|
|
179
|
+
'[class.indeterminate]': 'indeterminate',
|
|
180
|
+
'[class.required]': 'required'
|
|
181
|
+
}, preserveWhitespaces: false, template: "<input #input\n [id]=\"labelId\"\n [disabled]=\"disabled\"\n [checked]=\"checked\"\n (change)=\"onChangeEvent($event)\"\n (click)=\"onClickEvent($event)\"\n (blur)=\"onTouched()\"\n class=\"bbi-checkbox-input\"\n type=\"checkbox\">\n<label [attr.for]=\"labelId\"\n class=\"bbi-checkbox-label\">\n <span class=\"bbi-checkbox-text\"><ng-content></ng-content></span>\n</label>\n", styles: [".bbi-checkbox{display:block}.bbi-checkbox.grouped{margin-bottom:20px}.bbi-checkbox.required>.bbi-checkbox-label>.bbi-checkbox-text:after{content:\"*\";color:#c23934;font-size:12px;line-height:1.5;margin-left:3px}.bbi-checkbox-input{border:0;width:1px;padding:0;height:1px;margin:-1px;overflow:hidden;position:absolute;visibility:inherit;white-space:nowrap;clip:rect(0,0,0,0)}.bbi-checkbox-input:checked+.bbi-checkbox-label:before,.bbi-checkbox-input:indeterminate+.bbi-checkbox-label:before{border:1px solid var(--checkbox-accent-color, #1565c0);background-color:var(--checkbox-accent-color, #1565c0)}.bbi-checkbox-input:checked+.bbi-checkbox-label:after,.bbi-checkbox-input:indeterminate+.bbi-checkbox-label:after{opacity:1;transform:scale(1) rotate(-45deg)}.bbi-checkbox-input:indeterminate+.bbi-checkbox-label:after{top:-1px;left:5px;width:10px;transform:scale(1) rotate(0);border-left:0 solid var(--checkbox-check-color, white);border-bottom:2px solid var(--checkbox-check-color, white)}.bbi-checkbox-input:focus+.bbi-checkbox-label:before{outline-color:var(--checkbox-accent-color, #1565c0)}.bbi-checkbox-input:disabled+.bbi-checkbox-label{cursor:not-allowed;color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-input:disabled+.bbi-checkbox-label:before{border-color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-input:disabled+.bbi-checkbox-label>.bbi-checkbox-text{color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-input:checked:disabled+.bbi-checkbox-label:before,.bbi-checkbox-input:indeterminate:disabled+.bbi-checkbox-label:before{background-color:var(--checkbox-disabled-color, #c6c6c6)}.bbi-checkbox-label{border:0;margin:0;display:flex;cursor:pointer;font-size:16px;font-weight:400;line-height:1.28;-webkit-user-select:none;user-select:none;position:relative;padding-left:20px;font-family:inherit;vertical-align:initial}.bbi-checkbox-label:before{left:0;width:20px;content:\"\";height:20px;position:absolute;border-radius:4px;outline-offset:1px;background-color:initial;outline:2px solid transparent;border:1px solid var(--checkbox-border-color, #111111);transition:outline-color .2s cubic-bezier(0,0,.2,1),background-color .18s cubic-bezier(0,0,.2,1),border-color .18s cubic-bezier(0,0,.2,1)}.bbi-checkbox-label:after{left:4px;opacity:0;width:12px;height:6px;content:\"\";margin-top:6px;background:none;position:absolute;transform-origin:center;transform:scale(.85) rotate(-60deg);border-left:2px solid var(--checkbox-check-color, white);border-bottom:2px solid var(--checkbox-check-color, white);transition:opacity .12s cubic-bezier(0,0,.2,1),transform .18s cubic-bezier(0,0,.2,1)}.bbi-checkbox-text{padding-left:6px;color:var(--checkbox-label-color, #111111)}\n"] }]
|
|
182
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { inputElementRef: [{
|
|
79
183
|
type: ViewChild,
|
|
80
184
|
args: ['input', { static: true }]
|
|
185
|
+
}], checkedChange: [{
|
|
186
|
+
type: Output
|
|
187
|
+
}], indeterminateChange: [{
|
|
188
|
+
type: Output
|
|
189
|
+
}], checked: [{
|
|
190
|
+
type: Input
|
|
81
191
|
}], disabled: [{
|
|
82
192
|
type: Input
|
|
83
193
|
}], grouped: [{
|
|
84
194
|
type: Input
|
|
85
195
|
}], indeterminate: [{
|
|
86
196
|
type: Input
|
|
197
|
+
}], required: [{
|
|
198
|
+
type: Input
|
|
87
199
|
}] } });
|
|
88
200
|
|
|
89
201
|
class CheckboxModule {
|
|
90
202
|
}
|
|
91
203
|
CheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: CheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
92
|
-
CheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: CheckboxModule, declarations: [BbiCheckbox], imports: [CommonModule
|
|
93
|
-
CheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: CheckboxModule, imports: [[CommonModule
|
|
204
|
+
CheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: CheckboxModule, declarations: [BbiCheckbox, BbiCheckboxGroup], imports: [CommonModule], exports: [BbiCheckbox, BbiCheckboxGroup] });
|
|
205
|
+
CheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: CheckboxModule, imports: [[CommonModule]] });
|
|
94
206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: CheckboxModule, decorators: [{
|
|
95
207
|
type: NgModule,
|
|
96
208
|
args: [{
|
|
97
|
-
imports: [CommonModule
|
|
98
|
-
declarations: [BbiCheckbox],
|
|
99
|
-
exports: [BbiCheckbox]
|
|
209
|
+
imports: [CommonModule],
|
|
210
|
+
declarations: [BbiCheckbox, BbiCheckboxGroup],
|
|
211
|
+
exports: [BbiCheckbox, BbiCheckboxGroup]
|
|
100
212
|
}]
|
|
101
213
|
}] });
|
|
102
214
|
|
|
@@ -117,5 +229,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.0", ngImpor
|
|
|
117
229
|
* Generated bundle index. Do not edit.
|
|
118
230
|
*/
|
|
119
231
|
|
|
120
|
-
export { BbiCheckbox, CheckboxModule, ControlsModule };
|
|
232
|
+
export { BbiCheckbox, BbiCheckboxGroup, CheckboxModule, ControlsModule };
|
|
121
233
|
//# sourceMappingURL=bravobit-bb-foundation-controls.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bravobit-bb-foundation-controls.mjs","sources":["../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox.component.ts","../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox.component.html","../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox.module.ts","../../../projects/bb-foundation/controls/src/lib/controls.module.ts","../../../projects/bb-foundation/controls/src/bravobit-bb-foundation-controls.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n forwardRef,\n Input, OnInit,\n Renderer2,\n ViewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\nimport {coerceBooleanProperty} from '@bravobit/bb-foundation';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'bbi-checkbox',\n templateUrl: './checkbox.component.html',\n styleUrls: ['./checkbox.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbiCheckbox), multi: true}\n ],\n host: {\n 'class': 'bbi-checkbox',\n '[class.grouped]': '_grouped',\n '[class.indeterminate]': '_indeterminate'\n },\n inputs: ['grouped'],\n preserveWhitespaces: false\n})\nexport class BbiCheckbox implements ControlValueAccessor, OnInit {\n\n // Readonly data.\n readonly labelId = `bbi-checkbox-${nextUniqueId++}`;\n\n // Views.\n @ViewChild('input', {static: true}) inputElementRef: ElementRef<HTMLInputElement>;\n\n // Inputs.\n @Input() set disabled(value: unknown) {\n const disabled = coerceBooleanProperty(value);\n this.setDisabledState(disabled);\n }\n\n @Input() set grouped(value: unknown) {\n this._grouped = coerceBooleanProperty(value);\n }\n\n @Input() set indeterminate(value: unknown) {\n const indeterminate = coerceBooleanProperty(value);\n this.setIndeterminateState(indeterminate);\n }\n\n // Methods.\n onChange: (newValue: boolean) => void = () => ({});\n onTouched: () => void = () => ({});\n\n // State.\n _grouped: boolean = false;\n _disabled: boolean = false;\n _indeterminate: boolean = false;\n\n constructor(private _renderer: Renderer2) {\n }\n\n ngOnInit() {\n this.setDisabledState(this._disabled);\n this.setIndeterminateState(this._indeterminate);\n }\n\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean) {\n this._disabled = isDisabled;\n this.setProperty('disabled', this._disabled);\n }\n\n setIndeterminateState(indeterminate: boolean) {\n this._indeterminate = indeterminate;\n this.setProperty('indeterminate', this._indeterminate);\n }\n\n writeValue(newValue: boolean) {\n this.setProperty('checked', newValue);\n }\n\n onChangeEvent(event: Event) {\n this.onChange((event?.target as HTMLInputElement)?.checked);\n }\n\n private setProperty(key: string, value: unknown) {\n const element = this.inputElementRef?.nativeElement;\n if (!element) {\n return;\n }\n this._renderer.setProperty(element, key, value);\n }\n\n}\n","<input #input\n [id]=\"labelId\"\n (change)=\"onChangeEvent($event)\"\n (blur)=\"onTouched()\"\n class=\"bbi-checkbox-input\"\n type=\"checkbox\">\n<label [attr.for]=\"labelId\"\n class=\"bbi-checkbox-label\">\n <span class=\"bbi-checkbox-text\"\n dir=\"auto\"><ng-content></ng-content></span>\n</label>\n","import {ReactiveFormsModule} from '@angular/forms';\nimport {BbiCheckbox} from './checkbox.component';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [CommonModule, ReactiveFormsModule],\n declarations: [BbiCheckbox],\n exports: [BbiCheckbox]\n})\nexport class CheckboxModule {\n}\n","import {CheckboxModule} from './checkbox/checkbox.module';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [CheckboxModule],\n exports: [CheckboxModule]\n})\nexport class ControlsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAaA,IAAI,YAAY,GAAG,CAAC,CAAC;MAmBR,WAAW;IAgCpB,YAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;;QA7B/B,YAAO,GAAG,gBAAgB,YAAY,EAAE,EAAE,CAAC;;QAqBpD,aAAQ,GAAgC,OAAO,EAAE,CAAC,CAAC;QACnD,c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oBAC5C,YAAY,EAAE,CAAC,WAAW,CAAC;oBAC3B,OAAO,EAAE,CAAC,WAAW,CAAC;iBACzB;;;MCFY,cAAc;;2GAAd,cAAc;4GAAd,cAAc,YAHb,cAAc,aACd,cAAc;4GAEf,cAAc,YAHd,CAAC,cAAc,CAAC,EACf,cAAc;2FAEf,cAAc;kBAJ1B,QAAQ;mBAAC;oBACN,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,cAAc,CAAC;iBAC5B;;;ACND;;;;;;"}
|
|
1
|
+
{"version":3,"file":"bravobit-bb-foundation-controls.mjs","sources":["../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox-group/checkbox-group.component.ts","../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox-group/checkbox-group.component.html","../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox/checkbox.component.ts","../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox/checkbox.component.html","../../../projects/bb-foundation/controls/src/lib/checkbox/checkbox.module.ts","../../../projects/bb-foundation/controls/src/lib/controls.module.ts","../../../projects/bb-foundation/controls/src/bravobit-bb-foundation-controls.ts"],"sourcesContent":["import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, ViewEncapsulation} from '@angular/core';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\n\n@Component({\n selector: 'bbi-checkbox-group',\n templateUrl: './checkbox-group.component.html',\n styleUrls: ['./checkbox-group.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n 'class': 'bbi-checkbox-group',\n '[class.grouped]': 'grouped',\n '[class.required]': 'required'\n },\n preserveWhitespaces: false\n})\nexport class BbiCheckboxGroup {\n\n // Inputs.\n @Input() label: string | null = null; // TODO(Stan): Add template possibilities here.\n\n // Grouped.\n @Input()\n get grouped() { return this._grouped; }\n\n set grouped(value: unknown) {\n const newValue = coerceBooleanProperty(value);\n if (newValue !== this.grouped) {\n this._grouped = newValue;\n this._changeDetectorRef.markForCheck();\n }\n }\n\n private _grouped = false;\n\n // Required.\n @Input()\n get required() { return this._required; }\n\n set required(value: unknown) {\n const newValue = coerceBooleanProperty(value);\n if (newValue !== this.required) {\n this._required = newValue;\n this._changeDetectorRef.markForCheck();\n }\n }\n\n private _required = false;\n\n constructor(private _changeDetectorRef: ChangeDetectorRef) {\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_grouped: BooleanInput;\n static ngAcceptInputType_required: BooleanInput;\n\n}\n","<label *ngIf=\"label as label\"\n class=\"bbi-checkbox-group-label\">\n {{ label }}\n</label>\n\n<div class=\"bbi-checkbox-group-items\">\n <ng-content select=\"bbi-checkbox\"></ng-content>\n</div>\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Input, Output,\n Renderer2,\n ViewChild,\n ViewEncapsulation\n} from '@angular/core';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';\n\nlet nextUniqueId = 0;\n\n@Component({\n selector: 'bbi-checkbox',\n templateUrl: './checkbox.component.html',\n styleUrls: ['./checkbox.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BbiCheckbox), multi: true}\n ],\n host: {\n 'class': 'bbi-checkbox',\n '[class.grouped]': 'grouped',\n '[class.indeterminate]': 'indeterminate',\n '[class.required]': 'required'\n },\n preserveWhitespaces: false\n})\nexport class BbiCheckbox implements ControlValueAccessor, AfterViewInit {\n\n // Readonly data.\n readonly labelId = `bbi-checkbox-${nextUniqueId++}`;\n\n // Views.\n @ViewChild('input', {static: true}) inputElementRef: ElementRef<HTMLInputElement>;\n\n // Outputs.\n @Output() checkedChange = new EventEmitter<boolean>();\n @Output() indeterminateChange = new EventEmitter<boolean>();\n\n // Checked.\n @Input()\n get checked() { return this._checked;}\n\n set checked(value: boolean) {\n const newValue = coerceBooleanProperty(value);\n if (newValue !== this.checked) {\n this._checked = newValue;\n this._changeDetectorRef.markForCheck();\n }\n }\n\n private _checked: boolean = false;\n\n // Disabled.\n @Input()\n get disabled() { return this._disabled; }\n\n set disabled(value: unknown) {\n const newValue = coerceBooleanProperty(value);\n if (newValue !== this.disabled) {\n this._disabled = newValue;\n this._changeDetectorRef.markForCheck();\n }\n }\n\n private _disabled = false;\n\n // Grouped.\n @Input()\n get grouped() { return this._grouped; }\n\n set grouped(value: unknown) {\n const newValue = coerceBooleanProperty(value);\n if (newValue !== this.grouped) {\n this._grouped = newValue;\n this._changeDetectorRef.markForCheck();\n }\n }\n\n private _grouped = false;\n\n // Indeterminate.\n @Input()\n get indeterminate() { return this._indeterminate; }\n\n set indeterminate(value: unknown) {\n this._indeterminate = coerceBooleanProperty(value);\n this.syncField('indeterminate', this._indeterminate);\n }\n\n private _indeterminate = false;\n\n // Required.\n @Input()\n get required() { return this._required; }\n\n set required(value: unknown) {\n const newValue = coerceBooleanProperty(value);\n if (newValue !== this.required) {\n this._required = newValue;\n this._changeDetectorRef.markForCheck();\n }\n }\n\n private _required = false;\n\n // Methods.\n onChange: (newValue: boolean) => void = () => ({});\n onTouched: () => void = () => ({});\n\n constructor(private _renderer: Renderer2,\n private _changeDetectorRef: ChangeDetectorRef) {\n }\n\n ngAfterViewInit() {\n this.syncField('indeterminate', this._indeterminate);\n }\n\n registerOnChange(fn: (newValue: boolean) => void) {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void) {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n writeValue(newValue: boolean) {\n this.checked = !!newValue;\n }\n\n toggle() {\n this.checked = !this.checked;\n }\n\n onClickEvent(event: Event) {\n event.stopPropagation();\n if (this.disabled) {\n return;\n }\n\n // When user manually click on the checkbox, `indeterminate` is set to false.\n if (this.indeterminate) {\n Promise.resolve().then(() => {\n this._indeterminate = false;\n this.indeterminateChange.emit(this._indeterminate);\n });\n }\n\n this.toggle();\n\n // Emit our custom change event if the native input emitted one.\n // It is important to only emit it, if the native input triggered one, because\n // we don't want to trigger a change event, when the `checked` variable changes for example.\n this.emitChangeEvent();\n }\n\n onChangeEvent(event: Event) {\n // We always have to stop propagation on the change event.\n // Otherwise the change event, from the input element, will bubble up and\n // emit its event object to the `change` output.\n event.stopPropagation();\n }\n\n private emitChangeEvent() {\n this.onChange?.(this.checked);\n this.checkedChange.emit(this.checked);\n this.syncField('checked', this.checked);\n }\n\n private syncField(field: string, value: boolean) {\n const element = this.inputElementRef?.nativeElement;\n if (!element) {\n return;\n }\n this._renderer.setProperty(element, field, value);\n }\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_checked: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n static ngAcceptInputType_required: BooleanInput;\n static ngAcceptInputType_grouped: BooleanInput;\n static ngAcceptInputType_indeterminate: BooleanInput;\n\n}\n","<input #input\n [id]=\"labelId\"\n [disabled]=\"disabled\"\n [checked]=\"checked\"\n (change)=\"onChangeEvent($event)\"\n (click)=\"onClickEvent($event)\"\n (blur)=\"onTouched()\"\n class=\"bbi-checkbox-input\"\n type=\"checkbox\">\n<label [attr.for]=\"labelId\"\n class=\"bbi-checkbox-label\">\n <span class=\"bbi-checkbox-text\"><ng-content></ng-content></span>\n</label>\n","import {BbiCheckboxGroup} from './checkbox-group/checkbox-group.component';\nimport {BbiCheckbox} from './checkbox/checkbox.component';\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [BbiCheckbox, BbiCheckboxGroup],\n exports: [BbiCheckbox, BbiCheckboxGroup]\n})\nexport class CheckboxModule {\n}\n","import {CheckboxModule} from './checkbox/checkbox.module';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [CheckboxModule],\n exports: [CheckboxModule]\n})\nexport class ControlsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MAgBa,gBAAgB;IAiCzB,YAAoB,kBAAqC;QAArC,uBAAkB,GAAlB,kBAAkB,CAAmB;;QA9BhD,UAAK,GAAkB,IAAI,CAAC;QAc7B,aAAQ,GAAG,KAAK,CAAC;QAcjB,cAAS,GAAG,KAAK,CAAC;KAGzB;;IA5BD,IACI,OAAO,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE;IAEvC,IAAI,OAAO,CAAC,KAAc;QACtB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,QAAQ,KAAK,IAAI,CAAC,OAAO,EAAE;YAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;SAC1C;KACJ;;IAKD,IACI,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE;IAEzC,IAAI,QAAQ,CAAC,KAAc;QACvB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE;YAC5B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;YAC1B,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,CAAC;SAC1C;KACJ;;6GA7BQ,gBAAgB;iGAAhB,gBAAgB,0PChB7B,qNAQA;2FDQa,gBAAgB;kBAb5B,SAAS;+BACI,oBAAoB,mBAGb,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI,QAC/B;wBACF,OAAO,EAAE,oBAAoB;wBAC7B,iBAAiB,EAAE,SAAS;wBAC5B,kBAAkB,EAAE,UAAU;qBACjC,uBACoB,KAAK;wGAKjB,KAAK;sBAAb,KAAK;gBAIF,OA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EMPTY, combineLatest, of, Subscripti
|
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
6
6
|
import { formatDate, DatePipe, CommonModule } from '@angular/common';
|
|
7
7
|
import * as i1$1 from '@bravobit/bb-foundation';
|
|
8
|
-
import { mixinDisabled, mixinLoad, mixinGrouped, mixinFocused, mixinReadonly, mixinRequired, mixinError, mixinHideErrors
|
|
8
|
+
import { mixinDisabled, mixinLoad, mixinGrouped, mixinFocused, mixinReadonly, mixinRequired, mixinError, mixinHideErrors } from '@bravobit/bb-foundation';
|
|
9
9
|
import * as i5 from '@angular/forms';
|
|
10
10
|
import { NG_VALUE_ACCESSOR, NgControl, NG_VALIDATORS, Validators, FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
11
11
|
import { map, mapTo, startWith, distinctUntilChanged, shareReplay, tap, delay } from 'rxjs/operators';
|
|
12
12
|
import * as i4 from '@bravobit/bb-foundation/localize';
|
|
13
13
|
import { LocalizeModule } from '@bravobit/bb-foundation/localize';
|
|
14
14
|
import * as i2 from '@angular/platform-browser';
|
|
15
|
+
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
15
16
|
|
|
16
17
|
class BbDropdown {
|
|
17
18
|
constructor(_elementRef) {
|