-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(calendar): Adding a template for igxCalendar #333
- Loading branch information
Showing
6 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
7 changes: 7 additions & 0 deletions
7
templates/angular/igx-ts/calendar/default/files/src/app/__path__/__name__.component.html
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,7 @@ | ||
<div igxLayout igxLayoutDir="columns" igxLayoutItemAlign="center"> | ||
<p>igx-calendar component</p> | ||
<p>You can read more about configuring the igx-calendar component in the | ||
<a href="https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/calendar/README.md" target="_blank">README</a> or the | ||
<a href="https://www.infragistics.com/products/ignite-ui-angular/angular/components/calendar.html" target="_blank">official documentation</a>.</p> | ||
<igx-calendar $(selectionType)></igx-calendar> | ||
</div> |
27 changes: 27 additions & 0 deletions
27
templates/angular/igx-ts/calendar/default/files/src/app/__path__/__name__.component.spec.ts
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,27 @@ | ||
import { async, TestBed, ComponentFixture } from '@angular/core/testing'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { $(ClassName)Component } from './$(filePrefix).component'; | ||
import { IgxCalendarModule } from 'igniteui-angular'; | ||
|
||
describe('$(ClassName)Component', () => { | ||
let component: $(ClassName)Component; | ||
let fixture: ComponentFixture<$(ClassName)Component>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [$(ClassName)Component], | ||
imports: [ IgxCalendarModule, NoopAnimationsModule] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent($(ClassName)Component); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
templates/angular/igx-ts/calendar/default/files/src/app/__path__/__name__.component.ts
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,14 @@ | ||
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-$(filePrefix)', | ||
templateUrl: './$(filePrefix).component.html', | ||
styleUrls: ['./$(filePrefix).component.css'], | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class $(ClassName)Component implements OnInit { | ||
|
||
constructor() { } | ||
|
||
public ngOnInit(): 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,60 @@ | ||
import { IgniteUIForAngularTemplate } from "../../../../../lib/templates/IgniteUIForAngularTemplate"; | ||
|
||
class IgxCalendarTemplate extends IgniteUIForAngularTemplate { | ||
private userExtraConfiguration: {} = {}; | ||
constructor() { | ||
super(__dirname); | ||
this.components = ["Calendar"]; | ||
this.controlGroup = "Scheduling"; | ||
this.listInComponentTemplates = true; | ||
this.id = "calendar"; | ||
this.projectType = "igx-ts"; | ||
this.name = "Calendar"; | ||
this.description = "IgxCalendar with single selection"; | ||
this.dependencies = [ | ||
{ import: "IgxCalendarModule", from: "igniteui-angular" } | ||
]; | ||
|
||
this.hasExtraConfiguration = true; | ||
} | ||
|
||
public setExtraConfiguration(extraConfigKeys: {}) { | ||
this.userExtraConfiguration = extraConfigKeys; | ||
} | ||
|
||
public getExtraConfiguration(): ControlExtraConfiguration[] { | ||
return [{ | ||
choices: ["Single selection", "Multi selection", "Range selection"], | ||
default: "Single selection", | ||
key: "selectionType", | ||
message: "Choose selection type for the igx-calendar", | ||
type: Enumerations.ControlExtraConfigType.Choice | ||
}]; | ||
} | ||
|
||
public generateFiles(projectPath: string, name: string, ...options: any[]): Promise<boolean> { | ||
let selectionType = ""; | ||
|
||
if (this.userExtraConfiguration["selectionType"]) { | ||
const type = this.userExtraConfiguration["selectionType"] as string; | ||
switch (type) { | ||
case "Single selection": | ||
selectionType = ""; | ||
break; | ||
case "Multi selection": | ||
selectionType = 'selection="multi"'; | ||
break; | ||
case "Range selection": | ||
selectionType = 'selection="range"'; | ||
break; | ||
} | ||
} | ||
|
||
const extraConfig = { | ||
"$(selectionType)": selectionType | ||
}; | ||
|
||
return super.generateFiles(projectPath, name, { extraConfig }); | ||
} | ||
} | ||
module.exports = new IgxCalendarTemplate(); |
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,14 @@ | ||
|
||
import { BaseComponent } from "../../../../lib/BaseComponent"; | ||
|
||
class IgxCalendarComponent extends BaseComponent { | ||
/** | ||
* | ||
*/ | ||
constructor() { | ||
super(__dirname); | ||
this.name = "Calendar"; | ||
this.group = "Scheduling"; | ||
} | ||
} | ||
module.exports = new IgxCalendarComponent(); |