From 4c27b7375ae80541d608e82fadef44746038112e Mon Sep 17 00:00:00 2001 From: Eyal Hakim <> Date: Mon, 28 May 2018 12:22:30 +0300 Subject: [PATCH] move element-closest to polyfills.ts fix Array declerations syntax fix strange bug on build (https://github.com/edcarroll/ng2-semantic-ui/issues/357) fix optional param --- demo/src/app/components/api/api.component.ts | 6 +++--- demo/src/app/components/sidebar/sidebar.component.ts | 2 -- demo/src/polyfills.ts | 1 + src/modules/datepicker/helpers/date-fns.ts | 2 +- src/modules/dropdown/directives/dropdown-menu.ts | 2 -- src/modules/search/components/search.ts | 5 +++-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/demo/src/app/components/api/api.component.ts b/demo/src/app/components/api/api.component.ts index a4bdd9788..be16ea57f 100644 --- a/demo/src/app/components/api/api.component.ts +++ b/demo/src/app/components/api/api.component.ts @@ -16,11 +16,11 @@ export interface IApiEvent { export interface IApi { selector:string; - properties?:[IApiProperty]; - events?:[IApiEvent]; + properties?:IApiProperty[]; + events?:IApiEvent[]; } -export type ApiDefinition = [IApi]; +export type ApiDefinition = IApi[]; @Component({ selector: "demo-api", diff --git a/demo/src/app/components/sidebar/sidebar.component.ts b/demo/src/app/components/sidebar/sidebar.component.ts index c242f4023..60117cb6b 100644 --- a/demo/src/app/components/sidebar/sidebar.component.ts +++ b/demo/src/app/components/sidebar/sidebar.component.ts @@ -1,6 +1,4 @@ import { Component, HostBinding, Output, EventEmitter, HostListener, isDevMode } from "@angular/core"; -// Polyfill for IE -import "element-closest"; interface IAugmentedElement extends Element { closest(selector:string):IAugmentedElement; diff --git a/demo/src/polyfills.ts b/demo/src/polyfills.ts index 2866f9009..76b0b272c 100644 --- a/demo/src/polyfills.ts +++ b/demo/src/polyfills.ts @@ -17,3 +17,4 @@ import "core-js/es6/reflect"; import "core-js/es7/reflect"; import "zone.js/dist/zone"; +import "element-closest"; diff --git a/src/modules/datepicker/helpers/date-fns.ts b/src/modules/datepicker/helpers/date-fns.ts index 6f20ecb7b..4ee04d866 100644 --- a/src/modules/datepicker/helpers/date-fns.ts +++ b/src/modules/datepicker/helpers/date-fns.ts @@ -3,7 +3,7 @@ import { format, parse } from "date-fns"; import * as defaultLocale from "date-fns/locale/en-US"; interface IDateFnsLocaleValues { [name:string]:string[]; } -interface IDateFnsHelperOptions { type?:string; } +interface IDateFnsHelperOptions { type:string; } type DateFnsHelper = (value:U, options:IDateFnsHelperOptions) => T; type DateFnsWeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6; diff --git a/src/modules/dropdown/directives/dropdown-menu.ts b/src/modules/dropdown/directives/dropdown-menu.ts index 7df10514f..b6fafdb4c 100644 --- a/src/modules/dropdown/directives/dropdown-menu.ts +++ b/src/modules/dropdown/directives/dropdown-menu.ts @@ -5,8 +5,6 @@ import { import { Transition, SuiTransition, TransitionController, TransitionDirection } from "../../transition/index"; import { HandledEvent, IAugmentedElement, KeyCode } from "../../../misc/util/index"; import { DropdownService, DropdownAutoCloseType } from "../services/dropdown.service"; -// Polyfill for IE -import "element-closest"; @Directive({ // We must attach to every '.item' as Angular doesn't support > selectors. diff --git a/src/modules/search/components/search.ts b/src/modules/search/components/search.ts index d6dc2cfc7..e00af953b 100644 --- a/src/modules/search/components/search.ts +++ b/src/modules/search/components/search.ts @@ -100,9 +100,10 @@ export class SuiSearch implements AfterViewInit, OnDestroy { public set query(query:string) { this.selectedResult = undefined; // Initialise a delayed search. - this.searchService.updateQueryDelayed(query, () => + this.searchService.updateQueryDelayed(query, () => { // Set the results open state depending on whether a query has been entered. - this.dropdownService.setOpenState(this.searchService.query.length > 0)); + return this.dropdownService.setOpenState(this.searchService.query.length > 0); + }); } @Input()