UNPKG

@dotglitch/ngx-common

Version:

Angular components and utilities that are commonly used.

84 lines (81 loc) 6.3 kB
import * as i0 from '@angular/core'; import { Component, Input } 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 i3 from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon'; import * as i4 from '@angular/material/input'; import { MatInputModule } from '@angular/material/input'; import * as i1 from '@angular/material/dialog'; import { Fetch } from './dotglitch-ngx-common.mjs'; import * as i4$1 from '@angular/material/form-field'; import '@angular/common'; import '@angular/platform-browser'; import 'rxjs'; import '@angular/material/progress-spinner'; import '@angular/cdk/portal'; import 'ulidx'; import 'localforage'; import '@angular/cdk/dialog'; import 'rxjs/operators'; import '@angular/common/http'; import '@angular/cdk/scrolling'; import 'ngx-scrollbar'; import 'tslib'; import '@angular/material/tabs'; import '@angular/material/sidenav'; import 'angular-split'; import '@angular/material/checkbox'; import 'tabulator-tables'; import '@angular/material/progress-bar'; import '@angular/material/expansion'; import 'path-browserify'; import 'react'; import 'react-dom/client'; 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.1.2", ngImport: i0, type: FolderRenameComponent, deps: [{ token: i1.MatDialogRef }, { token: Fetch }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.2", 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: i4.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$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.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.1.2", 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: i1.MatDialogRef }, { type: Fetch }], propDecorators: { path: [{ type: Input }], name: [{ type: Input }], config: [{ type: Input }] } }); export { FolderRenameComponent }; //# sourceMappingURL=dotglitch-ngx-common-folder-rename.component-6j7OjwOo.mjs.map