@volo/abp.ng.file-management 11.0.0-rc.1 → 11.0.0-rc.3

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,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, output, ChangeDetectionStrategy, Component, inject, Injectable, viewChild, ChangeDetectorRef, model, effect, InjectionToken, Renderer2, ElementRef, DOCUMENT, ViewEncapsulation, Injector, NgModule } from '@angular/core';
3
- import { LocalizationPipe, InternalStore, EnvironmentService, PermissionService, SubscriptionService, ListService, AbpWindowService, LocalizationService, ApiInterceptor, authGuard, permissionGuard, LazyModuleFactory, CoreModule } from '@abp/ng.core';
3
+ import { LocalizationPipe, InternalStore, EnvironmentService, AbpWindowService, PermissionService, SubscriptionService, ListService, LocalizationService, ApiInterceptor, authGuard, permissionGuard, LazyModuleFactory, CoreModule } from '@abp/ng.core';
4
4
  import { Subject, merge, Subscription, forkJoin, of, BehaviorSubject, tap as tap$1, fromEvent, map as map$1 } from 'rxjs';
5
- import { filter, switchMap, skip, map, tap, finalize, take, distinctUntilChanged, debounceTime, bufferTime } from 'rxjs/operators';
5
+ import { filter, switchMap, skip, map, tap, finalize, take, distinctUntilChanged, debounceTime, bufferTime, startWith } from 'rxjs/operators';
6
6
  import { ModalComponent, ButtonComponent, ConfirmationService, ToasterService, Confirmation, NgxDatatableDefaultDirective, ThemeSharedModule } from '@abp/ng.theme.shared';
7
7
  import { UPPY_OPTIONS, FILE_MANAGEMENT_FEATURES } from '@volo/abp.ng.file-management/common';
8
8
  import * as i1 from '@angular/forms';
@@ -16,7 +16,7 @@ import { Uppy } from '@uppy/core';
16
16
  import Dashboard from '@uppy/dashboard';
17
17
  import XHRUpload from '@uppy/xhr-upload';
18
18
  import { ExtensibleTableComponent, EXTENSIONS_IDENTIFIER, EntityAction, PROP_DATA_STREAM, EntityProp, ToolbarAction, ExtensionsService, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultActions, mergeWithDefaultProps, ExtensibleModule } from '@abp/ng.components/extensible';
19
- import { toSignal } from '@angular/core/rxjs-interop';
19
+ import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
20
20
  import { NgbTooltipModule, NgbTooltip, NgbDropdownItem, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
21
21
  import { ResourcePermissionManagementComponent } from '@abp/ng.permission-management';
22
22
  import { AsyncPipe } from '@angular/common';
@@ -59,7 +59,7 @@ class UpdateStreamService {
59
59
  this.directoryCreate$ = this.store.sliceUpdate(state => state.createdDirectory);
60
60
  this.directoryMove$ = this.sliceState(state => state.movedDirectory);
61
61
  this.storageSizeInfo$ = this.sliceState(state => state.storageSizeInfo);
62
- this.contentRefresh$ = merge(this.sliceState(state => state.content), this.currentDirectory$, this.storageSizeInfo$, this.directoryCreate$.pipe(filter(id => id === this.currentDirectory)), this.directoryMove$.pipe(filter(({ oldParentId, newParentId }) => oldParentId === this.currentDirectory || newParentId === this.currentDirectory)));
62
+ this.contentRefresh$ = merge(this.sliceState(state => state.content), this.currentDirectory$, this.storageSizeInfo$, this.directoryCreate$.pipe(filter(id => this.isCurrentDirectory(id))), this.directoryMove$.pipe(filter(({ oldParentId, newParentId }) => oldParentId === this.currentDirectory || newParentId === this.currentDirectory)));
63
63
  this.patchStore = (state) => this.store.patch(state);
64
64
  this.requestStorageSizeRefresh = () => this.storageSizeRefresh$.next();
65
65
  this.refreshContent = () => this.store.patch({ content: new Date().getTime() });
@@ -74,6 +74,11 @@ class UpdateStreamService {
74
74
  // skip initial empty values
75
75
  return this.store.sliceState(fn).pipe(skip(1));
76
76
  }
77
+ // The root is null after navigation and undefined before the first navigation.
78
+ // sliceUpdate drops undefined, so a root create is published as null.
79
+ isCurrentDirectory(directoryId) {
80
+ return (directoryId ?? null) === (this.currentDirectory ?? null);
81
+ }
77
82
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: UpdateStreamService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
78
83
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: UpdateStreamService }); }
79
84
  }
