From 6a85a90e9ccde326039d6217cbf5594802f550e0 Mon Sep 17 00:00:00 2001 From: Nicolas Molina Date: Fri, 8 Nov 2024 16:47:28 -0400 Subject: [PATCH] chore(edit-content): add docs #30216 --- .../dot-file-field-preview.component.ts | 8 ++++---- .../dot-file-field-ui-message.component.ts | 3 +-- .../dot-form-file-editor.component.ts | 3 +-- .../dot-form-import-url.component.ts | 5 ++--- .../dot-dataview/dot-dataview.component.ts | 12 ++++++++++++ .../components/dot-sidebar/dot-sidebar.component.ts | 10 ++++++++++ .../dot-select-existing-file.component.ts | 4 ++++ 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts index 47e39b4744ff..61754a7bc1df 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-preview/dot-file-field-preview.component.ts @@ -19,6 +19,10 @@ import { catchError } from 'rxjs/operators'; import { DotResourceLinksService } from '@dotcms/data-access'; import { DotCMSBaseTypesContentTypes, DotCMSContentlet } from '@dotcms/dotcms-models'; +import { + DotPreviewResourceLink, + UploadedFile +} from '@dotcms/edit-content/models/dot-edit-content-file.model'; import { DotTempFileThumbnailComponent, DotFileSizeFormatPipe, @@ -26,10 +30,6 @@ import { DotCopyButtonComponent } from '@dotcms/ui'; -import { - DotPreviewResourceLink, - UploadedFile -} from '../../../../models/dot-edit-content-file.model'; import { getFileMetadata } from '../../utils'; @Component({ diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-ui-message/dot-file-field-ui-message.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-ui-message/dot-file-field-ui-message.component.ts index 0e956411a96f..4d14177c9958 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-ui-message/dot-file-field-ui-message.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-file-field-ui-message/dot-file-field-ui-message.component.ts @@ -1,10 +1,9 @@ import { NgClass } from '@angular/common'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; +import { UIMessage } from '@dotcms/edit-content/models/dot-edit-content-file.model'; import { DotMessagePipe } from '@dotcms/ui'; -import { UIMessage } from '../../../../models/dot-edit-content-file.model'; - @Component({ selector: 'dot-file-field-ui-message', standalone: true, diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.ts index a8018cb11a51..43982c895e9e 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.component.ts @@ -17,12 +17,11 @@ import { InputTextModule } from 'primeng/inputtext'; import { debounceTime, distinctUntilChanged, filter } from 'rxjs/operators'; +import { UploadedFile } from '@dotcms/edit-content/models/dot-edit-content-file.model'; import { DotMessagePipe, DotFieldValidationMessageComponent } from '@dotcms/ui'; import { FormFileEditorStore } from './store/form-file-editor.store'; -import { UploadedFile } from '../../../../models/dot-edit-content-file.model'; - type DialogProps = { allowFileNameEdit: boolean; userMonacoOptions: Partial; diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-import-url/dot-form-import-url.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-import-url/dot-form-import-url.component.ts index a97121b6daac..9308f75df601 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-import-url/dot-form-import-url.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-form-import-url/dot-form-import-url.component.ts @@ -12,12 +12,11 @@ import { ButtonModule } from 'primeng/button'; import { DynamicDialogRef, DynamicDialogConfig } from 'primeng/dynamicdialog'; import { InputTextModule } from 'primeng/inputtext'; +import { INPUT_TYPES } from '@dotcms/edit-content/models/dot-edit-content-file.model'; import { DotMessagePipe, DotFieldValidationMessageComponent, DotValidators } from '@dotcms/ui'; import { FormImportUrlStore } from './store/form-import-url.store'; -import { INPUT_TYPE } from '../../../dot-edit-content-text-field/utils'; - @Component({ selector: 'dot-form-import-url', standalone: true, @@ -38,7 +37,7 @@ export class DotFormImportUrlComponent implements OnInit { readonly #formBuilder = inject(FormBuilder); readonly #dialogRef = inject(DynamicDialogRef); readonly #dialogConfig = inject( - DynamicDialogConfig<{ inputType: INPUT_TYPE; acceptedFiles: string[] }> + DynamicDialogConfig<{ inputType: INPUT_TYPES; acceptedFiles: string[] }> ); #abortController: AbortController | null = null; diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-dataview/dot-dataview.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-dataview/dot-dataview.component.ts index 07e5e95c8f08..0725fbfed51d 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-dataview/dot-dataview.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-dataview/dot-dataview.component.ts @@ -54,9 +54,21 @@ export class DotDataViewComponent { */ $loading = input.required({ alias: 'loading' }); + /** + * Signal representing the number of rows per page in the data view. + * + * @type {number} + */ $rowsPerPage = signal(9); + /** + * Reactive model holding the currently selected product. + * Can be a `DotCMSContentlet` or `null`. + */ $selectedProduct = model(null); + /** + * Emits the selected `DotCMSContentlet` when a row is selected. + */ onRowSelect = output(); } diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-sidebar/dot-sidebar.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-sidebar/dot-sidebar.component.ts index 3048d4922f5d..d6170306cf52 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-sidebar/dot-sidebar.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/components/dot-sidebar/dot-sidebar.component.ts @@ -57,6 +57,9 @@ export class DotSideBarComponent { */ $fakeColumns = signal(Array.from({ length: 50 }).map((_) => this.getPercentage())); + /** + * Reactive model representing the currently selected file. + */ $selectedFile = model(null); /** @@ -75,6 +78,13 @@ export class DotSideBarComponent { */ onNodeSelect = output(); + /** + * Computed property representing the component's state. + * + * @returns An object containing: + * - `folders`: An array of folders obtained from `$folders()`. + * - `selectedFile`: A signal of the selected file, initialized to the file whose `data.identifier` matches `SYSTEM_HOST_ID`. + */ $state = computed(() => { const folders = this.$folders(); diff --git a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/dot-select-existing-file.component.ts b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/dot-select-existing-file.component.ts index 4bcd41ce59a3..6b32a1326532 100644 --- a/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/dot-select-existing-file.component.ts +++ b/core-web/libs/edit-content/src/lib/fields/dot-edit-content-file-field/components/dot-select-existing-file/dot-select-existing-file.component.ts @@ -81,6 +81,10 @@ export class DotSelectExistingFileComponent implements OnInit { this.#dialogRef.close(); } + /** + * Retrieves the selected content from the store, fetches it by ID using the upload service, + * and closes the dialog with the retrieved content. + */ addContent(): void { const content = this.store.selectedContent(); this.#uploadService.getContentById(content.identifier).subscribe((content) => {