-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Boris Jenicek
committed
Dec 22, 2021
1 parent
b9fe9d2
commit b97e5b9
Showing
65 changed files
with
3,092 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,47 @@ | ||
# Class: ButtonMaker | ||
|
||
**`returns`** It will return custom button object ready to be used in child component layout. | ||
|
||
## Implements | ||
|
||
* [*IButton*](#/documentation/Interface:%20IButton) | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
\+ **new ButtonMaker**(`label`: *string*, `ID`: *string*, `layoutType?`: [*ButtonLayoutDisplay*](#/documentation/Enum:%20ButtonLayoutDisplay)): [*ButtonMaker*](#/documentation/Class:%20ButtonMaker) | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `label` | *string* | | ||
| `ID` | *string* | | ||
| `layoutType` | [*ButtonLayoutDisplay*](#/documentation/Enum:%20ButtonLayoutDisplay) | | ||
|
||
**Returns:** [*ButtonMaker*](#/documentation/Class:%20ButtonMaker) | ||
|
||
## Properties | ||
|
||
### ID | ||
|
||
• **ID**: *string* | ||
|
||
Implementation of: [IButton](#/documentation/Interface:%20IButton).[ID](#/documentation/Interface:%20IButton#id) | ||
|
||
___ | ||
|
||
### label | ||
|
||
• **label**: *string* | ||
|
||
Implementation of: [IButton](#/documentation/Interface:%20IButton).[label](#/documentation/Interface:%20IButton#label) | ||
|
||
___ | ||
|
||
### layoutType | ||
|
||
• **layoutType**: [*ButtonLayoutDisplay*](#/documentation/Enum:%20ButtonLayoutDisplay) | ||
|
||
Implementation of: [IButton](#/documentation/Interface:%20IButton).[layoutType](#/documentation/Interface:%20IButton#layouttype) |
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,70 @@ | ||
# Class: ConfirmBoxConfigModule | ||
|
||
This is the module that ignites Confirm box dialog, its purpose is to show popup in a | ||
small dialog window in the middle of the screen. User can provide title, message and include buttons. | ||
Confirm box is available in predefined layout types (enums): [DialogLayoutDisplay](#/documentation/Enum:%20DialogLayoutDisplay). | ||
|
||
It is crucial for user to add this module in angular.app imports. | ||
Below is the example with (optional) default user configuration, that's what will be used if there is no | ||
local config when popup is evoked, that means it can be overridden directly when popup is evoked. | ||
That mean it's predefined config, so it doesn't need to be configured each time when confirm box is evoked. | ||
For implementation look: [IConfirmBoxUserConfig](#/documentation/Interface:%20IConfirmBoxUserConfig). | ||
|
||
Example: | ||
```typescript | ||
// app.module imports: | ||
ConfirmBoxConfigModule.forRoot({ | ||
confirmBoxCoreConfig: { | ||
width: '700px', | ||
layoutType: DialogLayoutDisplay.DANGER, | ||
buttonPosition: 'center', // optional ' center', 'left', 'right' | ||
layoutType: DialogLayoutDisplay.SUCCESS, // SUCCESS | INFO | NONE | DANGER | WARNING | ||
animationIn: AppearanceAnimation.BOUNCE_IN, // BOUNCE_IN | SWING | ZOOM_IN | ZOOM_IN_ROTATE | ELASTIC | JELLO | FADE_IN | SLIDE_IN_UP | SLIDE_IN_DOWN | SLIDE_IN_LEFT | SLIDE_IN_RIGHT | NONE | ||
animationOut: DisappearanceAnimation.BOUNCE_OUT, // BOUNCE_OUT | ZOOM_OUT | ZOOM_OUT_WIND | ZOOM_OUT_ROTATE | FLIP_OUT | SLIDE_OUT_UP | SLIDE_OUT_DOWN | SLIDE_OUT_LEFT | SLIDE_OUT_RIGHT | NONE | ||
allowHtmlMessage: true, // default false | ||
disableIcon: true, // default false | ||
customStyles: { | ||
titleCSS: 'color: #ddd; background: #333; font-size: 20px; padding: 20px', | ||
buttonSectionCSS: 'background: #333', | ||
buttonCSS: 'font-size: 14px;', | ||
textCSS: 'color: #ddd; font-size: 16px; background: #333;', | ||
wrapperCSS: 'background: #333;' | ||
} | ||
}, | ||
dispatch: { // Optional default dispatch object. | ||
title: 'Default title', | ||
message: 'Default message' | ||
}, | ||
// optional predefined custom default buttons | ||
buttons : [ | ||
new ButtonMaker('Ok', 'ok', ButtonLayoutDisplay.PRIMARY), | ||
new ButtonMaker('Cancel', 'cancel', ButtonLayoutDisplay.SECONDARY) | ||
] | ||
}) | ||
``` | ||
* confirmBoxCoreConfig: [IConfirmBoxCoreConfig](#/documentation/Interface:%20IConfirmBoxCoreConfig) | ||
* dispatch: [IDispatch](#/documentation/Interface:%20IDispatch) | ||
* buttons: [IButton](#/documentation/Interface:%20IButton) | ||
* ButtonMaker: [ButtonMaker](#/documentation/Class:%20ButtonMaker) | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
\+ **new ConfirmBoxConfigModule**(): [*ConfirmBoxConfigModule*](#/documentation/Class:%20ConfirmBoxConfigModule) | ||
|
||
**Returns:** [*ConfirmBoxConfigModule*](#/documentation/Class:%20ConfirmBoxConfigModule) | ||
|
||
## Methods | ||
|
||
### forRoot | ||
|
||
▸ `Static`**forRoot**(`confirmBoxConfig?`: [*IConfirmBoxUserConfig*](#/documentation/Interface:%20IConfirmBoxUserConfig)): *ModuleWithProviders*<[*ConfirmBoxConfigModule*](#/documentation/Class:%20ConfirmBoxConfigModule)\> | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `confirmBoxConfig?` | [*IConfirmBoxUserConfig*](#/documentation/Interface:%20IConfirmBoxUserConfig) | | ||
|
||
**Returns:** *ModuleWithProviders*<[*ConfirmBoxConfigModule*](#/documentation/Class:%20ConfirmBoxConfigModule)\> |
136 changes: 136 additions & 0 deletions
136
docs/assets/angular-wiki/Class: ConfirmBoxInitializer.md
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,136 @@ | ||
# Class: ConfirmBoxInitializer | ||
|
||
This is the class that needs to be instantiated to set up and ignite a ConfirmBox and create content. | ||
Its purpose is to get confirmation response from end-user. It can be called from any angular | ||
typescript file. | ||
|
||
Below is example with (some optional) user configuration, | ||
it will override default configuration from app.module. | ||
|
||
Example: | ||
```typescript | ||
// Create the initializer. | ||
const newConfirmBox = new ConfirmBoxInitializer(); | ||
|
||
// Set desired dispatch: _Title: string, _Message: string. | ||
newConfirmBox.setDispatch('Are you sure?', 'That action will delete user!'); | ||
|
||
// Set desired configuration. | ||
newConfirmBox.setConfig({ | ||
layoutType: DialogLayoutDisplay.DANGER | ||
}); | ||
|
||
// Set button labels. | ||
newConfirmBox.setButtonLabels('YES', 'NO'); | ||
|
||
// Open a ConfirmBox, and get clicked button-id in response. | ||
newConfirmBox.openConfirmBox$().subscribe(resp => { | ||
// IConfirmBoxPublicResponse | ||
console.log('confirmBox response: ', resp); | ||
}); | ||
``` | ||
* IConfirmBoxCoreConfig: [IConfirmBoxCoreConfig](#/documentation/Interface:%20IConfirmBoxCoreConfig) | ||
* layoutType: [DialogLayoutDisplay](#/documentation/Enum:%20DialogLayoutDisplay) | ||
* IConfirmBoxPublicResponse: [IConfirmBoxPublicResponse](#/documentation/Interface:%20IConfirmBoxPublicResponse) | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
\+ **new ConfirmBoxInitializer**(): [*ConfirmBoxInitializer*](#/documentation/Class:%20ConfirmBoxInitializer) | ||
|
||
**Returns:** [*ConfirmBoxInitializer*](#/documentation/Class:%20ConfirmBoxInitializer) | ||
|
||
## Methods | ||
|
||
### openConfirmBox$ | ||
|
||
▸ **openConfirmBox$**(): *Observable*<[*IConfirmBoxPublicResponse*](#/documentation/Interface:%20IConfirmBoxPublicResponse)\> | ||
|
||
**Returns:** *Observable*<[*IConfirmBoxPublicResponse*](#/documentation/Interface:%20IConfirmBoxPublicResponse)\> | ||
|
||
___ | ||
|
||
### setButtonLabels | ||
|
||
▸ **setButtonLabels**(`_Confirm`: *string*, `_Decline?`: *string*): *void* | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `_Confirm` | *string* | | ||
| `_Decline?` | *string* | | ||
|
||
**Returns:** *void* | ||
|
||
___ | ||
|
||
### setButtons | ||
|
||
▸ **setButtons**(`_Buttons`: [*IButton*](#/documentation/Interface:%20IButton)[]): *void* | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `_Buttons` | [*IButton*](#/documentation/Interface:%20IButton)[] | | ||
|
||
**Returns:** *void* | ||
|
||
___ | ||
|
||
### setConfig | ||
|
||
▸ **setConfig**(`_ConfirmBoxCoreConfig`: [*IConfirmBoxCoreConfig*](#/documentation/Interface:%20IConfirmBoxCoreConfig)): *void* | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `_ConfirmBoxCoreConfig` | [*IConfirmBoxCoreConfig*](#/documentation/Interface:%20IConfirmBoxCoreConfig) | | ||
|
||
**Returns:** *void* | ||
|
||
___ | ||
|
||
### setDispatch | ||
|
||
▸ **setDispatch**(`_Title`: *string*, `_Message?`: *string*): *void* | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | Default value | | ||
| :------ | :------ | :------ | | ||
| `_Title` | *string* | - | | ||
| `_Message` | *string* | null | | ||
|
||
**Returns:** *void* | ||
|
||
___ | ||
|
||
### setMessage | ||
|
||
▸ **setMessage**(`_Message`: *string*): *void* | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `_Message` | *string* | | ||
|
||
**Returns:** *void* | ||
|
||
___ | ||
|
||
### setTitle | ||
|
||
▸ **setTitle**(`_Title`: *string*): *void* | ||
|
||
#### Parameters: | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `_Title` | *string* | | ||
|
||
**Returns:** *void* |
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,117 @@ | ||
# Class: DialogBelonging<CustomData\> | ||
|
||
This is the class that needs to be added as DI in the constructor of a child component that will be | ||
opened dynamically with [DialogInitializer](#/documentation/Class:%20DialogInitializer). It contains various information or | ||
event controllers, and listeners that can be used in a child component. Also, there is custom data | ||
that is sent from component where the [DialogInitializer](#/documentation/Class:%20DialogInitializer) is. User can set specific type of | ||
custom data that child component will receive by including it as generic type. | ||
|
||
Example: | ||
```typescript | ||
import {DialogBelonging} from 'ngx-awesome-popup'; | ||
@Component({ | ||
selector : 'app-dynamic', | ||
templateUrl: './dynamic.component.html', | ||
styleUrls : ['./dynamic.component.scss'] | ||
}) | ||
export class DynamicComponent implements OnInit, OnDestroy { | ||
|
||
subscriptions: Subscription = new Subscription(); | ||
|
||
constructor(@Inject('dialogBelonging') private dialogBelonging: DialogBelonging) {} | ||
|
||
ngOnInit(): void { | ||
console.log(this.dialogBelonging); | ||
|
||
this.subscriptions.add( | ||
this.dialogBelonging.eventsController.onButtonClick$.subscribe((_Button) => { | ||
if (_Button.ID === 'ok') { | ||
// Do some logic and close popup. | ||
this.dialogBelonging.eventsController.close(); | ||
} else if (_Button.ID === 'cancel') { | ||
// Do some logic and close popup. | ||
this.dialogBelonging.eventsController.close(); | ||
} | ||
}) | ||
); | ||
|
||
setTimeout(() => { | ||
// Close loader after async data is ready. | ||
this.dialogBelonging.eventsController.closeLoader(); | ||
}, 1000); | ||
} | ||
} | ||
|
||
ngOnDestroy(): void { | ||
// Close all subscriptions. | ||
this.subscriptions.unsubscribe(); | ||
} | ||
``` | ||
|
||
## Type parameters | ||
|
||
| Name | Default | | ||
| :------ | :------ | | ||
| `CustomData` | *any* | | ||
|
||
## Hierarchy | ||
|
||
* *DialogSettings* | ||
|
||
↳ **DialogBelonging** | ||
|
||
## Implements | ||
|
||
* *IDialogBelonging* | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
\+ **new DialogBelonging**<CustomData\>(): [*DialogBelonging*](#/documentation/Class:%20DialogBelonging)<CustomData\> | ||
|
||
#### Type parameters: | ||
|
||
| Name | Default | | ||
| :------ | :------ | | ||
| `CustomData` | *any* | | ||
|
||
**Returns:** [*DialogBelonging*](#/documentation/Class:%20DialogBelonging)<CustomData\> | ||
|
||
Overrides: DialogSettings.constructor | ||
|
||
## Properties | ||
|
||
### buttons | ||
|
||
• **buttons**: [*IButton*](#/documentation/Interface:%20IButton)[]= [] | ||
|
||
Implementation of: IDialogBelonging.buttons | ||
|
||
Inherited from: DialogSettings.buttons | ||
|
||
___ | ||
|
||
### customData | ||
|
||
• **customData**: CustomData= null | ||
|
||
Implementation of: IDialogBelonging.customData | ||
|
||
___ | ||
|
||
### dialogCoreConfig | ||
|
||
• **dialogCoreConfig**: [*IDialogCoreConfig*](#/documentation/Interface:%20IDialogCoreConfig) | ||
|
||
Implementation of: IDialogBelonging.dialogCoreConfig | ||
|
||
Inherited from: DialogSettings.dialogCoreConfig | ||
|
||
___ | ||
|
||
### eventsController | ||
|
||
• **eventsController**: [*IDialogeventsController*](#/documentation/Interface:%20IDialogeventsController) | ||
|
||
Implementation of: IDialogBelonging.eventsController |
Oops, something went wrong.