@@ -226,7 +231,8 @@ class CreateFolderModalService {
226
231
  .create({ name, parentId: mapRootIdToEmpty(parentId), extraProperties: {} })
227
232
  .pipe(tap(_ => {
228
233
  this.directoryService.updateDirectories(parentId);
229
- this.updateStream.patchStore({ createdDirectory: parentId });
234
+ // Root has no id. undefined is dropped by sliceUpdate, so the open list would not refresh.
235
+ this.updateStream.patchStore({ createdDirectory: parentId ?? null });
230
236
  this.directoryService.refreshNode({ newParentId: parentId });
231
237
  }));
232
238
  }
@@ -499,15 +505,14 @@ class DownloadService {
499
505
  constructor() {
500
506
  this.fileDescriptorService = inject(FileDescriptorService);
501
507
  this.environment = inject(EnvironmentService);
508
+ this.abpWindowService = inject(AbpWindowService);
502
509
  this.apiName = 'FileManagement';
503
510
  }
504
511
  get apiUrl() {
505
512
  return this.environment.getApiUrl(this.apiName);
506
513
  }
507
514
  downloadFile(file) {
508
- return this.fileDescriptorService.getDownloadToken(file.id).pipe(tap((res) => {
509
- window.open(`${this.apiUrl}/api/file-management/file-descriptor/download/${file.id}?token=${res.token}`, '_self');
510
- }));
515
+ return this.fileDescriptorService.getDownloadToken(file.id).pipe(switchMap(res => this.fileDescriptorService.download(file.id, res.token, { apiName: this.apiName }).pipe(tap(blob => this.abpWindowService.downloadBlob(blob, file.name)), map(() => res))));
511
516
  }
512
517
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: DownloadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
513
518
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: DownloadService }); }
@@ -621,7 +626,21 @@ class NavigatorService {
621
626
  return mapRootIdToEmpty(this.getCurrentFolder()?.id);
622
627
  }
623
628
  updateCurrentFolderPath(folder) {
624
- this.next([...this.directory.findFullPathOf(folder)]);
629
+ this.next(this.resolveFolderPath(folder));
630
+ }
631
+ resolveFolderPath(folder) {
632
+ const path = this.directory.findFullPathOf(folder);
633
+ if (!folder?.id || path[path.length - 1]?.id === folder.id) {
634
+ return path;
635
+ }
636
+ // The tree only contains the folders of expanded nodes, so a folder opened from the
637
+ // breadcrumb or the content list may not be in it. Content list items are children of the
638
+ // current folder.
639
+ const index = this.findIndexOf(folder.id);
640
+ if (index > -1) {
641
+ return this.navigatedFolders.slice(0, index + 1);
642
+ }
643
+ return [...this.navigatedFolders, { id: folder.id, name: folder.name }];
625
644
  }
