UNPKG

@dotglitch/ngx-common

Version:

Angular components and utilities that are commonly used.

61 lines (58 loc) 5.66 kB
import * as i0 from '@angular/core'; import { Input, Component } from '@angular/core'; import * as i7 from '@angular/forms'; import { FormsModule } from '@angular/forms'; import * as i9 from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button'; import * as i8 from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon'; import * as i3 from '@angular/material/input'; import { MatInputModule } from '@angular/material/input'; import * as i2 from '@angular/material/dialog'; import * as i1 from '@dotglitch/ngx-common/core'; import * as i4 from '@angular/material/form-field'; class FolderRenameComponent { constructor(dialog, fetch) { this.dialog = dialog; this.fetch = fetch; this.name = ''; this.isRename = false; } ngOnInit() { this.isRename = this.name.length > 0; } onSave() { if (this.isRename) { const url = this.config.apiSettings.renameEntryUrlTemplate ? this.config.apiSettings.renameEntryUrlTemplate(this.path + this.name) : this.config.apiSettings.renameEntryUrl; this.fetch.post(url, { path: this.path + '/' + this.name }); } else { const url = this.config.apiSettings.createDirectoryUrlTemplate ? this.config.apiSettings.createDirectoryUrlTemplate(this.path + this.name) : this.config.apiSettings.createDirectoryUrl; this.fetch.post(url, { path: this.path + '/' + this.name }); } this.dialog.close(true); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FolderRenameComponent, deps: [{ token: i2.MatDialogRef }, { token: i1.Fetch }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: FolderRenameComponent, isStandalone: true, selector: "app-folder-rename", inputs: { path: "path", name: "name", config: "config" }, ngImport: i0, template: "<mat-form-field style=\"width: 280px;\">\n <mat-label>Name</mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"name\" (keyup)=\"$event.key == 'Enter' && onSave()\">\n</mat-form-field>\n\n<div style=\"align-self: end;\">\n <button mat-flat-button (click)=\"onSave()\"><mat-icon>check</mat-icon>Ok</button>\n <button mat-flat-button (click)=\"dialog.close()\"><mat-icon>cancel</mat-icon>Cancel</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column;padding:24px}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i8.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i9.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FolderRenameComponent, decorators: [{ type: Component, args: [{ selector: 'app-folder-rename', imports: [ MatInputModule, MatIconModule, MatButtonModule, FormsModule ], standalone: true, template: "<mat-form-field style=\"width: 280px;\">\n <mat-label>Name</mat-label>\n <input matInput type=\"text\" [(ngModel)]=\"name\" (keyup)=\"$event.key == 'Enter' && onSave()\">\n</mat-form-field>\n\n<div style=\"align-self: end;\">\n <button mat-flat-button (click)=\"onSave()\"><mat-icon>check</mat-icon>Ok</button>\n <button mat-flat-button (click)=\"dialog.close()\"><mat-icon>cancel</mat-icon>Cancel</button>\n</div>\n", styles: [":host{display:flex;flex-direction:column;padding:24px}\n"] }] }], ctorParameters: () => [{ type: i2.MatDialogRef }, { type: i1.Fetch }], propDecorators: { path: [{ type: Input }], name: [{ type: Input }], config: [{ type: Input }] } }); export { FolderRenameComponent }; //# sourceMappingURL=dotglitch-ngx-common-filemanager-folder-rename.component-CnKuU8nn.mjs.map