1.0.11 • Published 3 years ago
@aliasghar.ahmed/share-lib v1.0.11
Share-Lib
This library was generated with Angular CLI version 11.0.5.
Installation
npm install @aliasghar.ahmed/share-lib --save
Dependencies
This library has the following peer dependencies.
- "@angular/cdk": "^11.0.0",
- "@angular/common": "~11.0.2",
- "@angular/core": "^11.0.2",
- "@angular/elements": "^11.0.5",
- "@angular/router": "~11.0.2",
- "@angular/forms": "~11.0.2",
- "@circlon/angular-tree-component": "^10.0.1",
- "@ng-bootstrap/ng-bootstrap": "^7.0.0",
- "bootstrap": "^4.5.2"
If your application has all the above dependencies installed then add them in the root tsconfig.json under the path. e.g
- "@angular/": [ "./node_modules/@angular/" ],
This mapping ensures that the library always loads the local copies of the modules it needs.
Example usage
To enable the share library import "ShareLibModule" in your module.
import { ShareLibModule } from 'share-lib';
@NgModule({
declarations: [
.....
],
imports: [
.....
ShareLibModule
],
providers: [
...
],
exports: [
...
],
bootstrap: [..]
})
export class YourModule {}
Add the following element to your HTML for enabling share dialog popup.
<lib-share-dialog (onShareComplete)="onShare($event)" (onShareClose)="onClose($event)" [shareOptions]="shareOptions"></lib-share-dialog>
Inputs
Name | Description |
---|---|
shareOptions | This is a JSON provided to the share library.All the JSON properties are explained below. |
Json structure for share Input.
this.shareOptions = {
objectId: '', // Can be empty now. For future customizations component can use this property
objectType: '', // Can be empty now. For future customizations component can use this property
shareData: {
hideEditOption: false, // boolean to hide edit checkbox
disableUserSelection: false, // boolean to disable user selection
showTeams: true, // boolean to show teams
showNotifyEmail: false, // boolean to show notify email option
serviceUrl: LD_SERVICE_URL, // LD Service URL (https://advantageqa2.iriworldwide.com/ld_engg)
parentClass: 'web-share-dialog', // custom class to handle css by hosting app
readGroups: [1024], // Existing share details of the object, list of groups with only Read access
editGroups: [], // Existing share details of the object, list of groups with write access, leave it empty if not applicable
readUsers: ['zp8k4'], // Existing share details of the object, list of users with only Read access
editUsers: [], // Existing share details of the object, list of users with write access, leave it empty if not applicable
readUsersDetails: [{"userId":"zp8k4","mobileNumber":"0015999","avatar":"zp8k4_1642007974000.png","emailId":"Abhishek.Singh@infores.com","groups":[1221],"clientId":0,"allowChangePassword":true,"fName":"Abhishek","lName":"Singh","passwordExpiryDt":0}], // Existing share details of the object, details of the list of users with read access
editUsersDetails: [], // Existing share details of the object, details of the list of users with write access
styles: {
'z-index': 7500 // external styling option to handle modal-dialog
},
}
}
Outputs
Name | Function Name | Description |
---|---|---|
onShareComplete | onShare | This function will emit json object(shared data) when user clicks on share button in the popup |
onShareClose | onClose | This function will emit the closure event of popup basically when user clicks on 'X' or 'Cancel' in the popup. |