626
645
  next(newValue) {
627
646
  this.navigatedFolders = newValue;
@@ -760,7 +779,7 @@ class MoveFileModalComponent extends BaseModalComponent {
760
779
  return this.canMoveToCurrentDirectory;
761
780
  }
762
781
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: MoveFileModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
763
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.8", type: MoveFileModalComponent, isStandalone: true, selector: "abp-move-file-modal", inputs: { fileToMove: { classPropertyName: "fileToMove", publicName: "fileToMove", isSignal: true, isRequired: false, transformFunction: null }, oldParentId: { classPropertyName: "oldParentId", publicName: "oldParentId", isSignal: true, isRequired: false, transformFunction: null } }, providers: [MoveFileModalService, ListService, SubscriptionService], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!-- htmlhint attr-lowercase:false -->\r\n<abp-file-management-modal title=\"Move\" [parent]=\"self\">\r\n <span class=\"d-block p-2\">{{ 'FileManagement::MoveToUnder' | abpLocalization }}</span>\r\n <abp-file-management-breadcrumb\r\n [navigatedFolders]=\"(service.breadcrumbs$ | async) ?? []\"\r\n rootBreadcrumbName=\"FileManagement::Root\"\r\n (breadcrumbClick)=\"onBreadcrumbClick($event)\"\r\n />\r\n\r\n <ngx-datatable\r\n [rows]=\"directoryContent$ | async\"\r\n default\r\n [messages]=\"{ emptyMessage: 'FileManagement::MoveHere' | abpLocalization }\"\r\n >\r\n <ngx-datatable-column [sortable]=\"true\" [name]=\"'FileManagement::Name' | abpLocalization\">\r\n <ng-template let-row=\"row\" ngx-datatable-cell-template>\r\n <div (click)=\"service.goTo(row)\" class=\"pointer\">\r\n <i class=\"fa fa-folder text-primary me-1\" aria-hidden=\"true\"></i> {{ row.name }}\r\n </div>\r\n </ng-template>\r\n </ngx-datatable-column>\r\n </ngx-datatable>\r\n</abp-file-management-modal>\r\n", dependencies: [{ kind: "ngmodule", type: NgxDatatableModule }, { kind: "component", type: i1$1.DatatableComponent, selector: "ngx-datatable", inputs: ["targetMarkerTemplate", "rows", "groupRowsBy", "groupedRows", "columns", "selected", "scrollbarV", "scrollbarVDynamic", "scrollbarH", "rowHeight", "columnMode", "headerHeight", "footerHeight", "externalPaging", "externalSorting", "limit", "count", "offset", "loadingIndicator", "ghostLoadingIndicator", "selectionType", "reorderable", "swapColumns", "sortType", "sorts", "cssClasses", "messages", "rowClass", "selectCheck", "displayCheck", "groupExpansionDefault", "trackByProp", "selectAllRowsOnPage", "virtualization", "treeFromRelation", "treeToRelation", "summaryRow", "summaryHeight", "summaryPosition", "disableRowCheck", "rowDraggable", "enableClearingSortState", "rowIdentity"], outputs: ["scroll", "activate", "select", "sort", "page", "reorder", "resize", "tableContextmenu", "treeAction", "rowDragEvents"] }, { kind: "directive", type: i1$1.DataTableColumnDirective, selector: "ngx-datatable-column", inputs: ["name", "prop", "bindAsUnsafeHtml", "frozenLeft", "frozenRight", "flexGrow", "resizeable", "comparator", "pipe", "sortable", "draggable", "canAutoResize", "minWidth", "width", "maxWidth", "checkboxable", "headerCheckboxable", "headerClass", "cellClass", "isTreeColumn", "treeLevelIndent", "summaryFunc", "summaryTemplate", "cellTemplate", "headerTemplate", "treeToggleTemplate", "ghostCellTemplate"] }, { kind: "directive", type: i1$1.DataTableColumnCellDirective, selector: "[ngx-datatable-cell-template]" }, { kind: "directive", type: NgxDatatableDefaultDirective, selector: "ngx-datatable[default]", inputs: ["class"], exportAs: ["ngxDatatableDefault"] }, { kind: "component", type: FileManagementBreadcrumbComponent, selector: "abp-file-management-breadcrumb", inputs: ["rootBreadcrumbName", "navigatedFolders"], outputs: ["breadcrumbClick"] }, { kind: "component", type: BaseModalComponent, selector: "abp-file-management-modal", inputs: ["title", "titleLocalizationParams", "size", "formName", "visible", "parent"], outputs: ["visibleChange", "contentSaved"] }, { kind: "pipe", type: LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
782
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.8", type: MoveFileModalComponent, isStandalone: true, selector: "abp-move-file-modal", inputs: { fileToMove: { classPropertyName: "fileToMove", publicName: "fileToMove", isSignal: true, isRequired: false, transformFunction: null }, oldParentId: { classPropertyName: "oldParentId", publicName: "oldParentId", isSignal: true, isRequired: false, transformFunction: null } }, providers: [MoveFileModalService, ListService, SubscriptionService], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<!-- htmlhint attr-lowercase:false -->\r\n<abp-file-management-modal title=\"Move\" [parent]=\"self\">\r\n <span class=\"d-block p-2\">{{ 'FileManagement::MoveToUnder' | abpLocalization }}</span>\r\n <abp-file-management-breadcrumb\r\n [navigatedFolders]=\"(service.breadcrumbs$ | async) ?? []\"\r\n rootBreadcrumbName=\"FileManagement::Root\"\r\n (breadcrumbClick)=\"onBreadcrumbClick($event)\"\r\n />\r\n\r\n <ngx-datatable\r\n [rows]=\"directoryContent$ | async\"\r\n default\r\n [messages]=\"{ emptyMessage: 'FileManagement::MoveHere' | abpLocalization }\"\r\n >\r\n <ngx-datatable-column [sortable]=\"true\" [name]=\"'FileManagement::Name' | abpLocalization\">\r\n <ng-template let-row=\"row\" ngx-datatable-cell-template>\r\n <div (click)=\"service.goTo(row)\" class=\"pointer\">\r\n <i class=\"fa fa-folder text-primary me-1\" aria-hidden=\"true\"></i> {{ row.name }}\r\n </div>\r\n </ng-template>\r\n </ngx-datatable-column>\r\n </ngx-datatable>\r\n</abp-file-management-modal>\r\n", dependencies: [{ kind: "ngmodule", type: NgxDatatableModule }, { kind: "component", type: i1$1.DatatableComponent, selector: "ngx-datatable", inputs: ["targetMarkerTemplate", "rows", "groupRowsBy", "groupedRows", "columns", "selected", "scrollbarV", "scrollbarVDynamic", "scrollbarH", "rowHeight", "columnMode", "headerHeight", "footerHeight", "externalPaging", "externalSorting", "limit", "count", "offset", "loadingIndicator", "ghostLoadingIndicator", "selectionType", "reorderable", "swapColumns", "sortType", "sorts", "cssClasses", "messages", "rowClass", "selectCheck", "displayCheck", "groupExpansionDefault", "trackByProp", "selectAllRowsOnPage", "virtualization", "treeFromRelation", "treeToRelation", "summaryRow", "summaryHeight", "summaryPosition", "disableRowCheck", "rowDraggable", "enableClearingSortState", "checkRowListChanges", "checkRowPropertyChanges", "rowIdentity"], outputs: ["selectedChange", "offsetChange", "sortsChange", "scroll", "activate", "page", "reorder", "resize", "tableContextmenu", "treeAction", "rowDragEvents"] }, { kind: "directive", type: i1$1.DataTableColumnDirective, selector: "ngx-datatable-column", inputs: ["name", "prop", "bindAsUnsafeHtml", "frozenLeft", "frozenRight", "flexGrow", "resizeable", "comparator", "pipe", "sortable", "draggable", "canAutoResize", "minWidth", "width", "maxWidth", "checkboxable", "headerCheckboxable", "headerClass", "cellClass", "isTreeColumn", "treeLevelIndent", "summaryFunc", "summaryTemplate", "cellTemplate", "headerTemplate", "treeToggleTemplate", "ghostCellTemplate"] }, { kind: "directive", type: i1$1.DataTableColumnCellDirective, selector: "[ngx-datatable-cell-template]" }, { kind: "directive", type: NgxDatatableDefaultDirective, selector: "ngx-datatable[default]", inputs: ["class"], exportAs: ["ngxDatatableDefault"] }, { kind: "component", type: FileManagementBreadcrumbComponent, selector: "abp-file-management-breadcrumb", inputs: ["rootBreadcrumbName", "navigatedFolders"], outputs: ["breadcrumbClick"] }, { kind: "component", type: BaseModalComponent, selector: "abp-file-management-modal", inputs: ["title", "titleLocalizationParams", "size", "formName", "visible", "parent"], outputs: ["visibleChange", "contentSaved"] }, { kind: "pipe", type: LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
764
783
  }
765
784
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: MoveFileModalComponent, decorators: [{
766
785
  type: Component,
@@ -1742,7 +1761,10 @@ class FileManagementDirectoryTreeComponent {
1742
1761
  };
1743
1762
  this.updateSelectedNode = (directory) => {
1744
1763
  const id = directory || ROOT_ID;
1764
+ // The tree resets its selection to this input whenever its nodes change.
1765
+ this.selectedNode = { id };
1745
1766
  this.tree().setSelectedNode({ id });
1767
+ this.cdr.markForCheck();
1746
1768
  };
1747
1769
  this.markAsParentHasChildren = (node) => {
1748
1770
  return {
@@ -1852,20 +1874,34 @@ class FileManagementFolderFilterComponent {
1852
1874
  constructor() {
1853
1875
  this.list = inject(ListService);
1854
1876
  this.navigator = inject(NavigatorService);
1877
+ this.updateStream = inject(UpdateStreamService);
1878
+ this.cdr = inject(ChangeDetectorRef);
1855
1879
  this.isAtRoot = toSignal(this.navigator.navigatedFolderPath$.pipe(map(folders => folders.length <= 1), distinctUntilChanged()), { initialValue: true });
1880
+ // The root folder is stored as undefined before the first navigation and as null after it.
1881
+ const toFolderId = (id) => id || null;
1882
+ this.updateStream.currentDirectory$
1883
+ .pipe(map(toFolderId), startWith(toFolderId(this.updateStream.currentDirectory)), distinctUntilChanged(), skip(1), takeUntilDestroyed())
1884
+ .subscribe(() => this.clearFilter());
1856
1885
  }
1857
1886
  goUpFolder() {
1858
1887
  if (!this.isAtRoot()) {
1859
1888
  this.navigator.goUpFolder();
1860
1889
  }
1861
1890
  }
1891
+ clearFilter() {
1892
+ if (!this.list.filter) {
1893
+ return;
1894
+ }
1895
+ this.list.filter = '';
1896
+ this.cdr.markForCheck();
1897
+ }
1862
1898
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: FileManagementFolderFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1863
1899
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.8", type: FileManagementFolderFilterComponent, isStandalone: true, selector: "abp-file-management-folder-filter", ngImport: i0, template: "<div class=\"row mb-3\">\r\n <div class=\"col-sm-12 col-md-auto col-lg-auto col-xl-auto\">\r\n <abp-button\r\n type=\"button\"\r\n (click)=\"goUpFolder()\"\r\n [disabled]=\"isAtRoot()\"\r\n [attr.aria-disabled]=\"isAtRoot()\"\r\n [class.disabled]=\"isAtRoot()\"\r\n [style.cursor]=\"isAtRoot() ? 'default' : 'pointer'\"\r\n iconClass=\"fa fa-level-up-alt fa-flip-horizontal me-2\"\r\n buttonClass=\"w-100 mb-2 mb-md-0 shadow-none btn-block btn btn-outline-secondary\"\r\n >{{ 'FileManagement::GoUpFolder' | abpLocalization }}</abp-button\r\n >\r\n </div>\r\n <div class=\"col\">\r\n <div class=\"input-group\">\r\n <input\r\n class=\"form-control page-search-filter-text\"\r\n [(ngModel)]=\"list.filter\"\r\n [placeholder]=\"'FileManagement::Filter' | abpLocalization\"\r\n />\r\n </div>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "pipe", type: LocalizationPipe, name: "abpLocalization" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1864
1900
  }
1865
1901
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.8", ngImport: i0, type: FileManagementFolderFilterComponent, decorators: [{
1866
1902
  type: Component,
1867
1903
  args: [{ selector: 'abp-file-management-folder-filter', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, LocalizationPipe, ButtonComponent], template: "<div class=\"row mb-3\">\r\n <div class=\"col-sm-12 col-md-auto col-lg-auto col-xl-auto\">\r\n <abp-button\r\n type=\"button\"\r\n (click)=\"goUpFolder()\"\r\n [disabled]=\"isAtRoot()\"\r\n [attr.aria-disabled]=\"isAtRoot()\"\r\n [class.disabled]=\"isAtRoot()\"\r\n [style.cursor]=\"isAtRoot() ? 'default' : 'pointer'\"\r\n iconClass=\"fa fa-level-up-alt fa-flip-horizontal me-2\"\r\n buttonClass=\"w-100 mb-2 mb-md-0 shadow-none btn-block btn btn-outline-secondary\"\r\n >{{ 'FileManagement::GoUpFolder' | abpLocalization }}</abp-button\r\n >\r\n </div>\r\n <div class=\"col\">\r\n <div class=\"input-group\">\r\n <input\r\n class=\"form-control page-search-filter-text\"\r\n [(ngModel)]=\"list.filter\"\r\n [placeholder]=\"'FileManagement::Filter' | abpLocalization\"\r\n />\r\n </div>\r\n </div>\r\n</div>\r\n" }]
1868
- }] });
1904
+ }], ctorParameters: () => [] });
1869
1905
 
1870
1906
  class FileManagementFolderPanelComponent {
1871
1907
  constructor() {