-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(edit-content) add selected component in sidebar, remove item and…
… clear all button #28493
- Loading branch information
Showing
12 changed files
with
408 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...y-field/components/dot-category-field-selected/dot-category-field-selected.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<ul class="category-list"> | ||
@for (category of $categories(); track category.key) { | ||
<li class="category-list__item" @fadeAnimation> | ||
<div class="category-list__item-content"> | ||
<div class="category-list__title">{{ category.value }}</div> | ||
<div class="category-list__path"> | ||
<span | ||
[pTooltip]="category.path" | ||
tooltipPosition="top" | ||
class="category-list__path-content"> | ||
{{ category.path }} | ||
</span> | ||
</div> | ||
</div> | ||
|
||
<div class="category-list__remove"> | ||
<button | ||
(click)="removeItem.emit(category.key)" | ||
icon="pi pi-times" | ||
class="p-button-sm p-button-text p-button-secondary" | ||
data-testId="category-list__remove-btn" | ||
pButton></button> | ||
</div> | ||
</li> | ||
|
||
} @empty { | ||
<li>No Categories selected</li> | ||
} | ||
</ul> |
57 changes: 57 additions & 0 deletions
57
...y-field/components/dot-category-field-selected/dot-category-field-selected.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@use "variables" as *; | ||
|
||
.category-list { | ||
list-style: none; | ||
padding: $spacing-3; | ||
margin: 0; | ||
} | ||
|
||
.category-list__item { | ||
display: grid; | ||
grid-template-columns: 1fr 40px; | ||
align-items: center; | ||
padding: $spacing-1 0; | ||
border-bottom: 1px solid $color-palette-gray-300; | ||
} | ||
|
||
.category-list__item-content { | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
overflow: hidden; | ||
gap: $spacing-1; | ||
flex-direction: column; | ||
} | ||
|
||
.category-list__title { | ||
color: $black; | ||
font-size: $font-size-smd; | ||
font-weight: $font-weight-medium-bold; | ||
flex-shrink: 0; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.category-list__path { | ||
flex-grow: 1; | ||
overflow: hidden; | ||
} | ||
|
||
.category-list__path-content { | ||
font-size: $font-size-smd; | ||
color: $color-palette-gray-700; | ||
font-weight: $font-weight-regular-bold; | ||
display: block; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
|
||
.category-list__remove { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} |
58 changes: 58 additions & 0 deletions
58
...ory-field/components/dot-category-field-selected/dot-category-field-selected.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { animate, state, style, transition, trigger } from '@angular/animations'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component, EventEmitter, input, Output } from '@angular/core'; | ||
|
||
import { ButtonModule } from 'primeng/button'; | ||
import { ChipModule } from 'primeng/chip'; | ||
import { TooltipModule } from 'primeng/tooltip'; | ||
|
||
import { DotMessagePipe } from '@dotcms/ui'; | ||
|
||
import { DotCategoryFieldKeyValueObj } from '../../models/dot-category-field.models'; | ||
import { DotCategoryFieldSearchListComponent } from '../dot-category-field-search-list/dot-category-field-search-list.component'; | ||
|
||
@Component({ | ||
selector: 'dot-category-field-selected', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
ButtonModule, | ||
DotMessagePipe, | ||
DotCategoryFieldSearchListComponent, | ||
ChipModule, | ||
TooltipModule | ||
], | ||
templateUrl: './dot-category-field-selected.component.html', | ||
styleUrl: './dot-category-field-selected.component.scss', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
animations: [ | ||
trigger('fadeAnimation', [ | ||
state( | ||
'void', | ||
style({ | ||
opacity: 0 | ||
}) | ||
), | ||
transition(':enter, :leave', [animate('50ms ease-in-out')]) | ||
]) | ||
] | ||
}) | ||
export class DotCategoryFieldSelectedComponent { | ||
/** | ||
* Represents the array of selected categories. | ||
*/ | ||
$categories = input<DotCategoryFieldKeyValueObj[]>([], { | ||
alias: 'categories' | ||
}); | ||
|
||
@Output() | ||
removeItem = new EventEmitter<string>(); | ||
|
||
private convertPathToArray(path: string): string[] { | ||
if (!path) { | ||
return []; | ||
} | ||
|
||
return path.split(' / '); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.