@alauda/ui 7.4.2-beta.16 → 7.4.2-beta.18
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.
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { EventEmitter, TemplateRef } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CustomBeforeAction } from '../dialog';
|
|
3
|
+
import { ButtonPosition, EditableMode } from './editable.type';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class EditableComponent {
|
|
6
|
+
beforeSave: CustomBeforeAction<unknown>;
|
|
7
|
+
get position(): ButtonPosition;
|
|
8
|
+
set position(val: ButtonPosition);
|
|
5
9
|
save: EventEmitter<void>;
|
|
6
10
|
cancel: EventEmitter<void>;
|
|
7
11
|
modeChange: EventEmitter<EditableMode>;
|
|
@@ -9,10 +13,13 @@ export declare class EditableComponent {
|
|
|
9
13
|
editor: TemplateRef<unknown>;
|
|
10
14
|
EditableMode: typeof EditableMode;
|
|
11
15
|
bem: import("../internal/utils").Bem;
|
|
16
|
+
loading: boolean;
|
|
12
17
|
$$mode: import("@angular/core").WritableSignal<EditableMode>;
|
|
18
|
+
$$position: import("@angular/core").WritableSignal<ButtonPosition>;
|
|
19
|
+
$hostClass: import("@angular/core").Signal<string>;
|
|
13
20
|
constructor();
|
|
14
21
|
saveEdit(): void;
|
|
15
22
|
cancelEdit(): void;
|
|
16
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<EditableComponent, never>;
|
|
17
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EditableComponent, "aui-editable", never, {}, { "save": "save"; "cancel": "cancel"; "modeChange": "modeChange"; }, ["viewer", "editor"], never, true, never>;
|
|
24
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EditableComponent, "aui-editable", never, { "beforeSave": { "alias": "beforeSave"; "required": false; }; "position": { "alias": "position"; "required": false; }; }, { "save": "save"; "cancel": "cancel"; "modeChange": "modeChange"; }, ["viewer", "editor"], never, true, never>;
|
|
18
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AsyncPipe, NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import { ChangeDetectionStrategy, Component, ContentChild, EventEmitter, Output, TemplateRef, effect, signal, } from '@angular/core';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ContentChild, EventEmitter, Input, Output, TemplateRef, computed, effect, signal, } from '@angular/core';
|
|
3
|
+
import { finalize, first, from } from 'rxjs';
|
|
3
4
|
import { ButtonModule } from '../button';
|
|
4
5
|
import { IconComponent } from '../icon';
|
|
5
6
|
import { buildBem } from '../internal/utils';
|
|
@@ -9,27 +10,48 @@ import * as i0 from "@angular/core";
|
|
|
9
10
|
import * as i1 from "../button/button.component";
|
|
10
11
|
const bem = buildBem('aui-editable');
|
|
11
12
|
export class EditableComponent {
|
|
13
|
+
get position() {
|
|
14
|
+
return this.$$position();
|
|
15
|
+
}
|
|
16
|
+
set position(val) {
|
|
17
|
+
if (this.$$position() !== val) {
|
|
18
|
+
this.$$position.set(val);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
12
21
|
constructor() {
|
|
13
22
|
this.save = new EventEmitter();
|
|
14
23
|
this.cancel = new EventEmitter();
|
|
15
24
|
this.modeChange = new EventEmitter();
|
|
16
25
|
this.EditableMode = EditableMode;
|
|
17
26
|
this.bem = bem;
|
|
27
|
+
this.loading = false;
|
|
18
28
|
this.$$mode = signal(EditableMode.View);
|
|
29
|
+
this.$$position = signal('center');
|
|
30
|
+
this.$hostClass = computed(() => {
|
|
31
|
+
return `${bem.block()} ${bem.modifier(this.$$position())}`;
|
|
32
|
+
});
|
|
19
33
|
effect(() => {
|
|
20
34
|
this.modeChange.emit(this.$$mode());
|
|
21
35
|
});
|
|
22
36
|
}
|
|
23
37
|
saveEdit() {
|
|
24
|
-
this
|
|
25
|
-
this.
|
|
38
|
+
this.loading = true;
|
|
39
|
+
from(this.beforeSave?.() || Promise.resolve())
|
|
40
|
+
.pipe(first(), finalize(() => (this.loading = false)))
|
|
41
|
+
.subscribe(isContinue => {
|
|
42
|
+
if (isContinue === false) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.$$mode.set(EditableMode.View);
|
|
46
|
+
this.save.emit();
|
|
47
|
+
});
|
|
26
48
|
}
|
|
27
49
|
cancelEdit() {
|
|
28
50
|
this.$$mode.set(EditableMode.View);
|
|
29
51
|
this.cancel.emit();
|
|
30
52
|
}
|
|
31
53
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: EditableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
32
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: EditableComponent, isStandalone: true, selector: "aui-editable", outputs: { save: "save", cancel: "cancel", modeChange: "modeChange" }, queries: [{ propertyName: "viewer", first: true, predicate: EditableViewerDirective, descendants: true, read: TemplateRef }, { propertyName: "editor", first: true, predicate: EditableEditorDirective, descendants: true, read: TemplateRef }], ngImport: i0, template: "<div [class]=\"
|
|
54
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: EditableComponent, isStandalone: true, selector: "aui-editable", inputs: { beforeSave: "beforeSave", position: "position" }, outputs: { save: "save", cancel: "cancel", modeChange: "modeChange" }, queries: [{ propertyName: "viewer", first: true, predicate: EditableViewerDirective, descendants: true, read: TemplateRef }, { propertyName: "editor", first: true, predicate: EditableEditorDirective, descendants: true, read: TemplateRef }], ngImport: i0, template: "<div [class]=\"$hostClass()\">\n <div\n [class]=\"bem.element('viewer-container')\"\n *ngIf=\"$$mode() === EditableMode.View\"\n >\n <ng-container [ngTemplateOutlet]=\"viewer\"> </ng-container>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"$$mode.set(EditableMode.Edit)\"\n >\n <aui-icon icon=\"pencil\"></aui-icon>\n </button>\n </div>\n <ng-container *ngIf=\"$$mode() === EditableMode.Edit\">\n <div [class]=\"bem.element('editor-container')\">\n <ng-container [ngTemplateOutlet]=\"editor\"> </ng-container>\n\n <button\n *ngIf=\"!loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"check\"></aui-icon>\n </button>\n <button\n *ngIf=\"loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"spinner\"></aui-icon>\n </button>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"cancelEdit()\"\n >\n <aui-icon icon=\"xmark\"></aui-icon>\n </button>\n </div>\n </ng-container>\n</div>\n", styles: [".aui-editable .aui-button--text{color:rgb(var(--aui-color-main-text))}.aui-editable .aui-button--text:first-of-type{margin-left:8px}.aui-editable .aui-button--text:hover{color:rgb(var(--aui-color-primary))}.aui-editable--center .aui-editable__view-container,.aui-editable--center .aui-editable__editor-container{display:flex;align-items:center}.aui-editable--top .aui-editable__view-container,.aui-editable--top .aui-editable__editor-container{display:flex;align-items:flex-start}.aui-editable--bottom .aui-editable__view-container,.aui-editable--bottom .aui-editable__editor-container{display:flex;align-items:flex-end}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "aui-icon", inputs: ["icon", "light", "dark", "link", "margin", "size", "color", "background", "backgroundColor"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1.ButtonComponent, selector: "button[aui-button]", inputs: ["aui-button", "size", "plain", "loading", "round", "square"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
33
55
|
}
|
|
34
56
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: EditableComponent, decorators: [{
|
|
35
57
|
type: Component,
|
|
@@ -40,8 +62,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
|
|
|
40
62
|
NgTemplateOutlet,
|
|
41
63
|
IconComponent,
|
|
42
64
|
ButtonModule,
|
|
43
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"
|
|
44
|
-
}], ctorParameters: function () { return []; }, propDecorators: {
|
|
65
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"$hostClass()\">\n <div\n [class]=\"bem.element('viewer-container')\"\n *ngIf=\"$$mode() === EditableMode.View\"\n >\n <ng-container [ngTemplateOutlet]=\"viewer\"> </ng-container>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"$$mode.set(EditableMode.Edit)\"\n >\n <aui-icon icon=\"pencil\"></aui-icon>\n </button>\n </div>\n <ng-container *ngIf=\"$$mode() === EditableMode.Edit\">\n <div [class]=\"bem.element('editor-container')\">\n <ng-container [ngTemplateOutlet]=\"editor\"> </ng-container>\n\n <button\n *ngIf=\"!loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"check\"></aui-icon>\n </button>\n <button\n *ngIf=\"loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"spinner\"></aui-icon>\n </button>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"cancelEdit()\"\n >\n <aui-icon icon=\"xmark\"></aui-icon>\n </button>\n </div>\n </ng-container>\n</div>\n", styles: [".aui-editable .aui-button--text{color:rgb(var(--aui-color-main-text))}.aui-editable .aui-button--text:first-of-type{margin-left:8px}.aui-editable .aui-button--text:hover{color:rgb(var(--aui-color-primary))}.aui-editable--center .aui-editable__view-container,.aui-editable--center .aui-editable__editor-container{display:flex;align-items:center}.aui-editable--top .aui-editable__view-container,.aui-editable--top .aui-editable__editor-container{display:flex;align-items:flex-start}.aui-editable--bottom .aui-editable__view-container,.aui-editable--bottom .aui-editable__editor-container{display:flex;align-items:flex-end}\n"] }]
|
|
66
|
+
}], ctorParameters: function () { return []; }, propDecorators: { beforeSave: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], position: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], save: [{
|
|
45
71
|
type: Output
|
|
46
72
|
}], cancel: [{
|
|
47
73
|
type: Output
|
|
@@ -54,4 +80,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
|
|
|
54
80
|
type: ContentChild,
|
|
55
81
|
args: [EditableEditorDirective, { read: TemplateRef }]
|
|
56
82
|
}] } });
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWRpdGFibGUuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2VkaXRhYmxlL2VkaXRhYmxlLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uL3NyYy9lZGl0YWJsZS9lZGl0YWJsZS5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMzRSxPQUFPLEVBQ0wsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxZQUFZLEVBQ1osWUFBWSxFQUNaLEtBQUssRUFDTCxNQUFNLEVBQ04sV0FBVyxFQUNYLFFBQVEsRUFDUixNQUFNLEVBQ04sTUFBTSxHQUNQLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBRSxRQUFRLEVBQUUsS0FBSyxFQU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gW3NxdWFyZV09XCJ0cnVlXCJcbiAgICAgICAgKGNsaWNrKT1cInNhdmVFZGl0KClcIlxuICAgICAgPlxuICAgICAgICA8YXVpLWljb24gaWNvbj1cInNwaW5uZXJcIj48L2F1aS1pY29uPlxuICAgICAgPC9idXR0b24+XG4gICAgICA8YnV0dG9uXG4gICAgICAgIGF1aS1idXR0b249XCJ0ZXh0XCJcbiAgICAgICAgW3NxdWFyZV09XCJ0cnVlXCJcbiAgICAgICAgKGNsaWNrKT1cImNhbmNlbEVkaXQoKVwiXG4gICAgICA+XG4gICAgICAgIDxhdWktaWNvbiBpY29uPVwieG1hcmtcIj48L2F1aS1pY29uPlxuICAgICAgPC9idXR0b24+XG4gICAgPC9kaXY+XG4gIDwvbmctY29udGFpbmVyPlxuPC9kaXY+XG4iXX0=
|
|
@@ -3,4 +3,4 @@ export var EditableMode;
|
|
|
3
3
|
EditableMode["View"] = "view";
|
|
4
4
|
EditableMode["Edit"] = "edit";
|
|
5
5
|
})(EditableMode || (EditableMode = {}));
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWRpdGFibGUudHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lZGl0YWJsZS9lZGl0YWJsZS50eXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBTixJQUFZLFlBR1g7QUFIRCxXQUFZLFlBQVk7SUFDdEIsNkJBQWEsQ0FBQTtJQUNiLDZCQUFhLENBQUE7QUFDZixDQUFDLEVBSFcsWUFBWSxLQUFaLFlBQVksUUFHdkIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZW51bSBFZGl0YWJsZU1vZGUge1xuICBWaWV3ID0gJ3ZpZXcnLFxuICBFZGl0ID0gJ2VkaXQnLFxufVxuXG5leHBvcnQgdHlwZSBCdXR0b25Qb3NpdGlvbiA9ICd0b3AnIHwgJ2NlbnRlcicgfCAnYm90dG9tJztcbiJdfQ==
|
package/fesm2022/alauda-ui.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { CdkAccordion, CdkAccordionItem, CdkAccordionModule } from '@angular/cdk
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Component, ViewEncapsulation, ChangeDetectionStrategy, SkipSelf, Optional, Input, HostBinding, booleanAttribute, TemplateRef, Injectable, Pipe, Inject, NgModule, Directive, ContentChild, EventEmitter, Output, ElementRef, ContentChildren, ChangeDetectorRef, forwardRef, ViewChild, HostListener, Host, InjectionToken, signal, inject, computed, isDevMode, numberAttribute, Injector, Type, effect, ViewContainerRef, ViewChildren, Renderer2 } from '@angular/core';
|
|
4
4
|
import { DOCUMENT, NgIf, NgClass, CommonModule, NgTemplateOutlet, NgFor, AsyncPipe, DecimalPipe, NgStyle, DatePipe, NgComponentOutlet, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
|
|
5
|
-
import { Observable, ReplaySubject, share, startWith, map, distinctUntilChanged, Subject, takeUntil, filter, take, merge as merge$1, fromEvent, combineLatest, debounceTime, switchMap, of, EMPTY, tap, BehaviorSubject, withLatestFrom, delay, first, throttleTime, firstValueFrom, NEVER, observeOn, animationFrameScheduler, repeat, takeWhile, endWith, Subscription } from 'rxjs';
|
|
5
|
+
import { Observable, ReplaySubject, share, startWith, map, distinctUntilChanged, Subject, takeUntil, filter, take, merge as merge$1, fromEvent, combineLatest, debounceTime, switchMap, of, EMPTY, tap, BehaviorSubject, withLatestFrom, delay, first, throttleTime, firstValueFrom, from, finalize, NEVER, observeOn, animationFrameScheduler, repeat, takeWhile, endWith, Subscription } from 'rxjs';
|
|
6
6
|
import * as i1 from '@angular/common/http';
|
|
7
7
|
import * as i2 from '@angular/cdk/a11y';
|
|
8
8
|
import { FocusKeyManager, A11yModule } from '@angular/cdk/a11y';
|
|
@@ -7414,27 +7414,48 @@ var EditableMode;
|
|
|
7414
7414
|
|
|
7415
7415
|
const bem = buildBem('aui-editable');
|
|
7416
7416
|
class EditableComponent {
|
|
7417
|
+
get position() {
|
|
7418
|
+
return this.$$position();
|
|
7419
|
+
}
|
|
7420
|
+
set position(val) {
|
|
7421
|
+
if (this.$$position() !== val) {
|
|
7422
|
+
this.$$position.set(val);
|
|
7423
|
+
}
|
|
7424
|
+
}
|
|
7417
7425
|
constructor() {
|
|
7418
7426
|
this.save = new EventEmitter();
|
|
7419
7427
|
this.cancel = new EventEmitter();
|
|
7420
7428
|
this.modeChange = new EventEmitter();
|
|
7421
7429
|
this.EditableMode = EditableMode;
|
|
7422
7430
|
this.bem = bem;
|
|
7431
|
+
this.loading = false;
|
|
7423
7432
|
this.$$mode = signal(EditableMode.View);
|
|
7433
|
+
this.$$position = signal('center');
|
|
7434
|
+
this.$hostClass = computed(() => {
|
|
7435
|
+
return `${bem.block()} ${bem.modifier(this.$$position())}`;
|
|
7436
|
+
});
|
|
7424
7437
|
effect(() => {
|
|
7425
7438
|
this.modeChange.emit(this.$$mode());
|
|
7426
7439
|
});
|
|
7427
7440
|
}
|
|
7428
7441
|
saveEdit() {
|
|
7429
|
-
this
|
|
7430
|
-
this.
|
|
7442
|
+
this.loading = true;
|
|
7443
|
+
from(this.beforeSave?.() || Promise.resolve())
|
|
7444
|
+
.pipe(first(), finalize(() => (this.loading = false)))
|
|
7445
|
+
.subscribe(isContinue => {
|
|
7446
|
+
if (isContinue === false) {
|
|
7447
|
+
return;
|
|
7448
|
+
}
|
|
7449
|
+
this.$$mode.set(EditableMode.View);
|
|
7450
|
+
this.save.emit();
|
|
7451
|
+
});
|
|
7431
7452
|
}
|
|
7432
7453
|
cancelEdit() {
|
|
7433
7454
|
this.$$mode.set(EditableMode.View);
|
|
7434
7455
|
this.cancel.emit();
|
|
7435
7456
|
}
|
|
7436
7457
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: EditableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7437
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: EditableComponent, isStandalone: true, selector: "aui-editable", outputs: { save: "save", cancel: "cancel", modeChange: "modeChange" }, queries: [{ propertyName: "viewer", first: true, predicate: EditableViewerDirective, descendants: true, read: TemplateRef }, { propertyName: "editor", first: true, predicate: EditableEditorDirective, descendants: true, read: TemplateRef }], ngImport: i0, template: "<div [class]=\"
|
|
7458
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.3", type: EditableComponent, isStandalone: true, selector: "aui-editable", inputs: { beforeSave: "beforeSave", position: "position" }, outputs: { save: "save", cancel: "cancel", modeChange: "modeChange" }, queries: [{ propertyName: "viewer", first: true, predicate: EditableViewerDirective, descendants: true, read: TemplateRef }, { propertyName: "editor", first: true, predicate: EditableEditorDirective, descendants: true, read: TemplateRef }], ngImport: i0, template: "<div [class]=\"$hostClass()\">\n <div\n [class]=\"bem.element('viewer-container')\"\n *ngIf=\"$$mode() === EditableMode.View\"\n >\n <ng-container [ngTemplateOutlet]=\"viewer\"> </ng-container>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"$$mode.set(EditableMode.Edit)\"\n >\n <aui-icon icon=\"pencil\"></aui-icon>\n </button>\n </div>\n <ng-container *ngIf=\"$$mode() === EditableMode.Edit\">\n <div [class]=\"bem.element('editor-container')\">\n <ng-container [ngTemplateOutlet]=\"editor\"> </ng-container>\n\n <button\n *ngIf=\"!loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"check\"></aui-icon>\n </button>\n <button\n *ngIf=\"loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"spinner\"></aui-icon>\n </button>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"cancelEdit()\"\n >\n <aui-icon icon=\"xmark\"></aui-icon>\n </button>\n </div>\n </ng-container>\n</div>\n", styles: [".aui-editable .aui-button--text{color:rgb(var(--aui-color-main-text))}.aui-editable .aui-button--text:first-of-type{margin-left:8px}.aui-editable .aui-button--text:hover{color:rgb(var(--aui-color-primary))}.aui-editable--center .aui-editable__view-container,.aui-editable--center .aui-editable__editor-container{display:flex;align-items:center}.aui-editable--top .aui-editable__view-container,.aui-editable--top .aui-editable__editor-container{display:flex;align-items:flex-start}.aui-editable--bottom .aui-editable__view-container,.aui-editable--bottom .aui-editable__editor-container{display:flex;align-items:flex-end}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "aui-icon", inputs: ["icon", "light", "dark", "link", "margin", "size", "color", "background", "backgroundColor"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: ButtonComponent, selector: "button[aui-button]", inputs: ["aui-button", "size", "plain", "loading", "round", "square"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
7438
7459
|
}
|
|
7439
7460
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImport: i0, type: EditableComponent, decorators: [{
|
|
7440
7461
|
type: Component,
|
|
@@ -7445,8 +7466,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.3", ngImpor
|
|
|
7445
7466
|
NgTemplateOutlet,
|
|
7446
7467
|
IconComponent,
|
|
7447
7468
|
ButtonModule,
|
|
7448
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"
|
|
7449
|
-
}], ctorParameters: function () { return []; }, propDecorators: {
|
|
7469
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"$hostClass()\">\n <div\n [class]=\"bem.element('viewer-container')\"\n *ngIf=\"$$mode() === EditableMode.View\"\n >\n <ng-container [ngTemplateOutlet]=\"viewer\"> </ng-container>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"$$mode.set(EditableMode.Edit)\"\n >\n <aui-icon icon=\"pencil\"></aui-icon>\n </button>\n </div>\n <ng-container *ngIf=\"$$mode() === EditableMode.Edit\">\n <div [class]=\"bem.element('editor-container')\">\n <ng-container [ngTemplateOutlet]=\"editor\"> </ng-container>\n\n <button\n *ngIf=\"!loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"check\"></aui-icon>\n </button>\n <button\n *ngIf=\"loading\"\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"saveEdit()\"\n >\n <aui-icon icon=\"spinner\"></aui-icon>\n </button>\n <button\n aui-button=\"text\"\n [square]=\"true\"\n (click)=\"cancelEdit()\"\n >\n <aui-icon icon=\"xmark\"></aui-icon>\n </button>\n </div>\n </ng-container>\n</div>\n", styles: [".aui-editable .aui-button--text{color:rgb(var(--aui-color-main-text))}.aui-editable .aui-button--text:first-of-type{margin-left:8px}.aui-editable .aui-button--text:hover{color:rgb(var(--aui-color-primary))}.aui-editable--center .aui-editable__view-container,.aui-editable--center .aui-editable__editor-container{display:flex;align-items:center}.aui-editable--top .aui-editable__view-container,.aui-editable--top .aui-editable__editor-container{display:flex;align-items:flex-start}.aui-editable--bottom .aui-editable__view-container,.aui-editable--bottom .aui-editable__editor-container{display:flex;align-items:flex-end}\n"] }]
|
|
7470
|
+
}], ctorParameters: function () { return []; }, propDecorators: { beforeSave: [{
|
|
7471
|
+
type: Input
|
|
7472
|
+
}], position: [{
|
|
7473
|
+
type: Input
|
|
7474
|
+
}], save: [{
|
|
7450
7475
|
type: Output
|
|
7451
7476
|
}], cancel: [{
|
|
7452
7477
|
type: Output
|