diff --git a/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html b/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html index 9bee7f5cf..836cb0923 100644 --- a/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html +++ b/projects/cashmere-examples/src/lib/checkbox-standard/checkbox-standard-example.component.html @@ -1,3 +1,5 @@ Standard Checkbox Disabled Checkbox + +Disabled Checkbox (Checked) diff --git a/projects/cashmere-examples/src/lib/date-range/date-range-example.component.html b/projects/cashmere-examples/src/lib/date-range/date-range-example.component.html index 545554a58..c5c112318 100644 --- a/projects/cashmere-examples/src/lib/date-range/date-range-example.component.html +++ b/projects/cashmere-examples/src/lib/date-range/date-range-example.component.html @@ -7,7 +7,7 @@ popperPlacement="bottom" (selectedDateRangeChanged)="updateRange($event)" (selectedPresetChanged)="updatePreset($event)" - [selectedDate]="range" + [selectedDate]="selected" [options]="options" #pickerOne > diff --git a/projects/cashmere-examples/src/lib/date-range/date-range-example.component.ts b/projects/cashmere-examples/src/lib/date-range/date-range-example.component.ts index e51821b13..a80b1d97e 100644 --- a/projects/cashmere-examples/src/lib/date-range/date-range-example.component.ts +++ b/projects/cashmere-examples/src/lib/date-range/date-range-example.component.ts @@ -8,6 +8,7 @@ import {DateRangeOptions, PresetItem, DateRange} from '@healthcatalyst/cashmere' }) export class DateRangeExampleComponent implements OnInit { range: DateRange = {fromDate: new Date(), toDate: new Date()}; + selected: number | DateRange = this.range; options: DateRangeOptions; presets: Array = []; presetSelection: string = 'None'; @@ -36,8 +37,10 @@ export class DateRangeExampleComponent implements OnInit { updatePreset(index: number | DateRange) { if (typeof index === 'number') { this.presetSelection = this.presets[index].presetLabel; + this.selected = index; } else { this.presetSelection = 'None'; + this.selected = this.range; } } @@ -73,6 +76,10 @@ export class DateRangeExampleComponent implements OnInit { presetLabel: 'This Month', range: {fromDate: currMonthStart, toDate: currMonthEnd} }, + { + presetLabel: '1 Month to End', + range: {fromDate: currMonthStart, toDate: currMonthEnd} + }, { presetLabel: 'Last Month', range: {fromDate: lastMonthStart, toDate: lastMonthEnd} diff --git a/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.html b/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.html index 335494003..e532e59ed 100644 --- a/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.html +++ b/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.html @@ -2,7 +2,7 @@
Date: - + Please enter a valid date diff --git a/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.ts b/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.ts index 476af44b5..f0d7fb3aa 100644 --- a/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.ts +++ b/projects/cashmere-examples/src/lib/datepicker/datepicker-example.component.ts @@ -10,4 +10,6 @@ export class DatepickerExampleComponent { date2 = new Date(); date3 = new Date("2010-01-01T20:15:00.00"); hourCycle = false; + + maxStr: string = this.date2.toISOString(); } diff --git a/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.html b/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.html index a8fe5db1e..8c112f657 100644 --- a/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.html +++ b/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.html @@ -1,4 +1,4 @@ - + diff --git a/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.ts b/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.ts index 3a3a0d5d2..ef965f3b8 100644 --- a/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.ts +++ b/projects/cashmere-examples/src/lib/navbar-app-switcher/navbar-app-switcher-example.component.ts @@ -1,4 +1,5 @@ import {Component} from '@angular/core'; +import {HcIcon} from '@healthcatalyst/cashmere'; /** * @title Navbar app switcher with mobile menu example @@ -9,4 +10,5 @@ import {Component} from '@angular/core'; }) export class NavbarAppSwitcherExampleComponent { username = 'Christine K.'; + navIcon: HcIcon = {fontSet: "hc-icons", fontIcon: "hci-catalyst-logo", fontSize: 37}; } diff --git a/projects/cashmere-examples/src/lib/pagination-load-more/pagination-load-more-example.component.ts b/projects/cashmere-examples/src/lib/pagination-load-more/pagination-load-more-example.component.ts index fba9de8b3..e08b7afd0 100644 --- a/projects/cashmere-examples/src/lib/pagination-load-more/pagination-load-more-example.component.ts +++ b/projects/cashmere-examples/src/lib/pagination-load-more/pagination-load-more-example.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; +import {Component, ViewChild, AfterViewInit} from '@angular/core'; import {LoadMorePaginationComponent, HcTableDataSource} from '@healthcatalyst/cashmere'; export interface PeriodicElement { @@ -39,7 +39,7 @@ const ELEMENT_DATA: PeriodicElement[] = [ templateUrl: 'pagination-load-more-example.component.html', styleUrls: ['pagination-load-more-example.component.scss'] }) -export class PaginationLoadMoreExampleComponent implements OnInit { +export class PaginationLoadMoreExampleComponent implements AfterViewInit { displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; dataSource: HcTableDataSource; get length(): number { @@ -49,7 +49,7 @@ export class PaginationLoadMoreExampleComponent implements OnInit { @ViewChild(LoadMorePaginationComponent) loadMoreBtn: LoadMorePaginationComponent; - ngOnInit(): void { + ngAfterViewInit(): void { this.dataSource = new HcTableDataSource(ELEMENT_DATA); this.dataSource.paginator = this.loadMoreBtn; } diff --git a/projects/cashmere-examples/src/lib/pagination-standard/pagination-standard-example.component.ts b/projects/cashmere-examples/src/lib/pagination-standard/pagination-standard-example.component.ts index af46d0e1a..7584eea99 100644 --- a/projects/cashmere-examples/src/lib/pagination-standard/pagination-standard-example.component.ts +++ b/projects/cashmere-examples/src/lib/pagination-standard/pagination-standard-example.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; +import {Component, ViewChild, AfterViewInit} from '@angular/core'; import {PaginationComponent, HcTableDataSource} from '@healthcatalyst/cashmere'; export interface PeriodicElement { @@ -39,7 +39,7 @@ const ELEMENT_DATA: PeriodicElement[] = [ templateUrl: 'pagination-standard-example.component.html', styleUrls: ['pagination-standard-example.component.scss'] }) -export class PaginationStandardExampleComponent implements OnInit { +export class PaginationStandardExampleComponent implements AfterViewInit { displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; dataSource: HcTableDataSource; pageNumber = 1; @@ -51,7 +51,7 @@ export class PaginationStandardExampleComponent implements OnInit { @ViewChild(PaginationComponent) paginator: PaginationComponent; - ngOnInit(): void { + ngAfterViewInit(): void { this.dataSource = new HcTableDataSource(ELEMENT_DATA); this.dataSource.paginator = this.paginator; } diff --git a/projects/cashmere-examples/src/lib/picklist-simple/picklist-simple-example.component.html b/projects/cashmere-examples/src/lib/picklist-simple/picklist-simple-example.component.html index ccb75aff7..772280ce2 100644 --- a/projects/cashmere-examples/src/lib/picklist-simple/picklist-simple-example.component.html +++ b/projects/cashmere-examples/src/lib/picklist-simple/picklist-simple-example.component.html @@ -1,4 +1,4 @@ + [simpleOptions]="['North', 'East', 'South', 'West']"> \ No newline at end of file diff --git a/projects/cashmere-examples/src/lib/popover-menu/popover-menu-example.component.html b/projects/cashmere-examples/src/lib/popover-menu/popover-menu-example.component.html index 182dd4eb2..513d0310c 100644 --- a/projects/cashmere-examples/src/lib/popover-menu/popover-menu-example.component.html +++ b/projects/cashmere-examples/src/lib/popover-menu/popover-menu-example.component.html @@ -2,25 +2,82 @@
- - + + Save document Ctrl + S + + + +
-
-
+
+ + +
+ + + +
+ +
+
+ + +
+ + +
+
+ + +
+ +
diff --git a/projects/cashmere/src/lib/app-switcher/app-switcher.component.html b/projects/cashmere/src/lib/app-switcher/app-switcher.component.html index 4d08957b8..172006aa4 100644 --- a/projects/cashmere/src/lib/app-switcher/app-switcher.component.html +++ b/projects/cashmere/src/lib/app-switcher/app-switcher.component.html @@ -18,7 +18,11 @@

Applications [title]="appIsMe(app) ? 'Current Application' : app.Description" [attr.href]="linkIfNotMe(app)" target="_blank"> - +
+
{{app?.FriendlyName | ellipsis:18}}

diff --git a/projects/cashmere/src/lib/app-switcher/app-switcher.component.scss b/projects/cashmere/src/lib/app-switcher/app-switcher.component.scss index ca5fe9f9b..02d2d42cd 100644 --- a/projects/cashmere/src/lib/app-switcher/app-switcher.component.scss +++ b/projects/cashmere/src/lib/app-switcher/app-switcher.component.scss @@ -40,7 +40,9 @@ } & > .thumbnail-img { - width: auto; + background-size: cover; + background-position: center; + background-repeat: no-repeat; } } diff --git a/projects/cashmere/src/lib/checkbox/checkbox.component.scss b/projects/cashmere/src/lib/checkbox/checkbox.component.scss index 1da3c927f..4adeec345 100644 --- a/projects/cashmere/src/lib/checkbox/checkbox.component.scss +++ b/projects/cashmere/src/lib/checkbox/checkbox.component.scss @@ -35,10 +35,6 @@ @include hc-checkbox-overlay-hover(); } - .hc-checkbox-disabled & { - @include hc-checkbox-overlay-disabled(); - } - .hc-checkbox-indeterminate & { @include hc-checkbox-overlay-indeterminate(); } @@ -46,6 +42,10 @@ input[type='checkbox']:checked + & { @include hc-checkbox-overlay-checked(); } + + .hc-checkbox-disabled input[type=checkbox] + & { + @include hc-checkbox-overlay-disabled(); + } } .hc-form-field-invalid { diff --git a/projects/cashmere/src/lib/date-range/date-range/date-range.directive.spec.ts b/projects/cashmere/src/lib/date-range/date-range/date-range.directive.spec.ts index 320c6c50d..4d1108e0d 100644 --- a/projects/cashmere/src/lib/date-range/date-range/date-range.directive.spec.ts +++ b/projects/cashmere/src/lib/date-range/date-range/date-range.directive.spec.ts @@ -25,7 +25,7 @@ class MockOverlayService { }) class TestComponent { options: DateRangeOptions; - range: DateRange = {fromDate: new Date(), toDate: new Date()}; + range: number | DateRange = {fromDate: new Date(), toDate: new Date()}; constructor() { this.options = { presets: [ @@ -105,12 +105,9 @@ describe('DateRangeDirective', () => { expect(overlay.open).toHaveBeenCalled(); }); - it('should return the index of the selected preset', () => { - const resetRange = {fromDate: new Date(2000, 1, 1), toDate: new Date(2000, 1, 2)}; - directive.selectedDate = resetRange; - + it('should set the selected preset from an index', () => { spyOn(component, 'updatePreset'); - component.range = resetRange; + component.range = 1; fixture.detectChanges(); expect(component.updatePreset).toHaveBeenCalledWith(1); diff --git a/projects/cashmere/src/lib/date-range/date-range/date-range.directive.ts b/projects/cashmere/src/lib/date-range/date-range/date-range.directive.ts index e9ced72bb..30f033902 100644 --- a/projects/cashmere/src/lib/date-range/date-range/date-range.directive.ts +++ b/projects/cashmere/src/lib/date-range/date-range/date-range.directive.ts @@ -2,7 +2,7 @@ import {OnInit, Output, EventEmitter, Input, OnDestroy, ElementRef, Directive, H import {DatePipe} from '@angular/common'; import {OverlayRef} from '@angular/cdk/overlay'; import {CalendarOverlayService} from '../services/calendar-overlay.service'; -import {DateRange, DateRangeOptions, PresetItem} from '../model/model'; +import {DateRange, DateRangeOptions} from '../model/model'; import {ConfigStoreService} from '../services/config-store.service'; @Directive({ @@ -14,9 +14,9 @@ export class DateRangeDirective implements OnInit, OnDestroy, OnChanges { @Output() readonly selectedDateRangeChanged: EventEmitter = new EventEmitter(); - /** Selected date range. */ + /** Sets the selected date range. Accepts either a `DateRange` or a numerical index for preset. */ @Input() - selectedDate: DateRange; + selectedDate: number | DateRange; /** Emits either a numerical index for the selected preset, or a `DateRange` if the selected value is not a preset */ @Output() @@ -55,22 +55,12 @@ export class DateRangeDirective implements OnInit, OnDestroy, OnChanges { this.configStoreService.updateDateRangeOptions(options); } if (changes['selectedDate']) { - const selectedDate: DateRange = changes['selectedDate'].currentValue; - this.configStoreService.updateRange(selectedDate); + const selectedDate: number | DateRange = changes['selectedDate'].currentValue; - if (this.options.presets) { - let selectedPreset = -1; - for (let i = 0; i < this.options.presets.length; i++) { - let tempRange = this.options.presets[i].range; - if ( tempRange.fromDate && selectedDate.fromDate && - tempRange.fromDate.toDateString() === selectedDate.fromDate.toDateString() && - tempRange.toDate && selectedDate.toDate && - tempRange.toDate.toDateString() === selectedDate.toDate.toDateString() - ) { - selectedPreset = i; - } - } - this.configStoreService.updatePreset(selectedPreset >= 0 ? selectedPreset : selectedDate); + if ( typeof selectedDate === 'number' ) { + this.configStoreService.updatePreset(selectedDate); + } else { + this.configStoreService.updateRange(selectedDate); } } } diff --git a/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.html b/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.html index 6280be0d1..16f51c4b8 100644 --- a/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.html +++ b/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.html @@ -32,13 +32,13 @@
- {{ p.presetLabel }} + {{ p.presetLabel }}
-
diff --git a/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.spec.ts b/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.spec.ts index d0a812fe4..86005802d 100644 --- a/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.spec.ts +++ b/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.spec.ts @@ -48,14 +48,13 @@ describe('RangeComponent', () => { }); it("should select a preset radio if the current dates match that preset's range", () => { - let radioDebugElement = fixture.debugElement.query(By.directive(RadioButtonComponent)); - expect(radioDebugElement.componentInstance.checked).toBe(false); + expect(component._selectedPreset).toBeFalsy(); component._updateFromDate(new Date(2010, 1, 1)); component._updateToDate(new Date(2010, 1, 2)); fixture.detectChanges(); - expect(radioDebugElement.componentInstance.checked).toBe(true); + expect(component._selectedPreset).toBe(0); }); describe('fromMaxDate', () => { diff --git a/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.ts b/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.ts index 6da4ed8a6..1b0898326 100644 --- a/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.ts +++ b/projects/cashmere/src/lib/date-range/picker-overlay/picker-overlay.component.ts @@ -1,5 +1,5 @@ -import {Component, OnInit, ViewEncapsulation, ChangeDetectorRef, AfterViewInit, ViewChildren, QueryList} from '@angular/core'; -import {DateRangeOptions} from '../model/model'; +import {Component, OnInit, ViewEncapsulation, AfterViewInit, ViewChildren, QueryList} from '@angular/core'; +import {DateRangeOptions, PresetItem} from '../model/model'; import {OverlayRef} from '@angular/cdk/overlay'; import {ConfigStoreService} from '../services/config-store.service'; import {DateRange} from '../model/model'; @@ -7,7 +7,6 @@ import {D} from '../../datepicker/datetime/date-formats'; import {CalendarWrapperComponent} from '../calendar-wrapper/calendar-wrapper.component'; import {Observable} from 'rxjs'; import {map} from 'rxjs/operators'; -import {RadioButtonComponent, RadioGroupDirective} from '../../radio-button/radio'; // ** Date range wrapper component */ @Component({ @@ -20,24 +19,21 @@ export class PickerOverlayComponent implements OnInit, AfterViewInit { options$: Observable; _fromDate: D | undefined; _toDate: D | undefined; - _disabled: boolean; - _selectedPreset: DateRange | null; + _selectedPreset: number | null; + _presetValues: PresetItem[] | undefined; + _skipRangeCheck: boolean = false; @ViewChildren(CalendarWrapperComponent) calendarWrappers: QueryList; - @ViewChildren(RadioButtonComponent) - _presetRadios: QueryList; - - @ViewChildren(RadioGroupDirective) - _presetGroup: QueryList; - - constructor(public configStoreService: ConfigStoreService, private overlayRef: OverlayRef, private cd: ChangeDetectorRef) { + constructor(public configStoreService: ConfigStoreService, private overlayRef: OverlayRef) { this.options$ = configStoreService.dateRangeOptions$; } ngOnInit() { - this._setValidity(); + this.options$.subscribe((options: DateRangeOptions) => { + this._presetValues = options.presets; + }); this.configStoreService.rangeUpdate$.subscribe((dateRange: DateRange) => { if (dateRange) { this._fromDate = dateRange.fromDate; @@ -47,66 +43,73 @@ export class PickerOverlayComponent implements OnInit, AfterViewInit { this._toDate = undefined; } }); + this.configStoreService.presetUpdate$.subscribe((presetIndex: number | DateRange) => { + if (typeof presetIndex === 'number') { + this._selectedPreset = presetIndex; + this._updateRangeByPreset( presetIndex ); + } + }); } ngAfterViewInit(): void { if (this.calendarWrappers.first) { this.calendarWrappers.first.focusInput(); } - setTimeout(() => { - this._isRangePreset(); - }); } _updateFromDate(date?: D) { - this._fromDate = date; - if (this._selectedPreset && this._selectedPreset.fromDate !== date) { - setTimeout(() => { - this._selectedPreset = null; - this.cd.detectChanges(); - }); + if ( !this._skipRangeCheck ) { + this._fromDate = date; + this._isRangePreset(); } - this._setValidity(); - this._isRangePreset(); } _updateToDate(date?: D) { - this._toDate = date; - if (this._selectedPreset && this._selectedPreset.toDate !== date) { - setTimeout(() => { - this._selectedPreset = null; - this.cd.detectChanges(); - }); + if ( !this._skipRangeCheck ) { + this._toDate = date; + this._isRangePreset(); } - this._setValidity(); - this._isRangePreset(); } - _updateRangeByPreset(range: DateRange) { - this._fromDate = range.fromDate; - this._toDate = range.toDate; - this._setValidity(); + _updateRangeByPreset(index: number) { + if (this._presetValues && index < this._presetValues.length && index >= 0 ) { + // Prevent the system from assigning a preset if one has specifically been selected + this._skipRangeCheck = true; + this._fromDate = this._presetValues[index].range.fromDate; + this._toDate = this._presetValues[index].range.toDate; + + setTimeout(() => { + if ( this._fromDate ) { + this.calendarWrappers.first.hcCalendar.activeDate = this._fromDate; + } + if ( this._toDate ) { + this.calendarWrappers.last.hcCalendar.activeDate = this._toDate; + } + this._skipRangeCheck = false; + }); + } } _isRangePreset() { - if (this._presetRadios) { - this._presetRadios.forEach((radio: RadioButtonComponent) => { - let radioRange: DateRange = radio.value; + this._selectedPreset = null; + if (this._presetValues) { + for (let i = 0; i < this._presetValues.length; i++) { + let radioRange: DateRange = this._presetValues[i].range; if (this._fromDate && radioRange.fromDate && this._toDate && radioRange.toDate) { - radio.checked = - this._fromDate.toDateString() === radioRange.fromDate.toDateString() && - this._toDate.toDateString() === radioRange.toDate.toDateString(); + if ( this._fromDate.toDateString() === radioRange.fromDate.toDateString() && + this._toDate.toDateString() === radioRange.toDate.toDateString() ) { + this._selectedPreset = i; + } } - }); + } } } _applyNewDates() { if (!!this._toDate && !!this._fromDate) { this.configStoreService.updateRange({fromDate: this._fromDate, toDate: this._toDate}); - if ( this._presetGroup.first.selected ) { - let presetStr = this._presetGroup.first.selected.id.substr(21); - this.configStoreService.updatePreset( +presetStr ); + if (this._selectedPreset !== null) { + this.configStoreService.updatePreset(this._selectedPreset); } else { this.configStoreService.updatePreset({fromDate: this._fromDate, toDate: this._toDate}); } @@ -118,10 +121,6 @@ export class PickerOverlayComponent implements OnInit, AfterViewInit { this.overlayRef.dispose(); } - _setValidity() { - this._disabled = !this._toDate || !this._fromDate; - } - get _fromMaxDate(): Observable { return this.options$.pipe( map(options => { diff --git a/projects/cashmere/src/lib/datepicker/calendar/calendar.component.ts b/projects/cashmere/src/lib/datepicker/calendar/calendar.component.ts index 0fe150e28..1a7154a9a 100644 --- a/projects/cashmere/src/lib/datepicker/calendar/calendar.component.ts +++ b/projects/cashmere/src/lib/datepicker/calendar/calendar.component.ts @@ -139,9 +139,24 @@ export class CalendarHeaderComponent { } _todayEnabled(): boolean { + let minDate; + let maxDate; + let today = new Date( this._dateAdapter.today().toDateString() ); + + /** Normalize the compare dates to all be on the first day of the month because we are only concerned + * about whether today falls outside of the month than min or max is in */ + today.setDate(1); + if ( this.calendar.minDate ) { + minDate = new Date( this.calendar.minDate.toDateString() ); + minDate.setDate(1); + } + if ( this.calendar.maxDate ) { + maxDate = new Date( this.calendar.maxDate.toDateString() ); + maxDate.setDate(1); + } return ( - (!this.calendar.minDate || this._dateAdapter.compareDate(this.calendar.minDate, this._dateAdapter.today()) < 1) && - (!this.calendar.maxDate || this._dateAdapter.compareDate(this.calendar.maxDate, this._dateAdapter.today()) > -1) + (!minDate || this._dateAdapter.compareDate(minDate, today) < 1) && + (!maxDate || this._dateAdapter.compareDate(maxDate, today) > -1) ); } diff --git a/projects/cashmere/src/lib/datepicker/datepicker-input/datepicker-input.directive.ts b/projects/cashmere/src/lib/datepicker/datepicker-input/datepicker-input.directive.ts index d230748b6..1eb68449c 100644 --- a/projects/cashmere/src/lib/datepicker/datepicker-input/datepicker-input.directive.ts +++ b/projects/cashmere/src/lib/datepicker/datepicker-input/datepicker-input.directive.ts @@ -323,6 +323,22 @@ export class DatepickerInputDirective implements ControlValueAccessor, OnDestroy _onInput(value: string) { let date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput); + /** Two-digit year input conversion method for IE + * Based on the current year, assume that the four-digit year date should be in + * either the next 30 years, or the preceding 70 years */ + if (date) { + let inputString: string = this._elementRef.nativeElement.value; + /** Skip this check if the input string contains any 3+ digit numerical values - assumed to be a year */ + if (!inputString.match(/[1-9][0-9][0-9]/g)) { + let currentDate = new Date(); + if (date.getFullYear() >= currentDate.getFullYear() + 30) { + date.setFullYear(date.getFullYear() - 100); + } else if (date.getFullYear() < currentDate.getFullYear() - 70) { + date.setFullYear(date.getFullYear() + 100); + } + } + } + this._lastValueValid = !date || this._dateAdapter.isValid(date); date = this._getValidDateOrNull(date); diff --git a/projects/cashmere/src/lib/form-field/hc-form-field.component.scss b/projects/cashmere/src/lib/form-field/hc-form-field.component.scss index 252680dd2..7c67c25e3 100644 --- a/projects/cashmere/src/lib/form-field/hc-form-field.component.scss +++ b/projects/cashmere/src/lib/form-field/hc-form-field.component.scss @@ -109,3 +109,13 @@ .hc-required-marker { @include hc-required-marker(); } + +/* IE won't render borders for our inputs correctly, so default to a thicker width */ +@media all and (-ms-high-contrast:none) { + .hc-form-field-flex, + .hc-form-field-flex-inline, + .hc-form-field-disabled-flex, + .hc-form-field-input-invalid { + @include hc-form-field-border-override(); + } +} diff --git a/projects/cashmere/src/lib/icon/icon.component.ts b/projects/cashmere/src/lib/icon/icon.component.ts index 0f74bf348..d55875c46 100644 --- a/projects/cashmere/src/lib/icon/icon.component.ts +++ b/projects/cashmere/src/lib/icon/icon.component.ts @@ -1,5 +1,15 @@ import {Attribute, Component, ElementRef, HostBinding, Input, OnChanges, SimpleChanges, ViewEncapsulation} from '@angular/core'; +/** Object used to pass values that will be used in an IconComponent */ +export interface HcIcon { + /** Font set icon is a part of */ + fontSet: string; + /** Name of icon within a font set */ + fontIcon: string; + /** Optional height in pixels of the icon; defaults to 37 */ + fontSize?: number; +} + /** Makes using a font icon easier. */ @Component({ selector: 'hc-icon', diff --git a/projects/cashmere/src/lib/icon/index.ts b/projects/cashmere/src/lib/icon/index.ts index 78cd31f91..60fb1ad57 100644 --- a/projects/cashmere/src/lib/icon/index.ts +++ b/projects/cashmere/src/lib/icon/index.ts @@ -1,4 +1,4 @@ -export {IconComponent} from './icon.component'; +export {HcIcon, IconComponent} from './icon.component'; export {IconModule} from './icon.module'; export {HcIconSmallDirective} from './hc-icon-sm.directive'; export {HcIconMediumDirective} from './hc-icon-md.directive'; diff --git a/projects/cashmere/src/lib/modal/active-modal.ts b/projects/cashmere/src/lib/modal/active-modal.ts index 9ab4b2ae1..ad06fe62d 100644 --- a/projects/cashmere/src/lib/modal/active-modal.ts +++ b/projects/cashmere/src/lib/modal/active-modal.ts @@ -1,12 +1,12 @@ -export class ActiveModal { +export class ActiveModal { /** Data that was passed in through ModalOptions */ - public data?: any; + public data?: T; /** Closes the modal with an optional result. * Use this close method when opening a modal using a component. When doing so, * ActiveModal must be injected in order to get access to the close method. * To dismiss a modal that was created from a TemplateRef, use the dismiss method * on HcModal */ - public close(result?: any): void {} + public close(result?: U): void {} /** Dismisses the modal with no result. * Use this dismiss method when opening a modal using a component. When doing so, * ActiveModal must be injected in order to get access to the dismiss method. diff --git a/projects/cashmere/src/lib/navbar/navbar.component.html b/projects/cashmere/src/lib/navbar/navbar.component.html index 5ed04598a..143318e2d 100644 --- a/projects/cashmere/src/lib/navbar/navbar.component.html +++ b/projects/cashmere/src/lib/navbar/navbar.component.html @@ -1,7 +1,13 @@