feat(directory-picker): add selection actions for folders, add buttons for select all, deselect all, and select current folder (#2293)
Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
@@ -651,7 +651,9 @@
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
padding-right: 0.25rem;
|
padding-right: 0.25rem;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
@@ -685,6 +687,10 @@
|
|||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
min-height: 70px;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
border-color: var(--primary-color);
|
border-color: var(--primary-color);
|
||||||
@@ -702,6 +708,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
.folder-icon-wrapper {
|
.folder-icon-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -711,6 +718,7 @@
|
|||||||
height: 38px;
|
height: 38px;
|
||||||
background: var(--overlay-background);
|
background: var(--overlay-background);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
.folder-icon {
|
.folder-icon {
|
||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
@@ -741,8 +749,9 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.25rem;
|
gap: 0.375rem;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.folder-path {
|
.folder-path {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
@@ -751,6 +760,8 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
max-width: 100%;
|
||||||
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.folder-meta {
|
.folder-meta {
|
||||||
@@ -759,19 +770,27 @@
|
|||||||
gap: 0.25rem;
|
gap: 0.25rem;
|
||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
color: var(--text-secondary-color);
|
color: var(--text-secondary-color);
|
||||||
|
line-height: 1.3;
|
||||||
|
|
||||||
i {
|
i {
|
||||||
font-size: 0.6875rem;
|
font-size: 0.6875rem;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .p-button {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
|||||||
+36
@@ -44,6 +44,42 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="selection-actions">
|
||||||
|
<p-button
|
||||||
|
label="Select All"
|
||||||
|
icon="pi pi-check-square"
|
||||||
|
severity="secondary"
|
||||||
|
[outlined]="true"
|
||||||
|
size="small"
|
||||||
|
(click)="selectAll()"
|
||||||
|
[disabled]="filteredPaths.length === 0"
|
||||||
|
pTooltip="Select all visible folders"
|
||||||
|
tooltipPosition="bottom"
|
||||||
|
/>
|
||||||
|
<p-button
|
||||||
|
label="Deselect All"
|
||||||
|
icon="pi pi-times-circle"
|
||||||
|
severity="secondary"
|
||||||
|
[outlined]="true"
|
||||||
|
size="small"
|
||||||
|
(click)="deselectAll()"
|
||||||
|
[disabled]="selectedFolders.length === 0"
|
||||||
|
pTooltip="Clear all selections"
|
||||||
|
tooltipPosition="bottom"
|
||||||
|
/>
|
||||||
|
<p-button
|
||||||
|
label="Select Current"
|
||||||
|
icon="pi pi-folder"
|
||||||
|
severity="info"
|
||||||
|
[outlined]="true"
|
||||||
|
size="small"
|
||||||
|
(click)="selectCurrent()"
|
||||||
|
[disabled]="!selectedProductName || selectedProductName === '/'"
|
||||||
|
pTooltip="Select the current directory"
|
||||||
|
tooltipPosition="bottom"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
@if (selectedFolders.length > 0) {
|
@if (selectedFolders.length > 0) {
|
||||||
<div class="selection-badge">
|
<div class="selection-badge">
|
||||||
<i class="pi pi-check-circle"></i>
|
<i class="pi pi-check-circle"></i>
|
||||||
|
|||||||
+35
-8
@@ -14,10 +14,13 @@
|
|||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
height: 80vh;
|
||||||
|
max-height: 900px;
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
height: 90vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +101,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selection-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
::ng-deep .p-button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.selection-badge {
|
.selection-badge {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -145,14 +163,12 @@
|
|||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-top: none;
|
border-top: none;
|
||||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||||
min-height: 500px;
|
flex: 1;
|
||||||
max-height: 500px;
|
min-height: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
min-height: 300px;
|
|
||||||
max-height: 400px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,11 +294,13 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding-right: 0.25rem;
|
padding-right: 0.25rem;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transition: opacity 0.3s ease-in-out;
|
transition: opacity 0.3s ease-in-out;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
&.loading {
|
&.loading {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -330,7 +348,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
padding: 0.75rem 1rem;
|
padding: 0.875rem 1rem;
|
||||||
background: var(--ground-background);
|
background: var(--ground-background);
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
@@ -338,6 +356,10 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
animation: fadeInItem 0.3s ease-out forwards;
|
animation: fadeInItem 0.3s ease-out forwards;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
min-height: 70px;
|
||||||
|
|
||||||
@for $i from 1 through 20 {
|
@for $i from 1 through 20 {
|
||||||
&:nth-child(#{$i}) {
|
&:nth-child(#{$i}) {
|
||||||
@@ -407,8 +429,9 @@
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.25rem;
|
gap: 0.375rem;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.directory-name {
|
.directory-name {
|
||||||
font-size: 0.9375rem;
|
font-size: 0.9375rem;
|
||||||
@@ -417,6 +440,8 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
max-width: 100%;
|
||||||
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.directory-path {
|
.directory-path {
|
||||||
@@ -426,6 +451,8 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
max-width: 100%;
|
||||||
|
line-height: 1.3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,8 +505,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dialog-footer {
|
.dialog-footer {
|
||||||
@include panel.dialog-footer;
|
@include panel.dialog-footer;
|
||||||
border-top: none;
|
border-top: 1px solid var(--border-color);
|
||||||
|
|
||||||
.selection-info {
|
.selection-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -150,6 +150,30 @@ export class DirectoryPickerComponent implements OnInit {
|
|||||||
this.dynamicDialogRef.close(null);
|
this.dynamicDialogRef.close(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectAll(): void {
|
||||||
|
this.filteredPaths.forEach(folder => {
|
||||||
|
if (!this.selectedFolders.includes(folder)) {
|
||||||
|
this.selectedFolders.push(folder);
|
||||||
|
}
|
||||||
|
this.selectedFoldersMap[folder] = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deselectAll(): void {
|
||||||
|
this.selectedFolders = [];
|
||||||
|
Object.keys(this.selectedFoldersMap).forEach(key => {
|
||||||
|
this.selectedFoldersMap[key] = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
selectCurrent(): void {
|
||||||
|
const currentPath = this.selectedProductName || '/';
|
||||||
|
if (!this.selectedFolders.includes(currentPath)) {
|
||||||
|
this.selectedFolders.push(currentPath);
|
||||||
|
}
|
||||||
|
this.selectedFoldersMap[currentPath] = true;
|
||||||
|
}
|
||||||
|
|
||||||
getFolderName(path: string): string {
|
getFolderName(path: string): string {
|
||||||
return path.split('/').filter(p => p).pop() || path;
|
return path.split('/').filter(p => p).pop() || path;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user