author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
530,388 | 03.05.2017 16:05:40 | -19,080 | f24a2bc30bed6035bad22670e68796ebc9285542 | fix(toast) on click issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/toast/toast.html",
"new_path": "src/lib/toast/toast.html",
"diff": "<div *ngFor=\"let toast of toasts\"\nclass=\"md2-toast\"\n[class.in]=\"toast.isVisible\"\n- (click)=\"remove(toast.id)\">{{ toast.message }}</div>\n+ (click)=\"removeToast(toast.id)\">{{ toast.message }}</div>\n"
}
] | TypeScript | MIT License | promact/md2 | fix(toast) on click issue #195 |
530,388 | 03.05.2017 16:25:34 | -19,080 | d34699637ba96be21a260b0c43695e58e0c2dedc | chore: update select with navigate options through arrow without opening panel | [
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -66,7 +66,7 @@ const MD2_MODULES = [\nMd2DialogModule.forRoot(),\nMd2MenuModule.forRoot(),\nMdRippleModule,\n- Md2SelectModule.forRoot(),\n+ Md2SelectModule,\nMd2TabsModule.forRoot(),\nMd2TagsModule.forRoot(),\nMd2ToastModule.forRoot(),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/index.ts",
"new_path": "src/lib/select/index.ts",
"diff": "-import { NgModule, ModuleWithProviders } from '@angular/core';\n+import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Md2Select } from './select';\nimport { Md2SelectHeader } from './select-header';\nimport { Md2OptionModule } from './option';\n-import { CompatibilityModule, OverlayModule } from '../core';\n+import { MdCommonModule, OverlayModule } from '../core';\n@NgModule({\n- imports: [CommonModule, OverlayModule, Md2OptionModule, CompatibilityModule],\n- exports: [Md2Select, Md2SelectHeader, Md2OptionModule, CompatibilityModule],\n+ imports: [\n+ CommonModule,\n+ OverlayModule,\n+ Md2OptionModule,\n+ MdCommonModule,\n+ ],\n+ exports: [Md2Select, Md2SelectHeader, Md2OptionModule, MdCommonModule],\ndeclarations: [Md2Select, Md2SelectHeader],\n})\n-export class Md2SelectModule {\n- /** @deprecated */\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2SelectModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2SelectModule { }\nexport * from './select';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/option.ts",
"new_path": "src/lib/select/option.ts",
"diff": "@@ -5,9 +5,9 @@ import {\nInput,\nOutput,\nNgModule,\n- ModuleWithProviders,\n- Renderer,\nViewEncapsulation,\n+ Inject,\n+ Optional,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ENTER, SPACE } from '../core/keyboard/keycodes';\n@@ -79,8 +79,7 @@ export class Md2Option {\n@Output() onSelectionChange = new EventEmitter<Md2OptionSelectionChange>();\nconstructor(\n- private _element: ElementRef,\n- private _renderer: Renderer) { }\n+ private _element: ElementRef) { }\n/**\n* Whether or not the option is currently active and ready to be selected.\n@@ -114,7 +113,7 @@ export class Md2Option {\n/** Sets focus onto this option. */\nfocus(): void {\n- this._renderer.invokeElementMethod(this._getHostElement(), 'focus');\n+ this._getHostElement().focus();\n}\n/**\n@@ -166,7 +165,7 @@ export class Md2Option {\n/** Emits the selection change event. */\nprivate _emitSelectionChangeEvent(isUserInput = false): void {\nthis.onSelectionChange.emit(new Md2OptionSelectionChange(this, isUserInput));\n- };\n+ }\n}\n@@ -175,11 +174,4 @@ export class Md2Option {\nexports: [Md2Option],\ndeclarations: [Md2Option]\n})\n-export class Md2OptionModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2OptionModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2OptionModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.html",
"new_path": "src/lib/select/select.html",
"diff": "<span class=\"md2-select-placeholder\"\n[class.md2-floating-placeholder]=\"_selectionModel.hasValue()\"\n[@transformPlaceholder]=\"_getPlaceholderAnimationState()\"\n- [style.visibility]=\"_getPlaceholderVisibility()\"\n+ [style.opacity]=\"_getPlaceholderOpacity()\"\n[style.width.px]=\"_selectedValueWidth\">{{ placeholder }}</span>\n<span class=\"md2-select-value\" *ngIf=\"_selectionModel.hasValue()\">\n<span class=\"md2-select-value-text\">{{ triggerValue }}</span>\n</div>\n<ng-template cdk-connected-overlay [origin]=\"origin\" [open]=\"panelOpen\" hasBackdrop (backdropClick)=\"close()\"\nbackdropClass=\"cdk-overlay-transparent-backdrop\" [positions]=\"_positions\" [minWidth]=\"_triggerWidth\"\n- [offsetY]=\"_offsetY\" [offsetX]=\"_offsetX\" (attach)=\"_setScrollTop()\">\n+ [offsetY]=\"_offsetY\" (attach)=\"_onAttached()\" (detach)=\"close()\">\n<div class=\"md2-select-panel\" [@transformPanel]=\"'showing'\" (@transformPanel.done)=\"_onPanelDone()\"\n(keydown)=\"_keyManager.onKeydown($event)\" [style.transformOrigin]=\"_transformOrigin\"\n[class.md2-select-panel-done-animating]=\"_panelDoneAnimating\">\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.scss",
"new_path": "src/lib/select/select.scss",
"diff": "@@ -134,6 +134,7 @@ $md2-select-trigger-font-size: 16px !default;\npadding-top: 0;\npadding-bottom: 0;\nmax-height: $md2-select-panel-max-height;\n+ min-width: 100%;\n@include cdk-high-contrast {\noutline: solid 1px;\n@@ -161,7 +162,7 @@ $md2-select-trigger-font-size: 16px !default;\n&.md2-selected {\ncolor: $primary;\n- // In multiple mode there is a checkbox to show that the option is selected.\n+\n&:not(.md2-option-multiple) {\nbackground: rgba(black, 0.04);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.ts",
"new_path": "src/lib/select/select.ts",
"diff": "@@ -9,15 +9,16 @@ import {\nOptional,\nOutput,\nQueryList,\n- Renderer,\n+ Renderer2,\nSelf,\nViewEncapsulation,\nViewChild,\nChangeDetectorRef,\nAttribute,\n+ OnInit,\n} from '@angular/core';\nimport { Md2Option, Md2OptionSelectionChange } from './option';\n-import { ENTER, SPACE } from '../core/keyboard/keycodes';\n+import { ENTER, SPACE, UP_ARROW, DOWN_ARROW } from '../core/keyboard/keycodes';\nimport { FocusKeyManager } from '../core/a11y/focus-key-manager';\nimport { Dir } from '../core/rtl/dir';\nimport { Observable } from 'rxjs/Observable';\n@@ -120,7 +121,7 @@ export type Md2SelectFloatPlaceholderType = 'always' | 'never' | 'auto';\n],\nexportAs: 'md2Select',\n})\n-export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDestroy {\n+export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlValueAccessor {\n/** Whether or not the overlay panel is open. */\nprivate _panelOpen = false;\n@@ -187,13 +188,6 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n/** Whether the panel's animation is done. */\n_panelDoneAnimating: boolean = false;\n- /**\n- * The x-offset of the overlay panel in relation to the trigger's top start corner.\n- * This must be adjusted to align the selected option text over the trigger text when\n- * the panel opens. Will change based on LTR or RTL text direction.\n- */\n- _offsetX = 0;\n-\n/**\n* The y-offset of the overlay panel in relation to the trigger's top start corner.\n* This must be adjusted to align the selected option text over the trigger text.\n@@ -238,7 +232,7 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nthis._placeholder = value;\n// Must wait to record the trigger width to ensure placeholder width is included.\n- Promise.resolve(null).then(() => this._triggerWidth = this._getWidth());\n+ Promise.resolve(null).then(() => this._setTriggerWidth());\n}\n/** Whether the component is disabled. */\n@@ -301,10 +295,11 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n/** Event emitted when the selected value has been changed by the user. */\n@Output() change: EventEmitter<Md2SelectChange> = new EventEmitter<Md2SelectChange>();\n- constructor(private _element: ElementRef, private _renderer: Renderer,\n+ constructor(private _element: ElementRef, private _renderer: Renderer2,\nprivate _viewportRuler: ViewportRuler, private _changeDetectorRef: ChangeDetectorRef,\n@Optional() private _dir: Dir, @Self() @Optional() public _control: NgControl,\n@Attribute('tabindex') tabIndex: string) {\n+\nif (this._control) {\nthis._control.valueAccessor = this;\n}\n@@ -312,8 +307,11 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nthis._tabIndex = parseInt(tabIndex) || 0;\n}\n- ngAfterContentInit() {\n+ ngOnInit() {\nthis._selectionModel = new SelectionModel<Md2Option>(this.multiple, null, false);\n+ }\n+\n+ ngAfterContentInit() {\nthis._initKeyManager();\nthis._changeSubscription = this.options.changes.startWith(null).subscribe(() => {\n@@ -349,6 +347,11 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nif (this.disabled || !this.options.length) {\nreturn;\n}\n+\n+ if (!this._triggerWidth) {\n+ this._setTriggerWidth();\n+ }\n+\nthis._calculateOverlayPosition();\nthis._placeholderState = this._floatPlaceholderState();\nthis._panelOpen = true;\n@@ -358,9 +361,11 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nclose(): void {\nif (this._panelOpen) {\nthis._panelOpen = false;\n+\nif (this._selectionModel.isEmpty()) {\nthis._placeholderState = '';\n}\n+\nthis._focusHost();\n}\n}\n@@ -421,9 +426,18 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n/** The value displayed in the trigger. */\nget triggerValue(): string {\n- return this.multiple ?\n- this._selectionModel.selected.map(option => option.viewValue).join(', ') :\n- this._selectionModel.selected[0].viewValue;\n+ if (this._multiple) {\n+ let selectedOptions = this._selectionModel.selected.map(option => option.viewValue);\n+\n+ if (this._isRtl()) {\n+ selectedOptions.reverse();\n+ }\n+\n+ // TODO(crisbeto): delimiter should be configurable for proper localization.\n+ return selectedOptions.join(', ');\n+ }\n+\n+ return this._selectionModel.selected[0].viewValue;\n}\n/** Whether the element is in RTL mode. */\n@@ -431,17 +445,23 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nreturn this._dir ? this._dir.value === 'rtl' : false;\n}\n- /** The width of the trigger element. This is necessary to match\n+ /**\n+ * Sets the width of the trigger element. This is necessary to match\n* the overlay width to the trigger width.\n*/\n- _getWidth(): number {\n- return this._getTriggerRect().width;\n+ private _setTriggerWidth(): void {\n+ this._triggerWidth = this._getTriggerRect().width;\n}\n- /** Ensures the panel opens if activated by the keyboard. */\n+ /** Handles the keyboard interactions of a closed select. */\n_handleKeydown(event: KeyboardEvent): void {\n+ if (!this.disabled) {\nif (event.keyCode === ENTER || event.keyCode === SPACE) {\n+ event.preventDefault(); // prevents the page from scrolling down when pressing space\nthis.open();\n+ } else if (event.keyCode === UP_ARROW || event.keyCode === DOWN_ARROW) {\n+ this._handleArrowKey(event);\n+ }\n}\n}\n@@ -456,6 +476,7 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n} else {\nthis.onClose.emit();\nthis._panelDoneAnimating = false;\n+ this.overlayDir.offsetX = 0;\n}\n}\n@@ -477,12 +498,20 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n}\n}\n+ /**\n+ * Callback that is invoked when the overlay panel has been attached.\n+ */\n+ _onAttached(): void {\n+ this._calculateOverlayOffsetX();\n+ this._setScrollTop();\n+ }\n+\n/**\n* Sets the scroll position of the scroll container. This must be called after\n* the overlay pane is attached or the scroll container element will not yet be\n* present in the DOM.\n*/\n- _setScrollTop(): void {\n+ private _setScrollTop(): void {\nconst scrollContainer =\nthis.overlayDir.overlayRef.overlayElement.querySelector('.md2-select-panel');\nscrollContainer.scrollTop = this._scrollTop;\n@@ -521,11 +550,13 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n* @returns Option that has the corresponding value.\n*/\nprivate _selectValue(value: any): Md2Option {\n- let correspondingOption = this.options.find(option => this.equals(option.value, value));\n+ let optionsArray = this.options.toArray();\n+ let correspondingOption = optionsArray.find(option => this.equals(option.value, value));\nif (correspondingOption) {\ncorrespondingOption.select();\nthis._selectionModel.select(correspondingOption);\n+ this._keyManager.setActiveItem(optionsArray.indexOf(correspondingOption));\n}\nreturn correspondingOption;\n@@ -661,7 +692,6 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n/**\n* Sets the `multiple` property on each option. The promise is necessary\n* in order to avoid Angular errors when modifying the property after init.\n- * TODO: there should be a better way of doing this.\n*/\nprivate _setOptionMultiple() {\nif (this.multiple) {\n@@ -694,7 +724,7 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n/** Focuses the host element when the panel closes. */\nprivate _focusHost(): void {\n- this._renderer.invokeElementMethod(this._element.nativeElement, 'focus');\n+ this._element.nativeElement.focus();\n}\n/** Gets the index of the provided option in the option list. */\n@@ -706,12 +736,6 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n/** Calculates the scroll position and x- and y-offsets of the overlay panel. */\nprivate _calculateOverlayPosition(): void {\n- this._offsetX = this.multiple ? SELECT_MULTIPLE_PANEL_PADDING_X : SELECT_PANEL_PADDING_X;\n-\n- if (!this._isRtl()) {\n- this._offsetX *= -1;\n- }\n-\nconst panelHeight =\nMath.min(this.options.length * SELECT_OPTION_HEIGHT, SELECT_PANEL_MAX_HEIGHT);\nconst scrollContainerHeight = this.options.length * SELECT_OPTION_HEIGHT;\n@@ -725,7 +749,7 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n// center of the overlay panel rather than the top.\nconst scrollBuffer = panelHeight / 2;\nthis._scrollTop = this._calculateOverlayScroll(selectedIndex, scrollBuffer, maxScroll);\n- this._offsetY = this._calculateOverlayOffset(selectedIndex, scrollBuffer, maxScroll);\n+ this._offsetY = this._calculateOverlayOffsetY(selectedIndex, scrollBuffer, maxScroll);\n} else {\n// If no option is selected, the panel centers on the first option. In this case,\n// we must only adjust for the height difference between the option element\n@@ -773,11 +797,11 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\n}\n/**\n- * Determines the CSS `visibility` of the placeholder element.\n+ * Determines the CSS `opacity` of the placeholder element.\n*/\n- _getPlaceholderVisibility(): 'visible' | 'hidden' {\n+ _getPlaceholderOpacity(): string {\nreturn (this.floatPlaceholder !== 'never' || this._selectionModel.isEmpty()) ?\n- 'visible' : 'hidden';\n+ '1' : '0';\n}\n/** Returns the aria-label of the select component. */\n@@ -787,12 +811,46 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nreturn this.ariaLabelledby ? null : this.ariaLabel || this.placeholder;\n}\n+ /**\n+ * Sets the x-offset of the overlay panel in relation to the trigger's top start corner.\n+ * This must be adjusted to align the selected option text over the trigger text when\n+ * the panel opens. Will change based on LTR or RTL text direction. Note that the offset\n+ * can't be calculated until the panel has been attached, because we need to know the\n+ * content width in order to constrain the panel within the viewport.\n+ */\n+ private _calculateOverlayOffsetX(): void {\n+ const overlayRect = this.overlayDir.overlayRef.overlayElement.getBoundingClientRect();\n+ const viewportRect = this._viewportRuler.getViewportRect();\n+ const isRtl = this._isRtl();\n+ let offsetX = this.multiple ? SELECT_MULTIPLE_PANEL_PADDING_X : SELECT_PANEL_PADDING_X;\n+\n+ if (!isRtl) {\n+ offsetX *= -1;\n+ }\n+\n+ const leftOverflow = 0 - (overlayRect.left + offsetX\n+ - (isRtl ? SELECT_PANEL_PADDING_X * 2 : 0));\n+ const rightOverflow = overlayRect.right + offsetX - viewportRect.width\n+ + (isRtl ? 0 : SELECT_PANEL_PADDING_X * 2);\n+\n+ if (leftOverflow > 0) {\n+ offsetX += leftOverflow + SELECT_PANEL_VIEWPORT_PADDING;\n+ } else if (rightOverflow > 0) {\n+ offsetX -= rightOverflow + SELECT_PANEL_VIEWPORT_PADDING;\n+ }\n+\n+ // Set the offset directly in order to avoid having to go through change detection and\n+ // potentially triggering \"changed after it was checked\" errors.\n+ this.overlayDir.offsetX = offsetX;\n+ this.overlayDir.overlayRef.updatePosition();\n+ }\n+\n/**\n* Calculates the y-offset of the select's overlay panel in relation to the\n* top start corner of the trigger. It has to be adjusted in order for the\n* selected option to be aligned over the trigger when the panel opens.\n*/\n- private _calculateOverlayOffset(selectedIndex: number, scrollBuffer: number,\n+ private _calculateOverlayOffsetY(selectedIndex: number, scrollBuffer: number,\nmaxScroll: number): number {\nlet optionOffsetFromPanelTop: number;\n@@ -902,6 +960,31 @@ export class Md2Select implements AfterContentInit, ControlValueAccessor, OnDest\nprivate _floatPlaceholderState(): string {\nreturn this._isRtl() ? 'floating-rtl' : 'floating-ltr';\n}\n+\n+ /** Handles the user pressing the arrow keys on a closed select. */\n+ private _handleArrowKey(event: KeyboardEvent): void {\n+ if (this._multiple) {\n+ event.preventDefault();\n+ this.open();\n+ } else {\n+ const prevActiveItem = this._keyManager.activeItem;\n+\n+ // Cycle though the select options even when the select is closed,\n+ // matching the behavior of the native select element.\n+ // TODO(crisbeto): native selects also cycle through the options with left/right arrows,\n+ // however the key manager only supports up/down at the moment.\n+ this._keyManager.onKeydown(event);\n+\n+ const currentActiveItem = this._keyManager.activeItem as Md2Option;\n+\n+ if (currentActiveItem !== prevActiveItem) {\n+ this._clearSelection();\n+ this._setSelectionByValue(currentActiveItem.value);\n+ this._propagateChanges();\n+ }\n+ }\n+ }\n+\n}\n/** Clamps a value n between min and max values. */\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update select with navigate options through arrow without opening panel |
530,388 | 03.05.2017 17:18:07 | -19,080 | 8417ce33f6b43181082461106aee4616a282b5a2 | chore(datatable) update injection of select module | [
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/data-table.ts",
"new_path": "src/lib/data-table/data-table.ts",
"diff": "@@ -307,7 +307,7 @@ export const MD2_DATA_TABLE_DIRECTIVES: any[] = [\n];\n@NgModule({\n- imports: [CommonModule, FormsModule, Md2SelectModule.forRoot()],\n+ imports: [CommonModule, FormsModule, Md2SelectModule],\nexports: MD2_DATA_TABLE_DIRECTIVES,\ndeclarations: MD2_DATA_TABLE_DIRECTIVES,\n})\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datatable) update injection of select module |
530,388 | 11.05.2017 08:17:06 | -19,080 | 703fe7deedbd810f8fe5f56eff35892af4ffc850 | chore(datepicker) added datepicker reference in module | [
{
"change_type": "MODIFY",
"old_path": "src/lib/index.ts",
"new_path": "src/lib/index.ts",
"diff": "@@ -8,6 +8,7 @@ export * from './collapse/index';\nexport * from './colorpicker/index';\nexport * from './data-table/index';\nexport * from './datepicker/index';\n+export * from './datepicker2/index';\nexport * from './dialog/index';\nexport * from './menu/index';\nexport * from './select/index';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -17,6 +17,7 @@ import { Md2CollapseModule } from './collapse/index';\nimport { Md2ColorpickerModule } from './colorpicker/index';\nimport { Md2DataTableModule } from './data-table/index';\nimport { Md2DatepickerModule } from './datepicker/index';\n+import { Md2Datepicker2Module } from './datepicker2/index';\nimport { Md2DialogModule } from './dialog/index';\nimport { Md2MenuModule } from './menu/index';\nimport { Md2SelectModule } from './select/index';\n@@ -36,6 +37,7 @@ const MD2_MODULES = [\nMd2ColorpickerModule,\nMd2DataTableModule,\nMd2DatepickerModule,\n+ Md2Datepicker2Module,\nMd2DialogModule,\nMd2MenuModule,\nMdRippleModule,\n@@ -63,6 +65,7 @@ const MD2_MODULES = [\nMd2ColorpickerModule.forRoot(),\nMd2DataTableModule.forRoot(),\nMd2DatepickerModule,\n+ Md2Datepicker2Module,\nMd2DialogModule.forRoot(),\nMd2MenuModule.forRoot(),\nMdRippleModule,\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) added datepicker reference in module |
530,388 | 11.05.2017 12:23:14 | -19,080 | 90356bdf4a3b644cd3cb44b4550a325731b31ab8 | chore: updated core | [
{
"change_type": "MODIFY",
"old_path": "src/lib/core/core.ts",
"new_path": "src/lib/core/core.ts",
"diff": "import {NgModule} from '@angular/core';\nimport {MdLineModule} from './line/line';\nimport {RtlModule} from './rtl/dir';\n-import {ObserveContentModule} from './observe-content/observe-content';\nimport {MdOptionModule} from './option/option';\nimport {PortalModule} from './portal/portal-directives';\nimport {OverlayModule} from './overlay/overlay-directives';\n@@ -13,9 +12,6 @@ import {MdRippleModule} from './ripple/index';\n// RTL\nexport {Dir, LayoutDirection, RtlModule} from './rtl/dir';\n-// Mutation Observer\n-export {ObserveContentModule, ObserveContent} from './observe-content/observe-content';\n-\nexport {MdOptionModule, MdOption, MdOptionSelectionChange} from './option/option';\n// Portals\n@@ -37,24 +33,7 @@ export {DomPortalHost} from './portal/dom-portal-host';\nexport * from './platform/index';\n// Overlay\n-export {Overlay, OVERLAY_PROVIDERS} from './overlay/overlay';\n-export {OverlayContainer} from './overlay/overlay-container';\n-export {FullscreenOverlayContainer} from './overlay/fullscreen-overlay-container';\n-export {OverlayRef} from './overlay/overlay-ref';\n-export {OverlayState} from './overlay/overlay-state';\n-export {\n- ConnectedOverlayDirective,\n- OverlayOrigin,\n- OverlayModule,\n-} from './overlay/overlay-directives';\n-export * from './overlay/position/global-position-strategy';\n-export * from './overlay/position/connected-position-strategy';\n-export * from './overlay/position/connected-position';\n-export {ScrollDispatcher} from './overlay/scroll/scroll-dispatcher';\n-export {ScrollStrategy} from './overlay/scroll/scroll-strategy';\n-export {RepositionScrollStrategy} from './overlay/scroll/reposition-scroll-strategy';\n-export {CloseScrollStrategy} from './overlay/scroll/close-scroll-strategy';\n-export {NoopScrollStrategy} from './overlay/scroll/noop-scroll-strategy';\n+export * from './overlay/index';\n// Gestures\nexport {GestureConfig} from './gestures/gesture-config';\n@@ -126,7 +105,6 @@ export {MdCommonModule} from './common-behaviors/common-module';\nMdLineModule,\nRtlModule,\nMdRippleModule,\n- ObserveContentModule,\nPortalModule,\nOverlayModule,\nA11yModule,\n@@ -137,7 +115,6 @@ export {MdCommonModule} from './common-behaviors/common-module';\nMdLineModule,\nRtlModule,\nMdRippleModule,\n- ObserveContentModule,\nPortalModule,\nOverlayModule,\nA11yModule,\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/core/observe-content/observe-content.ts",
"new_path": null,
"diff": "-import {\n- Directive,\n- ElementRef,\n- NgModule,\n- Output,\n- Input,\n- EventEmitter,\n- OnDestroy,\n- AfterContentInit,\n- Injectable,\n-} from '@angular/core';\n-import { Subject } from 'rxjs/Subject';\n-import 'rxjs/add/operator/debounceTime';\n-\n-/**\n- * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n- * @docs-private\n- */\n-@Injectable()\n-export class MdMutationObserverFactory {\n- create(callback: any): MutationObserver {\n- return new MutationObserver(callback);\n- }\n-}\n-\n-/**\n- * Directive that triggers a callback whenever the content of\n- * its associated element has changed.\n- */\n-@Directive({\n- selector: '[cdkObserveContent]'\n-})\n-export class ObserveContent implements AfterContentInit, OnDestroy {\n- private _observer: MutationObserver;\n-\n- /** Event emitted for each change in the element's content. */\n- @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n-\n- /** Used for debouncing the emitted values to the observeContent event. */\n- private _debouncer = new Subject<MutationRecord[]>();\n-\n- /** Debounce interval for emitting the changes. */\n- @Input() debounce: number;\n-\n- constructor(\n- private _mutationObserverFactory: MdMutationObserverFactory,\n- private _elementRef: ElementRef) { }\n-\n- ngAfterContentInit() {\n- if (this.debounce > 0) {\n- this._debouncer\n- .debounceTime(this.debounce)\n- .subscribe(mutations => this.event.emit(mutations));\n- } else {\n- this._debouncer.subscribe(mutations => this.event.emit(mutations));\n- }\n-\n- this._observer = this._mutationObserverFactory.create((mutations: MutationRecord[]) => {\n- this._debouncer.next(mutations);\n- });\n-\n- this._observer.observe(this._elementRef.nativeElement, {\n- characterData: true,\n- childList: true,\n- subtree: true\n- });\n- }\n-\n- ngOnDestroy() {\n- if (this._observer) {\n- this._observer.disconnect();\n- this._debouncer.complete();\n- this._debouncer = this._observer = null;\n- }\n- }\n-}\n-\n-\n-@NgModule({\n- exports: [ObserveContent],\n- declarations: [ObserveContent],\n- providers: [MdMutationObserverFactory]\n-})\n-export class ObserveContentModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/core/overlay/_overlay.scss",
"new_path": "src/lib/core/overlay/_overlay.scss",
"diff": "// The container should be the size of the viewport.\ntop: 0;\nleft: 0;\n- height: 100%;\n- width: 100%;\n+\n+ // Note: we prefer viewport units, because they aren't being offset by the global scrollbar.\n+ height: 100vh;\n+ width: 100vw;\n}\n// The overlay-container is an invisible element which contains all individual overlays.\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/core/overlay/index.ts",
"diff": "+export {Overlay, OVERLAY_PROVIDERS} from './overlay';\n+export {OverlayContainer} from './overlay-container';\n+export {FullscreenOverlayContainer} from './fullscreen-overlay-container';\n+export {OverlayRef} from './overlay-ref';\n+export {OverlayState} from './overlay-state';\n+export {ConnectedOverlayDirective, OverlayOrigin, OverlayModule} from './overlay-directives';\n+export {ScrollDispatcher} from './scroll/scroll-dispatcher';\n+\n+export * from './position/connected-position';\n+\n+// Export pre-defined position strategies and interface to build custom ones.\n+export {PositionStrategy} from './position/position-strategy';\n+export {GlobalPositionStrategy} from './position/global-position-strategy';\n+export {ConnectedPositionStrategy} from './position/connected-position-strategy';\n+\n+// Export pre-defined scroll strategies and interface to build custom ones.\n+export {ScrollStrategy} from './scroll/scroll-strategy';\n+export {RepositionScrollStrategy} from './scroll/reposition-scroll-strategy';\n+export {CloseScrollStrategy} from './scroll/close-scroll-strategy';\n+export {NoopScrollStrategy} from './scroll/noop-scroll-strategy';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/core/overlay/position/connected-position-strategy.ts",
"new_path": "src/lib/core/overlay/position/connected-position-strategy.ts",
"diff": "@@ -108,6 +108,7 @@ export class ConnectedPositionStrategy implements PositionStrategy {\n// Fallback point if none of the fallbacks fit into the viewport.\nlet fallbackPoint: OverlayPoint = null;\n+ let fallbackPosition: ConnectionPositionPair = null;\n// We want to place the overlay in the first of the preferred positions such that the\n// overlay fits on-screen.\n@@ -119,7 +120,7 @@ export class ConnectedPositionStrategy implements PositionStrategy {\n// If the overlay in the calculated position fits on-screen, put it there and we're done.\nif (overlayPoint.fitsInViewport) {\n- this._setElementPosition(element, overlayPoint);\n+ this._setElementPosition(element, overlayRect, overlayPoint, pos);\n// Save the last connected position in case the position needs to be re-calculated.\nthis._lastConnectedPosition = pos;\n@@ -132,12 +133,13 @@ export class ConnectedPositionStrategy implements PositionStrategy {\nreturn Promise.resolve(null);\n} else if (!fallbackPoint || fallbackPoint.visibleArea < overlayPoint.visibleArea) {\nfallbackPoint = overlayPoint;\n+ fallbackPosition = pos;\n}\n}\n// If none of the preferred positions were in the viewport, take the one\n// with the largest visible area.\n- this._setElementPosition(element, fallbackPoint);\n+ this._setElementPosition(element, overlayRect, fallbackPoint, fallbackPosition);\nreturn Promise.resolve(null);\n}\n@@ -155,7 +157,7 @@ export class ConnectedPositionStrategy implements PositionStrategy {\nlet originPoint = this._getOriginConnectionPoint(originRect, lastPosition);\nlet overlayPoint = this._getOverlayPoint(originPoint, overlayRect, viewportRect, lastPosition);\n- this._setElementPosition(this._pane, overlayPoint);\n+ this._setElementPosition(this._pane, overlayRect, overlayPoint, lastPosition);\n}\n/**\n@@ -346,14 +348,48 @@ export class ConnectedPositionStrategy implements PositionStrategy {\n});\n}\n- /**\n- * Physically positions the overlay element to the given coordinate.\n- * @param element\n- * @param overlayPoint\n- */\n- private _setElementPosition(element: HTMLElement, overlayPoint: Point) {\n- element.style.left = overlayPoint.x + 'px';\n- element.style.top = overlayPoint.y + 'px';\n+ /** Physically positions the overlay element to the given coordinate. */\n+ private _setElementPosition(\n+ element: any,\n+ overlayRect: ClientRect,\n+ overlayPoint: Point,\n+ pos: ConnectionPositionPair) {\n+ const viewport = this._viewportRuler.getViewportRect();\n+\n+ // We want to set either `top` or `bottom` based on whether the overlay wants to appear above\n+ // or below the origin and the direction in which the element will expand.\n+ let verticalStyleProperty = pos.overlayY === 'bottom' ? 'bottom' : 'top';\n+\n+ // When using `bottom`, we adjust the y position such that it is the distance\n+ // from the bottom of the viewport rather than the top.\n+ let y = verticalStyleProperty === 'top' ?\n+ overlayPoint.y :\n+ viewport.height - (overlayPoint.y + overlayRect.height);\n+\n+ // We want to set either `left` or `right` based on whether the overlay wants to appear \"before\"\n+ // or \"after\" the origin, which determines the direction in which the element will expand.\n+ // For the horizontal axis, the meaning of \"before\" and \"after\" change based on whether the\n+ // page is in RTL or LTR.\n+ let horizontalStyleProperty: string;\n+ if (this._dir === 'rtl') {\n+ horizontalStyleProperty = pos.overlayX === 'end' ? 'left' : 'right';\n+ } else {\n+ horizontalStyleProperty = pos.overlayX === 'end' ? 'right' : 'left';\n+ }\n+\n+ // When we're setting `right`, we adjust the x position such that it is the distance\n+ // from the right edge of the viewport rather than the left edge.\n+ let x = horizontalStyleProperty === 'left' ?\n+ overlayPoint.x :\n+ viewport.width - (overlayPoint.x + overlayRect.width);\n+\n+\n+ // Reset any existing styles. This is necessary in case the preferred position has\n+ // changed since the last `apply`.\n+ ['top', 'bottom', 'left', 'right'].forEach(p => element.style[p] = null);\n+\n+ element.style[verticalStyleProperty] = `${y}px`;\n+ element.style[horizontalStyleProperty] = `${x}px`;\n}\n/** Returns the bounding positions of the provided element with respect to the viewport. */\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/core/overlay/position/relative-position-strategy.ts",
"new_path": null,
"diff": "-import {PositionStrategy} from './position-strategy';\n-import {ElementRef} from '@angular/core';\n-\n-/** @docs-private */\n-export class RelativePositionStrategy implements PositionStrategy {\n- constructor(private _relativeTo: ElementRef) { }\n-\n- apply(element: Element): Promise<void> {\n- // Not yet implemented.\n- return null;\n- }\n-\n- dispose() {\n- // Not yet implemented.\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/core/platform/platform.ts",
"new_path": "src/lib/core/platform/platform.ts",
"diff": "@@ -19,11 +19,11 @@ export class Platform {\nEDGE = /(edge)/i.test(navigator.userAgent);\nTRIDENT = /(msie|trident)/i.test(navigator.userAgent);\n- // EdgeHTML and Trident mock Blink specific things and need to excluded from this check.\n+ // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\nBLINK = !!(window.chrome || hasV8BreakIterator) && !!CSS && !this.EDGE && !this.TRIDENT;\n- // Webkit is part of the userAgent in EdgeHTML Blink and Trident, so we need to\n- // ensure that Webkit runs standalone and is not use as another engines base.\n+ // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n+ // ensure that Webkit runs standalone and is not used as another engine's base.\nWEBKIT = /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;\n/** Browsers and Platform Types */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -3,7 +3,6 @@ import { NgModule, ModuleWithProviders } from '@angular/core';\nimport {\nMdRippleModule,\nRtlModule,\n- ObserveContentModule,\nPortalModule,\nOverlayModule,\nA11yModule,\n@@ -53,7 +52,6 @@ const MD2_MODULES = [\nA11yModule,\nPlatformModule,\nCompatibilityModule,\n- ObserveContentModule\n];\n@NgModule({\n@@ -76,7 +74,6 @@ const MD2_MODULES = [\nMd2TooltipModule.forRoot(),\nPortalModule,\nRtlModule,\n- ObserveContentModule,\n// These modules include providers.\nA11yModule,\n"
}
] | TypeScript | MIT License | promact/md2 | chore: updated core |
530,388 | 11.05.2017 14:11:01 | -19,080 | 9cc40f52c295bcaa05ea836432d52b320b556557 | chore: update tooltip component | [
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -71,7 +71,7 @@ const MD2_MODULES = [\nMd2TabsModule.forRoot(),\nMd2TagsModule.forRoot(),\nMd2ToastModule.forRoot(),\n- Md2TooltipModule.forRoot(),\n+ Md2TooltipModule,\nPortalModule,\nRtlModule,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/index.ts",
"new_path": "src/lib/tooltip/index.ts",
"diff": "-import {NgModule, ModuleWithProviders} from '@angular/core';\n-import {OverlayModule, CompatibilityModule} from '../core';\n+import {NgModule} from '@angular/core';\n+import {OverlayModule, MdCommonModule} from '../core';\nimport {PlatformModule} from '../core/platform/index';\nimport {Md2Tooltip, Md2TooltipComponent} from './tooltip';\n@NgModule({\n- imports: [OverlayModule, CompatibilityModule, PlatformModule],\n- exports: [Md2Tooltip, Md2TooltipComponent, CompatibilityModule],\n+ imports: [OverlayModule, MdCommonModule, PlatformModule],\n+ exports: [Md2Tooltip, Md2TooltipComponent, MdCommonModule],\ndeclarations: [Md2Tooltip, Md2TooltipComponent],\nentryComponents: [Md2TooltipComponent],\n})\n-export class Md2TooltipModule {\n- /** @deprecated */\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2TooltipModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2TooltipModule {}\nexport * from './tooltip';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/tooltip.scss",
"new_path": "src/lib/tooltip/tooltip.scss",
"diff": "@@ -5,7 +5,7 @@ $md2-tooltip-margin: 14px;\n$md2-tooltip-horizontal-padding: 8px;\n$md2-tooltip-vertical-padding: ($md2-tooltip-target-height - $md2-tooltip-font-size) / 2;\n-md2-tooltip {\n+:host {\npointer-events: none;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/tooltip.ts",
"new_path": "src/lib/tooltip/tooltip.ts",
"diff": "@@ -7,10 +7,8 @@ import {\nNgZone,\nOptional,\nOnDestroy,\n- Renderer,\n- OnInit,\n- ViewEncapsulation,\n- ChangeDetectorRef\n+ Renderer2,\n+ ChangeDetectorRef,\n} from '@angular/core';\nimport {\nstyle,\n@@ -27,6 +25,7 @@ import {\nComponentPortal,\nOverlayConnectionPosition,\nOriginConnectionPosition,\n+ RepositionScrollStrategy,\n} from '../core';\nimport { Md2TooltipInvalidPositionError } from './tooltip-errors';\nimport { Observable } from 'rxjs/Observable';\n@@ -35,7 +34,6 @@ import { Dir } from '../core/rtl/dir';\nimport { Platform } from '../core/platform/index';\nimport 'rxjs/add/operator/first';\nimport { ScrollDispatcher } from '../core/overlay/scroll/scroll-dispatcher';\n-import { Subscription } from 'rxjs/Subscription';\nimport { coerceBooleanProperty } from '../core/coercion/boolean-property';\nexport type TooltipPosition = 'left' | 'right' | 'above' | 'below' | 'before' | 'after';\n@@ -60,10 +58,9 @@ export const SCROLL_THROTTLE_MS = 20;\n},\nexportAs: 'md2Tooltip',\n})\n-export class Md2Tooltip implements OnInit, OnDestroy {\n+export class Md2Tooltip implements OnDestroy {\n_overlayRef: OverlayRef;\n_tooltipInstance: Md2TooltipComponent;\n- scrollSubscription: Subscription;\nprivate _position: TooltipPosition = 'below';\nprivate _disabled: boolean = false;\n@@ -117,28 +114,18 @@ export class Md2Tooltip implements OnInit, OnDestroy {\nprivate _scrollDispatcher: ScrollDispatcher,\nprivate _viewContainerRef: ViewContainerRef,\nprivate _ngZone: NgZone,\n- private _renderer: Renderer,\n+ private _renderer: Renderer2,\nprivate _platform: Platform,\n@Optional() private _dir: Dir) {\n// The mouse events shouldn't be bound on iOS devices, because\n- // they can prevent the first tap from firing it's click event.\n+ // they can prevent the first tap from firing its click event.\nif (!_platform.IOS) {\n_renderer.listen(_elementRef.nativeElement, 'mouseenter', () => this.show());\n_renderer.listen(_elementRef.nativeElement, 'mouseleave', () => this.hide());\n}\n}\n- ngOnInit() {\n- // When a scroll on the page occurs, update the position in case this tooltip needs\n- // to be repositioned.\n- this.scrollSubscription = this._scrollDispatcher.scrolled(SCROLL_THROTTLE_MS, () => {\n- if (this._overlayRef) {\n- this._overlayRef.updatePosition();\n- }\n- });\n- }\n-\n/**\n* Dispose the tooltip when destroyed.\n*/\n@@ -146,10 +133,6 @@ export class Md2Tooltip implements OnInit, OnDestroy {\nif (this._tooltipInstance) {\nthis._disposeTooltip();\n}\n-\n- if (this.scrollSubscription) {\n- this.scrollSubscription.unsubscribe();\n- }\n}\n/** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */\n@@ -214,6 +197,8 @@ export class Md2Tooltip implements OnInit, OnDestroy {\n});\nlet config = new OverlayState();\nconfig.positionStrategy = strategy;\n+ config.scrollStrategy =\n+ new RepositionScrollStrategy(this._scrollDispatcher, SCROLL_THROTTLE_MS);\nthis._overlayRef = this._overlay.create(config);\n}\n@@ -278,6 +263,8 @@ export class Md2Tooltip implements OnInit, OnDestroy {\n// Must wait for the message to be painted to the tooltip so that the overlay can properly\n// calculate the correct positioning based on the size of the text.\nthis._tooltipInstance.message = message;\n+ this._tooltipInstance._markForCheck();\n+\nthis._ngZone.onMicrotaskEmpty.first().subscribe(() => {\nif (this._tooltipInstance) {\nthis._overlayRef.updatePosition();\n@@ -309,8 +296,7 @@ export type TooltipVisibility = 'initial' | 'visible' | 'hidden';\n],\nhost: {\n'(body:click)': 'this._handleBodyInteraction()'\n- },\n- encapsulation: ViewEncapsulation.None\n+ }\n})\nexport class Md2TooltipComponent {\n/** Message to display in the tooltip */\n@@ -360,8 +346,8 @@ export class Md2TooltipComponent {\n// Mark for check so if any parent component has set the\n// ChangeDetectionStrategy to OnPush it will be checked anyways\n- this._changeDetectorRef.markForCheck();\n- setTimeout(() => { this._closeOnInteraction = true; }, 0);\n+ this._markForCheck();\n+ setTimeout(() => this._closeOnInteraction = true, 0);\n}, delay);\n}\n@@ -381,7 +367,7 @@ export class Md2TooltipComponent {\n// Mark for check so if any parent component has set the\n// ChangeDetectionStrategy to OnPush it will be checked anyways\n- this._changeDetectorRef.markForCheck();\n+ this._markForCheck();\n}, delay);\n}\n@@ -429,4 +415,13 @@ export class Md2TooltipComponent {\nthis.hide(0);\n}\n}\n+\n+ /**\n+ * Marks that the tooltip needs to be checked in the next change detection run.\n+ * Mainly used for rendering the initial text before positioning a tooltip, which\n+ * can be problematic in components with OnPush change detection.\n+ */\n+ _markForCheck(): void {\n+ this._changeDetectorRef.markForCheck();\n+ }\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update tooltip component |
530,388 | 11.05.2017 16:40:20 | -19,080 | e91818946ddac297554df5dd4cdd473fc93e5594 | chore: removed root from modules | [
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/accordion.ts",
"new_path": "src/lib/accordion/accordion.ts",
"diff": "import {\n- NgModule,\n- ModuleWithProviders\n+ Component,\n+ EventEmitter,\n+ Input,\n+ Output,\n+ ViewEncapsulation\n} from '@angular/core';\n-import { CommonModule } from '@angular/common';\n+import { Md2AccordionTab } from './accordiontab';\n+import { coerceBooleanProperty } from '../core/core';\n-import { Md2Accordion } from './accordionpanel';\n-import { Md2AccordionTab, Md2AccordionHeader } from './accordiontab';\n+@Component({\n+ moduleId: module.id,\n+ selector: 'md2-accordion',\n+ template: `<ng-content></ng-content>`,\n+ styleUrls: ['accordion.css'],\n+ encapsulation: ViewEncapsulation.None,\n+ exportAs: 'md2Accordion'\n+})\n+export class Md2Accordion {\n-export * from './accordionpanel';\n-export * from './accordiontab';\n+ private _multiple: boolean;\n-export const MD2_ACCORDION_DIRECTIVES: any[] = [Md2Accordion, Md2AccordionTab, Md2AccordionHeader];\n+ @Input()\n+ get multiple(): boolean { return this._multiple; }\n+ set multiple(value) { this._multiple = coerceBooleanProperty(value); }\n-@NgModule({\n- imports: [CommonModule],\n- exports: MD2_ACCORDION_DIRECTIVES,\n- declarations: MD2_ACCORDION_DIRECTIVES,\n-})\n-export class Md2AccordionModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2AccordionModule,\n- providers: []\n- };\n+ @Output() close: EventEmitter<any> = new EventEmitter<any>();\n+ @Output() open: EventEmitter<any> = new EventEmitter<any>();\n+\n+ tabs: Md2AccordionTab[] = [];\n+\n+ /**\n+ * Add or append tab in accordion\n+ * @param tab object of Md2AccordionTab\n+ */\n+ addTab(tab: Md2AccordionTab) {\n+ this.tabs.push(tab);\n}\n}\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/accordion/accordionpanel.ts",
"new_path": null,
"diff": "-import {\n- Component,\n- EventEmitter,\n- Input,\n- Output,\n- ViewEncapsulation\n-} from '@angular/core';\n-import { Md2AccordionTab } from './accordiontab';\n-import { coerceBooleanProperty } from '../core/core';\n-\n-@Component({\n- moduleId: module.id,\n- selector: 'md2-accordion',\n- template: `<ng-content></ng-content>`,\n- styleUrls: ['accordion.css'],\n- encapsulation: ViewEncapsulation.None,\n- exportAs: 'md2Accordion'\n-})\n-export class Md2Accordion {\n-\n- private _multiple: boolean;\n-\n- @Input()\n- get multiple(): boolean { return this._multiple; }\n- set multiple(value) { this._multiple = coerceBooleanProperty(value); }\n-\n- @Output() close: EventEmitter<any> = new EventEmitter<any>();\n- @Output() open: EventEmitter<any> = new EventEmitter<any>();\n-\n- tabs: Md2AccordionTab[] = [];\n-\n- /**\n- * Add or append tab in accordion\n- * @param tab object of Md2AccordionTab\n- */\n- addTab(tab: Md2AccordionTab) {\n- this.tabs.push(tab);\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/accordiontab.ts",
"new_path": "src/lib/accordion/accordiontab.ts",
"diff": "@@ -11,7 +11,7 @@ import {\ntransition,\ntrigger,\n} from '@angular/animations';\n-import { Md2Accordion } from './accordionpanel';\n+import { Md2Accordion } from './accordion';\nimport { coerceBooleanProperty } from '../core';\n@Directive({ selector: 'md2-accordion-header' })\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/index.ts",
"new_path": "src/lib/accordion/index.ts",
"diff": "+import { NgModule } from '@angular/core';\n+import { CommonModule } from '@angular/common';\n+import { Md2Accordion } from './accordion';\n+import { Md2AccordionTab, Md2AccordionHeader } from './accordiontab';\n+\nexport * from './accordion';\n+export * from './accordiontab';\n+\n+@NgModule({\n+ imports: [CommonModule],\n+ exports: [Md2Accordion, Md2AccordionTab, Md2AccordionHeader],\n+ declarations: [Md2Accordion, Md2AccordionTab, Md2AccordionHeader],\n+})\n+export class Md2AccordionModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.ts",
"new_path": "src/lib/autocomplete/autocomplete.ts",
"diff": "@@ -6,17 +6,12 @@ import {\nforwardRef,\nInput,\nOutput,\n- ViewEncapsulation,\n- NgModule,\n- ModuleWithProviders\n+ ViewEncapsulation\n} from '@angular/core';\nimport {\nNG_VALUE_ACCESSOR,\nControlValueAccessor,\n- FormsModule,\n} from '@angular/forms';\n-import { CommonModule } from '@angular/common';\n-import { HighlightPipe } from './autocomplete-pipe';\nimport {\ncoerceBooleanProperty,\nUP_ARROW,\n@@ -362,19 +357,3 @@ export class Md2Autocomplete implements AfterContentInit, ControlValueAccessor {\n}\n}\n-\n-export const MD2_AUTOCOMPLETE_DIRECTIVES = [Md2Autocomplete, HighlightPipe];\n-\n-@NgModule({\n- imports: [CommonModule, FormsModule],\n- exports: MD2_AUTOCOMPLETE_DIRECTIVES,\n- declarations: MD2_AUTOCOMPLETE_DIRECTIVES,\n-})\n-export class Md2AutocompleteModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2AutocompleteModule,\n- providers: []\n- };\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/index.ts",
"new_path": "src/lib/autocomplete/index.ts",
"diff": "+import { NgModule } from '@angular/core';\n+import { FormsModule } from '@angular/forms';\n+import { CommonModule } from '@angular/common';\n+import { HighlightPipe } from './autocomplete-pipe';\n+import { Md2Autocomplete } from './autocomplete';\n+\nexport * from './autocomplete';\nexport * from './autocomplete-pipe';\n+\n+@NgModule({\n+ imports: [CommonModule, FormsModule],\n+ exports: [Md2Autocomplete, HighlightPipe],\n+ declarations: [Md2Autocomplete, HighlightPipe],\n+})\n+export class Md2AutocompleteModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -6,7 +6,6 @@ import {\nViewChild,\nNgModule,\nElementRef,\n- ModuleWithProviders,\nEventEmitter,\nAfterContentInit,\nHostListener,\n@@ -20,7 +19,7 @@ import {\n} from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n-import { Md2AutocompleteModule } from '../autocomplete/autocomplete';\n+import { Md2AutocompleteModule } from '../autocomplete/index';\nimport {\nENTER,\nSPACE,\n@@ -397,11 +396,4 @@ export const MD2_CHIPS_DIRECTIVES: any[] = [Md2Chips];\ndeclarations: MD2_CHIPS_DIRECTIVES,\nexports: MD2_CHIPS_DIRECTIVES\n})\n-export class Md2ChipsModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2ChipsModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2ChipsModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/collapse/collapse.ts",
"new_path": "src/lib/collapse/collapse.ts",
"diff": "@@ -3,10 +3,7 @@ import {\nEventEmitter,\nInput,\nOutput,\n- NgModule,\n- ModuleWithProviders\n} from '@angular/core';\n-import { CommonModule } from '@angular/common';\n@Directive({\nselector: '[collapse]',\n@@ -66,19 +63,3 @@ export class Md2Collapse {\n}\n}\n-\n-export const MD2_COLLAPSE_DIRECTIVES = [Md2Collapse];\n-\n-@NgModule({\n- imports: [CommonModule],\n- exports: MD2_COLLAPSE_DIRECTIVES,\n- declarations: MD2_COLLAPSE_DIRECTIVES,\n-})\n-export class Md2CollapseModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2CollapseModule,\n- providers: []\n- };\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/collapse/index.ts",
"new_path": "src/lib/collapse/index.ts",
"diff": "+import { NgModule } from '@angular/core';\n+import { CommonModule } from '@angular/common';\n+import { Md2Collapse } from './collapse';\n+\nexport * from './collapse';\n+\n+@NgModule({\n+ imports: [CommonModule],\n+ exports: [Md2Collapse],\n+ declarations: [Md2Collapse],\n+})\n+export class Md2CollapseModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.ts",
"new_path": "src/lib/colorpicker/colorpicker.ts",
"diff": "@@ -6,7 +6,6 @@ import {\nElementRef,\nViewEncapsulation,\nNgModule,\n- ModuleWithProviders,\nDirective,\nOnDestroy,\nOptional,\n@@ -688,11 +687,4 @@ export const MD2_COLORPICKER_DIRECTIVES = [\nexports: MD2_COLORPICKER_DIRECTIVES,\nproviders: [ColorUtil]\n})\n-export class Md2ColorpickerModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2ColorpickerModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2ColorpickerModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/data-table.ts",
"new_path": "src/lib/data-table/data-table.ts",
"diff": "@@ -11,7 +11,6 @@ import {\nIterableDiffer,\nViewEncapsulation,\nNgModule,\n- ModuleWithProviders,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n@@ -311,10 +310,4 @@ export const MD2_DATA_TABLE_DIRECTIVES: any[] = [\nexports: MD2_DATA_TABLE_DIRECTIVES,\ndeclarations: MD2_DATA_TABLE_DIRECTIVES,\n})\n-export class Md2DataTableModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2DataTableModule\n- };\n- }\n-}\n+export class Md2DataTableModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/menu/menu.ts",
"new_path": "src/lib/menu/menu.ts",
"diff": "@@ -2,7 +2,6 @@ import {\nComponent,\nViewEncapsulation,\nNgModule,\n- ModuleWithProviders\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { Md2MenuContent } from './menu-content';\n@@ -27,10 +26,4 @@ export class Md2Menu { }\nexports: [Md2Menu, Md2MenuContent, Md2MenuItem, Md2MenuTrigger],\ndeclarations: [Md2Menu, Md2MenuContent, Md2MenuItem, Md2MenuTrigger],\n})\n-export class Md2MenuModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2MenuModule,\n- };\n- }\n-}\n+export class Md2MenuModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -56,21 +56,21 @@ const MD2_MODULES = [\n@NgModule({\nimports: [\n- Md2AccordionModule.forRoot(),\n- Md2AutocompleteModule.forRoot(),\n- Md2ChipsModule.forRoot(),\n- Md2CollapseModule.forRoot(),\n- Md2ColorpickerModule.forRoot(),\n- Md2DataTableModule.forRoot(),\n+ Md2AccordionModule,\n+ Md2AutocompleteModule,\n+ Md2ChipsModule,\n+ Md2CollapseModule,\n+ Md2ColorpickerModule,\n+ Md2DataTableModule,\nMd2DatepickerModule,\nMd2Datepicker2Module,\nMd2DialogModule,\n- Md2MenuModule.forRoot(),\n+ Md2MenuModule,\nMdRippleModule,\nMd2SelectModule,\n- Md2TabsModule.forRoot(),\n- Md2TagsModule.forRoot(),\n- Md2ToastModule.forRoot(),\n+ Md2TabsModule,\n+ Md2TagsModule,\n+ Md2ToastModule,\nMd2TooltipModule,\nPortalModule,\nRtlModule,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tabs/tabs.ts",
"new_path": "src/lib/tabs/tabs.ts",
"diff": "@@ -12,7 +12,6 @@ import {\nViewContainerRef,\nViewEncapsulation,\nNgModule,\n- ModuleWithProviders\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\n@@ -326,11 +325,4 @@ export const MD2_TABS_DIRECTIVES: any[] = [Md2TabLabel, Md2Tabs, Md2Tab];\nexports: MD2_TABS_DIRECTIVES,\ndeclarations: [Md2Transclude, Md2TabLabel, Md2Tabs, Md2Tab],\n})\n-export class Md2TabsModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2TabsModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2TabsModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/tags.ts",
"new_path": "src/lib/tags/tags.ts",
"diff": "@@ -9,7 +9,6 @@ import {\nOutput,\nViewEncapsulation,\nNgModule,\n- ModuleWithProviders\n} from '@angular/core';\nimport {\nNG_VALUE_ACCESSOR,\n@@ -26,7 +25,7 @@ import {\nTAB,\nESCAPE\n} from '../core/core';\n-import { Md2AutocompleteModule } from '../autocomplete/autocomplete';\n+import { Md2AutocompleteModule } from '../autocomplete/index';\nconst noop = () => { };\n@@ -426,11 +425,4 @@ export const MD2_TAGS_DIRECTIVES = [Md2Tags];\nexports: MD2_TAGS_DIRECTIVES,\ndeclarations: MD2_TAGS_DIRECTIVES,\n})\n-export class Md2TagsModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2TagsModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2TagsModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/toast/toast.ts",
"new_path": "src/lib/toast/toast.ts",
"diff": "@@ -3,7 +3,6 @@ import {\nInjectable,\nViewContainerRef,\nNgModule,\n- ModuleWithProviders,\nViewEncapsulation,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\n@@ -194,11 +193,4 @@ export const MD2_TOAST_DIRECTIVES: any[] = [Md2ToastComponent];\nentryComponents: MD2_TOAST_DIRECTIVES,\nproviders: [Md2Toast, Md2ToastConfig, OVERLAY_PROVIDERS]\n})\n-export class Md2ToastModule {\n- static forRoot(): ModuleWithProviders {\n- return {\n- ngModule: Md2ToastModule,\n- providers: []\n- };\n- }\n-}\n+export class Md2ToastModule { }\n"
}
] | TypeScript | MIT License | promact/md2 | chore: removed root from modules |
530,388 | 11.05.2017 16:45:51 | -19,080 | 22ddf286fd3577aeac793ec965b8dbac475984ea | chore: removed md2RootModule | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/demo-app-module.ts",
"new_path": "src/demo-app/demo-app-module.ts",
"diff": "@@ -31,7 +31,7 @@ import {TooltipDemo} from './tooltip/tooltip-demo';\nHttpModule,\nReactiveFormsModule,\nRouterModule.forRoot(DEMO_APP_ROUTES, { useHash: true }),\n- Md2Module.forRoot(),\n+ Md2Module,\n],\ndeclarations: [\nDemoApp,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -54,45 +54,8 @@ const MD2_MODULES = [\nCompatibilityModule,\n];\n-@NgModule({\n- imports: [\n- Md2AccordionModule,\n- Md2AutocompleteModule,\n- Md2ChipsModule,\n- Md2CollapseModule,\n- Md2ColorpickerModule,\n- Md2DataTableModule,\n- Md2DatepickerModule,\n- Md2Datepicker2Module,\n- Md2DialogModule,\n- Md2MenuModule,\n- MdRippleModule,\n- Md2SelectModule,\n- Md2TabsModule,\n- Md2TagsModule,\n- Md2ToastModule,\n- Md2TooltipModule,\n- PortalModule,\n- RtlModule,\n-\n- // These modules include providers.\n- A11yModule,\n- PlatformModule,\n- OverlayModule,\n- CompatibilityModule,\n- ],\n- exports: MD2_MODULES,\n-})\n-export class Md2RootModule { }\n-\n-\n@NgModule({\nimports: MD2_MODULES,\nexports: MD2_MODULES,\n})\n-export class Md2Module {\n- /** @deprecated */\n- static forRoot(): ModuleWithProviders {\n- return { ngModule: Md2RootModule };\n- }\n-}\n+export class Md2Module { }\n"
}
] | TypeScript | MIT License | promact/md2 | chore: removed md2RootModule |
530,388 | 12.05.2017 08:31:13 | -19,080 | 9338d8e45fe6df35bbd327238e576202479a3b5f | fix(tags) design issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/tags.scss",
"new_path": "src/lib/tags/tags.scss",
"diff": "md2-tags {\n- -webkit-user-select: none;\n- -moz-user-select: none;\n- -ms-user-select: none;\nuser-select: none;\n- -moz-backface-visibility: hidden;\n- -webkit-backface-visibility: hidden;\nbackface-visibility: hidden;\n}\n@@ -17,9 +12,7 @@ md2-tags .md2-tags-container {\ndisplay: block;\nmax-width: 100%;\npadding: 2px 3px 8px;\n- border-bottom: 1px solid rgba(0, 0, 0, 0.38);\n- -moz-box-sizing: content-box;\n- -webkit-box-sizing: content-box;\n+ border-bottom: 1px solid rgba(black, 0.12);\nbox-sizing: content-box;\nmin-width: 64px;\nmin-height: 26px;\n@@ -41,13 +34,13 @@ md2-tags.focus .md2-tags-container {\n}\nmd2-tags.md2-tags-disabled .md2-tags-container {\n- color: rgba(0, 0, 0, 0.38);\n+ color: rgba(black, 0.38);\ncursor: default;\n}\nmd2-tags.md2-tags-disabled.focus .md2-tags-container {\npadding-bottom: 8px;\n- border-bottom: 1px solid rgba(0, 0, 0, 0.38);\n+ border-bottom: 1px solid rgba(black, 0.38);\n}\nmd2-tags .md2-tags-container .md2-tag {\n@@ -60,16 +53,12 @@ md2-tags .md2-tags-container .md2-tag {\nmargin: 8px 8px 0 0;\npadding: 0 26px 0 12px;\nfloat: left;\n- -moz-box-sizing: border-box;\n- -webkit-box-sizing: border-box;\nbox-sizing: border-box;\nmax-width: 100%;\nbackground: #e0e0e0;\ncolor: rgb(66, 66, 66);\nwhite-space: nowrap;\noverflow: hidden;\n- -ms-text-overflow: ellipsis;\n- -o-text-overflow: ellipsis;\ntext-overflow: ellipsis;\n}\n@@ -86,7 +75,7 @@ md2-tags .md2-tags-container .md2-tag svg {\ndisplay: inline-block;\noverflow: hidden;\nfill: currentColor;\n- color: rgba(0, 0, 0, 0.54);\n+ color: rgba(black, 0.54);\n}\nmd2-tags .md2-tag.active svg {\n@@ -105,12 +94,12 @@ md2-tags input {\nheight: 32px;\nline-height: 32px;\npadding: 0;\n- color: rgba(0, 0, 0, 0.87);\n+ color: rgba(black, 0.87);\nbackground: 0 0;\n}\nmd2-tags .md2-tags-container .md2-tags-placeholder {\n- color: rgba(0, 0, 0, 0.38);\n+ color: rgba(black, 0.38);\n}\nmd2-tags .md2-tags-menu {\n@@ -119,20 +108,14 @@ md2-tags .md2-tags-menu {\ntop: 100%;\ndisplay: block;\nz-index: 10;\n- -ms-flex-direction: column;\n- -webkit-flex-direction: column;\nflex-direction: column;\nwidth: 100%;\nmargin: 6px 0 0;\npadding: 8px 0;\n- box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 2px 1px -1px rgba(0, 0, 0, 0.12);\n+ box-shadow: 0 1px 3px 0 rgba(black, 0.2), 0 1px 1px 0 rgba(black, 0.14), 0 2px 1px -1px rgba(black, 0.12);\nmax-height: 256px;\nmin-height: 48px;\noverflow-y: auto;\n- -moz-transform: scale(1);\n- -ms-transform: scale(1);\n- -o-transform: scale(1);\n- -webkit-transform: scale(1);\ntransform: scale(1);\nbackground: #fff;\n}\n"
}
] | TypeScript | MIT License | promact/md2 | fix(tags) design issue |
530,388 | 12.05.2017 08:41:03 | -19,080 | 33ff5aba441003fd954f732f4463ca8ac99e63d7 | fix(tags) design issues | [
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/tags.scss",
"new_path": "src/lib/tags/tags.scss",
"diff": "@@ -11,7 +11,7 @@ md2-tags .md2-tags-container {\nposition: relative;\ndisplay: block;\nmax-width: 100%;\n- padding: 2px 3px 8px;\n+ padding: 2px 2px 4px;\nborder-bottom: 1px solid rgba(black, 0.12);\nbox-sizing: content-box;\nmin-width: 64px;\n@@ -50,7 +50,7 @@ md2-tags .md2-tags-container .md2-tag {\ndisplay: block;\nheight: 32px;\nline-height: 32px;\n- margin: 8px 8px 0 0;\n+ margin: 4px 4px 0 0;\npadding: 0 26px 0 12px;\nfloat: left;\nbox-sizing: border-box;\n@@ -85,14 +85,15 @@ md2-tags .md2-tag.active svg {\nmd2-tags .md2-tag-add {\nposition: relative;\ndisplay: inline-block;\n+ margin-left: 4px;\n}\nmd2-tags input {\nborder: 0;\noutline: 0;\n- margin-top: 8px;\n- height: 32px;\n- line-height: 32px;\n+ margin-top: 6px;\n+ height: 30px;\n+ line-height: 30px;\npadding: 0;\ncolor: rgba(black, 0.87);\nbackground: 0 0;\n"
}
] | TypeScript | MIT License | promact/md2 | fix(tags) design issues |
530,388 | 15.05.2017 11:59:59 | -19,080 | c7009c5ae818c8232ea4de995f4a6ea7209f8b8c | chore(tags) update design style | [
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/index.ts",
"new_path": "src/lib/tags/index.ts",
"diff": "+import { NgModule } from '@angular/core';\n+import { CommonModule } from '@angular/common';\n+import { FormsModule } from '@angular/forms';\n+import { Md2AutocompleteModule } from '../autocomplete/index';\n+import { Md2Tags } from './tags';\n+\nexport * from './tags';\n+\n+@NgModule({\n+ imports: [CommonModule, FormsModule, Md2AutocompleteModule],\n+ exports: [Md2Tags],\n+ declarations: [Md2Tags],\n+})\n+export class Md2TagsModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/tags.html",
"new_path": "src/lib/tags/tags.html",
"diff": "<div class=\"md2-tag-add\">\n<input [(ngModel)]=\"_inputValue\" type=\"text\" tabs=\"false\" autocomplete=\"off\" tabindex=\"-1\" [disabled]=\"disabled\" class=\"md2-tags-input\" [placeholder]=\"placeholder\" (focus)=\"_onInputFocus()\" (blur)=\"_onInputBlur()\" (keydown)=\"_handleInputKeydown($event)\" (change)=\"$event.stopPropagation()\" />\n<ul *ngIf=\"isMenuVisible\" class=\"md2-tags-menu\" (mouseenter)=\"_listEnter()\" (mouseleave)=\"_listLeave()\">\n- <li class=\"md2-option\" *ngFor=\"let l of _list; let i = index;\" [class.focused]=\"_focusedTag === i\" (click)=\"_addTag($event, i)\">\n- <span class=\"md2-option-text\" [innerHtml]=\"l.text | highlight:_inputValue\"></span>\n+ <li class=\"md2-tag-option\" *ngFor=\"let l of _list; let i = index;\" [class.focused]=\"_focusedTag === i\" (click)=\"_addTag($event, i)\">\n+ <span class=\"md2-tag-option-text\" [innerHtml]=\"l.text | highlight:_inputValue\"></span>\n</li>\n</ul>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/tags.scss",
"new_path": "src/lib/tags/tags.scss",
"diff": "-md2-tags {\n- user-select: none;\n- backface-visibility: hidden;\n-}\n+$primary: #106cc8 !default;\n+$warn: #f44336 !default;\n-md2-tags:focus {\n+:host {\noutline: none;\n+ user-select: none;\n+ backface-visibility: hidden;\n}\n-md2-tags .md2-tags-container {\n+.md2-tags-container {\nposition: relative;\ndisplay: block;\nmax-width: 100%;\n@@ -28,22 +28,22 @@ md2-tags .md2-tags-container {\n}\n}\n-md2-tags.focus .md2-tags-container {\n- padding-bottom: 7px;\n- border-bottom: 2px solid #106cc8;\n+.focus .md2-tags-container {\n+ padding-bottom: 3px;\n+ border-bottom: 2px solid $primary;\n}\n-md2-tags.md2-tags-disabled .md2-tags-container {\n+.md2-tags-disabled .md2-tags-container {\ncolor: rgba(black, 0.38);\ncursor: default;\n}\n-md2-tags.md2-tags-disabled.focus .md2-tags-container {\n- padding-bottom: 8px;\n+.md2-tags-disabled.focus .md2-tags-container {\n+ padding-bottom: 4px;\nborder-bottom: 1px solid rgba(black, 0.38);\n}\n-md2-tags .md2-tags-container .md2-tag {\n+.md2-tag {\nposition: relative;\ncursor: default;\nborder-radius: 16px;\n@@ -60,14 +60,17 @@ md2-tags .md2-tags-container .md2-tag {\nwhite-space: nowrap;\noverflow: hidden;\ntext-overflow: ellipsis;\n-}\n-md2-tags .md2-tags-container .md2-tag.active {\n- background: #106cc8;\n- color: rgba(255, 255, 255, 0.87);\n+ &.active {\n+ background: $primary;\n+ color: rgba(white, 0.87);\n+\n+ svg {\n+ color: rgba(white, 0.87);\n+ }\n}\n-md2-tags .md2-tags-container .md2-tag svg {\n+ svg {\nposition: absolute;\ntop: 4px;\nright: 2px;\n@@ -77,18 +80,15 @@ md2-tags .md2-tags-container .md2-tag svg {\nfill: currentColor;\ncolor: rgba(black, 0.54);\n}\n-\n-md2-tags .md2-tag.active svg {\n- color: rgba(255, 255, 255, 0.87);\n}\n-md2-tags .md2-tag-add {\n+.md2-tag-add {\nposition: relative;\ndisplay: inline-block;\nmargin-left: 4px;\n}\n-md2-tags input {\n+input {\nborder: 0;\noutline: 0;\nmargin-top: 6px;\n@@ -99,11 +99,11 @@ md2-tags input {\nbackground: 0 0;\n}\n-md2-tags .md2-tags-container .md2-tags-placeholder {\n+.md2-tags-placeholder {\ncolor: rgba(black, 0.38);\n}\n-md2-tags .md2-tags-menu {\n+.md2-tags-menu {\nposition: absolute;\nleft: 0;\ntop: 100%;\n@@ -119,9 +119,9 @@ md2-tags .md2-tags-menu {\noverflow-y: auto;\ntransform: scale(1);\nbackground: #fff;\n-}\n+ backface-visibility: hidden;\n-md2-tags .md2-tags-menu .md2-option {\n+ .md2-tag-option {\ncursor: pointer;\nposition: relative;\ndisplay: block;\n@@ -131,17 +131,20 @@ md2-tags .md2-tags-menu .md2-option {\ntransition: background 150ms linear;\npadding: 12px 16px;\nline-height: 24px;\n-}\n+ box-sizing: border-box;\n-md2-tags .md2-tags-menu .md2-option:hover, md2-tags .md2-tags-menu .md2-option.focused {\n+ &:hover,\n+ &.focused {\nbackground: #eeeeee;\n}\n-md2-tags .md2-tags-menu .md2-option .md2-option-text {\n+ .md2-tag-option-text {\nwidth: auto;\nfont-size: 16px;\n}\n+ }\n+}\n-md2-tags .highlight {\n+.highlight {\ncolor: #757575;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/tags.ts",
"new_path": "src/lib/tags/tags.ts",
"diff": "@@ -8,14 +8,11 @@ import {\nInput,\nOutput,\nViewEncapsulation,\n- NgModule,\n} from '@angular/core';\nimport {\nNG_VALUE_ACCESSOR,\nControlValueAccessor,\n- FormsModule,\n} from '@angular/forms';\n-import { CommonModule } from '@angular/common';\nimport {\ncoerceBooleanProperty,\nLEFT_ARROW,\n@@ -25,7 +22,6 @@ import {\nTAB,\nESCAPE\n} from '../core/core';\n-import { Md2AutocompleteModule } from '../autocomplete/index';\nconst noop = () => { };\n@@ -417,12 +413,3 @@ export class Md2Tags implements AfterContentInit, ControlValueAccessor {\n}\n}\n-\n-export const MD2_TAGS_DIRECTIVES = [Md2Tags];\n-\n-@NgModule({\n- imports: [CommonModule, FormsModule, Md2AutocompleteModule],\n- exports: MD2_TAGS_DIRECTIVES,\n- declarations: MD2_TAGS_DIRECTIVES,\n-})\n-export class Md2TagsModule { }\n"
}
] | TypeScript | MIT License | promact/md2 | chore(tags) update design style |
530,388 | 15.05.2017 12:00:29 | -19,080 | 208365e557eacad5049d8c4277e81ae208462563 | chore(demo) fix design issue | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/assets/css/style.scss",
"new_path": "src/demo-app/assets/css/style.scss",
"diff": "@@ -396,7 +396,7 @@ html, body {\n}\n}\n-.card {\n+.table-card {\n.content {\noverflow-x: auto;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/data-table/data-table-demo.html",
"new_path": "src/demo-app/data-table/data-table-demo.html",
"diff": "<div class=\"demo-data-table\">\n<h1>Data Table</h1>\n<hr />\n- <div class=\"card\">\n+ <div class=\"card table-card\">\n<div class=\"header\">\n<h3 class=\"title\">Basic Data Table</h3>\n</div>\n"
}
] | TypeScript | MIT License | promact/md2 | chore(demo) fix design issue |
530,388 | 15.05.2017 12:11:59 | -19,080 | 7349cd836eb576e44ef2b0102d5794d7943ad8b9 | chore(tabs) fix alignment and spacing issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/tabs/tabs.html",
"new_path": "src/lib/tabs/tabs.html",
"diff": "<em class=\"next-icon\">Next</em>\n</div>\n<div class=\"md2-tabs-canvas\" [class.md2-paginated]=\"_shouldPaginate\" role=\"tablist\" tabindex=\"0\" (keydown.arrowRight)=\"focusNextTab()\" (keydown.arrowLeft)=\"focusPreviousTab()\" (keydown.enter)=\"selectedIndex = focusIndex\" (mousewheel)=\"scroll($event)\">\n- <div class=\"md2-tabs-header\" [style.marginLeft]=\"-_offsetLeft + 'px'\">\n+ <div class=\"md2-tabs-header\" [style.marginLeft.px]=\"-_offsetLeft\">\n<div class=\"md2-tab-label\" role=\"tab\" *ngFor=\"let tab of tabs; let i = index\" [class.focus]=\"focusIndex === i\" [class.active]=\"selectedIndex === i\" [class.disabled]=\"tab.disabled\" (click)=\"focusIndex = selectedIndex = i\">\n<span [md2Transclude]=\"tab.labelRef\">{{tab.label}}</span>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tabs/tabs.ts",
"new_path": "src/lib/tabs/tabs.ts",
"diff": "@@ -311,8 +311,8 @@ export class Md2Tabs implements AfterContentInit {\nif (!elements.tabs.length || !this._shouldPaginate) { return 0; }\nlet lastTab = elements.tabs[elements.tabs.length - 1],\ntotalWidth = lastTab.offsetLeft + lastTab.offsetWidth;\n- value = Math.max(0, value);\nvalue = Math.min(totalWidth - elements.canvas.clientWidth, value);\n+ value = Math.max(0, value);\nreturn value;\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore(tabs) fix alignment and spacing issue |
530,400 | 26.04.2017 15:44:25 | -3,600 | dd69e760e5a6c6bae781ad5c91db63820b20abd7 | fix: usage of dynamic i18n arrays | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-locale.ts",
"new_path": "src/lib/datepicker/date-locale.ts",
"diff": "@@ -43,21 +43,6 @@ export class DateLocale {\nfirstDayOfWeek = 0;\n- months = [\n- { full: 'January', short: 'Jan' },\n- { full: 'February', short: 'Feb' },\n- { full: 'March', short: 'Mar' },\n- { full: 'April', short: 'Apr' },\n- { full: 'May', short: 'May' },\n- { full: 'June', short: 'Jun' },\n- { full: 'July', short: 'Jul' },\n- { full: 'August', short: 'Aug' },\n- { full: 'September', short: 'Sep' },\n- { full: 'October', short: 'Oct' },\n- { full: 'November', short: 'Nov' },\n- { full: 'December', short: 'Dec' },\n- ];\n-\nfullMonths = SUPPORTS_INTL_API ? this._createMonthsArray('long') :\n[\n'January',\n@@ -80,15 +65,10 @@ export class DateLocale {\nnarrowMonths = SUPPORTS_INTL_API ? this._createMonthsArray('narrow') :\n['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];\n- days = [\n- { full: 'Sunday', short: 'Sun', xshort: 'S' },\n- { full: 'Monday', short: 'Mon', xshort: 'M' },\n- { full: 'Tuesday', short: 'Tue', xshort: 'T' },\n- { full: 'Wednesday', short: 'Wed', xshort: 'W' },\n- { full: 'Thursday', short: 'Thu', xshort: 'T' },\n- { full: 'Friday', short: 'Fri', xshort: 'F' },\n- { full: 'Saturday', short: 'Sat', xshort: 'S' },\n- ];\n+ months = this.fullMonths.map((val, index) => {\n+ return { full: val, short: this.shortMonths[index], xshort: this.narrowMonths[index] };\n+ });\n+\nfullDays = SUPPORTS_INTL_API ? this._createDaysArray('long') :\n['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];\n@@ -99,6 +79,11 @@ export class DateLocale {\nnarrowDays = SUPPORTS_INTL_API ? this._createDaysArray('narrow') :\n['S', 'M', 'T', 'W', 'T', 'F', 'S'];\n+ days = this.fullDays.map((val, index) => {\n+ return { full: val, short: this.shortDays[index], xshort: this.narrowDays[index] };\n+ });\n+\n+\ngetDays() {\nreturn this.days.slice(this.firstDayOfWeek, this.days.length)\n.concat(this.days.slice(0, this.firstDayOfWeek));\n"
}
] | TypeScript | MIT License | promact/md2 | fix: usage of dynamic i18n arrays |
530,388 | 16.05.2017 15:14:35 | -19,080 | 82a7bf2e314b794235d12c44264b73566feefb46 | fix(datepicker) date format issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.html",
"new_path": "src/lib/datepicker/datepicker.html",
"diff": "<div class=\"md2-datepicker-header-year\"\n*ngIf=\"type!=='time'\"\n[class.active]=\"_isYearsVisible\"\n- (click)=\"_showYear()\">{{ date | date: 'y' }}</div>\n+ (click)=\"_showYear()\">{{ activeDate | date: 'y' }}</div>\n<div class=\"md2-datepicker-header-date-time\">\n<span class=\"md2-datepicker-header-date\"\n*ngIf=\"type!=='time'\"\n<div class=\"md2-calendar-years-content\">\n<div *ngFor=\"let y of _years\"\nclass=\"md2-calendar-year\"\n- [class.selected]=\"y === date.getFullYear()\"\n+ [class.selected]=\"y === activeDate.getFullYear()\"\n(click)=\"_setYear(y)\">{{y}}</div>\n</div>\n</div>\n<td *ngFor=\"let d of w\">\n<div class=\"md2-calendar-day\"\n[class.today]=\"d.today\"\n- [class.focus]=\"_util.isSameDay(date, d.date)\"\n+ [class.focus]=\"_util.isSameDay(activeDate, d.date)\"\n[class.selected]=\"_util.isSameDay(selected, d.date)\"\n[class.disabled]=\"d.disabled\"\n[class.prev-month]=\"d.calMonth===_prevMonth\"\n<md2-clock [class.active]=\"!_isCalendarVisible\"\n[startView]=\"_clockView\"\n[interval]=\"timeInterval\"\n- [selected]=\"date\"\n+ [selected]=\"activeDate\"\n[min]=\"min\"\n[max]=\"max\"\n(activeDateChange)=\"_onActiveTimeChange($event)\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -86,7 +86,6 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nprivate _value: Date = null;\nprivate _selected: Date = null;\n- private _date: Date = null;\nprivate _panelOpen = false;\n@@ -147,7 +146,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\nngAfterContentInit() {\n- this.date = this._date || this._util.today();\n+ this.activeDate = this._activeDate || this._util.today();\n}\nngOnDestroy() { this.destroyPanel(); }\n@@ -208,22 +207,23 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nget value() { return this._value; }\nset value(value: Date) {\nthis._value = this.coerceDateProperty(value);\n- this.date = this._value;\n+ if (this._value) { this.activeDate = this._value; }\nsetTimeout(() => {\nthis._input.nativeElement.value = this._formatDate(this._value);\n});\n}\n- get date() { return this._date; }\n- set date(value: Date) {\n- this._date = this._util.clampDate(value, this.min, this.max);\n+ get activeDate(): Date { return this._activeDate; }\n+ set activeDate(value: Date) {\n+ this._activeDate = this._util.clampDate(value, this.min, this.max);\n}\n+ private _activeDate: Date;\nget minutes(): string {\n- return ('0' + this._date.getMinutes()).slice(-2);\n+ return ('0' + this._activeDate.getMinutes()).slice(-2);\n}\nget hours(): string {\n- return ('0' + this._date.getHours()).slice(-2);\n+ return ('0' + this._activeDate.getHours()).slice(-2);\n}\n@Input()\n@@ -272,11 +272,11 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\nget getDateLabel(): string {\n- return this._locale.getDateLabel(this.date);\n+ return this._locale.getDateLabel(this.activeDate);\n}\nget getMonthLabel(): string {\n- return this._locale.getMonthLabel(this.date.getMonth(), this.date.getFullYear());\n+ return this._locale.getMonthLabel(this.activeDate.getMonth(), this.activeDate.getFullYear());\n}\ntoggle(): void {\n@@ -297,7 +297,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis._subscribeToBackdrop();\nthis._panelOpen = true;\nthis.selected = this.value || new Date(1, 0, 1);\n- this.date = this.value || this.today;\n+ this.activeDate = this.value || this.today;\nthis.generateCalendar();\n}\n@@ -309,7 +309,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis._openOnFocus = false;\nsetTimeout(() => { this._openOnFocus = true; }, 100);\n}\n- // if (!this._date) {\n+ // if (!this._activeDate) {\n// this._placeholderState = '';\n// }\nif (this._overlayRef) {\n@@ -400,21 +400,21 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\ncase TAB:\ncase ESCAPE: this._onBlur(); this.close(); break;\n}\n- let date = this.date;\n+ let date = this.activeDate;\nif (this._isYearsVisible) {\nswitch (event.keyCode) {\ncase ENTER:\ncase SPACE: this._onClickOk(); break;\ncase DOWN_ARROW:\n- if (this.date.getFullYear() < (this.today.getFullYear() + 100)) {\n- this.date = this._util.incrementYears(date, 1);\n+ if (this.activeDate.getFullYear() < (this.today.getFullYear() + 100)) {\n+ this.activeDate = this._util.incrementYears(date, 1);\nthis._scrollToSelectedYear();\n}\nbreak;\ncase UP_ARROW:\n- if (this.date.getFullYear() > 1900) {\n- this.date = this._util.incrementYears(date, -1);\n+ if (this.activeDate.getFullYear() > 1900) {\n+ this.activeDate = this._util.incrementYears(date, -1);\nthis._scrollToSelectedYear();\n}\nbreak;\n@@ -423,71 +423,71 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n} else if (this._isCalendarVisible) {\nswitch (event.keyCode) {\ncase ENTER:\n- case SPACE: this.setDate(this.date); break;\n+ case SPACE: this.setDate(this.activeDate); break;\ncase RIGHT_ARROW:\n- this.date = this._util.incrementDays(date, 1);\n+ this.activeDate = this._util.incrementDays(date, 1);\nbreak;\ncase LEFT_ARROW:\n- this.date = this._util.incrementDays(date, -1);\n+ this.activeDate = this._util.incrementDays(date, -1);\nbreak;\ncase PAGE_DOWN:\nif (event.shiftKey) {\n- this.date = this._util.incrementYears(date, 1);\n+ this.activeDate = this._util.incrementYears(date, 1);\n} else {\n- this.date = this._util.incrementMonths(date, 1);\n+ this.activeDate = this._util.incrementMonths(date, 1);\n}\nbreak;\ncase PAGE_UP:\nif (event.shiftKey) {\n- this.date = this._util.incrementYears(date, -1);\n+ this.activeDate = this._util.incrementYears(date, -1);\n} else {\n- this.date = this._util.incrementMonths(date, -1);\n+ this.activeDate = this._util.incrementMonths(date, -1);\n}\nbreak;\ncase DOWN_ARROW:\n- this.date = this._util.incrementDays(date, 7);\n+ this.activeDate = this._util.incrementDays(date, 7);\nbreak;\ncase UP_ARROW:\n- this.date = this._util.incrementDays(date, -7);\n+ this.activeDate = this._util.incrementDays(date, -7);\nbreak;\ncase HOME:\n- this.date = this._util.getFirstDateOfMonth(date);\n+ this.activeDate = this._util.getFirstDateOfMonth(date);\nbreak;\ncase END:\n- this.date = this._util.getLastDateOfMonth(date);\n+ this.activeDate = this._util.getLastDateOfMonth(date);\nbreak;\n}\n- if (!this._util.isSameMonthAndYear(date, this.date)) {\n+ if (!this._util.isSameMonthAndYear(date, this.activeDate)) {\nthis.generateCalendar();\n}\n} else if (this._clockView === 'hour') {\nswitch (event.keyCode) {\ncase ENTER:\n- case SPACE: this.setHour(this.date.getHours()); break;\n+ case SPACE: this.setHour(this.activeDate.getHours()); break;\ncase UP_ARROW:\n- this.date = this._util.incrementHours(date, 1);\n+ this.activeDate = this._util.incrementHours(date, 1);\nbreak;\ncase DOWN_ARROW:\n- this.date = this._util.incrementHours(date, -1);\n+ this.activeDate = this._util.incrementHours(date, -1);\nbreak;\n}\n} else {\nswitch (event.keyCode) {\ncase ENTER:\ncase SPACE:\n- this.setMinute(this.date.getMinutes());\n+ this.setMinute(this.activeDate.getMinutes());\nbreak;\ncase UP_ARROW:\n- this.date = this._util.incrementMinutes(date, 1);\n+ this.activeDate = this._util.incrementMinutes(date, 1);\nbreak;\ncase DOWN_ARROW:\n- this.date = this._util.incrementMinutes(date, -1);\n+ this.activeDate = this._util.incrementMinutes(date, -1);\nbreak;\n}\n}\n@@ -574,8 +574,8 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n* @param year\n*/\n_setYear(year: number) {\n- this.date = new Date(year, this.date.getMonth(), this.date.getDate(),\n- this.date.getHours(), this.date.getMinutes());\n+ this.activeDate = new Date(year, this.activeDate.getMonth(), this.activeDate.getDate(),\n+ this.activeDate.getHours(), this.activeDate.getMinutes());\nthis.generateCalendar();\nthis._isYearsVisible = false;\n}\n@@ -607,11 +607,11 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis._isYearsVisible = false;\nthis._isCalendarVisible = true;\n} else if (this._isCalendarVisible) {\n- this.setDate(this.date);\n+ this.setDate(this.activeDate);\n} else if (this._clockView === 'hour') {\nthis._clockView = 'minute';\n} else {\n- this.value = this.date;\n+ this.value = this.activeDate;\nthis._emitChangeEvent();\nthis._onBlur();\nthis.close();\n@@ -648,7 +648,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis.close();\n} else {\nthis.selected = date;\n- this.date = date;\n+ this.activeDate = date;\nthis._isCalendarVisible = false;\nthis._clockView = 'hour';\n}\n@@ -659,7 +659,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n* @param noOfMonths increment number of months\n*/\n_updateMonth(noOfMonths: number) {\n- this.date = this._util.incrementMonths(this.date, noOfMonths);\n+ this.activeDate = this._util.incrementMonths(this.activeDate, noOfMonths);\nthis.generateCalendar();\nif (noOfMonths > 0) {\nthis.calendarState('right');\n@@ -674,7 +674,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\n_isBeforeMonth() {\nreturn !this.min ? true :\n- this.min && this._util.getMonthDistance(this.date, this.min) < 0;\n+ this.min && this._util.getMonthDistance(this.activeDate, this.min) < 0;\n}\n/**\n@@ -683,11 +683,11 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\n_isAfterMonth() {\nreturn !this._max ? true :\n- this._max && this._util.getMonthDistance(this.date, this._max) > 0;\n+ this._max && this._util.getMonthDistance(this.activeDate, this._max) > 0;\n}\n_onActiveTimeChange(event: Date) {\n- this.date = event;\n+ this.activeDate = event;\n}\n_onTimeChange(event: Date) {\n@@ -724,9 +724,9 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\nprivate generateCalendar(): void {\nthis._dates.length = 0;\n- let year = this.date.getFullYear();\n- let month = this.date.getMonth();\n- let firstDayOfMonth = this._util.getFirstDateOfMonth(this.date);\n+ let year = this.activeDate.getFullYear();\n+ let month = this.activeDate.getMonth();\n+ let firstDayOfMonth = this._util.getFirstDateOfMonth(this.activeDate);\nlet calMonth = this._prevMonth;\nlet date = this._util.getFirstDateOfWeek(firstDayOfMonth, this._locale.firstDayOfWeek);\ndo {\n@@ -759,8 +759,8 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\nprivate setHour(hour: number) {\nthis._clockView = 'minute';\n- this.date = new Date(this.date.getFullYear(), this.date.getMonth(),\n- this.date.getDate(), hour, this.date.getMinutes());\n+ this.activeDate = new Date(this.activeDate.getFullYear(), this.activeDate.getMonth(),\n+ this.activeDate.getDate(), hour, this.activeDate.getMinutes());\n}\n/**\n@@ -768,10 +768,10 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n* @param minute number of minutes\n*/\nprivate setMinute(minute: number) {\n- this.date = new Date(this.date.getFullYear(), this.date.getMonth(),\n- this.date.getDate(), this.date.getHours(), minute);\n- this.selected = this.date;\n- this.value = this.date;\n+ this.activeDate = new Date(this.activeDate.getFullYear(), this.activeDate.getMonth(),\n+ this.activeDate.getDate(), this.activeDate.getHours(), minute);\n+ this.selected = this.activeDate;\n+ this.value = this.activeDate;\nthis._emitChangeEvent();\nthis._onBlur();\nthis.close();\n@@ -802,21 +802,50 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\nprivate _formatDate(date: Date): string {\nif (!this.format || !date) { return ''; }\n- return this.format\n- .replace('yy', ('00' + date.getFullYear()).slice(-2))\n- .replace('y', '' + date.getFullYear())\n- .replace('MMMM', this._locale.months[date.getMonth()].full)\n- .replace('MMM', this._locale.months[date.getMonth()].short)\n- .replace('MM', ('0' + (date.getMonth() + 1)).slice(-2))\n- .replace('M', '' + (date.getMonth() + 1))\n- .replace('dd', ('0' + date.getDate()).slice(-2))\n- .replace('d', '' + date.getDate())\n- .replace('HH', ('0' + date.getHours()).slice(-2))\n- .replace('H', '' + date.getHours())\n- .replace('mm', ('0' + date.getMinutes()).slice(-2))\n- .replace('m', '' + date.getMinutes())\n- .replace('ss', ('0' + date.getSeconds()).slice(-2))\n- .replace('s', '' + date.getSeconds());\n+\n+ let format = this.format;\n+\n+ if (format.indexOf('yy') > -1) {\n+ format = format.replace('yy', ('00' + date.getFullYear()).slice(-2));\n+ } else if (format.indexOf('y') > -1) {\n+ format = format.replace('y', '' + date.getFullYear());\n+ }\n+\n+ if (format.indexOf('MMMM') > -1) {\n+ format = format.replace('MMMM', this._locale.months[date.getMonth()].full);\n+ } else if (format.indexOf('MMM') > -1) {\n+ format = format.replace('MMM', this._locale.months[date.getMonth()].short);\n+ } else if (format.indexOf('MM') > -1) {\n+ format = format.replace('MM', ('0' + (date.getMonth() + 1)).slice(-2));\n+ } else if (format.indexOf('M') > -1) {\n+ format = format.replace('M', '' + (date.getMonth() + 1));\n+ }\n+\n+ if (format.indexOf('dd') > -1) {\n+ format = format.replace('dd', ('0' + date.getDate()).slice(-2));\n+ } else if (format.indexOf('d') > -1) {\n+ format = format.replace('d', '' + date.getDate());\n+ }\n+\n+ if (format.indexOf('HH') > -1) {\n+ format = format.replace('HH', ('0' + date.getHours()).slice(-2));\n+ } else if (format.indexOf('H') > -1) {\n+ format = format.replace('H', '' + date.getHours());\n+ }\n+\n+ if (format.indexOf('mm') > -1) {\n+ format = format.replace('mm', ('0' + date.getMinutes()).slice(-2));\n+ } else if (format.indexOf('m') > -1) {\n+ format = format.replace('m', '' + date.getMinutes());\n+ }\n+\n+ if (format.indexOf('ss') > -1) {\n+ format = format.replace('ss', ('0' + date.getSeconds()).slice(-2));\n+ } else if (format.indexOf('s') > -1) {\n+ format = format.replace('s', '' + date.getSeconds());\n+ }\n+\n+ return format;\n}\nprivate _subscribeToBackdrop(): void {\n"
}
] | TypeScript | MIT License | promact/md2 | fix(datepicker) date format issue #205 |
530,390 | 05.05.2017 23:46:26 | -7,200 | 1f52e873e2745fda84e3b0c0603158b863ff7a9c | feat (datepicker): add 12-hour date format to the Date Format options | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/README.md",
"new_path": "src/lib/datepicker/README.md",
"diff": "@@ -49,6 +49,8 @@ A datepicker would have the following markup.\n| hour | `H` | - | - | - | H(13) | HH(13) |\n| minute | `m` | - | - | - | m(5) | mm(05) |\n| second | `s` | - | - | - | s(5) | ss(05) |\n+| am/pm | `a` | - | - | - | - | - |\n+| AM/PM | `A` | - | - | - | - | - |\n#### Keyboard interaction:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-util.ts",
"new_path": "src/lib/datepicker/date-util.ts",
"diff": "@@ -22,7 +22,8 @@ export class DateUtil {\n'k': [3, 1],\n's': 5,\n'S': 6,\n- 'a': [3, ['am', 'pm']]\n+ 'a': [3, ['am', 'pm']],\n+ 'A': [3, ['AM', 'PM']]\n};\nreplace(s: string, regexp: any, sub?: string) {\n@@ -112,7 +113,7 @@ export class DateUtil {\ntimezoneIndex = reIndex;\nreIndex += 3;\nreturn '([+-])(\\\\d\\\\d)(\\\\d\\\\d)';\n- } else if (/[Nna]/.test(placeholderChar)) {\n+ } else if (/[NnaA]/.test(placeholderChar)) {\nindexMap[reIndex++] = [placeholderChar, param && param.split(',')];\nreturn '([a-zA-Z\\\\u0080-\\\\u1fff]+)';\n} else if (/w/i.test(placeholderChar)) {\n@@ -146,7 +147,7 @@ export class DateUtil {\nif (listValue == null) {\nreturn undefined;\n}\n- if (placeholderChar == 'a') {\n+ if (placeholderChar == 'a' || placeholderChar == 'A') {\nctorArgs[ctorIndex] += listValue * 12;\n} else {\nctorArgs[ctorIndex] = listValue;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -792,6 +792,20 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis.disabled = isDisabled;\n}\n+ /**\n+ * Get an hour of the date in the 12-hour format\n+ * @param date Date Object\n+ * @return hour of the date in the 12-hour format\n+ */\n+ private _getHours12(date: Date): number {\n+ let hrs = date.getHours();\n+ if (hrs == 0)\n+ hrs = 12;\n+ else if (hrs > 12)\n+ hrs -= 12;\n+ return hrs;\n+ }\n+\n/**\n* format date\n* @param date Date Object\n@@ -824,11 +838,24 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nformat = format.replace('d', '' + date.getDate());\n}\n+ if (/[aA]/.test(format)) {\n+ // 12-hour\n+ if (format.indexOf('HH') > -1) {\n+ format = format.replace('HH', ('0' + this._getHours12(date)).slice(-2));\n+ } else if (format.indexOf('H') > -1) {\n+ format = format.replace('H', '' + this._getHours12(date));\n+ }\n+ format = format.replace('A', ((date.getHours() < 12) ? 'AM' : 'PM'))\n+ .replace('a', ((date.getHours() < 12) ? 'am' : 'pm'));\n+ }\n+ else {\n+ // 24-hour\nif (format.indexOf('HH') > -1) {\nformat = format.replace('HH', ('0' + date.getHours()).slice(-2));\n} else if (format.indexOf('H') > -1) {\nformat = format.replace('H', '' + date.getHours());\n}\n+ }\nif (format.indexOf('mm') > -1) {\nformat = format.replace('mm', ('0' + date.getMinutes()).slice(-2));\n"
}
] | TypeScript | MIT License | promact/md2 | feat (datepicker): add 12-hour date format to the Date Format options |
530,390 | 07.05.2017 18:05:16 | -7,200 | cddc9cef56fde35b77e401eba659d524f092e038 | feat (datepicker): AM/PM support for the choosing panel | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.html",
"new_path": "src/lib/datepicker/datepicker.html",
"diff": "(click)=\"_toggleHours('hour')\">{{ hours }}</span>:<span class=\"md2-datepicker-header-minute\"\n[class.active]=\"_clockView === 'minute'\"\n(click)=\"_toggleHours('minute')\">{{ minutes }}</span>\n+ <span class =\"md2-datepicker-header-ampm\" *ngIf=\"is12HourClock()\" >{{ _ampm(true) }} </span>\n</span>\n+\n</div>\n</div>\n<div class=\"md2-datepicker-content\">\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.scss",
"new_path": "src/lib/datepicker/datepicker.scss",
"diff": "@@ -232,8 +232,11 @@ md2-datepicker {\n}\n.md2-datepicker-header-date-time {\n+ font-size: 24px;\n+ [mode='landscape'] & {\nfont-size: 32px;\n}\n+}\n.md2-datepicker-header-date {\nopacity: 0.7;\n@@ -251,6 +254,11 @@ md2-datepicker {\npadding-left: 8px;\ncursor: pointer;\n+ .md2-datepicker-header-ampm {\n+ opacity: 0.7;\n+ cursor: default;\n+ }\n+\n&.active {\nopacity: 1;\ncursor: default;\n@@ -493,6 +501,10 @@ md2-clock {\ndisplay: block;\npadding-left: 0;\n}\n+\n+ .md2-datepicker-header-date-time {\n+ font-size: 32px\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -222,7 +222,26 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nreturn ('0' + this._activeDate.getMinutes()).slice(-2);\n}\nget hours(): string {\n+ if (!this.is12HourClock())\nreturn ('0' + this._activeDate.getHours()).slice(-2);\n+ else\n+ return ('0' + this._getHours12(this._activeDate)).slice(-2);\n+ }\n+\n+ /**\n+ * Return the am/pm part of the hour description\n+ * @param upperCase boolean if true return AM/PM, default false\n+ * @return string the am/pm part of the hour description\n+ */\n+ private _ampm(upperCase: boolean = false): string {\n+ if (this.is12HourClock()) {\n+ if (upperCase)\n+ return (this._activeDate.getHours() < 12) ? 'AM' : 'PM';\n+ else\n+ return (this._activeDate.getHours() < 12) ? 'am' : 'pm';\n+ }\n+ else\n+ return \"\";\n}\n@Input() selected: Date;\n@@ -806,6 +825,10 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nreturn hrs;\n}\n+ public is12HourClock(): boolean {\n+ return /[aA]/.test(this.format);\n+ }\n+\n/**\n* format date\n* @param date Date Object\n"
}
] | TypeScript | MIT License | promact/md2 | feat (datepicker): AM/PM support for the choosing panel |
530,390 | 17.05.2017 10:29:13 | -7,200 | ab6f4b7124978878a4ae15b30a639e94ef0b1e92 | feat (demo app): datepicker: date format input | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.html",
"new_path": "src/demo-app/datepicker/datepicker-demo.html",
"diff": "[max]=\"maxDate\"\n[mode]=\"mode\"\n[container]=\"container\"\n+ [format]=\"dateFormat\"\n#dateControl=\"ngModel\"></md2-datepicker>\n<p> Value: {{ date }} </p>\n<p> Touched: {{ dateControl.touched }} </p>\n<md2-option *ngFor=\"let c of containers\" [value]=\"c.value\">{{ c.text }}</md2-option>\n</md2-select>\n</div>\n+ <div class=\"inline-control\">\n+ <md2-select name=\"container\" [(ngModel)]=\"dateFormat\" placeholder=\"Source format\">\n+ <md2-option *ngFor=\"let c of dateFormats[type]\" [value]=\"c.value\">{{ c.name }}</md2-option>\n+ </md2-select>\n+ </div>\n+ <div class=\"inline-control\">\n+ <input name=\"formatInput\" [(ngModel)]=\"dateFormat\" placeholder=\"date format\">\n+ </div>\n</div>\n<div>\n<button type=\"button\" button=\"primary\" (click)=\"setDate()\">SET VALUE</button>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.ts",
"new_path": "src/demo-app/datepicker/datepicker-demo.ts",
"diff": "@@ -18,7 +18,16 @@ export class DatepickerDemo {\nisOpenOnFocus = false;\nisOpen = false;\ntoday: Date = new Date();\n- type: string = 'date';\n+\n+ private _type: string = 'date';\n+ set type(val: string) {\n+ this._type = val;\n+ this.dateFormat = null;\n+ }\n+ get type() {\n+ return this._type;\n+ }\n+\ntypes: Array<any> = [\n{ text: 'Date', value: 'date' },\n{ text: 'Time', value: 'time' },\n@@ -55,6 +64,33 @@ export class DatepickerDemo {\n];\ndisableWeekDays: Array<number> = [0, 6];\n+ dateFormat: string = null;\n+ dateFormatsDateTime: Array<any> = [\n+ { name: 'US:', value: 'M/d/y H:mm A' },\n+ { name: 'England:', value: 'dd/MM/y H:mm A' },\n+ { name: 'Poland:', value: 'd.MM.y HH:mm' },\n+ { name: 'Germany:', value: 'd.M.y HH:mm' },\n+ { name: 'France:', value: 'd/MM/y HH:mm' },\n+ { name: 'ISO 8601', value: 'y-MM-dd HH:mm' }\n+ ];\n+ dateFormatsDate: Array<any> = [\n+ { name: 'US:', value: 'M/d/y' },\n+ { name: 'England:', value: 'dd/MM/y' },\n+ { name: 'Poland:', value: 'd.MM.y' },\n+ { name: 'Germany:', value: 'd.M.y' },\n+ { name: 'France:', value: 'd/MM/y' },\n+ { name: 'ISO 8601', value: 'y-MM-dd' }\n+ ];\n+ dateFormatsTime: Array<any> = [\n+ { name: 'US:', value: 'H:mm A' },\n+ { name: 'England:', value: 'H:mm A' },\n+ { name: 'Poland:', value: 'HH:mm' },\n+ { name: 'Germany:', value: 'HH:mm' },\n+ { name: 'France:', value: 'HH:mm' },\n+ { name: 'ISO 8601', value: 'HH:mm' }\n+ ];\n+ dateFormats: { [index: string]: Array<any>; } = { 'datetime': this.dateFormatsDateTime, 'date': this.dateFormatsDate, 'time': this.dateFormatsTime };\n+\nopenDatepicker() {\nthis.isOpen = true;\nsetTimeout(() => {\n"
}
] | TypeScript | MIT License | promact/md2 | feat (demo app): datepicker: date format input |
530,388 | 18.05.2017 16:38:59 | -19,080 | ee3ed1566ab087a9380b034bdb0637a90e445db8 | chore(datepicker) fix input format issue | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.html",
"new_path": "src/demo-app/datepicker/datepicker-demo.html",
"diff": "[container]=\"container\"\n[format]=\"dateFormat\"\n#dateControl=\"ngModel\"></md2-datepicker>\n+ <span *ngIf=\"dateControl.hasError('mdDatepickerMin')\">Too early!</span>\n+ <span *ngIf=\"dateControl.hasError('mdDatepickerMax')\">Too late!</span>\n+ <span *ngIf=\"dateControl.hasError('mdDatepickerFilter')\">Date unavailable!</span>\n<p> Value: {{ date }} </p>\n<p> Touched: {{ dateControl.touched }} </p>\n<p> Dirty: {{ dateControl.dirty }} </p>\n</md2-select>\n</div>\n<div class=\"inline-control\">\n- <input name=\"formatInput\" [(ngModel)]=\"dateFormat\" placeholder=\"date format\">\n+ <input class=\"md2-input\" name=\"formatInput\" [(ngModel)]=\"dateFormat\" placeholder=\"date format\">\n</div>\n</div>\n<div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/README.md",
"new_path": "src/lib/datepicker/README.md",
"diff": "@@ -64,4 +64,4 @@ A datepicker would have the following markup.\n- <kbd>PAGE_DOWN</kbd>: Focus a month forward\n- <kbd>SHIFT + PAGE_UP</kbd>: Focus a year backward\n- <kbd>SHIFT + PAGE_DOWN</kbd>: Focus a year forward\n-- <kbd>ENTER</kbd> or <kbd>SPACE</kbd>: Select focused item\n+- <kbd>ENTER</kbd>: Select focused item\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-util.ts",
"new_path": "src/lib/datepicker/date-util.ts",
"diff": "@@ -167,9 +167,7 @@ export class DateUtil {\nreturn d;\n}\n- parse(value: any, fmt?: Object): Date | null {\n- // We have no way using the native JS Date to set the parse format or locale, so we ignore these\n- // parameters.\n+ parse(value: any, format?: Object): Date | null {\nlet timestamp = typeof value == 'number' ? value : Date.parse(value);\nreturn isNaN(timestamp) ? null : new Date(timestamp);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.scss",
"new_path": "src/lib/datepicker/datepicker.scss",
"diff": "@@ -233,6 +233,7 @@ md2-datepicker {\n.md2-datepicker-header-date-time {\nfont-size: 24px;\n+\n[mode='landscape'] & {\nfont-size: 32px;\n}\n@@ -382,7 +383,14 @@ md2-datepicker {\nbackground: transparent;\nbox-sizing: border-box;\n+ &.disabled {\n+ color: rgba(black, 0.38);\n+ cursor: default;\n+ pointer-events: none;\n+ }\n+\nsvg {\n+ fill: currentColor;\nvertical-align: top;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -30,7 +30,6 @@ import { DateUtil } from './date-util';\nimport {\ncoerceBooleanProperty,\nENTER,\n- SPACE,\nTAB,\nESCAPE,\nHOME,\n@@ -459,8 +458,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nlet date = this.activeDate;\nif (this._isYearsVisible) {\nswitch (event.keyCode) {\n- case ENTER:\n- case SPACE: this._onClickOk(); break;\n+ case ENTER: this._onClickOk(); break;\ncase DOWN_ARROW:\nif (this.activeDate.getFullYear() < (this.today.getFullYear() + 100)) {\n@@ -478,8 +476,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n} else if (this._isCalendarVisible) {\nswitch (event.keyCode) {\n- case ENTER:\n- case SPACE: this._dateSelected(this.activeDate); break;\n+ case ENTER: this._dateSelected(this.activeDate); break;\ncase RIGHT_ARROW:\nthis.activeDate = this._util.incrementDays(date, 1);\n@@ -522,8 +519,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\n} else if (this._clockView === 'hour') {\nswitch (event.keyCode) {\n- case ENTER:\n- case SPACE: this._hourSelected(this.activeDate.getHours()); break;\n+ case ENTER: this._hourSelected(this.activeDate.getHours()); break;\ncase UP_ARROW:\nthis.activeDate = this._util.incrementHours(date, 1);\n@@ -535,7 +531,6 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n} else {\nswitch (event.keyCode) {\ncase ENTER:\n- case SPACE:\nthis._minuteSelected(this.activeDate.getMinutes());\nbreak;\n@@ -550,7 +545,6 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n} else {\nswitch (event.keyCode) {\ncase ENTER:\n- case SPACE:\nevent.preventDefault();\nevent.stopPropagation();\nthis.open();\n@@ -578,7 +572,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis._onTouched();\n}\nlet el: any = event.target;\n- let date: Date = this._util.parseDate(el.value, this.format);\n+ let date: Date = this._util.parse(el.value, this.format);\nif (this._util.isValidDate(date)) {\nlet d: Date = new Date(this.value);\nif (this.type !== 'time') {\n@@ -883,28 +877,21 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nlet format = this.format;\n+ // Years\nif (format.indexOf('yy') > -1) {\nformat = format.replace('yy', ('00' + date.getFullYear()).slice(-2));\n} else if (format.indexOf('y') > -1) {\nformat = format.replace('y', '' + date.getFullYear());\n}\n- if (format.indexOf('MMMM') > -1) {\n- format = format.replace('MMMM', this._locale.months[date.getMonth()].full);\n- } else if (format.indexOf('MMM') > -1) {\n- format = format.replace('MMM', this._locale.months[date.getMonth()].short);\n- } else if (format.indexOf('MM') > -1) {\n- format = format.replace('MM', ('0' + (date.getMonth() + 1)).slice(-2));\n- } else if (format.indexOf('M') > -1) {\n- format = format.replace('M', '' + (date.getMonth() + 1));\n- }\n-\n+ // Days\nif (format.indexOf('dd') > -1) {\nformat = format.replace('dd', ('0' + date.getDate()).slice(-2));\n} else if (format.indexOf('d') > -1) {\nformat = format.replace('d', '' + date.getDate());\n}\n+ // Hours\nif (/[aA]/.test(format)) {\n// 12-hour\nif (format.indexOf('HH') > -1) {\n@@ -924,18 +911,31 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\n}\n+ // Minutes\nif (format.indexOf('mm') > -1) {\nformat = format.replace('mm', ('0' + date.getMinutes()).slice(-2));\n} else if (format.indexOf('m') > -1) {\nformat = format.replace('m', '' + date.getMinutes());\n}\n+ // Seconds\nif (format.indexOf('ss') > -1) {\nformat = format.replace('ss', ('0' + date.getSeconds()).slice(-2));\n} else if (format.indexOf('s') > -1) {\nformat = format.replace('s', '' + date.getSeconds());\n}\n+ // Months\n+ if (format.indexOf('MMMM') > -1) {\n+ format = format.replace('MMMM', this._locale.months[date.getMonth()].full);\n+ } else if (format.indexOf('MMM') > -1) {\n+ format = format.replace('MMM', this._locale.months[date.getMonth()].short);\n+ } else if (format.indexOf('MM') > -1) {\n+ format = format.replace('MM', ('0' + (date.getMonth() + 1)).slice(-2));\n+ } else if (format.indexOf('M') > -1) {\n+ format = format.replace('M', '' + (date.getMonth() + 1));\n+ }\n+\nreturn format;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/calendar-body.ts",
"new_path": "src/lib/datepicker2/calendar-body.ts",
"diff": "@@ -12,7 +12,7 @@ import {\n* An internal class that represents the data corresponding to a single calendar cell.\n* @docs-private\n*/\n-export class MdCalendarCell {\n+export class Md2CalendarCell {\nconstructor(public value: number,\npublic displayValue: string,\npublic ariaLabel: string,\n@@ -35,12 +35,12 @@ export class MdCalendarCell {\nencapsulation: ViewEncapsulation.None,\nchangeDetection: ChangeDetectionStrategy.OnPush,\n})\n-export class MdCalendarBody {\n+export class Md2CalendarBody {\n/** The label for the table. (e.g. \"Jan 2017\"). */\n@Input() label: string;\n/** The cells to display in the table. */\n- @Input() rows: MdCalendarCell[][];\n+ @Input() rows: Md2CalendarCell[][];\n/** The value in the table that corresponds to today. */\n@Input() todayValue: number;\n@@ -63,7 +63,7 @@ export class MdCalendarBody {\n/** Emits when a new value is selected. */\n@Output() selectedValueChange = new EventEmitter<number>();\n- _cellClicked(cell: MdCalendarCell): void {\n+ _cellClicked(cell: Md2CalendarCell): void {\nif (!this.allowDisabledSelection && !cell.enabled) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/datepicker-input.ts",
"new_path": "src/lib/datepicker2/datepicker-input.ts",
"diff": "@@ -69,18 +69,12 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces\n}\n_datepicker: MdDatepicker<D>;\n- @Input() set matDatepicker(value: MdDatepicker<D>) { this.mdDatepicker = value; }\n-\n@Input() set mdDatepickerFilter(filter: (date: D | null) => boolean) {\nthis._dateFilter = filter;\nthis._validatorOnChange();\n}\n_dateFilter: (date: D | null) => boolean;\n- @Input() set matDatepickerFilter(filter: (date: D | null) => boolean) {\n- this.mdDatepickerFilter = filter;\n- }\n-\n/** The value of the input. */\n@Input()\nget value(): D {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/index.ts",
"new_path": "src/lib/datepicker2/index.ts",
"diff": "import { NgModule } from '@angular/core';\n-import { MdMonthView } from './month-view';\n+import { Md2MonthView } from './month-view';\nimport { CommonModule } from '@angular/common';\n-import { MdCalendarBody } from './calendar-body';\n-import { MdYearView } from './year-view';\n+import { Md2CalendarBody } from './calendar-body';\n+import { Md2YearView } from './year-view';\nimport { OverlayModule } from '../core/overlay/overlay-directives';\nimport { MdDatepicker, MdDatepickerContent } from './datepicker';\nimport { MdDatepickerInput } from './datepicker-input';\n@@ -43,13 +43,13 @@ export * from './native-date-adapter';\n],\ndeclarations: [\nMdCalendar,\n- MdCalendarBody,\n+ Md2CalendarBody,\nMdDatepicker,\nMdDatepickerContent,\nMdDatepickerInput,\nMdDatepickerToggle,\n- MdMonthView,\n- MdYearView,\n+ Md2MonthView,\n+ Md2YearView,\n],\nproviders: [\nMdDatepickerIntl,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/month-view.ts",
"new_path": "src/lib/datepicker2/month-view.ts",
"diff": "@@ -9,7 +9,7 @@ import {\nOutput,\nViewEncapsulation\n} from '@angular/core';\n-import { MdCalendarCell } from './calendar-body';\n+import { Md2CalendarCell } from './calendar-body';\nimport { DateAdapter } from './date-adapter';\nimport { createMissingDateImplError } from './datepicker-errors';\nimport { MD_DATE_FORMATS, MdDateFormats } from './date-formats';\n@@ -29,7 +29,7 @@ const DAYS_PER_WEEK = 7;\nencapsulation: ViewEncapsulation.None,\nchangeDetection: ChangeDetectionStrategy.OnPush,\n})\n-export class MdMonthView<D> implements AfterContentInit {\n+export class Md2MonthView<D> implements AfterContentInit {\n/**\n* The date to display in this month view (everything other than the month and year is ignored).\n*/\n@@ -63,7 +63,7 @@ export class MdMonthView<D> implements AfterContentInit {\n_monthLabel: string;\n/** Grid of calendar cells representing the dates of the month. */\n- _weeks: MdCalendarCell[][];\n+ _weeks: Md2CalendarCell[][];\n/** The number of blank cells in the first row before the 1st of the month. */\n_firstWeekOffset: number;\n@@ -150,7 +150,7 @@ export class MdMonthView<D> implements AfterContentInit {\nthis.dateFilter(date);\nlet ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.dateA11yLabel);\nthis._weeks[this._weeks.length - 1]\n- .push(new MdCalendarCell(i + 1, dateNames[i], ariaLabel, enabled));\n+ .push(new Md2CalendarCell(i + 1, dateNames[i], ariaLabel, enabled));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/year-view.ts",
"new_path": "src/lib/datepicker2/year-view.ts",
"diff": "@@ -9,7 +9,7 @@ import {\nOutput,\nViewEncapsulation\n} from '@angular/core';\n-import {MdCalendarCell} from './calendar-body';\n+import {Md2CalendarCell} from './calendar-body';\nimport { DateAdapter } from './date-adapter';\nimport {createMissingDateImplError} from './datepicker-errors';\nimport {MD_DATE_FORMATS, MdDateFormats} from './date-formats';\n@@ -26,7 +26,7 @@ import {MD_DATE_FORMATS, MdDateFormats} from './date-formats';\nencapsulation: ViewEncapsulation.None,\nchangeDetection: ChangeDetectionStrategy.OnPush,\n})\n-export class MdYearView<D> implements AfterContentInit {\n+export class Md2YearView<D> implements AfterContentInit {\n/** The date to display in this year view (everything other than the year is ignored). */\n@Input()\nget activeDate(): D { return this._activeDate; }\n@@ -55,7 +55,7 @@ export class MdYearView<D> implements AfterContentInit {\n@Output() selectedChange = new EventEmitter<D>();\n/** Grid of calendar cells representing the months of the year. */\n- _months: MdCalendarCell[][];\n+ _months: Md2CalendarCell[][];\n/** The label for this year (e.g. \"2017\"). */\n_yearLabel: string;\n@@ -118,7 +118,7 @@ export class MdYearView<D> implements AfterContentInit {\nlet ariaLabel = this._dateAdapter.format(\nthis._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1),\nthis._dateFormats.display.monthYearA11yLabel);\n- return new MdCalendarCell(\n+ return new Md2CalendarCell(\nmonth, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) fix input format issue |
530,388 | 19.05.2017 10:33:38 | -19,080 | 0d63c7dbd0882c57f7104ddbbeb98567318d70c2 | docs(dialog) update documentation of dialog component | [
{
"change_type": "MODIFY",
"old_path": "src/lib/dialog/README.md",
"new_path": "src/lib/dialog/README.md",
"diff": "@@ -27,7 +27,6 @@ Dialog allow the user to display content in popup.\n| --- | --- |\n| `<md2-dialog-title>` | Title of Dialog. |\n| `<md2-dialog-content>` | Content of Dialog. |\n-| `<md2-dialog-content>` | Content of Dialog. |\n| `<md2-dialog-footer> or <md2-dialog-actions>` | Footer of Dialog. |\n@@ -48,5 +47,5 @@ A dialog would have the following markup.\n<md2-dialog-title>Confirm Title</md2-dialog-title>\nBody Content...\n</md2-dialog>\n-<button (click)=\"confirm.show()\">Open Confirm Dialog</button>\n+<button (click)=\"confirm.open()\">Open Confirm Dialog</button>\n```\n"
}
] | TypeScript | MIT License | promact/md2 | docs(dialog) update documentation of dialog component |
530,388 | 19.05.2017 16:53:09 | -19,080 | c4ef84d90b3ef4fff31550adb2ea14d6b571f917 | fix: datepicker toggle issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/calendar-body.scss",
"new_path": "src/lib/datepicker2/calendar-body.scss",
"diff": "@@ -42,6 +42,11 @@ $background: white;\npadding: $md2-calendar-body-cell-padding 0;\ntext-align: center;\noutline: none;\n+ cursor: pointer;\n+\n+ .md2-calendar-body-disabled {\n+ cursor: default;\n+ }\n}\n.md2-calendar-body-cell-content {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/datepicker-toggle.scss",
"new_path": "src/lib/datepicker2/datepicker-toggle.scss",
"diff": "@@ -12,4 +12,8 @@ $md2-datepicker-toggle-icon-size: 24px !default;\noutline: none;\nvertical-align: middle;\nopacity: 0.54;\n+\n+ &:not([disabled]) {\n+ cursor: pointer;\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/datepicker-toggle.ts",
"new_path": "src/lib/datepicker2/datepicker-toggle.ts",
"diff": "@@ -9,6 +9,7 @@ import {MdDatepickerIntl} from './datepicker-intl';\ntemplate: '',\nstyleUrls: ['datepicker-toggle.css'],\nhost: {\n+ '[attr.type]': 'type',\n'[class.md2-datepicker-toggle]': 'true',\n'[attr.aria-label]': '_intl.openCalendarLabel',\n'(click)': '_open($event)',\n@@ -19,9 +20,7 @@ import {MdDatepickerIntl} from './datepicker-intl';\nexport class MdDatepickerToggle<D> {\n@Input('mdDatepickerToggle') datepicker: MdDatepicker<D>;\n- @Input('matDatepickerToggle')\n- get _datepicker() { return this.datepicker; }\n- set _datepicker(v: MdDatepicker<D>) { this.datepicker = v; }\n+ @Input() type: string = 'button';\nconstructor(public _intl: MdDatepickerIntl) { }\n"
}
] | TypeScript | MIT License | promact/md2 | fix: datepicker toggle issue |
530,398 | 24.05.2017 11:12:34 | -7,200 | c692eb358473c237f95caf8bbea9a901994f05e9 | Make arrow next to date picker clickable | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.html",
"new_path": "src/lib/datepicker/datepicker.html",
"diff": "(focus)=\"_handleFocus($event)\"\n(blur)=\"_handleBlur($event)\"\n(keydown)=\"_handleKeydown($event)\" />\n- <span class=\"md2-datepicker-arrow\"></span>\n+ <span class=\"md2-datepicker-arrow\" (click)=\"toggle()\"></span>\n</div>\n</div>\n<ng-template #portal>\n"
}
] | TypeScript | MIT License | promact/md2 | Make arrow next to date picker clickable |
530,388 | 25.05.2017 09:05:26 | -19,080 | fe3d952ce2dcd1e7a5ae45582f0e1849f665c936 | docs(menu) update documentation | [
{
"change_type": "MODIFY",
"old_path": "src/lib/menu/README.md",
"new_path": "src/lib/menu/README.md",
"diff": "@@ -13,8 +13,8 @@ Menu is a list of options that displays when triggered.\n### Attributes\n-| attributes | Value | Description |\n-| --- | --- |\n+| Attributes | Value | Description |\n+| --- | --- | --- |\n| `x-position` | `before | after` | The horizontal position of the menu in relation to the trigger. Defaults to `after`. |\n| `y-position` | `above | below` | The vertical position of the menu in relation to the trigger. Defaults to `below`. |\n"
}
] | TypeScript | MIT License | promact/md2 | docs(menu) update documentation |
530,388 | 25.05.2017 15:23:28 | -19,080 | 80c161ab358e0a23ffdf57b5decb66fb6138a336 | chore(tooltip) update tooltip component | [
{
"change_type": "DELETE",
"old_path": "src/lib/tooltip/tooltip-errors.ts",
"new_path": null,
"diff": "-import {MdError} from '../core';\n-\n-/**\n- * Exception thrown when a tooltip has an invalid position.\n- * @docs-private\n- */\n-export class Md2TooltipInvalidPositionError extends MdError {\n- constructor(position: string) {\n- super(`Tooltip position \"${position}\" is invalid.`);\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/tooltip.ts",
"new_path": "src/lib/tooltip/tooltip.ts",
"diff": "@@ -27,7 +27,6 @@ import {\nOriginConnectionPosition,\nRepositionScrollStrategy,\n} from '../core';\n-import { Md2TooltipInvalidPositionError } from './tooltip-errors';\nimport { Observable } from 'rxjs/Observable';\nimport { Subject } from 'rxjs/Subject';\nimport { Dir } from '../core/rtl/dir';\n@@ -44,6 +43,11 @@ export const TOUCHEND_HIDE_DELAY = 1500;\n/** Time in ms to throttle repositioning after scroll events. */\nexport const SCROLL_THROTTLE_MS = 20;\n+/** Throws an error if the user supplied an invalid tooltip position. */\n+export function throwMd2TooltipInvalidPositionError(position: string) {\n+ throw new Error(`Tooltip position \"${position}\" is invalid.`);\n+}\n+\n/**\n* Directive that attaches a material design tooltip to the host element. Animates the showing and\n* hiding of a tooltip provided position (defaults to below the element).\n@@ -195,7 +199,9 @@ export class Md2Tooltip implements OnDestroy {\nthis.hide(0);\n}\n});\n+\nlet config = new OverlayState();\n+ config.direction = this._dir ? this._dir.value : 'ltr';\nconfig.positionStrategy = strategy;\nconfig.scrollStrategy =\nnew RepositionScrollStrategy(this._scrollDispatcher, SCROLL_THROTTLE_MS);\n@@ -229,7 +235,7 @@ export class Md2Tooltip implements OnDestroy {\nreturn { originX: 'end', originY: 'center' };\n}\n- throw new Md2TooltipInvalidPositionError(this.position);\n+ throwMd2TooltipInvalidPositionError(this.position);\n}\n/** Returns the overlay position based on the user's preference */\n@@ -255,7 +261,7 @@ export class Md2Tooltip implements OnDestroy {\nreturn { overlayX: 'start', overlayY: 'center' };\n}\n- throw new Md2TooltipInvalidPositionError(this.position);\n+ throwMd2TooltipInvalidPositionError(this.position);\n}\n/** Updates the tooltip message and repositions the overlay according to the new message length */\n@@ -395,7 +401,7 @@ export class Md2TooltipComponent {\ncase 'right': this._transformOrigin = 'left'; break;\ncase 'above': this._transformOrigin = 'bottom'; break;\ncase 'below': this._transformOrigin = 'top'; break;\n- default: throw new Md2TooltipInvalidPositionError(value);\n+ default: throwMd2TooltipInvalidPositionError(value);\n}\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore(tooltip) update tooltip component |
530,388 | 26.05.2017 11:08:42 | -19,080 | e83a3aa73ed93888d2affcf253ab92b7c79b6e58 | docs: update documentations | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/README.md",
"new_path": "src/lib/datepicker/README.md",
"diff": "@@ -22,8 +22,8 @@ Datepicker allow the user to select date and time.\n| `enableDates` | `Array<Date>` | Enable dates. |\n| `disableDates` | `Array<Date>` | Disable Dates. |\n| `disableWeekDays` | `Array<number>` | Disable Week Days. |\n-| `mode` | `'auto'` | `'portrait'` | `'landscape'` | Mode of the Datepicker, default auto. |\n-| `container` | `'inline'` | `'dialog'` | Container of the Datepicker, default inline. |\n+| `mode` | `'auto'` | `'portrait'` | `'landscape'` | Mode of the Datepicker, default auto. |\n+| `container` | `'inline'` | `'dialog'` | Container of the Datepicker, default inline. |\n### Events\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tags/README.md",
"new_path": "src/lib/tags/README.md",
"diff": "@@ -6,7 +6,7 @@ Tags allow the user to add tag.\n| Name | Type | Description |\n| --- | --- | --- |\n-| `items` | `Array<any>` | List of items |\n+| `md2-tags` | `Array<any>` | List of items |\n| `md2-tag-text` | `string` | Map property for display text |\n| `md2-tag-value` | `string` | Map property for return value, by default it returns whole object of tag |\n| `placeholder` | `string` | Hint label |\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/toast/README.md",
"new_path": "src/lib/toast/README.md",
"diff": "@@ -5,7 +5,7 @@ Toast is a service, which show notifications in the view.\n| Name | Description |\n| --- | --- |\n-| `toast(message: string, duration?: number)`/`show(message: string, duration?: number)` | Creates and show a simple toast noticiation. |\n+| `show(message: string, duration?: number)` | Creates and show a simple toast noticiation. |\n### Examples\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/README.md",
"new_path": "src/lib/tooltip/README.md",
"diff": "@@ -7,9 +7,9 @@ Tooltip is a directive, it allows the user to show hint text while the user mous\n| --- | --- | --- |\n| `tooltip` | `string` | The message of the Tooltip |\n| `tooltipDisabled` | `boolean` | Enable/Disable the Tooltip |\n-| `tooltip-position` | `'above'|'below'|'before'|'after'` | The position of the Tooltip |\n-| `tooltip-delay` | `number` | The delay of the Tooltip |\n+| `tooltip-position` | `above` | `below` | `before` | `after` | The position of the Tooltip |\n| `tooltip-delay` | `number` | The delay of the Tooltip |\n+| `tooltip-hide-delay` | `number` | The delay of the Tooltip |\n### Examples\nA tooltip would have the following markup.\n"
}
] | TypeScript | MIT License | promact/md2 | docs: update documentations |
530,388 | 26.05.2017 11:30:09 | -19,080 | cc56203f99c2c443c685400aadfd9f50685e70d0 | chore: update datepicker | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/calendar.html",
"new_path": "src/lib/datepicker2/calendar.html",
"diff": "</div>\n</div>\n<div class=\"md2-calendar-content\" (keydown)=\"_handleCalendarBodyKeydown($event)\"\n- cdkMonitorSubtreeFocus>\n- <md2-month-view *ngIf=\"_monthView\"\n+ [ngSwitch]=\"_monthView\" cdkMonitorSubtreeFocus>\n+ <md2-month-view *ngSwitchCase=\"true\"\n[activeDate]=\"_activeDate\"\n[selected]=\"selected\"\n[dateFilter]=\"_dateFilterForViews\"\n(selectedChange)=\"_dateSelected($event)\">\n</md2-month-view>\n- <md2-year-view *ngIf=\"!_monthView\"\n+ <md2-year-view *ngSwitchDefault\n[activeDate]=\"_activeDate\"\n[selected]=\"selected\"\n[dateFilter]=\"_dateFilterForViews\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/calendar.ts",
"new_path": "src/lib/datepicker2/calendar.ts",
"diff": "@@ -22,10 +22,10 @@ import {\nRIGHT_ARROW,\nUP_ARROW\n} from '../core/keyboard/keycodes';\n-import {DateAdapter} from './date-adapter';\n+import {DateAdapter} from '../core/datetime/index';\nimport {MdDatepickerIntl} from './datepicker-intl';\nimport {createMissingDateImplError} from './datepicker-errors';\n-import {MD_DATE_FORMATS, MdDateFormats} from './date-formats';\n+import {MD_DATE_FORMATS, MdDateFormats} from '../core/datetime/date-formats';\n/**\n@@ -34,7 +34,7 @@ import {MD_DATE_FORMATS, MdDateFormats} from './date-formats';\n*/\n@Component({\nmoduleId: module.id,\n- selector: 'md2-calendar',\n+ selector: 'md-calendar',\ntemplateUrl: 'calendar.html',\nstyleUrls: ['calendar.css'],\nhost: {\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/datepicker2/date-adapter.ts",
"new_path": null,
"diff": "-/** Adapts type `D` to be usable as a date by cdk-based components that work with dates. */\n-export abstract class DateAdapter<D> {\n- /** The locale to use for all dates. */\n- protected locale: any;\n-\n- /**\n- * Gets the year component of the given date.\n- * @param date The date to extract the year from.\n- * @returns The year component.\n- */\n- abstract getYear(date: D): number;\n-\n- /**\n- * Gets the month component of the given date.\n- * @param date The date to extract the month from.\n- * @returns The month component (0-indexed, 0 = January).\n- */\n- abstract getMonth(date: D): number;\n-\n- /**\n- * Gets the date of the month component of the given date.\n- * @param date The date to extract the date of the month from.\n- * @returns The month component (1-indexed, 1 = first of month).\n- */\n- abstract getDate(date: D): number;\n-\n- /**\n- * Gets the day of the week component of the given date.\n- * @param date The date to extract the day of the week from.\n- * @returns The month component (0-indexed, 0 = Sunday).\n- */\n- abstract getDayOfWeek(date: D): number;\n-\n- /**\n- * Gets a list of names for the months.\n- * @param style The naming style (e.g. long = 'January', short = 'Jan', narrow = 'J').\n- * @returns An ordered list of all month names, starting with January.\n- */\n- abstract getMonthNames(style: 'long' | 'short' | 'narrow'): string[];\n-\n- /**\n- * Gets a list of names for the dates of the month.\n- * @returns An ordered list of all date of the month names, starting with '1'.\n- */\n- abstract getDateNames(): string[];\n-\n- /**\n- * Gets a list of names for the days of the week.\n- * @param style The naming style (e.g. long = 'Sunday', short = 'Sun', narrow = 'S').\n- * @returns An ordered list of all weekday names, starting with Sunday.\n- */\n- abstract getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];\n-\n- /**\n- * Gets the name for the year of the given date.\n- * @param date The date to get the year name for.\n- * @returns The name of the given year (e.g. '2017').\n- */\n- abstract getYearName(date: D): string;\n-\n- /**\n- * Gets the first day of the week.\n- * @returns The first day of the week (0-indexed, 0 = Sunday).\n- */\n- abstract getFirstDayOfWeek(): number;\n-\n- /**\n- * Gets the number of days in the month of the given date.\n- * @param date The date whose month should be checked.\n- * @returns The number of days in the month of the given date.\n- */\n- abstract getNumDaysInMonth(date: D): number;\n-\n- /**\n- * Clones the given date.\n- * @param date The date to clone\n- * @returns A new date equal to the given date.\n- */\n- abstract clone(date: D): D;\n-\n- /**\n- * Creates a date with the given year, month, and date. Does not allow over/under-flow of the\n- * month and date.\n- * @param year The full year of the date. (e.g. 89 means the year 89, not the year 1989).\n- * @param month The month of the date (0-indexed, 0 = January). Must be an integer 0 - 11.\n- * @param date The date of month of the date. Must be an integer 1 - length of the given month.\n- * @returns The new date, or null if invalid.\n- */\n- abstract createDate(year: number, month: number, date: number): D;\n-\n- /**\n- * Gets today's date.\n- * @returns Today's date.\n- */\n- abstract today(): D;\n-\n- /**\n- * Parses a date from a value.\n- * @param value The value to parse.\n- * @param parseFormat The expected format of the value being parsed\n- * (type is implementation-dependent).\n- * @returns The parsed date, or null if date could not be parsed.\n- */\n- abstract parse(value: any, parseFormat: any): D | null;\n-\n- /**\n- * Formats a date as a string.\n- * @param date The value to parse.\n- * @param displayFormat The format to use to display the date as a string.\n- * @returns The parsed date, or null if date could not be parsed.\n- */\n- abstract format(date: D, displayFormat: any): string;\n-\n- /**\n- * Adds the given number of years to the date. Years are counted as if flipping 12 pages on the\n- * calendar for each year and then finding the closest date in the new month. For example when\n- * adding 1 year to Feb 29, 2016, the resulting date will be Feb 28, 2017.\n- * @param date The date to add years to.\n- * @param years The number of years to add (may be negative).\n- * @returns A new date equal to the given one with the specified number of years added.\n- */\n- abstract addCalendarYears(date: D, years: number): D;\n-\n- /**\n- * Adds the given number of months to the date. Months are counted as if flipping a page on the\n- * calendar for each month and then finding the closest date in the new month. For example when\n- * adding 1 month to Jan 31, 2017, the resulting date will be Feb 28, 2017.\n- * @param date The date to add months to.\n- * @param months The number of months to add (may be negative).\n- * @returns A new date equal to the given one with the specified number of months added.\n- */\n- abstract addCalendarMonths(date: D, months: number): D;\n-\n- /**\n- * Adds the given number of days to the date. Days are counted as if moving one cell on the\n- * calendar for each day.\n- * @param date The date to add days to.\n- * @param days The number of days to add (may be negative).\n- * @returns A new date equal to the given one with the specified number of days added.\n- */\n- abstract addCalendarDays(date: D, days: number): D;\n-\n- /**\n- * Gets the RFC 3339 compatible date string (https://tools.ietf.org/html/rfc3339) for the given\n- * date.\n- * @param date The date to get the ISO date string for.\n- * @returns The ISO date string date string.\n- */\n- abstract getISODateString(date: D): string;\n-\n- /**\n- * Sets the locale used for all dates.\n- * @param locale The new locale.\n- */\n- setLocale(locale: any) {\n- this.locale = locale;\n- }\n-\n- /**\n- * Compares two dates.\n- * @param first The first date to compare.\n- * @param second The second date to compare.\n- * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier,\n- * a number greater than 0 if the first date is later.\n- */\n- compareDate(first: D, second: D): number {\n- return this.getYear(first) - this.getYear(second) ||\n- this.getMonth(first) - this.getMonth(second) ||\n- this.getDate(first) - this.getDate(second);\n- }\n-\n- /**\n- * Checks if two dates are equal.\n- * @param first The first date to check.\n- * @param second The second date to check.\n- * @returns {boolean} Whether the two dates are equal.\n- * Null dates are considered equal to other null dates.\n- */\n- sameDate(first: D | null, second: D | null): boolean {\n- return first && second ? !this.compareDate(first, second) : first == second;\n- }\n-\n- /**\n- * Clamp the given date between min and max dates.\n- * @param date The date to clamp.\n- * @param min The minimum value to allow. If null or omitted no min is enforced.\n- * @param max The maximum value to allow. If null or omitted no max is enforced.\n- * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`,\n- * otherwise `date`.\n- */\n- clampDate(date: D, min?: D | null, max?: D | null): D {\n- if (min && this.compareDate(date, min) < 0) {\n- return min;\n- }\n- if (max && this.compareDate(date, max) > 0) {\n- return max;\n- }\n- return date;\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/datepicker2/date-formats.ts",
"new_path": null,
"diff": "-import {InjectionToken} from '@angular/core';\n-\n-\n-export type MdDateFormats = {\n- parse: {\n- dateInput: any\n- },\n- display: {\n- dateInput: any,\n- monthYearLabel: any,\n- dateA11yLabel: any,\n- monthYearA11yLabel: any,\n- }\n-};\n-\n-\n-export const MD_DATE_FORMATS = new InjectionToken<MdDateFormats>('md-date-formats');\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/datepicker-input.ts",
"new_path": "src/lib/datepicker2/datepicker-input.ts",
"diff": "@@ -23,9 +23,9 @@ import {\n} from '@angular/forms';\nimport { Subscription } from 'rxjs/Subscription';\nimport { DOWN_ARROW } from '../core/keyboard/keycodes';\n-import { DateAdapter } from './date-adapter';\n+import { DateAdapter } from '../core/datetime/index';\nimport { createMissingDateImplError } from './datepicker-errors';\n-import { MD_DATE_FORMATS, MdDateFormats } from './date-formats';\n+import { MD_DATE_FORMATS, MdDateFormats } from '../core/datetime/date-formats';\nexport const MD_DATEPICKER_VALUE_ACCESSOR: any = {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/datepicker.ts",
"new_path": "src/lib/datepicker2/datepicker.ts",
"diff": "@@ -10,23 +10,20 @@ import {\nOutput,\nViewChild,\nViewContainerRef,\n- ViewEncapsulation\n+ ViewEncapsulation,\n+ NgZone,\n} from '@angular/core';\nimport { Overlay } from '../core/overlay/overlay';\nimport { OverlayRef } from '../core/overlay/overlay-ref';\nimport { ComponentPortal } from '../core/portal/portal';\nimport { OverlayState } from '../core/overlay/overlay-state';\nimport { Dir } from '../core/rtl/dir';\n-import { MdError } from '../core/errors/error';\nimport { PositionStrategy } from '../core/overlay/position/position-strategy';\n-import {\n- OriginConnectionPosition,\n- OverlayConnectionPosition\n-} from '../core/overlay/position/connected-position';\n+import { RepositionScrollStrategy, ScrollDispatcher } from '../core/overlay/index';\nimport { MdDatepickerInput } from './datepicker-input';\nimport 'rxjs/add/operator/first';\nimport { Subscription } from 'rxjs/Subscription';\n-import { DateAdapter } from './date-adapter';\n+import { DateAdapter } from '../core/datetime/index';\nimport { createMissingDateImplError } from './datepicker-errors';\nimport { ESCAPE } from '../core/keyboard/keycodes';\nimport { MdCalendar } from './calendar';\n@@ -113,10 +110,6 @@ export class MdDatepicker<D> implements OnDestroy {\n*/\n@Input() touchUi = false;\n- /** A function used to filter which dates are selectable. */\n- @Input()\n- dateFilter: (date: D) => boolean;\n-\n/** Emits new selected date when selected date changes. */\n@Output() selectedChanged = new EventEmitter<D>();\n@@ -155,7 +148,9 @@ export class MdDatepicker<D> implements OnDestroy {\nprivate _inputSubscription: Subscription;\nconstructor(private _overlay: Overlay,\n+ private _ngZone: NgZone,\nprivate _viewContainerRef: ViewContainerRef,\n+ private _scrollDispatcher: ScrollDispatcher,\n@Optional() private _dateAdapter: DateAdapter<D>,\n@Optional() private _dir: Dir) {\nif (!this._dateAdapter) {\n@@ -190,7 +185,7 @@ export class MdDatepicker<D> implements OnDestroy {\n*/\n_registerInput(input: MdDatepickerInput<D>): void {\nif (this._datepickerInput) {\n- throw new MdError('An MdDatepicker can only be associated with a single input.');\n+ throw new Error('An MdDatepicker can only be associated with a single input.');\n}\nthis._datepickerInput = input;\nthis._inputSubscription =\n@@ -203,7 +198,7 @@ export class MdDatepicker<D> implements OnDestroy {\nreturn;\n}\nif (!this._datepickerInput) {\n- throw new MdError('Attempted to open an MdDatepicker with no associated input.');\n+ throw new Error('Attempted to open an MdDatepicker with no associated input.');\n}\n//this.touchUi ? this._openAsDialog() :\n@@ -253,6 +248,7 @@ export class MdDatepicker<D> implements OnDestroy {\nlet componentRef: ComponentRef<MdDatepickerContent<D>> =\nthis._popupRef.attach(this._calendarPortal);\ncomponentRef.instance.datepicker = this;\n+ this._ngZone.onStable.first().subscribe(() => this._popupRef.updatePosition());\n}\nthis._popupRef.backdropClick().first().subscribe(() => this.close());\n@@ -265,15 +261,29 @@ export class MdDatepicker<D> implements OnDestroy {\noverlayState.hasBackdrop = true;\noverlayState.backdropClass = 'md-overlay-transparent-backdrop';\noverlayState.direction = this._dir ? this._dir.value : 'ltr';\n+ overlayState.scrollStrategy = new RepositionScrollStrategy(this._scrollDispatcher);\nthis._popupRef = this._overlay.create(overlayState);\n}\n/** Create the popup PositionStrategy. */\nprivate _createPopupPositionStrategy(): PositionStrategy {\n- let origin = { originX: 'start', originY: 'bottom' } as OriginConnectionPosition;\n- let overlay = { overlayX: 'start', overlayY: 'top' } as OverlayConnectionPosition;\n- return this._overlay.position().connectedTo(\n- this._datepickerInput.getPopupConnectionElementRef(), origin, overlay);\n+ return this._overlay.position()\n+ .connectedTo(this._datepickerInput.getPopupConnectionElementRef(),\n+ { originX: 'start', originY: 'bottom' },\n+ { overlayX: 'start', overlayY: 'top' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'start', originY: 'top' },\n+ { overlayX: 'start', overlayY: 'bottom' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'end', originY: 'bottom' },\n+ { overlayX: 'end', overlayY: 'top' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'end', originY: 'top' },\n+ { overlayX: 'end', overlayY: 'bottom' }\n+ );\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/index.ts",
"new_path": "src/lib/datepicker2/index.ts",
"diff": "@@ -10,10 +10,6 @@ import { MdCalendar } from './calendar';\nimport { MdDatepickerToggle } from './datepicker-toggle';\nimport { StyleModule } from '../core/style/index';\nimport { MdDatepickerIntl } from './datepicker-intl';\n-import { DateAdapter } from './date-adapter';\n-import { NativeDateAdapter } from './native-date-adapter';\n-import { MD_DATE_FORMATS } from './date-formats';\n-import { MD_NATIVE_DATE_FORMATS } from './native-date-formats';\n@@ -25,8 +21,6 @@ export * from './datepicker-intl';\nexport * from './datepicker-toggle';\nexport * from './month-view';\nexport * from './year-view';\n-export * from './date-adapter';\n-export * from './native-date-adapter';\n@NgModule({\n@@ -51,11 +45,7 @@ export * from './native-date-adapter';\nMd2MonthView,\nMd2YearView,\n],\n- providers: [\n- MdDatepickerIntl,\n- { provide: DateAdapter, useClass: NativeDateAdapter },\n- { provide: MD_DATE_FORMATS, useValue: MD_NATIVE_DATE_FORMATS }\n- ],\n+ providers: [MdDatepickerIntl],\nentryComponents: [\nMdDatepickerContent,\n]\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/month-view.ts",
"new_path": "src/lib/datepicker2/month-view.ts",
"diff": "@@ -10,9 +10,9 @@ import {\nViewEncapsulation\n} from '@angular/core';\nimport { Md2CalendarCell } from './calendar-body';\n-import { DateAdapter } from './date-adapter';\n+import { DateAdapter } from '../core/datetime/index';\nimport { createMissingDateImplError } from './datepicker-errors';\n-import { MD_DATE_FORMATS, MdDateFormats } from './date-formats';\n+import { MD_DATE_FORMATS, MdDateFormats } from '../core/datetime/date-formats';\nconst DAYS_PER_WEEK = 7;\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/datepicker2/native-date-adapter.ts",
"new_path": null,
"diff": "-import {DateAdapter} from './date-adapter';\n-\n-\n-// TODO(mmalerba): Remove when we no longer support safari 9.\n-/** Whether the browser supports the Intl API. */\n-const SUPPORTS_INTL_API = typeof Intl != 'undefined';\n-\n-\n-/** The default month names to use if Intl API is not available. */\n-const DEFAULT_MONTH_NAMES = {\n- 'long': [\n- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',\n- 'October', 'November', 'December'\n- ],\n- 'short': ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n- 'narrow': ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D']\n-};\n-\n-\n-/** The default date names to use if Intl API is not available. */\n-const DEFAULT_DATE_NAMES = range(31, i => String(i + 1));\n-\n-\n-/** The default day of the week names to use if Intl API is not available. */\n-const DEFAULT_DAY_OF_WEEK_NAMES = {\n- 'long': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n- 'short': ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n- 'narrow': ['S', 'M', 'T', 'W', 'T', 'F', 'S']\n-};\n-\n-\n-/** Creates an array and fills it with values. */\n-function range<T>(length: number, valueFunction: (index: number) => T): T[] {\n- return Array.apply(null, Array(length)).map((v: undefined, i: number) => valueFunction(i));\n-}\n-\n-\n-/** Adapts the native JS Date for use with cdk-based components that work with dates. */\n-export class NativeDateAdapter extends DateAdapter<Date> {\n- getYear(date: Date): number {\n- return date.getFullYear();\n- }\n-\n- getMonth(date: Date): number {\n- return date.getMonth();\n- }\n-\n- getDate(date: Date): number {\n- return date.getDate();\n- }\n-\n- getDayOfWeek(date: Date): number {\n- return date.getDay();\n- }\n-\n- getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n- if (SUPPORTS_INTL_API) {\n- let dtf = new Intl.DateTimeFormat(this.locale, {month: style});\n- return range(12, i => this._stripDirectionalityCharacters(dtf.format(new Date(2017, i, 1))));\n- }\n- return DEFAULT_MONTH_NAMES[style];\n- }\n-\n- getDateNames(): string[] {\n- if (SUPPORTS_INTL_API) {\n- let dtf = new Intl.DateTimeFormat(this.locale, {day: 'numeric'});\n- return range(31, i => this._stripDirectionalityCharacters(\n- dtf.format(new Date(2017, 0, i + 1))));\n- }\n- return DEFAULT_DATE_NAMES;\n- }\n-\n- getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n- if (SUPPORTS_INTL_API) {\n- let dtf = new Intl.DateTimeFormat(this.locale, {weekday: style});\n- return range(7, i => this._stripDirectionalityCharacters(\n- dtf.format(new Date(2017, 0, i + 1))));\n- }\n- return DEFAULT_DAY_OF_WEEK_NAMES[style];\n- }\n-\n- getYearName(date: Date): string {\n- if (SUPPORTS_INTL_API) {\n- let dtf = new Intl.DateTimeFormat(this.locale, {year: 'numeric'});\n- return this._stripDirectionalityCharacters(dtf.format(date));\n- }\n- return String(this.getYear(date));\n- }\n-\n- getFirstDayOfWeek(): number {\n- // We can't tell using native JS Date what the first day of the week is, we default to Sunday.\n- return 0;\n- }\n-\n- getNumDaysInMonth(date: Date): number {\n- return this.getDate(this._createDateWithOverflow(\n- this.getYear(date), this.getMonth(date) + 1, 0));\n- }\n-\n- clone(date: Date): Date {\n- return this.createDate(this.getYear(date), this.getMonth(date), this.getDate(date));\n- }\n-\n- createDate(year: number, month: number, date: number): Date {\n- // Check for invalid month and date (except upper bound on date which we have to check after\n- // creating the Date).\n- if (month < 0 || month > 11 || date < 1) {\n- return null;\n- }\n-\n- let result = this._createDateWithOverflow(year, month, date);\n-\n- // Check that the date wasn't above the upper bound for the month, causing the month to\n- // overflow.\n- if (result.getMonth() != month) {\n- return null;\n- }\n-\n- return result;\n- }\n-\n- today(): Date {\n- return new Date();\n- }\n-\n- parse(value: any, parseFormat: Object): Date | null {\n- // We have no way using the native JS Date to set the parse format or locale, so we ignore these\n- // parameters.\n- let timestamp = typeof value == 'number' ? value : Date.parse(value);\n- return isNaN(timestamp) ? null : new Date(timestamp);\n- }\n-\n- format(date: Date, displayFormat: Object): string {\n- if (SUPPORTS_INTL_API) {\n- let dtf = new Intl.DateTimeFormat(this.locale, displayFormat);\n- return this._stripDirectionalityCharacters(dtf.format(date));\n- }\n- return this._stripDirectionalityCharacters(date.toDateString());\n- }\n-\n- addCalendarYears(date: Date, years: number): Date {\n- return this.addCalendarMonths(date, years * 12);\n- }\n-\n- addCalendarMonths(date: Date, months: number): Date {\n- let newDate = this._createDateWithOverflow(\n- this.getYear(date), this.getMonth(date) + months, this.getDate(date));\n-\n- // It's possible to wind up in the wrong month if the original month has more days than the new\n- // month. In this case we want to go to the last day of the desired month.\n- // Note: the additional + 12 % 12 ensures we end up with a positive number, since JS % doesn't\n- // guarantee this.\n- if (this.getMonth(newDate) != ((this.getMonth(date) + months) % 12 + 12) % 12) {\n- newDate = this._createDateWithOverflow(this.getYear(newDate), this.getMonth(newDate), 0);\n- }\n-\n- return newDate;\n- }\n-\n- addCalendarDays(date: Date, days: number): Date {\n- return this._createDateWithOverflow(\n- this.getYear(date), this.getMonth(date), this.getDate(date) + days);\n- }\n-\n- getISODateString(date: Date): string {\n- if (typeof date === 'string') { return null; }\n- return [\n- date.getUTCFullYear(),\n- this._2digit(date.getUTCMonth() + 1),\n- this._2digit(date.getUTCDate())\n- ].join('-');\n- }\n-\n- /** Creates a date but allows the month and date to overflow. */\n- private _createDateWithOverflow(year: number, month: number, date: number) {\n- let result = new Date(year, month, date);\n-\n- // We need to correct for the fact that JS native Date treats years in range [0, 99] as\n- // abbreviations for 19xx.\n- if (year >= 0 && year < 100) {\n- result.setFullYear(this.getYear(result) - 1900);\n- }\n- return result;\n- }\n-\n- /**\n- * Pads a number to make it two digits.\n- * @param n The number to pad.\n- * @returns The padded number.\n- */\n- private _2digit(n: number) {\n- return ('00' + n).slice(-2);\n- }\n-\n- /**\n- * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while\n- * other browsers do not. We remove them to make output consistent and because they interfere with\n- * date parsing.\n- * @param s The string to strip direction characters from.\n- * @returns The stripped string.\n- */\n- private _stripDirectionalityCharacters(s: string) {\n- return s.replace(/[\\u200e\\u200f]/g, '');\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/datepicker2/native-date-formats.ts",
"new_path": null,
"diff": "-import {MdDateFormats} from './date-formats';\n-\n-\n-export const MD_NATIVE_DATE_FORMATS: MdDateFormats = {\n- parse: {\n- dateInput: null,\n- },\n- display: {\n- dateInput: {year: 'numeric', month: 'numeric', day: 'numeric'},\n- monthYearLabel: {year: 'numeric', month: 'short'},\n- dateA11yLabel: {year: 'numeric', month: 'long', day: 'numeric'},\n- monthYearA11yLabel: {year: 'numeric', month: 'long'},\n- }\n-};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/year-view.ts",
"new_path": "src/lib/datepicker2/year-view.ts",
"diff": "@@ -10,9 +10,9 @@ import {\nViewEncapsulation\n} from '@angular/core';\nimport {Md2CalendarCell} from './calendar-body';\n-import { DateAdapter } from './date-adapter';\n+import {DateAdapter} from '../core/datetime/index';\nimport {createMissingDateImplError} from './datepicker-errors';\n-import {MD_DATE_FORMATS, MdDateFormats} from './date-formats';\n+import {MD_DATE_FORMATS, MdDateFormats} from '../core/datetime/date-formats';\n/**\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update datepicker |
530,388 | 26.05.2017 12:50:33 | -19,080 | c7e69d62daa339f64a257ffeffe5237c59a699bd | chore: update option in core | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/core/option/_optgroup-theme.scss",
"diff": "+@import '../theming/palette';\n+@import '../theming/theming';\n+\n+@mixin mat-optgroup-theme($theme) {\n+ $foreground: map-get($theme, foreground);\n+\n+ .mat-optgroup-label {\n+ color: mat-color($foreground, secondary-text);\n+ }\n+\n+ .mat-optgroup-disabled .mat-optgroup-label {\n+ color: mat-color($foreground, hint-text);\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/core/option/_optgroup.scss",
"diff": "+@import '../style/menu-common';\n+@import '../style/vendor-prefixes';\n+\n+@mixin mat-optgroup() {\n+ .mat-optgroup-label {\n+ @include mat-menu-item-base();\n+ @include user-select(none);\n+ cursor: default;\n+\n+ // TODO(crisbeto): should use the typography functions once #4375 is in.\n+ font-weight: bold;\n+ font-size: 14px;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/core/option/_option-theme.scss",
"new_path": "src/lib/core/option/_option-theme.scss",
"diff": "$warn: map-get($theme, warn);\n.mat-option {\n- color: mat-color($foreground, text);\n-\n&:hover:not(.mat-option-disabled), &:focus:not(.mat-option-disabled) {\nbackground: mat-color($background, hover);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/core/option/_option.scss",
"new_path": "src/lib/core/option/_option.scss",
"diff": "@include user-select(none);\ncursor: default;\n}\n+\n+ .mat-optgroup &:not(.mat-option-multiple) {\n+ padding-left: $mat-menu-side-padding * 2;\n+\n+ [dir='rtl'] & {\n+ padding-left: $mat-menu-side-padding;\n+ padding-right: $mat-menu-side-padding * 2;\n+ }\n+ }\n}\n.mat-option-ripple {\nbottom: 0;\nright: 0;\n- // Disable pointer events for the ripple container because the container will overlay the\n- // user content and we don't want to disable mouse events on the user content.\n- // Pointer events can be safely disabled because the ripple trigger element is the host element.\n- pointer-events: none;\n-\n- // In high contrast mode this completely covers the text.\n+ // Prevents the ripple from completely covering the option in high contrast mode.\n@include cdk-high-contrast {\nopacity: 0.5;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/core/option/index.ts",
"diff": "+import {NgModule} from '@angular/core';\n+import {CommonModule} from '@angular/common';\n+import {MdRippleModule} from '../ripple/index';\n+import {MdSelectionModule} from '../selection/index';\n+import {MdOption} from './option';\n+import {MdOptgroup} from './optgroup';\n+\n+\n+@NgModule({\n+ imports: [MdRippleModule, CommonModule, MdSelectionModule],\n+ exports: [MdOption, MdOptgroup],\n+ declarations: [MdOption, MdOptgroup]\n+})\n+export class MdOptionModule {}\n+\n+\n+export * from './option';\n+export * from './optgroup';\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/core/option/optgroup.html",
"diff": "+<label class=\"mat-optgroup-label\" [id]=\"_labelId\">{{ label }}</label>\n+<ng-content select=\"md-option, mat-option\"></ng-content>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/core/option/optgroup.ts",
"diff": "+import {Component, ViewEncapsulation, ContentChildren, QueryList, Input} from '@angular/core';\n+import {mixinDisabled, CanDisable} from '../common-behaviors/disabled';\n+\n+// Boilerplate for applying mixins to MdOptgroup.\n+export class MdOptgroupBase { }\n+export const _MdOptgroupMixinBase = mixinDisabled(MdOptgroupBase);\n+\n+// Counter for unique group ids.\n+let nextId = 0;\n+\n+/**\n+ * Component that is used to group instances of `md-option`.\n+ */\n+@Component({\n+ moduleId: module.id,\n+ selector: 'md-optgroup, mat-optgroup',\n+ templateUrl: 'optgroup.html',\n+ encapsulation: ViewEncapsulation.None,\n+ inputs: ['disabled'],\n+ host: {\n+ 'class': 'mat-optgroup',\n+ 'role': 'group',\n+ '[class.mat-optgroup-disabled]': 'disabled',\n+ '[attr.aria-disabled]': 'disabled.toString()',\n+ '[attr.aria-labelledby]': '_labelId',\n+ }\n+})\n+export class MdOptgroup extends _MdOptgroupMixinBase implements CanDisable {\n+ /** Label for the option group. */\n+ @Input() label: string;\n+\n+ /** Unique id for the underlying label. */\n+ _labelId: string = `mat-optgroup-label-${nextId++}`;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/core/option/option.ts",
"new_path": "src/lib/core/option/option.ts",
"diff": "@@ -9,12 +9,10 @@ import {\nInject,\nOptional,\n} from '@angular/core';\n-import {CommonModule} from '@angular/common';\nimport {ENTER, SPACE} from '../keyboard/keycodes';\nimport {coerceBooleanProperty} from '../coercion/boolean-property';\n-import {MdRippleModule} from '../ripple/index';\n-import {MdSelectionModule} from '../selection/index';\nimport {MATERIAL_COMPATIBILITY_MODE} from '../../core/compatibility/compatibility';\n+import {MdOptgroup} from './optgroup';\n/**\n* Option IDs need to be unique across components, so this counter exists outside of\n@@ -74,7 +72,7 @@ export class MdOption {\n/** Whether the option is disabled. */\n@Input()\n- get disabled() { return this._disabled; }\n+ get disabled() { return (this.group && this.group.disabled) || this._disabled; }\nset disabled(value: any) { this._disabled = coerceBooleanProperty(value); }\n/** Event emitted when the option is selected or deselected. */\n@@ -82,6 +80,7 @@ export class MdOption {\nconstructor(\nprivate _element: ElementRef,\n+ @Optional() public readonly group: MdOptgroup,\n@Optional() @Inject(MATERIAL_COMPATIBILITY_MODE) public _isCompatibilityMode: boolean) {}\n/**\n@@ -172,10 +171,3 @@ export class MdOption {\n}\n}\n-\n-@NgModule({\n- imports: [MdRippleModule, CommonModule, MdSelectionModule],\n- exports: [MdOption],\n- declarations: [MdOption]\n-})\n-export class MdOptionModule {}\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update option in core |
530,388 | 26.05.2017 14:01:01 | -19,080 | 50e1ed3a19e2dbfed5e63b5b2f246b4b4e873502 | update lint issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/core/observe-content/observe-content.ts",
"new_path": "src/lib/core/observe-content/observe-content.ts",
"diff": "@@ -18,7 +18,7 @@ import 'rxjs/add/operator/debounceTime';\n*/\n@Injectable()\nexport class MdMutationObserverFactory {\n- create(callback): MutationObserver {\n+ create(callback: any): MutationObserver {\nreturn new MutationObserver(callback);\n}\n}\n"
}
] | TypeScript | MIT License | promact/md2 | update lint issue |
530,388 | 26.05.2017 14:01:19 | -19,080 | fab045ca0e1d7922fdee621965de255b4472a27a | fix: datepicker issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/calendar.ts",
"new_path": "src/lib/datepicker2/calendar.ts",
"diff": "@@ -34,7 +34,7 @@ import {MD_DATE_FORMATS, MdDateFormats} from '../core/datetime/date-formats';\n*/\n@Component({\nmoduleId: module.id,\n- selector: 'md-calendar',\n+ selector: 'md2-calendar',\ntemplateUrl: 'calendar.html',\nstyleUrls: ['calendar.css'],\nhost: {\n"
}
] | TypeScript | MIT License | promact/md2 | fix: datepicker issue |
530,388 | 27.05.2017 11:15:34 | -19,080 | 6fa8b8eaebd34566fc321a9b244c1c895428f135 | fix(datepicker) service issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/datepicker-input.ts",
"new_path": "src/lib/datepicker2/datepicker-input.ts",
"diff": "@@ -123,14 +123,14 @@ export class MdDatepickerInput<D> implements AfterContentInit, ControlValueAcces\n/** The form control validator for the min date. */\nprivate _minValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\nreturn (!this.min || !control.value ||\n- this._dateAdapter.compareDate(this.min, control.value) < 0) ?\n+ this._dateAdapter.compareDate(this.min, control.value) <= 0) ?\nnull : { 'mdDatepickerMin': { 'min': this.min, 'actual': control.value } };\n}\n/** The form control validator for the max date. */\nprivate _maxValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\nreturn (!this.max || !control.value ||\n- this._dateAdapter.compareDate(this.max, control.value) > 0) ?\n+ this._dateAdapter.compareDate(this.max, control.value) >= 0) ?\nnull : { 'mdDatepickerMax': { 'max': this.max, 'actual': control.value } };\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/index.ts",
"new_path": "src/lib/datepicker2/index.ts",
"diff": "@@ -4,6 +4,7 @@ import { CommonModule } from '@angular/common';\nimport { Md2CalendarBody } from './calendar-body';\nimport { Md2YearView } from './year-view';\nimport { OverlayModule } from '../core/overlay/overlay-directives';\n+import { MdNativeDateModule } from '../core/datetime/index';\nimport { MdDatepicker, MdDatepickerContent } from './datepicker';\nimport { MdDatepickerInput } from './datepicker-input';\nimport { MdCalendar } from './calendar';\n@@ -28,6 +29,7 @@ export * from './year-view';\nCommonModule,\nOverlayModule,\nStyleModule,\n+ MdNativeDateModule\n],\nexports: [\nMdDatepicker,\n"
}
] | TypeScript | MIT License | promact/md2 | fix(datepicker) service issue |
530,388 | 29.05.2017 11:18:04 | -19,080 | cad09d4eb132f32351f39812034667c01486c013 | chore: update native date module of datepicker | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker2/index.ts",
"new_path": "src/lib/datepicker2/index.ts",
"diff": "@@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common';\nimport { Md2CalendarBody } from './calendar-body';\nimport { Md2YearView } from './year-view';\nimport { OverlayModule } from '../core/overlay/overlay-directives';\n-import { MdNativeDateModule } from '../core/datetime/index';\nimport { MdDatepicker, MdDatepickerContent } from './datepicker';\nimport { MdDatepickerInput } from './datepicker-input';\nimport { MdCalendar } from './calendar';\n@@ -29,7 +28,6 @@ export * from './year-view';\nCommonModule,\nOverlayModule,\nStyleModule,\n- MdNativeDateModule\n],\nexports: [\nMdDatepicker,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/module.ts",
"new_path": "src/lib/module.ts",
"diff": "@@ -7,6 +7,7 @@ import {\nOverlayModule,\nA11yModule,\nCompatibilityModule,\n+ MdNativeDateModule,\n} from './core/index';\nimport { Md2AccordionModule } from './accordion/index';\n@@ -52,6 +53,7 @@ const MD2_MODULES = [\nA11yModule,\nPlatformModule,\nCompatibilityModule,\n+ MdNativeDateModule,\n];\n@NgModule({\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update native date module of datepicker |
530,388 | 29.05.2017 11:28:14 | -19,080 | a09b4d6bde75c733f98191749f5675cf3b8b471c | fix: rollup warnings while compilation | [
{
"change_type": "MODIFY",
"old_path": "tools/gulp/tasks/components.ts",
"new_path": "tools/gulp/tasks/components.ts",
"diff": "@@ -113,24 +113,29 @@ const ROLLUP_GLOBALS = {\n'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',\n// Rxjs dependencies\n- 'rxjs/Subject': 'Rx',\n- 'rxjs/add/observable/fromEvent': 'Rx.Observable',\n+ 'rxjs/add/observable/combineLatest': 'Rx.Observable',\n'rxjs/add/observable/forkJoin': 'Rx.Observable',\n- 'rxjs/add/observable/of': 'Rx.Observable',\n+ 'rxjs/add/observable/fromEvent': 'Rx.Observable',\n'rxjs/add/observable/merge': 'Rx.Observable',\n+ 'rxjs/add/observable/of': 'Rx.Observable',\n'rxjs/add/observable/throw': 'Rx.Observable',\n'rxjs/add/operator/auditTime': 'Rx.Observable.prototype',\n- 'rxjs/add/operator/toPromise': 'Rx.Observable.prototype',\n- 'rxjs/add/operator/map': 'Rx.Observable.prototype',\n- 'rxjs/add/operator/filter': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/catch': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/debounceTime': 'Rx.Observable.prototype',\n'rxjs/add/operator/do': 'Rx.Observable.prototype',\n- 'rxjs/add/operator/share': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/filter': 'Rx.Observable.prototype',\n'rxjs/add/operator/finally': 'Rx.Observable.prototype',\n- 'rxjs/add/operator/catch': 'Rx.Observable.prototype',\n'rxjs/add/operator/first': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/let': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/map': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/share': 'Rx.Observable.prototype',\n'rxjs/add/operator/startWith': 'Rx.Observable.prototype',\n'rxjs/add/operator/switchMap': 'Rx.Observable.prototype',\n- 'rxjs/Observable': 'Rx'\n+ 'rxjs/add/operator/toPromise': 'Rx.Observable.prototype',\n+ 'rxjs/BehaviorSubject': 'Rx',\n+ 'rxjs/Observable': 'Rx',\n+ 'rxjs/Subject': 'Rx',\n+ 'rxjs/Subscription': 'Rx',\n};\n/** Creates a rollup bundles of the Material components.*/\n"
}
] | TypeScript | MIT License | promact/md2 | fix: rollup warnings while compilation |
530,388 | 29.05.2017 11:38:18 | -19,080 | cc10dc3d81e44e47d69d6cab0bd48b2322c859a4 | chore: update lint configurations and fixed lint issues | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.ts",
"new_path": "src/demo-app/datepicker/datepicker-demo.ts",
"diff": "@@ -89,7 +89,12 @@ export class DatepickerDemo {\n{ name: 'France:', value: 'HH:mm' },\n{ name: 'ISO 8601', value: 'HH:mm' }\n];\n- dateFormats: { [index: string]: Array<any>; } = { 'datetime': this.dateFormatsDateTime, 'date': this.dateFormatsDate, 'time': this.dateFormatsTime };\n+ dateFormats: { [index: string]: Array<any>; } =\n+ {\n+ 'datetime': this.dateFormatsDateTime,\n+ 'date': this.dateFormatsDate,\n+ 'time': this.dateFormatsTime\n+ };\nopenDatepicker() {\nthis.isOpen = true;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/tabs/tabs-demo.ts",
"new_path": "src/demo-app/tabs/tabs-demo.ts",
"diff": "@@ -13,5 +13,5 @@ export class TabsDemo {\nhandleChange(tab: Event) {\nconsole.log('Tab Changed');\n- };\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -233,8 +233,7 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\nif (this.disabled) { return; }\nif (!this.isAutoComplete) {\nthis.elementRef.nativeElement.querySelector('input.chip-input').focus();\n- }\n- else {\n+ } else {\nthis.autoCompleteFocued = true;\nthis._onTouched();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.ts",
"new_path": "src/lib/colorpicker/colorpicker.ts",
"diff": "@@ -265,7 +265,7 @@ export class Md2Colorpicker implements OnDestroy, ControlValueAccessor {\nget value(): any {\nreturn this._innerValue;\n- };\n+ }\n/**\n* set accessor including call the onchange callback\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -234,11 +234,12 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nreturn ('0' + this._activeDate.getMinutes()).slice(-2);\n}\nget hours(): string {\n- if (!this.is12HourClock())\n+ if (!this.is12HourClock()) {\nreturn ('0' + this._activeDate.getHours()).slice(-2);\n- else\n+ } else {\nreturn ('0' + this._getHours12(this._activeDate)).slice(-2);\n}\n+ }\n/**\n* Return the am/pm part of the hour description\n@@ -247,13 +248,14 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\nprivate _ampm(upperCase: boolean = false): string {\nif (this.is12HourClock()) {\n- if (upperCase)\n+ if (upperCase) {\nreturn (this._activeDate.getHours() < 12) ? 'AM' : 'PM';\n- else\n+ } else {\nreturn (this._activeDate.getHours() < 12) ? 'am' : 'pm';\n}\n- else\n- return \"\";\n+ } else {\n+ return '';\n+ }\n}\n@Input() selected: Date;\n@@ -856,10 +858,11 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n*/\nprivate _getHours12(date: Date): number {\nlet hrs = date.getHours();\n- if (hrs == 0)\n+ if (hrs == 0) {\nhrs = 12;\n- else if (hrs > 12)\n+ } else if (hrs > 12) {\nhrs -= 12;\n+ }\nreturn hrs;\n}\n@@ -901,8 +904,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\nformat = format.replace('A', ((date.getHours() < 12) ? 'AM' : 'PM'))\n.replace('a', ((date.getHours() < 12) ? 'am' : 'pm'));\n- }\n- else {\n+ } else {\n// 24-hour\nif (format.indexOf('HH') > -1) {\nformat = format.replace('HH', ('0' + date.getHours()).slice(-2));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.ts",
"new_path": "src/lib/select/select.ts",
"diff": "@@ -567,7 +567,8 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n*/\nprivate _selectValue(value: any): Md2Option {\nlet optionsArray = this.options.toArray();\n- let correspondingOption = optionsArray.find(option => option.value && this.equals(option.value, value));\n+ let correspondingOption = optionsArray.find(option =>\n+ option.value && this.equals(option.value, value));\nif (correspondingOption) {\ncorrespondingOption.select();\n"
},
{
"change_type": "MODIFY",
"old_path": "stylelint-config.json",
"new_path": "stylelint-config.json",
"diff": "{\n\"plugins\": [\n- \"./tools/stylelint/no-prefixes/no-prefixes.js\"\n+ \"./tools/stylelint/no-prefixes/no-prefixes.js\",\n+ \"./tools/stylelint/selector-nested-pattern-scoped/index.js\"\n],\n\"rules\": {\n\"material/no-prefixes\": [[\"last 2 versions\", \"not ie <= 10\", \"not ie_mob <= 10\"]],\n+ \"material/selector-nested-pattern-scoped\": [\".*[^&]$\", {\n+ \"message\": \"The & operator is not allowed at the end of theme selectors.\",\n+ \"filePattern\": \"-theme\\\\.scss$\"\n+ }],\n+\n\"color-hex-case\": \"lower\",\n\"color-no-invalid-hex\": true,\n\"unit-case\": \"lower\",\n\"unit-no-unknown\": true,\n- \"unit-whitelist\": [\"px\", \"%\", \"deg\", \"ms\", \"em\", \"vh\", \"vw\"],\n+ \"unit-whitelist\": [\"px\", \"%\", \"deg\", \"ms\", \"em\", \"vh\", \"vw\", \"vmin\"],\n\"value-list-comma-space-after\": \"always-single-line\",\n\"value-list-comma-space-before\": \"never\",\n\"declaration-block-semicolon-space-after\": \"always-single-line\",\n\"declaration-block-semicolon-newline-before\": \"never-multi-line\",\n\"declaration-block-semicolon-newline-after\": \"always-multi-line\",\n+ \"declaration-property-value-blacklist\": [\n+ { \"/.*/\": [\"initial\"] },\n+ { \"message\": \"The `initial` value is not supported in IE.\"}\n+ ],\n\"block-closing-brace-newline-after\": \"always\",\n\"block-closing-brace-newline-before\": \"always-multi-line\",\n"
},
{
"change_type": "MODIFY",
"old_path": "tslint.json",
"new_path": "tslint.json",
"diff": "{\n- \"rulesDirectory\": [\"node_modules/tslint-no-unused-var\"],\n+ \"rulesDirectory\": [\n+ \"./tools/tslint-rules/\"\n+ ],\n\"rules\": {\n\"max-line-length\": [true, 100],\n// Disable this flag because of SHA tslint#48b0c597f9257712c7d1f04b55ed0aa60e333f6a\n\"no-bitwise\": true,\n\"no-shadowed-variable\": true,\n\"no-unused-expression\": true,\n- \"no-unused-var\": [true, {\"ignore-pattern\": \"^(_.*)$\"}],\n\"no-var-keyword\": true,\n+ \"no-exposed-todo\": true,\n\"no-debugger\": true,\n\"one-line\": [\ntrue,\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update lint configurations and fixed lint issues |
530,388 | 29.05.2017 14:12:23 | -19,080 | 6e0cd566388d52d457f3f1f391ea8c6dc5def07b | feat(select) option group and | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/select/select-demo.html",
"new_path": "src/demo-app/select/select-demo.html",
"diff": "<button type=\"button\" button=\"primary\" (click)=\"pokemonControl.reset()\">RESET</button>\n</form>\n</div>\n+ <div class=\"card\">\n+ <div class=\"header\">\n+ <h3 class=\"title\">Option Groups</h3>\n+ </div>\n+ <form class=\"content\">\n+ <md2-select name=\"pokemongo\" placeholder=\"Pokemon\" [(ngModel)]=\"currentPokemonFromGroup\">\n+ <md2-optgroup *ngFor=\"let group of pokemonGroups\" [label]=\"group.name\"\n+ [disabled]=\"group.disabled\">\n+ <md2-option *ngFor=\"let creature of group.pokemon\" [value]=\"creature.value\">\n+ {{ creature.viewValue }}\n+ </md2-option>\n+ </md2-optgroup>\n+ </md2-select>\n+ </form>\n+ </div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/select/select-demo.ts",
"new_path": "src/demo-app/select/select-demo.ts",
"diff": "@@ -14,6 +14,7 @@ export class SelectDemo {\npokemonRequired = false;\npokemonDisabled = false;\ncurrentPokemon: string[];\n+ currentPokemonFromGroup: string;\nitems: Array<any> =\n[\n@@ -35,6 +36,41 @@ export class SelectDemo {\n{ value: 'psyduck-6', viewValue: 'Psyduck' },\n];\n+ pokemonGroups = [\n+ {\n+ name: 'Grass',\n+ pokemon: [\n+ { value: 'bulbasaur-0', viewValue: 'Bulbasaur' },\n+ { value: 'oddish-1', viewValue: 'Oddish' },\n+ { value: 'bellsprout-2', viewValue: 'Bellsprout' }\n+ ]\n+ },\n+ {\n+ name: 'Water',\n+ pokemon: [\n+ { value: 'squirtle-3', viewValue: 'Squirtle' },\n+ { value: 'psyduck-4', viewValue: 'Psyduck' },\n+ { value: 'horsea-5', viewValue: 'Horsea' }\n+ ]\n+ },\n+ {\n+ name: 'Fire',\n+ disabled: true,\n+ pokemon: [\n+ { value: 'charmander-6', viewValue: 'Charmander' },\n+ { value: 'vulpix-7', viewValue: 'Vulpix' },\n+ { value: 'flareon-8', viewValue: 'Flareon' }\n+ ]\n+ },\n+ {\n+ name: 'Psychic',\n+ pokemon: [\n+ { value: 'mew-9', viewValue: 'Mew' },\n+ { value: 'mewtwo-10', viewValue: 'Mewtwo' },\n+ ]\n+ }\n+ ];\n+\nsetPokemonValue() {\nthis.currentPokemon = ['eevee-4', 'psyduck-6'];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/README.md",
"new_path": "src/lib/select/README.md",
"diff": "@@ -21,6 +21,14 @@ Select allow the user to select option from options.\n| `onClose` | `Event` | Fired when close the Panel |\n+## `<md2-optgroup>`\n+### Properties of Option Group\n+\n+| Name | Type | Description |\n+| --- | --- | --- |\n+| `label` | `string` | Label of option group |\n+| `disabled` | `boolean` | Whether or not the options of the group is disabled |\n+\n## `<md2-option>`\n### Properties of Option\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/index.ts",
"new_path": "src/lib/select/index.ts",
"diff": "@@ -22,4 +22,5 @@ export class Md2SelectModule { }\nexport * from './select';\nexport * from './select-header';\nexport * from './option';\n+export * from './optgroup';\nexport { fadeInContent, transformPanel, transformPlaceholder } from './select-animations';\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/select/optgroup.html",
"diff": "+<label class=\"md2-optgroup-label\" [id]=\"_labelId\">{{ label }}</label>\n+<ng-content select=\"md2-option\"></ng-content>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/select/optgroup.scss",
"diff": "+.md2-optgroup-label {\n+ color: rgba(black, 0.54);\n+ white-space: nowrap;\n+ overflow: hidden;\n+ text-overflow: ellipsis;\n+ display: block;\n+ line-height: 48px;\n+ height: 48px;\n+ padding: 0 16px;\n+ text-align: left;\n+ text-decoration: none;\n+ user-select: none;\n+ cursor: default;\n+ font-weight: 700;\n+ font-size: 14px;\n+}\n+\n+.md2-optgroup-disabled .md2-optgroup-label {\n+ color: rgba(black, 0.38);\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/select/optgroup.ts",
"diff": "+import {Component, ViewEncapsulation, ContentChildren, QueryList, Input} from '@angular/core';\n+import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled';\n+\n+// Boilerplate for applying mixins to Md2Optgroup.\n+export class Md2OptgroupBase { }\n+export const _Md2OptgroupMixinBase = mixinDisabled(Md2OptgroupBase);\n+\n+// Counter for unique group ids.\n+let nextId = 0;\n+\n+/**\n+ * Component that is used to group instances of `md2-option`.\n+ */\n+@Component({\n+ moduleId: module.id,\n+ selector: 'md2-optgroup',\n+ templateUrl: 'optgroup.html',\n+ styleUrls: ['optgroup.css'],\n+ encapsulation: ViewEncapsulation.None,\n+ inputs: ['disabled'],\n+ host: {\n+ 'class': 'md2-optgroup',\n+ 'role': 'group',\n+ '[class.md2-optgroup-disabled]': 'disabled',\n+ '[attr.aria-disabled]': 'disabled.toString()',\n+ '[attr.aria-labelledby]': '_labelId',\n+ }\n+})\n+export class Md2Optgroup extends _Md2OptgroupMixinBase implements CanDisable {\n+ /** Label for the option group. */\n+ @Input() label: string;\n+\n+ /** Unique id for the underlying label. */\n+ _labelId: string = `md2-optgroup-label-${nextId++}`;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/select/option.scss",
"diff": "+@import '../core/style/menu-common';\n+@import '../core/style/vendor-prefixes';\n+@import '../core/a11y/a11y';\n+\n+$primary: #106cc8 !default;\n+\n+.md2-option {\n+ @include mat-menu-item-base();\n+ position: relative;\n+ cursor: pointer;\n+ outline: none;\n+\n+ &[aria-disabled='true'] {\n+ @include user-select(none);\n+ cursor: default;\n+ }\n+\n+ &:hover:not(.md2-option-disabled), &:focus:not(.md2-option-disabled) {\n+ background: rgba(black, 0.04);\n+ }\n+\n+ &.md2-selected {\n+ color: $primary;\n+\n+ &:not(.md2-option-multiple) {\n+ background: rgba(black, 0.04);\n+ }\n+ }\n+\n+ &.md2-active {\n+ background: rgba(black, 0.04);\n+ color: $primary;\n+ }\n+\n+ &.md2-option-disabled {\n+ color: rgba(black, 0.38);\n+ }\n+\n+ &.md2-option-multiple {\n+ padding-left: 40px;\n+\n+ &::after {\n+ content: '';\n+ position: absolute;\n+ top: 50%;\n+ left: 12px;\n+ display: block;\n+ width: 16px;\n+ height: 16px;\n+ margin-top: -8px;\n+ border: 2px solid;\n+ border-radius: 2px;\n+ box-sizing: border-box;\n+ transition: 240ms;\n+ }\n+\n+ &.md2-selected::after {\n+ transform: rotate(-45deg);\n+ height: 8px;\n+ border-width: 0 0 2px 2px;\n+ }\n+ }\n+}\n+\n+.md2-optgroup .md2-option:not(.md2-option-multiple) {\n+ padding-left: 32px;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/option.ts",
"new_path": "src/lib/select/option.ts",
"diff": "@@ -4,6 +4,7 @@ import {\nEventEmitter,\nInput,\nOutput,\n+ Optional,\nNgModule,\nViewEncapsulation,\n} from '@angular/core';\n@@ -11,6 +12,7 @@ import { CommonModule } from '@angular/common';\nimport { ENTER, SPACE } from '../core/keyboard/keycodes';\nimport { coerceBooleanProperty } from '../core/coercion/boolean-property';\nimport { MdSelectionModule } from '../core/selection/index';\n+import { Md2Optgroup } from './optgroup';\n/**\n* Option IDs need to be unique across components, so this counter exists outside of\n@@ -45,6 +47,7 @@ export class Md2OptionSelectionChange {\n'[class.md2-option]': 'true',\n},\ntemplate: '<ng-content></ng-content>',\n+ styleUrls: ['option.css'],\nencapsulation: ViewEncapsulation.None\n})\nexport class Md2Option {\n@@ -70,13 +73,14 @@ export class Md2Option {\n/** Whether the option is disabled. */\n@Input()\n- get disabled() { return this._disabled; }\n+ get disabled() { return (this.group && this.group.disabled) || this._disabled; }\nset disabled(value: any) { this._disabled = coerceBooleanProperty(value); }\n/** Event emitted when the option is selected or deselected. */\n@Output() onSelectionChange = new EventEmitter<Md2OptionSelectionChange>();\nconstructor(\n+ @Optional() public readonly group: Md2Optgroup,\nprivate _element: ElementRef) { }\n/**\n@@ -169,7 +173,7 @@ export class Md2Option {\n@NgModule({\nimports: [CommonModule, MdSelectionModule],\n- exports: [Md2Option],\n- declarations: [Md2Option]\n+ exports: [Md2Option, Md2Optgroup],\n+ declarations: [Md2Option, Md2Optgroup]\n})\nexport class Md2OptionModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.scss",
"new_path": "src/lib/select/select.scss",
"diff": "@@ -145,64 +145,6 @@ $md2-select-trigger-font-size: 16px !default;\nbackground: white;\n}\n-.md2-option {\n- @include mat-menu-item-base();\n- position: relative;\n- cursor: pointer;\n- outline: none;\n-\n- &[aria-disabled='true'] {\n- @include user-select(none);\n- cursor: default;\n- }\n-\n- &:hover:not(.md2-option-disabled), &:focus:not(.md2-option-disabled) {\n- background: rgba(black, 0.04);\n- }\n-\n- &.md2-selected {\n- color: $primary;\n-\n- &:not(.md2-option-multiple) {\n- background: rgba(black, 0.04);\n- }\n- }\n-\n- &.md2-active {\n- background: rgba(black, 0.04);\n- color: $primary;\n- }\n-\n- &.md2-option-disabled {\n- color: rgba(black, 0.38);\n- }\n-\n- &.md2-option-multiple {\n- padding-left: 40px;\n-\n- &::after {\n- content: '';\n- position: absolute;\n- top: 50%;\n- left: 12px;\n- display: block;\n- width: 16px;\n- height: 16px;\n- margin-top: -8px;\n- border: 2px solid;\n- border-radius: 2px;\n- box-sizing: border-box;\n- transition: 240ms;\n- }\n-\n- &.md2-selected::after {\n- transform: rotate(-45deg);\n- height: 8px;\n- border-width: 0 0 2px 2px;\n- }\n- }\n-}\n-\n.cdk-overlay-container, .cdk-global-overlay-wrapper {\npointer-events: none;\ntop: 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.ts",
"new_path": "src/lib/select/select.ts",
"diff": "@@ -18,6 +18,7 @@ import {\nOnInit,\n} from '@angular/core';\nimport { Md2Option, Md2OptionSelectionChange } from './option';\n+import { Md2Optgroup } from './optgroup';\nimport { ENTER, SPACE, UP_ARROW, DOWN_ARROW, HOME, END } from '../core/keyboard/keycodes';\nimport { FocusKeyManager } from '../core/a11y/focus-key-manager';\nimport { Dir } from '../core/rtl/dir';\n@@ -42,14 +43,15 @@ import 'rxjs/add/operator/filter';\n* the trigger element.\n*/\n-/** The fixed height of every option element. */\n-export const SELECT_OPTION_HEIGHT = 48;\n+/** The fixed height of every option element (option, group header etc.). */\n+export const SELECT_ITEM_HEIGHT = 48;\n/** The max height of the select's overlay panel */\nexport const SELECT_PANEL_MAX_HEIGHT = 256;\n/** The max number of options visible at once in the select panel. */\n-export const SELECT_MAX_OPTIONS_DISPLAYED = 5;\n+export const SELECT_MAX_OPTIONS_DISPLAYED =\n+ Math.floor(SELECT_PANEL_MAX_HEIGHT / SELECT_ITEM_HEIGHT);\n/** The fixed height of the select's trigger element. */\nexport const SELECT_TRIGGER_HEIGHT = 30;\n@@ -57,13 +59,15 @@ export const SELECT_TRIGGER_HEIGHT = 30;\n/**\n* Must adjust for the difference in height between the option and the trigger,\n* so the text will align on the y axis.\n- * (SELECT_OPTION_HEIGHT (48) - SELECT_TRIGGER_HEIGHT (30)) / 2 = 9\n*/\n-export const SELECT_OPTION_HEIGHT_ADJUSTMENT = 9;\n+export const SELECT_ITEM_HEIGHT_ADJUSTMENT = (SELECT_ITEM_HEIGHT - SELECT_TRIGGER_HEIGHT) / 2;\n/** The panel's padding on the x-axis */\nexport const SELECT_PANEL_PADDING_X = 16;\n+/** The panel's x axis padding if it is indented (e.g. there is an option group). */\n+export const SELECT_PANEL_INDENT_PADDING_X = SELECT_PANEL_PADDING_X * 2;\n+\n/**\n* Distance between the panel edge and the option text in\n* multi-selection mode.\n@@ -227,7 +231,10 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n@ViewChild(ConnectedOverlayDirective) overlayDir: ConnectedOverlayDirective;\n/** All of the defined select options. */\n- @ContentChildren(Md2Option) options: QueryList<Md2Option>;\n+ @ContentChildren(Md2Option, { descendants: true }) options: QueryList<Md2Option>;\n+\n+ /** All of the defined groups of options. */\n+ @ContentChildren(Md2Optgroup) optionGroups: QueryList<Md2Optgroup>;\n/** Placeholder to be shown if no value has been selected. */\n@Input()\n@@ -762,15 +769,18 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n/** Calculates the scroll position and x- and y-offsets of the overlay panel. */\nprivate _calculateOverlayPosition(): void {\n- const panelHeight =\n- Math.min(this.options.length * SELECT_OPTION_HEIGHT, SELECT_PANEL_MAX_HEIGHT);\n- const scrollContainerHeight = this.options.length * SELECT_OPTION_HEIGHT;\n+ const items = this._getItemCount();\n+ const panelHeight = Math.min(items * SELECT_ITEM_HEIGHT, SELECT_PANEL_MAX_HEIGHT);\n+ const scrollContainerHeight = items * SELECT_ITEM_HEIGHT;\n// The farthest the panel can be scrolled before it hits the bottom\nconst maxScroll = scrollContainerHeight - panelHeight;\nif (this._selectionModel.hasValue()) {\n- const selectedIndex = this._getOptionIndex(this._selectionModel.selected[0]);\n+ let selectedIndex = this._getOptionIndex(this._selectionModel.selected[0]);\n+\n+ selectedIndex += this._getLabelCountBeforeOption(selectedIndex);\n+\n// We must maintain a scroll buffer so the selected option will be scrolled to the\n// center of the overlay panel rather than the top.\nconst scrollBuffer = panelHeight / 2;\n@@ -781,7 +791,7 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n// we must only adjust for the height difference between the option element\n// and the trigger element, then multiply it by -1 to ensure the panel moves\n// in the correct direction up the page.\n- this._offsetY = (SELECT_OPTION_HEIGHT - SELECT_TRIGGER_HEIGHT) / 2 * -1;\n+ this._offsetY = (SELECT_ITEM_HEIGHT - SELECT_TRIGGER_HEIGHT) / 2 * -1;\n}\nthis._checkOverlayWithinViewport(maxScroll);\n@@ -796,8 +806,8 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n*/\n_calculateOverlayScroll(selectedIndex: number, scrollBuffer: number,\nmaxScroll: number): number {\n- const optionOffsetFromScrollTop = SELECT_OPTION_HEIGHT * selectedIndex;\n- const halfOptionHeight = SELECT_OPTION_HEIGHT / 2;\n+ const optionOffsetFromScrollTop = SELECT_ITEM_HEIGHT * selectedIndex;\n+ const halfOptionHeight = SELECT_ITEM_HEIGHT / 2;\n// Starts at the optionOffsetFromScrollTop, which scrolls the option to the top of the\n// scroll container, then subtracts the scroll buffer to scroll the option down to\n@@ -848,17 +858,28 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\nconst overlayRect = this.overlayDir.overlayRef.overlayElement.getBoundingClientRect();\nconst viewportRect = this._viewportRuler.getViewportRect();\nconst isRtl = this._isRtl();\n- let offsetX = this.multiple ? SELECT_MULTIPLE_PANEL_PADDING_X : SELECT_PANEL_PADDING_X;\n+ let offsetX: number;\n+\n+ // Adjust the offset, depending on the option padding.\n+ if (this.multiple) {\n+ offsetX = SELECT_MULTIPLE_PANEL_PADDING_X;\n+ } else {\n+ let selected = this._selectionModel.selected[0];\n+ offsetX = selected && selected.group ? SELECT_PANEL_INDENT_PADDING_X : SELECT_PANEL_PADDING_X;\n+ }\n+ // Invert the offset in LTR.\nif (!isRtl) {\noffsetX *= -1;\n}\n+ // Determine how much the select overflows on each side.\nconst leftOverflow = 0 - (overlayRect.left + offsetX\n- (isRtl ? SELECT_PANEL_PADDING_X * 2 : 0));\nconst rightOverflow = overlayRect.right + offsetX - viewportRect.width\n+ (isRtl ? 0 : SELECT_PANEL_PADDING_X * 2);\n+ // If the element overflows on either side, reduce the offset to allow it to fit.\nif (leftOverflow > 0) {\noffsetX += leftOverflow + SELECT_PANEL_VIEWPORT_PADDING;\n} else if (rightOverflow > 0) {\n@@ -881,9 +902,9 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\nlet optionOffsetFromPanelTop: number;\nif (this._scrollTop === 0) {\n- optionOffsetFromPanelTop = selectedIndex * SELECT_OPTION_HEIGHT;\n+ optionOffsetFromPanelTop = selectedIndex * SELECT_ITEM_HEIGHT;\n} else if (this._scrollTop === maxScroll) {\n- const firstDisplayedIndex = this.options.length - SELECT_MAX_OPTIONS_DISPLAYED;\n+ const firstDisplayedIndex = this._getItemCount() - SELECT_MAX_OPTIONS_DISPLAYED;\nconst selectedDisplayIndex = selectedIndex - firstDisplayedIndex;\n// Because the panel height is longer than the height of the options alone,\n@@ -891,18 +912,18 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n// scrolled to the very bottom, this padding is at the top of the panel and\n// must be added to the offset.\noptionOffsetFromPanelTop =\n- selectedDisplayIndex * SELECT_OPTION_HEIGHT + SELECT_PANEL_PADDING_Y;\n+ selectedDisplayIndex * SELECT_ITEM_HEIGHT + SELECT_PANEL_PADDING_Y;\n} else {\n// If the option was scrolled to the middle of the panel using a scroll buffer,\n// its offset will be the scroll buffer minus the half height that was added to\n// center it.\n- optionOffsetFromPanelTop = scrollBuffer - SELECT_OPTION_HEIGHT / 2;\n+ optionOffsetFromPanelTop = scrollBuffer - SELECT_ITEM_HEIGHT / 2;\n}\n// The final offset is the option's offset from the top, adjusted for the height\n// difference, multiplied by -1 to ensure that the overlay moves in the correct\n// direction up the page.\n- return optionOffsetFromPanelTop * -1 - SELECT_OPTION_HEIGHT_ADJUSTMENT;\n+ return optionOffsetFromPanelTop * -1 - SELECT_ITEM_HEIGHT_ADJUSTMENT;\n}\n/**\n@@ -921,7 +942,7 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\nconst panelHeightTop = Math.abs(this._offsetY);\nconst totalPanelHeight =\n- Math.min(this.options.length * SELECT_OPTION_HEIGHT, SELECT_PANEL_MAX_HEIGHT);\n+ Math.min(this._getItemCount() * SELECT_ITEM_HEIGHT, SELECT_PANEL_MAX_HEIGHT);\nconst panelHeightBottom = totalPanelHeight - panelHeightTop - triggerRect.height;\nif (panelHeightBottom > bottomSpaceAvailable) {\n@@ -978,7 +999,7 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n/** Sets the transform origin point based on the selected option. */\nprivate _getOriginBasedOnOption(): string {\nconst originY =\n- Math.abs(this._offsetY) - SELECT_OPTION_HEIGHT_ADJUSTMENT + SELECT_OPTION_HEIGHT / 2;\n+ Math.abs(this._offsetY) - SELECT_ITEM_HEIGHT_ADJUSTMENT + SELECT_ITEM_HEIGHT / 2;\nreturn `50% ${originY}px 0px`;\n}\n@@ -1011,6 +1032,34 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n}\n}\n+ /** Calculates the amount of items in the select. This includes options and group labels. */\n+ private _getItemCount(): number {\n+ return this.options.length + this.optionGroups.length;\n+ }\n+\n+ /**\n+ * Calculates the amount of option group labels that precede the specified option.\n+ * Useful when positioning the panel, because the labels will offset the index of the\n+ * currently-selected option.\n+ */\n+ private _getLabelCountBeforeOption(optionIndex: number): number {\n+ if (this.optionGroups.length) {\n+ let options = this.options.toArray();\n+ let groups = this.optionGroups.toArray();\n+ let groupCounter = 0;\n+\n+ for (let i = 0; i < optionIndex + 1; i++) {\n+ if (options[i].group && options[i].group === groups[groupCounter]) {\n+ groupCounter++;\n+ }\n+ }\n+\n+ return groupCounter;\n+ }\n+\n+ return 0;\n+ }\n+\n}\n/** Clamps a value n between min and max values. */\n"
}
] | TypeScript | MIT License | promact/md2 | feat(select) option group #129 and #213 |
530,388 | 30.05.2017 08:05:43 | -19,080 | f392449043eaf60d5fd2d988917783acb1fc0429 | fix(select) design with multiple select | [
{
"change_type": "MODIFY",
"old_path": "src/lib/select/option.scss",
"new_path": "src/lib/select/option.scss",
"diff": "@@ -7,6 +7,7 @@ $primary: #106cc8 !default;\n.md2-option {\n@include mat-menu-item-base();\nposition: relative;\n+ font-family: inherit;\ncursor: pointer;\noutline: none;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.ts",
"new_path": "src/lib/select/select.ts",
"diff": "@@ -77,7 +77,7 @@ export const SELECT_PANEL_INDENT_PADDING_X = SELECT_PANEL_PADDING_X * 2;\n* the browser adds ~4px, because we're using inline elements.\n* The checkbox width is 20px.\n*/\n-export const SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_PANEL_PADDING_X * 1.75 + 20;\n+export const SELECT_MULTIPLE_PANEL_PADDING_X = SELECT_PANEL_PADDING_X * 1.25 + 20;\n/**\n* The panel's padding on the y-axis. This padding indicates there are more\n"
}
] | TypeScript | MIT License | promact/md2 | fix(select) design with multiple select #221 |
530,388 | 30.05.2017 14:40:13 | -19,080 | 9c4394ded9bbccc14a95bebb66b1865351283404 | fix(datepicker) format date issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -575,6 +575,9 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\nlet el: any = event.target;\nlet date: Date = this._util.parse(el.value, this.format);\n+ if (!date) {\n+ date = this._util.parseDate(el.value, this.format);\n+ }\nif (this._util.isValidDate(date)) {\nlet d: Date = new Date(this.value);\nif (this.type !== 'time') {\n"
}
] | TypeScript | MIT License | promact/md2 | fix(datepicker) format date issue |
530,388 | 30.05.2017 15:14:51 | -19,080 | 9cfd97d7aa35de10c5b75edec8bf7b29fb6b0c40 | chore: update datepicker demo | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.html",
"new_path": "src/demo-app/datepicker/datepicker-demo.html",
"diff": "<h3 class=\"title\">Basic Date Picker</h3>\n</div>\n<form class=\"content\">\n+ <md2-datepicker name=\"mindate\"\n+ placeholder=\"Minimum Date\"\n+ [(ngModel)]=\"minDate\"\n+ [mode]=\"mode\"\n+ [container]=\"container\"\n+ [format]=\"dateFormat\"></md2-datepicker>\n+ <md2-datepicker name=\"maxdate\"\n+ placeholder=\"Maximum Date\"\n+ [(ngModel)]=\"maxDate\"\n+ [min]=\"minDate\"\n+ [mode]=\"mode\"\n+ [container]=\"container\"\n+ [format]=\"dateFormat\"></md2-datepicker>\n+ <br />\n<md2-datepicker name=\"birthdate\"\nplaceholder=\"Select Date\"\n[(ngModel)]=\"date\"\n[openOnFocus]=\"isOpenOnFocus\"\n[isOpen]=\"isOpen\"\n[type]=\"type\"\n- [enableDates]=\"enableDates\"\n- [disableDates]=\"disableDates\"\n- [disableWeekDays]=\"disableWeekDays\"\n[min]=\"minDate\"\n[max]=\"maxDate\"\n[mode]=\"mode\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.ts",
"new_path": "src/demo-app/datepicker/datepicker-demo.ts",
"diff": "@@ -48,21 +48,6 @@ export class DatepickerDemo {\nminDate: Date;\nmaxDate: Date;\nstartAt: Date;\n- enableDates: Array<Date> = [\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() - 7),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() - 1),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() + 5),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() + 7),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() + 8)\n- ];\n- disableDates: Array<Date> = [\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() - 2),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() - 1),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() + 2),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() + 5),\n- new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate() + 9)\n- ];\n- disableWeekDays: Array<number> = [0, 6];\ndateFormat: string = null;\ndateFormatsDateTime: Array<any> = [\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update datepicker demo |
530,388 | 30.05.2017 16:04:22 | -19,080 | d61bca059324b5742efd906bf3fa7a53f6b87a2d | feat(datepicker) picker position improvement | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -43,6 +43,9 @@ import {\nOverlay,\nOverlayState,\nOverlayRef,\n+ PositionStrategy,\n+ RepositionScrollStrategy,\n+ ScrollDispatcher,\nTemplatePortal,\nHorizontalConnectionPos,\nVerticalConnectionPos,\n@@ -140,8 +143,9 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n/** Event emitted when the selected date has been changed by the user. */\n@Output() change: EventEmitter<Md2DateChange> = new EventEmitter<Md2DateChange>();\n- constructor(private _element: ElementRef, private overlay: Overlay,\n+ constructor(private _element: ElementRef, private _overlay: Overlay,\nprivate _viewContainerRef: ViewContainerRef, private _locale: DateLocale,\n+ private _scrollDispatcher: ScrollDispatcher,\nprivate _util: DateUtil, @Self() @Optional() public _control: NgControl) {\nif (this._control) {\nthis._control.valueAccessor = this;\n@@ -171,14 +175,6 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n@Input() disableWeekDays: Array<number> = [];\n@Input() timeInterval: number = 1;\n- /** Position of the menu in the X axis. */\n- positionX: PanelPositionX = 'after';\n-\n- /** Position of the menu in the Y axis. */\n- positionY: PanelPositionY = 'below';\n-\n- overlapTrigger: boolean = true;\n-\n@Input()\nget type() { return this._type; }\nset type(value: Type) {\n@@ -958,44 +954,42 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nif (!this._overlayRef) {\nlet config = new OverlayState();\nif (this.container === 'inline') {\n- const [posX, fallbackX]: HorizontalConnectionPos[] =\n- this.positionX === 'before' ? ['end', 'start'] : ['start', 'end'];\n-\n- const [overlayY, fallbackOverlayY]: VerticalConnectionPos[] =\n- this.positionY === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];\n-\n- let originY = overlayY;\n- let fallbackOriginY = fallbackOverlayY;\n-\n- if (!this.overlapTrigger) {\n- originY = overlayY === 'top' ? 'bottom' : 'top';\n- fallbackOriginY = fallbackOverlayY === 'top' ? 'bottom' : 'top';\n- }\n- config.positionStrategy = this.overlay.position().connectedTo(this._element,\n- { originX: posX, originY: originY },\n- { overlayX: posX, overlayY: overlayY })\n- .withFallbackPosition(\n- { originX: fallbackX, originY: originY },\n- { overlayX: fallbackX, overlayY: overlayY })\n- .withFallbackPosition(\n- { originX: posX, originY: fallbackOriginY },\n- { overlayX: posX, overlayY: fallbackOverlayY })\n- .withFallbackPosition(\n- { originX: fallbackX, originY: fallbackOriginY },\n- { overlayX: fallbackX, overlayY: fallbackOverlayY });\n+ config.positionStrategy = this._createPopupPositionStrategy();\nconfig.hasBackdrop = true;\nconfig.backdropClass = 'cdk-overlay-transparent-backdrop';\n+ config.scrollStrategy = new RepositionScrollStrategy(this._scrollDispatcher);\n} else {\n- config.positionStrategy = this.overlay.position()\n+ config.positionStrategy = this._overlay.position()\n.global()\n.centerHorizontally()\n.centerVertically();\nconfig.hasBackdrop = true;\n}\n- this._overlayRef = this.overlay.create(config);\n+ this._overlayRef = this._overlay.create(config);\n}\n}\n+ /** Create the popup PositionStrategy. */\n+ private _createPopupPositionStrategy(): PositionStrategy {\n+ return this._overlay.position()\n+ .connectedTo(this._element,\n+ { originX: 'start', originY: 'top' },\n+ { overlayX: 'start', overlayY: 'top' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'end', originY: 'top' },\n+ { overlayX: 'end', overlayY: 'top' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'start', originY: 'bottom' },\n+ { overlayX: 'start', overlayY: 'bottom' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'end', originY: 'bottom' },\n+ { overlayX: 'end', overlayY: 'bottom' }\n+ );\n+ }\n+\nprivate _cleanUpSubscriptions(): void {\nif (this._backdropSubscription) {\nthis._backdropSubscription.unsubscribe();\n"
}
] | TypeScript | MIT License | promact/md2 | feat(datepicker) picker position improvement |
530,388 | 30.05.2017 16:07:22 | -19,080 | 400d4e4df842b6384011d6fd819e3bb6b441b882 | chore: update lint configurations | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "tools/stylelint/selector-nested-pattern-scoped/index.js",
"diff": "+const stylelint = require('stylelint');\n+const path = require('path');\n+const isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule');\n+const isStandardSyntaxSelector = require('stylelint/lib/utils/isStandardSyntaxSelector');\n+\n+const ruleName = 'material/selector-nested-pattern-scoped';\n+const messages = stylelint.utils.ruleMessages(ruleName, {\n+ expected: selector => `Expected nested selector '${selector}' to match specified pattern`,\n+});\n+\n+/**\n+ * Re-implementation of the `selector-nested-pattern` Stylelint rule, allowing us\n+ * to scope it to a particular set of files via the custom `filePattern` option. The\n+ * primary use-case is to be able to apply the rule only to theme files.\n+ *\n+ * Reference: https://stylelint.io/user-guide/rules/selector-nested-pattern/\n+ * Source: https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-nested-pattern/\n+ */\n+const plugin = stylelint.createPlugin(ruleName, (pattern, options) => {\n+ return (root, result) => {\n+ const selectorPattern = new RegExp(pattern);\n+ const filePattern = new RegExp(options.filePattern);\n+ const fileName = path.basename(root.source.input.file);\n+\n+ if (!filePattern.test(fileName)) return;\n+\n+ root.walkRules(rule => {\n+ if (rule.parent.type === 'rule' &&\n+ isStandardSyntaxRule(rule) &&\n+ isStandardSyntaxSelector(rule.selector) &&\n+ !selectorPattern.test(rule.selector)) {\n+\n+ stylelint.utils.report({\n+ result,\n+ ruleName,\n+ message: messages.expected(rule.selector),\n+ node: rule\n+ });\n+ }\n+ });\n+ };\n+});\n+\n+plugin.ruleName = ruleName;\n+plugin.messages = messages;\n+module.exports = plugin;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tools/tslint-rules/noExposedTodoRule.js",
"diff": "+const ts = require('typescript');\n+const utils = require('tsutils');\n+const Lint = require('tslint');\n+\n+const ERROR_MESSAGE =\n+ 'A TODO may only appear in inline (//) style comments. ' +\n+ 'This is meant to prevent a TODO from being accidentally included in any public API docs.';\n+\n+/**\n+ * Rule that walks through all comments inside of the library and adds failures when it\n+ * detects TODO's inside of multi-line comments. TODOs need to be placed inside of single-line\n+ * comments.\n+ */\n+class Rule extends Lint.Rules.AbstractRule {\n+\n+ apply(sourceFile) {\n+ return this.applyWithWalker(new NoExposedTodoWalker(sourceFile, this.getOptions()));\n+ }\n+}\n+\n+class NoExposedTodoWalker extends Lint.RuleWalker {\n+\n+ visitSourceFile(sourceFile) {\n+ utils.forEachComment(sourceFile, (fullText, commentRange) => {\n+ let isTodoComment = fullText.substring(commentRange.pos, commentRange.end).includes('TODO');\n+\n+ if (commentRange.kind === ts.SyntaxKind.MultiLineCommentTrivia && isTodoComment) {\n+ this.addFailureAt(commentRange.pos, commentRange.end - commentRange.pos, ERROR_MESSAGE);\n+ }\n+ });\n+ }\n+}\n+\n+exports.Rule = Rule;\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update lint configurations |
530,388 | 31.05.2017 14:05:51 | -19,080 | acabd1cb5c4ba3aa7a5aeffafea8ab88fd2a3fbc | feat(colorpicker) picker position improvement | [
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.ts",
"new_path": "src/lib/colorpicker/colorpicker.ts",
"diff": "@@ -26,6 +26,9 @@ import {\nOverlayModule,\nOverlayState,\nOverlayRef,\n+ PositionStrategy,\n+ RepositionScrollStrategy,\n+ ScrollDispatcher,\nTemplatePortal,\nPortalModule,\nHorizontalConnectionPos,\n@@ -34,7 +37,7 @@ import {\nimport { Subscription } from 'rxjs/Subscription';\nimport { ColorUtil } from './color-util';\nimport { coerceBooleanProperty } from '../core/coercion/boolean-property';\n-import { Container, PanelPositionX, PanelPositionY } from '../datepicker/datepicker';\n+import { Container } from '../datepicker/datepicker';\nlet nextId = 0;\n@@ -256,12 +259,6 @@ export class Md2Colorpicker implements OnDestroy, ControlValueAccessor {\n@Input() tabindex: number = 0;\n@Input() id: string = 'md2-colorpicker-' + (++nextId);\n- /** Position of the colorpicker in the X axis. */\n- positionX: PanelPositionX = 'after';\n-\n- /** Position of the colorpicker in the Y axis. */\n- positionY: PanelPositionY = 'below';\n- overlapTrigger: boolean = true;\nget value(): any {\nreturn this._innerValue;\n@@ -303,8 +300,9 @@ export class Md2Colorpicker implements OnDestroy, ControlValueAccessor {\n@ViewChild('portal') _templatePortal: TemplateRef<any>;\n- constructor(private _element: ElementRef, private overlay: Overlay,\n+ constructor(private _element: ElementRef, private _overlay: Overlay,\nprivate _viewContainerRef: ViewContainerRef, private _renderer: Renderer,\n+ private _scrollDispatcher: ScrollDispatcher,\nprivate _util: ColorUtil, @Self() @Optional() public _control: NgControl) {\nthis._created = false;\nif (this._control) {\n@@ -612,42 +610,40 @@ export class Md2Colorpicker implements OnDestroy, ControlValueAccessor {\nif (!this._overlayRef) {\nlet config = new OverlayState();\nif (this.container === 'inline') {\n- const [posX, fallbackX]: HorizontalConnectionPos[] =\n- this.positionX === 'before' ? ['end', 'start'] : ['start', 'end'];\n-\n- const [overlayY, fallbackOverlayY]: VerticalConnectionPos[] =\n- this.positionY === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];\n-\n- let originY = overlayY;\n- let fallbackOriginY = fallbackOverlayY;\n-\n- if (!this.overlapTrigger) {\n- originY = overlayY === 'top' ? 'bottom' : 'top';\n- fallbackOriginY = fallbackOverlayY === 'top' ? 'bottom' : 'top';\n- }\n- config.positionStrategy = this.overlay.position().connectedTo(this._element,\n- { originX: posX, originY: originY },\n- { overlayX: posX, overlayY: overlayY })\n- .withFallbackPosition(\n- { originX: fallbackX, originY: originY },\n- { overlayX: fallbackX, overlayY: overlayY })\n- .withFallbackPosition(\n- { originX: posX, originY: fallbackOriginY },\n- { overlayX: posX, overlayY: fallbackOverlayY })\n- .withFallbackPosition(\n- { originX: fallbackX, originY: fallbackOriginY },\n- { overlayX: fallbackX, overlayY: fallbackOverlayY });\n+ config.positionStrategy = this._createPickerPositionStrategy();\nconfig.hasBackdrop = true;\nconfig.backdropClass = 'cdk-overlay-transparent-backdrop';\n+ config.scrollStrategy = new RepositionScrollStrategy(this._scrollDispatcher);\n} else {\n- config.positionStrategy = this.overlay.position()\n+ config.positionStrategy = this._overlay.position()\n.global()\n.centerHorizontally()\n.centerVertically();\nconfig.hasBackdrop = true;\n}\n- this._overlayRef = this.overlay.create(config);\n+ this._overlayRef = this._overlay.create(config);\n+ }\n}\n+\n+ /** Create the popup PositionStrategy. */\n+ private _createPickerPositionStrategy(): PositionStrategy {\n+ return this._overlay.position()\n+ .connectedTo(this._element,\n+ { originX: 'start', originY: 'top' },\n+ { overlayX: 'start', overlayY: 'top' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'end', originY: 'top' },\n+ { overlayX: 'end', overlayY: 'top' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'start', originY: 'bottom' },\n+ { overlayX: 'start', overlayY: 'bottom' }\n+ )\n+ .withFallbackPosition(\n+ { originX: 'end', originY: 'bottom' },\n+ { overlayX: 'end', overlayY: 'bottom' }\n+ );\n}\nprivate _cleanUpSubscriptions(): void {\n"
}
] | TypeScript | MIT License | promact/md2 | feat(colorpicker) picker position improvement |
530,388 | 31.05.2017 14:07:27 | -19,080 | 386bb460f741c89be1eeb6ce07cd6366d88a25ae | fix(datepicker) prevent unnecessary fire change event onblur of textbox | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -360,9 +360,6 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis._openOnFocus = false;\nsetTimeout(() => { this._openOnFocus = true; }, 100);\n}\n- // if (!this._activeDate) {\n- // this._placeholderState = '';\n- // }\nif (this._overlayRef) {\nthis._overlayRef.detach();\nthis._backdropSubscription.unsubscribe();\n@@ -580,7 +577,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nif (this.type !== 'date') {\nd.setHours(date.getHours(), date.getMinutes());\n}\n- if (this.value !== d) {\n+ if (!this._util.isSameMinute(this.value, d)) {\nthis.value = d;\nthis._emitChangeEvent();\n}\n@@ -952,7 +949,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nif (!this._overlayRef) {\nlet config = new OverlayState();\nif (this.container === 'inline') {\n- config.positionStrategy = this._createPopupPositionStrategy();\n+ config.positionStrategy = this._createPickerPositionStrategy();\nconfig.hasBackdrop = true;\nconfig.backdropClass = 'cdk-overlay-transparent-backdrop';\nconfig.scrollStrategy = new RepositionScrollStrategy(this._scrollDispatcher);\n@@ -968,7 +965,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\n/** Create the popup PositionStrategy. */\n- private _createPopupPositionStrategy(): PositionStrategy {\n+ private _createPickerPositionStrategy(): PositionStrategy {\nreturn this._overlay.position()\n.connectedTo(this._element,\n{ originX: 'start', originY: 'top' },\n"
}
] | TypeScript | MIT License | promact/md2 | fix(datepicker) prevent unnecessary fire change event onblur of textbox |
530,388 | 31.05.2017 16:19:29 | -19,080 | 6053961c8946130088e4d7533f25e8559816c6cd | chore(chips) fix autocomplete object binding issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -94,7 +94,7 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\n@Input('autocomplete-item-text') autocompleteItemText: string = 'text';\n@Input('autocomplete-item-value') autocompleteItemValue: string = 'value';\n@Input('item-text') textKey: string = 'text';\n- @Input('item-value') valueKey: string = 'value';\n+ @Input('item-value') valueKey: string = null;\n@Output() change: EventEmitter<any> = new EventEmitter<any>();\n@ViewChild('chipInputForm') chipInputForm: NgForm;\n@@ -151,8 +151,7 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\nchangeAutocomplete(value: any) {\nif (value) {\n- let objText = value.value;\n- this.addNewChip(objText);\n+ this.addNewChip(value.value);\nthis.item = null;\n}\n}\n@@ -309,11 +308,8 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\nprivate addNewChip(chips: any): void {\nlet validInput = this._isValid(chips);\nif (validInput) {\n- if (this.maxChips) {\n- if (this.chipItemList.length < this.maxChips) {\n- this.chipItemList.push(new Chip(chips,\n- this.autocompleteItemText, this.autocompleteItemValue));\n- }\n+ if (this.maxChips && this.maxChips < this.chipItemList.length - 1) {\n+ return;\n} else {\nthis.chipItemList.push(new Chip(chips, this.textKey, this.valueKey));\nthis.item = null;\n@@ -361,15 +357,8 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\n* update value\n*/\nprivate updateValue() {\n-\nthis._value = new Array<any>();\n-\n- this._value = this.chipItemList.map((chip: any) => {\n- let a: any = {};\n- a[this.textKey] = chip.text;\n- a[this.valueKey] = chip.value;\n- return a;\n- });\n+ this._value = this.chipItemList.map((chip: any) => chip.value);\nthis._emitChangeEvent();\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore(chips) fix autocomplete object binding issue |
530,388 | 01.06.2017 10:52:51 | -19,080 | cea63a10765557cb50f27709737cf3ee3374b64b | fix(tabs) runtime forEach issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/tabs/tabs.ts",
"new_path": "src/lib/tabs/tabs.ts",
"diff": "@@ -265,9 +265,10 @@ export class Md2Tabs implements AfterContentInit {\n*/\nupdatePagination() {\nlet canvasWidth = this.element.root.clientWidth;\n- this.element.tabs.forEach((tab: any) => {\n- canvasWidth -= tab.offsetWidth;\n- });\n+ let tabs: any[] = this.element.tabs ? this.element.tabs : [];\n+ for (let i = 0; i < tabs.length; i++) {\n+ canvasWidth -= tabs[i].offsetWidth;\n+ }\nthis._shouldPaginate = canvasWidth < 0;\n}\n"
}
] | TypeScript | MIT License | promact/md2 | fix(tabs) runtime forEach issue |
530,388 | 01.06.2017 17:21:21 | -19,080 | 149dab896e22df0b21fb51dce2e14f508cf96c18 | chore(datepicker) implemented calendar component | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/calendar.scss",
"diff": "+$primary: #106cc8 !default;\n+$md2-calendar-padding: 8px !default;\n+$md2-calendar-period-font-size: 14px;\n+$md2-calendar-weekday-table-font-size: 11px !default;\n+$md2-calendar-body-font-size: 13px !default;\n+$md2-calendar-body-label-padding-start: 5% !default;\n+$md2-calendar-body-label-translation: -6px !default;\n+$md2-calendar-body-cell-min-size: 32px !default;\n+$md2-calendar-body-cell-size: 100% / 7 !default;\n+$md2-calendar-body-cell-content-margin: 5% !default;\n+$md2-calendar-body-cell-content-border-width: 1px !default;\n+$md2-calendar-body-min-size: 7 * $md2-calendar-body-cell-min-size !default;\n+$md2-calendar-body-cell-padding: $md2-calendar-body-cell-size / 2 !default;\n+$md2-calendar-body-cell-content-size: 100% - $md2-calendar-body-cell-content-margin * 2 !default;\n+$md2-datepicker-selected-today-box-shadow-width: 1px;\n+$md2-datepicker-selected-fade-amount: 0.6;\n+$md2-datepicker-today-fade-amount: 0.2;\n+\n+.md2-calendar {\n+ display: block;\n+}\n+\n+.md2-calendar-header {\n+ padding: $md2-calendar-padding $md2-calendar-padding 0 $md2-calendar-padding;\n+}\n+\n+.md2-calendar-controls {\n+ display: flex;\n+ justify-content: space-between;\n+}\n+\n+.md2-calendar-period-label {\n+ font: inherit;\n+ font-size: $md2-calendar-period-font-size;\n+ font-weight: bold;\n+ color: currentColor;\n+ line-height: 48px;\n+}\n+\n+.md2-calendar-previous-button,\n+.md2-calendar-next-button {\n+ display: inline-block;\n+ width: 48px;\n+ height: 48px;\n+ padding: 12px;\n+ outline: none;\n+ border: 0;\n+ cursor: pointer;\n+ background: transparent;\n+ box-sizing: border-box;\n+\n+ &[disabled] {\n+ color: rgba(black, 0.38);\n+ cursor: default;\n+ pointer-events: none;\n+ }\n+\n+ svg {\n+ fill: currentColor;\n+ vertical-align: top;\n+ }\n+}\n+\n+.md2-calendar-table {\n+ border-spacing: 0;\n+ border-collapse: collapse;\n+ width: 100%;\n+}\n+\n+.md2-calendar-table-header {\n+ color: rgba(black, 0.38);\n+\n+ th {\n+ text-align: center;\n+ font-size: $md2-calendar-weekday-table-font-size;\n+ font-weight: normal;\n+ padding: 0 0 $md2-calendar-padding 0;\n+ }\n+}\n+\n+.md2-calendar-body {\n+ font-size: $md2-calendar-body-font-size;\n+ min-width: $md2-calendar-body-min-size;\n+}\n+\n+.md2-calendar-body-cell {\n+ position: relative;\n+ width: $md2-calendar-body-cell-size;\n+ height: 0;\n+ line-height: 0;\n+ padding: $md2-calendar-body-cell-padding 0;\n+ text-align: center;\n+ outline: none;\n+ cursor: pointer;\n+\n+ .md2-calendar-body-disabled {\n+ cursor: default;\n+ }\n+}\n+\n+.md2-calendar-body-cell-content {\n+ position: absolute;\n+ top: $md2-calendar-body-cell-content-margin;\n+ left: $md2-calendar-body-cell-content-margin;\n+ display: flex;\n+ align-items: center;\n+ justify-content: center;\n+ box-sizing: border-box;\n+ width: $md2-calendar-body-cell-content-size;\n+ height: $md2-calendar-body-cell-content-size;\n+ border-width: $md2-calendar-body-cell-content-border-width;\n+ border-style: solid;\n+ border-radius: 50%;\n+ color: black;\n+ border-color: transparent;\n+\n+ .md2-calendar-body-disabled > &:not(.md2-calendar-body-selected) {\n+ color: rgba(black, 0.38);\n+ }\n+}\n+\n+:not(.md2-calendar-body-disabled):hover,\n+.md2-calendar-body-active {\n+ & > .md2-calendar-body-cell-content:not(.md2-calendar-body-selected) {\n+ background-color: rgba(black, 0.12);\n+ }\n+}\n+\n+.md2-calendar-body-selected {\n+ background-color: $primary;\n+ color: white;\n+}\n+\n+.md2-calendar-body-disabled > .md2-calendar-body-selected {\n+ background-color: fade-out($primary, $md2-datepicker-selected-fade-amount);\n+}\n+\n+.md2-calendar-body-today {\n+ &:not(.md2-calendar-body-selected) {\n+ border-color: $primary;\n+ }\n+\n+ &.md2-calendar-body-selected {\n+ box-shadow: inset 0 0 0 $md2-datepicker-selected-today-box-shadow-width white;\n+ }\n+}\n+\n+.md2-calendar-body-disabled > .md2-calendar-body-today:not(.md2-calendar-body-selected) {\n+ border-color: rgba(black, 0.18);\n+}\n+\n+.md2-calendar-years {\n+ position: absolute;\n+ top: 10px;\n+ right: 0;\n+ bottom: 10px;\n+ display: block;\n+ width: 100%;\n+ line-height: 40px;\n+ background: white;\n+ overflow-x: hidden;\n+ overflow-y: auto;\n+ transition: 300ms;\n+\n+ .md2-calendar-years-content {\n+ display: flex;\n+ flex-direction: column;\n+ justify-content: center;\n+ min-height: 100%;\n+ }\n+}\n+\n+.md2-calendar-year {\n+ position: relative;\n+ display: block;\n+ margin: 0 auto;\n+ padding: 0;\n+ font-size: 17px;\n+ font-weight: 400;\n+ text-align: center;\n+ cursor: pointer;\n+\n+ &.selected {\n+ color: $primary;\n+ font-size: 26px;\n+ font-weight: 500;\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/calendar.ts",
"diff": "+import {\n+ AfterContentInit,\n+ ChangeDetectionStrategy,\n+ Component,\n+ EventEmitter,\n+ Inject,\n+ Input,\n+ Optional,\n+ Output,\n+ ViewEncapsulation\n+} from '@angular/core';\n+import { DateAdapter } from '../core/datetime/index';\n+import { MD_DATE_FORMATS, MdDateFormats } from '../core/datetime/date-formats';\n+\n+export class Md2CalendarCell {\n+ constructor(public value: number,\n+ public displayValue: string,\n+ public ariaLabel: string,\n+ public enabled: boolean) { }\n+}\n+\n+const DAYS_PER_WEEK = 7;\n+\n+\n+/**\n+ * An internal component used to display a calendar in the datepicker.\n+ * @docs-private\n+ */\n+@Component({\n+ moduleId: module.id,\n+ selector: 'md2-calendar',\n+ templateUrl: 'calendar.html',\n+ styleUrls: ['calendar.css'],\n+ host: {\n+ '[class.md2-calendar]': 'true',\n+ },\n+ encapsulation: ViewEncapsulation.None,\n+ changeDetection: ChangeDetectionStrategy.OnPush,\n+})\n+export class Md2Calendar implements AfterContentInit {\n+\n+ @Input()\n+ get startView() { return this._startView; }\n+ set startView(value: 'month' | 'year') {\n+ this._startView = value;\n+ this._monthView = value != 'year';\n+ if (value === 'year') {\n+ this._scrollToSelectedYear();\n+ }\n+ }\n+ private _startView: 'month' | 'year' = 'month';\n+\n+ /** Whether the calendar is in month view. */\n+ _monthView: boolean;\n+\n+ /**\n+ * The date to display in this calendar (everything other than the month and year is ignored).\n+ */\n+ @Input()\n+ get activeDate(): Date { return this._activeDate; }\n+ set activeDate(value: Date) {\n+ let oldActiveDate = this._activeDate;\n+ this._activeDate = value || this._dateAdapter.today();\n+ if (!this._hasSameMonthAndYear(oldActiveDate, this._activeDate) && this._monthView !== undefined) {\n+ this._init();\n+ }\n+ }\n+ private _activeDate: Date;\n+\n+ get _periodLabel(): string {\n+ return this._dateAdapter.format(this.activeDate, this._dateFormats.display.monthYearLabel)\n+ .toLocaleUpperCase();\n+ }\n+\n+ /** The currently selected date. */\n+ @Input()\n+ get selected(): Date { return this._selected; }\n+ set selected(value: Date) {\n+ this._selected = value;\n+ this._selectedDate = this._getDateInCurrentMonth(this.selected);\n+ }\n+ private _selected: Date;\n+\n+ /** The minimum selectable date. */\n+ @Input() minDate: Date;\n+\n+ /** The maximum selectable date. */\n+ @Input() maxDate: Date;\n+\n+ /** A function used to filter which dates are selectable. */\n+ @Input() dateFilter: (date: Date) => boolean;\n+\n+ /** Emits when a new date is selected. */\n+ @Output() selectedChange = new EventEmitter<Date>();\n+\n+ /** The label for this month (e.g. \"January 2017\"). */\n+ _monthLabel: string;\n+\n+ /** Grid of calendar cells representing the dates of the month. */\n+ _weeks: Md2CalendarCell[][];\n+\n+ _years: Array<number> = [];\n+\n+ /** The number of blank cells in the first row before the 1st of the month. */\n+ _firstWeekOffset: number;\n+\n+ /**\n+ * The date of the month that the currently selected Date falls on.\n+ * Null if the currently selected Date is in another month.\n+ */\n+ _selectedDate: number;\n+\n+ /** The date of the month that today falls on. Null if today is in another month. */\n+ _todayDate: number;\n+\n+ /** The names of the weekdays. */\n+ _weekdays: { long: string, narrow: string }[];\n+\n+ constructor( @Optional() public _dateAdapter: DateAdapter<Date>,\n+ @Optional() @Inject(MD_DATE_FORMATS) private _dateFormats: MdDateFormats) {\n+ if (!this._dateAdapter) {\n+ throw Error('DateAdapter');\n+ }\n+ if (!this._dateFormats) {\n+ throw Error('MD_DATE_FORMATS');\n+ }\n+\n+ const firstDayOfWeek = this._dateAdapter.getFirstDayOfWeek();\n+ const narrowWeekdays = this._dateAdapter.getDayOfWeekNames('narrow');\n+ const longWeekdays = this._dateAdapter.getDayOfWeekNames('long');\n+\n+ // Rotate the labels for days of the week based on the configured first day of the week.\n+ let weekdays = longWeekdays.map((long, i) => {\n+ return { long, narrow: narrowWeekdays[i] };\n+ });\n+ this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));\n+\n+ this.activeDate = this._dateAdapter.today();\n+ }\n+\n+ ngAfterContentInit(): void {\n+ this._monthView = this.startView != 'year';\n+ this._init();\n+ }\n+\n+ /** Handles when a new date is selected. */\n+ _dateSelected(cell: Md2CalendarCell) {\n+ if (!cell.enabled) { return; }\n+ if (this._selectedDate == cell.value) {\n+ return;\n+ }\n+ this.selectedChange.emit(this._dateAdapter.createDate(\n+ this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate),\n+ cell.value));\n+ }\n+\n+ /** Handles month selection in the year view. */\n+ _yearSelected(year: number): void {\n+ this.selectedChange.emit(new Date(year, this.activeDate.getMonth(), this.activeDate.getDate(),\n+ this.activeDate.getHours(), this.activeDate.getMinutes()));\n+ }\n+\n+ /** Handles user clicks on the previous button. */\n+ _previousClicked(): void {\n+ this.activeDate = this._dateAdapter.addCalendarMonths(this.activeDate, -1);\n+ }\n+\n+ /** Handles user clicks on the next button. */\n+ _nextClicked(): void {\n+ this.activeDate = this._dateAdapter.addCalendarMonths(this.activeDate, 1);\n+ }\n+\n+ /** Whether the previous period button is enabled. */\n+ _previousEnabled(): boolean {\n+ if (!this.minDate) {\n+ return true;\n+ }\n+ return !this.minDate || !this._hasSameMonthAndYear(this.activeDate, this.minDate);\n+ }\n+\n+ /** Whether the next period button is enabled. */\n+ _nextEnabled(): boolean {\n+ return !this.maxDate || !this._hasSameMonthAndYear(this.activeDate, this.maxDate);\n+ }\n+\n+ /** The number of blank cells to put at the beginning for the first row. */\n+ get _firstRowOffset(): number {\n+ return this._weeks && this._weeks.length && this._weeks[0].length ?\n+ DAYS_PER_WEEK - this._weeks[0].length : 0;\n+ }\n+\n+ _isActiveCell(rowIndex: number, colIndex: number): boolean {\n+ let cellNumber = rowIndex * DAYS_PER_WEEK + colIndex;\n+\n+ // Account for the fact that the first row may not have as many cells.\n+ if (rowIndex) {\n+ cellNumber -= this._firstRowOffset;\n+ }\n+\n+ return cellNumber == this._dateAdapter.getDate(this.activeDate) - 1;\n+ }\n+\n+ /** Initializes this month view. */\n+ private _init() {\n+ this._selectedDate = this._getDateInCurrentMonth(this.selected);\n+ this._todayDate = this._getDateInCurrentMonth(this._dateAdapter.today());\n+ this._monthLabel =\n+ this._dateAdapter.getMonthNames('short')[this._dateAdapter.getMonth(this.activeDate)]\n+ .toLocaleUpperCase();\n+\n+ let firstOfMonth = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),\n+ this._dateAdapter.getMonth(this.activeDate), 1);\n+ this._firstWeekOffset =\n+ (DAYS_PER_WEEK + this._dateAdapter.getDayOfWeek(firstOfMonth) -\n+ this._dateAdapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;\n+\n+ this._createWeekCells();\n+ this._createYears();\n+ }\n+\n+ /** Creates Md2CalendarCells for the dates in this month. */\n+ private _createWeekCells() {\n+ let daysInMonth = this._dateAdapter.getNumDaysInMonth(this.activeDate);\n+ let dateNames = this._dateAdapter.getDateNames();\n+ this._weeks = [[]];\n+ for (let i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++ , cell++) {\n+ if (cell == DAYS_PER_WEEK) {\n+ this._weeks.push([]);\n+ cell = 0;\n+ }\n+ let date = this._dateAdapter.createDate(\n+ this._dateAdapter.getYear(this.activeDate),\n+ this._dateAdapter.getMonth(this.activeDate), i + 1);\n+ let enabled = !this.dateFilter ||\n+ this.dateFilter(date);\n+ let ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.dateA11yLabel);\n+ this._weeks[this._weeks.length - 1]\n+ .push(new Md2CalendarCell(i + 1, dateNames[i], ariaLabel, enabled));\n+ }\n+ }\n+\n+ private _createYears() {\n+ let startYear = this.minDate ? this.minDate.getFullYear() : 1900,\n+ endYear = this.maxDate ? this.maxDate.getFullYear() : this._dateAdapter.today().getFullYear() + 100;\n+ this._years = [];\n+ for (let i = startYear; i <= endYear; i++) {\n+ this._years.push(i);\n+ }\n+ }\n+\n+ private _scrollToSelectedYear() {\n+ setTimeout(() => {\n+ let yearContainer: any = document.querySelector('.md2-calendar-years'),\n+ selectedYear: any = document.querySelector('.md2-calendar-year.selected');\n+ yearContainer.scrollTop = (selectedYear.offsetTop + 20) - yearContainer.clientHeight / 2;\n+ }, 0);\n+ }\n+\n+ /**\n+ * Gets the date in this month that the given Date falls on.\n+ * Returns null if the given Date is in another month.\n+ */\n+ private _getDateInCurrentMonth(date: Date): number {\n+ return this._hasSameMonthAndYear(date, this.activeDate) ?\n+ this._dateAdapter.getDate(date) : null;\n+ }\n+\n+ /** Checks whether the 2 dates are non-null and fall within the same month of the same year. */\n+ private _hasSameMonthAndYear(d1: Date, d2: Date): boolean {\n+ return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n+ this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.html",
"new_path": "src/lib/datepicker/datepicker.html",
"diff": "<div class=\"md2-datepicker-header\">\n<div class=\"md2-datepicker-header-year\"\n*ngIf=\"type!=='time'\"\n- [class.active]=\"_isYearsVisible\"\n+ [class.active]=\"startView === 'year'\"\n(click)=\"_showYear()\">{{ activeDate | date: 'y' }}</div>\n<div class=\"md2-datepicker-header-date-time\">\n<span class=\"md2-datepicker-header-date\"\n*ngIf=\"type!=='time'\"\n- [class.active]=\"_isCalendarVisible && !_isYearsVisible\"\n+ [class.active]=\"_isCalendarVisible && startView === 'month'\"\n(click)=\"_showCalendar()\">\n{{ getDateLabel }}\n</span>\n</div>\n<div class=\"md2-datepicker-content\">\n<div class=\"md2-datepicker-calendar\" [class.active]=\"_isCalendarVisible\">\n- <div class=\"md2-calendar-years\" [class.active]=\"_isYearsVisible\">\n+ <md2-calendar [startView]=\"startView\"\n+ [minDate]=\"min\"\n+ [maxDate]=\"max\"\n+ [activeDate]=\"activeDate\"\n+ [selected]=\"value\"\n+ [dateFilter]=\"_dateFilterForViews\"\n+ (selectedChange)=\"_onDateChange($event)\"></md2-calendar>\n+ <!--<div class=\"md2-calendar-years\" [class.active]=\"_isYearsVisible\">\n<div class=\"md2-calendar-years-content\">\n<div *ngFor=\"let y of _years\"\nclass=\"md2-calendar-year\"\n</tr>\n</tbody>\n</table>\n- </div>\n+ </div>-->\n</div>\n<md2-clock [class.active]=\"!_isCalendarVisible\"\n[startView]=\"_clockView\"\n[selected]=\"activeDate\"\n[min]=\"min\"\n[max]=\"max\"\n- (activeDateChange)=\"_onActiveTimeChange($event)\"\n+ (activeDateChange)=\"_onActiveDateChange($event)\"\n(selectedChange)=\"_onTimeChange($event)\"></md2-clock>\n<div class=\"md2-datepicker-actions\">\n<div class=\"md2-button\" (click)=\"close()\">{{ cancelLabel }}</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -25,6 +25,7 @@ import {\nValidatorFn,\nValidators\n} from '@angular/forms';\n+import { DateAdapter } from '../core/datetime/index';\nimport { DateLocale } from './date-locale';\nimport { DateUtil } from './date-util';\nimport {\n@@ -109,7 +110,6 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n_years: Array<number> = [];\n_dates: Array<Object> = [];\n- _isYearsVisible: boolean;\n_isCalendarVisible: boolean;\n_clockView: ClockView = 'hour';\n_calendarState: string;\n@@ -141,7 +141,23 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n/** Event emitted when the selected date has been changed by the user. */\n@Output() change: EventEmitter<Md2DateChange> = new EventEmitter<Md2DateChange>();\n+\n+ /** The view that the calendar should start in. */\n+ @Input() startView: 'month' | 'year' = 'month';\n+\n+ /** A function used to filter which dates are selectable. */\n+ @Input() dateFilter: (date: Date) => boolean;\n+\n+ /** Date filter for the month and year views. */\n+ _dateFilterForViews = (date: Date) => {\n+ return !!date &&\n+ (!this.dateFilter || this.dateFilter(date)) &&\n+ (!this.min || this._dateAdapter.compareDate(date, this.min) >= 0) &&\n+ (!this.max || this._dateAdapter.compareDate(date, this.max) <= 0);\n+ }\n+\nconstructor(private _element: ElementRef, private _overlay: Overlay,\n+ @Optional() public _dateAdapter: DateAdapter<Date>,\nprivate _viewContainerRef: ViewContainerRef, private _locale: DateLocale,\nprivate _scrollDispatcher: ScrollDispatcher,\nprivate _util: DateUtil, @Self() @Optional() public _control: NgControl) {\n@@ -366,7 +382,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n}\nthis._focusHost();\n- this._isYearsVisible = false;\n+ this.startView = 'month';\nthis._isCalendarVisible = this.type !== 'time' ? true : false;\nthis._clockView = 'hour';\n}, 10);\n@@ -449,7 +465,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\ncase ESCAPE: this._onBlur(); this.close(); break;\n}\nlet date = this.activeDate;\n- if (this._isYearsVisible) {\n+ if (this.startView === 'year') {\nswitch (event.keyCode) {\ncase ENTER: this._onClickOk(); break;\n@@ -593,9 +609,9 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n* Display Years\n*/\n_showYear() {\n- this._isYearsVisible = true;\n+ this.startView = 'year';\nthis._isCalendarVisible = true;\n- this._scrollToSelectedYear();\n+ //this._scrollToSelectedYear();\n}\nprivate getYears() {\n@@ -623,14 +639,14 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis.activeDate = new Date(year, this.activeDate.getMonth(), this.activeDate.getDate(),\nthis.activeDate.getHours(), this.activeDate.getMinutes());\nthis.generateCalendar();\n- this._isYearsVisible = false;\n+ this.startView = 'month';\n}\n/**\n* Display Calendar\n*/\n_showCalendar() {\n- this._isYearsVisible = false;\n+ this.startView = 'month';\nthis._isCalendarVisible = true;\n}\n@@ -638,9 +654,8 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n* Toggle Hour visiblity\n*/\n_toggleHours(value: ClockView) {\n- this._isYearsVisible = false;\n+ this.startView = 'month';\nthis._isCalendarVisible = false;\n- this._isYearsVisible = false;\nthis._clockView = value;\n}\n@@ -648,9 +663,9 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\n* Ok Button Event\n*/\n_onClickOk() {\n- if (this._isYearsVisible) {\n+ if (this.startView === 'year') {\nthis.generateCalendar();\n- this._isYearsVisible = false;\n+ this.startView = 'month';\nthis._isCalendarVisible = true;\n} else if (this._isCalendarVisible) {\nthis._dateSelected(this.activeDate);\n@@ -732,8 +747,17 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nthis._max && this._util.getMonthDistance(this.activeDate, this._max) > 0;\n}\n- _onActiveTimeChange(event: Date) {\n- this.activeDate = event;\n+ _onActiveDateChange(date: Date) {\n+ this.activeDate = date;\n+ }\n+\n+ _onDateChange(date: Date) {\n+ this.value = date;\n+ if (this.startView === 'year') {\n+ this.startView = 'month';\n+ } else {\n+ this._dateSelected(date);\n+ }\n}\n_onTimeChange(event: Date) {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/index.ts",
"new_path": "src/lib/datepicker/index.ts",
"diff": "@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { OverlayModule, PortalModule } from '../core';\nimport { Md2Datepicker } from './datepicker';\n+import { Md2Calendar } from './calendar';\nimport { Md2Clock } from './clock';\nimport { DateUtil } from './date-util';\nimport { DateLocale } from './date-locale';\n@@ -23,10 +24,12 @@ export * from './date-locale';\n],\nexports: [\nMd2Datepicker,\n+ Md2Calendar,\nMd2Clock,\n],\ndeclarations: [\nMd2Datepicker,\n+ Md2Calendar,\nMd2Clock,\n],\nproviders: [DateLocale, DateUtil],\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) implemented calendar component |
530,388 | 02.06.2017 12:17:41 | -19,080 | 13276bfac235a44e78267b34a4d1c295750a3dfa | chore: implemented month, year and calendar body components in datepicker | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/calendar-body.html",
"diff": "+<!--\n+ If there's not enough space in the first row, create a separate label row. We mark this row as\n+ aria-hidden because we don't want it to be read out as one of the weeks in the month.\n+-->\n+<tr *ngIf=\"_firstRowOffset < labelMinRequiredCells\" aria-hidden=\"true\">\n+ <td class=\"md2-calendar-body-label\" [attr.colspan]=\"numCols\" >{{label}}</td>\n+</tr>\n+\n+<!-- Create the first row separately so we can include a special spacer cell. -->\n+<tr *ngFor=\"let row of rows; let rowIndex = index\" role=\"row\">\n+ <!--\n+ We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n+ -->\n+ <td *ngIf=\"rowIndex === 0 && _firstRowOffset\"\n+ aria-hidden=\"true\"\n+ class=\"md2-calendar-body-label\"\n+ [attr.colspan]=\"_firstRowOffset\">\n+ {{_firstRowOffset >= labelMinRequiredCells ? label : ''}}\n+ </td>\n+ <td *ngFor=\"let item of row; let colIndex = index\"\n+ role=\"gridcell\"\n+ class=\"md2-calendar-body-cell\"\n+ [tabindex]=\"_isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n+ [class.md2-calendar-body-disabled]=\"!item.enabled\"\n+ [class.md2-calendar-body-active]=\"_isActiveCell(rowIndex, colIndex)\"\n+ [attr.aria-label]=\"item.ariaLabel\"\n+ [attr.aria-disabled]=\"!item.enabled || null\"\n+ (click)=\"_cellClicked(item)\">\n+ <div class=\"md2-calendar-body-cell-content\"\n+ [class.md2-calendar-body-selected]=\"selectedValue === item.value\"\n+ [class.md2-calendar-body-today]=\"todayValue === item.value\">\n+ {{item.displayValue}}\n+ </div>\n+ </td>\n+</tr>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/calendar-body.scss",
"diff": "+$primary: #106cc8 !default;\n+$md2-calendar-body-font-size: 13px !default;\n+$md2-calendar-body-header-font-size: 14px !default;\n+$md2-calendar-body-label-padding-start: 5% !default;\n+$md2-calendar-body-label-translation: -6px !default;\n+$md2-calendar-body-cell-min-size: 32px !default;\n+$md2-calendar-body-cell-size: 100% / 7 !default;\n+$md2-calendar-body-cell-content-margin: 5% !default;\n+$md2-calendar-body-cell-content-border-width: 1px !default;\n+\n+$md2-calendar-body-min-size: 7 * $md2-calendar-body-cell-min-size !default;\n+$md2-calendar-body-cell-padding: $md2-calendar-body-cell-size / 2 !default;\n+$md2-calendar-body-cell-content-size: 100% - $md2-calendar-body-cell-content-margin * 2 !default;\n+$md2-datepicker-selected-today-box-shadow-width: 1px;\n+\n+.md2-calendar-body {\n+ font-size: $md2-calendar-body-font-size;\n+ min-width: $md2-calendar-body-min-size;\n+}\n+\n+.md2-calendar-body-label {\n+ padding: $md2-calendar-body-cell-padding 0 $md2-calendar-body-cell-padding $md2-calendar-body-cell-padding;\n+ height: 0;\n+ line-height: 0;\n+ color: rgba(black, 0.54);\n+ transform: translateX($md2-calendar-body-label-translation);\n+ text-align: left;\n+ font-size: $md2-calendar-body-header-font-size;\n+ font-weight: bold;\n+}\n+\n+.md2-calendar-body-cell {\n+ position: relative;\n+ width: $md2-calendar-body-cell-size;\n+ height: 0;\n+ line-height: 0;\n+ padding: $md2-calendar-body-cell-padding 0;\n+ text-align: center;\n+ outline: none;\n+ cursor: pointer;\n+}\n+\n+.md2-calendar-body-disabled {\n+ cursor: default;\n+}\n+\n+.md2-calendar-body-cell-content {\n+ position: absolute;\n+ top: $md2-calendar-body-cell-content-margin;\n+ left: $md2-calendar-body-cell-content-margin;\n+ display: flex;\n+ align-items: center;\n+ justify-content: center;\n+ box-sizing: border-box;\n+ width: $md2-calendar-body-cell-content-size;\n+ height: $md2-calendar-body-cell-content-size;\n+ color: rgba(black, 0.87);\n+ border-width: $md2-calendar-body-cell-content-border-width;\n+ border-style: solid;\n+ border-color: transparent;\n+ border-radius: 50%;\n+\n+ .md2-calendar-body-disabled > &:not(.md2-calendar-body-selected) {\n+ color: rgba(0,0,0,.38);\n+ }\n+}\n+\n+:not(.md2-calendar-body-disabled):hover,\n+.cdk-keyboard-focused .md2-calendar-body-active {\n+ & > .md2-calendar-body-cell-content:not(.md2-calendar-body-selected) {\n+ background-color: rgba(black, 0.12);\n+ }\n+}\n+\n+.md2-calendar-body-selected {\n+ background-color: $primary;\n+ color: white;\n+}\n+\n+.md2-calendar-body-disabled > .md2-calendar-body-selected {\n+ background-color: rgba($primary, 0.4);\n+}\n+\n+.md2-calendar-body-today {\n+ &:not(.md2-calendar-body-selected) {\n+ border-color: $primary;\n+ }\n+\n+ &.md2-calendar-body-selected {\n+ box-shadow: inset 0 0 0 $md2-datepicker-selected-today-box-shadow-width md2-color($primary, default-contrast);\n+ }\n+}\n+\n+.md2-calendar-body-disabled > .md2-calendar-body-today:not(.md2-calendar-body-selected) {\n+ border-color: rgba(black, 0.18);\n+}\n+\n+[dir='rtl'] {\n+ .md2-calendar-body-label {\n+ padding: 0 $md2-calendar-body-cell-padding 0 0;\n+ transform: translateX(-$md2-calendar-body-label-translation);\n+ text-align: right;\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/calendar-body.ts",
"diff": "+import {\n+ ChangeDetectionStrategy,\n+ Component,\n+ EventEmitter,\n+ Input,\n+ Output,\n+ ViewEncapsulation\n+} from '@angular/core';\n+\n+\n+/**\n+ * An internal class that represents the data corresponding to a single calendar cell.\n+ * @docs-private\n+ */\n+export class Md2CalendarCell {\n+ constructor(public value: number,\n+ public displayValue: string,\n+ public ariaLabel: string,\n+ public enabled: boolean) {}\n+}\n+\n+\n+/**\n+ * An internal component used to display calendar data in a table.\n+ * @docs-private\n+ */\n+@Component({\n+ moduleId: module.id,\n+ selector: '[md2-calendar-body]',\n+ templateUrl: 'calendar-body.html',\n+ styleUrls: ['calendar-body.css'],\n+ host: {\n+ 'class': 'md2-calendar-body',\n+ },\n+ encapsulation: ViewEncapsulation.None,\n+ changeDetection: ChangeDetectionStrategy.OnPush,\n+})\n+export class Md2CalendarBody {\n+ /** The label for the table. (e.g. \"Jan 2017\"). */\n+ @Input() label: string;\n+\n+ /** The cells to display in the table. */\n+ @Input() rows: Md2CalendarCell[][];\n+\n+ /** The value in the table that corresponds to today. */\n+ @Input() todayValue: number;\n+\n+ /** The value in the table that is currently selected. */\n+ @Input() selectedValue: number;\n+\n+ /** The minimum number of free cells needed to fit the label in the first row. */\n+ @Input() labelMinRequiredCells: number;\n+\n+ /** The number of columns in the table. */\n+ @Input() numCols = 7;\n+\n+ /** Whether to allow selection of disabled cells. */\n+ @Input() allowDisabledSelection = false;\n+\n+ /** The cell number of the active cell in the table. */\n+ @Input() activeCell = 0;\n+\n+ /** Emits when a new value is selected. */\n+ @Output() selectedValueChange = new EventEmitter<number>();\n+\n+ _cellClicked(cell: Md2CalendarCell): void {\n+ if (!this.allowDisabledSelection && !cell.enabled) {\n+ return;\n+ }\n+ this.selectedValueChange.emit(cell.value);\n+ }\n+\n+ /** The number of blank cells to put at the beginning for the first row. */\n+ get _firstRowOffset(): number {\n+ return this.rows && this.rows.length && this.rows[0].length ?\n+ this.numCols - this.rows[0].length : 0;\n+ }\n+\n+ _isActiveCell(rowIndex: number, colIndex: number): boolean {\n+ let cellNumber = rowIndex * this.numCols + colIndex;\n+\n+ // Account for the fact that the first row may not have as many cells.\n+ if (rowIndex) {\n+ cellNumber -= this._firstRowOffset;\n+ }\n+\n+ return cellNumber == this.activeCell;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/calendar.scss",
"new_path": "src/lib/datepicker/calendar.scss",
"diff": "@@ -13,8 +13,6 @@ $md2-calendar-body-min-size: 7 * $md2-calendar-body-cell-min-size !default;\n$md2-calendar-body-cell-padding: $md2-calendar-body-cell-size / 2 !default;\n$md2-calendar-body-cell-content-size: 100% - $md2-calendar-body-cell-content-margin * 2 !default;\n$md2-datepicker-selected-today-box-shadow-width: 1px;\n-$md2-datepicker-selected-fade-amount: 0.6;\n-$md2-datepicker-today-fade-amount: 0.2;\n.md2-calendar {\ndisplay: block;\n@@ -132,7 +130,7 @@ $md2-datepicker-today-fade-amount: 0.2;\n}\n.md2-calendar-body-disabled > .md2-calendar-body-selected {\n- background-color: fade-out($primary, $md2-datepicker-selected-fade-amount);\n+ background-color: rgba($primary, 0.4);\n}\n.md2-calendar-body-today {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/index.ts",
"new_path": "src/lib/datepicker/index.ts",
"diff": "@@ -3,6 +3,9 @@ import { CommonModule } from '@angular/common';\nimport { OverlayModule, PortalModule } from '../core';\nimport { Md2Datepicker } from './datepicker';\nimport { Md2Calendar } from './calendar';\n+import { Md2MonthView } from './month-view';\n+import { Md2YearView } from './year-view';\n+import { Md2CalendarBody } from './calendar-body';\nimport { Md2Clock } from './clock';\nimport { DateUtil } from './date-util';\nimport { DateLocale } from './date-locale';\n@@ -10,6 +13,9 @@ import { StyleModule } from '../core/style/index';\nexport * from './datepicker';\n+export * from './month-view';\n+export * from './year-view';\n+export * from './calendar-body';\nexport * from './clock';\nexport * from './date-util';\nexport * from './date-locale';\n@@ -25,11 +31,17 @@ export * from './date-locale';\nexports: [\nMd2Datepicker,\nMd2Calendar,\n+ Md2MonthView,\n+ Md2YearView,\n+ Md2CalendarBody,\nMd2Clock,\n],\ndeclarations: [\nMd2Datepicker,\nMd2Calendar,\n+ Md2MonthView,\n+ Md2YearView,\n+ Md2CalendarBody,\nMd2Clock,\n],\nproviders: [DateLocale, DateUtil],\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/month-view.html",
"diff": "+<table class=\"md2-calendar-table\">\n+ <thead class=\"md2-calendar-table-header\">\n+ <tr><th *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th></tr>\n+ <tr><th class=\"md2-calendar-table-header-divider\" colspan=\"7\" aria-hidden=\"true\"></th></tr>\n+ </thead>\n+ <tbody md2-calendar-body\n+ role=\"grid\"\n+ [label]=\"_monthLabel\"\n+ [rows]=\"_weeks\"\n+ [todayValue]=\"_todayDate\"\n+ [selectedValue]=\"_selectedDate\"\n+ [labelMinRequiredCells]=\"3\"\n+ [activeCell]=\"_dateAdapter.getDate(activeDate) - 1\"\n+ (selectedValueChange)=\"_dateSelected($event)\">\n+ </tbody>\n+</table>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/month-view.ts",
"diff": "+import {\n+ AfterContentInit,\n+ ChangeDetectionStrategy,\n+ Component,\n+ EventEmitter,\n+ Inject,\n+ Input,\n+ Optional,\n+ Output,\n+ ViewEncapsulation\n+} from '@angular/core';\n+import {Md2CalendarCell} from './calendar-body';\n+import {DateAdapter} from '../core/datetime/index';\n+import {MD_DATE_FORMATS, MdDateFormats} from '../core/datetime/date-formats';\n+\n+\n+const DAYS_PER_WEEK = 7;\n+\n+\n+/**\n+ * An internal component used to display a single month in the datepicker.\n+ * @docs-private\n+ */\n+@Component({\n+ moduleId: module.id,\n+ selector: 'md2-month-view',\n+ templateUrl: 'month-view.html',\n+ encapsulation: ViewEncapsulation.None,\n+ changeDetection: ChangeDetectionStrategy.OnPush,\n+})\n+export class Md2MonthView<D> implements AfterContentInit {\n+ /**\n+ * The date to display in this month view (everything other than the month and year is ignored).\n+ */\n+ @Input()\n+ get activeDate(): D { return this._activeDate; }\n+ set activeDate(value: D) {\n+ let oldActiveDate = this._activeDate;\n+ this._activeDate = value || this._dateAdapter.today();\n+ if (!this._hasSameMonthAndYear(oldActiveDate, this._activeDate)) {\n+ this._init();\n+ }\n+ }\n+ private _activeDate: D;\n+\n+ /** The currently selected date. */\n+ @Input()\n+ get selected(): D { return this._selected; }\n+ set selected(value: D) {\n+ this._selected = value;\n+ this._selectedDate = this._getDateInCurrentMonth(this.selected);\n+ }\n+ private _selected: D;\n+\n+ /** A function used to filter which dates are selectable. */\n+ @Input() dateFilter: (date: D) => boolean;\n+\n+ /** Emits when a new date is selected. */\n+ @Output() selectedChange = new EventEmitter<D>();\n+\n+ /** The label for this month (e.g. \"January 2017\"). */\n+ _monthLabel: string;\n+\n+ /** Grid of calendar cells representing the dates of the month. */\n+ _weeks: Md2CalendarCell[][];\n+\n+ /** The number of blank cells in the first row before the 1st of the month. */\n+ _firstWeekOffset: number;\n+\n+ /**\n+ * The date of the month that the currently selected Date falls on.\n+ * Null if the currently selected Date is in another month.\n+ */\n+ _selectedDate: number;\n+\n+ /** The date of the month that today falls on. Null if today is in another month. */\n+ _todayDate: number;\n+\n+ /** The names of the weekdays. */\n+ _weekdays: {long: string, narrow: string}[];\n+\n+ constructor(@Optional() public _dateAdapter: DateAdapter<D>,\n+ @Optional() @Inject(MD_DATE_FORMATS) private _dateFormats: MdDateFormats) {\n+ if (!this._dateAdapter) {\n+ throw Error('DateAdapter');\n+ }\n+ if (!this._dateFormats) {\n+ throw Error('MD_DATE_FORMATS');\n+ }\n+\n+ const firstDayOfWeek = this._dateAdapter.getFirstDayOfWeek();\n+ const narrowWeekdays = this._dateAdapter.getDayOfWeekNames('narrow');\n+ const longWeekdays = this._dateAdapter.getDayOfWeekNames('long');\n+\n+ // Rotate the labels for days of the week based on the configured first day of the week.\n+ let weekdays = longWeekdays.map((long, i) => {\n+ return {long, narrow: narrowWeekdays[i]};\n+ });\n+ this._weekdays = weekdays.slice(firstDayOfWeek).concat(weekdays.slice(0, firstDayOfWeek));\n+\n+ this._activeDate = this._dateAdapter.today();\n+ }\n+\n+ ngAfterContentInit(): void {\n+ this._init();\n+ }\n+\n+ /** Handles when a new date is selected. */\n+ _dateSelected(date: number) {\n+ if (this._selectedDate == date) {\n+ return;\n+ }\n+ this.selectedChange.emit(this._dateAdapter.createDate(\n+ this._dateAdapter.getYear(this.activeDate), this._dateAdapter.getMonth(this.activeDate),\n+ date));\n+ }\n+\n+ /** Initializes this month view. */\n+ private _init() {\n+ this._selectedDate = this._getDateInCurrentMonth(this.selected);\n+ this._todayDate = this._getDateInCurrentMonth(this._dateAdapter.today());\n+ this._monthLabel =\n+ this._dateAdapter.getMonthNames('short')[this._dateAdapter.getMonth(this.activeDate)]\n+ .toLocaleUpperCase();\n+\n+ let firstOfMonth = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate),\n+ this._dateAdapter.getMonth(this.activeDate), 1);\n+ this._firstWeekOffset =\n+ (DAYS_PER_WEEK + this._dateAdapter.getDayOfWeek(firstOfMonth) -\n+ this._dateAdapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;\n+\n+ this._createWeekCells();\n+ }\n+\n+ /** Creates MdCalendarCells for the dates in this month. */\n+ private _createWeekCells() {\n+ let daysInMonth = this._dateAdapter.getNumDaysInMonth(this.activeDate);\n+ let dateNames = this._dateAdapter.getDateNames();\n+ this._weeks = [[]];\n+ for (let i = 0, cell = this._firstWeekOffset; i < daysInMonth; i++, cell++) {\n+ if (cell == DAYS_PER_WEEK) {\n+ this._weeks.push([]);\n+ cell = 0;\n+ }\n+ let date = this._dateAdapter.createDate(\n+ this._dateAdapter.getYear(this.activeDate),\n+ this._dateAdapter.getMonth(this.activeDate), i + 1);\n+ let enabled = !this.dateFilter ||\n+ this.dateFilter(date);\n+ let ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.dateA11yLabel);\n+ this._weeks[this._weeks.length - 1]\n+ .push(new Md2CalendarCell(i + 1, dateNames[i], ariaLabel, enabled));\n+ }\n+ }\n+\n+ /**\n+ * Gets the date in this month that the given Date falls on.\n+ * Returns null if the given Date is in another month.\n+ */\n+ private _getDateInCurrentMonth(date: D): number {\n+ return this._hasSameMonthAndYear(date, this.activeDate) ?\n+ this._dateAdapter.getDate(date) : null;\n+ }\n+\n+ /** Checks whether the 2 dates are non-null and fall within the same month of the same year. */\n+ private _hasSameMonthAndYear(d1: D, d2: D): boolean {\n+ return !!(d1 && d2 && this._dateAdapter.getMonth(d1) == this._dateAdapter.getMonth(d2) &&\n+ this._dateAdapter.getYear(d1) == this._dateAdapter.getYear(d2));\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/lib/datepicker/year-view.ts",
"diff": "+import {\n+ AfterContentInit,\n+ ChangeDetectionStrategy,\n+ Component,\n+ EventEmitter,\n+ Inject,\n+ Input,\n+ Optional,\n+ Output,\n+ ViewEncapsulation\n+} from '@angular/core';\n+import { Md2CalendarCell } from './calendar-body';\n+import { DateAdapter } from '../core/datetime/index';\n+import { MD_DATE_FORMATS, MdDateFormats } from '../core/datetime/date-formats';\n+\n+\n+/**\n+ * An internal component used to display a single year in the datepicker.\n+ * @docs-private\n+ */\n+@Component({\n+ moduleId: module.id,\n+ selector: 'md2-year-view',\n+ templateUrl: 'year-view.html',\n+ encapsulation: ViewEncapsulation.None,\n+ changeDetection: ChangeDetectionStrategy.OnPush,\n+})\n+export class Md2YearView<D> implements AfterContentInit {\n+ /** The date to display in this year view (everything other than the year is ignored). */\n+ @Input()\n+ get activeDate(): D { return this._activeDate; }\n+ set activeDate(value: D) {\n+ let oldActiveDate = this._activeDate;\n+ this._activeDate = value || this._dateAdapter.today();\n+ if (this._dateAdapter.getYear(oldActiveDate) != this._dateAdapter.getYear(this._activeDate)) {\n+ this._init();\n+ }\n+ }\n+ private _activeDate: D;\n+\n+ /** The currently selected date. */\n+ @Input()\n+ get selected(): D { return this._selected; }\n+ set selected(value: D) {\n+ this._selected = value;\n+ this._selectedMonth = this._getMonthInCurrentYear(this.selected);\n+ }\n+ private _selected: D;\n+\n+ /** A function used to filter which dates are selectable. */\n+ @Input() dateFilter: (date: D) => boolean;\n+\n+ /** Emits when a new month is selected. */\n+ @Output() selectedChange = new EventEmitter<D>();\n+\n+ /** Grid of calendar cells representing the months of the year. */\n+ _months: Md2CalendarCell[][];\n+\n+ /** The label for this year (e.g. \"2017\"). */\n+ _yearLabel: string;\n+\n+ /** The month in this year that today falls on. Null if today is in a different year. */\n+ _todayMonth: number;\n+\n+ /**\n+ * The month in this year that the selected Date falls on.\n+ * Null if the selected Date is in a different year.\n+ */\n+ _selectedMonth: number;\n+\n+ constructor( @Optional() public _dateAdapter: DateAdapter<D>,\n+ @Optional() @Inject(MD_DATE_FORMATS) private _dateFormats: MdDateFormats) {\n+ if (!this._dateAdapter) {\n+ throw Error('DateAdapter');\n+ }\n+ if (!this._dateFormats) {\n+ throw Error('MD_DATE_FORMATS');\n+ }\n+\n+ this._activeDate = this._dateAdapter.today();\n+ }\n+\n+ ngAfterContentInit() {\n+ this._init();\n+ }\n+\n+ /** Handles when a new month is selected. */\n+ _monthSelected(month: number) {\n+ this.selectedChange.emit(this._dateAdapter.createDate(\n+ this._dateAdapter.getYear(this.activeDate), month,\n+ this._dateAdapter.getDate(this.activeDate)));\n+ }\n+\n+ /** Initializes this month view. */\n+ private _init() {\n+ this._selectedMonth = this._getMonthInCurrentYear(this.selected);\n+ this._todayMonth = this._getMonthInCurrentYear(this._dateAdapter.today());\n+ this._yearLabel = this._dateAdapter.getYearName(this.activeDate);\n+\n+ let monthNames = this._dateAdapter.getMonthNames('short');\n+ // First row of months only contains 5 elements so we can fit the year label on the same row.\n+ this._months = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9, 10, 11]].map(row => row.map(\n+ month => this._createCellForMonth(month, monthNames[month])));\n+ }\n+\n+ /**\n+ * Gets the month in this year that the given Date falls on.\n+ * Returns null if the given Date is in another year.\n+ */\n+ private _getMonthInCurrentYear(date: D) {\n+ return date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate) ?\n+ this._dateAdapter.getMonth(date) : null;\n+ }\n+\n+ /** Creates an MdCalendarCell for the given month. */\n+ private _createCellForMonth(month: number, monthName: string) {\n+ let ariaLabel = this._dateAdapter.format(\n+ this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1),\n+ this._dateFormats.display.monthYearA11yLabel);\n+ return new Md2CalendarCell(\n+ month, monthName.toLocaleUpperCase(), ariaLabel, this._isMonthEnabled(month));\n+ }\n+\n+ /** Whether the given month is enabled. */\n+ private _isMonthEnabled(month: number) {\n+ if (!this.dateFilter) {\n+ return true;\n+ }\n+\n+ let firstOfMonth = this._dateAdapter.createDate(\n+ this._dateAdapter.getYear(this.activeDate), month, 1);\n+\n+ // If any date in the month is enabled count the month as enabled.\n+ for (let date = firstOfMonth; this._dateAdapter.getMonth(date) == month;\n+ date = this._dateAdapter.addCalendarDays(date, 1)) {\n+ if (this.dateFilter(date)) {\n+ return true;\n+ }\n+ }\n+\n+ return false;\n+ }\n+}\n"
}
] | TypeScript | MIT License | promact/md2 | chore: implemented month, year and calendar body components in datepicker |
530,388 | 06.06.2017 11:42:41 | -19,080 | 1b9db6f0224b3dc81516e3d7ba96dfe3a5220b1d | fix(datepicker) invalid time after selecting it | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -766,6 +766,7 @@ export class Md2Datepicker implements AfterContentInit, OnDestroy, ControlValueA\nif (this._clockView === 'hour') {\nthis._clockView = 'minute';\n} else {\n+ this._emitChangeEvent();\nthis._clockView = 'hour';\nthis._onBlur();\nthis.close();\n"
}
] | TypeScript | MIT License | promact/md2 | fix(datepicker) invalid time after selecting it #227 |
530,399 | 09.06.2017 15:34:47 | -10,800 | 08bbf34d7ee12fe819d8b7dfd3b21443a93de692 | Chips component always send changes event | [
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -245,7 +245,6 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\nthis.addNewChip(this.inputValue);\n}\nthis._onTouched();\n- this.addNewChip(this.inputValue);\n}\ninputFocus(event: Event): void {\n"
}
] | TypeScript | MIT License | promact/md2 | #233 Chips component always send changes event |
530,388 | 13.06.2017 13:33:03 | -19,080 | 3f13a839315b823a1d98d5dda3e82e82cc62bb98 | chore(datepicker) removed datepickerInput component | [
{
"change_type": "DELETE",
"old_path": "src/lib/datepicker/datepicker-input.ts",
"new_path": null,
"diff": "-import {\n- AfterContentInit,\n- Directive,\n- ElementRef,\n- EventEmitter,\n- forwardRef,\n- Inject,\n- Input,\n- OnDestroy,\n- Optional,\n- Renderer2\n-} from '@angular/core';\n-import { Md2Datepicker } from './datepicker';\n-import {\n- AbstractControl,\n- ControlValueAccessor,\n- NG_VALIDATORS,\n- NG_VALUE_ACCESSOR,\n- ValidationErrors,\n- Validator,\n- ValidatorFn,\n- Validators\n-} from '@angular/forms';\n-import { Subscription } from 'rxjs/Subscription';\n-import { DOWN_ARROW } from '../core/keyboard/keycodes';\n-import { DateAdapter } from '../core/datetime/index';\n-import { MD_DATE_FORMATS, MdDateFormats } from '../core/datetime/date-formats';\n-\n-\n-export const MD2_DATEPICKER_VALUE_ACCESSOR: any = {\n- provide: NG_VALUE_ACCESSOR,\n- useExisting: forwardRef(() => Md2DatepickerInput),\n- multi: true\n-};\n-\n-\n-export const MD2_DATEPICKER_VALIDATORS: any = {\n- provide: NG_VALIDATORS,\n- useExisting: forwardRef(() => Md2DatepickerInput),\n- multi: true\n-};\n-\n-\n-/** Directive used to connect an input to a MdDatepicker. */\n-@Directive({\n- selector: 'input[md2Datepicker]',\n- providers: [MD2_DATEPICKER_VALUE_ACCESSOR, MD2_DATEPICKER_VALIDATORS],\n- host: {\n- '[attr.aria-expanded]': '_datepicker?.opened || \"false\"',\n- '[attr.aria-haspopup]': 'true',\n- '[attr.aria-owns]': '_datepicker?.id',\n- '[attr.min]': 'min ? _dateAdapter.getISODateString(min) : null',\n- '[attr.max]': 'max ? _dateAdapter.getISODateString(max) : null',\n- '(input)': '_onInput($event.target.value)',\n- '(blur)': '_onTouched()',\n- '(keydown)': '_onKeydown($event)',\n- }\n-})\n-export class Md2DatepickerInput<D> implements AfterContentInit, ControlValueAccessor, OnDestroy,\n- Validator {\n- /** The datepicker that this input is associated with. */\n- @Input()\n- set md2Datepicker(value: Md2Datepicker) {\n- if (value) {\n- this._datepicker = value;\n- // this._datepicker._registerInput(this);\n- }\n- }\n- _datepicker: Md2Datepicker;\n-\n- @Input() set md2DatepickerFilter(filter: (date: D | null) => boolean) {\n- this._dateFilter = filter;\n- this._validatorOnChange();\n- }\n- _dateFilter: (date: D | null) => boolean;\n-\n- /** The value of the input. */\n- @Input()\n- get value(): D {\n- return this._dateAdapter.parse(this._elementRef.nativeElement.value,\n- this._dateFormats.parse.dateInput);\n- }\n- set value(value: D) {\n- let date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput);\n- let oldDate = this.value;\n- this._renderer.setProperty(this._elementRef.nativeElement, 'value',\n- date ? this._dateAdapter.format(date, this._dateFormats.display.dateInput) : '');\n- if (!this._dateAdapter.sameDate(oldDate, date)) {\n- this._valueChange.emit(date);\n- }\n- }\n-\n- /** The minimum valid date. */\n- @Input()\n- get min(): D { return this._min; }\n- set min(value: D) {\n- this._min = value;\n- this._validatorOnChange();\n- }\n- private _min: D;\n-\n- /** The maximum valid date. */\n- @Input()\n- get max(): D { return this._max; }\n- set max(value: D) {\n- this._max = value;\n- this._validatorOnChange();\n- }\n- private _max: D;\n-\n- /** Emits when the value changes (either due to user input or programmatic change). */\n- _valueChange = new EventEmitter<D>();\n-\n- _onTouched = () => { };\n-\n- private _cvaOnChange: (value: any) => void = () => { };\n-\n- private _validatorOnChange = () => { };\n-\n- private _datepickerSubscription: Subscription;\n-\n- /** The form control validator for the min date. */\n- private _minValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\n- return (!this.min || !control.value ||\n- this._dateAdapter.compareDate(this.min, control.value) <= 0) ?\n- null : { 'md2DatepickerMin': { 'min': this.min, 'actual': control.value } };\n- }\n-\n- /** The form control validator for the max date. */\n- private _maxValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\n- return (!this.max || !control.value ||\n- this._dateAdapter.compareDate(this.max, control.value) >= 0) ?\n- null : { 'md2DatepickerMax': { 'max': this.max, 'actual': control.value } };\n- }\n-\n- /** The form control validator for the date filter. */\n- private _filterValidator: ValidatorFn = (control: AbstractControl): ValidationErrors | null => {\n- return !this._dateFilter || !control.value || this._dateFilter(control.value) ?\n- null : { 'md2DatepickerFilter': true };\n- }\n-\n- /** The combined form control validator for this input. */\n- private _validator: ValidatorFn =\n- Validators.compose([this._minValidator, this._maxValidator, this._filterValidator]);\n-\n- constructor(\n- private _elementRef: ElementRef,\n- private _renderer: Renderer2,\n- @Optional() private _dateAdapter: DateAdapter<D>,\n- @Optional() @Inject(MD_DATE_FORMATS) private _dateFormats: MdDateFormats) {\n- if (!this._dateAdapter) {\n- throw Error('DateAdapter');\n- }\n- if (!this._dateFormats) {\n- throw Error('MD2_DATE_FORMATS');\n- }\n- }\n-\n- ngAfterContentInit() {\n- if (this._datepicker) {\n- this._datepickerSubscription =\n- this._datepicker.selectedChanged.subscribe((selected: D) => {\n- this.value = selected;\n- this._cvaOnChange(selected);\n- });\n- }\n- }\n-\n- ngOnDestroy() {\n- if (this._datepickerSubscription) {\n- this._datepickerSubscription.unsubscribe();\n- }\n- }\n-\n- registerOnValidatorChange(fn: () => void): void {\n- this._validatorOnChange = fn;\n- }\n-\n- validate(c: AbstractControl): ValidationErrors | null {\n- return this._validator ? this._validator(c) : null;\n- }\n-\n- /**\n- * Gets the element that the datepicker popup should be connected to.\n- * @return The element to connect the popup to.\n- */\n- getPopupConnectionElementRef(): ElementRef {\n- return this._elementRef;\n- }\n-\n- // Implemented as part of ControlValueAccessor\n- writeValue(value: D): void {\n- this.value = value;\n- }\n-\n- // Implemented as part of ControlValueAccessor\n- registerOnChange(fn: (value: any) => void): void {\n- this._cvaOnChange = fn;\n- }\n-\n- // Implemented as part of ControlValueAccessor\n- registerOnTouched(fn: () => void): void {\n- this._onTouched = fn;\n- }\n-\n- // Implemented as part of ControlValueAccessor\n- setDisabledState(disabled: boolean): void {\n- this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', disabled);\n- }\n-\n- _onKeydown(event: KeyboardEvent) {\n- if (event.altKey && event.keyCode === DOWN_ARROW) {\n- this._datepicker.open();\n- event.preventDefault();\n- }\n- }\n-\n- _onInput(value: string) {\n- let date = this._dateAdapter.parse(value, this._dateFormats.parse.dateInput);\n- this._cvaOnChange(date);\n- this._valueChange.emit(date);\n- }\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/index.ts",
"new_path": "src/lib/datepicker/index.ts",
"diff": "@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { StyleModule, OverlayModule, PortalModule, A11yModule } from '../core';\nimport { Md2Datepicker, Md2DatepickerContent } from './datepicker';\n-import { Md2DatepickerInput } from './datepicker-input';\nimport { Md2DatepickerToggle } from './datepicker-toggle';\nimport { Md2Calendar } from './calendar';\nimport { Md2MonthView } from './month-view';\n@@ -33,7 +32,6 @@ export * from './date-util';\nexports: [\nMd2Datepicker,\nMd2DatepickerContent,\n- Md2DatepickerInput,\nMd2DatepickerToggle,\nMd2Calendar,\nMd2CalendarBody,\n@@ -46,7 +44,6 @@ export * from './date-util';\ndeclarations: [\nMd2Datepicker,\nMd2DatepickerContent,\n- Md2DatepickerInput,\nMd2DatepickerToggle,\nMd2Calendar,\nMd2MonthView,\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) removed datepickerInput component |
530,388 | 13.06.2017 16:09:04 | -19,080 | dffc7a75e0c272d0bfc0d9892dbf9a3abcb9fa11 | chore(datepicker) fixed issue of datepicker portal | [
{
"change_type": "MODIFY",
"old_path": "src/lib/core/portal/dom-portal-host.ts",
"new_path": "src/lib/core/portal/dom-portal-host.ts",
"diff": "@@ -29,17 +29,21 @@ export class DomPortalHost extends BasePortalHost {\n*/\nattachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T> {\nlet componentFactory = this._componentFactoryResolver.resolveComponentFactory(portal.component);\n- let componentRef = componentFactory.create(portal.injector || this._defaultInjector);\n- componentRef.hostView.detectChanges();\n+ let componentRef: ComponentRef<T>;\n// If the portal specifies a ViewContainerRef, we will use that as the attachment point\n// for the component (in terms of Angular's component tree, not rendering).\n// When the ViewContainerRef is missing, we use the factory to create the component directly\n// and then manually attach the view to the application.\nif (portal.viewContainerRef) {\n- portal.viewContainerRef.insert(componentRef.hostView);\n+ componentRef = portal.viewContainerRef.createComponent(\n+ componentFactory,\n+ portal.viewContainerRef.length,\n+ portal.injector || portal.viewContainerRef.parentInjector);\n+\nthis.setDisposeFn(() => componentRef.destroy());\n} else {\n+ componentRef = componentFactory.create(portal.injector || this._defaultInjector);\nthis._appRef.attachView(componentRef.hostView);\nthis.setDisposeFn(() => {\nthis._appRef.detachView(componentRef.hostView);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -25,10 +25,8 @@ import {\nValidatorFn,\nValidators,\n} from '@angular/forms';\n-import {\n- coerceBooleanProperty,\n- Overlay\n-} from '../core';\n+import { coerceBooleanProperty } from '../core';\n+import { Overlay } from '../core/overlay/overlay';\nimport { OverlayRef } from '../core/overlay/overlay-ref';\nimport { ComponentPortal } from '../core/portal/portal';\nimport { OverlayState } from '../core/overlay/overlay-state';\n@@ -65,7 +63,7 @@ let datepickerUid = 0;\nstyleUrls: ['datepicker-content.css'],\nhost: {\n'class': 'md2-datepicker-content',\n- '[class.md2-datepicker-content-touch]': 'datepicker.touchUi',\n+ '[class.md2-datepicker-content-touch]': 'datepicker?.touchUi',\n'(keydown)': '_handleKeydown($event)',\n},\nencapsulation: ViewEncapsulation.None,\n@@ -289,7 +287,8 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\nprivate _overlay: Overlay,\nprivate _ngZone: NgZone,\nprivate _viewContainerRef: ViewContainerRef,\n- private _locale: DateLocale, private _util: DateUtil,\n+ private _locale: DateLocale,\n+ private _util: DateUtil,\n@Optional() private _dir: Dir) {\n}\n@@ -541,7 +540,7 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\ncomponentRef.instance.datepicker = this;\n}\n- this._dialogRef.backdropClick().first().subscribe(() => this.close());\n+ this._dialogRef.backdropClick().subscribe(() => this.close());\n}\n/** Open the calendar as a popup. */\n@@ -559,7 +558,7 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\nthis._ngZone.onStable.first().subscribe(() => this._popupRef.updatePosition());\n}\n- this._popupRef.backdropClick().first().subscribe(() => this.close());\n+ this._popupRef.backdropClick().subscribe(() => this.close());\n}\n/** Create the dialog. */\n@@ -579,11 +578,7 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\nconst overlayState = new OverlayState();\noverlayState.positionStrategy = this._createPopupPositionStrategy();\noverlayState.hasBackdrop = true;\n- if (this.touchUi) {\n- overlayState.backdropClass = 'cdk-overlay-dark-backdrop';\n- } else {\noverlayState.backdropClass = 'cdk-overlay-transparent-backdrop';\n- }\noverlayState.direction = this._dir ? this._dir.value : 'ltr';\noverlayState.scrollStrategy = this._overlay.scrollStrategies.reposition();\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) fixed issue of datepicker portal |
530,388 | 14.06.2017 09:25:14 | -19,080 | cc8bd6288a85123d9c4184f33460dcba75f35f45 | chore(datepicker) update design animation | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/calendar.scss",
"new_path": "src/lib/datepicker/calendar.scss",
"diff": "@@ -85,6 +85,7 @@ $md2-calendar-next-icon-transform: translateX(-2px) rotate(45deg);\npadding: 0 $md2-calendar-padding $md2-calendar-padding $md2-calendar-padding;\noutline: none;\nbox-sizing: border-box;\n+ overflow: hidden;\n[mode='landscape'] & {\npadding-top: $md2-calendar-padding;\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) update design animation |
530,388 | 14.06.2017 09:39:02 | -19,080 | ffdd055cf58d3881dd5acaec0bf9dae2b187c9f5 | docs(datepicker) updated documentation of datepicker component | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/README.md",
"new_path": "src/lib/datepicker/README.md",
"diff": "@@ -6,7 +6,7 @@ Datepicker allow the user to select date and time.\n| Name | Type | Description |\n| --- | --- | --- |\n-| `type` | `'date' | 'time' | 'datetime'` | The type of the datepicker |\n+| `type` | `'date' | 'time' | 'month' | 'datetime'` | The type of the datepicker |\n| `required` | `boolean` | Whether or not the datepicker is required |\n| `disabled` | `boolean` | Whether or not the datepicker is disabled |\n| `min` | `date` | The min date of Datepicker. |\n@@ -38,6 +38,35 @@ A datepicker would have the following markup.\n<md2-datepicker [(ngModel)]=\"date\"></md2-datepicker>\n```\n+## md2DatepickerToggle\n+\n+#### Selector: button\\[md2DatepickerToggle]\n+\n+| Name | Description |\n+| --- | --- |\n+| `md2DatepickerToggle` | Datepicker instance that the button will toggle. |\n+\n+### Examples\n+A datepicker toggle button would have the following markup.\n+```html\n+<md2-datepicker #birthday></md2-datepicker>\n+<button [md2DatepickerToggle]=\"birthday\"></button>\n+```\n+\n+## Datepicker Locale Service\n+This `DateLocale` service that allows the user to specify months, daysOfWeek, dates, hours, minutes and firstDayOfWeek internationalization. The `DateLocale` service itself is consumed by `Md2Datepicker` component that deal with dates.\n+\n+import { DateLocale } from 'md2';\n+\n+| Name | Type | Description |\n+| --- | --- | --- |\n+| `months` | `Months = { long: Array<string>, short: Array<string>, narrow: Array<string> }` | Month Object with property long, short and narrow along with Array of month names (in order). |\n+| `daysOfWeek` | `DaysOfWeek = { long: Array<string>, short: Array<string>, narrow: Array<string> }` | DaysOfWeek Object with property long, short and narrow along with Array of the days of the week (in order). |\n+| `dates` | `Array<string>` | Array of dates of the month. Only necessary for locales using a numeral system other than ['1', '2', '3', ..., '31']. |\n+| `hours` | `Array<string>` | Array of hours of the clock. Only necessary for locales using a numeral system other than ['0', '1', '2', ..., '23']. |\n+| `minutes` | `Array<string>` | Array of minutes of the clock. Only necessary for locales using a numeral system other than ['0', '1', '2', ..., '59']. |\n+| `firstDayOfWeek` | `number` | The first day of the week. Sunday = 0, Monday = 1, etc. |\n+\n### Date Format\n| COMPONENT | SYMBOL | NARROW | SHORT FORM | LONG FORM | NUMERIC | 2-DIGIT |\n@@ -61,6 +90,6 @@ A datepicker would have the following markup.\n- <kbd>END</kbd>: Focus last day of the month\n- <kbd>PAGE_UP</kbd>: Focus a month backward\n- <kbd>PAGE_DOWN</kbd>: Focus a month forward\n-- <kbd>SHIFT + PAGE_UP</kbd>: Focus a year backward\n-- <kbd>SHIFT + PAGE_DOWN</kbd>: Focus a year forward\n+- <kbd>ALT + PAGE_UP</kbd>: Focus a year backward\n+- <kbd>ALT + PAGE_DOWN</kbd>: Focus a year forward\n- <kbd>ENTER</kbd>: Select focused item\n"
}
] | TypeScript | MIT License | promact/md2 | docs(datepicker) updated documentation of datepicker component |
530,388 | 14.06.2017 09:41:10 | -19,080 | 04245195a793f44c9a1c709c117867c36f98bd3c | chore(datepicker) updated DateLocale service | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-locale.ts",
"new_path": "src/lib/datepicker/date-locale.ts",
"diff": "@@ -59,9 +59,9 @@ export class DateLocale {\nlocale: any;\nmonths: Months;\ndaysOfWeek: DaysOfWeek;\n- dates: string[];\n- hours: string[];\n- minutes: string[];\n+ dates: Array<string>;\n+ hours: Array<string>;\n+ minutes: Array<string>;\nfirstDayOfWeek: number = 0;\ngetDayOfWeek(date: Date): number {\n"
}
] | TypeScript | MIT License | promact/md2 | chore(datepicker) updated DateLocale service |
530,388 | 14.06.2017 10:01:52 | -19,080 | 8488e748430ce5f759c728dfb0c213bbb295a6a7 | chore: update rollup build demo configurations | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"stylelint\": \"gulp lint\",\n\"e2e\": \"gulp e2e\",\n\"deploy\": \"gulp deploy\",\n+ \"rollup\": \"./node_modules/.bin/rollup -c ./dist/rollup-config.js\",\n\"webdriver-manager\": \"webdriver-manager\",\n\"docs\": \"gulp docs\",\n\"api\": \"gulp api-docs\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/deploy/deploy.sh",
"new_path": "scripts/deploy/deploy.sh",
"diff": "@@ -6,7 +6,7 @@ TARGET_BRANCH=\"gh-pages\"\nCOMMIT_MSG=`git log --format=%B --no-merges -n 1`\n# Pull requests and commits to other branches shouldn't try to deploy, just build to verify\n-if [ \"$TRAVIS_PULL_REQUEST\" != \"false\" ] || [ \"$TRAVIS_BRANCH\" != \"$SOURCE_BRANCH\" ] || [[ $COMMIT_MSG != \"publish-\"* ]]; then\n+if [ \"$TRAVIS_PULL_REQUEST\" != \"false\" ] || [ \"$TRAVIS_BRANCH\" != \"$SOURCE_BRANCH\" ]; then\necho \"Building demo-app\"\ngulp build:devapp\nexit 0\n@@ -23,7 +23,7 @@ rm -rf deploy/**/* || exit 0\n# Deploy demo.\ngulp rollup:prepare\n-./node_modules/.bin/rollup -c ./dist/rollup-config.js\n+npm run rollup\ngulp deploy\n# Configure cloned repo.\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update rollup build demo configurations |
530,388 | 14.06.2017 12:42:45 | -19,080 | 65e3639cbc5dff5e532b57f5aaa86660f4c64464 | chore(colorpicker) removed circular dependency and moved module in index | [
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/color-util.ts",
"new_path": "src/lib/colorpicker/color-util.ts",
"diff": "import { Injectable } from '@angular/core';\n-import { Rgba, Hsla, Hsva } from './colorpicker';\nexport const COLOR_RGB = /(rgb)a?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*%?,\\s*(\\d{1,3})\\s*%?(?:,\\s*(\\d+(?:\\.\\d+)?)\\s*)?\\)/;\nexport const COLOR_HSL = /(hsl)a?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})%\\s*,\\s*(\\d{1,3})%\\s*(?:,\\s*(\\d+(?:\\.\\d+)?)\\s*)?\\)/;\n+export class Hsva {\n+ constructor(public h: number, public s: number, public v: number, public a: number) { }\n+}\n+export class Hsla {\n+ constructor(public h: number, public s: number, public l: number, public a: number) { }\n+}\n+export class Rgba {\n+ constructor(public r: number, public g: number, public b: number, public a: number) { }\n+}\n+\n@Injectable()\nexport class ColorUtil {\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.ts",
"new_path": "src/lib/colorpicker/colorpicker.ts",
"diff": "@@ -17,7 +17,6 @@ import {\n} from '@angular/core';\nimport {\nControlValueAccessor,\n- FormsModule,\nNgControl\n} from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n@@ -33,9 +32,16 @@ import {\nVerticalConnectionPos\n} from '../core';\nimport { Subscription } from 'rxjs/Subscription';\n-import { ColorUtil } from './color-util';\n+import { ColorUtil, Rgba, Hsla, Hsva } from './color-util';\nimport { coerceBooleanProperty } from '../core/coercion/boolean-property';\n+export class SliderPosition {\n+ constructor(public h: number, public s: number, public v: number, public a: number) { }\n+}\n+export class SliderDimension {\n+ constructor(public h: number, public s: number, public v: number, public a: number) { }\n+}\n+\nexport type Container = 'inline' | 'dialog';\nlet nextId = 0;\n@@ -620,20 +626,16 @@ export class Md2Colorpicker implements OnDestroy, ControlValueAccessor {\nreturn this._overlay.position()\n.connectedTo(this._element,\n{ originX: 'start', originY: 'top' },\n- { overlayX: 'start', overlayY: 'top' }\n- )\n+ { overlayX: 'start', overlayY: 'top' })\n.withFallbackPosition(\n{ originX: 'end', originY: 'top' },\n- { overlayX: 'end', overlayY: 'top' }\n- )\n+ { overlayX: 'end', overlayY: 'top' })\n.withFallbackPosition(\n{ originX: 'start', originY: 'bottom' },\n- { overlayX: 'start', overlayY: 'bottom' }\n- )\n+ { overlayX: 'start', overlayY: 'bottom' })\n.withFallbackPosition(\n{ originX: 'end', originY: 'bottom' },\n- { overlayX: 'end', overlayY: 'bottom' }\n- );\n+ { overlayX: 'end', overlayY: 'bottom' });\n}\nprivate _cleanUpSubscriptions(): void {\n@@ -646,31 +648,3 @@ export class Md2Colorpicker implements OnDestroy, ControlValueAccessor {\n}\n}\n-\n-export class Hsva {\n- constructor(public h: number, public s: number, public v: number, public a: number) { }\n-}\n-export class Hsla {\n- constructor(public h: number, public s: number, public l: number, public a: number) { }\n-}\n-export class Rgba {\n- constructor(public r: number, public g: number, public b: number, public a: number) { }\n-}\n-export class SliderPosition {\n- constructor(public h: number, public s: number, public v: number, public a: number) { }\n-}\n-export class SliderDimension {\n- constructor(public h: number, public s: number, public v: number, public a: number) { }\n-}\n-\n-export const MD2_COLORPICKER_DIRECTIVES = [\n- Md2Colorpicker, ColorpickerSliderDirective, TextDirective\n-];\n-\n-@NgModule({\n- declarations: MD2_COLORPICKER_DIRECTIVES,\n- imports: [CommonModule, FormsModule, OverlayModule, PortalModule],\n- exports: MD2_COLORPICKER_DIRECTIVES,\n- providers: [ColorUtil]\n-})\n-export class Md2ColorpickerModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/index.ts",
"new_path": "src/lib/colorpicker/index.ts",
"diff": "+import { NgModule } from '@angular/core';\n+import { CommonModule } from '@angular/common';\n+import { FormsModule } from '@angular/forms';\n+import { StyleModule, OverlayModule, PortalModule, A11yModule } from '../core';\n+import { Md2Colorpicker, ColorpickerSliderDirective, TextDirective } from './colorpicker';\n+import { ColorUtil } from './color-util';\n+\n+\nexport * from './colorpicker';\n+export * from './color-util';\n+\n+\n+@NgModule({\n+ imports: [\n+ CommonModule,\n+ FormsModule,\n+ OverlayModule,\n+ PortalModule,\n+ StyleModule,\n+ A11yModule,\n+ ],\n+ exports: [\n+ Md2Colorpicker,\n+ ColorpickerSliderDirective,\n+ TextDirective\n+ ],\n+ declarations: [\n+ Md2Colorpicker,\n+ ColorpickerSliderDirective,\n+ TextDirective\n+ ],\n+ providers: [ColorUtil],\n+ entryComponents: [\n+ Md2Colorpicker,\n+ ]\n+})\n+export class Md2ColorpickerModule { }\n"
}
] | TypeScript | MIT License | promact/md2 | chore(colorpicker) removed circular dependency and moved module in index |
530,388 | 14.06.2017 12:44:15 | -19,080 | 1c4f48b20c50b60e30bd8252fd7e44650f9c6860 | chore: update style lints | [
{
"change_type": "MODIFY",
"old_path": "stylelint-config.json",
"new_path": "stylelint-config.json",
"diff": "\"./tools/stylelint/selector-nested-pattern-scoped/index.js\"\n],\n\"rules\": {\n- \"material/no-prefixes\": [[\"last 2 versions\", \"not ie <= 10\", \"not ie_mob <= 10\"]],\n- \"material/selector-nested-pattern-scoped\": [\".*[^&]$\", {\n+ \"md2/no-prefixes\": [[\"last 2 versions\", \"not ie <= 10\", \"not ie_mob <= 10\"]],\n+ \"md2/selector-nested-pattern-scoped\": [\".*[^&]$\", {\n\"message\": \"The & operator is not allowed at the end of theme selectors.\",\n\"filePattern\": \"-theme\\\\.scss$\"\n}],\n"
},
{
"change_type": "MODIFY",
"old_path": "tools/stylelint/selector-nested-pattern-scoped/index.js",
"new_path": "tools/stylelint/selector-nested-pattern-scoped/index.js",
"diff": "@@ -3,7 +3,7 @@ const path = require('path');\nconst isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule');\nconst isStandardSyntaxSelector = require('stylelint/lib/utils/isStandardSyntaxSelector');\n-const ruleName = 'material/selector-nested-pattern-scoped';\n+const ruleName = 'md2/selector-nested-pattern-scoped';\nconst messages = stylelint.utils.ruleMessages(ruleName, {\nexpected: selector => `Expected nested selector '${selector}' to match specified pattern`,\n});\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update style lints |
530,388 | 14.06.2017 14:24:03 | -19,080 | 766671c94e5eace2ccca7f7b070b39fda769af47 | chore: update ci build process | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -8,6 +8,15 @@ branches:\nonly:\n- master\n+jobs:\n+ include:\n+ - env: \"MODE=lint\"\n+ - env: \"MODE=aot\"\n+ - env: \"MODE=payload\"\n+ - stage: Deploy\n+ script: ./scripts/ci/publish-artifacts.sh\n+ env: \"MODE=release\"\n+\nenv:\nglobal:\n- LOGS_DIR=/tmp/md2-build/logs\n@@ -22,7 +31,7 @@ before_script:\n- mkdir -p $LOGS_DIR\nscript:\n- - ./scripts/deploy/deploy.sh\n+ - ./scripts/ci/build-and-test.sh\nbefore_deploy:\n- gulp build:release\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/build-and-test.sh",
"new_path": "scripts/ci/build-and-test.sh",
"diff": "-#!/usr/bin/env bash\n-set -ex\n+#!/bin/bash\n-echo \"======= Starting build-and-test.sh ========================================\"\n+set -e\n+\n+echo \"\"\n+echo \"Building sources and running tests. Running mode: ${MODE}\"\n+echo \"\"\n# Go to project dir\ncd $(dirname $0)/../..\n# Include sources.\nsource scripts/ci/sources/mode.sh\n-source scripts/ci/sources/tunnel.sh\n+\n+# Get commit diff\n+if [ \"$TRAVIS_PULL_REQUEST\" = \"false\" ]; then\n+ fileDiff=$(git diff --name-only $TRAVIS_COMMIT_RANGE)\n+else\n+ fileDiff=$(git diff --name-only $TRAVIS_BRANCH...HEAD)\n+fi\n+\n+# Check if tests can be skipped\n+if [[ ${fileDiff} =~ ^(.*\\.md\\s*)*$ ]]); then\n+ echo \"Skipping tests since only markdown files changed\"\n+ exit 0\n+fi\nstart_tunnel\nwait_for_tunnel\nif is_lint; then\n$(npm bin)/gulp ci:lint\n-elif is_e2e; then\n- $(npm bin)/gulp ci:e2e\nelif is_aot; then\n$(npm bin)/gulp ci:aot\nelif is_payload; then\n$(npm bin)/gulp ci:payload\n-else\n- $(npm bin)/gulp ci:test\n-fi\n-\n-# Upload coverage results if those are present.\n-if [ -f dist/coverage/coverage-summary.json ]; then\n- $(npm bin)/gulp ci:coverage\nfi\nteardown_tunnel\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "scripts/ci/publish-artifacts.sh",
"diff": "+#!/bin/bash\n+\n+# Script that runs after the testing stage of Travis passed.\n+# Build artifacts and docs content will be published to different repositories.\n+\n+# Go to the project root directory\n+cd $(dirname $0)/../..\n+\n+if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]]; then\n+ echo \"Build artifacts and docs content will only be deployed in Travis push builds.\"\n+ exit 0;\n+fi\n+\n+echo \"Starting to publish the build artifacts and docs content...\"\n+echo \"\"\n+\n+# Build Md2 before publishing\n+$(npm bin)/gulp build:release\n+\n+# Run publishing of artifacts in parallel.\n+# This is possible because the output has been built before.\n+\n+# Deploy the dashboard functions for each push build.\n+\n+wait\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/sources/mode.sh",
"new_path": "scripts/ci/sources/mode.sh",
"diff": "#!/usr/bin/env bash\n-source ./scripts/ci/sources/tunnel.sh\n-\n-is_e2e() {\n- [[ \"$MODE\" = e2e ]]\n-}\nis_lint() {\n[[ \"$MODE\" = lint ]]\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update ci build process |
530,388 | 14.06.2017 15:15:39 | -19,080 | 64baed5d1dfd30bbed4f75c7ee723e36750f336e | chore: update build script and process | [
{
"change_type": "MODIFY",
"old_path": "scripts/browserstack/start-tunnel.sh",
"new_path": "scripts/browserstack/start-tunnel.sh",
"diff": "@@ -4,52 +4,49 @@ set -e -o pipefail\n# Workaround for Travis CI cookbook https://github.com/travis-ci/travis-ci/issues/4862,\n# where $PATH will be extended with relative paths to the NPM binaries.\n-PATH=`echo $PATH | sed -e 's/:\\.\\/node_modules\\/\\.bin//'`\n+PATH=`echo ${PATH} | sed -e 's/:\\.\\/node_modules\\/\\.bin//'`\nTUNNEL_FILE=\"BrowserStackLocal-linux-x64.zip\"\n-TUNNEL_URL=\"https://www.browserstack.com/browserstack-local/$TUNNEL_FILE\"\n+TUNNEL_URL=\"https://www.browserstack.com/browserstack-local/${TUNNEL_FILE}\"\nTUNNEL_DIR=\"/tmp/browserstack-tunnel\"\n-TUNNEL_LOG=\"$LOGS_DIR/browserstack-tunnel.log\"\n+TUNNEL_LOG=\"${LOGS_DIR}/browserstack-tunnel.log\"\n-BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`\n+BROWSER_STACK_ACCESS_KEY=`echo ${BROWSER_STACK_ACCESS_KEY} | rev`\n# Cleanup and create the folder structure for the tunnel connector.\n-rm -rf $TUNNEL_DIR $BROWSER_PROVIDER_READY_FILE\n-mkdir -p $TUNNEL_DIR\n-touch $TUNNEL_LOG\n+rm -rf ${TUNNEL_DIR} ${BROWSER_PROVIDER_READY_FILE}\n+mkdir -p ${TUNNEL_DIR}\n+touch ${TUNNEL_LOG}\n-cd $TUNNEL_DIR\n+cd ${TUNNEL_DIR}\n# Download the browserstack local binaries.\n-curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null\n+curl ${TUNNEL_URL} -o ${TUNNEL_FILE} 2> /dev/null 1> /dev/null\n# Extract the browserstack local binaries from the tarball.\nmkdir -p browserstack-tunnel\n-unzip -q $TUNNEL_FILE -d browserstack-tunnel\n+unzip -q ${TUNNEL_FILE} -d browserstack-tunnel\n# Cleanup the download directory.\n-rm $TUNNEL_FILE\n+rm ${TUNNEL_FILE}\nARGS=\"\"\n# Set tunnel-id only on Travis, to make local testing easier.\n-if [ ! -z \"$TRAVIS_JOB_ID\" ]; then\n- ARGS=\"$ARGS --local-identifier $TRAVIS_JOB_ID\"\n+if [ ! -z \"${TRAVIS_JOB_ID}\" ]; then\n+ ARGS=\"${ARGS} --local-identifier ${TRAVIS_JOB_ID}\"\nfi\n-echo \"Starting Browserstack Local in the background, logging into:\"\n-echo \" $TUNNEL_LOG\"\n-echo \" ---\"\n-echo \" $ARGS\"\n+echo \"Starting Browserstack Local in the background, logging into: ${TUNNEL_LOG}\"\n# Extension to the BrowserStackLocal binaries, because those can't create a readyfile.\nfunction create_ready_file {\n# To be able to exit the tail properly we need to have a sub shell spawned, which is\n# used to track the state of tail.\n- { sleep 120; touch $BROWSER_PROVIDER_ERROR_FILE; } &\n+ { sleep 120; touch ${BROWSER_PROVIDER_ERROR_FILE}; } &\n- TIMER_PID=$!\n+ TIMER_PID=${!}\n# Disown the background process, because we don't want to show any messages when killing\n# the timer.\n@@ -57,16 +54,16 @@ function create_ready_file {\n# When the tail recognizes the `Ctrl-C` log message the BrowserStack Tunnel is up.\n{\n- tail -n0 -f $TUNNEL_LOG --pid $TIMER_PID | { sed '/Ctrl/q' && kill -9 $TIMER_PID; };\n+ tail -n0 -f ${TUNNEL_LOG} --pid ${TIMER_PID} | { sed '/Ctrl/q' && kill -9 ${TIMER_PID}; };\n} &> /dev/null\necho\necho \"BrowserStack Tunnel ready\"\n- touch $BROWSER_PROVIDER_READY_FILE\n+ touch ${BROWSER_PROVIDER_READY_FILE}\n}\n-browserstack-tunnel/BrowserStackLocal -k $BROWSER_STACK_ACCESS_KEY $ARGS &>> $TUNNEL_LOG &\n+browserstack-tunnel/BrowserStackLocal -k ${BROWSER_STACK_ACCESS_KEY} ${ARGS} 2>&1 >> ${TUNNEL_LOG} &\n# Wait for the tunnel to be ready and create the readyfile with the Browserstack PID\ncreate_ready_file &\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/browserstack/wait-tunnel.sh",
"new_path": "scripts/browserstack/wait-tunnel.sh",
"diff": "@@ -26,3 +26,6 @@ while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do\nprintf \".\"\nsleep .5\ndone\n+\n+echo \"\"\n+echo \"Connected to Browserstack\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/ci/after-success.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-# Script which always runs when the current Travis mode succeeds.\n-# Used to run the travis-after-modes script, which checks if all other modes finished.\n-\n-# Go to the project root directory\n-cd $(dirname $0)/../..\n-\n-# If not running as a PR, wait for all other travis modes to finish.\n-if [ \"$TRAVIS_PULL_REQUEST\" = \"false\" ] && $(npm bin)/travis-after-modes; then\n- echo \"All travis modes passed. Publishing the build artifacts...\"\n- ./scripts/release/publish-build-artifacts.sh\n- ./scripts/release/publish-docs-content.sh\n-fi\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/build-and-test.sh",
"new_path": "scripts/ci/build-and-test.sh",
"diff": "@@ -11,6 +11,7 @@ cd $(dirname $0)/../..\n# Include sources.\nsource scripts/ci/sources/mode.sh\n+source scripts/ci/sources/tunnel.sh\n# Get commit diff\nif [ \"$TRAVIS_PULL_REQUEST\" = \"false\" ]; then\n@@ -20,7 +21,7 @@ else\nfi\n# Check if tests can be skipped\n-if [[ ${fileDiff} =~ ^(.*\\.md\\s*)*$ ]]); then\n+if [[ ${fileDiff} =~ ^(.*\\.md\\s*)*$ ]] && (is_e2e || is_unit); then\necho \"Skipping tests since only markdown files changed\"\nexit 0\nfi\n@@ -34,6 +35,8 @@ elif is_aot; then\n$(npm bin)/gulp ci:aot\nelif is_payload; then\n$(npm bin)/gulp ci:payload\n+elif is_closure_compiler; then\n+ ./scripts/closure-compiler/build-devapp-bundle.sh\nfi\nteardown_tunnel\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/sources/mode.sh",
"new_path": "scripts/ci/sources/mode.sh",
"diff": "#!/usr/bin/env bash\n+source ./scripts/ci/sources/tunnel.sh\nis_lint() {\n[[ \"$MODE\" = lint ]]\n@@ -8,6 +9,10 @@ is_aot() {\n[[ \"$MODE\" = aot ]]\n}\n+is_closure_compiler() {\n+ [[ \"$MODE\" = closure-compiler ]]\n+}\n+\nis_payload() {\n[[ \"$MODE\" = payload ]]\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "scripts/closure-compiler/tsconfig-rxjs.json",
"diff": "+{\n+ \"compilerOptions\": {\n+ \"module\": \"es2015\",\n+ \"outDir\": \"../../dist/packages/rxjs\",\n+ \"target\": \"es5\",\n+ \"lib\": [\"es2015\", \"dom\"],\n+ \"types\": []\n+ },\n+ \"files\": [\n+ \"../../node_modules/rxjs/src/Rx.ts\"\n+ ],\n+ \"angularCompilerOptions\": {\n+ \"annotateForClosureCompiler\": true,\n+ \"skipMetadataEmit\": true,\n+ \"skipTemplateCodegen\": true\n+ }\n+}\n"
},
{
"change_type": "RENAME",
"old_path": "scripts/release/publish-build-artifacts.sh",
"new_path": "scripts/deploy/publish-build-artifacts.sh",
"diff": "set -e -o pipefail\n# Go to the project root directory\n-cd $(dirname $0)/../..\n+cd $(dirname ${0})/../..\nbuildDir=\"dist/md2\"\nbuildVersion=$(sed -nE 's/^\\s*\"version\": \"(.*?)\",$/\\1/p' package.json)\n-\ncommitSha=$(git rev-parse --short HEAD)\ncommitAuthorName=$(git --no-pager show -s --format='%an' HEAD)\ncommitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)\ncommitMessage=$(git log --oneline -n 1)\n-repoName=\"md2-builds\"\n-repoUrl=\"https://github.com/Promact/md2-builds.git\"\n+repoName=\"md2\"\n+repoUrl=\"https://github.com/Promact/md2.git\"\nrepoDir=\"tmp/$repoName\"\n# Create a release of the current repository.\n@@ -28,25 +27,28 @@ rm -rf $repoDir\nmkdir -p $repoDir\n# Clone the repository\n-git clone $repoUrl $repoDir\n+git clone $repoUrl $repoDir --depth 1 --branch=build\n# Copy the build files to the repository\nrm -rf $repoDir/*\ncp -r $buildDir/* $repoDir\n# Create the build commit and push the changes to the repository.\n-cd $repoDir\n+cd ${repoDir}\n+\n+# Update the package.json version to include the current commit SHA.\n+ sed -i \"s/${buildVersion}/${buildVersion}-${commitSha}/g\" package.json\n# Prepare Git for pushing the artifacts to the repository.\n-git config user.name \"$commitAuthorName\"\n-git config user.email \"$commitAuthorEmail\"\n+git config user.name \"${commitAuthorName}\"\n+ git config user.email \"${commitAuthorEmail}\"\ngit config credential.helper \"store --file=.git/credentials\"\n-echo \"https://${MATERIAL2_DOCS_CONTENT_TOKEN}:@github.com\" > .git/credentials\n+echo \"https://${$GH_TOKEN}:@github.com\" > .git/credentials\ngit add -A\ngit commit -m \"$commitMessage\"\ngit tag \"$buildVersion-$commitSha\"\ngit push origin master --tags\n-echo \"Finished publishing build artifacts\"\n+echo \"Published artifacts for Md2 package.\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/release/copy-docs.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-# Copy docs to material docs site\n-\n-# Run this script after `gulp docs`\n-# Need to specify destination folder\n-# Use OVERVIEW.html when possible. If there's no OVERVIEW file exists, use README.html\n-\n-usage='Usage: copy-docs.sh $destinationFolder'\n-if [ $# -ne 1 ]; then\n- echo \"Missing destination folder. $usage\"\n- exit\n-fi\n-\n-originFolder=./dist/docs/\n-destFolder=$1\n-\n-if [ ! -w $destFolder ]; then\n- echo \"Invalid destination folder. $usage\"\n- exit\n-fi\n-\n-for file in $originFolder*\n-do\n- name=${file#$originFolder}\n- overviewFile=$originFolder$name/$name.html\n- readmeFile=$originFolder$name/README.html\n- destFile=$destFolder/$name.html\n- if [ -f $overviewFile ]; then\n- cp $overviewFile $destFile\n- echo \"Copied $overviewFile to $destFile\"\n- elif [ -f $readmeFile ]; then\n- cp $readmeFile $destFile\n- echo \"Copied $readmeFile to $destFile\"\n- fi\n-done\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/release/enact-release.sh",
"new_path": null,
"diff": "-#!/usr/bin/env bash\n-\n-# Run this script after running `stage-release.sh` to publish the packages staged to deploy/\n-# Optionally uses the first argument as the tag for the release (such as \"next\").\n-# This script should be run from the root of the md2 repo.\n-\n-\n-# `npm whoami` errors and dies if you're not logged in,\n-# so we redirect the stderr output to /dev/null since we don't care.\n-NPM_USER=$(npm whoami 2> /dev/null)\n-\n-if [ \"${NPM_USER}\" != \"md2\" ]; then\n- echo \"You must be logged in as 'md2' to publish. Use 'npm login'.\"\n- exit\n-fi\n-\n-NPM_TAG=\"latest\"\n-if [ \"$1\" ] ; then\n- NPM_TAG=${1}\n-fi\n-\n-set -ex\n-\n-for package in ./deploy/* ; do\n- npm publish --access public ${package} --tag ${NPM_TAG}\n-done\n-\n-# Always log out of npm when publish is complete.\n-npm logout\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/release/publish-docs-content.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-# Publish md2 docs assets to the md2-docs-content repo\n-# code.promactinfo.com/md2 will pull from this assets repo to get the latest docs\n-\n-cd \"$(dirname $0)/../../\"\n-\n-docsPath=\"./dist/docs\"\n-repoPath=\"/tmp/md2-docs-content\"\n-repoUrl=\"https://github.com/Promact/md2-docs-content\"\n-examplesSource=\"./dist/docs/examples\"\n-\n-# If the docs directory is not present, generate docs\n-if [ ! -d $docsPath ]; then\n- $(npm bin)/gulp docs\n-fi\n-\n-# Get git meta info for commit\n-commitSha=\"$(git rev-parse --short HEAD)\"\n-commitAuthorName=\"$(git --no-pager show -s --format='%an' HEAD)\"\n-commitAuthorEmail=\"$(git --no-pager show -s --format='%ae' HEAD)\"\n-commitMessage=\"$(git log --oneline -n 1)\"\n-\n-# create directory and clone test repo\n-rm -rf $repoPath\n-mkdir -p $repoPath\n-git clone $repoUrl $repoPath\n-\n-# Clean out repo directory and copy contents of dist/docs into it\n-rm -rf $repoPath/*\n-mkdir $repoPath/overview\n-mkdir $repoPath/guides\n-mkdir $repoPath/api\n-mkdir $repoPath/examples\n-\n-# Move api files over to $repoPath/api\n-cp -r $docsPath/api/* $repoPath/api\n-\n-# Flatten the markdown docs structure and move it into $repoPath/overview\n-overviewFiles=$docsPath/markdown/\n-for filename in $overviewFiles*\n-do\n- if [ -d $filename ]; then\n- for _ in $filename/*\n- do\n- markdownFile=${filename#$overviewFiles}.html\n- # Filename should be same as folder name with .html extension\n- if [ -e $filename/$markdownFile ]; then\n- cp -r $filename/$markdownFile $repoPath/overview/\n- fi\n- done\n- fi\n-done\n-\n-# Move guide files over to $repoPath/guides\n-for filename in $overviewFiles*\n-do\n- if [ -f $filename ]; then\n- cp -r $filename $repoPath/guides\n- fi\n-done\n-\n-# Move highlighted examples into $repoPath\n-cp -r $examplesSource/* $repoPath/examples\n-\n-# Copies assets over to the docs-content repository.\n-cp LICENSE $repoPath/\n-\n-# Push content to repo\n-cd $repoPath\n-git config user.name \"$commitAuthorName\"\n-git config user.email \"$commitAuthorEmail\"\n-git config credential.helper \"store --file=.git/credentials\"\n-\n-echo \"https://${MATERIAL2_BUILDS_TOKEN}:@github.com\" > .git/credentials\n-\n-git add -A\n-git commit -m \"$commitMessage\"\n-git tag \"$commitSha\"\n-git push origin master --tags\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/saucelabs/start-tunnel.sh",
"new_path": "scripts/saucelabs/start-tunnel.sh",
"diff": "set -e -o pipefail\n-TUNNEL_FILE=\"sc-4.4.5-linux.tar.gz\"\n-TUNNEL_URL=\"https://saucelabs.com/downloads/$TUNNEL_FILE\"\n+TUNNEL_FILE=\"sc-4.4.6-linux.tar.gz\"\n+TUNNEL_URL=\"https://saucelabs.com/downloads/${TUNNEL_FILE}\"\nTUNNEL_DIR=\"/tmp/saucelabs-connect\"\n-TUNNEL_LOG=\"$LOGS_DIR/sauce-connect\"\n+TUNNEL_LOG=\"${LOGS_DIR}/sauce-connect\"\n-SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`\n+SAUCE_ACCESS_KEY=`echo ${SAUCE_ACCESS_KEY} | rev`\n# Cleanup and create the folder structure for the tunnel connector.\n-rm -rf $TUNNEL_DIR $BROWSER_PROVIDER_READY_FILE\n-mkdir -p $TUNNEL_DIR\n+rm -rf ${TUNNEL_DIR} ${BROWSER_PROVIDER_READY_FILE}\n+mkdir -p ${TUNNEL_DIR}\n-cd $TUNNEL_DIR\n+cd ${TUNNEL_DIR}\n# Download the saucelabs connect binaries.\n-curl $TUNNEL_URL -o $TUNNEL_FILE 2> /dev/null 1> /dev/null\n+curl ${TUNNEL_URL} -o ${TUNNEL_FILE} 2> /dev/null 1> /dev/null\n# Extract the saucelabs connect binaries from the tarball.\nmkdir -p sauce-connect\n-tar --extract --file=$TUNNEL_FILE --strip-components=1 --directory=sauce-connect > /dev/null\n+tar --extract --file=${TUNNEL_FILE} --strip-components=1 --directory=sauce-connect > /dev/null\n# Cleanup the download directory.\n-rm $TUNNEL_FILE\n+rm ${TUNNEL_FILE}\nARGS=\"\"\n# Set tunnel-id only on Travis, to make local testing easier.\n-if [ ! -z \"$TRAVIS_JOB_ID\" ]; then\n- ARGS=\"$ARGS --tunnel-identifier $TRAVIS_JOB_ID\"\n+if [ ! -z \"${TRAVIS_JOB_ID}\" ]; then\n+ ARGS=\"${ARGS} --tunnel-identifier ${TRAVIS_JOB_ID}\"\nfi\n-if [ ! -z \"$BROWSER_PROVIDER_READY_FILE\" ]; then\n- ARGS=\"$ARGS --readyfile $BROWSER_PROVIDER_READY_FILE\"\n+if [ ! -z \"${BROWSER_PROVIDER_READY_FILE}\" ]; then\n+ ARGS=\"${ARGS} --readyfile ${BROWSER_PROVIDER_READY_FILE}\"\nfi\n-echo \"Starting Sauce Connect in the background, logging into:\"\n-echo \" $TUNNEL_LOG\"\n-echo \" ---\"\n-echo \" $ARGS\"\n+echo \"Starting Sauce Connect in the background, logging into: ${TUNNEL_LOG}\"\n-sauce-connect/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY $ARGS --logfile $TUNNEL_LOG &\n+sauce-connect/bin/sc -u ${SAUCE_USERNAME} -k ${SAUCE_ACCESS_KEY} ${ARGS} 2>&1 >> ${TUNNEL_LOG} &\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/saucelabs/wait-tunnel.sh",
"new_path": "scripts/saucelabs/wait-tunnel.sh",
"diff": "#!/bin/bash\n-# Wait for Connect to be ready before exiting\n-echo \"Connecting to Sauce Labs\"\n-\n-\n# Wait for Saucelabs Connect to be ready before exiting\n# Time out if we wait for more than 2 minutes, so the process won't run forever.\nlet \"counter=0\"\n@@ -12,7 +8,7 @@ while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do\nlet \"counter++\"\nif [ $counter -gt 240 ]; then\n- echo\n+ echo \"\"\necho \"Timed out after 2 minutes waiting for tunnel ready file\"\nexit 5\nfi\n@@ -21,5 +17,5 @@ while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do\nsleep .5\ndone\n-echo\n-echo \"Connected\"\n+echo \"\"\n+echo \"Connected to Saucelabs\"\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update build script and process |
530,388 | 14.06.2017 15:46:30 | -19,080 | 24cce033390f2b8489052af468f877e26819d798 | chore: update package dependency | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"conventional-changelog\": \"^1.1.3\",\n\"conventional-github-releaser\": \"^1.1.3\",\n\"dgeni\": \"^0.4.7\",\n- \"dgeni-packages\": \"^0.19.0\",\n+ \"dgeni-packages\": \"^0.19.1\",\n\"firebase-admin\": \"^5.0.0\",\n\"firebase-tools\": \"^3.9.0\",\n\"fs-extra\": \"^3.0.1\",\n\"rollup-plugin-uglify\": \"^2.0.1\",\n\"run-sequence\": \"^1.2.2\",\n\"sass\": \"^0.5.0\",\n- \"scss-bundle\": \"^1.0.1\",\n+ \"scss-bundle\": \"^2.0.1-beta.7\",\n\"selenium-webdriver\": \"^3.4.0\",\n\"stylelint\": \"^7.10.1\",\n\"travis-after-modes\": \"0.0.7\",\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update package dependency |
530,388 | 15.06.2017 13:25:04 | -19,080 | c4a12a5cc31a826041d2d14338ba9daa04c98ba5 | chore: removed data-table component from core | [
{
"change_type": "DELETE",
"old_path": "src/lib/core/data-table/cell.ts",
"new_path": null,
"diff": "-import {ContentChild, Directive, ElementRef, Input, Renderer2, TemplateRef} from '@angular/core';\n-\n-/**\n- * Cell definition for a CDK data-table.\n- * Captures the template of a column's data row cell as well as cell-specific properties.\n- */\n-@Directive({selector: '[cdkCellDef]'})\n-export class CdkCellDef {\n- constructor(public template: TemplateRef<any>) { }\n-}\n-\n-/**\n- * Header cell definition for a CDK data-table.\n- * Captures the template of a column's header cell and as well as cell-specific properties.\n- */\n-@Directive({selector: '[cdkHeaderCellDef]'})\n-export class CdkHeaderCellDef {\n- constructor(public template: TemplateRef<any>) { }\n-}\n-\n-/**\n- * Column definition for the CDK data-table.\n- * Defines a set of cells available for a table column.\n- */\n-@Directive({selector: '[cdkColumnDef]'})\n-export class CdkColumnDef {\n- @Input('cdkColumnDef') name: string;\n-\n- @ContentChild(CdkCellDef) cell: CdkCellDef;\n- @ContentChild(CdkHeaderCellDef) headerCell: CdkHeaderCellDef;\n-}\n-\n-/** Header cell template container that adds the right classes and role. */\n-@Directive({\n- selector: 'cdk-header-cell',\n- host: {\n- 'class': 'cdk-header-cell',\n- 'role': 'columnheader',\n- },\n-})\n-export class CdkHeaderCell {\n- constructor(private columnDef: CdkColumnDef,\n- private elementRef: ElementRef,\n- private renderer: Renderer2) {\n- this.renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);\n- }\n-}\n-\n-/** Cell template container that adds the right classes and role. */\n-@Directive({\n- selector: 'cdk-cell',\n- host: {\n- 'class': 'cdk-cell',\n- 'role': 'gridcell',\n- },\n-})\n-export class CdkCell {\n- constructor(private columnDef: CdkColumnDef,\n- private elementRef: ElementRef,\n- private renderer: Renderer2) {\n- this.renderer.addClass(elementRef.nativeElement, `cdk-column-${columnDef.name}`);\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/core/data-table/data-source.ts",
"new_path": null,
"diff": "-import {Observable} from 'rxjs/Observable';\n-\n-export interface CollectionViewer {\n- viewChange: Observable<{start: number, end: number}>;\n-}\n-\n-export abstract class DataSource<T> {\n- abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/core/data-table/data-table.ts",
"new_path": null,
"diff": "-import {\n- Attribute,\n- ChangeDetectionStrategy,\n- ChangeDetectorRef,\n- Component,\n- ContentChild,\n- ContentChildren,\n- Directive,\n- ElementRef,\n- Input,\n- IterableChangeRecord,\n- IterableDiffer,\n- IterableDiffers,\n- NgIterable,\n- QueryList,\n- Renderer2,\n- ViewChild,\n- ViewContainerRef,\n- ViewEncapsulation\n-} from '@angular/core';\n-import {CollectionViewer, DataSource} from './data-source';\n-import {BaseRowDef, CdkCellOutlet, CdkHeaderRowDef, CdkRowDef} from './row';\n-import {CdkCellDef, CdkColumnDef, CdkHeaderCellDef} from './cell';\n-import {Observable} from 'rxjs/Observable';\n-import {BehaviorSubject} from 'rxjs/BehaviorSubject';\n-import 'rxjs/add/operator/let';\n-import 'rxjs/add/operator/debounceTime';\n-import 'rxjs/add/observable/combineLatest';\n-\n-/**\n- * Provides a handle for the table to grab the view container's ng-container to insert data rows.\n- * @docs-private\n- */\n-@Directive({selector: '[rowPlaceholder]'})\n-export class RowPlaceholder {\n- constructor(public viewContainer: ViewContainerRef) { }\n-}\n-\n-/**\n- * Provides a handle for the table to grab the view container's ng-container to insert the header.\n- * @docs-private\n- */\n-@Directive({selector: '[headerRowPlaceholder]'})\n-export class HeaderRowPlaceholder {\n- constructor(public viewContainer: ViewContainerRef) { }\n-}\n-\n-/**\n- * A data table that connects with a data source to retrieve data of type T and renders\n- * a header row and data rows. Updates the rows when new data is provided by the data source.\n- */\n-@Component({\n- selector: 'cdk-table',\n- template: `\n- <ng-container headerRowPlaceholder></ng-container>\n- <ng-container rowPlaceholder></ng-container>\n- `,\n- host: {\n- 'class': 'cdk-table',\n- },\n- encapsulation: ViewEncapsulation.None,\n- changeDetection: ChangeDetectionStrategy.OnPush,\n-})\n-export class CdkTable<T> implements CollectionViewer {\n- /**\n- * Provides a stream containing the latest data array to render. Influenced by the table's\n- * stream of view window (what rows are currently on screen).\n- */\n- @Input() dataSource: DataSource<T>;\n-\n- // TODO(andrewseguin): Remove max value as the end index\n- // and instead calculate the view on init and scroll.\n- /**\n- * Stream containing the latest information on what rows are being displayed on screen.\n- * Can be used by the data source to as a heuristic of what data should be provided.\n- */\n- viewChange =\n- new BehaviorSubject<{start: number, end: number}>({start: 0, end: Number.MAX_VALUE});\n-\n- /** Stream that emits when a row def has a change to its array of columns to render. */\n- _columnsChange = new Observable<void>();\n-\n- /**\n- * Map of all the user's defined columns identified by name.\n- * Contains the header and data-cell templates.\n- */\n- private _columnDefinitionsByName = new Map<string, CdkColumnDef>();\n-\n- /** Differ used to find the changes in the data provided by the data source. */\n- private _dataDiffer: IterableDiffer<T> = null;\n-\n- // Placeholders within the table's template where the header and data rows will be inserted.\n- @ViewChild(RowPlaceholder) _rowPlaceholder: RowPlaceholder;\n- @ViewChild(HeaderRowPlaceholder) _headerRowPlaceholder: HeaderRowPlaceholder;\n-\n- /**\n- * The column definitions provided by the user that contain what the header and cells should\n- * render for each column.\n- */\n- @ContentChildren(CdkColumnDef) _columnDefinitions: QueryList<CdkColumnDef>;\n-\n- /** Template used as the header container. */\n- @ContentChild(CdkHeaderRowDef) _headerDefinition: CdkHeaderRowDef;\n-\n- /** Set of templates that used as the data row containers. */\n- @ContentChildren(CdkRowDef) _rowDefinitions: QueryList<CdkRowDef>;\n-\n- constructor(private readonly _differs: IterableDiffers,\n- private readonly _changeDetectorRef: ChangeDetectorRef,\n- elementRef: ElementRef,\n- renderer: Renderer2,\n- @Attribute('role') role: string) {\n- // Show the stability warning of the data-table only if it doesn't run inside of jasmine.\n- // This is just temporary and should reduce warnings when running the tests.\n- if (!(typeof window !== 'undefined' && window['jasmine'])) {\n- console.warn('The data table is still in active development ' +\n- 'and should be considered unstable.');\n- }\n-\n- if (!role) {\n- renderer.setAttribute(elementRef.nativeElement, 'role', 'grid');\n- }\n-\n- // TODO(andrewseguin): Add trackby function input.\n- // Find and construct an iterable differ that can be used to find the diff in an array.\n- this._dataDiffer = this._differs.find([]).create();\n- }\n-\n- ngOnDestroy() {\n- // TODO(andrewseguin): Disconnect from the data source so\n- // that it can unsubscribe from its streams.\n- }\n-\n- ngOnInit() {\n- // TODO(andrewseguin): Setup a listener for scroll events\n- // and emit the calculated view to this.viewChange\n- }\n-\n- ngAfterContentInit() {\n- // TODO(andrewseguin): Throw an error if two columns share the same name\n- this._columnDefinitions.forEach(columnDef => {\n- this._columnDefinitionsByName.set(columnDef.name, columnDef);\n- });\n-\n- // Get and merge the streams for column changes made to the row defs\n- const rowDefs = [...this._rowDefinitions.toArray(), this._headerDefinition];\n- const columnChangeStreams =\n- rowDefs.map((rowDef: BaseRowDef) => rowDef.columnsChange);\n- this._columnsChange = Observable.merge(...columnChangeStreams);\n- }\n-\n- ngAfterViewInit() {\n- this.renderHeaderRow();\n-\n- // Re-render the header row if the columns changed.\n- this._columnsChange.subscribe(() => {\n- this._headerRowPlaceholder.viewContainer.clear();\n- this.renderHeaderRow();\n-\n- // Reset the data to an empty array so that renderRowChanges will re-render all new rows.\n- this._rowPlaceholder.viewContainer.clear();\n- this._dataDiffer.diff([]);\n- });\n-\n- // TODO(andrewseguin): If the data source is not\n- // present after view init, connect it when it is defined.\n- // TODO(andrewseguin): Unsubscribe from this on destroy.\n- const streams = [this.dataSource.connect(this), this._columnsChange];\n- Observable.combineLatest(streams).subscribe(([rowsData]) => {\n- this.renderRowChanges(rowsData);\n- });\n- }\n-\n- /**\n- * Create the embedded view for the header template and place it in the header row view container.\n- */\n- renderHeaderRow() {\n- const cells = this.getHeaderCellTemplatesForRow(this._headerDefinition);\n-\n- // TODO(andrewseguin): add some code to enforce that exactly\n- // one CdkCellOutlet was instantiated as a result\n- // of `createEmbeddedView`.\n- this._headerRowPlaceholder.viewContainer\n- .createEmbeddedView(this._headerDefinition.template, {cells});\n- CdkCellOutlet.mostRecentCellOutlet.cells = cells;\n- CdkCellOutlet.mostRecentCellOutlet.context = {};\n- }\n-\n- /** Check for changes made in the data and render each change (row added/removed/moved). */\n- renderRowChanges(dataRows: NgIterable<T>) {\n- const changes = this._dataDiffer.diff(dataRows);\n- if (!changes) { return; }\n-\n- changes.forEachOperation(\n- (item: IterableChangeRecord<any>, adjustedPreviousIndex: number, currentIndex: number) => {\n- if (item.previousIndex == null) {\n- this.insertRow(dataRows[currentIndex], currentIndex);\n- } else if (currentIndex == null) {\n- this._rowPlaceholder.viewContainer.remove(adjustedPreviousIndex);\n- } else {\n- const view = this._rowPlaceholder.viewContainer.get(adjustedPreviousIndex);\n- this._rowPlaceholder.viewContainer.move(view, currentIndex);\n- }\n- });\n-\n- this._changeDetectorRef.markForCheck();\n- }\n-\n- /**\n- * Create the embedded view for the data row template and place it in the correct index location\n- * within the data row view container.\n- */\n- insertRow(rowData: T, index: number) {\n- // TODO(andrewseguin): Add when predicates to the row definitions\n- // to find the right template to used based on\n- // the data rather than choosing the first row definition.\n- const row = this._rowDefinitions.first;\n-\n- // TODO(andrewseguin): Add more context, such as first/last/isEven/etc\n- const context = {$implicit: rowData};\n-\n- // TODO(andrewseguin): add some code to enforce that exactly one\n- // CdkCellOutlet was instantiated as a result of `createEmbeddedView`.\n- this._rowPlaceholder.viewContainer.createEmbeddedView(row.template, context, index);\n-\n- // Insert empty cells if there is no data to improve rendering time.\n- CdkCellOutlet.mostRecentCellOutlet.cells = rowData ? this.getCellTemplatesForRow(row) : [];\n- CdkCellOutlet.mostRecentCellOutlet.context = context;\n- }\n-\n- /**\n- * Returns the cell template definitions to insert into the header\n- * as defined by its list of columns to display.\n- */\n- getHeaderCellTemplatesForRow(headerDef: CdkHeaderRowDef): CdkHeaderCellDef[] {\n- return headerDef.columns.map(columnId => {\n- // TODO(andrewseguin): Throw an error if there is no column with this columnId\n- return this._columnDefinitionsByName.get(columnId).headerCell;\n- });\n- }\n-\n- /**\n- * Returns the cell template definitions to insert in the provided row\n- * as defined by its list of columns to display.\n- */\n- getCellTemplatesForRow(rowDef: CdkRowDef): CdkCellDef[] {\n- return rowDef.columns.map(columnId => {\n- // TODO(andrewseguin): Throw an error if there is no column with this columnId\n- return this._columnDefinitionsByName.get(columnId).cell;\n- });\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/core/data-table/index.ts",
"new_path": null,
"diff": "-import {CommonModule} from '@angular/common';\n-import {NgModule} from '@angular/core';\n-import {HeaderRowPlaceholder, RowPlaceholder, CdkTable} from './data-table';\n-import {CdkCellOutlet, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef} from './row';\n-import {CdkColumnDef, CdkHeaderCellDef, CdkHeaderCell, CdkCell, CdkCellDef} from './cell';\n-\n-export * from './data-source';\n-export * from './data-table';\n-\n-@NgModule({\n- imports: [CommonModule],\n- exports: [\n- CdkTable, CdkRowDef, CdkCellDef, CdkCellOutlet, CdkHeaderCellDef,\n- CdkColumnDef, CdkCell, CdkRow,\n- CdkHeaderCell, CdkHeaderRow, CdkHeaderRowDef],\n- declarations: [\n- CdkTable, CdkRowDef, CdkCellDef, CdkCellOutlet, CdkHeaderCellDef,\n- CdkColumnDef, CdkCell, CdkRow,\n- CdkHeaderCell, CdkHeaderRow, CdkHeaderRowDef,\n- RowPlaceholder, HeaderRowPlaceholder,\n- ]\n-\n-})\n-export class CdkDataTableModule { }\n"
},
{
"change_type": "DELETE",
"old_path": "src/lib/core/data-table/row.ts",
"new_path": null,
"diff": "-import {\n- ChangeDetectionStrategy,\n- Component,\n- Directive,\n- IterableDiffer,\n- IterableDiffers,\n- SimpleChanges,\n- TemplateRef,\n- ViewContainerRef\n-} from '@angular/core';\n-import {CdkCellDef} from './cell';\n-import {Subject} from 'rxjs/Subject';\n-\n-/**\n- * Base class for the CdkHeaderRowDef and CdkRowDef that handles checking their columns inputs\n- * for changes and notifying the table.\n- */\n-export abstract class BaseRowDef {\n- /** The columns to be displayed on this row. */\n- columns: string[];\n-\n- /** Event stream that emits when changes are made to the columns. */\n- columnsChange: Subject<void> = new Subject<void>();\n-\n- /** Differ used to check if any changes were made to the columns. */\n- protected _columnsDiffer: IterableDiffer<any>;\n-\n- private viewInitialized = false;\n-\n- constructor(public template: TemplateRef<any>,\n- protected _differs: IterableDiffers) { }\n-\n- ngAfterViewInit() {\n- this.viewInitialized = true;\n- }\n-\n- ngOnChanges(changes: SimpleChanges): void {\n- // Create a new columns differ if one does not yet exist. Initialize it based on initial value\n- // of the columns property.\n- if (!this._columnsDiffer) {\n- this._columnsDiffer = this._differs.find(changes['columns'].currentValue).create();\n- }\n- }\n-\n- ngDoCheck(): void {\n- if (!this.viewInitialized || !this._columnsDiffer || !this.columns) { return; }\n-\n- // Notify the table if there are any changes to the columns.\n- const changes = this._columnsDiffer.diff(this.columns);\n- if (changes) { this.columnsChange.next(); }\n- }\n-}\n-\n-/**\n- * Header row definition for the CDK data-table.\n- * Captures the header row's template and other header properties such as the columns to display.\n- */\n-@Directive({\n- selector: '[cdkHeaderRowDef]',\n- inputs: ['columns: cdkHeaderRowDef'],\n-})\n-export class CdkHeaderRowDef extends BaseRowDef {\n- constructor(template: TemplateRef<any>, _differs: IterableDiffers) {\n- super(template, _differs);\n- }\n-}\n-\n-/**\n- * Data row definition for the CDK data-table.\n- * Captures the header row's template and other row properties such as the columns to display.\n- */\n-@Directive({\n- selector: '[cdkRowDef]',\n- inputs: ['columns: cdkRowDefColumns'],\n-})\n-export class CdkRowDef extends BaseRowDef {\n- // TODO(andrewseguin): Add an input for providing a switch function to determine\n- // if this template should be used.\n- constructor(template: TemplateRef<any>, _differs: IterableDiffers) {\n- super(template, _differs);\n- }\n-}\n-\n-/**\n- * Outlet for rendering cells inside of a row or header row.\n- * @docs-private\n- */\n-@Directive({selector: '[cdkCellOutlet]'})\n-export class CdkCellOutlet {\n- /** The ordered list of cells to render within this outlet's view container */\n- cells: CdkCellDef[];\n-\n- /** The data context to be provided to each cell */\n- context: any;\n-\n- /**\n- * Static property containing the latest constructed instance of this class.\n- * Used by the CDK data-table when each CdkHeaderRow and CdkRow component is created using\n- * createEmbeddedView. After one of these components are created, this property will provide\n- * a handle to provide that component's cells and context. After init, the CdkCellOutlet will\n- * construct the cells with the provided context.\n- */\n- static mostRecentCellOutlet: CdkCellOutlet = null;\n-\n- constructor(private _viewContainer: ViewContainerRef) {\n- CdkCellOutlet.mostRecentCellOutlet = this;\n- }\n-\n- ngOnInit() {\n- this.cells.forEach(cell => {\n- this._viewContainer.createEmbeddedView(cell.template, this.context);\n- });\n- }\n-}\n-\n-/** Header template container that contains the cell outlet. Adds the right class and role. */\n-@Component({\n- selector: 'cdk-header-row',\n- template: '<ng-container cdkCellOutlet></ng-container>',\n- host: {\n- 'class': 'cdk-header-row',\n- 'role': 'row',\n- },\n- changeDetection: ChangeDetectionStrategy.OnPush,\n-})\n-export class CdkHeaderRow { }\n-\n-/** Data row template container that contains the cell outlet. Adds the right class and role. */\n-@Component({\n- selector: 'cdk-row',\n- template: '<ng-container cdkCellOutlet></ng-container>',\n- host: {\n- 'class': 'cdk-row',\n- 'role': 'row',\n- },\n- changeDetection: ChangeDetectionStrategy.OnPush,\n-})\n-export class CdkRow { }\n"
}
] | TypeScript | MIT License | promact/md2 | chore: removed data-table component from core |
530,388 | 15.06.2017 13:26:08 | -19,080 | a3ca00d5b41f592d0d3c9eede2e403ccde21dcb6 | chore: update build script and ci config | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "language: node_js\nsudo: false\n+dist: trusty\nnode_js:\n- '--lts'\n@@ -13,6 +14,7 @@ jobs:\n- env: \"MODE=lint\"\n- env: \"MODE=aot\"\n- env: \"MODE=payload\"\n+ - env: \"MODE=closure-compiler\"\n- stage: Deploy\nscript: ./scripts/ci/publish-artifacts.sh\nenv: \"MODE=release\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/sources/mode.sh",
"new_path": "scripts/ci/sources/mode.sh",
"diff": "source ./scripts/ci/sources/tunnel.sh\nis_lint() {\n- [[ \"$MODE\" = lint ]]\n+ [[ \"${MODE}\" = lint ]]\n}\nis_aot() {\n- [[ \"$MODE\" = aot ]]\n+ [[ \"${MODE}\" = aot ]]\n}\nis_closure_compiler() {\n- [[ \"$MODE\" = closure-compiler ]]\n+ [[ \"${MODE}\" = closure-compiler ]]\n}\nis_payload() {\n- [[ \"$MODE\" = payload ]]\n+ [[ \"${MODE}\" = payload ]]\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/deploy/publish-build-artifacts.sh",
"new_path": "scripts/deploy/publish-build-artifacts.sh",
"diff": "@@ -17,21 +17,21 @@ commitMessage=$(git log --oneline -n 1)\nrepoName=\"md2\"\nrepoUrl=\"https://github.com/Promact/md2.git\"\n-repoDir=\"tmp/$repoName\"\n+repoDir=\"tmp/${repoName}\"\n# Create a release of the current repository.\n$(npm bin)/gulp build:release\n# Prepare cloning the builds repository\n-rm -rf $repoDir\n-mkdir -p $repoDir\n+rm -rf ${repoDir}\n+mkdir -p ${repoDir}\n# Clone the repository\n-git clone $repoUrl $repoDir --depth 1 --branch=build\n+git clone ${repoUrl} ${repoDir} --depth 1 --branch=build\n# Copy the build files to the repository\n-rm -rf $repoDir/*\n-cp -r $buildDir/* $repoDir\n+rm -rf ${repoDir}/*\n+cp -r ${buildDir}/* ${repoDir}\n# Create the build commit and push the changes to the repository.\ncd ${repoDir}\n@@ -47,8 +47,8 @@ git config credential.helper \"store --file=.git/credentials\"\necho \"https://${$GH_TOKEN}:@github.com\" > .git/credentials\ngit add -A\n-git commit -m \"$commitMessage\"\n-git tag \"$buildVersion-$commitSha\"\n+git commit -m \"${commitMessage}\"\n+git tag \"${buildVersion}-${commitSha}\"\ngit push origin master --tags\necho \"Published artifacts for Md2 package.\"\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update build script and ci config |
530,388 | 15.06.2017 15:34:53 | -19,080 | 53ca6c41eb474a40427f963bbab22a58872cc568 | chore: update ci build script | [
{
"change_type": "MODIFY",
"old_path": "scripts/ci/publish-artifacts.sh",
"new_path": "scripts/ci/publish-artifacts.sh",
"diff": "@@ -12,14 +12,14 @@ if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]]; then\nfi\necho \"Starting to publish the build artifacts and docs content...\"\n-echo \"\"\n# Build Md2 before publishing\n$(npm bin)/gulp build:release\n-# Run publishing of artifacts in parallel.\n-# This is possible because the output has been built before.\n+# Run publishing.\n+./scripts/deploy/publish-build-artifacts.sh --no-build &\n-# Deploy the dashboard functions for each push build.\n+# Deploy the demo.\n+./scripts/deploy/deploy-demo.sh &\nwait\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/closure-compiler/tsconfig-rxjs.json",
"new_path": null,
"diff": "-{\n- \"compilerOptions\": {\n- \"module\": \"es2015\",\n- \"outDir\": \"../../dist/packages/rxjs\",\n- \"target\": \"es5\",\n- \"lib\": [\"es2015\", \"dom\"],\n- \"types\": []\n- },\n- \"files\": [\n- \"../../node_modules/rxjs/src/Rx.ts\"\n- ],\n- \"angularCompilerOptions\": {\n- \"annotateForClosureCompiler\": true,\n- \"skipMetadataEmit\": true,\n- \"skipTemplateCodegen\": true\n- }\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "scripts/deploy/deploy-demo.sh",
"diff": "+#!/bin/bash\n+\n+# Script to publish the demo artifacts to a GitHub repository.\n+\n+set -e -o pipefail\n+\n+# Go to the project root directory\n+cd $(dirname ${0})/../..\n+\n+buildDir=\"deploy\"\n+buildVersion=$(sed -nE 's/^\\s*\"version\": \"(.*?)\",$/\\1/p' package.json)\n+commitSha=$(git rev-parse --short HEAD)\n+commitAuthorName=$(git --no-pager show -s --format='%an' HEAD)\n+commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)\n+commitMessage=$(git log --oneline -n 1)\n+\n+repoName=\"md2\"\n+repoUrl=\"https://github.com/Promact/md2.git\"\n+repoDir=\"tmp/${repoName}/${buildDir}\"\n+\n+# Create a release of the current repository.\n+$(npm bin)/gulp rollup:prepare\n+$(npm bin)/rollup -c ./dist/rollup-config.js\n+$(npm bin)/gulp deploy\n+\n+# Prepare cloning the builds repository\n+rm -rf ${repoDir}\n+mkdir -p ${repoDir}\n+\n+# Clone the repository\n+git clone ${repoUrl} ${repoDir} --depth 1 --branch=gh-pages\n+\n+# Copy the build files to the repository\n+rm -rf ${repoDir}/*\n+cp -r ${buildDir}/* ${repoDir}\n+\n+# Create the build commit and push the changes to the repository.\n+cd ${repoDir}\n+\n+# Prepare Git for pushing the artifacts to the repository.\n+git config user.name \"${commitAuthorName}\"\n+git config user.email \"${commitAuthorEmail}\"\n+git config credential.helper \"store --file=.git/credentials\"\n+\n+echo \"https://${$GH_TOKEN}:@github.com\" > .git/credentials\n+\n+git add -A\n+git commit -m \"${commitMessage}\"\n+git tag \"${buildVersion}-${commitSha}\"\n+git push origin master --tags\n+\n+echo \"Published demo on Md2 gh-pages.\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/deploy/publish-build-artifacts.sh",
"new_path": "scripts/deploy/publish-build-artifacts.sh",
"diff": "@@ -36,9 +36,6 @@ cp -r ${buildDir}/* ${repoDir}\n# Create the build commit and push the changes to the repository.\ncd ${repoDir}\n-# Update the package.json version to include the current commit SHA.\n-sed -i \"s/${buildVersion}/${buildVersion}-${commitSha}/g\" package.json\n-\n# Prepare Git for pushing the artifacts to the repository.\ngit config user.name \"${commitAuthorName}\"\ngit config user.email \"${commitAuthorEmail}\"\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update ci build script |
530,388 | 15.06.2017 15:54:43 | -19,080 | 036c319d9eb177bb7c88005dfbdda5c65816873a | chore: update gulp tasks | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"conventional-github-releaser\": \"^1.1.3\",\n\"dgeni\": \"^0.4.7\",\n\"dgeni-packages\": \"^0.19.1\",\n- \"firebase-admin\": \"^5.0.0\",\n- \"firebase-tools\": \"^3.9.0\",\n\"fs-extra\": \"^3.0.1\",\n\"glob\": \"^7.1.2\",\n- \"google-cloud\": \"^0.48.0\",\n\"gulp\": \"^3.9.1\",\n\"gulp-better-rollup\": \"^1.1.1\",\n\"gulp-bump\": \"^2.7.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "tools/gulp/gulpfile.ts",
"new_path": "tools/gulp/gulpfile.ts",
"diff": "@@ -8,10 +8,8 @@ import './tasks/docs';\nimport './tasks/e2e';\nimport './tasks/lint';\nimport './tasks/release';\n-import './tasks/screenshots';\nimport './tasks/serve';\nimport './tasks/unit-test';\nimport './tasks/docs';\nimport './tasks/aot';\nimport './tasks/payload';\n-import './tasks/coverage';\n"
},
{
"change_type": "DELETE",
"old_path": "tools/gulp/tasks/coverage.ts",
"new_path": null,
"diff": "-import {task} from 'gulp';\n-import {existsSync} from 'fs-extra';\n-import {COVERAGE_RESULT_FILE} from '../constants';\n-import {spawnSync} from 'child_process';\n-import {isTravisPushBuild} from '../util/travis-ci';\n-import {openFirebaseDashboardDatabase} from '../util/firebase';\n-\n-task('coverage:upload', () => {\n- if (!existsSync(COVERAGE_RESULT_FILE)) {\n- throw new Error('No coverage file has been found!');\n- }\n-\n- if (!isTravisPushBuild()) {\n- throw new Error('Coverage results will be only uploaded inside of Travis Push builds.');\n- }\n-\n- let results = require(COVERAGE_RESULT_FILE)['total'];\n-\n- // To reduce database payload, the covered lines won't be pushed to the Firebase database.\n- delete results['linesCovered'];\n-\n- return uploadResults(results);\n-});\n-\n-/** Uploads the coverage results to the firebase database. */\n-function uploadResults(results: any): Promise<void> {\n- let latestSha = spawnSync('git', ['rev-parse', 'HEAD']).stdout.toString().trim();\n- let database = openFirebaseDashboardDatabase();\n-\n- return database.ref('coverage-reports').child(latestSha).set(results)\n- .then(() => database.goOffline(), () => database.goOffline());\n-}\n-\n-// TODO(devversion): In the future we might have a big database where we can store full summaries.\n-// TODO(devversion): We could also move the coverage to a bot and reply with the results on PRs.\n"
},
{
"change_type": "MODIFY",
"old_path": "tools/gulp/tasks/payload.ts",
"new_path": "tools/gulp/tasks/payload.ts",
"diff": "@@ -3,8 +3,6 @@ import {join} from 'path';\nimport {statSync, readFileSync} from 'fs';\nimport {DIST_COMPONENTS_ROOT} from '../constants';\nimport {spawnSync} from 'child_process';\n-import {isTravisPushBuild} from '../util/travis-ci';\n-import {openFirebaseDashboardDatabase} from '../util/firebase';\n// There are no type definitions available for these imports.\nconst uglifyJs = require('uglify-js');\n@@ -23,11 +21,6 @@ task('payload', ['build:release'], () => {\n// Print the results to the console, so we can read it from the CI.\nconsole.log('Payload Results:', JSON.stringify(results, null, 2));\n- // Publish the results to firebase when it runs on Travis and not as a PR.\n- if (isTravisPushBuild()) {\n- return publishResults(results);\n- }\n-\n});\n/** Returns the size of a file in kilobytes. */\n@@ -45,13 +38,3 @@ function getUglifiedSize(filePath: string) {\nreturn Buffer.byteLength(compressedFile.code, 'utf8') / 1000;\n}\n-\n-/** Publishes the given results to the firebase database. */\n-function publishResults(results: any) {\n- let latestSha = spawnSync('git', ['rev-parse', 'HEAD']).stdout.toString().trim();\n- let database = openFirebaseDashboardDatabase();\n-\n- // Write the results to the payloads object with the latest Git SHA as key.\n- return database.ref('payloads').child(latestSha).set(results)\n- .then(() => database.goOffline(), () => database.goOffline());\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "tools/gulp/tasks/screenshots.ts",
"new_path": null,
"diff": "-import {task} from 'gulp';\n-import {readdirSync, statSync, existsSync, mkdirp} from 'fs-extra';\n-import * as path from 'path';\n-import * as admin from 'firebase-admin';\n-import {openScreenshotsBucket, openFirebaseScreenshotsDatabase} from '../util/firebase';\n-import {setGithubStatus} from '../util/github';\n-\n-const imageDiff = require('image-diff');\n-\n-const SCREENSHOT_DIR = './screenshots';\n-const FIREBASE_REPORT = 'screenshot/reports';\n-const FIREBASE_FILELIST = 'screenshot/filenames';\n-\n-/** Task which upload screenshots generated from e2e test. */\n-task('screenshots', () => {\n- let prNumber = process.env['TRAVIS_PULL_REQUEST'];\n- if (prNumber) {\n- let database = openFirebaseScreenshotsDatabase();\n- return getScreenshotFiles(database)\n- .then((files: any[]) => downloadAllGoldsAndCompare(files, database, prNumber))\n- .then((results: boolean) => updateResult(database, prNumber, results))\n- .then((result: boolean) => updateGithubStatus(prNumber, result))\n- .then(() => uploadScreenshots('diff', prNumber))\n- .then(() => uploadScreenshots('test', prNumber))\n- .then(() => updateTravis(database, prNumber))\n- .then(() => setScreenFilenames(database, prNumber))\n- .then(() => database.goOffline(), () => database.goOffline());\n- } else if (process.env['TRAVIS']) {\n- // Only update golds and filenames for build\n- let database = openFirebaseScreenshotsDatabase();\n- uploadScreenshots('gold')\n- .then(() => setScreenFilenames(database))\n- .then(() => database.goOffline(), () => database.goOffline());\n- }\n-});\n-\n-function updateFileResult(database: admin.database.Database, prNumber: string,\n- filenameKey: string, result: boolean) {\n- return getPullRequestRef(database, prNumber).child('results').child(filenameKey).set(result);\n-}\n-\n-function updateResult(database: admin.database.Database, prNumber: string, result: boolean) {\n- return getPullRequestRef(database, prNumber).child('result').set(result).then(() => result);\n-}\n-\n-function getPullRequestRef(database: admin.database.Database, prNumber: string) {\n- return database.ref(FIREBASE_REPORT).child(prNumber);\n-}\n-\n-function updateTravis(database: admin.database.Database,\n- prNumber: string) {\n- return database.ref(FIREBASE_REPORT).child(prNumber).update({\n- commit: process.env['TRAVIS_COMMIT'],\n- sha: process.env['TRAVIS_PULL_REQUEST_SHA'],\n- travis: process.env['TRAVIS_JOB_ID'],\n- });\n-}\n-\n-/** Get a list of filenames from firebase database. */\n-function getScreenshotFiles(database: admin.database.Database) {\n- let bucket = openScreenshotsBucket();\n- return bucket.getFiles({ prefix: 'golds/' }).then(function(data: any) {\n- return data[0].filter((file: any) => file.name.endsWith('.screenshot.png'));\n- });\n-}\n-\n-function extractScreenshotName(fileName: string) {\n- return path.basename(fileName, '.screenshot.png');\n-}\n-\n-function getLocalScreenshotFiles(dir: string): string[] {\n- return readdirSync(dir)\n- .filter((fileName: string) => !statSync(path.join(SCREENSHOT_DIR, fileName)).isDirectory())\n- .filter((fileName: string) => fileName.endsWith('.screenshot.png'));\n-}\n-\n-/**\n- * Upload screenshots to google cloud storage.\n- * @param prNumber - The key used in firebase. Here it is the PR number.\n- * If there's no prNumber, we will upload images to 'golds/' folder\n- * @param mode - Can be 'test' or 'diff' or 'gold'.\n- * If the images are the test results, mode should be 'test'.\n- * If the images are the diff images generated, mode should be 'diff'.\n- * For golds mode should be 'gold'.\n- */\n-function uploadScreenshots(mode?: 'test' | 'diff' | 'gold', prNumber?: string) {\n- let bucket = openScreenshotsBucket();\n-\n- let promises: any[] = [];\n- let localDir = mode == 'diff' ? path.join(SCREENSHOT_DIR, 'diff') : SCREENSHOT_DIR;\n- getLocalScreenshotFiles(localDir).forEach((file: string) => {\n- let fileName = path.join(localDir, file);\n- let destination = (mode == 'gold' || !prNumber) ?\n- `golds/${file}` : `screenshots/${prNumber}/${mode}/${file}`;\n- promises.push(bucket.upload(fileName, { destination: destination }));\n- });\n- return Promise.all(promises);\n-}\n-\n-/** Download golds screenshots. */\n-function downloadAllGoldsAndCompare(\n- files: any[], database: admin.database.Database,\n- prNumber: string) {\n-\n- mkdirp(path.join(SCREENSHOT_DIR, `golds`));\n- mkdirp(path.join(SCREENSHOT_DIR, `diff`));\n-\n- return Promise.all(files.map((file: any) => {\n- return downloadGold(file).then(() => diffScreenshot(file.name, database, prNumber));\n- })).then((results: boolean[]) => results.every((value: boolean) => value == true));\n-}\n-\n-/** Download one gold screenshot */\n-function downloadGold(file: any) {\n- return file.download({\n- destination: path.join(SCREENSHOT_DIR, file.name)\n- });\n-}\n-\n-function diffScreenshot(filename: string, database: admin.database.Database,\n- prNumber: string) {\n- // TODO(tinayuangao): Run the downloads and diffs in parallel.\n- filename = path.basename(filename);\n- let goldUrl = path.join(SCREENSHOT_DIR, `golds`, filename);\n- let pullRequestUrl = path.join(SCREENSHOT_DIR, filename);\n- let diffUrl = path.join(SCREENSHOT_DIR, `diff`, filename);\n- let filenameKey = extractScreenshotName(filename);\n-\n- if (existsSync(goldUrl) && existsSync(pullRequestUrl)) {\n- return new Promise((resolve: any, reject: any) => {\n- imageDiff({\n- actualImage: pullRequestUrl,\n- expectedImage: goldUrl,\n- diffImage: diffUrl,\n- }, (err: any, imagesAreSame: boolean) => {\n- if (err) {\n- console.log(err);\n- imagesAreSame = false;\n- reject(err);\n- }\n- resolve(imagesAreSame);\n- return updateFileResult(database, prNumber, filenameKey, imagesAreSame);\n- });\n- });\n- } else {\n- return updateFileResult(database, prNumber, filenameKey, false).then(() => false);\n- }\n-}\n-\n-/**\n- * Upload a list of filenames to firebase database as gold.\n- * This is necessary for control panel since google-cloud is not available to client side.\n- */\n-function setScreenFilenames(database: admin.database.Database,\n- prNumber?: string) {\n- let filenames: string[] = getLocalScreenshotFiles(SCREENSHOT_DIR);\n- let filelistDatabase = prNumber ?\n- database.ref(FIREBASE_REPORT).child(prNumber).child('filenames') :\n- database.ref(FIREBASE_FILELIST);\n- return filelistDatabase.set(filenames);\n-}\n-\n-/** Updates the Github Status of the given Pullrequest. */\n-function updateGithubStatus(prNumber: number, result: boolean) {\n- setGithubStatus(process.env['TRAVIS_PULL_REQUEST_SHA'], {\n- result: result,\n- name: 'Screenshot Tests',\n- description: `Screenshot Tests ${result ? 'passed' : 'failed'})`,\n- url: `http://material2-screenshots.firebaseapp.com/${prNumber}`\n- });\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "tools/gulp/util/firebase.ts",
"new_path": null,
"diff": "-const firebaseAdmin = require('firebase-admin');\n-const gcloud = require('google-cloud');\n-\n-/** Opens a connection to the firebase realtime database. */\n-export function openFirebaseDashboardDatabase() {\n- // Initialize the Firebase application with admin credentials.\n- // Credentials need to be for a Service Account, which can be created in the Firebase console.\n- firebaseAdmin.initializeApp({\n- credential: firebaseAdmin.credential.cert({\n- project_id: 'material2-dashboard',\n- client_email: 'firebase-adminsdk-ch1ob@material2-dashboard.iam.gserviceaccount.com',\n- // In Travis CI the private key will be incorrect because the line-breaks are escaped.\n- // The line-breaks need to persist in the service account private key.\n- private_key: (process.env['MATERIAL2_FIREBASE_PRIVATE_KEY'] || '').replace(/\\\\n/g, '\\n')\n- }),\n- databaseURL: 'https://material2-dashboard.firebaseio.com'\n- });\n-\n- return firebaseAdmin.database();\n-}\n-\n-/**\n- * Open Google Cloud Storage for screenshots.\n- * The files uploaded to google cloud are also available to firebase storage.\n- */\n-export function openScreenshotsBucket() {\n- let gcs = gcloud.storage({\n- projectId: 'material2-screenshots',\n- credentials: {\n- client_email: 'firebase-adminsdk-t4209@material2-screenshots.iam.gserviceaccount.com',\n- private_key: decode(process.env['MATERIAL2_SCREENSHOT_FIREBASE_KEY'])\n- },\n- });\n-\n- // Reference the existing appspot bucket.\n- return gcs.bucket('material2-screenshots.appspot.com');\n-}\n-\n-/** Opens a connection to the firebase database for screenshots. */\n-export function openFirebaseScreenshotsDatabase() {\n- // Initialize the Firebase application with admin credentials.\n- // Credentials need to be for a Service Account, which can be created in the Firebase console.\n- let screenshotApp = firebaseAdmin.initializeApp({\n- credential: firebaseAdmin.credential.cert({\n- project_id: 'material2-screenshots',\n- client_email: 'firebase-adminsdk-t4209@material2-screenshots.iam.gserviceaccount.com',\n- private_key: decode(process.env['MATERIAL2_SCREENSHOT_FIREBASE_KEY'])\n- }),\n- databaseURL: 'https://material2-screenshots.firebaseio.com'\n- }, 'material2-screenshots');\n-\n- return screenshotApp.database();\n-}\n-\n-/** Decodes a Travis CI variable that is public in favor for PRs. */\n-export function decode(str: string): string {\n- // In Travis CI the private key will be incorrect because the line-breaks are escaped.\n- // The line-breaks need to persist in the service account private key.\n- return (str || '').split('\\\\n').reverse().join('\\\\n').replace(/\\\\n/g, '\\n');\n-}\n-\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update gulp tasks |
530,388 | 15.06.2017 16:57:24 | -19,080 | 3e3ce1164a3caf967563081ed7387c8c83103304 | chore: removed dev-app bundle job from travis ci | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -14,7 +14,6 @@ jobs:\n- env: \"MODE=lint\"\n- env: \"MODE=aot\"\n- env: \"MODE=payload\"\n- - env: \"MODE=closure-compiler\"\n- stage: Deploy\nscript: bash ./scripts/ci/publish-artifacts.sh\nenv: \"MODE=release\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/build-and-test.sh",
"new_path": "scripts/ci/build-and-test.sh",
"diff": "@@ -35,8 +35,6 @@ elif is_aot; then\n$(npm bin)/gulp ci:aot\nelif is_payload; then\n$(npm bin)/gulp ci:payload\n-elif is_closure_compiler; then\n- ./scripts/closure-compiler/build-devapp-bundle.sh\nfi\nteardown_tunnel\n"
}
] | TypeScript | MIT License | promact/md2 | chore: removed dev-app bundle job from travis ci |
530,388 | 15.06.2017 17:37:38 | -19,080 | e6eaa1485fe0256869a59fc783b4ba26a3e680a7 | chore: update deploy build script | [
{
"change_type": "MODIFY",
"old_path": "scripts/ci/publish-artifacts.sh",
"new_path": "scripts/ci/publish-artifacts.sh",
"diff": "#!/bin/bash\n# Script that runs after the testing stage of Travis passed.\n-# Build artifacts and docs content will be published to different repositories.\n+# Build artifacts and demo content will be published to different repositories.\n# Go to the project root directory\ncd $(dirname $0)/../..\n-if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]]; then\n- echo \"Build artifacts and docs content will only be deployed in Travis push builds.\"\n+if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]] || [[ \"$TRAVIS_BRANCH\" != \"master\" ]]; then\n+ echo \"Build artifacts and demo content will only be deployed in Travis push builds and branch is master.\"\nexit 0;\nfi\n-echo \"Starting to publish the build artifacts and docs content...\"\n-\n-# Build Md2 before publishing\n-$(npm bin)/gulp build:release\n-\n+echo \"Starting to publish the build artifacts and demo content...\"\n# Run publishing.\n-./scripts/deploy/publish-build-artifacts.sh --no-build &\n+bash ./scripts/deploy/publish-build-artifacts.sh --no-build &\n# Deploy the demo.\n-./scripts/deploy/deploy-demo.sh &\n+bash ./scripts/deploy/deploy-demo.sh &\nwait\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update deploy build script |
530,388 | 16.06.2017 11:04:07 | -19,080 | bcd23776689b18a8cfccf1114e9952469e0dafbd | chore: update travis ci config and build script | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -9,15 +9,6 @@ branches:\nonly:\n- master\n-jobs:\n- include:\n- - env: \"MODE=lint\"\n- - env: \"MODE=aot\"\n- - env: \"MODE=payload\"\n- - stage: Deploy\n- script: bash ./scripts/ci/publish-artifacts.sh\n- env: \"MODE=release\"\n-\nenv:\nglobal:\n- LOGS_DIR=/tmp/md2-build/logs\n@@ -32,7 +23,7 @@ before_script:\n- mkdir -p $LOGS_DIR\nscript:\n- - bash ./scripts/ci/build-and-test.sh\n+ - bash ./scripts/ci/test-build-and-deploy.sh\nbefore_deploy:\n- gulp build:release\n"
},
{
"change_type": "RENAME",
"old_path": "scripts/ci/build-and-test.sh",
"new_path": "scripts/ci/test-build-and-deploy.sh",
"diff": "set -e\necho \"\"\n-echo \"Building sources and running tests. Running mode: ${MODE}\"\n+echo \"Test Build and Deploy starts\"\necho \"\"\n# Go to project dir\ncd $(dirname $0)/../..\n-# Include sources.\n-source scripts/ci/sources/mode.sh\n-source scripts/ci/sources/tunnel.sh\n-\n# Get commit diff\nif [ \"$TRAVIS_PULL_REQUEST\" = \"false\" ]; then\nfileDiff=$(git diff --name-only $TRAVIS_COMMIT_RANGE)\n@@ -26,15 +22,12 @@ if [[ ${fileDiff} =~ ^(.*\\.md\\s*)*$ ]] && (is_e2e || is_unit); then\nexit 0\nfi\n-start_tunnel\n-wait_for_tunnel\n-if is_lint; then\n+echo \"start lint\"\n$(npm bin)/gulp ci:lint\n-elif is_aot; then\n+echo \"start AOT\"\n$(npm bin)/gulp ci:aot\n-elif is_payload; then\n+echo \"start payload\"\n$(npm bin)/gulp ci:payload\n-fi\n-teardown_tunnel\n+bash ./scripts/ci/publish-artifacts.sh\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/deploy/deploy-demo.sh",
"new_path": "scripts/deploy/deploy-demo.sh",
"diff": "@@ -15,7 +15,7 @@ commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)\ncommitMessage=$(git log --oneline -n 1)\nrepoName=\"md2\"\n-repoUrl=\"https://github.com/Promact/md2.git\"\n+repoUrl=\"https://Promact:[email protected]/Promact/md2.git\"\nrepoDir=\"tmp/${repoName}/${buildDir}\"\n# Create a release of the current repository.\n@@ -40,13 +40,9 @@ cd ${repoDir}\n# Prepare Git for pushing the artifacts to the repository.\ngit config user.name \"${commitAuthorName}\"\ngit config user.email \"${commitAuthorEmail}\"\n-git config credential.helper \"store --file=.git/credentials\"\n-\n-echo \"https://${$GH_TOKEN}:@github.com\" > .git/credentials\ngit add -A\ngit commit -m \"${commitMessage}\"\n-git tag \"${buildVersion}-${commitSha}\"\ngit push origin master --tags\necho \"Published demo on Md2 gh-pages.\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/deploy/publish-build-artifacts.sh",
"new_path": "scripts/deploy/publish-build-artifacts.sh",
"diff": "@@ -16,7 +16,7 @@ commitAuthorEmail=$(git --no-pager show -s --format='%ae' HEAD)\ncommitMessage=$(git log --oneline -n 1)\nrepoName=\"md2\"\n-repoUrl=\"https://github.com/Promact/md2.git\"\n+repoUrl=\"https://Promact:[email protected]/Promact/md2.git\"\nrepoDir=\"tmp/${repoName}\"\n# Create a release of the current repository.\n@@ -39,13 +39,10 @@ cd ${repoDir}\n# Prepare Git for pushing the artifacts to the repository.\ngit config user.name \"${commitAuthorName}\"\ngit config user.email \"${commitAuthorEmail}\"\n-git config credential.helper \"store --file=.git/credentials\"\n-\n-echo \"https://${$GH_TOKEN}:@github.com\" > .git/credentials\ngit add -A\ngit commit -m \"${commitMessage}\"\ngit tag \"${buildVersion}-${commitSha}\"\ngit push origin master --tags\n-echo \"Published artifacts for Md2 package.\"\n+echo \"Published build on Md2 build.\"\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update travis ci config and build script |
530,388 | 16.06.2017 13:46:39 | -19,080 | 7b9b757536e14b4508328d467aaf1e1b0fe9676c | chore: update travis ci deploy tasks | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -31,7 +31,11 @@ before_deploy:\n- cd md2\ndeploy:\n- provider: npm\n+ - provider: releases\n+ api_key: $GH_TOKEN\n+ on:\n+ tags: true\n+ - provider: npm\nskip_cleanup: true\nemail: [email protected]\napi_key:\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update travis ci deploy tasks |
530,388 | 16.06.2017 16:25:18 | -19,080 | c66b1017106717930a2c9fbb028399932e8c2599 | chore: update dependencies in colorpicker | [
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.ts",
"new_path": "src/lib/colorpicker/colorpicker.ts",
"diff": "@@ -5,7 +5,6 @@ import {\nEventEmitter,\nElementRef,\nViewEncapsulation,\n- NgModule,\nDirective,\nOnDestroy,\nOptional,\n@@ -19,21 +18,14 @@ import {\nControlValueAccessor,\nNgControl\n} from '@angular/forms';\n-import { CommonModule } from '@angular/common';\n-import {\n- Overlay,\n- OverlayModule,\n- OverlayState,\n- OverlayRef,\n- PositionStrategy,\n- TemplatePortal,\n- PortalModule,\n- HorizontalConnectionPos,\n- VerticalConnectionPos\n-} from '../core';\n+import { coerceBooleanProperty } from '../core/coercion/boolean-property';\n+import { Overlay } from '../core/overlay/overlay';\n+import { OverlayRef } from '../core/overlay/overlay-ref';\n+import { OverlayState } from '../core/overlay/overlay-state';\n+import { PositionStrategy } from '../core/overlay/position/position-strategy';\n+import { TemplatePortal } from '../core';\nimport { Subscription } from 'rxjs/Subscription';\nimport { ColorUtil, Rgba, Hsla, Hsva } from './color-util';\n-import { coerceBooleanProperty } from '../core/coercion/boolean-property';\nexport class SliderPosition {\nconstructor(public h: number, public s: number, public v: number, public a: number) { }\n@@ -176,7 +168,6 @@ export class Md2ColorChange {\nconstructor(public source: Md2Colorpicker, public color: string) { }\n}\n-\n@Component({\nmoduleId: module.id,\nselector: 'md2-colorpicker',\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update dependencies in colorpicker |
530,399 | 17.06.2017 18:05:51 | -10,800 | 62062811c930765a2e35c5c0fc5e5679cdb8378c | Runtime Error: MD_DATE_FORMATS (Datepicker) | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-locale.ts",
"new_path": "src/lib/datepicker/date-locale.ts",
"diff": "@@ -92,17 +92,18 @@ export class DateLocale {\nif (SUPPORTS_INTL_API) {\nlet dtf = new Intl.DateTimeFormat(this.locale, { hour: 'numeric' });\nreturn range(24, i => this._stripDirectionalityCharacters(\n- dtf.format(new Date(2017, 0, 0, i + 1))));\n+ dtf.format(new Date(2017, 0, 0, i))));\n}\nreturn DEFAULT_HOUR_NAMES;\n}\ngetMinuteNames(): string[] {\n+ console.log(0);\nif (this.minutes) { return this.minutes; }\nif (SUPPORTS_INTL_API) {\nlet dtf = new Intl.DateTimeFormat(this.locale, { minute: 'numeric' });\nreturn range(60, i => this._stripDirectionalityCharacters(\n- dtf.format(new Date(2017, 0, 0, 0, i + 1))));\n+ dtf.format(new Date(2017, 0, 0, 0, i))));\n}\nreturn DEFAULT_MINUTE_NAMES;\n}\n"
}
] | TypeScript | MIT License | promact/md2 | #242 Runtime Error: MD_DATE_FORMATS (Datepicker) |
530,399 | 17.06.2017 22:28:48 | -10,800 | 77fcbb5c23e57b9f8c264041454300b28e37e570 | Update date-locale.ts
Delete console.log | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-locale.ts",
"new_path": "src/lib/datepicker/date-locale.ts",
"diff": "@@ -98,7 +98,6 @@ export class DateLocale {\n}\ngetMinuteNames(): string[] {\n- console.log(0);\nif (this.minutes) { return this.minutes; }\nif (SUPPORTS_INTL_API) {\nlet dtf = new Intl.DateTimeFormat(this.locale, { minute: 'numeric' });\n"
}
] | TypeScript | MIT License | promact/md2 | Update date-locale.ts
Delete console.log |
530,388 | 19.06.2017 11:54:19 | -19,080 | 28a6d3eb0e9fda70b89600559941811733913e53 | chore: update configurations for build rollup bundle | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/tsconfig.json",
"new_path": "src/demo-app/tsconfig.json",
"diff": "\"declaration\": false,\n\"emitDecoratorMetadata\": true,\n\"experimentalDecorators\": true,\n+ \"noUnusedParameters\": true,\n\"lib\": [\"es6\", \"es2015\", \"dom\"],\n\"module\": \"commonjs\",\n\"moduleResolution\": \"node\",\n"
},
{
"change_type": "MODIFY",
"old_path": "tools/gulp/tasks/components.ts",
"new_path": "tools/gulp/tasks/components.ts",
"diff": "@@ -101,18 +101,28 @@ task(':watch:components', () => {\n});\nconst ROLLUP_GLOBALS = {\n+ // Import tslib rather than having TypeScript output its helpers multiple times.\n+ // See https://github.com/Microsoft/tslib\n+ 'tslib': 'tslib',\n+\n// Angular dependencies\n+ '@angular/animations': 'ng.animations',\n'@angular/core': 'ng.core',\n'@angular/common': 'ng.common',\n'@angular/forms': 'ng.forms',\n'@angular/http': 'ng.http',\n- '@angular/animations': 'ng.animations',\n- '@angular/animations/browser': 'ng.animations.browser',\n'@angular/platform-browser': 'ng.platformBrowser',\n- '@angular/platform-browser/animations': 'ng.platformBrowser.animations',\n'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',\n+ '@angular/platform-browser/animations': 'ng.platformBrowser.animations',\n+\n+ // Local Angular packages inside of Material.\n+ 'md2': 'ng.md2',\n// Rxjs dependencies\n+ 'rxjs/BehaviorSubject': 'Rx',\n+ 'rxjs/Observable': 'Rx',\n+ 'rxjs/Subject': 'Rx',\n+ 'rxjs/Subscription': 'Rx',\n'rxjs/add/observable/combineLatest': 'Rx.Observable',\n'rxjs/add/observable/forkJoin': 'Rx.Observable',\n'rxjs/add/observable/fromEvent': 'Rx.Observable',\n@@ -131,11 +141,8 @@ const ROLLUP_GLOBALS = {\n'rxjs/add/operator/share': 'Rx.Observable.prototype',\n'rxjs/add/operator/startWith': 'Rx.Observable.prototype',\n'rxjs/add/operator/switchMap': 'Rx.Observable.prototype',\n+ 'rxjs/add/operator/takeUntil': 'Rx.Observable.prototype',\n'rxjs/add/operator/toPromise': 'Rx.Observable.prototype',\n- 'rxjs/BehaviorSubject': 'Rx',\n- 'rxjs/Observable': 'Rx',\n- 'rxjs/Subject': 'Rx',\n- 'rxjs/Subscription': 'Rx',\n};\n/** Creates a rollup bundles of the Material components.*/\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update configurations for build rollup bundle |
530,388 | 20.06.2017 08:47:56 | -19,080 | 0bf9c27d29384da72ba6658d68cbabd2fa6bf072 | chore(tooltip) fixed view encapsulation issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/tooltip.scss",
"new_path": "src/lib/tooltip/tooltip.scss",
"diff": "@@ -5,7 +5,7 @@ $md2-tooltip-margin: 14px;\n$md2-tooltip-horizontal-padding: 8px;\n$md2-tooltip-vertical-padding: ($md2-tooltip-target-height - $md2-tooltip-font-size) / 2;\n-:host {\n+md2-tooltip {\npointer-events: none;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/tooltip/tooltip.ts",
"new_path": "src/lib/tooltip/tooltip.ts",
"diff": "@@ -9,6 +9,7 @@ import {\nOnDestroy,\nRenderer2,\nChangeDetectorRef,\n+ ViewEncapsulation,\n} from '@angular/core';\nimport {\nstyle,\n@@ -304,7 +305,8 @@ export type TooltipVisibility = 'initial' | 'visible' | 'hidden';\nhost: {\n'[style.zoom]': '_visibility === \"visible\" ? 1 : null',\n'(body:click)': 'this._handleBodyInteraction()'\n- }\n+ },\n+ encapsulation: ViewEncapsulation.None\n})\nexport class Md2TooltipComponent {\n/** Message to display in the tooltip */\n"
}
] | TypeScript | MIT License | promact/md2 | chore(tooltip) fixed view encapsulation issue |
530,388 | 20.06.2017 09:49:10 | -19,080 | 354a8ea65eb3233b174046d2484bdd539f3b48a6 | docs(datepicker) updated documentations | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/README.md",
"new_path": "src/lib/datepicker/README.md",
"diff": "@@ -6,7 +6,7 @@ Datepicker allow the user to select date and time.\n| Name | Type | Description |\n| --- | --- | --- |\n-| `type` | `'date' | 'time' | 'month' | 'datetime'` | The type of the datepicker |\n+| `type` | `'date'` | `'time'` | `'month'` | `'datetime'` | The type of the datepicker |\n| `required` | `boolean` | Whether or not the datepicker is required |\n| `disabled` | `boolean` | Whether or not the datepicker is disabled |\n| `min` | `date` | The min date of Datepicker. |\n"
}
] | TypeScript | MIT License | promact/md2 | docs(datepicker) updated documentations |
530,388 | 20.06.2017 10:49:25 | -19,080 | a5f5fed25593ad18aaa493f48bda2c5043a8bd5d | chore: updated package dependencies with latest | [
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "\"lockfileVersion\": 1,\n\"dependencies\": {\n\"@angular/animations\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/animations/-/animations-4.2.2.tgz\",\n- \"integrity\": \"sha1-SwDdNBTVXPekhmhsVIaAwvyTQl4=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/animations/-/animations-4.2.3.tgz\",\n+ \"integrity\": \"sha1-aGkmpp0MnCapvK0mzW+9AkW7bBs=\"\n},\n\"@angular/common\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/common/-/common-4.2.2.tgz\",\n- \"integrity\": \"sha1-fAfEaJfVhUJxJAeQEwB33IOgp3U=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/common/-/common-4.2.3.tgz\",\n+ \"integrity\": \"sha1-4Bc2EutqnPjdUL00yKky286R0r8=\"\n},\n\"@angular/compiler\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/compiler/-/compiler-4.2.2.tgz\",\n- \"integrity\": \"sha1-EMFo+KFWOX8Hrm74OgkR4B7SZPg=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/compiler/-/compiler-4.2.3.tgz\",\n+ \"integrity\": \"sha1-6c3tR5lM9K23Ui13jEax98UmMwI=\"\n},\n\"@angular/compiler-cli\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.2.2.tgz\",\n- \"integrity\": \"sha1-vF+lLjQAC2eKPIGJ/+LaX8ABdQE=\",\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-4.2.3.tgz\",\n+ \"integrity\": \"sha1-M6o/v02YecwUKj7M5GmWvshAwCk=\",\n+ \"dev\": true,\n+ \"dependencies\": {\n+ \"@angular/tsc-wrapped\": {\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.3.tgz\",\n+ \"integrity\": \"sha1-GYPmXZypY5XdUqCpBKz+isjlck0=\",\n\"dev\": true\n+ }\n+ }\n},\n\"@angular/core\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/core/-/core-4.2.2.tgz\",\n- \"integrity\": \"sha1-r1WH3aJ1k1hocJ2MGG4twqHXCgA=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/core/-/core-4.2.3.tgz\",\n+ \"integrity\": \"sha1-q3MpwY1P0wWHK4Jxj/rj525NRUk=\"\n},\n\"@angular/forms\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/forms/-/forms-4.2.2.tgz\",\n- \"integrity\": \"sha1-XJYK0pYKCuKZn8R0Vg1z6RDRGKA=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/forms/-/forms-4.2.3.tgz\",\n+ \"integrity\": \"sha1-/3cPCkXzfNmafCDO3OVg0BjJyjs=\"\n},\n\"@angular/http\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/http/-/http-4.2.2.tgz\",\n- \"integrity\": \"sha1-6fl397Ds7E1Y7N/FbVcG2ClYSLI=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/http/-/http-4.2.3.tgz\",\n+ \"integrity\": \"sha1-io/8j9/P2huSz8M178ZY7dS2pno=\"\n},\n\"@angular/platform-browser\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.2.2.tgz\",\n- \"integrity\": \"sha1-5+HqMtEGn/lgQpB28/CIKWW2IPM=\"\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-4.2.3.tgz\",\n+ \"integrity\": \"sha1-mhrM/J6TqVYQErugN6BLQc7cAlU=\"\n},\n\"@angular/platform-browser-dynamic\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.2.2.tgz\",\n- \"integrity\": \"sha1-APS40c5BX0MrzFqyu5CwsGkDYoc=\",\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.2.3.tgz\",\n+ \"integrity\": \"sha1-h85B9XedMcvGjHHba/66IW0TVVQ=\",\n\"dev\": true\n},\n\"@angular/platform-server\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/platform-server/-/platform-server-4.2.2.tgz\",\n- \"integrity\": \"sha1-qqE1lhW92WSMfBmNtZqlIIiBaL0=\",\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/platform-server/-/platform-server-4.2.3.tgz\",\n+ \"integrity\": \"sha1-reRQZTC7GAqj8DVSu8ZwRbUR084=\",\n\"dev\": true\n},\n\"@angular/router\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/router/-/router-4.2.2.tgz\",\n- \"integrity\": \"sha1-Ly0gLJLb44KNWj0v0sNzfAy2pYc=\",\n- \"dev\": true\n- },\n- \"@angular/tsc-wrapped\": {\n- \"version\": \"4.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/@angular/tsc-wrapped/-/tsc-wrapped-4.2.2.tgz\",\n- \"integrity\": \"sha1-CU2hUUhJoIR/nLUYTgzrFvwZRFc=\",\n+ \"version\": \"4.2.3\",\n+ \"resolved\": \"https://registry.npmjs.org/@angular/router/-/router-4.2.3.tgz\",\n+ \"integrity\": \"sha1-RJJDGxsFr4X+ttzCspg4IAazqdo=\",\n\"dev\": true\n},\n\"@gulp-sourcemaps/identity-map\": {\n\"dev\": true\n},\n\"@types/node\": {\n- \"version\": \"7.0.31\",\n- \"resolved\": \"https://registry.npmjs.org/@types/node/-/node-7.0.31.tgz\",\n- \"integrity\": \"sha512-+KrE1LDddn97ip+gXZAnzNQ0pupKH/6tcKwTpo96BDVNpzmhIKGHug0Wd3H0dN4WEqYB1tXYI5m2mZuIZNI8tg==\",\n+ \"version\": \"7.0.32\",\n+ \"resolved\": \"https://registry.npmjs.org/@types/node/-/node-7.0.32.tgz\",\n+ \"integrity\": \"sha512-7+0Ai8r8Xt6NNVM0Eo+XSqiZsBUYXg2yrCwyBhQzSfFHTGQWzFv/pk9106vPR8HWjKmGK+zzUj244POs4xfO2g==\",\n\"dev\": true\n},\n\"@types/orchestrator\": {\n\"dev\": true\n},\n\"axe-core\": {\n- \"version\": \"2.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/axe-core/-/axe-core-2.3.0.tgz\",\n- \"integrity\": \"sha1-CFVBoC1XCm1vsm7tcB0IUUneIdM=\",\n+ \"version\": \"2.3.1\",\n+ \"resolved\": \"https://registry.npmjs.org/axe-core/-/axe-core-2.3.1.tgz\",\n+ \"integrity\": \"sha512-7tp/4CaH1pJNANRj6ULjxND2FBK34stXC4+0WMGu1OOLVPTBj4rLreEb8dBVLh4J5c4BNzU+X3OSmDwRhDxyfg==\",\n\"dev\": true\n},\n\"axe-webdriverjs\": {\n\"dev\": true\n},\n\"conventional-changelog\": {\n- \"version\": \"1.1.3\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.3.tgz\",\n- \"integrity\": \"sha1-JigweKw4wJTfKvFgSwpGu8AWXE0=\",\n+ \"version\": \"1.1.4\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.4.tgz\",\n+ \"integrity\": \"sha1-EIvHUMKjF+IA4vm0E8qqH4x++js=\",\n+ \"dev\": true,\n+ \"dependencies\": {\n+ \"conventional-changelog-angular\": {\n+ \"version\": \"1.3.4\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.3.4.tgz\",\n+ \"integrity\": \"sha1-fXzfvTWJSDEpBNAiKaYf1gdc9FU=\",\n\"dev\": true\n},\n- \"conventional-changelog-angular\": {\n- \"version\": \"1.3.3\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.3.3.tgz\",\n- \"integrity\": \"sha1-586AeoXdR1DhtBf3ZgRUl1EeByY=\",\n+ \"conventional-changelog-core\": {\n+ \"version\": \"1.9.0\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-1.9.0.tgz\",\n+ \"integrity\": \"sha1-3l37wJGEdlZQjUo4njXJobxJ5/Q=\",\n\"dev\": true\n},\n+ \"conventional-changelog-ember\": {\n+ \"version\": \"0.2.6\",\n+ \"resolved\": \"https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-0.2.6.tgz\",\n+ \"integrity\": \"sha1-i3NVQZ9RJ0k8TFYkc6svx5LxwrY=\",\n+ \"dev\": true\n+ }\n+ }\n+ },\n\"conventional-changelog-atom\": {\n\"version\": \"0.1.0\",\n\"resolved\": \"https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-0.1.0.tgz\",\n\"integrity\": \"sha1-dXelkdv5tTjnoVCn7mL2WihyszQ=\",\n\"dev\": true\n},\n- \"conventional-changelog-core\": {\n- \"version\": \"1.8.0\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-1.8.0.tgz\",\n- \"integrity\": \"sha1-l3hItBbK8V+wnyCxKmLUDvFFuVc=\",\n- \"dev\": true\n- },\n- \"conventional-changelog-ember\": {\n- \"version\": \"0.2.5\",\n- \"resolved\": \"https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-0.2.5.tgz\",\n- \"integrity\": \"sha1-ziHVz4PNXr4F0j/fIy2IRPS1ak8=\",\n- \"dev\": true\n- },\n\"conventional-changelog-eslint\": {\n\"version\": \"0.1.0\",\n\"resolved\": \"https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-0.1.0.tgz\",\n\"dev\": true\n},\n\"dgeni\": {\n- \"version\": \"0.4.7\",\n- \"resolved\": \"https://registry.npmjs.org/dgeni/-/dgeni-0.4.7.tgz\",\n- \"integrity\": \"sha1-UHBifdKPiNSABuIfVa+xipy4vmg=\",\n+ \"version\": \"0.4.9\",\n+ \"resolved\": \"https://registry.npmjs.org/dgeni/-/dgeni-0.4.9.tgz\",\n+ \"integrity\": \"sha1-nkJ3WxOGyl64JHU6ws0WnY9hztE=\",\n\"dev\": true,\n\"dependencies\": {\n\"lodash\": {\n\"dev\": true\n},\n\"gulp-git\": {\n- \"version\": \"2.4.0\",\n- \"resolved\": \"https://registry.npmjs.org/gulp-git/-/gulp-git-2.4.0.tgz\",\n- \"integrity\": \"sha1-luTO6/pTOFxfJmwVeB6CHwmeNYU=\",\n+ \"version\": \"2.4.1\",\n+ \"resolved\": \"https://registry.npmjs.org/gulp-git/-/gulp-git-2.4.1.tgz\",\n+ \"integrity\": \"sha1-7J6qTgCXhmz71qqSzLEBanffA6U=\",\n\"dev\": true,\n\"dependencies\": {\n\"clone-stats\": {\n\"dev\": true\n},\n\"jasmine-core\": {\n- \"version\": \"2.6.3\",\n- \"resolved\": \"https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.6.3.tgz\",\n- \"integrity\": \"sha1-RQcpUOSkKx4yL+VcABEApGXXeBU=\",\n+ \"version\": \"2.6.4\",\n+ \"resolved\": \"https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.6.4.tgz\",\n+ \"integrity\": \"sha1-3skmzQqfoof7bbXHVfpIfnTOysU=\",\n\"dev\": true\n},\n\"jasminewd2\": {\n}\n},\n\"stylelint\": {\n- \"version\": \"7.11.0\",\n- \"resolved\": \"https://registry.npmjs.org/stylelint/-/stylelint-7.11.0.tgz\",\n- \"integrity\": \"sha1-SBY3Ls0K/Sww/lP09qAOsElg2/w=\",\n+ \"version\": \"7.11.1\",\n+ \"resolved\": \"https://registry.npmjs.org/stylelint/-/stylelint-7.11.1.tgz\",\n+ \"integrity\": \"sha1-yBbGWLr32eXRZ9gic/6tN8l65J0=\",\n\"dev\": true,\n\"dependencies\": {\n\"balanced-match\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"node\": \">= 5.4.1 < 7\"\n},\n\"dependencies\": {\n- \"@angular/animations\": \"^4.0.0\",\n- \"@angular/common\": \"^4.0.0\",\n- \"@angular/compiler\": \"^4.0.0\",\n- \"@angular/core\": \"^4.0.0\",\n- \"@angular/forms\": \"^4.0.0\",\n- \"@angular/http\": \"^4.0.0\",\n- \"@angular/platform-browser\": \"^4.0.0\",\n+ \"@angular/animations\": \"^4.2.3\",\n+ \"@angular/common\": \"^4.2.3\",\n+ \"@angular/compiler\": \"^4.2.3\",\n+ \"@angular/core\": \"^4.2.3\",\n+ \"@angular/forms\": \"^4.2.3\",\n+ \"@angular/http\": \"^4.2.3\",\n+ \"@angular/platform-browser\": \"^4.2.3\",\n\"core-js\": \"^2.4.1\",\n\"rxjs\": \"^5.0.1\",\n\"systemjs\": \"0.19.43\",\n\"zone.js\": \"^0.8.4\"\n},\n\"devDependencies\": {\n- \"@angular/compiler-cli\": \"^4.0.0\",\n- \"@angular/platform-browser-dynamic\": \"^4.0.0\",\n- \"@angular/platform-server\": \"^4.0.0\",\n- \"@angular/router\": \"^4.0.0\",\n+ \"@angular/compiler-cli\": \"^4.2.3\",\n+ \"@angular/platform-browser-dynamic\": \"^4.2.3\",\n+ \"@angular/platform-server\": \"^4.2.3\",\n+ \"@angular/router\": \"^4.2.3\",\n\"@types/chalk\": \"^0.4.31\",\n\"@types/fs-extra\": \"^3.0.1\",\n\"@types/glob\": \"^5.0.30\",\n\"@types/jasmine\": \"2.5.45\",\n\"@types/merge2\": \"^0.3.30\",\n\"@types/minimist\": \"^1.2.0\",\n- \"@types/node\": \"^7.0.21\",\n+ \"@types/node\": \"^7.0.32\",\n\"@types/run-sequence\": \"^0.0.29\",\n\"@types/rx\": \"2.5.33\",\n\"autoprefixer\": \"^6.7.6\",\n- \"axe-core\": \"^2.2.1\",\n+ \"axe-core\": \"^2.3.1\",\n\"axe-webdriverjs\": \"^1.1.1\",\n\"chalk\": \"^1.1.3\",\n- \"conventional-changelog\": \"^1.1.3\",\n+ \"conventional-changelog\": \"^1.1.4\",\n\"conventional-github-releaser\": \"^1.1.3\",\n- \"dgeni\": \"^0.4.7\",\n+ \"dgeni\": \"^0.4.9\",\n\"dgeni-packages\": \"^0.19.1\",\n\"fs-extra\": \"^3.0.1\",\n\"glob\": \"^7.1.2\",\n\"gulp-conventional-changelog\": \"^1.1.3\",\n\"gulp-dom\": \"^0.9.17\",\n\"gulp-flatten\": \"^0.3.1\",\n- \"gulp-git\": \"^2.3.0\",\n+ \"gulp-git\": \"^2.4.1\",\n\"gulp-highlight-files\": \"^0.0.4\",\n\"gulp-htmlmin\": \"^3.0.0\",\n\"gulp-if\": \"^2.0.2\",\n\"highlight.js\": \"^9.11.0\",\n\"http-rewrite-middleware\": \"^0.1.6\",\n\"image-diff\": \"^1.6.3\",\n- \"jasmine-core\": \"^2.6.2\",\n+ \"jasmine-core\": \"^2.6.4\",\n\"karma\": \"^1.7.0\",\n\"karma-browserstack-launcher\": \"^1.2.0\",\n\"karma-chrome-launcher\": \"^2.1.1\",\n\"sass\": \"^0.5.0\",\n\"scss-bundle\": \"^2.0.1-beta.7\",\n\"selenium-webdriver\": \"^3.4.0\",\n- \"stylelint\": \"^7.10.1\",\n+ \"stylelint\": \"^7.11.1\",\n\"travis-after-modes\": \"0.0.7\",\n\"ts-node\": \"^3.0.4\",\n\"tslint\": \"^5.2.0\",\n"
}
] | TypeScript | MIT License | promact/md2 | chore: updated package dependencies with latest |
530,388 | 20.06.2017 12:27:01 | -19,080 | 3427fb1c8d6a7a6692224a3729ffba2a094a0444 | chore: updated tasks for AOT | [
{
"change_type": "MODIFY",
"old_path": "tools/gulp/tasks/aot.ts",
"new_path": "tools/gulp/tasks/aot.ts",
"diff": "@@ -3,19 +3,19 @@ import {join} from 'path';\nimport {DIST_ROOT} from '../constants';\nimport {execNodeTask, sequenceTask} from '../util/task_helpers';\n-/** Copies the source files of the demo-app to the dist folder. */\n-task('aot:copy', [':build:devapp:vendor', ':build:devapp:scss', ':build:devapp:assets']);\n-\n/**\n* Prepares the AOT compilation by copying the demo-app and building the components with their\n* associated metadata files from the Angular compiler.\n*/\n-task('aot:prepare', sequenceTask(\n- 'clean',\n- ['aot:copy', 'build:components', ':build:components:ngc'])\n+task('aot:deps', sequenceTask(\n+ 'build:devapp',\n+ ':build:components:release')\n);\n-/** Builds the demo-app with the Angular compiler to verify that all components work. */\n-task('aot:build', ['aot:prepare'], execNodeTask(\n- '@angular/compiler-cli', 'ngc', ['-p', join(DIST_ROOT, 'tsconfig-aot.json')])\n-);\n+/** Build the demo-app and a release to confirm that the library is AOT-compatible. */\n+task('aot:build', sequenceTask('aot:deps', 'aot:compiler-cli'));\n+\n+/** Build the demo-app and a release to confirm that the library is AOT-compatible. */\n+task('aot:compiler-cli', execNodeTask(\n+ '@angular/compiler-cli', 'ngc', ['-p', join(DIST_ROOT, 'tsconfig-aot.json')]\n+));\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | promact/md2 | chore: updated tasks for AOT |
530,388 | 21.06.2017 11:39:57 | -19,080 | a2550acfbd71f70fd290836c3fff38c4118343a6 | chore: update ts configurations | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/main-aot.ts",
"new_path": "src/demo-app/main-aot.ts",
"diff": "* This is the main entry-point for the AOT compilation. File will be used to test AOT support.\n*/\n-import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';\n+import {platformBrowser} from '@angular/platform-browser';\nimport {DemoAppModuleNgFactory} from './demo-app-module.ngfactory';\n-platformBrowserDynamic().bootstrapModuleFactory(DemoAppModuleNgFactory);\n+platformBrowser().bootstrapModuleFactory(DemoAppModuleNgFactory);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/tsconfig-aot.json",
"new_path": "src/demo-app/tsconfig-aot.json",
"diff": "/* Config file for the Angular Compiler. Paths need to be relative to the dist folder. */\n{\n+ \"extends\": \"./tsconfig\",\n\"compilerOptions\": {\n- \"emitDecoratorMetadata\": true,\n\"experimentalDecorators\": true,\n- \"lib\": [\"es6\", \"es2015\", \"dom\"],\n- \"module\": \"es2015\",\n- \"moduleResolution\": \"node\",\n- \"noEmitOnError\": true,\n- \"noImplicitAny\": true,\n- \"target\": \"es5\",\n- \"baseUrl\": \"\",\n- \"typeRoots\": [\n- \"../node_modules/@types/!(node)\"\n- ],\n- \"paths\": {\n- \"md2\": [\n- \"./md2\"\n- ]\n- }\n+ \"noUnusedParameters\": false,\n+ \"outDir\": \".\"\n},\n\"files\": [\n\"./demo-app-module.ts\",\n\"./main-aot.ts\"\n],\n\"angularCompilerOptions\": {\n- \"skipTemplateCodegen\": false,\n- \"debug\": true\n+ \"skipTemplateCodegen\": false\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/tsconfig.json",
"new_path": "src/demo-app/tsconfig.json",
"diff": "\"sourceMap\": true,\n\"target\": \"es5\",\n\"stripInternal\": false,\n- \"baseUrl\": \"\",\n+ \"baseUrl\": \".\",\n\"typeRoots\": [\n\"../../node_modules/@types/!(node)\"\n],\n\"paths\": {\n- \"md2\": [\n- \"../../dist/md2\"\n- ]\n+ \"md2\": [ \"../../dist/md2/index\" ]\n}\n},\n\"files\": [\n\"./demo-app-module.ts\",\n\"./system-config.ts\",\n\"./main.ts\"\n- ],\n- \"angularCompilerOptions\": {\n- \"genDir\": \"../../dist\",\n- \"skipTemplateCodegen\": true,\n- \"debug\": true\n- }\n+ ]\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update ts configurations |
530,388 | 21.06.2017 16:31:08 | -19,080 | a1a71e2ebfb8d0993d9013efe5578035d51ce3bd | chore: update demo AOT and ts configurations | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/main-aot.ts",
"new_path": "src/demo-app/main-aot.ts",
"diff": "* This is the main entry-point for the AOT compilation. File will be used to test AOT support.\n*/\n-import {platformBrowser} from '@angular/platform-browser';\n+import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';\nimport {DemoAppModuleNgFactory} from './demo-app-module.ngfactory';\n-platformBrowser().bootstrapModuleFactory(DemoAppModuleNgFactory);\n+platformBrowserDynamic().bootstrapModuleFactory(DemoAppModuleNgFactory);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/tsconfig-aot.json",
"new_path": "src/demo-app/tsconfig-aot.json",
"diff": "/* Config file for the Angular Compiler. Paths need to be relative to the dist folder. */\n{\n- \"extends\": \"./tsconfig\",\n\"compilerOptions\": {\n+ \"emitDecoratorMetadata\": true,\n\"experimentalDecorators\": true,\n- \"noUnusedParameters\": false,\n- \"outDir\": \".\"\n+ \"lib\": [\"es6\", \"es2015\", \"dom\"],\n+ \"module\": \"es2015\",\n+ \"moduleResolution\": \"node\",\n+ \"noEmitOnError\": true,\n+ \"noImplicitAny\": true,\n+ \"target\": \"es5\",\n+ \"baseUrl\": \"\",\n+ \"typeRoots\": [\n+ \"../node_modules/@types/!(node)\"\n+ ],\n+ \"paths\": {\n+ \"md2\": [\n+ \"./md2\"\n+ ]\n+ }\n},\n\"files\": [\n\"./demo-app-module.ts\",\n\"./main-aot.ts\"\n],\n\"angularCompilerOptions\": {\n- \"skipTemplateCodegen\": false\n+ \"skipTemplateCodegen\": false,\n+ \"debug\": true\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/tsconfig.json",
"new_path": "src/demo-app/tsconfig.json",
"diff": "\"declaration\": false,\n\"emitDecoratorMetadata\": true,\n\"experimentalDecorators\": true,\n- \"noUnusedParameters\": true,\n\"lib\": [\"es6\", \"es2015\", \"dom\"],\n\"module\": \"commonjs\",\n\"moduleResolution\": \"node\",\n\"sourceMap\": true,\n\"target\": \"es5\",\n\"stripInternal\": false,\n- \"baseUrl\": \".\",\n+ \"baseUrl\": \"\",\n\"typeRoots\": [\n\"../../node_modules/@types/!(node)\"\n],\n\"paths\": {\n- \"md2\": [ \"../../dist/md2/index\" ]\n+ \"md2\": [\n+ \"../../dist/md2\"\n+ ]\n}\n},\n\"files\": [\n\"./demo-app-module.ts\",\n\"./system-config.ts\",\n\"./main.ts\"\n- ]\n+ ],\n+ \"angularCompilerOptions\": {\n+ \"genDir\": \"../../dist\",\n+ \"skipTemplateCodegen\": true,\n+ \"debug\": true\n+ }\n}\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update demo AOT and ts configurations |
530,388 | 21.06.2017 16:32:42 | -19,080 | acdb4cfe2edce7e6ce71ee2a1cead56243295497 | chore: update library modules | [
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/index.ts",
"new_path": "src/lib/colorpicker/index.ts",
"diff": "@@ -29,9 +29,6 @@ export * from './color-util';\nColorpickerSliderDirective,\nTextDirective\n],\n- providers: [ColorUtil],\n- entryComponents: [\n- Md2Colorpicker,\n- ]\n+ providers: [ColorUtil]\n})\nexport class Md2ColorpickerModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/index.ts",
"new_path": "src/lib/datepicker/index.ts",
"diff": "@@ -31,7 +31,6 @@ export * from './date-util';\n],\nexports: [\nMd2Datepicker,\n- Md2DatepickerContent,\nMd2DatepickerToggle,\nMd2Calendar,\nMd2CalendarBody,\n@@ -53,7 +52,6 @@ export * from './date-util';\n],\nproviders: [DateLocale, DateUtil],\nentryComponents: [\n- Md2Datepicker,\nMd2DatepickerContent\n]\n})\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/dialog/index.ts",
"new_path": "src/lib/dialog/index.ts",
"diff": "@@ -26,8 +26,7 @@ import {\nMd2DialogContent,\nMd2DialogActions,\nMd2DialogPortal\n- ],\n- entryComponents: [Md2Dialog],\n+ ]\n})\nexport class Md2DialogModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/toast/index.ts",
"new_path": "src/lib/toast/index.ts",
"diff": "+import { NgModule } from '@angular/core';\n+import { CommonModule } from '@angular/common';\n+import { OverlayModule, MdCommonModule } from '../core';\n+import { PlatformModule } from '../core/platform/index';\n+import { Md2Toast, Md2ToastConfig, Md2ToastComponent } from './toast';\n+\nexport * from './toast';\n+\n+@NgModule({\n+ imports: [\n+ CommonModule,\n+ OverlayModule,\n+ MdCommonModule,\n+ PlatformModule\n+ ],\n+ exports: [Md2ToastComponent, MdCommonModule],\n+ declarations: [Md2ToastComponent],\n+ entryComponents: [Md2ToastComponent],\n+ providers: [Md2Toast, Md2ToastConfig],\n+})\n+export class Md2ToastModule { }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/toast/toast.html",
"new_path": "src/lib/toast/toast.html",
"diff": "<div *ngFor=\"let toast of toasts\"\nclass=\"md2-toast\"\n[class.in]=\"toast.isVisible\"\n- (click)=\"removeToast(toast.id)\">{{ toast.message }}</div>\n+ (click)=\"removeToast(toast.id)\"\n+ [innerHTML]=\"toast.message\">\n+</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/toast/toast.ts",
"new_path": "src/lib/toast/toast.ts",
"diff": "@@ -2,16 +2,13 @@ import {\nComponent,\nInjectable,\nViewContainerRef,\n- NgModule,\nViewEncapsulation,\n} from '@angular/core';\n-import { CommonModule } from '@angular/common';\nimport {\nOverlay,\nOverlayState,\nOverlayRef,\nComponentPortal,\n- OVERLAY_PROVIDERS\n} from '../core';\nexport class Toast {\n@@ -183,14 +180,3 @@ export class Md2ToastComponent {\nhasToast(): boolean { return this.toasts.length > 0; }\n}\n-\n-export const MD2_TOAST_DIRECTIVES: any[] = [Md2ToastComponent];\n-\n-@NgModule({\n- imports: [CommonModule],\n- exports: MD2_TOAST_DIRECTIVES,\n- declarations: MD2_TOAST_DIRECTIVES,\n- entryComponents: MD2_TOAST_DIRECTIVES,\n- providers: [Md2Toast, Md2ToastConfig, OVERLAY_PROVIDERS]\n-})\n-export class Md2ToastModule { }\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update library modules |
530,388 | 22.06.2017 10:12:39 | -19,080 | 2a5b43d29ad1c28f4d7df3be79417ecd7586212e | chore: update travis ci configurations and published tasks | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -31,11 +31,7 @@ before_deploy:\n- cd md2\ndeploy:\n- - provider: releases\n- api_key: $GH_TOKEN\n- on:\n- tags: true\n- - provider: npm\n+ provider: npm\nskip_cleanup: true\nemail: [email protected]\napi_key:\n@@ -43,7 +39,7 @@ deploy:\non:\nbranch: master\nrepo: Promact/md2\n- condition: \"/^deploy-.*$/\"\n+ condition: \"/^publish-.*$/\"\ncache:\ndirectories:\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/ci/deploy.sh",
"new_path": "scripts/ci/deploy.sh",
"diff": "# Go to the project root directory\ncd $(dirname $0)/../..\n-if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]] || [[ \"$TRAVIS_BRANCH\" != \"master\" ]]; then\n+COMMIT_MESSAGE=$(git log --oneline --format=%B --no-merges -n 1)\n+\n+if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]] || [[ \"$TRAVIS_BRANCH\" != \"master\" ]] || [[ $COMMIT_MESSAGE != \"publish-\"* ]];; then\necho \"Build artifacts and demo content will only be deployed in Travis push builds and branch is master.\"\nexit 0;\nfi\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/deploy/deploy-build.sh",
"new_path": "scripts/deploy/deploy-build.sh",
"diff": "@@ -44,7 +44,7 @@ git config user.email \"${commitAuthorEmail}\"\ngit add -A\ngit commit -m \"${commitMessage}\"\n-git tag \"${buildVersion}-${commitSha}\"\n+git tag \"${buildVersion}\"\ngit push origin ${branchName}\ngit push --tags\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/deploy/deploy.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-set -e # Exit with nonzero exit code if anything fails\n-\n-SOURCE_BRANCH=\"master\"\n-TARGET_BRANCH=\"gh-pages\"\n-COMMIT_MSG=`git log --format=%B --no-merges -n 1`\n-\n-# Pull requests and commits to other branches shouldn't try to deploy, just build to verify\n-if [ \"$TRAVIS_PULL_REQUEST\" != \"false\" ] || [ \"$TRAVIS_BRANCH\" != \"$SOURCE_BRANCH\" ]; then\n- echo \"Building demo-app\"\n- gulp build:devapp\n- exit 0\n-fi\n-\n-# Save some useful information\n-SHA=`git rev-parse --verify HEAD`\n-\n-# Clone the existing gh-pages for this repo into deploy/\n-git clone https://Promact:[email protected]/Promact/md2.git --depth 1 --branch=gh-pages deploy\n-\n-# Clean deploy existing contents\n-rm -rf deploy/**/* || exit 0\n-\n-# Deploy demo.\n-gulp rollup:prepare\n-npm run rollup\n-gulp deploy\n-\n-# Configure cloned repo.\n-cd deploy\n-git config --global user.email \"[email protected]\"\n-git config --global user.name \"Dharmesh Pipariya\"\n-\n-# Check if there are any changes or not.\n-if [ -z `git diff --exit-code` ]; then\n- echo \"Demo already updated.\"\n- exit 0\n-fi\n-\n-# Commit changes and Push Demo\n-git add -A .\n-git commit -m \"Update demo: ${SHA}\"\n-git push origin $TARGET_BRANCH\n-echo \"Demo deployed\"\n\\ No newline at end of file\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update travis ci configurations and published tasks |
530,388 | 22.06.2017 10:41:52 | -19,080 | 548269ab2c1784077db0c47bc61e4400c39df402 | chore: fixed deploy scripts | [
{
"change_type": "MODIFY",
"old_path": "scripts/ci/deploy.sh",
"new_path": "scripts/ci/deploy.sh",
"diff": "@@ -8,7 +8,7 @@ cd $(dirname $0)/../..\nCOMMIT_MESSAGE=$(git log --oneline --format=%B --no-merges -n 1)\n-if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]] || [[ \"$TRAVIS_BRANCH\" != \"master\" ]] || [[ $COMMIT_MESSAGE != \"publish-\"* ]];; then\n+if [[ \"$TRAVIS_PULL_REQUEST\" != \"false\" ]] || [[ \"$TRAVIS_BRANCH\" != \"master\" ]] || [[ $COMMIT_MESSAGE != \"publish-\"* ]]; then\necho \"Build artifacts and demo content will only be deployed in Travis push builds and branch is master.\"\nexit 0;\nfi\n"
}
] | TypeScript | MIT License | promact/md2 | chore: fixed deploy scripts |
530,388 | 22.06.2017 12:21:35 | -19,080 | 25fed8d5ecfc07cdaff593edcb7dba73fe23c50a | fix(chips) autocomplete-item-value binding issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.html",
"new_path": "src/lib/chips/chips.html",
"diff": "<form #chipInputForm=\"ngForm\" class=\"chip-input-form\">\n<input *ngIf=\"!isAutoComplete\" class=\"chip-input\" [disabled]=\"disabled\" [type]=\"type\" [(ngModel)]=\"inputValue\" name=\"chipInput\" [placeholder]=\"placeholder\" (paste)=\"inputPaste($event)\" (keydown)=\"inputChanged($event)\" (blur)=\"inputBlurred()\" (focus)=\"inputFocus()\" />\n<div *ngIf=\"isAutoComplete\">\n- <md2-autocomplete [items]=\"autocompleteDataList\"\n+ <md2-autocomplete name=\"autocomplete\"\n+ [placeholder]=\"placeholder\"\n+ [disabled]=\"disabled\"\n+ [(ngModel)]=\"item\"\n+ [items]=\"autocompleteDataList\"\n[item-text]=\"autocompleteItemText\"\n- [(ngModel)]=\"item\" name=\"autocomplete\" [disabled]=\"disabled\" (textChange)=\"valueupdate($event)\" (change)=\"changeAutocomplete($event)\" [placeholder]=\"placeholder\" (keydown)=\"inputChanged($event)\" (click)=\"getFocusAutocomplete()\">\n+ (textChange)=\"valueupdate($event)\"\n+ (change)=\"changeAutocomplete($event)\"\n+ (keydown)=\"inputChanged($event)\"\n+ (click)=\"getFocusAutocomplete()\">\n</md2-autocomplete>\n</div>\n</form>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -310,7 +310,7 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\nif (this.maxChips && this.maxChips < this.chipItemList.length - 1) {\nreturn;\n} else {\n- this.chipItemList.push(new Chip(chips, this.textKey, this.valueKey));\n+ this.chipItemList.push(new Chip(chips, this.autocompleteItemText, this.autocompleteItemValue));\nthis.item = null;\n}\n}\n@@ -357,7 +357,16 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\n*/\nprivate updateValue() {\nthis._value = new Array<any>();\n- this._value = this.chipItemList.map((chip: any) => chip.value);\n+ this._value = this.chipItemList.map((chip: any) => {\n+ if (this.valueKey) {\n+ let c: any = {};\n+ c[this.textKey] = chip.text;\n+ c[this.valueKey] = chip.value;\n+ return c;\n+ } else {\n+ return chip.value;\n+ }\n+ });\nthis._emitChangeEvent();\n}\n"
}
] | TypeScript | MIT License | promact/md2 | fix(chips) autocomplete-item-value binding issue #240 |
530,388 | 27.06.2017 16:46:43 | -19,080 | e4d2a403f1c75d08a455f3d805e458904df6bf81 | fix(datepicker) intl support cross browser issue with time | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/date-locale.ts",
"new_path": "src/lib/datepicker/date-locale.ts",
"diff": "import { Injectable } from '@angular/core';\n-const SUPPORTS_INTL_API = typeof Intl != 'undefined';\n+const SUPPORTS_INTL_API = false; // typeof Intl != 'undefined';\n/** The default month names to use if Intl API is not available. */\n"
}
] | TypeScript | MIT License | promact/md2 | fix(datepicker) intl support cross browser issue with time #250 |
530,388 | 28.06.2017 15:11:44 | -19,080 | e99af7fd825d32f7e27eaefdfc58ea88c351b5d9 | chore: update accordion performance | [
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/accordion.scss",
"new_path": "src/lib/accordion/accordion.scss",
"diff": "@@ -71,7 +71,6 @@ md2-accordion-tab {\n.md2-accordion-tab-body {\nposition: relative;\n- overflow: hidden;\n}\n.md2-accordion-tab-content {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/accordiontab.ts",
"new_path": "src/lib/accordion/accordiontab.ts",
"diff": "@@ -35,18 +35,16 @@ export class Md2AccordionHeader { }\nstyleUrls: ['accordion.css'],\nanimations: [\ntrigger('slide', [\n- state('up', style({ height: 0 })),\n- state('down', style({ height: '*' })),\n+ state('up', style({ height: 0, overflow: 'hidden' })),\n+ state('down', style({ height: '*', overflow: 'visible' })),\ntransition('down => up', [\n- style({ height: '*' }),\n- animate(300, style({\n- height: 0\n- }))\n+ style({ height: '*', overflow: 'visible' }),\n+ animate(300, style({ height: 0, overflow: 'hidden' }))\n]),\ntransition('up => down', [\n- style({ height: 0 }),\n+ style({ height: 0, overflow: 'hidden' }),\nanimate(300, style({\n- height: '*'\n+ height: '*', overflow: 'visible'\n}))\n])\n])\n"
}
] | TypeScript | MIT License | promact/md2 | chore: update accordion performance |
530,388 | 28.06.2017 15:31:16 | -19,080 | 2756c399b3500ab128b07e8f800036b650f11f9a | chore(accordion) refactor overflow issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/accordion.scss",
"new_path": "src/lib/accordion/accordion.scss",
"diff": "@@ -71,6 +71,11 @@ md2-accordion-tab {\n.md2-accordion-tab-body {\nposition: relative;\n+ overflow: hidden;\n+\n+ md2-accordion-tab.md2-accordion-tab-active & {\n+ overflow: visible;\n+ }\n}\n.md2-accordion-tab-content {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/accordion/accordiontab.ts",
"new_path": "src/lib/accordion/accordiontab.ts",
"diff": "@@ -35,16 +35,16 @@ export class Md2AccordionHeader { }\nstyleUrls: ['accordion.css'],\nanimations: [\ntrigger('slide', [\n- state('up', style({ height: 0, overflow: 'hidden' })),\n- state('down', style({ height: '*', overflow: 'visible' })),\n+ state('up', style({ height: 0 })),\n+ state('down', style({ height: '*' })),\ntransition('down => up', [\n- style({ height: '*', overflow: 'visible' }),\n- animate(300, style({ height: 0, overflow: 'hidden' }))\n+ style({ height: '*' }),\n+ animate(300, style({ height: 0 }))\n]),\ntransition('up => down', [\n- style({ height: 0, overflow: 'hidden' }),\n+ style({ height: 0 }),\nanimate(300, style({\n- height: '*', overflow: 'visible'\n+ height: '*'\n}))\n])\n])\n"
}
] | TypeScript | MIT License | promact/md2 | chore(accordion) refactor overflow issue |
530,396 | 18.07.2017 15:10:50 | -19,080 | 40c9f27acf33a558b829ee13af73f32793c46c31 | Solved issue -Chips no longer works with pasting from the clipboard | [
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -255,10 +255,8 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\ninputPaste(event: any): void {\nlet clipboardData = event.clipboardData ||\n(event.originalEvent && event.originalEvent.clipboardData);\n- let pastedString = clipboardData.getData('text/plain');\n- let chips = this.addRegExpString(pastedString);\n- let chipsToAdd = chips.filter((chip) => this._isValid(chip));\n- this.addNewChip(chipsToAdd);\n+ let pastedString = clipboardData.getData('text/plain').trim();\n+ this.addNewChip(pastedString);\nsetTimeout(() => this._resetInput());\n}\n@@ -283,11 +281,6 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\n}\n}\n- private addRegExpString(chipInputString: string): string[] {\n- chipInputString = chipInputString.trim();\n- let chips = chipInputString.split(this.splitRegExp);\n- return chips.filter((chip) => !!chip);\n- }\nprivate _isValid(chipString: any): boolean {\nlet typeString = typeof chipString;\n"
}
] | TypeScript | MIT License | promact/md2 | Solved issue :#220 -Chips no longer works with pasting from the clipboard |
530,396 | 20.07.2017 14:18:13 | -19,080 | 321ca590a281efffb4088a50d545a8c3c7580952 | Solved Custom Id for md2-datepicker | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.html",
"new_path": "src/demo-app/datepicker/datepicker-demo.html",
"diff": "[touchUi]=\"touch\"\n[startView]=\"startView\"\n[format]=\"dateFormat\"\n- #dateControl=\"ngModel\"></md2-datepicker>\n+ #dateControl=\"ngModel\"\n+ [id]=\"customID\"></md2-datepicker>\n<br />\n<span class=\"error-helper\" *ngIf=\"dateControl.touched && dateControl.errors?.required\">Date is Required!</span>\n<span class=\"error-helper\" *ngIf=\"dateControl.hasError('md2DatepickerMin')\">Too early!</span>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.ts",
"new_path": "src/demo-app/datepicker/datepicker-demo.ts",
"diff": "@@ -54,6 +54,7 @@ export class DatepickerDemo {\nminDate: Date;\nmaxDate: Date;\nstartAt: Date;\n+ customID: string = \"datepicker-id\";\ndateFormat: string = null;\ndateFormatsDateTime: Array<any> = [\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -145,7 +145,7 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\n@Input() mode: 'auto' | 'portrait' | 'landscape' = 'auto';\n@Input() placeholder: string;\n@Input() timeInterval: number = 1;\n-\n+ @Input() id: string;\n@Input()\nget type() { return this._type; }\n@@ -242,9 +242,6 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\n/** Whether the calendar is open. */\nopened = false;\n- /** The id for the datepicker calendar. */\n- id = `md2-datepicker-${datepickerUid++}`;\n-\n/** The currently selected date. */\n_selected: Date = null;\n@@ -290,6 +287,8 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\nprivate _locale: DateLocale,\nprivate _util: DateUtil,\n@Optional() private _dir: Dir) {\n+ /** The id for the datepicker calendar. */\n+ this.id = (this.id) ? this.id : `md2-datepicker-${datepickerUid++}`;\n}\nngOnDestroy() {\n"
}
] | TypeScript | MIT License | promact/md2 | Solved #254 Custom Id for md2-datepicker |
530,396 | 20.07.2017 16:21:05 | -19,080 | ca8172f51478a06b8db41820e64e56e26c912648 | solved duplicate values in chips using in autocomplete | [
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -284,11 +284,14 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\nprivate _isValid(chipString: any): boolean {\nlet typeString = typeof chipString;\n+ let isExist: any;\nif (typeString === 'string') {\nchipString = chipString.trim();\n- }\n- let isExist: any;\nisExist = this.chipItemList.filter((chip) => chip.text === chipString);\n+ }\n+ else {\n+ isExist = this.chipItemList.filter((chip) => chip.text === chipString.text);\n+ }\nif (this.chipItemList.indexOf(chipString) === -1 && (isExist.length ? false : true)) {\nreturn this.allowedPattern.test(chipString);\n}\n"
}
] | TypeScript | MIT License | promact/md2 | solved duplicate values in chips using in autocomplete |
530,396 | 26.07.2017 16:03:45 | -19,080 | 7aac1fb3c4005fe2500fb1c9eb2bbf2ec337f828 | solved tslint issue | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/datepicker/datepicker-demo.ts",
"new_path": "src/demo-app/datepicker/datepicker-demo.ts",
"diff": "@@ -54,7 +54,7 @@ export class DatepickerDemo {\nminDate: Date;\nmaxDate: Date;\nstartAt: Date;\n- customID: string = \"datepicker-id\";\n+ customID: string = 'datepicker-id';\ndateFormat: string = null;\ndateFormatsDateTime: Array<any> = [\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.ts",
"new_path": "src/lib/chips/chips.ts",
"diff": "@@ -281,15 +281,13 @@ export class Md2Chips implements ControlValueAccessor, AfterContentInit {\n}\n}\n-\nprivate _isValid(chipString: any): boolean {\nlet typeString = typeof chipString;\nlet isExist: any;\nif (typeString === 'string') {\nchipString = chipString.trim();\nisExist = this.chipItemList.filter((chip) => chip.text === chipString);\n- }\n- else {\n+ } else {\nisExist = this.chipItemList.filter((chip) => chip.text === chipString.text);\n}\nif (this.chipItemList.indexOf(chipString) === -1 && (isExist.length ? false : true)) {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.ts",
"new_path": "src/lib/datepicker/datepicker.ts",
"diff": "@@ -287,7 +287,6 @@ export class Md2Datepicker implements OnDestroy, ControlValueAccessor {\nprivate _locale: DateLocale,\nprivate _util: DateUtil,\n@Optional() private _dir: Dir) {\n- /** The id for the datepicker calendar. */\nthis.id = (this.id) ? this.id : `md2-datepicker-${datepickerUid++}`;\n}\n"
}
] | TypeScript | MIT License | promact/md2 | solved tslint issue |
530,396 | 04.08.2017 10:34:19 | -19,080 | 950a66bd4b503bbc0bffb85e6f7e9f98e38e42af | fix DataTable: pagination label could be an attribute | [
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/data-table.scss",
"new_path": "src/lib/data-table/data-table.scss",
"diff": "@@ -105,6 +105,11 @@ md2-pagination {\ncolor: rgba(black, 0.54);\nline-height: 36px;\n+ label{\n+ vertical-align: sub;\n+ margin-right: 10px;\n+ }\n+\nmd2-select {\ndisplay: inline-block;\nborder: 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/data-table.ts",
"new_path": "src/lib/data-table/data-table.ts",
"diff": "@@ -273,6 +273,7 @@ export class Md2Pagination {\n@Input() rowsPerPageSet: any = [];\n@Input() md2Table: Md2DataTable;\n+ @Input() paginationLabel: string = 'Rows per page:';\n_rowsPerPage: number;\n_dataLength: number = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/pagination.html",
"new_path": "src/lib/data-table/pagination.html",
"diff": "</li>\n</ul>\n<div class=\"md2-rows-select\" *ngIf=\"rowsPerPageSet.length && _dataLength > 0\">\n- Rows per page:\n+ <label>{{paginationLabel}}</label>\n<md2-select [(ngModel)]=\"_rowsPerPage\" (change)=\"_setRows($event)\">\n<md2-option *ngFor=\"let row of rowsPerPageSet\" [value]=\"row\">{{row}}</md2-option>\n</md2-select>\n"
}
] | TypeScript | MIT License | promact/md2 | fix (#268) DataTable: pagination label could be an attribute |
530,396 | 04.08.2017 10:37:26 | -19,080 | 614df1b99e2f2adff8407946071ea8ed1bf64958 | add label attribute | [
{
"change_type": "MODIFY",
"old_path": "src/demo-app/data-table/data-table-demo.html",
"new_path": "src/demo-app/data-table/data-table-demo.html",
"diff": "<tfoot>\n<tr>\n<td colspan=\"4\">\n- <md2-pagination [rowsPerPageSet]=\"[5,10,15]\" ></md2-pagination>\n+ <md2-pagination [rowsPerPageSet]=\"[5,10,15]\" paginationLabel=\"Rows per page\"></md2-pagination>\n</td>\n</tr>\n</tfoot>\n"
}
] | TypeScript | MIT License | promact/md2 | add label attribute |
530,396 | 10.08.2017 14:06:37 | -19,080 | 7460d779958e5f887201d0abb40d49677a49064b | Fix(auto complete) Md2Autocomplete and textChange emit old value | [
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.ts",
"new_path": "src/lib/autocomplete/autocomplete.ts",
"diff": "@@ -194,6 +194,10 @@ export class Md2Autocomplete implements AfterContentInit, ControlValueAccessor {\n* input event listner\n* @param event\n*/\n+ _handleKeyup(event: KeyboardEvent) {\n+ this.textChange.emit(this._inputValue);\n+ }\n+\n_handleKeydown(event: KeyboardEvent) {\nif (this.disabled) { return; }\nthis.textChange.emit(this._inputValue);\n"
}
] | TypeScript | MIT License | promact/md2 | Fix(auto complete) #272 Md2Autocomplete and textChange emit old value |
530,396 | 10.08.2017 14:47:27 | -19,080 | 92bb7c56841a21b18368482d654a9a670a01fbc7 | fix (autocomplte) set change event on keyup | [
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.ts",
"new_path": "src/lib/autocomplete/autocomplete.ts",
"diff": "@@ -200,7 +200,6 @@ export class Md2Autocomplete implements AfterContentInit, ControlValueAccessor {\n_handleKeydown(event: KeyboardEvent) {\nif (this.disabled) { return; }\n- this.textChange.emit(this._inputValue);\nswitch (event.keyCode) {\ncase TAB: this._handleMouseLeave(); break;\ncase ESCAPE:\n"
}
] | TypeScript | MIT License | promact/md2 | fix (autocomplte) set change event on keyup |
530,396 | 05.10.2017 17:56:16 | -19,080 | 8f46ef35646d89f319c3d6dc5cbd61d4a02600ba | Solved select issue | [
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.ts",
"new_path": "src/lib/select/select.ts",
"diff": "@@ -574,8 +574,7 @@ export class Md2Select implements AfterContentInit, OnDestroy, OnInit, ControlVa\n*/\nprivate _selectValue(value: any): Md2Option {\nlet optionsArray = this.options.toArray();\n- let correspondingOption = optionsArray.find(option =>\n- option.value && this.equals(option.value, value));\n+ let correspondingOption = optionsArray.find(option => option.value != null && option.value != undefined && this.equals(option.value, value));\nif (correspondingOption) {\ncorrespondingOption.select();\n"
}
] | TypeScript | MIT License | promact/md2 | Solved select issue |
530,391 | 25.10.2017 14:28:18 | -10,800 | 14fa4ad0e8861dccb1e38478e94d060452bd58ad | Fixed autocomplete to trim inputValue from redundant spaces | [
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.ts",
"new_path": "src/lib/autocomplete/autocomplete.ts",
"diff": "@@ -322,7 +322,7 @@ export class Md2Autocomplete implements AfterContentInit, ControlValueAccessor {\nthis._list = [];\n} else {\nthis._list = this._items.map((i: any) => new Item(i, this.textKey,\n- this.valueKey)).filter(i => new RegExp(this._inputValue, 'ig').test(i.text));\n+ this.valueKey)).filter(i => new RegExp(this._inputValue.trim(), 'ig').test(i.text));\nif (this._list.length && this._list[0].text !== this._inputValue) {\nthis.selectedItem = null;\n}\n"
}
] | TypeScript | MIT License | promact/md2 | Fixed autocomplete to trim inputValue from redundant spaces |
530,401 | 18.01.2018 16:51:38 | -3,600 | 5694ed226accbadcf356d4a2349dc246e3c90129 | Fix typo in dateFilter property description | [
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/README.md",
"new_path": "src/lib/datepicker/README.md",
"diff": "@@ -17,7 +17,7 @@ Datepicker allow the user to select date and time.\n| `timeInterval` | `number` | Select minutes in specific time interval, default is 1. |\n| `openOnFocus` | `boolean` | Opend Calendar Whether or not the datepicker is openOnFocus. |\n| `isOpen` | `boolean` | Opend Calendar Whether or not the datepicker is isOpen. |\n-| `dateFilter` | `(Date|null) => boolean` | Filter Dates for enabled with return boolean. |\n+| `dateFilter` | `(Date`|`null) => boolean` | Filter Dates for enabled with return boolean. |\n| `mode` | `'auto'` | `'portrait'` | `'landscape'` | Mode of the Datepicker, default auto. |\n| `touchUi` | `boolean` | Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather than a popup and elements have more padding to allow for bigger touch targets. |\n| `startAt` | `Date` | The date to open the calendar to initially. |\n"
}
] | TypeScript | MIT License | promact/md2 | Fix typo in dateFilter property description |
530,396 | 25.10.2018 17:12:08 | -19,080 | f0131a7ca0bb5c8804f6ea85e7db80fd7deb3963 | auto compplete - color and backspace issue
chips- set floating label
colorpicker,datepicker,select - set * color
table - added total entries code | [
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.scss",
"new_path": "src/lib/autocomplete/autocomplete.scss",
"diff": "@@ -87,6 +87,7 @@ md2-autocomplete.md2-autocomplete-disabled .md2-autocomplete-input {\n[aria-required=true] &::after {\ncontent: '*';\n+ color: #FD0F0F;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.ts",
"new_path": "src/lib/autocomplete/autocomplete.ts",
"diff": "@@ -195,6 +195,9 @@ export class Md2Autocomplete implements AfterContentInit, ControlValueAccessor {\n* @param event\n*/\n_handleKeyup(event: KeyboardEvent) {\n+ if (this._inputValue === '' || this._inputValue === null) {\n+ this._onClear()\n+ }\nthis.textChange.emit(this._inputValue);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.html",
"new_path": "src/lib/chips/chips.html",
"diff": "<div class=\"md2-chips-container\" [class.md2-chip-disabled]=\"disabled\" [class.md2-chip-remove]=\"!isRemovable\">\n+ <span class=\"md2-chip-placeholder\" [class.md2-floating-placeholder]=\"inputValue || chipItemList.length>0\">{{ placeholder }}</span>\n<span *ngFor=\"let chip of chipItemList; let i = index\" class=\"md2-chip\" [class.active]=\"selectedChip === i\">\n<span>{{chip.text}}</span>\n<span [innerHTML]=\"templateHtmlString\"></span>\n<input *ngIf=\"!isAutoComplete\" class=\"chip-input\" [disabled]=\"disabled\" [type]=\"type\" [(ngModel)]=\"inputValue\" name=\"chipInput\" [placeholder]=\"placeholder\" (paste)=\"inputPaste($event)\" (keydown)=\"inputChanged($event)\" (blur)=\"inputBlurred()\" (focus)=\"inputFocus()\" />\n<div *ngIf=\"isAutoComplete\">\n<md2-autocomplete name=\"autocomplete\"\n- [placeholder]=\"placeholder\"\n+ [placeholder]=\"chipItemList.length<1 ? placeholder: ''\"\n[disabled]=\"disabled\"\n[(ngModel)]=\"item\"\n[items]=\"autocompleteDataList\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.scss",
"new_path": "src/lib/chips/chips.scss",
"diff": "@@ -13,6 +13,7 @@ md2-chips {\nmin-height: 50px;\nbox-sizing: border-box;\nclear: both;\n+ position:relative;\n}\n.md2-chips-container::after {\n@@ -23,6 +24,7 @@ md2-chips {\n&.chip-input-focus .md2-chips-container {\nbox-shadow: 0 2px #0d8bff;\n+ .md2-chip-placeholder{color:#0d8bff;}\n}\n.md2-chip-disabled {\n@@ -130,6 +132,27 @@ md2-chips {\ncolor: #fd0f0f;\n}\n+.md2-chip-placeholder{\n+ position: absolute;\n+ display:none;\n+ max-width: 100%;\n+ padding-left: 3px;\n+ padding-right: 0;\n+ color: rgba(0,0,0,.38);\n+ overflow: hidden;\n+ text-overflow: ellipsis;\n+ white-space: nowrap;\n+ pointer-events: none;\n+ z-index: 1;\n+\n+ &.md2-floating-placeholder {\n+ top: -10px;\n+ left: -2px;\n+ text-align: left;\n+ transform: scale(0.80);\n+ display:block;\n+ }\n+}\n.md2-chips-container {\n.chip-input-form .md2-autocomplete-wrap {\nborder-bottom: 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.scss",
"new_path": "src/lib/colorpicker/colorpicker.scss",
"diff": "@@ -91,6 +91,7 @@ $warn: #f44336 !default;\n[aria-required=true] &::after {\ncontent: '*';\n+ color: #FD0F0F;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/data-table.scss",
"new_path": "src/lib/data-table/data-table.scss",
"diff": "@@ -107,7 +107,6 @@ md2-pagination {\nlabel {\nvertical-align: sub;\n- margin-right: 10px;\n}\nmd2-select {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/data-table.ts",
"new_path": "src/lib/data-table/data-table.ts",
"diff": "@@ -279,6 +279,16 @@ export class Md2Pagination {\n_dataLength: number = 0;\n_lastPage: number;\n+ getPageDataRangeLabel = (rowsPerPage: number, activePage: number, dataLength: number) => {\n+ if (dataLength == 0 || rowsPerPage == 0) { return `0 of ${dataLength}`; }\n+ dataLength = Math.max(dataLength, 0);\n+ const startIndex = activePage * rowsPerPage;\n+ const endIndex = startIndex < dataLength ?\n+ Math.min(startIndex + rowsPerPage, dataLength) :\n+ startIndex + rowsPerPage;\n+\n+ return `${startIndex + 1} - ${endIndex} of ${dataLength}`;\n+ }\nconstructor( @Optional() private _dataTable: Md2DataTable) { }\nngDoCheck() {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/data-table/pagination.html",
"new_path": "src/lib/data-table/pagination.html",
"diff": "<md2-select [(ngModel)]=\"_rowsPerPage\" (change)=\"_setRows($event)\">\n<md2-option *ngFor=\"let row of rowsPerPageSet\" [value]=\"row\">{{row}}</md2-option>\n</md2-select>\n+ <label> {{getPageDataRangeLabel(_rowsPerPage,_activePage-1, _dataLength)}}</label>\n</div>\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.scss",
"new_path": "src/lib/datepicker/datepicker.scss",
"diff": "@@ -127,6 +127,7 @@ md2-datepicker {\n[aria-required=true] &::after {\ncontent: '*';\n+ color: #FD0F0F;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.scss",
"new_path": "src/lib/select/select.scss",
"diff": "@@ -91,6 +91,7 @@ $md2-select-trigger-font-size: 16px !default;\n[aria-required=true] &::after {\ncontent: '*';\n+ color: #FD0F0F;\n}\n}\n"
}
] | TypeScript | MIT License | promact/md2 | auto compplete - color and backspace issue
chips- set floating label
colorpicker,datepicker,select - set * color
table - added total entries code |
530,396 | 23.11.2018 10:30:37 | -19,080 | a7639ec012f42fb3d3c461080a8e7653c3f27f9d | change colro code in style and solve lint isues | [
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.scss",
"new_path": "src/lib/autocomplete/autocomplete.scss",
"diff": "@@ -87,7 +87,7 @@ md2-autocomplete.md2-autocomplete-disabled .md2-autocomplete-input {\n[aria-required=true] &::after {\ncontent: '*';\n- color: #FD0F0F;\n+ color: #fd0f0f;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/autocomplete/autocomplete.ts",
"new_path": "src/lib/autocomplete/autocomplete.ts",
"diff": "@@ -196,7 +196,7 @@ export class Md2Autocomplete implements AfterContentInit, ControlValueAccessor {\n*/\n_handleKeyup(event: KeyboardEvent) {\nif (this._inputValue === '' || this._inputValue === null) {\n- this._onClear()\n+ this._onClear();\n}\nthis.textChange.emit(this._inputValue);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/chips/chips.scss",
"new_path": "src/lib/chips/chips.scss",
"diff": "@@ -138,7 +138,7 @@ md2-chips {\nmax-width: 100%;\npadding-left: 3px;\npadding-right: 0;\n- color: rgba(0,0,0,.38);\n+ color: rgba(0, 0, 0, 0.38);\noverflow: hidden;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/colorpicker/colorpicker.scss",
"new_path": "src/lib/colorpicker/colorpicker.scss",
"diff": "@@ -91,7 +91,7 @@ $warn: #f44336 !default;\n[aria-required=true] &::after {\ncontent: '*';\n- color: #FD0F0F;\n+ color: #fd0f0f;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/datepicker/datepicker.scss",
"new_path": "src/lib/datepicker/datepicker.scss",
"diff": "@@ -127,7 +127,7 @@ md2-datepicker {\n[aria-required=true] &::after {\ncontent: '*';\n- color: #FD0F0F;\n+ color: #fd0f0f;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/lib/select/select.scss",
"new_path": "src/lib/select/select.scss",
"diff": "@@ -91,7 +91,8 @@ $md2-select-trigger-font-size: 16px !default;\n[aria-required=true] &::after {\ncontent: '*';\n- color: #FD0F0F;\n+ color: #fd0f0f;\n+\n}\n}\n"
}
] | TypeScript | MIT License | promact/md2 | change colro code in style and solve lint isues |
377,522 | 16.01.2017 17:14:36 | -10,800 | 0773d9e1a04eafe1e7ac4fb1b9be2b0b85559699 | Add python3.6 in runtests, set default retrieve_refs to True, update changelog | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG",
"new_path": "CHANGELOG",
"diff": "- Performance improvements in :py:func:`pyteomics.electrochem.pI`.\n+ - Fix the issue in :py:mod:`pyteomics.xml` which resulted in very long processing times for indexed XML files\n+ with a byte ordering mark (BOM).\n+\n+ - Change default value of ``retrieve_refs`` in :py:func:`pyteomics.mzid.read` to :py:const:`True`.\n+\n+ - Preserve unit information extracted from cvParam tags in PSI XML files.\n+\n3.4\n---\n"
},
{
"change_type": "MODIFY",
"old_path": "VERSION",
"new_path": "VERSION",
"diff": "-3.4.1a5\n\\ No newline at end of file\n+3.4.1a6\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/mzid.py",
"new_path": "pyteomics/mzid.py",
"diff": "@@ -157,7 +157,7 @@ def read(source, **kwargs):\nretrieve_refs : bool, optional\nIf :py:const:`True`, additional information from references will be\nautomatically added to the results. The file processing time will\n- increase. Default is :py:const:`False`.\n+ increase. Default is :py:const:`True`.\niterative : bool, optional\nSpecifies whether iterative XML parsing should be used. Iterative\n@@ -177,10 +177,11 @@ def read(source, **kwargs):\ncreated :py:class:`MzIdentML` instance. Default value is the value of\n`retrieve_refs`.\n+ .. note:: This parameter is ignored when ``use_index`` is ``True`` (default).\n+\nuse_index : bool, optional\nDefines whether an index of byte offsets needs to be created for\n- the indexed elements. If :py:const:`True`, `build_id_cache` is ignored.\n- Default is :py:const:`False`.\n+ the indexed elements. If :py:const:`True` (default), `build_id_cache` is ignored.\nindexed_tags : container of bytes, optional\nDefines which elements need to be indexed. Empty set by default.\n@@ -191,10 +192,8 @@ def read(source, **kwargs):\nAn iterator over the dicts with PSM properties.\n\"\"\"\nkwargs = kwargs.copy()\n- if kwargs.get('use_index'):\n- kwargs['build_id_cache'] = False\n- kwargs['build_id_cache'] = kwargs.get('build_id_cache',\n- kwargs.get('retrieve_refs'))\n+ kwargs.setdefault('retrieve_refs', True)\n+ kwargs['build_id_cache'] = kwargs.get('build_id_cache', kwargs.get('retrieve_refs'))\nreturn MzIdentML(source, **kwargs)\ndef iterfind(source, path, **kwargs):\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/xml.py",
"new_path": "pyteomics/xml.py",
"diff": "@@ -878,8 +878,8 @@ class IndexedXML(XML):\nelements listed in `indexed_tags`.\nThis is useful for random access to spectra in mzML or elements of mzIdentML files,\nor for iterative parsing of mzIdentML with ``retrieve_refs=True``.\n- If :py:const:`True`, `build_id_cache`\n- is ignored. If :py:const:`False`, the object acts exactly like :py:class:`XML`.\n+ If :py:const:`True`, `build_id_cache` is ignored.\n+ If :py:const:`False`, the object acts exactly like :py:class:`XML`.\nDefault is :py:const:`True`.\nindexed_tags : container of bytes, optional\nIf `use_index` is :py:const:`True`, elements listed in this parameter\n@@ -917,8 +917,7 @@ class IndexedXML(XML):\nif not self._indexed_tags or not self._use_index:\nreturn\nself._offset_index = FlatTagSpecificXMLByteIndex(\n- self._source, self._indexed_tags,\n- self._indexed_tag_keys)\n+ self._source, self._indexed_tags, self._indexed_tag_keys)\n@_keepstate\ndef _find_by_id_reset(self, elem_id, id_key=None):\n@@ -945,8 +944,6 @@ class IndexedXML(XML):\noffset = index[elem_id]\nself._source.seek(offset)\nelem = self._find_by_id_no_reset(elem_id, id_key=id_key)\n- data = self._get_info_smart(elem, **kwargs)\n- return data\nexcept (KeyError, etree.LxmlError):\nelem = self._find_by_id_reset(elem_id, id_key=id_key)\ndata = self._get_info_smart(elem, **kwargs)\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/runtests.sh",
"new_path": "tests/runtests.sh",
"diff": "#!/bin/bash\nexport PYTHONPATH=\"..\"\nif [ $# -eq 0 ]; then\n- find . -name 'test_*.py' -exec bash -c 'declare -a versions=(2.7 3.3 3.4 3.5); for v in \"${versions[@]}\"; do echo \"Executing python${v} $0\"; eval \"python${v}\" \"$0\"; done' {} \\;\n+ find . -name 'test_*.py' -exec bash -c 'declare -a versions=(2.7 3.3 3.4 3.5 3.6); for v in \"${versions[@]}\"; do echo \"Executing python${v} $0\"; eval \"python${v}\" \"$0\"; done' {} \\;\nelse\nfor f; do\n- for v in 2.7 3.3 3.4 3.5; do\n+ for v in 2.7 3.3 3.4 3.5 3.6; do\necho \"Executing python${v}\" \"$f\"\neval \"python${v}\" \"$f\"\ndone\n"
}
] | Python | Apache License 2.0 | levitsky/pyteomics | Add python3.6 in runtests, set default retrieve_refs to True, update changelog |
377,522 | 20.02.2017 00:36:32 | -10,800 | 8c50c6abb8636c79575935ecd2debf281955a64a | Fixes and basic tests for mass.isotopologues | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG",
"new_path": "CHANGELOG",
"diff": "- Fix the issue in :py:mod:`pyteomics.xml` which resulted in very long processing times for indexed XML files\nwith a byte ordering mark (BOM).\n+ - Fix in :py:mod:`pyteomics.mzxml`.\n+\n- Change default value of ``retrieve_refs`` in :py:func:`pyteomics.mzid.read` to :py:const:`True`.\n- Preserve unit information extracted from cvParam tags in PSI XML files.\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/mass/mass.py",
"new_path": "pyteomics/mass/mass.py",
"diff": "@@ -45,6 +45,9 @@ Isotopic abundances\nabundant isotopic composition for a molecule defined by a\npolypeptide sequence, chemical formula or elemental composition.\n+ :py:func:`isotopologues` - iterate over possible isotopic conposition of a molecule,\n+ possibly filtered by abundance.\n+\nData\n----\n@@ -623,6 +626,8 @@ def isotopic_composition_abundance(*args, **kwargs):\ndef isotopologues(*args, **kwargs):\n\"\"\"Iterate over possible isotopic states of a molecule.\nThe molecule can be defined by formula, sequence, parsed sequence, or composition.\n+ The space of possible isotopic compositions is restrained by parameters\n+ ``elements_with_isotopes``, ``isotope_threshold``, ``overall_threshold``.\nParameters\n----------\n@@ -635,15 +640,18 @@ def isotopologues(*args, **kwargs):\ncomposition : :py:class:`Composition`, optional\nA :py:class:`Composition` object with the elemental composition of a\nsubstance.\n- elements_with_isotopes : list of str, optional\n- A list of elements to be considered in isotopic distribution\n+ report_report_abundance : bool, optional\n+ If :py:const:`True`, the output will contain 2-tuples: `(composition, abundance)`.\n+ Otherwise, only composition are yielded. Default is :py:const:`False`.\n+ elements_with_isotopes : container of str, optional\n+ A set of elements to be considered in isotopic distribution\n(by default, every element has a isotopic distribution).\nisotope_threshold : float, optional\nThe threshold abundance of a specific isotope to be considered.\nDefault is :py:const:`5e-4`.\noverall_threshold : float, optional\nThe threshold abundance of the calculateed isotopic composition.\n- Default is :py:const:`None`.\n+ Default is :py:const:`0`.\naa_comp : dict, optional\nA dict with the elemental composition of the amino acids (the\ndefault value is :py:data:`std_aa_comp`).\n@@ -657,9 +665,10 @@ def isotopologues(*args, **kwargs):\nIterator over possible isotopic compositions.\n\"\"\"\niso_threshold = kwargs.pop('isotope_threshold', 5e-4)\n- overall_threshold = kwargs.pop('overall_threshold', None)\n+ overall_threshold = kwargs.pop('overall_threshold', 0.0)\nmass_data = kwargs.get('mass_data', nist_mass)\nelements_with_isotopes = kwargs.get('elements_with_isotopes')\n+ report_abundance = kwargs.get('report_abundance', False)\ncomposition = Composition(kwargs['composition']) if 'composition' in kwargs else Composition(*args, **kwargs)\ndict_elem_isotopes = {}\n@@ -679,8 +688,15 @@ def isotopologues(*args, **kwargs):\nlist_comb_element_n.append(elementXn)\nall_isotoplogues.append(list_comb_element_n)\nfor isotopologue in product(*all_isotoplogues):\n- ic = Composition(formula=''.join(atom for el in isotopologue for atom in el))\n- if overall_threshold is None or isotopic_composition_abundance(composition=ic) > overall_threshold:\n+ ic = Composition(formula=''.join(atom for el in isotopologue for atom in el), **kwargs)\n+ if report_abundance or overall_threshold > 0.0:\n+ abundance = isotopic_composition_abundance(composition=ic, **kwargs)\n+ if abundance > overall_threshold:\n+ if report_abundance:\n+ yield (ic, abundance)\n+ else:\n+ yield ic\n+ else:\nyield ic\nstd_aa_mass = {\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/test_mass.py",
"new_path": "tests/test_mass.py",
"diff": "@@ -44,6 +44,8 @@ class MassTest(unittest.TestCase):\nmass_data=self.mass_data),\n'Z': mass.Composition({'C': 1},\nmass_data=self.mass_data),\n+ 'F': mass.Composition({'F': 1},\n+ mass_data=self.mass_data),\n'H-': mass.Composition({'D': 1},\nmass_data=self.mass_data),\n'-OH': mass.Composition({'E': 1},\n@@ -284,5 +286,27 @@ class MassTest(unittest.TestCase):\nfor aa, m in mass.std_aa_mass.items():\nself.assertEqual(m + h2o, mass.fast_mass(aa))\n+ def test_isotopologues(self):\n+ peptide = 'XYF'\n+ states = [{'F[6]': 1, 'A': 1, 'B': 1, 'D': 1, 'E': 1}, {'F[7]': 1, 'A': 1, 'B': 1, 'D': 1, 'E': 1}]\n+ abundances = [0.7, 0.3]\n+ for state in mass.isotopologues(peptide, elements_with_isotopes='F',\n+ aa_comp=self.aa_comp, mass_data=self.mass_data):\n+ i = states.index(state)\n+ self.assertNotEqual(i, -1)\n+ self.assertAlmostEqual(abundances[i], mass.isotopic_composition_abundance(state,\n+ aa_comp=self.aa_comp, mass_data=self.mass_data))\n+\n+ def test_isotopologues_with_abundances(self):\n+ peptide = 'XYF'\n+ states = [{'F[6]': 1, 'A': 1, 'B': 1, 'D': 1, 'E': 1}, {'F[7]': 1, 'A': 1, 'B': 1, 'D': 1, 'E': 1}]\n+ abundances = [0.7, 0.3]\n+ for state, abundance in mass.isotopologues(peptide, elements_with_isotopes='F',\n+ aa_comp=self.aa_comp, mass_data=self.mass_data, report_abundance=True):\n+ i = states.index(state)\n+ self.assertNotEqual(i, -1)\n+ self.assertAlmostEqual(abundances[i], abundance)\n+\n+\nif __name__ == '__main__':\nunittest.main()\n"
}
] | Python | Apache License 2.0 | levitsky/pyteomics | Fixes and basic tests for mass.isotopologues |
377,522 | 20.02.2017 15:58:16 | -10,800 | ac85d1185e547ab5092a38995ae5b4797b8af521 | Minor fixes. Version 3.4.1 | [
{
"change_type": "MODIFY",
"old_path": "CHANGELOG",
"new_path": "CHANGELOG",
"diff": "and :py:func:`pyteomics.fasta.read`). This can be useful for MGF files with non-ASCII spectrum\ntitles or comments.\n- - New function :py:func:`pyteomics.mass.isotopologues`.\n+ - New function :py:func:`pyteomics.mass.mass.isotopologues`.\n- Performance improvements in :py:func:`pyteomics.electrochem.pI`.\n- Fix the issue in :py:mod:`pyteomics.xml` which resulted in very long processing times for indexed XML files\nwith a byte ordering mark (BOM).\n- - Fix in :py:mod:`pyteomics.mzxml`.\n+ - Support all standard and non-standard data array names in :py:mod:`pyteomics.mzml`.\n- Change default value of ``retrieve_refs`` in :py:func:`pyteomics.mzid.read` to :py:const:`True`.\n- Preserve unit information extracted from cvParam tags in PSI XML files.\n+ - Fix in :py:mod:`pyteomics.mzxml`, other minor fixes.\n+\n3.4\n---\n"
},
{
"change_type": "MODIFY",
"old_path": "VERSION",
"new_path": "VERSION",
"diff": "-3.4.1a6\n\\ No newline at end of file\n+3.4.1\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/auxiliary.py",
"new_path": "pyteomics/auxiliary.py",
"diff": "@@ -415,6 +415,7 @@ def _keepstate(func):\nclass _file_obj(object):\n\"\"\"Check if `f` is a file name and open the file in `mode`.\nA context manager.\"\"\"\n+\ndef __init__(self, f, mode, encoding=None):\nif f is None:\nself.file = {'r': sys.stdin, 'a': sys.stdout, 'w': sys.stdout\n@@ -425,8 +426,10 @@ class _file_obj(object):\nelse:\nself.file = f\nself.close_file = (self.file is not f)\n+\ndef __enter__(self):\nreturn self\n+\ndef __exit__(self, *args, **kwargs):\nif (not self.close_file) or hasattr(self, 'none'):\nreturn # do nothing\n@@ -438,8 +441,10 @@ class _file_obj(object):\nexit = getattr(self.file, 'close', None)\nif exit is not None:\nexit()\n+\ndef __getattr__(self, attr):\nreturn getattr(self.file, attr)\n+\ndef __iter__(self):\nreturn iter(self.file)\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/mass/mass.py",
"new_path": "pyteomics/mass/mass.py",
"diff": "@@ -640,12 +640,12 @@ def isotopologues(*args, **kwargs):\ncomposition : :py:class:`Composition`, optional\nA :py:class:`Composition` object with the elemental composition of a\nsubstance.\n- report_report_abundance : bool, optional\n+ report_abundance : bool, optional\nIf :py:const:`True`, the output will contain 2-tuples: `(composition, abundance)`.\n- Otherwise, only composition are yielded. Default is :py:const:`False`.\n+ Otherwise, only compositions are yielded. Default is :py:const:`False`.\nelements_with_isotopes : container of str, optional\nA set of elements to be considered in isotopic distribution\n- (by default, every element has a isotopic distribution).\n+ (by default, every element has an isotopic distribution).\nisotope_threshold : float, optional\nThe threshold abundance of a specific isotope to be considered.\nDefault is :py:const:`5e-4`.\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/xml.py",
"new_path": "pyteomics/xml.py",
"diff": "@@ -71,7 +71,7 @@ def _keepstate(func):\nclass XMLValueConverter(object):\n# Adapted from http://stackoverflow.com/questions/2764269/parsing-an-xsduration-datatype-into-a-python-datetime-timedelta-object\n_duration_parser = re.compile(\n- ('(?P<sign>-?)P(?:(?P<years>\\d+\\.?\\d*)Y)?(?:(?P<months>\\d+\\.?\\d*)M)?(?:(?P<days>\\d+\\.?\\d*)D)?(?:T(?:(?P<hours>\\d+\\.?\\d*)H)?(?:(?P<minutes>\\d+\\.?\\d*)M)?(?:(?P<seconds>\\d+\\.?\\d*)S)?)?'))\n+ (r'(?P<sign>-?)P(?:(?P<years>\\d+\\.?\\d*)Y)?(?:(?P<months>\\d+\\.?\\d*)M)?(?:(?P<days>\\d+\\.?\\d*)D)?(?:T(?:(?P<hours>\\d+\\.?\\d*)H)?(?:(?P<minutes>\\d+\\.?\\d*)M)?(?:(?P<seconds>\\d+\\.?\\d*)S)?)?'))\n@classmethod\ndef duration_str_to_float(cls, s):\n@@ -519,8 +519,8 @@ class XML(FileReader):\nreturn self._get_info_smart(elem, **kwargs)\n# XPath emulator tools\n-pattern_path = re.compile('([\\w/*]*)(\\[(\\w+[<>=]{1,2}[^\\]]+)\\])?')\n-pattern_cond = re.compile('^\\s*(\\w+)\\s*([<>=]{,2})\\s*([^\\]]+)$')\n+pattern_path = re.compile(r'([\\w/*]*)(\\[(\\w+[<>=]{1,2}[^\\]]+)\\])?')\n+pattern_cond = re.compile(r'^\\s*(\\w+)\\s*([<>=]{,2})\\s*([^\\]]+)$')\ndef get_rel_path(element, names):\nif not names:\n@@ -570,7 +570,7 @@ def xpath(tree, path, ns=None):\nif not ns: return s\nif not s: return 'd:'\nreturn '/d:'\n- new_path = re.sub('(\\/|^)(?![\\*\\/])', repl, path)\n+ new_path = re.sub(r'(\\/|^)(?![\\*\\/])', repl, path)\nn_s = ({'d': ns} if ns else None)\nreturn tree.xpath(new_path, namespaces=n_s)\n@@ -691,7 +691,7 @@ class ByteCountingXMLScanner(_file_obj):\n\"\"\"\ni = 0\npacked = b\"|\".join(self.indexed_tags)\n- pattern = re.compile((\"^\\s*<(%s)\\s\" % packed.decode()).encode())\n+ pattern = re.compile((r\"^\\s*<(%s)\\s\" % packed.decode()).encode())\nattrs = re.compile(br\"(\\S+)=[\\\"']([^\\\"']+)[\\\"']\")\nfor line in self._chunk_iterator():\nmatch = pattern.match(line)\n"
}
] | Python | Apache License 2.0 | levitsky/pyteomics | Minor fixes. Version 3.4.1 |
377,522 | 16.04.2017 23:41:06 | -10,800 | dce2231907c850f6cdfa605d6ed17a9fbc3e6ae5 | Refactored qvalues. Current tests working. Need more tests | [
{
"change_type": "MODIFY",
"old_path": "VERSION",
"new_path": "VERSION",
"diff": "-3.4.2a0\n\\ No newline at end of file\n+3.4.2a1\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "pyteomics/auxiliary.py",
"new_path": "pyteomics/auxiliary.py",
"diff": "@@ -611,6 +611,132 @@ def _fix_docstring(f, **defaults):\nif v is not None:\nf.__doc__ = re.sub('{} : .*'.format(argname), lambda m: m.group() + ', optional', f.__doc__)\n+def _calculate_qvalues(scores, isdecoy, peps=False, **kwargs):\n+ \"\"\"Actual q-value calculation.\n+\n+ Parameters\n+ ----------\n+ scores : numpy.ndarray\n+ Sorted array of PSMs.\n+ isdecoy : numpy.ndarray\n+ Sorted array of bools (decoy/target) or floats (PEPs).\n+\n+ Returns\n+ -------\n+ out : numpy.ndarray\n+ Calculated q-values.\n+ \"\"\"\n+ correction = kwargs.pop('correction', 0)\n+ ratio = kwargs.pop('ratio', 1)\n+ remove_decoy = kwargs.get('remove_decoy', False)\n+ formula = kwargs.pop('formula', (2, 1)[bool(remove_decoy)])\n+ if formula not in {1, 2}:\n+ raise PyteomicsError('`formula` must be either 1 or 2')\n+\n+ # score_label = kwargs['score_label']\n+ cumsum = isdecoy.cumsum(dtype=np.float64)\n+ tfalse = cumsum.copy()\n+ ind = np.arange(1., scores.shape[0] + 1., dtype=np.float64)\n+\n+ if peps:\n+ q = cumsum / ind\n+ else:\n+ if isinstance(correction, int):\n+ if correction == 1:\n+ tfalse += 1\n+ elif correction == 2:\n+ p = 1. / (1. + ratio)\n+ targ = ind - cumsum\n+ for i in range(tfalse.size):\n+ tfalse[i] = _expectation(cumsum[i], targ[i], p)\n+ elif 0 < correction < 1:\n+ p = 1. / (1. + ratio)\n+ targ = ind - cumsum\n+ for i in range(tfalse.size):\n+ tfalse[i] = _confidence_value(correction, cumsum[i], targ[i], p)\n+ elif correction:\n+ raise PyteomicsError('Invalid value for `correction`.')\n+\n+ if formula == 1:\n+ q = tfalse / (ind - cumsum) / ratio\n+ else:\n+ q = (cumsum + tfalse / ratio) / ind\n+\n+ # Make sure that q-values are equal for equal scores (conservatively)\n+ # and that q-values are monotonic\n+ for i in range(scores.size-1, 0, -1):\n+ if (scores[i] == scores[i-1] or\n+ q[i-1] > q[i]):\n+ q[i-1] = q[i]\n+\n+ return q\n+\n+def _qvalues_df(psms, keyf, isdecoy, **kwargs):\n+ full = kwargs.get('full_output', False)\n+ remove_decoy = kwargs.get('remove_decoy', False)\n+ peps = kwargs.get('pep')\n+ decoy_or_pep_label = _decoy_or_pep_label(**kwargs)\n+ q_label = kwargs.setdefault('q_label', 'q')\n+ if callable(keyf):\n+ keyf = psms.apply(keyf, axis=1)\n+ if callable(isdecoy):\n+ isdecoy = psms.apply(isdecoy, axis=1)\n+ if not isinstance(keyf, basestring):\n+ psms[kwargs.setdefault('score_label', 'score')] = keyf\n+ keyf = kwargs['score_label']\n+ if not isinstance(isdecoy, basestring):\n+ psms[decoy_or_pep_label] = isdecoy\n+ isdecoy = decoy_or_pep_label\n+ reverse = kwargs.get('reverse', False)\n+ psms.sort_values([keyf, isdecoy], ascending=[not reverse, True], inplace=True)\n+\n+ q = _calculate_qvalues(psms[keyf].values, psms[isdecoy].values, peps is not None, **kwargs)\n+ if remove_decoy:\n+ q = q[~psms[isdecoy]]\n+ psms = psms[~psms[isdecoy]].copy()\n+ if not full:\n+ if peps is None:\n+ fields = [(keyf, np.float64), (isdecoy, np.bool_), (q_label, np.float64)]\n+ else:\n+ fields = [(isdecoy, np.float64), (q_label, np.float64)]\n+ dtype = np.dtype(fields)\n+ psms_ = np.empty_like(q, dtype=dtype)\n+ if peps is None:\n+ psms_[keyf] = psms[keyf]\n+ psms_[isdecoy] = psms[isdecoy]\n+ psms_[q_label] = q\n+ psms = psms_\n+ else:\n+ q_label = kwargs['q_label']\n+ psms.loc[:, q_label] = q\n+ return psms\n+\n+def _decoy_or_pep_label(**kwargs):\n+ peps = kwargs.get('pep')\n+ return kwargs.get('is_decoy_label', 'is decoy') if peps is None else kwargs.get(\n+ 'pep_label', peps if isinstance(peps, basestring) else 'PEP')\n+\n+def _construct_dtype(*args, **kwargs):\n+ full = kwargs.pop('full_output', False)\n+ peps = kwargs.get('pep')\n+ q_label = kwargs.setdefault('q_label', 'q')\n+ score_label = kwargs.setdefault('score_label', 'score')\n+\n+ fields = [(score_label, np.float64),\n+ (_decoy_or_pep_label(**kwargs), np.bool_ if peps is None else np.float64),\n+ (q_label, np.float64)]\n+ # if all args are NumPy arrays with common dtype, use it in the output\n+ if full:\n+ dtypes = {getattr(arg, 'dtype', None) for arg in args}\n+ if len(dtypes) == 1 and None not in dtypes:\n+ psm_dtype = dtypes.pop()\n+ else:\n+ psm_dtype = np.object_\n+ dtype = np.dtype(fields + [('psm', psm_dtype)])\n+ else:\n+ dtype = np.dtype(fields)\n+ return dtype\n+\ndef _make_qvalues(read, is_decoy, key):\n\"\"\"Create a function that reads PSMs from a file and calculates q-values\nfor each value of `key`.\"\"\"\n@@ -702,6 +828,12 @@ def _make_qvalues(read, is_decoy, key):\nSee `this paper <http://dx.doi.org/10.1021/acs.jproteome.6b00144>`_ for further explanation.\n+ q_label : str, optional\n+ Field name for q-value in the output. Default is ``'q'``.\n+\n+ score_label : str, optional\n+ Field name for score in the output. Default is ``'score'``.\n+\nfull_output : bool, keyword only, optional\nIf :py:const:`True`, then the returned array has PSM objects along\nwith scores and q-values. Default is :py:const:`False`.\n@@ -738,57 +870,49 @@ def _make_qvalues(read, is_decoy, key):\nscores.append(tuple(row))\nreturn scores\n- peps = kwargs.pop('pep', None)\n+ peps = kwargs.get('pep', None)\nif peps is not None:\nx = {'is_decoy', 'remove_decoy', 'formula', 'ratio', 'correction'}.intersection(kwargs)\nif x:\nraise PyteomicsError(\"Can't use these parameters with `pep`: \" + ', '.join(x))\nkeyf = kwargs.pop('key', key)\n- reverse = kwargs.pop('reverse', False)\n+ reverse = kwargs.get('reverse', False)\nif keyf is None:\nkeyf = peps\nif reverse:\nraise PyteomicsError('reverse = True when using PEPs for sorting')\n+\nif not callable(keyf) and not isinstance(keyf, (Sized, Container)):\nkeyf = np.array(list(keyf))\n- ratio = kwargs.pop('ratio', 1)\n- remove_decoy = kwargs.pop('remove_decoy', False)\n+\nif peps is None:\nisdecoy = kwargs.pop('is_decoy', is_decoy)\nelse:\nisdecoy = peps\n+\nif not callable(isdecoy) and not isinstance(isdecoy, (Sized, Container)):\nisdecoy = np.array(list(isdecoy))\n- full = kwargs.pop('full_output', False)\n- formula = kwargs.pop('formula', (2, 1)[bool(remove_decoy)])\n- correction = kwargs.pop('correction', 0)\n- if formula not in {1, 2}:\n- raise PyteomicsError('`formula` must be either 1 or 2')\n-\n- decoy_or_pep_label = 'is decoy' if peps is None else 'PEP'\n-\n- fields = [('score', np.float64),\n- (decoy_or_pep_label, np.bool_ if peps is None else np.float64),\n- ('q', np.float64)]\n- # if all args are NumPy arrays with common dtype, use it in the output\n- if full:\n- dtypes = {getattr(arg, 'dtype', None) for arg in args}\n- if len(dtypes) == 1 and None not in dtypes:\n- psm_dtype = dtypes.pop()\n- else:\n- psm_dtype = np.object_\n- dtype = np.dtype(fields + [('psm', psm_dtype)])\n- else:\n- dtype = np.dtype(fields)\n+ remove_decoy = kwargs.get('remove_decoy', False)\n+ decoy_or_pep_label = _decoy_or_pep_label(**kwargs)\n+ score_label = kwargs.setdefault('score_label', 'score')\n+ q_label = kwargs.setdefault('q_label', 'q')\n+ dtype = _construct_dtype(*args, **kwargs)\n+ full = kwargs.get('full_output', False)\narr_flag = False\npsms = None\n+\n+\n+ # time to check arg type\n+ if pd is not None and all(isinstance(arg, pd.DataFrame) for arg in args):\n+ psms = pd.concat(args)\n+ return _qvalues_df(psms, keyf, isdecoy, **kwargs)\n+\nif callable(keyf) or callable(isdecoy):\n+ kwargs.pop('full_output', None)\nscores = np.array(get_scores(*args, **kwargs), dtype=dtype)\nelse:\n- if pd is not None and all(isinstance(arg, pd.DataFrame) for arg in args):\n- psms = pd.concat(args)\n- elif all(isinstance(arg, np.ndarray) for arg in args):\n+ if all(isinstance(arg, np.ndarray) for arg in args):\npsms = np.concatenate(args)\nif not isinstance(keyf, basestring):\n@@ -800,14 +924,14 @@ def _make_qvalues(read, is_decoy, key):\nif arr_flag:\nscores = np.empty(keyf.size if hasattr(keyf, 'size') else isdecoy.size, dtype=dtype)\n- for func, label in zip((keyf, isdecoy), ('score', decoy_or_pep_label)):\n+ for func, label in zip((keyf, isdecoy), (score_label, decoy_or_pep_label)):\nif not isinstance(func, basestring):\nscores[label] = func\nelse:\nscores[label] = psms[func]\nelse:\n- scores = np.empty(psms.shape[0], dtype=fields)\n- scores['score'] = psms[keyf]\n+ scores = np.empty(psms.shape[0], dtype=dtype)\n+ scores[score_label] = psms[keyf]\nscores[decoy_or_pep_label] = psms[isdecoy]\nif not scores.size:\n@@ -816,54 +940,15 @@ def _make_qvalues(read, is_decoy, key):\nreturn scores\nif not reverse:\n- keys = scores[decoy_or_pep_label], scores['score']\n+ keys = scores[decoy_or_pep_label], scores[score_label]\nelse:\n- keys = scores[decoy_or_pep_label], -scores['score']\n+ keys = scores[decoy_or_pep_label], -scores[score_label]\nlexsort = np.lexsort(keys)\nscores = scores[lexsort]\nif psms is not None:\n- if pd is not None and isinstance(psms, pd.DataFrame):\n- if arr_flag:\n- psms = psms.iloc[lexsort]\n- else:\n- psms.sort_values([keyf, isdecoy], ascending=[not reverse, True], inplace=True)\n- else:\npsms = psms[lexsort]\n- cumsum = scores[decoy_or_pep_label].cumsum(dtype=np.float64)\n- tfalse = cumsum.copy()\n- ind = np.arange(1., scores.shape[0] + 1., dtype=np.float64)\n-\n- if peps is not None:\n- q = cumsum / ind\n- else:\n- if isinstance(correction, int):\n- if correction == 1:\n- tfalse += 1\n- elif correction == 2:\n- p = 1. / (1. + ratio)\n- targ = ind - cumsum\n- for i in range(tfalse.size):\n- tfalse[i] = _expectation(cumsum[i], targ[i], p)\n- elif 0 < correction < 1:\n- p = 1. / (1. + ratio)\n- targ = ind - cumsum\n- for i in range(tfalse.size):\n- tfalse[i] = _confidence_value(correction, cumsum[i], targ[i], p)\n- elif correction:\n- raise PyteomicsError('Invalid value for `correction`.')\n-\n- if formula == 1:\n- q = tfalse / (ind - cumsum) / ratio\n- else:\n- q = (cumsum + tfalse / ratio) / ind\n- # Make sure that q-values are equal for equal scores (conservatively)\n- # and that q-values are monotonic\n- for i in range(scores.size-1, 0, -1):\n- if (scores['score'][i] == scores['score'][i-1] or\n- q[i-1] > q[i]):\n- q[i-1] = q[i]\n- scores['q'] = q\n+ scores[q_label] = _calculate_qvalues(scores[score_label], scores[decoy_or_pep_label], peps is not None, **kwargs)\nif remove_decoy:\nif psms is not None:\npsms = psms[~scores[decoy_or_pep_label]]\n@@ -879,7 +964,7 @@ def _make_qvalues(read, is_decoy, key):\nelif label in psms.dtype.fields:\npsms[label] = scores[label]\nnewdt = [(name, psms.dtype.fields[name][0]) for name in fields] + [\n- (name, np.float64) for name in extra] + [('q', np.float64)]\n+ (name, np.float64) for name in extra] + [(q_label, np.float64)]\npsms_ = psms\npsms = np.empty_like(psms_, dtype=newdt)\nfor f in fields:\n@@ -890,7 +975,7 @@ def _make_qvalues(read, is_decoy, key):\nfor func, label in zip((keyf, isdecoy), ('score', decoy_or_pep_label)):\nif not isinstance(label, basestring):\npsms[label] = scores[label]\n- psms['q'] = scores['q']\n+ psms[q_label] = scores[q_label]\nreturn psms\nreturn scores\n@@ -918,8 +1003,7 @@ def _make_filter(read, is_decoy, key, qvalues):\nexcept KeyError:\nraise PyteomicsError('Keyword argument required: fdr')\n- args = [list(arg) if not isinstance(arg, (Container, Sized))\n- else arg for arg in args]\n+ args = [list(arg) if not isinstance(arg, (Container, Sized)) else arg for arg in args]\npeps = kwargs.get('pep')\nif peps is None:\nremove_decoy = kwargs.pop('remove_decoy', True)\n@@ -932,6 +1016,9 @@ def _make_filter(read, is_decoy, key, qvalues):\nbetter = [op.lt, op.gt][bool(reverse)]\nisdecoy = kwargs.pop('is_decoy', is_decoy)\nkwargs.pop('formula', None)\n+ decoy_or_pep_label = _decoy_or_pep_label(**kwargs)\n+ score_label = kwargs.setdefault('score_label', 'score')\n+\ntry:\ni = scores['q'].searchsorted(fdr, side='right')\nif isinstance(i, Sized):\n@@ -947,13 +1034,17 @@ def _make_filter(read, is_decoy, key, qvalues):\nreturn scores[:i]\nelif not scores.size:\nreturn (_ for _ in ())\n- cutoff = scores['score'][i] if i < scores.size else (\n- scores['score'][-1] + (1, -1)[bool(reverse)])\n+ if peps is None:\n+ label = score_label\n+ else:\n+ label = decoy_or_pep_label\n+ cutoff = scores[label][i] if i < scores.size else (\n+ scores[label][-1] + (1, -1)[bool(reverse)])\ndef out():\nwith read(*args, **kwargs) as f:\nfor p, s in zip(f, scores):\n- if peps is not None or not remove_decoy or not s['is decoy']:\n- if better(s['score'], cutoff):\n+ if peps is not None or not remove_decoy or not s[decoy_or_pep_label]:\n+ if better(s[label], cutoff):\nyield p\nreturn out()\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/test_auxiliary.py",
"new_path": "tests/test_auxiliary.py",
"diff": "@@ -96,8 +96,7 @@ class QvalueTest(unittest.TestCase):\npsms = pd.DataFrame(np.array(list(self.psms), dtype=dtype))\nq = aux.qvalues(psms, key=self.key, is_decoy=self.is_decoy, remove_decoy=False, formula=1)\nself._run_check(q, 1)\n- q = aux.qvalues(psms, key=self.key, is_decoy=self.is_decoy, remove_decoy=False, formula=1,\n- full_output=True)\n+ q = aux.qvalues(psms, key=self.key, is_decoy=self.is_decoy, remove_decoy=False, formula=1, full_output=True)\nself._run_check(q, 1)\ndef test_qvalues_pep_from_dataframe(self):\n@@ -181,7 +180,6 @@ class QvalueTest(unittest.TestCase):\nself.assertTrue(np.allclose(q0['q'], q1['q']))\nclass FilterTest(unittest.TestCase):\n-\nkey = staticmethod(op.itemgetter(0))\nis_decoy = staticmethod(lambda x: x[1].islower())\npep = staticmethod(op.itemgetter(2))\n@@ -219,7 +217,7 @@ class FilterTest(unittest.TestCase):\ndef _run_check_pep(self, *args, **kwargs):\nkey = kwargs.pop('key', self.key)\n- is_decoy = kwargs.get('is_decoy', self.is_decoy)\n+ # is_decoy = kwargs.get('is_decoy', self.is_decoy)\nf11 = aux.filter(*args, key=key, fdr=0.02, **kwargs)\nf12 = aux.filter(*args, fdr=0.02, **kwargs)\n@@ -827,5 +825,8 @@ class OtherTests(unittest.TestCase):\nwith self.assertRaises(aux.PyteomicsError):\naux.linear_regression_perpendicular(self.x)\n+import warnings\nif __name__ == '__main__':\n+ with warnings.catch_warnings():\n+ warnings.simplefilter('error')\nunittest.main()\n\\ No newline at end of file\n"
}
] | Python | Apache License 2.0 | levitsky/pyteomics | Refactored qvalues. Current tests working. Need more tests |