
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@iapps/ngx-dhis2-period-filter
Advanced tools
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0.
This library was generated with Angular CLI version 7.2.0.
npm i @iapps/ngx-dhis2-period-filter --save
ngx-dhis2-period-filter
provides three period selection types
1. Import NgxDhis2PeriodFilterModule
.........
import { NgxDhis2PeriodFilterModule } from '@iapps/ngx-dhis2-period-filter';
........
@NgModule({
declarations: [AppComponent],
imports: [
..........
NgxDhis2PeriodFilterModule
.......
]
......
})
2. Injecting into components.ts to use
.........
@Component({
selector: 'app-period-filter',
templateUrl: './period-filter.component.html',
styleUrls: ['./period-filter.component.scss']
})
export class PeriodFilterComponent {
periodFilterConfig: any = {
singleSelection: true,
emitOnSelection: false,
childrenPeriodSortOrder: 'ASC',
allowDateRangeSelection: true,
allowRelativePeriodSelection: true,
allowFixedPeriodSelection: true
};
selectedPeriodItems: any[] = [
{
id: '201102',
type: 'Monthly',
name: 'February 2011'
},
{
id: '201101',
type: 'Monthly',
name: 'January 2011'
}
];
........
onPeriodUpdate(periodObject, action) {
this.periodObject = periodObject; // see on example of outputs
this.action = action; // See on example outputs
}
}
3. Injecting into components.html to use The selection period types to be see depends on the setting of the configuration, just set it true to allow a required selection type (Fixed, Relative or Range)
<div>
<ngx-dhis2-period-filter
[selectedPeriods]="selectedPeriodItems"
[periodFilterConfig]="periodFilterConfig"
[selectedPeriodType]="'Monthly'"
(update)="onPeriodUpdate($event, 'UPDATE')"
(change)="onPeriodUpdate($event, 'CHANGE')"
(close)="onPeriodUpdate($event, 'CLOSE')"
>
</ngx-dhis2-period-filter>
</div>
Others
allowFixedPeriodSelection: true
)<div>
<ngx-dhis2-period-filter
[selectedPeriods]="selectedPeriodItems"
[periodFilterConfig]="periodFilterConfig"
[selectedPeriodType]="'Relative Year'"
(update)="onPeriodUpdate($event, 'UPDATE')"
(change)="onPeriodUpdate($event, 'CHANGE')"
(close)="onPeriodUpdate($event, 'CLOSE')"
>
</ngx-dhis2-period-filter>
</div>
allowRelativePeriodSelection: true
)<div>
<ngx-dhis2-period-filter
[selectedPeriods]="selectedPeriodItems"
[periodFilterConfig]="periodFilterConfig"
[selectedPeriodType]="'Relative Year'"
(update)="onPeriodUpdate($event, 'UPDATE')"
(change)="onPeriodUpdate($event, 'CHANGE')"
(close)="onPeriodUpdate($event, 'CLOSE')"
>
</ngx-dhis2-period-filter>
</div>
allowDateRangeSelection: true
)<div>
<ngx-dhis2-period-filter
[selectedPeriods]="selectedPeriodItems"
[periodFilterConfig]="periodFilterConfig"
(update)="onPeriodUpdate($event, 'UPDATE')"
(change)="onPeriodUpdate($event, 'CHANGE')"
(close)="onPeriodUpdate($event, 'CLOSE')"
>
</ngx-dhis2-period-filter>
</div>
4. Sample outputs
Example 1: Fixed periods
UPDATE
{
"items": [
{
"id": "201109",
"type": "Monthly",
"name": "Genbot 2011"
},
{
"id": "201108",
"type": "Monthly",
"name": "Miazia 2011"
},
{
"id": "201107",
"type": "Monthly",
"name": "Megabit 2011"
},
{
"id": "201106",
"type": "Monthly",
"name": "Yekatit 2011"
}
],
"dimension": "pe",
"changed": true
}
```
Example 2: Relative periods
UPDATE
{
"items": [
{
"id": "LAST_6_MONTHS",
"type": "RelativeMonth",
"name": "Last 6 Months"
}
],
"dimension": "pe",
"changed": true
}
```
Example 3: Range periods
UPDATE
{
"items": [
{
"id": "dates-range",
"type": "dates-range",
"name": "2020-04-01 to 2020-05-22",
"dimension": "ou",
"startDate": {
"id": "2020-04-01",
"name": "2020-04-01"
},
"endDate": {
"id": "2020-05-22",
"name": "2020-05-22"
}
}
],
"dimension": "pe",
"changed": true
}
```
5. Setting Default filter type The selection period filter type determines which periods filter type to load by default when the period filter is opened(Fixed, Relative or Range)
<div>
<ngx-dhis2-period-filter
[selectedPeriods]="selectedPeriodItems"
[periodFilterConfig]="periodFilterConfig"
[selectedPeriodFilterType] = "'Range'"
(update)="onPeriodUpdate($event, 'UPDATE')"
(change)="onPeriodUpdate($event, 'CHANGE')"
(close)="onPeriodUpdate($event, 'CLOSE')"
>
</ngx-dhis2-period-filter>
</div>
FAQs
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0.
The npm package @iapps/ngx-dhis2-period-filter receives a total of 4 weekly downloads. As such, @iapps/ngx-dhis2-period-filter popularity was classified as not popular.
We found that @iapps/ngx-dhis2-period-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.