@ptsecurity/mosaic 16.3.0 → 16.4.0
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/_theming.scss +3 -3
- package/checkbox/_checkbox-theme.scss +1 -1
- 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/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/core/version.mjs +2 -2
- package/esm2022/form-field/form-field.mjs +7 -1
- package/esm2022/icon/icon.component.mjs +9 -1
- package/esm2022/loader-overlay/loader-overlay.component.mjs +2 -2
- package/esm2022/navbar/navbar-item.component.mjs +15 -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 +17 -6
- 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/ptsecurity-mosaic-core.mjs +15 -6
- package/fesm2022/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-form-field.mjs +6 -0
- package/fesm2022/ptsecurity-mosaic-form-field.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-icon.mjs +8 -0
- package/fesm2022/ptsecurity-mosaic-icon.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-loader-overlay.mjs +2 -2
- package/fesm2022/ptsecurity-mosaic-loader-overlay.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-navbar.mjs +33 -16
- package/fesm2022/ptsecurity-mosaic-navbar.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-popover.mjs +5 -0
- package/fesm2022/ptsecurity-mosaic-popover.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-tabs.mjs +3 -3
- package/fesm2022/ptsecurity-mosaic-tabs.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-textarea.mjs +16 -5
- package/fesm2022/ptsecurity-mosaic-textarea.mjs.map +1 -1
- package/fesm2022/ptsecurity-mosaic-tree.mjs +12 -8
- package/fesm2022/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/form-field/form-field.d.ts +2 -0
- package/icon/icon.component.d.ts +2 -0
- package/navbar/_navbar-theme.scss +2 -2
- package/navbar/navbar-item.component.d.ts +4 -1
- package/navbar/navbar-item.scss +7 -3
- package/navbar/navbar.component.d.ts +3 -0
- package/package.json +11 -11
- package/popover/popover.component.d.ts +5 -0
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/default-theme.css +1 -1
- package/textarea/textarea.component.d.ts +3 -2
- 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 '@ptsecurity/mosaic/core';
|
7
|
-
import { mixinErrorState, McCommonModule } from '@ptsecurity/mosaic/core';
|
7
|
+
import { mixinErrorState, MC_PARENT_ANIMATION_COMPONENT, McCommonModule } from '@ptsecurity/mosaic/core';
|
8
8
|
import { McFormFieldControl } from '@ptsecurity/mosaic/form-field';
|
9
9
|
import { Subject } from 'rxjs';
|
10
10
|
import { A11yModule } from '@angular/cdk/a11y';
|
@@ -80,9 +80,10 @@ class McTextarea extends McTextareaMixinBase {
|
|
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
|
/**
|
@@ -112,7 +113,10 @@ class McTextarea extends McTextareaMixinBase {
|
|
112
113
|
this.previousNativeValue = this.value;
|
113
114
|
// Force setter to be called in case id was not specified.
|
114
115
|
this.id = this.id;
|
115
|
-
this.
|
116
|
+
this.parent?.animationDone
|
117
|
+
.subscribe(() => this.ngOnInit());
|
118
|
+
this.growSubscription = this.stateChanges
|
119
|
+
.subscribe(() => this.grow());
|
116
120
|
}
|
117
121
|
ngOnInit() {
|
118
122
|
setTimeout(() => this.grow(), 0);
|
@@ -203,7 +207,7 @@ class McTextarea extends McTextareaMixinBase {
|
|
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: McTextarea, 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: MC_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: McTextarea, 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: MC_TEXTAREA_VALUE_ACCESSOR, optional: true, self: true }, { token: MC_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: McTextarea, selector: "textarea[mcTextarea]", inputs: { canGrow: "canGrow", errorStateMatcher: "errorStateMatcher", disabled: "disabled", id: "id", placeholder: "placeholder", required: "required", value: "value" }, host: { listeners: { "blur": "onBlur()", "focus": "focusChanged(true)" }, properties: { "class.mc-textarea-resizable": "!canGrow", "attr.id": "id", "attr.placeholder": "placeholder", "attr.aria-invalid": "errorState", "attr.disabled": "disabled || null", "attr.required": "required" }, classAttribute: "mc-textarea" }, providers: [{ provide: McFormFieldControl, useExisting: McTextarea }], exportAs: ["mcTextarea"], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
|
208
212
|
}
|
209
213
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: McTextarea, 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: [MC_TEXTAREA_VALUE_ACCESSOR]
|
246
|
+
}] }, { type: undefined, decorators: [{
|
247
|
+
type: Optional
|
248
|
+
}, {
|
249
|
+
type: Host
|
250
|
+
}, {
|
251
|
+
type: Inject,
|
252
|
+
args: [MC_PARENT_ANIMATION_COMPONENT]
|
242
253
|
}] }, { type: i0.NgZone }]; }, propDecorators: { canGrow: [{
|
243
254
|
type: Input
|
244
255
|
}], errorStateMatcher: [{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ptsecurity-mosaic-textarea.mjs","sources":["../../../packages/mosaic/textarea/textarea.component.ts","../../../packages/mosaic/textarea/textarea.module.ts","../../../packages/mosaic/textarea/ptsecurity-mosaic-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 '@ptsecurity/mosaic/core';\nimport { McFormFieldControl } from '@ptsecurity/mosaic/form-field';\nimport { Subscription, Subject } from 'rxjs';\n\n\nexport const MC_TEXTAREA_VALUE_ACCESSOR = new InjectionToken<{ value: any }>('MC_TEXTAREA_VALUE_ACCESSOR');\n\nlet nextUniqueId = 0;\n\n\n/** @docs-private */\nexport class McTextareaBase {\n /**\n * Emits whenever the component state changes and should cause the parent\n * form-field to update. Implemented as part of `McFormFieldControl`.\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 McTextareaMixinBase: CanUpdateErrorStateCtor & typeof McTextareaBase = mixinErrorState(McTextareaBase);\n\n@Directive({\n selector: 'textarea[mcTextarea]',\n exportAs: 'mcTextarea',\n host: {\n class: 'mc-textarea',\n '[class.mc-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: McFormFieldControl, useExisting: McTextarea }]\n})\nexport class McTextarea extends McTextareaMixinBase implements McFormFieldControl<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 McFormFieldControl.\n * @docs-private\n */\n focused: boolean = false;\n\n /**\n * Implemented as part of McFormFieldControl.\n * @docs-private\n */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /**\n * Implemented as part of McFormFieldControl.\n * @docs-private\n */\n controlType: string = 'textarea';\n\n /**\n * Implemented as part of McFormFieldControl.\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 McFormFieldControl.\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 McFormFieldControl.\n * @docs-private\n */\n @Input() placeholder: string;\n\n /**\n * Implemented as part of McFormFieldControl.\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 McFormFieldControl.\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 = `mc-textsrea-${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(MC_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 McFormFieldControl.\n * @docs-private\n */\n get empty(): boolean {\n return !this.elementRef.nativeElement.value && !this.isBadInput();\n }\n\n /**\n * Implemented as part of McFormFieldControl.\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 { McCommonModule } from '@ptsecurity/mosaic/core';\n\nimport { McTextarea } from './textarea.component';\n\n\n@NgModule({\n imports: [CommonModule, A11yModule, McCommonModule, FormsModule],\n exports: [McTextarea],\n declarations: [McTextarea]\n})\nexport class McTextareaModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA+Ba,0BAA0B,GAAG,IAAI,cAAc,CAAiB,4BAA4B,EAAE;AAE3G,IAAI,YAAY,GAAG,CAAC,CAAC;AAGrB;MACa,cAAc,CAAA;AAQvB,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,mBAAmB,GAAoD,eAAe,CAAC,cAAc,EAAE;AAoB9G,MAAO,UAAW,SAAQ,mBAAmB,CAAA;AA0B/C;;;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,IAAI,CAAC,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAE9C,IAAI,IAAI,CAAC,OAAO,EAAE;AACd,YAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;AACrB,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;AAC5B,SAAA;KACJ;AAED;;;AAGG;AACH,IAAA,IACI,EAAE,GAAA;QACF,OAAO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AA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAJf,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAItD,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,CAAC;oBAChE,OAAO,EAAE,CAAC,UAAU,CAAC;oBACrB,YAAY,EAAE,CAAC,UAAU,CAAC;AAC7B,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"ptsecurity-mosaic-textarea.mjs","sources":["../../../packages/mosaic/textarea/textarea.component.ts","../../../packages/mosaic/textarea/textarea.module.ts","../../../packages/mosaic/textarea/ptsecurity-mosaic-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, MC_PARENT_ANIMATION_COMPONENT,\n mixinErrorState\n} from '@ptsecurity/mosaic/core';\nimport { McFormFieldControl } from '@ptsecurity/mosaic/form-field';\nimport { Subscription, Subject } from 'rxjs';\n\n\nexport const MC_TEXTAREA_VALUE_ACCESSOR = new InjectionToken<{ value: any }>('MC_TEXTAREA_VALUE_ACCESSOR');\n\nlet nextUniqueId = 0;\n\n\n/** @docs-private */\nexport class McTextareaBase {\n /**\n * Emits whenever the component state changes and should cause the parent\n * form-field to update. Implemented as part of `McFormFieldControl`.\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 McTextareaMixinBase: CanUpdateErrorStateCtor & typeof McTextareaBase = mixinErrorState(McTextareaBase);\n\n@Directive({\n selector: 'textarea[mcTextarea]',\n exportAs: 'mcTextarea',\n host: {\n class: 'mc-textarea',\n '[class.mc-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: McFormFieldControl, useExisting: McTextarea }]\n})\nexport class McTextarea extends McTextareaMixinBase implements McFormFieldControl<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 McFormFieldControl.\n * @docs-private\n */\n focused: boolean = false;\n\n /**\n * Implemented as part of McFormFieldControl.\n * @docs-private\n */\n readonly stateChanges: Subject<void> = new Subject<void>();\n\n /**\n * Implemented as part of McFormFieldControl.\n * @docs-private\n */\n controlType: string = 'textarea';\n\n /**\n * Implemented as part of McFormFieldControl.\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 McFormFieldControl.\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 McFormFieldControl.\n * @docs-private\n */\n @Input() placeholder: string;\n\n /**\n * Implemented as part of McFormFieldControl.\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 McFormFieldControl.\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 = `mc-textsrea-${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(MC_TEXTAREA_VALUE_ACCESSOR) inputValueAccessor: any,\n @Optional() @Host() @Inject(MC_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 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 McFormFieldControl.\n * @docs-private\n */\n get empty(): boolean {\n return !this.elementRef.nativeElement.value && !this.isBadInput();\n }\n\n /**\n * Implemented as part of McFormFieldControl.\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 { McCommonModule } from '@ptsecurity/mosaic/core';\n\nimport { McTextarea } from './textarea.component';\n\n\n@NgModule({\n imports: [CommonModule, A11yModule, McCommonModule, FormsModule],\n exports: [McTextarea],\n declarations: [McTextarea]\n})\nexport class McTextareaModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MAgCa,0BAA0B,GAAG,IAAI,cAAc,CAAiB,4BAA4B,EAAE;AAE3G,IAAI,YAAY,GAAG,CAAC,CAAC;AAGrB;MACa,cAAc,CAAA;AAQvB,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,mBAAmB,GAAoD,eAAe,CAAC,cAAc,EAAE;AAoB9G,MAAO,UAAW,SAAQ,mBAAmB,CAAA;AA0B/C;;;AAGG;AACH,IAAA,IACI,QAAQ,GAAA;QACR,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,KAAK,IA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AAE,cAAc,EAAE,WAAW,CAAC;oBAChE,OAAO,EAAE,CAAC,UAAU,CAAC;oBACrB,YAAY,EAAE,CAAC,UAAU,CAAC;AAC7B,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
|
@@ -355,7 +355,7 @@ class McTreeNodeToggleBaseDirective extends McTreeNodeToggleMixinBase {
|
|
355
355
|
this.treeNode = treeNode;
|
356
356
|
this._recursive = false;
|
357
357
|
this.tree.treeControl.filterValue
|
358
|
-
.subscribe((value) => this.disabled = !!value);
|
358
|
+
.subscribe((value) => this.disabled = !!value?.length);
|
359
359
|
}
|
360
360
|
toggle(event) {
|
361
361
|
if (this.disabled) {
|
@@ -632,6 +632,9 @@ class McTreeOption extends McTreeNode {
|
|
632
632
|
}
|
633
633
|
markForCheck() {
|
634
634
|
this.changeDetectorRef.markForCheck();
|
635
|
+
if (this.showCheckbox) {
|
636
|
+
this.updateCheckboxState();
|
637
|
+
}
|
635
638
|
}
|
636
639
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.5", ngImport: i0, type: McTreeOption, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: MC_TREE_OPTION_PARENT_COMPONENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
637
640
|
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.5", type: McTreeOption, selector: "mc-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.mc-selected": "selected", "class.mc-focused": "hasFocus", "class.mc-action-button-focused": "actionButton?.active", "attr.id": "id", "attr.tabindex": "-1", "attr.disabled": "disabled || null" }, classAttribute: "mc-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
|
}
|
@@ -995,7 +999,7 @@ class FlatTreeControl extends BaseTreeControl {
|
|
995
999
|
this.filterModel.select(...result);
|
996
1000
|
// set current expansion state according to filtered tree
|
997
1001
|
this.expansionModel.setSelection(...result.filter((node) => this.isExpandable(node)));
|
998
|
-
this.updateFilterValue(value);
|
1002
|
+
this.updateFilterValue(value || result);
|
999
1003
|
Promise.resolve()
|
1000
1004
|
.then(() => this.restoreExpansionState());
|
1001
1005
|
}
|
@@ -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
|
}
|