i-tech-shared-components 1.4.100 → 1.4.101-alpha.1794393046784
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/fesm2022/i-tech-shared-components.mjs +343 -4
- package/fesm2022/i-tech-shared-components.mjs.map +1 -1
- package/lib/components/inline-edit/inline-edit.component.d.ts +93 -0
- package/lib/components/inline-edit/inline-edit.directives.d.ts +34 -0
- package/lib/interfaces/inline-edit.interface.d.ts +31 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, inject, Injectable, HostListener, Input, Directive, EventEmitter, Output, Component, ViewChild, InjectionToken, Optional, Inject, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { Pipe, inject, Injectable, HostListener, Input, Directive, EventEmitter, Output, Component, ViewChild, InjectionToken, Optional, Inject, ViewEncapsulation, ContentChild, ChangeDetectionStrategy } from '@angular/core';
|
|
3
3
|
import * as i1 from '@ngx-translate/core';
|
|
4
4
|
import { TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
5
5
|
import * as i3 from '@angular/forms';
|
|
@@ -8,7 +8,7 @@ import moment from 'moment';
|
|
|
8
8
|
import * as momentTimezone from 'moment-timezone';
|
|
9
9
|
import { MatIconButton, MatFabButton, MatButton, MatButtonModule } from '@angular/material/button';
|
|
10
10
|
import * as i2$1 from '@angular/common';
|
|
11
|
-
import { NgClass, NgIf, NgOptimizedImage, NgFor, NgForOf, UpperCasePipe, SlicePipe, LowerCasePipe, CommonModule, DecimalPipe } from '@angular/common';
|
|
11
|
+
import { NgClass, NgIf, NgOptimizedImage, NgFor, NgForOf, UpperCasePipe, SlicePipe, LowerCasePipe, CommonModule, DecimalPipe, DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
12
12
|
import * as i1$2 from '@angular/material/tooltip';
|
|
13
13
|
import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
|
|
14
14
|
import * as i1$1 from '@angular/material/icon';
|
|
@@ -37,7 +37,7 @@ import { HttpParams } from '@angular/common/http';
|
|
|
37
37
|
import * as libphonenumber from 'google-libphonenumber';
|
|
38
38
|
import { PhoneNumberUtil } from 'google-libphonenumber';
|
|
39
39
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
40
|
-
import { of, BehaviorSubject, Subject, combineLatest, debounceTime, distinctUntilChanged, tap, filter, switchMap, takeUntil } from 'rxjs';
|
|
40
|
+
import { of, BehaviorSubject, Subject, combineLatest, debounceTime, distinctUntilChanged, tap, filter, switchMap, takeUntil, merge } from 'rxjs';
|
|
41
41
|
import { map } from 'rxjs/operators';
|
|
42
42
|
|
|
43
43
|
class GenerateErrorMessagesPipe {
|
|
@@ -3582,6 +3582,345 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3582
3582
|
type: Input
|
|
3583
3583
|
}] } });
|
|
3584
3584
|
|
|
3585
|
+
/**
|
|
3586
|
+
* Marks the template rendered while an `<i-tech-inline-edit>` is in edit mode.
|
|
3587
|
+
* Any form control works inside it (text input, autocomplete, date picker, ...).
|
|
3588
|
+
*
|
|
3589
|
+
* ```html
|
|
3590
|
+
* <ng-template iTechInlineEditor let-showErrors="showErrors">
|
|
3591
|
+
* <i-tech-text-input formControlName="weight" [inputData]="{ ..., submit: showErrors }"></i-tech-text-input>
|
|
3592
|
+
* </ng-template>
|
|
3593
|
+
* ```
|
|
3594
|
+
*/
|
|
3595
|
+
class InlineEditorDirective {
|
|
3596
|
+
constructor(templateRef) {
|
|
3597
|
+
this.templateRef = templateRef;
|
|
3598
|
+
}
|
|
3599
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
3600
|
+
return true;
|
|
3601
|
+
}
|
|
3602
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InlineEditorDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3603
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.14", type: InlineEditorDirective, isStandalone: true, selector: "ng-template[iTechInlineEditor]", ngImport: i0 }); }
|
|
3604
|
+
}
|
|
3605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InlineEditorDirective, decorators: [{
|
|
3606
|
+
type: Directive,
|
|
3607
|
+
args: [{
|
|
3608
|
+
selector: 'ng-template[iTechInlineEditor]',
|
|
3609
|
+
standalone: true
|
|
3610
|
+
}]
|
|
3611
|
+
}], ctorParameters: () => [{ type: i0.TemplateRef }] });
|
|
3612
|
+
/**
|
|
3613
|
+
* Optional custom read-mode template. Receives the display value as implicit context.
|
|
3614
|
+
*
|
|
3615
|
+
* ```html
|
|
3616
|
+
* <ng-template iTechInlineDisplay let-value>{{ value }} lbs</ng-template>
|
|
3617
|
+
* ```
|
|
3618
|
+
*/
|
|
3619
|
+
class InlineDisplayDirective {
|
|
3620
|
+
constructor(templateRef) {
|
|
3621
|
+
this.templateRef = templateRef;
|
|
3622
|
+
}
|
|
3623
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
3624
|
+
return true;
|
|
3625
|
+
}
|
|
3626
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InlineDisplayDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3627
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.14", type: InlineDisplayDirective, isStandalone: true, selector: "ng-template[iTechInlineDisplay]", ngImport: i0 }); }
|
|
3628
|
+
}
|
|
3629
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InlineDisplayDirective, decorators: [{
|
|
3630
|
+
type: Directive,
|
|
3631
|
+
args: [{
|
|
3632
|
+
selector: 'ng-template[iTechInlineDisplay]',
|
|
3633
|
+
standalone: true
|
|
3634
|
+
}]
|
|
3635
|
+
}], ctorParameters: () => [{ type: i0.TemplateRef }] });
|
|
3636
|
+
|
|
3637
|
+
/**
|
|
3638
|
+
* Click-to-edit wrapper. Three states:
|
|
3639
|
+
* 1. read - plain text (`displayValue`)
|
|
3640
|
+
* 2. hover - highlighted box + pencil icon, signals that the value is editable
|
|
3641
|
+
* 3. edit - renders the projected `iTechInlineEditor` template (any form control)
|
|
3642
|
+
*
|
|
3643
|
+
* Commits on: click or focus moving outside (overlay panels such as autocomplete/datepicker count as inside),
|
|
3644
|
+
* Enter in an input (Ctrl/Cmd+Enter in a textarea), or a value change when `closeOnChange` is set.
|
|
3645
|
+
* Cancels on Escape: `control` is reverted to the value it had when editing started.
|
|
3646
|
+
* With `blockInvalidCommit`, an invalid control keeps the editor open and flips the editor
|
|
3647
|
+
* context's `showErrors` so the projected input displays its validation message.
|
|
3648
|
+
*
|
|
3649
|
+
* Works for both page-level save (read the form later) and per-field save
|
|
3650
|
+
* (handle `editEnd`, save when `changed`, toggle `loading`, revert to `previousValue` on error).
|
|
3651
|
+
*
|
|
3652
|
+
* ```html
|
|
3653
|
+
* <i-tech-inline-edit [displayValue]="weightLabel" [control]="form.controls.weight" placeholder="weight">
|
|
3654
|
+
* <ng-template iTechInlineEditor let-showErrors="showErrors">
|
|
3655
|
+
* <i-tech-text-input formControlName="weight" [inputData]="{ hideLabel: true, submit: showErrors }"></i-tech-text-input>
|
|
3656
|
+
* </ng-template>
|
|
3657
|
+
* </i-tech-inline-edit>
|
|
3658
|
+
* ```
|
|
3659
|
+
*/
|
|
3660
|
+
class InlineEditComponent {
|
|
3661
|
+
constructor(host, cdr, document) {
|
|
3662
|
+
this.host = host;
|
|
3663
|
+
this.cdr = cdr;
|
|
3664
|
+
this.document = document;
|
|
3665
|
+
/** Text shown in read mode. The parent is responsible for mapping ids to labels. */
|
|
3666
|
+
this.displayValue = null;
|
|
3667
|
+
/** Translation key shown (muted) when there is no value. Falls back to `---`. */
|
|
3668
|
+
this.placeholder = '';
|
|
3669
|
+
this.disabled = false;
|
|
3670
|
+
/** Shows a spinner and blocks editing, e.g. while a per-field save is in flight. */
|
|
3671
|
+
this.loading = false;
|
|
3672
|
+
/**
|
|
3673
|
+
* Control behind the editor. Enables Escape-revert, `closeOnChange`, `blockInvalidCommit`,
|
|
3674
|
+
* the `editEnd` values, invalid styling in read mode and disabled sync.
|
|
3675
|
+
*/
|
|
3676
|
+
this.control = null;
|
|
3677
|
+
/** Commit as soon as the value changes. For single selects / date pickers - not for multi-selects. */
|
|
3678
|
+
this.closeOnChange = false;
|
|
3679
|
+
/**
|
|
3680
|
+
* Keep the editor open while `control` is invalid: commits are refused, the control is marked touched
|
|
3681
|
+
* and `showErrors` becomes true in the editor template context. Escape still cancels.
|
|
3682
|
+
*/
|
|
3683
|
+
this.blockInvalidCommit = false;
|
|
3684
|
+
/**
|
|
3685
|
+
* Focus the editor when edit mode starts: `[cdkFocusInitial]` element if present,
|
|
3686
|
+
* otherwise the first input/textarea, otherwise opens a mat-select.
|
|
3687
|
+
*/
|
|
3688
|
+
this.autoFocus = true;
|
|
3689
|
+
/** Field name for screen readers (translation key), read together with the value. */
|
|
3690
|
+
this.ariaLabel = '';
|
|
3691
|
+
this.testId = '';
|
|
3692
|
+
this.editStart = new EventEmitter();
|
|
3693
|
+
this.editEnd = new EventEmitter();
|
|
3694
|
+
this.editing = false;
|
|
3695
|
+
this.isEmpty = true;
|
|
3696
|
+
this.isDisabled = false;
|
|
3697
|
+
this.isInvalid = false;
|
|
3698
|
+
this.editorContext = { showErrors: false };
|
|
3699
|
+
this.onDocumentMouseDown = (event) => {
|
|
3700
|
+
if (!this.isInside(event.target)) {
|
|
3701
|
+
this.commit();
|
|
3702
|
+
}
|
|
3703
|
+
};
|
|
3704
|
+
}
|
|
3705
|
+
ngOnChanges(changes) {
|
|
3706
|
+
if (changes['displayValue']) {
|
|
3707
|
+
const value = this.displayValue;
|
|
3708
|
+
this.isEmpty = value === null || value === undefined || value === '';
|
|
3709
|
+
}
|
|
3710
|
+
if (changes['control']) {
|
|
3711
|
+
this.subscribeToControl();
|
|
3712
|
+
}
|
|
3713
|
+
this.updateControlState();
|
|
3714
|
+
}
|
|
3715
|
+
ngOnDestroy() {
|
|
3716
|
+
this.controlSub?.unsubscribe();
|
|
3717
|
+
this.valueSub?.unsubscribe();
|
|
3718
|
+
this.document.removeEventListener('mousedown', this.onDocumentMouseDown, true);
|
|
3719
|
+
}
|
|
3720
|
+
startEdit() {
|
|
3721
|
+
if (this.editing || this.isDisabled || !this.editor) {
|
|
3722
|
+
return;
|
|
3723
|
+
}
|
|
3724
|
+
this.editing = true;
|
|
3725
|
+
this.editorContext = { showErrors: false };
|
|
3726
|
+
this.valueOnEditStart = this.control?.value;
|
|
3727
|
+
this.cdr.detectChanges();
|
|
3728
|
+
this.document.addEventListener('mousedown', this.onDocumentMouseDown, true);
|
|
3729
|
+
if (this.closeOnChange && this.control) {
|
|
3730
|
+
this.valueSub = this.control.valueChanges.subscribe({
|
|
3731
|
+
next: () => this.commit()
|
|
3732
|
+
});
|
|
3733
|
+
}
|
|
3734
|
+
this.editStart.emit();
|
|
3735
|
+
if (this.autoFocus) {
|
|
3736
|
+
setTimeout(() => this.focusEditor());
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
/** Returns false when the commit was refused by `blockInvalidCommit`. */
|
|
3740
|
+
commit(restoreFocus = false) {
|
|
3741
|
+
if (this.editing && this.blockInvalidCommit && this.control?.invalid) {
|
|
3742
|
+
this.control.markAsTouched();
|
|
3743
|
+
this.editorContext = { showErrors: true };
|
|
3744
|
+
this.cdr.detectChanges();
|
|
3745
|
+
// Pull focus back if it already left (Tab / click outside); leave it alone if it is still inside
|
|
3746
|
+
setTimeout(() => {
|
|
3747
|
+
if (!this.editorHost?.nativeElement.contains(this.document.activeElement)) {
|
|
3748
|
+
this.focusEditor();
|
|
3749
|
+
}
|
|
3750
|
+
});
|
|
3751
|
+
return false;
|
|
3752
|
+
}
|
|
3753
|
+
this.stopEdit(false, restoreFocus);
|
|
3754
|
+
return true;
|
|
3755
|
+
}
|
|
3756
|
+
cancel(restoreFocus = false) {
|
|
3757
|
+
this.stopEdit(true, restoreFocus);
|
|
3758
|
+
}
|
|
3759
|
+
// Focus moving to an element outside (Tab, clicking another field) commits.
|
|
3760
|
+
// A null relatedTarget (window blur, click on non-focusable area) is left to the mousedown handler.
|
|
3761
|
+
onFocusOut(event) {
|
|
3762
|
+
const next = event.relatedTarget;
|
|
3763
|
+
if (this.editing && next && !this.isInside(next)) {
|
|
3764
|
+
this.commit();
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
onEditorKeydown(event) {
|
|
3768
|
+
const tag = event.target.tagName;
|
|
3769
|
+
if (event.key === 'Escape') {
|
|
3770
|
+
event.stopPropagation();
|
|
3771
|
+
this.cancel(true);
|
|
3772
|
+
}
|
|
3773
|
+
else if (event.key === 'Enter' && (tag === 'INPUT' || (tag === 'TEXTAREA' && (event.ctrlKey || event.metaKey)))) {
|
|
3774
|
+
event.preventDefault();
|
|
3775
|
+
this.commit(true);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
stopEdit(cancelled, restoreFocus) {
|
|
3779
|
+
if (!this.editing) {
|
|
3780
|
+
return;
|
|
3781
|
+
}
|
|
3782
|
+
// Leave edit state first so the revert below can't re-enter through closeOnChange
|
|
3783
|
+
this.editing = false;
|
|
3784
|
+
this.valueSub?.unsubscribe();
|
|
3785
|
+
this.document.removeEventListener('mousedown', this.onDocumentMouseDown, true);
|
|
3786
|
+
if (cancelled && this.control) {
|
|
3787
|
+
this.control.setValue(this.valueOnEditStart);
|
|
3788
|
+
}
|
|
3789
|
+
const value = this.control?.value;
|
|
3790
|
+
this.updateControlState();
|
|
3791
|
+
this.cdr.markForCheck();
|
|
3792
|
+
this.editEnd.emit({
|
|
3793
|
+
cancelled,
|
|
3794
|
+
changed: !cancelled && !this.isSameValue(value, this.valueOnEditStart),
|
|
3795
|
+
value,
|
|
3796
|
+
previousValue: this.valueOnEditStart
|
|
3797
|
+
});
|
|
3798
|
+
if (restoreFocus) {
|
|
3799
|
+
setTimeout(() => this.displayEl?.nativeElement.focus());
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
/** Inside the host, or inside an overlay (select panel, datepicker) that isn't the dialog hosting us. */
|
|
3803
|
+
isInside(target) {
|
|
3804
|
+
if (!target) {
|
|
3805
|
+
return false;
|
|
3806
|
+
}
|
|
3807
|
+
const host = this.host.nativeElement;
|
|
3808
|
+
if (host.contains(target)) {
|
|
3809
|
+
return true;
|
|
3810
|
+
}
|
|
3811
|
+
const pane = target.closest('.cdk-overlay-pane');
|
|
3812
|
+
return !!pane && !pane.contains(host);
|
|
3813
|
+
}
|
|
3814
|
+
focusEditor() {
|
|
3815
|
+
const root = this.editorHost?.nativeElement;
|
|
3816
|
+
if (!root) {
|
|
3817
|
+
return;
|
|
3818
|
+
}
|
|
3819
|
+
const preferred = root.querySelector('[cdkFocusInitial]');
|
|
3820
|
+
if (preferred) {
|
|
3821
|
+
preferred.focus();
|
|
3822
|
+
return;
|
|
3823
|
+
}
|
|
3824
|
+
const input = root.querySelector('input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([disabled]), textarea:not([disabled])');
|
|
3825
|
+
if (input) {
|
|
3826
|
+
input.focus();
|
|
3827
|
+
input.select?.();
|
|
3828
|
+
return;
|
|
3829
|
+
}
|
|
3830
|
+
const selectTrigger = root.querySelector('.mat-mdc-select-trigger');
|
|
3831
|
+
if (selectTrigger) {
|
|
3832
|
+
root.querySelector('.mat-mdc-select')?.focus();
|
|
3833
|
+
selectTrigger.click();
|
|
3834
|
+
return;
|
|
3835
|
+
}
|
|
3836
|
+
root.querySelector('[tabindex]:not([tabindex="-1"]), button')?.focus();
|
|
3837
|
+
}
|
|
3838
|
+
subscribeToControl() {
|
|
3839
|
+
this.controlSub?.unsubscribe();
|
|
3840
|
+
if (!this.control) {
|
|
3841
|
+
return;
|
|
3842
|
+
}
|
|
3843
|
+
this.controlSub = merge(this.control.statusChanges, this.control.valueChanges).subscribe({
|
|
3844
|
+
next: () => {
|
|
3845
|
+
this.updateControlState();
|
|
3846
|
+
this.cdr.markForCheck();
|
|
3847
|
+
}
|
|
3848
|
+
});
|
|
3849
|
+
}
|
|
3850
|
+
updateControlState() {
|
|
3851
|
+
this.isDisabled = this.disabled || this.loading || !!this.control?.disabled;
|
|
3852
|
+
this.isInvalid = !!this.control && this.control.invalid && (this.control.dirty || this.control.touched);
|
|
3853
|
+
// Forced close - validation can't be fixed by the user while the field is locked
|
|
3854
|
+
if (this.editing && this.isDisabled) {
|
|
3855
|
+
this.stopEdit(false, false);
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
isSameValue(a, b) {
|
|
3859
|
+
if (a === b) {
|
|
3860
|
+
return true;
|
|
3861
|
+
}
|
|
3862
|
+
const normalize = (v) => (v === undefined || v === '' ? null : v);
|
|
3863
|
+
if (normalize(a) === normalize(b)) {
|
|
3864
|
+
return true;
|
|
3865
|
+
}
|
|
3866
|
+
// Arrays / objects (multi-selects, date ranges)
|
|
3867
|
+
return typeof a === 'object' && typeof b === 'object' && JSON.stringify(a) === JSON.stringify(b);
|
|
3868
|
+
}
|
|
3869
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InlineEditComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3870
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: InlineEditComponent, isStandalone: true, selector: "i-tech-inline-edit", inputs: { displayValue: "displayValue", placeholder: "placeholder", disabled: "disabled", loading: "loading", control: "control", closeOnChange: "closeOnChange", blockInvalidCommit: "blockInvalidCommit", autoFocus: "autoFocus", ariaLabel: "ariaLabel", testId: "testId" }, outputs: { editStart: "editStart", editEnd: "editEnd" }, host: { listeners: { "focusout": "onFocusOut($event)" } }, queries: [{ propertyName: "editor", first: true, predicate: InlineEditorDirective, descendants: true }, { propertyName: "display", first: true, predicate: InlineDisplayDirective, descendants: true }], viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true }, { propertyName: "displayEl", first: true, predicate: ["displayEl"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (editing) {\n <div class=\"i-tech-inline-edit-editor\" #editorHost (keydown)=\"onEditorKeydown($event)\">\n <ng-container [ngTemplateOutlet]=\"editor!.templateRef\"\n [ngTemplateOutletContext]=\"editorContext\"></ng-container>\n </div>\n} @else {\n <div class=\"i-tech-inline-edit-display\"\n #displayEl\n role=\"button\"\n [attr.data-testId]=\"testId ? testId + '-inline-edit' : null\"\n [attr.tabindex]=\"isDisabled ? -1 : 0\"\n [attr.aria-disabled]=\"isDisabled\"\n [attr.aria-busy]=\"loading\"\n [class.disabled]=\"isDisabled\"\n [class.loading]=\"loading\"\n [class.invalid]=\"isInvalid\"\n (click)=\"startEdit()\"\n (keydown.enter)=\"startEdit()\"\n (keydown.space)=\"$event.preventDefault(); startEdit()\">\n @if (ariaLabel) {\n <span class=\"i-tech-inline-edit-sr-only\">{{ ariaLabel | translate }}:</span>\n }\n <span class=\"i-tech-inline-edit-value\" [class.empty]=\"isEmpty\">\n @if (isEmpty) {\n {{ placeholder ? (placeholder | translate) : '---' }}\n } @else if (display) {\n <ng-container [ngTemplateOutlet]=\"display.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: displayValue }\"></ng-container>\n } @else {\n {{ displayValue }}\n }\n </span>\n @if (loading) {\n <mat-progress-spinner class=\"i-tech-inline-edit-icon\" mode=\"indeterminate\" [diameter]=\"16\"></mat-progress-spinner>\n } @else if (!isDisabled) {\n <mat-icon class=\"i-tech-inline-edit-icon\">edit</mat-icon>\n }\n </div>\n}\n", styles: [":host{display:block;min-width:0}.i-tech-inline-edit-display{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:var(--mat-form-field-container-height, 48px);padding:0 15px;border:1px solid transparent;border-radius:var(--mdc-outlined-text-field-container-shape, 4px);font-size:13px;font-weight:500;line-height:20px;letter-spacing:.2px;color:var(--neutral20, #30353D);cursor:pointer;outline:none;transition:background-color .15s ease,border-color .15s ease}.i-tech-inline-edit-display .i-tech-inline-edit-value{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.i-tech-inline-edit-display .i-tech-inline-edit-value.empty{color:var(--neutral50, #647081)}.i-tech-inline-edit-display .i-tech-inline-edit-icon{flex-shrink:0;width:16px;height:16px;font-size:16px;color:var(--neutral50, #647081);opacity:0;transition:opacity .15s ease}.i-tech-inline-edit-display:hover,.i-tech-inline-edit-display:focus-visible{background-color:var(--neutral99, #F9F9FC);border-color:var(--neutral90, #D7D9DE)}.i-tech-inline-edit-display:hover .i-tech-inline-edit-icon,.i-tech-inline-edit-display:focus-visible .i-tech-inline-edit-icon{opacity:1}.i-tech-inline-edit-display:focus-visible{border-color:var(--neutral50, #647081)}.i-tech-inline-edit-display.invalid{border-color:var(--error60, #DE4558)}.i-tech-inline-edit-display.disabled{cursor:default}.i-tech-inline-edit-display.disabled:hover{background-color:transparent;border-color:transparent}.i-tech-inline-edit-display.loading .i-tech-inline-edit-icon{opacity:1}@media (hover: none){.i-tech-inline-edit-display .i-tech-inline-edit-icon{opacity:1}}.i-tech-inline-edit-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3871
|
+
}
|
|
3872
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InlineEditComponent, decorators: [{
|
|
3873
|
+
type: Component,
|
|
3874
|
+
args: [{ selector: 'i-tech-inline-edit', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3875
|
+
NgTemplateOutlet,
|
|
3876
|
+
MatIcon,
|
|
3877
|
+
MatProgressSpinner,
|
|
3878
|
+
TranslateModule
|
|
3879
|
+
], template: "@if (editing) {\n <div class=\"i-tech-inline-edit-editor\" #editorHost (keydown)=\"onEditorKeydown($event)\">\n <ng-container [ngTemplateOutlet]=\"editor!.templateRef\"\n [ngTemplateOutletContext]=\"editorContext\"></ng-container>\n </div>\n} @else {\n <div class=\"i-tech-inline-edit-display\"\n #displayEl\n role=\"button\"\n [attr.data-testId]=\"testId ? testId + '-inline-edit' : null\"\n [attr.tabindex]=\"isDisabled ? -1 : 0\"\n [attr.aria-disabled]=\"isDisabled\"\n [attr.aria-busy]=\"loading\"\n [class.disabled]=\"isDisabled\"\n [class.loading]=\"loading\"\n [class.invalid]=\"isInvalid\"\n (click)=\"startEdit()\"\n (keydown.enter)=\"startEdit()\"\n (keydown.space)=\"$event.preventDefault(); startEdit()\">\n @if (ariaLabel) {\n <span class=\"i-tech-inline-edit-sr-only\">{{ ariaLabel | translate }}:</span>\n }\n <span class=\"i-tech-inline-edit-value\" [class.empty]=\"isEmpty\">\n @if (isEmpty) {\n {{ placeholder ? (placeholder | translate) : '---' }}\n } @else if (display) {\n <ng-container [ngTemplateOutlet]=\"display.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: displayValue }\"></ng-container>\n } @else {\n {{ displayValue }}\n }\n </span>\n @if (loading) {\n <mat-progress-spinner class=\"i-tech-inline-edit-icon\" mode=\"indeterminate\" [diameter]=\"16\"></mat-progress-spinner>\n } @else if (!isDisabled) {\n <mat-icon class=\"i-tech-inline-edit-icon\">edit</mat-icon>\n }\n </div>\n}\n", styles: [":host{display:block;min-width:0}.i-tech-inline-edit-display{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;min-height:var(--mat-form-field-container-height, 48px);padding:0 15px;border:1px solid transparent;border-radius:var(--mdc-outlined-text-field-container-shape, 4px);font-size:13px;font-weight:500;line-height:20px;letter-spacing:.2px;color:var(--neutral20, #30353D);cursor:pointer;outline:none;transition:background-color .15s ease,border-color .15s ease}.i-tech-inline-edit-display .i-tech-inline-edit-value{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.i-tech-inline-edit-display .i-tech-inline-edit-value.empty{color:var(--neutral50, #647081)}.i-tech-inline-edit-display .i-tech-inline-edit-icon{flex-shrink:0;width:16px;height:16px;font-size:16px;color:var(--neutral50, #647081);opacity:0;transition:opacity .15s ease}.i-tech-inline-edit-display:hover,.i-tech-inline-edit-display:focus-visible{background-color:var(--neutral99, #F9F9FC);border-color:var(--neutral90, #D7D9DE)}.i-tech-inline-edit-display:hover .i-tech-inline-edit-icon,.i-tech-inline-edit-display:focus-visible .i-tech-inline-edit-icon{opacity:1}.i-tech-inline-edit-display:focus-visible{border-color:var(--neutral50, #647081)}.i-tech-inline-edit-display.invalid{border-color:var(--error60, #DE4558)}.i-tech-inline-edit-display.disabled{cursor:default}.i-tech-inline-edit-display.disabled:hover{background-color:transparent;border-color:transparent}.i-tech-inline-edit-display.loading .i-tech-inline-edit-icon{opacity:1}@media (hover: none){.i-tech-inline-edit-display .i-tech-inline-edit-icon{opacity:1}}.i-tech-inline-edit-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n"] }]
|
|
3880
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Document, decorators: [{
|
|
3881
|
+
type: Inject,
|
|
3882
|
+
args: [DOCUMENT]
|
|
3883
|
+
}] }], propDecorators: { displayValue: [{
|
|
3884
|
+
type: Input
|
|
3885
|
+
}], placeholder: [{
|
|
3886
|
+
type: Input
|
|
3887
|
+
}], disabled: [{
|
|
3888
|
+
type: Input
|
|
3889
|
+
}], loading: [{
|
|
3890
|
+
type: Input
|
|
3891
|
+
}], control: [{
|
|
3892
|
+
type: Input
|
|
3893
|
+
}], closeOnChange: [{
|
|
3894
|
+
type: Input
|
|
3895
|
+
}], blockInvalidCommit: [{
|
|
3896
|
+
type: Input
|
|
3897
|
+
}], autoFocus: [{
|
|
3898
|
+
type: Input
|
|
3899
|
+
}], ariaLabel: [{
|
|
3900
|
+
type: Input
|
|
3901
|
+
}], testId: [{
|
|
3902
|
+
type: Input
|
|
3903
|
+
}], editStart: [{
|
|
3904
|
+
type: Output
|
|
3905
|
+
}], editEnd: [{
|
|
3906
|
+
type: Output
|
|
3907
|
+
}], editor: [{
|
|
3908
|
+
type: ContentChild,
|
|
3909
|
+
args: [InlineEditorDirective]
|
|
3910
|
+
}], display: [{
|
|
3911
|
+
type: ContentChild,
|
|
3912
|
+
args: [InlineDisplayDirective]
|
|
3913
|
+
}], editorHost: [{
|
|
3914
|
+
type: ViewChild,
|
|
3915
|
+
args: ['editorHost']
|
|
3916
|
+
}], displayEl: [{
|
|
3917
|
+
type: ViewChild,
|
|
3918
|
+
args: ['displayEl']
|
|
3919
|
+
}], onFocusOut: [{
|
|
3920
|
+
type: HostListener,
|
|
3921
|
+
args: ['focusout', ['$event']]
|
|
3922
|
+
}] } });
|
|
3923
|
+
|
|
3585
3924
|
/*
|
|
3586
3925
|
* Public API Surface of shared-components
|
|
3587
3926
|
*/
|
|
@@ -3590,5 +3929,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3590
3929
|
* Generated bundle index. Do not edit.
|
|
3591
3930
|
*/
|
|
3592
3931
|
|
|
3593
|
-
export { AgGridButtonCellComponent, AgGridFunctionsService, AnnouncementLinkType, AnnouncementModalComponent, ArrayToStringPipe, AutocompleteSelectComponent, ButtonComponent, ButtonType, ClearValueComponent, CompaniesEnum, DATA_ENDPOINT, DatePickerComponent, DateRangeDatepickerComponent, DateRangeSelectionComponent, DateTimePickerComponent, DriverCategories, DriverCategoryEnum, DriverStatus, GenerateErrorMessagesPipe, GetValueByKeyFromObjectPipe, IconButtonComponent, InputMaskDirective, InputService, LabelComponent, LabelTypeEnum, MenuComponent, NewSidebarComponent, ParseDateService, PhoneNumberInputComponent, ProcessedStatusCellRendererComponent, RoleEnum, SegmentedButtonComponent, SelectWithSearchComponent, TextInputComponent, TimeInputComponent, TooltipCellRendererComponent, formatPhoneNumber, internationalPhoneValidator };
|
|
3932
|
+
export { AgGridButtonCellComponent, AgGridFunctionsService, AnnouncementLinkType, AnnouncementModalComponent, ArrayToStringPipe, AutocompleteSelectComponent, ButtonComponent, ButtonType, ClearValueComponent, CompaniesEnum, DATA_ENDPOINT, DatePickerComponent, DateRangeDatepickerComponent, DateRangeSelectionComponent, DateTimePickerComponent, DriverCategories, DriverCategoryEnum, DriverStatus, GenerateErrorMessagesPipe, GetValueByKeyFromObjectPipe, IconButtonComponent, InlineDisplayDirective, InlineEditComponent, InlineEditorDirective, InputMaskDirective, InputService, LabelComponent, LabelTypeEnum, MenuComponent, NewSidebarComponent, ParseDateService, PhoneNumberInputComponent, ProcessedStatusCellRendererComponent, RoleEnum, SegmentedButtonComponent, SelectWithSearchComponent, TextInputComponent, TimeInputComponent, TooltipCellRendererComponent, formatPhoneNumber, internationalPhoneValidator };
|
|
3594
3933
|
//# sourceMappingURL=i-tech-shared-components.mjs.map
|