Skip to content

Commit

Permalink
Merge branch 'main' into 29875-file-field-create-new-file-functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
nicobytes authored Oct 21, 2024
2 parents 25cdf9d + a8440a9 commit 3ad703d
Show file tree
Hide file tree
Showing 34 changed files with 1,704 additions and 395 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,103 +8,139 @@

@switch (field.fieldType) {
@case (fieldTypes.SELECT) {
<dot-edit-content-select-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-select-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.RADIO) {
<dot-edit-content-radio-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-radio-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.TEXT) {
<dot-edit-content-text-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-text-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.TEXTAREA) {
<dot-edit-content-text-area
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-text-area
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.CHECKBOX) {
<dot-edit-content-checkbox-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-checkbox-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.MULTI_SELECT) {
<dot-edit-content-multi-select-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-multi-select-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (calendarTypes.includes(field.fieldType) ? field.fieldType : '') {
<dot-edit-content-calendar-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-calendar-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.TAG) {
<dot-edit-content-tag-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-tag-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.JSON) {
<dot-edit-content-json-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-json-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.BINARY) {
<dot-edit-content-binary-field
[formControlName]="field.variable"
[contentlet]="contentlet"
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-binary-field
[formControlName]="field.variable"
[contentlet]="contentlet"
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.CUSTOM_FIELD) {
<dot-edit-content-custom-field
[field]="field"
[contentType]="contentType"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-custom-field
[field]="field"
[contentType]="contentType"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.BLOCK_EDITOR) {
<dot-block-editor
[formControlName]="field.variable"
[contentlet]="contentlet"
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-block-editor
[formControlName]="field.variable"
[contentlet]="contentlet"
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.KEY_VALUE) {
<dot-edit-content-key-value
[formControlName]="field.variable"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-key-value
[formControlName]="field.variable"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.WYSIWYG) {
<dot-edit-content-wysiwyg-field
[field]="field"
[contentlet]="contentlet"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-wysiwyg-field
[field]="field"
[contentlet]="contentlet"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.HOST_FOLDER) {
<dot-edit-content-host-folder-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
@defer (on immediate) {
<dot-edit-content-host-folder-field
[field]="field"
[attr.data-testId]="'field-' + field.variable" />
}
}
@case (fieldTypes.CATEGORY) {
<dot-edit-content-category-field
[attr.data-testId]="'field-' + field.variable"
[contentlet]="contentlet"
[field]="field" />
@defer (on immediate) {
<dot-edit-content-category-field
[attr.data-testId]="'field-' + field.variable"
[contentlet]="contentlet"
[field]="field" />
}
}
@case (fieldTypes.FILE) {
<dot-edit-content-file-field
[formControlName]="field.variable"
[attr.data-testId]="'field-' + field.variable"
[field]="field" />
@defer (on immediate) {
<dot-edit-content-file-field
[formControlName]="field.variable"
[attr.data-testId]="'field-' + field.variable"
[field]="field" />
}
}
@case (fieldTypes.IMAGE) {
<dot-edit-content-file-field
[formControlName]="field.variable"
[attr.data-testId]="'field-' + field.variable"
[field]="field" />
@defer (on immediate) {
<dot-edit-content-file-field
[formControlName]="field.variable"
[attr.data-testId]="'field-' + field.variable"
[field]="field" />
}
}
}
@if (field.hint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ import { DotCMSContentlet, DotCMSContentTypeField } from '@dotcms/dotcms-models'
import { DotFieldRequiredDirective } from '@dotcms/ui';

import { DotEditContentBinaryFieldComponent } from '../../fields/dot-edit-content-binary-field/dot-edit-content-binary-field.component';
import { DotEditContentFieldsModule } from '../../fields/dot-edit-content-fields.module';
import { DotEditContentCalendarFieldComponent } from '../../fields/dot-edit-content-calendar-field/dot-edit-content-calendar-field.component';
import { DotEditContentCategoryFieldComponent } from '../../fields/dot-edit-content-category-field/dot-edit-content-category-field.component';
import { DotEditContentCheckboxFieldComponent } from '../../fields/dot-edit-content-checkbox-field/dot-edit-content-checkbox-field.component';
import { DotEditContentCustomFieldComponent } from '../../fields/dot-edit-content-custom-field/dot-edit-content-custom-field.component';
import { DotEditContentFileFieldComponent } from '../../fields/dot-edit-content-file-field/dot-edit-content-file-field.component';
import { DotEditContentHostFolderFieldComponent } from '../../fields/dot-edit-content-host-folder-field/dot-edit-content-host-folder-field.component';
import { DotEditContentJsonFieldComponent } from '../../fields/dot-edit-content-json-field/dot-edit-content-json-field.component';
import { DotEditContentKeyValueComponent } from '../../fields/dot-edit-content-key-value/dot-edit-content-key-value.component';
import { DotEditContentMultiSelectFieldComponent } from '../../fields/dot-edit-content-multi-select-field/dot-edit-content-multi-select-field.component';
import { DotEditContentRadioFieldComponent } from '../../fields/dot-edit-content-radio-field/dot-edit-content-radio-field.component';
import { DotEditContentSelectFieldComponent } from '../../fields/dot-edit-content-select-field/dot-edit-content-select-field.component';
import { DotEditContentTagFieldComponent } from '../../fields/dot-edit-content-tag-field/dot-edit-content-tag-field.component';
import { DotEditContentTextAreaComponent } from '../../fields/dot-edit-content-text-area/dot-edit-content-text-area.component';
import { DotEditContentTextFieldComponent } from '../../fields/dot-edit-content-text-field/dot-edit-content-text-field.component';
import { DotEditContentWYSIWYGFieldComponent } from '../../fields/dot-edit-content-wysiwyg-field/dot-edit-content-wysiwyg-field.component';
import { CALENDAR_FIELD_TYPES } from '../../models/dot-edit-content-field.constant';
import { FIELD_TYPES } from '../../models/dot-edit-content-field.enum';
Expand All @@ -27,7 +38,20 @@ import { FIELD_TYPES } from '../../models/dot-edit-content-field.enum';
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [
ReactiveFormsModule,
DotEditContentFieldsModule,
DotEditContentTextAreaComponent,
DotEditContentRadioFieldComponent,
DotEditContentSelectFieldComponent,
DotEditContentTextFieldComponent,
DotEditContentCalendarFieldComponent,
DotEditContentTagFieldComponent,
DotEditContentCheckboxFieldComponent,
DotEditContentMultiSelectFieldComponent,
DotEditContentBinaryFieldComponent,
DotEditContentJsonFieldComponent,
DotEditContentCustomFieldComponent,
DotEditContentWYSIWYGFieldComponent,
DotEditContentHostFolderFieldComponent,
DotEditContentCategoryFieldComponent,
DotFieldRequiredDirective,
BlockEditorModule,
DotEditContentBinaryFieldComponent,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createPipeFactory, SpectatorPipe } from '@ngneat/spectator';
import { createPipeFactory, SpectatorPipe } from '@ngneat/spectator/jest';

import { TruncatePathPipe } from './truncate-path.pipe';

Expand Down
3 changes: 2 additions & 1 deletion core-web/libs/portlets/dot-locales/portlet/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default {
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment'
]
],
testEnvironment: '@happy-dom/jest-environment'
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</tr>
</ng-template>
<ng-template pTemplate="body" let-locale>
<tr>
<tr (click)="store.openAddEditDialog(locale.id)" data-testId="locale-row">
<td [ngClass]="{ 'tag-padding': locale.defaultLanguage }" data-testId="locale-cell">
{{ locale.language }} ({{ locale.isoCode }})
@if (locale.defaultLanguage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,16 @@ describe('DotLocalesListComponent', () => {

expect(spectator.query('.p-tag-success')).toHaveText('Default');
});

it('should open AddEditDialog with locale id when row is clicked', () => {
spectator.detectChanges();

jest.spyOn(spectator.component.store, 'openAddEditDialog');

const row = spectator.query(byTestId('locale-row'));

spectator.click(row);

expect(spectator.component.store.openAddEditDialog).toHaveBeenCalled();
});
});
6 changes: 4 additions & 2 deletions core-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@ngrx/operators": "^17.2.0",
"@ngrx/signals": "^17.2.0",
"@nx/angular": "19.6.5",
"@storybook/addon-interactions": "^8.2.8",
"@tarekraafat/autocomplete.js": "^10.2.6",
"@tinymce/tinymce-angular": "^7.0.0",
"@tinymce/tinymce-react": "^5.1.1",
Expand Down Expand Up @@ -129,8 +130,7 @@
"tslib": "^2.3.0",
"uuid": "^9.0.0",
"webpack-dev-middleware": "^6.1.2",
"zone.js": "0.14.2",
"@storybook/addon-interactions": "^8.2.8"
"zone.js": "0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "18.2.3",
Expand All @@ -145,6 +145,7 @@
"@babel/preset-react": "^7.14.5",
"@compodoc/compodoc": "^1.1.24",
"@faker-js/faker": "8.4.1",
"@happy-dom/jest-environment": "^15.7.4",
"@materia-ui/ngx-monaco-editor": "^6.0.0",
"@mdx-js/react": "^2.1.2",
"@ngneat/spectator": "^19.0.0",
Expand Down Expand Up @@ -214,6 +215,7 @@
"fetch-mock": "^9.11.0",
"flatpickr": "^4.5.7",
"gh-pages": "^6.1.1",
"happy-dom": "^15.7.4",
"html-webpack-plugin": "^5.5.0",
"http-proxy-middleware": "^2.0.6",
"husky": "^7.0.0",
Expand Down
Loading

0 comments on commit 3ad703d

Please sign in to comment.