Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): implement upload-collection in fundamental-ngx #6392

Merged
merged 23 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f07042a
feat(core): starting on upload collection
mikerodonnell89 Aug 19, 2021
b61898f
feat(core): some progress - why is ok button not disabled
mikerodonnell89 Aug 20, 2021
f16a091
feat(core): finishing touches and tests
mikerodonnell89 Aug 25, 2021
49cf624
feat(core): put back title container
mikerodonnell89 Aug 25, 2021
1272b0c
feat(core): hardcode styles for now
mikerodonnell89 Aug 26, 2021
4b41846
feat(core): fixing dependencies etc
mikerodonnell89 Aug 26, 2021
3abc7b9
feat(core): finish merge
mikerodonnell89 Aug 26, 2021
9727fba
feat(core): missed some things
mikerodonnell89 Aug 26, 2021
d4ee3eb
feat(core): remove doc test
mikerodonnell89 Aug 30, 2021
b210f87
feat(core): conflicts/merge
mikerodonnell89 Aug 31, 2021
b3a28fd
feat(core): pr comments
mikerodonnell89 Aug 31, 2021
1517022
feat(core): some additional PR comments and add a "complex" example u…
mikerodonnell89 Sep 2, 2021
03105d7
feat(core): wrong selector in example
mikerodonnell89 Sep 2, 2021
4c71498
feat(core): fix multiple delete function
mikerodonnell89 Sep 2, 2021
5777f77
feat(core): cleanup complex example
mikerodonnell89 Sep 2, 2021
fa4cf28
feat(core): stopPropagation on example buttons/input
mikerodonnell89 Sep 3, 2021
4f8e11d
feat(core): conflicts
mikerodonnell89 Sep 8, 2021
03d9c82
feat(core): fix ok button disabling, updating css
mikerodonnell89 Sep 9, 2021
d900377
feat(core): move some files to folders
mikerodonnell89 Sep 9, 2021
7999609
feat(core): fix conflicts
mikerodonnell89 Sep 9, 2021
69ac38f
feat(core): fix test
mikerodonnell89 Sep 9, 2021
83b621b
feat(core): underscores for hidden but public functions/variables
mikerodonnell89 Sep 10, 2021
95964ad
feat(core): put back custom CSS for object stqatuses
mikerodonnell89 Sep 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -4050,6 +4050,50 @@
}
}
}
},
"core-upload-collection": {
"projectType": "library",
"root": "libs/core/src/lib/upload-collection",
"sourceRoot": "libs/core/src/lib/upload-collection",
"prefix": "fd",
"architect": {
"build": {
"builder": "@nrwl/angular:package",
"outputs": [
"dist/libs/core/upload-collection"
],
"options": {
"tsConfig": "libs/core/src/lib/upload-collection/tsconfig.lib.json",
"project": "libs/core/src/lib/upload-collection/ng-package.json",
"updateBuildableProjectDepsInPackageJson": false
},
"configurations": {
"production": {
"tsConfig": "libs/core/src/lib/upload-collection/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "libs/core/src/lib/upload-collection/test.ts",
"tsConfig": "libs/core/src/lib/upload-collection/tsconfig.spec.json",
"karmaConfig": "libs/core/src/lib/upload-collection/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/core/src/lib/upload-collection/tsconfig.lib.json",
"libs/core/src/lib/upload-collection/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "docs",
Expand Down
12 changes: 12 additions & 0 deletions apps/docs/src/app/core/api-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,16 @@ export const API_FILES = {
'ResizableCardLayoutComponent',
'ResizableCardItemComponent'
],
uploadCollection: [
'UploadCollectionComponent',
'UploadCollectionButtonGroupComponent',
'UploadCollectionFormItemComponent',
'UploadCollectionItemDirective',
'UploadCollectionThumbnailDirective',
'UploadCollectionTitleDirective',
'UploadCollectionDescriptionDirective',
'UploadCollectionTextSeparatorDirective',
'UploadCollectionStatusGroupDirective',
'UploadCollectionTitleContainerDirective'
]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<fd-upload-collection>
<li
fd-list-item
fd-upload-collection-item
*ngFor="let file of files"
[fileName]="file.fileName"
[extension]="file.extension"
(deleteClicked)="deleteClicked($event, file)"
(fileNameChanged)="fileNameChanged($event)"
>
<span fd-list-thumbnail fd-upload-collection-thumbnail><fd-icon [glyph]="file.icon"></fd-icon></span>
<div fd-list-content>
<div fd-upload-collection-title-container>
<a href="#" fd-link fd-list-title fd-upload-collection-title></a>
<fd-upload-collection-form-item></fd-upload-collection-form-item>
<span
*ngIf="file.marker1"
fd-object-marker
[glyph]="file.marker1"
title="Favorite"
aria-label="Favorite Icon"
></span>
<span
*ngIf="file.marker2"
fd-object-marker
[glyph]="file.marker2"
title="Flag"
aria-label="Favorite Flag"
></span>
</div>
<div fd-upload-collection-description>
This is the file description
<span fd-upload-collection-text-separator></span>
This is an additional description
</div>
<div fd-upload-collection-status-group>
<span
fd-object-status
status="negative"
label="Negative Object Status"
title="Object status Negative"
aria-label="Object status Negative"
></span>
<span fd-upload-collection-text-separator></span>
<span
fd-object-status
status="positive"
label="Positive Object Status"
title="Object status Positive"
aria-label="Object status Positive"
></span>
</div>
</div>
<fd-upload-collection-button-group
[allowFileDeletion]="file.allowDelete"
[allowFileNameEdit]="file.allowEdit"
[disableFileDeletion]="file.disableDeletion"
[disableFileNameEdit]="file.disableEdit"
></fd-upload-collection-button-group>
</li>
</fd-upload-collection>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Component, ContentChildren, QueryList } from '@angular/core';
import { UploadCollectionItemDirective } from '@fundamental-ngx/core';

@Component({
selector: 'fd-upload-collection-custom-example',
templateUrl: './upload-collection-custom-example.component.html'
})
export class UploadCollectionCustomExampleComponent {
files = [
{
fileName: 'File_Name_1',
extension: 'txt',
icon: 'activate',
allowEdit: false,
allowDelete: false,
marker1: 'flag',
marker2: 'add-favorite'
},
{
fileName: 'File_Name_2',
extension: 'jpg',
icon: 'calendar',
allowEdit: true,
allowDelete: true,
disableEdit: true,
disableDeletion: true
},
{ fileName: 'File_Name_3', extension: 'pdf', icon: 'customer', allowEdit: true, allowDelete: false }
];

@ContentChildren(UploadCollectionItemDirective, { descendants: true })
uploadCollectionItems: QueryList<UploadCollectionItemDirective>;

fileNameChanged(event: UploadCollectionItemDirective): void {
window.alert('User has updated the file name to ' + event.fileName);
}

deleteClicked(event: UploadCollectionItemDirective, file: any): void {
window.alert('User has deleted the file ' + event.fileName + '.' + event.extension);
this.files.splice(this.files.indexOf(file), 1);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<fd-message-page glyph="attachment" *ngIf="!items.length">
<fd-message-page-title>No files found. </fd-message-page-title>
<fd-message-page-subtitle> Drop files to upload, or use the "+" button. </fd-message-page-subtitle>
</fd-message-page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';

@Component({
selector: 'fd-upload-collection-empty-example',
templateUrl: './upload-collection-empty-example.component.html'
})
export class UploadCollectionEmptyExampleComponent {
items = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<fd-upload-collection>
<li
fd-list-item
fd-upload-collection-item
*ngFor="let file of files"
[fileName]="file.fileName"
[extension]="file.extension"
(deleteClicked)="deleteClicked($event, file)"
(fileNameChanged)="fileNameChanged($event)"
>
<span fd-list-thumbnail fd-upload-collection-thumbnail><fd-icon [glyph]="file.icon"></fd-icon></span>
<div fd-list-content>
<div fd-upload-collection-title-container>
<a href="#" fd-link fd-list-title fd-upload-collection-title></a>
<fd-upload-collection-form-item></fd-upload-collection-form-item>
<span
*ngIf="file.marker1"
fd-object-marker
[glyph]="file.marker1"
title="Favorite"
aria-label="Favorite Icon"
></span>
<span
*ngIf="file.marker2"
fd-object-marker
[glyph]="file.marker2"
title="Flag"
aria-label="Favorite Flag"
></span>
</div>
<div fd-upload-collection-description>
This is the file description
<span fd-upload-collection-text-separator></span>
This is an additional description
</div>
<div fd-upload-collection-status-group>
<span
fd-object-status
status="negative"
label="Negative Object Status"
title="Object status Negative"
aria-label="Object status Negative"
></span>
<span fd-upload-collection-text-separator></span>
<span
fd-object-status
status="positive"
label="Positive Object Status"
title="Object status Positive"
aria-label="Object status Positive"
></span>
</div>
</div>
<fd-upload-collection-button-group></fd-upload-collection-button-group>
</li>
</fd-upload-collection>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Component, ContentChildren, QueryList } from '@angular/core';
import { UploadCollectionItemDirective } from '@fundamental-ngx/core';

@Component({
selector: 'fd-upload-collection-example',
templateUrl: './upload-collection-example.component.html'
})
export class UploadCollectionExampleComponent {
files = [
{ fileName: 'File_Name_1', extension: 'txt', icon: 'activate' },
{ fileName: 'File_Name_2', extension: 'jpg', icon: 'calendar', marker1: 'flag', marker2: 'add-favorite' },
{ fileName: 'File_Name_3', extension: 'pdf', icon: 'customer' }
];

@ContentChildren(UploadCollectionItemDirective, { descendants: true })
uploadCollectionItems: QueryList<UploadCollectionItemDirective>;

fileNameChanged(event: UploadCollectionItemDirective): void {
window.alert('User has updated the file name to ' + event.fileName);
}

deleteClicked(event: UploadCollectionItemDirective, file: any): void {
window.alert('User has deleted the file ' + event.fileName + '.' + event.extension);
this.files.splice(this.files.indexOf(file), 1);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<div style="width: 29.5rem">
<fd-upload-collection [small]="true">
<li
fd-list-item
fd-upload-collection-item
*ngFor="let file of files"
[fileName]="file.fileName"
[extension]="file.extension"
(deleteClicked)="deleteClicked($event, file)"
(fileNameChanged)="fileNameChanged($event)"
>
<span fd-list-thumbnail fd-upload-collection-thumbnail><fd-icon [glyph]="file.icon"></fd-icon></span>
<div fd-list-content>
<div fd-upload-collection-title-container>
<a href="#" fd-link fd-list-title fd-upload-collection-title></a>
<fd-upload-collection-form-item></fd-upload-collection-form-item>
<span
*ngIf="file.marker1"
fd-object-marker
[glyph]="file.marker1"
title="Favorite"
aria-label="Favorite Icon"
></span>
<span
*ngIf="file.marker2"
fd-object-marker
[glyph]="file.marker2"
title="Flag"
aria-label="Favorite Flag"
></span>
</div>
<div fd-upload-collection-description>
This is the file description
<span fd-upload-collection-text-separator></span>
This is an additional description
</div>
<div fd-upload-collection-status-group>
<span
fd-object-status
status="negative"
label="Negative Object Status"
title="Object status Negative"
aria-label="Object status Negative"
></span>
<span fd-upload-collection-text-separator></span>
<span
fd-object-status
status="positive"
label="Positive Object Status"
title="Object status Positive"
aria-label="Object status Positive"
></span>
</div>
</div>
<fd-upload-collection-button-group></fd-upload-collection-button-group>
</li>
</fd-upload-collection>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Component, ContentChildren, QueryList } from '@angular/core';
import { UploadCollectionItemDirective } from '@fundamental-ngx/core';

@Component({
selector: 'fd-upload-collection-small-example',
templateUrl: './upload-collection-small-example.component.html'
})
export class UploadCollectionSmallExampleComponent {
files = [
{ fileName: 'File_Name_1', extension: 'txt', icon: 'activate' },
{ fileName: 'File_Name_2', extension: 'jpg', icon: 'calendar' },
{ fileName: 'File_Name_3', extension: 'pdf', icon: 'customer', marker1: 'flag', marker2: 'add-favorite' }
];

@ContentChildren(UploadCollectionItemDirective, { descendants: true })
uploadCollectionItems: QueryList<UploadCollectionItemDirective>;

fileNameChanged(event: UploadCollectionItemDirective): void {
window.alert('User has updated the file name to ' + event.fileName);
}

deleteClicked(event: UploadCollectionItemDirective, file: any): void {
window.alert('User has deleted the file ' + event.fileName + '.' + event.extension);
this.files.splice(this.files.indexOf(file), 1);
}
}
Loading