-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Date/time picker: action buttons customization (#4942)
* feat(pickers): custom buttons functionality #4647 * chore(*): fix lint errors #4647 * chore(*): remove trailing white space #4647 * feat(pickers): add custom styling ability #4647 * feat(pickers): remove css and unify retemplating approach #4647 * chore(*): update README.md and CHANGELOG.md #4647 * chore(*): address some review comments #4647 * chore(*): more code improvements #4647 * fix(time-picker): Fixed failing test #4942 * chore(*): update code snippet in README.md #4647 * fix(*): build error #4647
- Loading branch information
Showing
23 changed files
with
507 additions
and
52 deletions.
There are no files selected for viewing
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
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
37 changes: 37 additions & 0 deletions
37
projects/igniteui-angular/migrations/update-7_3_4/changes/outputs.json
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,37 @@ | ||
{ | ||
"$schema": "../../common/schema/binding.schema.json", | ||
"changes": [ | ||
{ | ||
"name": "onOpen", | ||
"replaceWith": "onOpened", | ||
"owner": { | ||
"selector": "igx-time-picker", | ||
"type": "component" | ||
} | ||
}, | ||
{ | ||
"name": "onClose", | ||
"replaceWith": "onClosed", | ||
"owner": { | ||
"selector": "igx-time-picker", | ||
"type": "component" | ||
} | ||
}, | ||
{ | ||
"name": "onOpen", | ||
"replaceWith": "onOpened", | ||
"owner": { | ||
"selector": "igx-date-picker", | ||
"type": "component" | ||
} | ||
}, | ||
{ | ||
"name": "onClose", | ||
"replaceWith": "onClosed", | ||
"owner": { | ||
"selector": "igx-date-picker", | ||
"type": "component" | ||
} | ||
} | ||
] | ||
} |
54 changes: 54 additions & 0 deletions
54
projects/igniteui-angular/migrations/update-7_3_4/index.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,54 @@ | ||
import * as path from 'path'; | ||
|
||
// tslint:disable:no-implicit-dependencies | ||
import { virtualFs } from '@angular-devkit/core'; | ||
import { EmptyTree } from '@angular-devkit/schematics'; | ||
// tslint:disable-next-line:no-submodule-imports | ||
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; | ||
|
||
describe('Update 7.3.4', () => { | ||
let appTree: UnitTestTree; | ||
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json')); | ||
const configJson = { | ||
defaultProject: 'testProj', | ||
projects: { | ||
testProj: { | ||
sourceRoot: '/testSrc' | ||
} | ||
}, | ||
schematics: { | ||
'@schematics/angular:component': { | ||
prefix: 'appPrefix' | ||
} | ||
} | ||
}; | ||
|
||
beforeEach(() => { | ||
appTree = new UnitTestTree(new EmptyTree()); | ||
appTree.create('/angular.json', JSON.stringify(configJson)); | ||
}); | ||
|
||
it('should update time picker events', done => { | ||
appTree.create( | ||
'/testSrc/appPrefix/component/test.component.html', | ||
`<igx-time-picker (onOpen)="handler" (onClose)="handler"></igx-time-picker>` | ||
); | ||
const tree = schematicRunner.runSchematic('migration-09', {}, appTree); | ||
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')) | ||
.toEqual( | ||
`<igx-time-picker (onOpened)="handler" (onClosed)="handler"></igx-time-picker>`); | ||
done(); | ||
}); | ||
|
||
it('should update date picker events', done => { | ||
appTree.create( | ||
'/testSrc/appPrefix/component/test.component.html', | ||
`<igx-date-picker (onOpen)="handler" (onClose)="handler"></igx-date-picker>` | ||
); | ||
const tree = schematicRunner.runSchematic('migration-09', {}, appTree); | ||
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')) | ||
.toEqual( | ||
`<igx-date-picker (onOpened)="handler" (onClosed)="handler"></igx-date-picker>`); | ||
done(); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
projects/igniteui-angular/migrations/update-7_3_4/index.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,25 @@ | ||
import * as path from 'path'; | ||
|
||
// tslint:disable:no-implicit-dependencies | ||
import { normalize } from '@angular-devkit/core'; | ||
import { | ||
chain, | ||
Rule, | ||
SchematicContext, | ||
SchematicsException, | ||
Tree | ||
} from '@angular-devkit/schematics'; | ||
import { filterSourceDirs } from '../common/filterSourceDirs'; | ||
import { getImportModulePositions } from '../common/tsUtils'; | ||
import { UpdateChanges } from '../common/UpdateChanges'; | ||
|
||
const version = '7.3.4'; | ||
|
||
export default function(): Rule { | ||
return (host: Tree, context: SchematicContext) => { | ||
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`); | ||
|
||
const update = new UpdateChanges(__dirname, host, context); | ||
update.applyChanges(); | ||
}; | ||
} |
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
22 changes: 13 additions & 9 deletions
22
projects/igniteui-angular/src/lib/date-picker/calendar-container.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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
<igx-calendar #calendar></igx-calendar> | ||
<div class="igx-date-picker__buttons" *ngIf="isReadonly && | ||
(cancelButtonLabel || todayButtonLabel)"> | ||
<button #closeButton *ngIf="cancelButtonLabel" igxButton="flat" igxRipple (click)="closeCalendar()"> | ||
{{ cancelButtonLabel }} | ||
</button> | ||
<button #todayButton *ngIf="todayButtonLabel" igxButton="flat" igxRipple (click)="triggerTodaySelection()"> | ||
{{ todayButtonLabel }} | ||
</button> | ||
<ng-template #defaultDatePickerActions> | ||
<div *ngIf="cancelButtonLabel || todayButtonLabel" class="igx-date-picker__buttons"> | ||
<button #closeButton *ngIf="cancelButtonLabel" igxButton="flat" igxRipple (click)="closeCalendar()"> | ||
{{ cancelButtonLabel }} | ||
</button> | ||
<button #todayButton *ngIf="todayButtonLabel" igxButton="flat" igxRipple (click)="triggerTodaySelection()"> | ||
{{ todayButtonLabel }} | ||
</button> | ||
</div> | ||
</ng-template> | ||
<div> | ||
<igx-calendar #calendar></igx-calendar> | ||
<ng-container *ngTemplateOutlet="datePickerActions ? datePickerActions.template : defaultDatePickerActions"></ng-container> | ||
</div> |
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
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
Oops, something went wrong.