@koobiq/components 16.0.0-beta.15 → 16.0.0-beta.17
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/checkbox/_checkbox-theme.scss +9 -6
- package/core/common-behaviors/index.d.ts +2 -0
- package/core/pop-up/pop-up.d.ts +7 -0
- package/core/styles/_variables.scss +1 -1
- package/core/styles/theming/_components-theming.scss +4 -0
- package/core/styles/theming/_theming.scss +1 -0
- package/esm2022/core/common-behaviors/index.mjs +3 -1
- package/esm2022/core/highlight/highlight.pipe.mjs +2 -2
- package/esm2022/core/pop-up/pop-up-trigger.mjs +2 -2
- package/esm2022/core/pop-up/pop-up.mjs +8 -1
- package/esm2022/form-field/form-field.mjs +7 -1
- package/esm2022/icon/icon-button.component.mjs +2 -1
- package/esm2022/icon/icon-item.component.mjs +2 -1
- package/esm2022/icon/icon.component.mjs +13 -1
- package/esm2022/input/input-number.mjs +4 -2
- package/esm2022/loader-overlay/loader-overlay.component.mjs +2 -2
- package/esm2022/modal/modal.component.mjs +17 -3
- package/esm2022/navbar/navbar-item.component.mjs +11 -8
- package/esm2022/navbar/navbar.component.mjs +18 -8
- package/esm2022/navbar/vertical-navbar.component.mjs +3 -3
- package/esm2022/popover/popover.component.mjs +6 -1
- package/esm2022/tabs/tab-group.component.mjs +5 -5
- package/esm2022/textarea/textarea.component.mjs +32 -21
- package/esm2022/tree/control/base-tree-control.mjs +4 -4
- package/esm2022/tree/control/flat-tree-control.filters.mjs +3 -2
- package/esm2022/tree/control/flat-tree-control.mjs +4 -4
- package/esm2022/tree/control/tree-control.mjs +1 -1
- package/esm2022/tree/toggle.mjs +2 -2
- package/esm2022/tree/tree-option.component.mjs +4 -1
- package/fesm2022/koobiq-components-core.mjs +14 -5
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs +6 -0
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-icon.mjs +14 -0
- package/fesm2022/koobiq-components-icon.mjs.map +1 -1
- package/fesm2022/koobiq-components-input.mjs +3 -1
- package/fesm2022/koobiq-components-input.mjs.map +1 -1
- package/fesm2022/koobiq-components-loader-overlay.mjs +2 -2
- package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -1
- package/fesm2022/koobiq-components-modal.mjs +16 -2
- package/fesm2022/koobiq-components-modal.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +29 -16
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-popover.mjs +5 -0
- package/fesm2022/koobiq-components-popover.mjs.map +1 -1
- package/fesm2022/koobiq-components-tabs.mjs +3 -3
- package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
- package/fesm2022/koobiq-components-textarea.mjs +31 -20
- package/fesm2022/koobiq-components-textarea.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree.mjs +12 -8
- package/fesm2022/koobiq-components-tree.mjs.map +1 -1
- package/form-field/form-field.d.ts +2 -0
- package/icon/icon-button.component.d.ts +1 -0
- package/icon/icon-item.component.d.ts +1 -0
- package/icon/icon.component.d.ts +3 -0
- package/input/input-number.d.ts +3 -2
- package/modal/modal.component.d.ts +3 -0
- package/navbar/_navbar-theme.scss +2 -2
- package/navbar/navbar-item.component.d.ts +1 -0
- package/navbar/navbar-item.scss +2 -2
- package/navbar/navbar.component.d.ts +3 -0
- package/package.json +31 -31
- package/popover/popover.component.d.ts +5 -0
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/splitter/_splitter-theme.scss +4 -4
- package/textarea/textarea.component.d.ts +4 -3
- package/tree/control/base-tree-control.d.ts +1 -1
- package/tree/control/tree-control.d.ts +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Directive, Optional, Self, Inject, Input, NgModule } from '@angular/core';
|
|
3
|
+
import { InjectionToken, Directive, Optional, Self, Inject, Host, Input, NgModule } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
6
|
import * as i2 from '@koobiq/components/core';
|
|
7
|
-
import { mixinErrorState, KbqCommonModule } from '@koobiq/components/core';
|
|
7
|
+
import { mixinErrorState, KBQ_PARENT_ANIMATION_COMPONENT, KbqCommonModule } from '@koobiq/components/core';
|
|
8
8
|
import { KbqFormFieldControl } from '@koobiq/components/form-field';
|
|
9
9
|
import { Subject } from 'rxjs';
|
|
10
10
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
@@ -80,9 +80,10 @@ class KbqTextarea extends KbqTextareaMixinBase {
|
|
|
80
80
|
this.stateChanges.next();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
constructor(elementRef, ngControl, parentForm, parentFormGroup, defaultErrorStateMatcher, inputValueAccessor, ngZone) {
|
|
83
|
+
constructor(elementRef, ngControl, parentForm, parentFormGroup, defaultErrorStateMatcher, inputValueAccessor, parent, ngZone) {
|
|
84
84
|
super(defaultErrorStateMatcher, parentForm, parentFormGroup, ngControl);
|
|
85
85
|
this.elementRef = elementRef;
|
|
86
|
+
this.parent = parent;
|
|
86
87
|
this.ngZone = ngZone;
|
|
87
88
|
this.canGrow = true;
|
|
88
89
|
/**
|
|
@@ -106,22 +107,39 @@ class KbqTextarea extends KbqTextareaMixinBase {
|
|
|
106
107
|
this.lineHeight = 0;
|
|
107
108
|
this.freeRowsHeight = 0;
|
|
108
109
|
this.minHeight = 0;
|
|
110
|
+
/** Grow textarea height to avoid vertical scroll */
|
|
111
|
+
this.grow = () => {
|
|
112
|
+
if (!this.canGrow) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.ngZone.runOutsideAngular(() => {
|
|
116
|
+
const textarea = this.elementRef.nativeElement;
|
|
117
|
+
const outerHeight = parseInt(window.getComputedStyle(textarea).height, 10);
|
|
118
|
+
const diff = outerHeight - textarea.clientHeight;
|
|
119
|
+
textarea.style.minHeight = 0; // this line is important to height recalculation
|
|
120
|
+
const height = Math.max(this.minHeight, +textarea.scrollHeight + diff + this.freeRowsHeight);
|
|
121
|
+
textarea.style.minHeight = `${height}px`;
|
|
122
|
+
});
|
|
123
|
+
};
|
|
109
124
|
// If no input value accessor was explicitly specified, use the element as the textarea value
|
|
110
125
|
// accessor.
|
|
111
126
|
this.valueAccessor = inputValueAccessor || this.elementRef.nativeElement;
|
|
112
127
|
this.previousNativeValue = this.value;
|
|
113
128
|
// Force setter to be called in case id was not specified.
|
|
114
129
|
this.id = this.id;
|
|
115
|
-
this.
|
|
130
|
+
this.parent?.animationDone
|
|
131
|
+
.subscribe(() => this.ngOnInit());
|
|
132
|
+
this.growSubscription = this.stateChanges
|
|
133
|
+
.subscribe(this.grow);
|
|
116
134
|
}
|
|
117
135
|
ngOnInit() {
|
|
118
|
-
setTimeout(() => this.grow(), 0);
|
|
119
136
|
this.lineHeight = parseInt(getComputedStyle(this.elementRef.nativeElement).lineHeight, 10);
|
|
120
137
|
const paddingTop = parseInt(getComputedStyle(this.elementRef.nativeElement).paddingTop, 10);
|
|
121
138
|
const paddingBottom = parseInt(getComputedStyle(this.elementRef.nativeElement).paddingBottom, 10);
|
|
122
139
|
// tslint:disable-next-line:no-magic-numbers
|
|
123
140
|
this.minHeight = this.lineHeight * 2 + paddingTop + paddingBottom;
|
|
124
141
|
this.freeRowsHeight = this.lineHeight;
|
|
142
|
+
setTimeout(this.grow, 0);
|
|
125
143
|
}
|
|
126
144
|
ngOnChanges() {
|
|
127
145
|
this.stateChanges.next();
|
|
@@ -150,20 +168,6 @@ class KbqTextarea extends KbqTextareaMixinBase {
|
|
|
150
168
|
control.statusChanges.emit(control.status);
|
|
151
169
|
}
|
|
152
170
|
}
|
|
153
|
-
/** Grow textarea height to avoid vertical scroll */
|
|
154
|
-
grow() {
|
|
155
|
-
if (!this.canGrow) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
this.ngZone.runOutsideAngular(() => {
|
|
159
|
-
const textarea = this.elementRef.nativeElement;
|
|
160
|
-
const outerHeight = parseInt(window.getComputedStyle(textarea).height, 10);
|
|
161
|
-
const diff = outerHeight - textarea.clientHeight;
|
|
162
|
-
textarea.style.minHeight = 0; // this line is important to height recalculation
|
|
163
|
-
const height = Math.max(this.minHeight, +textarea.scrollHeight + diff + this.freeRowsHeight);
|
|
164
|
-
textarea.style.minHeight = `${height}px`;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
171
|
/** Focuses the textarea. */
|
|
168
172
|
focus() {
|
|
169
173
|
this.elementRef.nativeElement.focus();
|
|
@@ -203,7 +207,7 @@ class KbqTextarea extends KbqTextareaMixinBase {
|
|
|
203
207
|
const validity = this.elementRef.nativeElement.validity;
|
|
204
208
|
return validity && validity.badInput;
|
|
205
209
|
}
|
|
206
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTextarea, deps: [{ token: i0.ElementRef }, { token: i1.NgControl, optional: true, self: true }, { token: i1.NgForm, optional: true }, { token: i1.FormGroupDirective, optional: true }, { token: i2.ErrorStateMatcher }, { token: KBQ_TEXTAREA_VALUE_ACCESSOR, optional: true, self: true }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
210
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTextarea, deps: [{ token: i0.ElementRef }, { token: i1.NgControl, optional: true, self: true }, { token: i1.NgForm, optional: true }, { token: i1.FormGroupDirective, optional: true }, { token: i2.ErrorStateMatcher }, { token: KBQ_TEXTAREA_VALUE_ACCESSOR, optional: true, self: true }, { token: KBQ_PARENT_ANIMATION_COMPONENT, host: true, optional: true }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
207
211
|
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.5", type: KbqTextarea, selector: "textarea[kbqTextarea]", inputs: { canGrow: "canGrow", errorStateMatcher: "errorStateMatcher", disabled: "disabled", id: "id", placeholder: "placeholder", required: "required", value: "value" }, host: { listeners: { "blur": "onBlur()", "focus": "focusChanged(true)" }, properties: { "class.kbq-textarea-resizable": "!canGrow", "attr.id": "id", "attr.placeholder": "placeholder", "attr.aria-invalid": "errorState", "attr.disabled": "disabled || null", "attr.required": "required" }, classAttribute: "kbq-textarea kbq-scrollbar" }, providers: [{ provide: KbqFormFieldControl, useExisting: KbqTextarea }], exportAs: ["kbqTextarea"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
|
|
208
212
|
}
|
|
209
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTextarea, decorators: [{
|
|
@@ -239,6 +243,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImpor
|
|
|
239
243
|
}, {
|
|
240
244
|
type: Inject,
|
|
241
245
|
args: [KBQ_TEXTAREA_VALUE_ACCESSOR]
|
|
246
|
+
}] }, { type: undefined, decorators: [{
|
|
247
|
+
type: Optional
|
|
248
|
+
}, {
|
|
249
|
+
type: Host
|
|
250
|
+
}, {
|
|
251
|
+
type: Inject,
|
|
252
|
+
args: [KBQ_PARENT_ANIMATION_COMPONENT]
|
|
242
253
|
}] }, { type: i0.NgZone }]; }, propDecorators: { canGrow: [{
|
|
243
254
|
type: Input
|
|
244
255
|
}], errorStateMatcher: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"koobiq-components-textarea.mjs","sources":["../../../packages/components/textarea/textarea.component.ts","../../../packages/components/textarea/textarea.module.ts","../../../packages/components/textarea/koobiq-components-textarea.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Directive,\n DoCheck,\n ElementRef,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n Optional,\n Self,\n InjectionToken,\n NgZone,\n OnInit,\n EventEmitter\n} from '@angular/core';\nimport {\n FormGroupDirective,\n NgControl,\n NgForm\n} from '@angular/forms';\nimport {\n CanUpdateErrorState,\n CanUpdateErrorStateCtor,\n ErrorStateMatcher,\n mixinErrorState\n} from '@koobiq/components/core';\nimport { KbqFormFieldControl } from '@koobiq/components/form-field';\nimport { Subscription, Subject } from 'rxjs';\n\n\nexport const KBQ_TEXTAREA_VALUE_ACCESSOR = new InjectionToken<{ value: any }>('KBQ_TEXTAREA_VALUE_ACCESSOR');\n\nlet nextUniqueId = 0;\n\n\n/** @docs-private */\nexport class KbqTextareaBase {\n /**\n * Emits whenever the component state changes and should cause the parent\n * form-field to update. Implemented as part of `KbqFormFieldControl`.\n * @docs-private\n */\n readonly stateChanges = new Subject<void>();\n\n constructor(\n public defaultErrorStateMatcher: ErrorStateMatcher,\n public parentForm: NgForm,\n public parentFormGroup: FormGroupDirective,\n public ngControl: NgControl\n ) {}\n}\n\n/** @docs-private */\nexport const KbqTextareaMixinBase: CanUpdateErrorStateCtor & typeof KbqTextareaBase = mixinErrorState(KbqTextareaBase);\n\n@Directive({\n selector: 'textarea[kbqTextarea]',\n exportAs: 'kbqTextarea',\n host: {\n class: 'kbq-textarea kbq-scrollbar',\n '[class.kbq-textarea-resizable]': '!canGrow',\n\n '[attr.id]': 'id',\n '[attr.placeholder]': 'placeholder',\n '[attr.aria-invalid]': 'errorState',\n '[attr.disabled]': 'disabled || null',\n '[attr.required]': 'required',\n\n '(blur)': 'onBlur()',\n '(focus)': 'focusChanged(true)'\n },\n providers: [{ provide: KbqFormFieldControl, useExisting: KbqTextarea }]\n})\nexport class KbqTextarea extends KbqTextareaMixinBase implements KbqFormFieldControl<any>, OnInit, OnChanges,\n OnDestroy, DoCheck, CanUpdateErrorState {\n\n @Input() canGrow: boolean = true;\n\n /** An object used to control when error messages are shown. */\n @Input() errorStateMatcher: ErrorStateMatcher;\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n focused: boolean = false;\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n controlType: string = 'textarea';\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n\n return this._disabled;\n }\n\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get id(): string {\n return this._id;\n }\n\n set id(value: string) {\n this._id = value || this.uid;\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input() placeholder: string;\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get required(): boolean {\n return this._required;\n }\n\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get value(): string {\n return this.valueAccessor.value;\n }\n\n set value(value: string) {\n if (value !== this.value) {\n this.valueAccessor.value = value;\n this.stateChanges.next();\n }\n }\n\n protected uid = `kbq-textarea-${nextUniqueId++}`;\n protected previousNativeValue: any;\n private _disabled = false;\n private _id: string;\n private _required = false;\n\n private valueAccessor: { value: any };\n private growSubscription: Subscription;\n\n private lineHeight: number = 0;\n private freeRowsHeight: number = 0;\n private minHeight: number = 0;\n\n constructor(\n protected elementRef: ElementRef,\n @Optional() @Self() ngControl: NgControl,\n @Optional() parentForm: NgForm,\n @Optional() parentFormGroup: FormGroupDirective,\n defaultErrorStateMatcher: ErrorStateMatcher,\n @Optional() @Self() @Inject(KBQ_TEXTAREA_VALUE_ACCESSOR) inputValueAccessor: any,\n private ngZone: NgZone\n ) {\n super(defaultErrorStateMatcher, parentForm, parentFormGroup, ngControl);\n // If no input value accessor was explicitly specified, use the element as the textarea value\n // accessor.\n this.valueAccessor = inputValueAccessor || this.elementRef.nativeElement;\n\n this.previousNativeValue = this.value;\n\n // Force setter to be called in case id was not specified.\n this.id = this.id;\n\n this.growSubscription = this.stateChanges.subscribe(() => this.grow());\n }\n\n ngOnInit() {\n setTimeout(() => this.grow(), 0);\n this.lineHeight = parseInt(getComputedStyle(this.elementRef.nativeElement).lineHeight!, 10);\n\n const paddingTop = parseInt(getComputedStyle(this.elementRef.nativeElement).paddingTop!, 10);\n const paddingBottom = parseInt(getComputedStyle(this.elementRef.nativeElement).paddingBottom!, 10);\n\n // tslint:disable-next-line:no-magic-numbers\n this.minHeight = this.lineHeight * 2 + paddingTop + paddingBottom;\n this.freeRowsHeight = this.lineHeight;\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this.growSubscription.unsubscribe();\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n // We need to re-evaluate this on every change detection cycle, because there are some\n // error triggers that we can't subscribe to (e.g. parent form submissions). This means\n // that whatever logic is in here has to be super lean or we risk destroying the performance.\n this.updateErrorState();\n }\n\n // We need to dirty-check the native element's value, because there are some cases where\n // we won't be notified when it changes (e.g. the consumer isn't using forms or they're\n // updating the value using `emitEvent: false`).\n this.dirtyCheckNativeValue();\n }\n\n onBlur(): void {\n this.focusChanged(false);\n\n if (this.ngControl?.control) {\n const control = this.ngControl.control;\n\n control.updateValueAndValidity({ emitEvent: false });\n (control.statusChanges as EventEmitter<string>).emit(control.status);\n }\n }\n\n /** Grow textarea height to avoid vertical scroll */\n grow() {\n if (!this.canGrow) { return; }\n\n this.ngZone.runOutsideAngular(() => {\n const textarea = this.elementRef.nativeElement;\n\n const outerHeight = parseInt(window.getComputedStyle(textarea).height!, 10);\n const diff = outerHeight - textarea.clientHeight;\n\n textarea.style.minHeight = 0; // this line is important to height recalculation\n\n const height = Math.max(this.minHeight, +textarea.scrollHeight + diff + this.freeRowsHeight);\n textarea.style.minHeight = `${height}px`;\n });\n }\n\n /** Focuses the textarea. */\n focus(): void {\n this.elementRef.nativeElement.focus();\n }\n\n /** Callback for the cases where the focused state of the textarea changes. */\n focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n get empty(): boolean {\n return !this.elementRef.nativeElement.value && !this.isBadInput();\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n onContainerClick() {\n this.focus();\n }\n\n /** Does some manual dirty checking on the native textarea `value` property. */\n protected dirtyCheckNativeValue() {\n const newValue = this.value;\n\n if (this.previousNativeValue !== newValue) {\n this.previousNativeValue = newValue;\n this.stateChanges.next();\n }\n }\n\n /** Checks whether the textarea is invalid based on the native validation. */\n protected isBadInput(): boolean {\n // The `validity` property won't be present on platform-server.\n const validity = (this.elementRef.nativeElement as HTMLTextAreaElement).validity;\n\n return validity && validity.badInput;\n }\n\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { KbqCommonModule } from '@koobiq/components/core';\n\nimport { KbqTextarea } from './textarea.component';\n\n\n@NgModule({\n imports: [CommonModule, A11yModule, KbqCommonModule, FormsModule],\n exports: [KbqTextarea],\n declarations: [KbqTextarea]\n})\nexport class KbqTextareaModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA+Ba,2BAA2B,GAAG,IAAI,cAAc,CAAiB,6BAA6B,EAAE;AAE7G,IAAI,YAAY,GAAG,CAAC,CAAC;AAGrB;MACa,eAAe,CAAA;AA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CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,CAAC;oBACjE,OAAO,EAAE,CAAC,WAAW,CAAC;oBACtB,YAAY,EAAE,CAAC,WAAW,CAAC;AAC9B,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"koobiq-components-textarea.mjs","sources":["../../../packages/components/textarea/textarea.component.ts","../../../packages/components/textarea/textarea.module.ts","../../../packages/components/textarea/koobiq-components-textarea.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Directive,\n DoCheck,\n ElementRef,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n Optional,\n Self,\n InjectionToken,\n NgZone,\n OnInit,\n EventEmitter,\n Host\n} from '@angular/core';\nimport {\n FormGroupDirective,\n NgControl,\n NgForm\n} from '@angular/forms';\nimport {\n CanUpdateErrorState,\n CanUpdateErrorStateCtor,\n ErrorStateMatcher,\n KBQ_PARENT_ANIMATION_COMPONENT,\n mixinErrorState\n} from '@koobiq/components/core';\nimport { KbqFormFieldControl } from '@koobiq/components/form-field';\nimport { Subscription, Subject } from 'rxjs';\n\n\nexport const KBQ_TEXTAREA_VALUE_ACCESSOR = new InjectionToken<{ value: any }>('KBQ_TEXTAREA_VALUE_ACCESSOR');\n\nlet nextUniqueId = 0;\n\n\n/** @docs-private */\nexport class KbqTextareaBase {\n /**\n * Emits whenever the component state changes and should cause the parent\n * form-field to update. Implemented as part of `KbqFormFieldControl`.\n * @docs-private\n */\n readonly stateChanges = new Subject<void>();\n\n constructor(\n public defaultErrorStateMatcher: ErrorStateMatcher,\n public parentForm: NgForm,\n public parentFormGroup: FormGroupDirective,\n public ngControl: NgControl\n ) {}\n}\n\n/** @docs-private */\nexport const KbqTextareaMixinBase: CanUpdateErrorStateCtor & typeof KbqTextareaBase = mixinErrorState(KbqTextareaBase);\n\n@Directive({\n selector: 'textarea[kbqTextarea]',\n exportAs: 'kbqTextarea',\n host: {\n class: 'kbq-textarea kbq-scrollbar',\n '[class.kbq-textarea-resizable]': '!canGrow',\n\n '[attr.id]': 'id',\n '[attr.placeholder]': 'placeholder',\n '[attr.aria-invalid]': 'errorState',\n '[attr.disabled]': 'disabled || null',\n '[attr.required]': 'required',\n\n '(blur)': 'onBlur()',\n '(focus)': 'focusChanged(true)'\n },\n providers: [{ provide: KbqFormFieldControl, useExisting: KbqTextarea }]\n})\nexport class KbqTextarea extends KbqTextareaMixinBase implements KbqFormFieldControl<any>, OnInit, OnChanges,\n OnDestroy, DoCheck, CanUpdateErrorState {\n\n @Input() canGrow: boolean = true;\n\n /** An object used to control when error messages are shown. */\n @Input() errorStateMatcher: ErrorStateMatcher;\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n focused: boolean = false;\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n controlType: string = 'textarea';\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get disabled(): boolean {\n if (this.ngControl && this.ngControl.disabled !== null) {\n return this.ngControl.disabled;\n }\n\n return this._disabled;\n }\n\n set disabled(value: boolean) {\n this._disabled = coerceBooleanProperty(value);\n\n if (this.focused) {\n this.focused = false;\n this.stateChanges.next();\n }\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get id(): string {\n return this._id;\n }\n\n set id(value: string) {\n this._id = value || this.uid;\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input() placeholder: string;\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get required(): boolean {\n return this._required;\n }\n\n set required(value: boolean) {\n this._required = coerceBooleanProperty(value);\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n @Input()\n get value(): string {\n return this.valueAccessor.value;\n }\n\n set value(value: string) {\n if (value !== this.value) {\n this.valueAccessor.value = value;\n this.stateChanges.next();\n }\n }\n\n protected uid = `kbq-textarea-${nextUniqueId++}`;\n protected previousNativeValue: any;\n private _disabled = false;\n private _id: string;\n private _required = false;\n\n private valueAccessor: { value: any };\n private growSubscription: Subscription;\n\n private lineHeight: number = 0;\n private freeRowsHeight: number = 0;\n private minHeight: number = 0;\n\n constructor(\n protected elementRef: ElementRef,\n @Optional() @Self() ngControl: NgControl,\n @Optional() parentForm: NgForm,\n @Optional() parentFormGroup: FormGroupDirective,\n defaultErrorStateMatcher: ErrorStateMatcher,\n @Optional() @Self() @Inject(KBQ_TEXTAREA_VALUE_ACCESSOR) inputValueAccessor: any,\n @Optional() @Host() @Inject(KBQ_PARENT_ANIMATION_COMPONENT) private parent: any,\n private ngZone: NgZone\n ) {\n super(defaultErrorStateMatcher, parentForm, parentFormGroup, ngControl);\n // If no input value accessor was explicitly specified, use the element as the textarea value\n // accessor.\n this.valueAccessor = inputValueAccessor || this.elementRef.nativeElement;\n\n this.previousNativeValue = this.value;\n\n // Force setter to be called in case id was not specified.\n this.id = this.id;\n\n this.parent?.animationDone\n .subscribe(() => this.ngOnInit());\n\n this.growSubscription = this.stateChanges\n .subscribe(this.grow);\n }\n\n ngOnInit() {\n this.lineHeight = parseInt(getComputedStyle(this.elementRef.nativeElement).lineHeight!, 10);\n\n const paddingTop = parseInt(getComputedStyle(this.elementRef.nativeElement).paddingTop!, 10);\n const paddingBottom = parseInt(getComputedStyle(this.elementRef.nativeElement).paddingBottom!, 10);\n\n // tslint:disable-next-line:no-magic-numbers\n this.minHeight = this.lineHeight * 2 + paddingTop + paddingBottom;\n this.freeRowsHeight = this.lineHeight;\n\n setTimeout(this.grow, 0);\n }\n\n ngOnChanges() {\n this.stateChanges.next();\n }\n\n ngOnDestroy() {\n this.stateChanges.complete();\n this.growSubscription.unsubscribe();\n }\n\n ngDoCheck() {\n if (this.ngControl) {\n // We need to re-evaluate this on every change detection cycle, because there are some\n // error triggers that we can't subscribe to (e.g. parent form submissions). This means\n // that whatever logic is in here has to be super lean or we risk destroying the performance.\n this.updateErrorState();\n }\n\n // We need to dirty-check the native element's value, because there are some cases where\n // we won't be notified when it changes (e.g. the consumer isn't using forms or they're\n // updating the value using `emitEvent: false`).\n this.dirtyCheckNativeValue();\n }\n\n onBlur(): void {\n this.focusChanged(false);\n\n if (this.ngControl?.control) {\n const control = this.ngControl.control;\n\n control.updateValueAndValidity({ emitEvent: false });\n (control.statusChanges as EventEmitter<string>).emit(control.status);\n }\n }\n\n /** Grow textarea height to avoid vertical scroll */\n grow = () => {\n if (!this.canGrow) { return; }\n\n this.ngZone.runOutsideAngular(() => {\n const textarea = this.elementRef.nativeElement;\n\n const outerHeight = parseInt(window.getComputedStyle(textarea).height!, 10);\n const diff = outerHeight - textarea.clientHeight;\n\n textarea.style.minHeight = 0; // this line is important to height recalculation\n\n const height = Math.max(this.minHeight, +textarea.scrollHeight + diff + this.freeRowsHeight);\n textarea.style.minHeight = `${height}px`;\n });\n }\n\n /** Focuses the textarea. */\n focus(): void {\n this.elementRef.nativeElement.focus();\n }\n\n /** Callback for the cases where the focused state of the textarea changes. */\n focusChanged(isFocused: boolean) {\n if (isFocused !== this.focused) {\n this.focused = isFocused;\n this.stateChanges.next();\n }\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n get empty(): boolean {\n return !this.elementRef.nativeElement.value && !this.isBadInput();\n }\n\n /**\n * Implemented as part of KbqFormFieldControl.\n * @docs-private\n */\n onContainerClick() {\n this.focus();\n }\n\n /** Does some manual dirty checking on the native textarea `value` property. */\n protected dirtyCheckNativeValue() {\n const newValue = this.value;\n\n if (this.previousNativeValue !== newValue) {\n this.previousNativeValue = newValue;\n this.stateChanges.next();\n }\n }\n\n /** Checks whether the textarea is invalid based on the native validation. */\n protected isBadInput(): boolean {\n // The `validity` property won't be present on platform-server.\n const validity = (this.elementRef.nativeElement as HTMLTextAreaElement).validity;\n\n return validity && validity.badInput;\n }\n\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { KbqCommonModule } from '@koobiq/components/core';\n\nimport { KbqTextarea } from './textarea.component';\n\n\n@NgModule({\n imports: [CommonModule, A11yModule, KbqCommonModule, FormsModule],\n exports: [KbqTextarea],\n declarations: [KbqTextarea]\n})\nexport class KbqTextareaModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MAiCa,2BAA2B,GAAG,IAAI,cAAc,CAAiB,6BAA6B,EAAE;AAE7G,IAAI,YAAY,GAAG,CAAC,CAAC;AAGrB;MACa,eAAe,CAAA;AAQxB,IAAA,WAAA,CACW,wBAA2C,EAC3C,UAAkB,EAClB,eAAmC,EACnC,SAAoB,EAAA;QAHpB,IAAwB,CAAA,wBAAA,GAAxB,wBAAwB,CAAmB;QAC3C,IAAU,CAAA,UAAA,GAAV,UAAU,CAAQ;QAClB,IAAe,CAAA,eAAA,GAAf,eAAe,CAAoB;QACnC,IAAS,CAAA,SAAA,GAAT,SAAS,CAAW;AAX/B;;;;AAIG;AACM,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAQ,CAAC;KAOxC;AACP,CAAA;AAED;MACa,oBAAoB,GAAqD,eAAe,CAAC,eAAe,EAAE;AAoBjH,MAAO,WAAY,SAAQ,oBAAoB,CAAA;AA0BjD;;;AAGG;AACH,IAAA,IACI,QAAQ,GAAA;QACR,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,EAAE;AACpD,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;AAClC,SAAA;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;KACzB;IAED,IAAI,QAAQ,CAAC,KAAc,EAAA;AACvB,QAAA,IAA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;ACbD;;AAEG;;;;"}
|
|
@@ -357,7 +357,7 @@ class KbqTreeNodeToggleBaseDirective extends KbqTreeNodeToggleMixinBase {
|
|
|
357
357
|
this.treeNode = treeNode;
|
|
358
358
|
this._recursive = false;
|
|
359
359
|
this.tree.treeControl.filterValue
|
|
360
|
-
.subscribe((value) => this.disabled = !!value);
|
|
360
|
+
.subscribe((value) => this.disabled = !!value?.length);
|
|
361
361
|
}
|
|
362
362
|
toggle(event) {
|
|
363
363
|
if (this.disabled) {
|
|
@@ -634,6 +634,9 @@ class KbqTreeOption extends KbqTreeNode {
|
|
|
634
634
|
}
|
|
635
635
|
markForCheck() {
|
|
636
636
|
this.changeDetectorRef.markForCheck();
|
|
637
|
+
if (this.showCheckbox) {
|
|
638
|
+
this.updateCheckboxState();
|
|
639
|
+
}
|
|
637
640
|
}
|
|
638
641
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: KbqTreeOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: KBQ_TREE_OPTION_PARENT_COMPONENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
639
642
|
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: KbqTreeOption, selector: "kbq-tree-option", inputs: { checkboxThirdState: "checkboxThirdState", disabled: "disabled", showCheckbox: "showCheckbox" }, outputs: { onSelectionChange: "onSelectionChange" }, host: { listeners: { "focusin": "focus()", "blur": "blur()", "click": "selectViaInteraction($event)", "keydown": "onKeydown($event)" }, properties: { "class.kbq-selected": "selected", "class.kbq-focused": "hasFocus", "class.kbq-disabled": "disabled", "class.kbq-action-button-focused": "actionButton?.active", "attr.id": "id", "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "kbq-tree-option" }, providers: [
|
|
@@ -819,21 +822,21 @@ class BaseTreeControl {
|
|
|
819
822
|
}
|
|
820
823
|
/** Toggles one single data node's expanded/collapsed state. */
|
|
821
824
|
toggle(dataNode) {
|
|
822
|
-
if (this.filterValue.value) {
|
|
825
|
+
if (this.filterValue.value?.length) {
|
|
823
826
|
return;
|
|
824
827
|
}
|
|
825
828
|
this.expansionModel.toggle(dataNode);
|
|
826
829
|
}
|
|
827
830
|
/** Expands one single data node. */
|
|
828
831
|
expand(dataNode) {
|
|
829
|
-
if (this.filterValue.value) {
|
|
832
|
+
if (this.filterValue.value?.length) {
|
|
830
833
|
return;
|
|
831
834
|
}
|
|
832
835
|
this.expansionModel.select(dataNode);
|
|
833
836
|
}
|
|
834
837
|
/** Collapses one single data node. */
|
|
835
838
|
collapse(dataNode) {
|
|
836
|
-
if (this.filterValue.value) {
|
|
839
|
+
if (this.filterValue.value?.length) {
|
|
837
840
|
return;
|
|
838
841
|
}
|
|
839
842
|
this.expansionModel.deselect(dataNode);
|
|
@@ -871,8 +874,9 @@ class FilterByViewValue {
|
|
|
871
874
|
this.control = control;
|
|
872
875
|
}
|
|
873
876
|
handle(value) {
|
|
877
|
+
const viewValue = value || null;
|
|
874
878
|
this.result = this.control.dataNodes
|
|
875
|
-
.filter((node) => this.control.compareViewValues(this.control.getViewValue(node),
|
|
879
|
+
.filter((node) => this.control.compareViewValues(this.control.getViewValue(node), viewValue));
|
|
876
880
|
return this.result;
|
|
877
881
|
}
|
|
878
882
|
}
|
|
@@ -1001,7 +1005,7 @@ class FlatTreeControl extends BaseTreeControl {
|
|
|
1001
1005
|
this.filterModel.select(...result);
|
|
1002
1006
|
// set current expansion state according to filtered tree
|
|
1003
1007
|
this.expansionModel.setSelection(...result.filter((node) => this.isExpandable(node)));
|
|
1004
|
-
this.updateFilterValue(value);
|
|
1008
|
+
this.updateFilterValue(value || result);
|
|
1005
1009
|
Promise.resolve()
|
|
1006
1010
|
.then(() => this.restoreExpansionState());
|
|
1007
1011
|
}
|
|
@@ -1010,12 +1014,12 @@ class FlatTreeControl extends BaseTreeControl {
|
|
|
1010
1014
|
.then(() => this.filterValue.next(value));
|
|
1011
1015
|
}
|
|
1012
1016
|
saveExpansionState() {
|
|
1013
|
-
if (!this.filterValue.value) {
|
|
1017
|
+
if (!this.filterValue.value?.length) {
|
|
1014
1018
|
this.expandedItemsBeforeFiltration = this.expansionModel.selected;
|
|
1015
1019
|
}
|
|
1016
1020
|
}
|
|
1017
1021
|
restoreExpansionState() {
|
|
1018
|
-
if (!this.filterValue.value) {
|
|
1022
|
+
if (!this.filterValue.value?.length) {
|
|
1019
1023
|
this.expansionModel.setSelection(...this.expandedItemsBeforeFiltration);
|
|
1020
1024
|
}
|
|
1021
1025
|
}
|