var HighlightDirective = (function () {
    function HighlightDirective(el) {
        this.el = el.nativeElement;
    }
    HighlightDirective.prototype.onMouseEnter = function () {
        this.highlight('yellow');
    };
    HighlightDirective.prototype.onKeypress = function (event) {
    };
    HighlightDirective.prototype.highlight = function (color) {
        this.el.style.backgroundColor = color;
    };
    __decorate([
        core_1.HostListener('mouseenter'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], HighlightDirective.prototype, "onMouseEnter", null);
    __decorate([
        core_1.HostListener('window:keypress', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [Event]), 
        __metadata('design:returntype', void 0)
    ], HighlightDirective.prototype, "onKeypress", null);
    HighlightDirective = __decorate([
        core_1.Directive({ selector: '[myHighlight]' }), 
        __metadata('design:paramtypes', [core_1.ElementRef])
    ], HighlightDirective);
    return HighlightDirective;
}());
Example #2
0
var FavDirective = (function () {
    function FavDirective() {
        this.isFavorite = true;
        this.hovering = false;
    }
    FavDirective.prototype.onMouseEnter = function () {
        this.hovering = true;
    };
    FavDirective.prototype.onMouseLeave = function () {
        this.hovering = false;
    };
    Object.defineProperty(FavDirective.prototype, "mvFav", {
        set: function (value) {
            this.isFavorite = value;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        core_1.HostBinding('class.is-favorite'), 
        __metadata('design:type', Object)
    ], FavDirective.prototype, "isFavorite", void 0);
    __decorate([
        core_1.HostBinding('class.is.favorite-hovering'), 
        __metadata('design:type', Object)
    ], FavDirective.prototype, "hovering", void 0);
    __decorate([
        core_1.HostListener('mouseenter'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], FavDirective.prototype, "onMouseEnter", null);
    __decorate([
        core_1.HostListener('mouseleave'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], FavDirective.prototype, "onMouseLeave", null);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object), 
        __metadata('design:paramtypes', [Object])
    ], FavDirective.prototype, "mvFav", null);
    FavDirective = __decorate([
        core_1.Directive({
            selector: '[mwFavs]',
        }), 
        __metadata('design:paramtypes', [])
    ], FavDirective);
    return FavDirective;
}());
Example #3
0
var MenuClose = (function () {
    function MenuClose(_menu) {
        this._menu = _menu;
    }
    /**
    * @private
    */
    MenuClose.prototype.close = function () {
        var menu = this._menu.get(this.menuClose);
        menu && menu.close();
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], MenuClose.prototype, "menuClose", void 0);
    __decorate([
        core_1.HostListener('click'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], MenuClose.prototype, "close", null);
    MenuClose = __decorate([
        core_1.Directive({
            selector: '[menuClose]'
        }), 
        __metadata('design:paramtypes', [menu_controller_1.MenuController])
    ], MenuClose);
    return MenuClose;
}());
var EnterKeyDirective = (function () {
    function EnterKeyDirective() {
        this.enterExcute = new core_1.EventEmitter();
    }
    EnterKeyDirective.prototype.onKeypress = function (event) {
        if (event.code == 'Enter') {
            this.enterExcute.emit();
        }
    };
    __decorate([
        core_1.Output(), 
        __metadata('design:type', Object)
    ], EnterKeyDirective.prototype, "enterExcute", void 0);
    __decorate([
        core_1.HostListener('keypress', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [Object]), 
        __metadata('design:returntype', void 0)
    ], EnterKeyDirective.prototype, "onKeypress", null);
    EnterKeyDirective = __decorate([
        core_1.Directive({ selector: '[enterKey]' }), 
        __metadata('design:paramtypes', [])
    ], EnterKeyDirective);
    return EnterKeyDirective;
}());
var MainPageComponent = (function () {
    function MainPageComponent(document) {
        this.document = document;
    }
    MainPageComponent.prototype.onWindowScroll = function () {
        var element = this.document.getElementById('#main-content');
        var number = this.document.body.scrollTop;
        if (number > 20) {
            element.style.opacity = "0";
        }
        else if (number < 900) {
            element.style.opacity = "1";
        }
    };
    __decorate([
        core_1.HostListener("window:scroll", []), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], MainPageComponent.prototype, "onWindowScroll", null);
    MainPageComponent = __decorate([
        core_1.Component({
            moduleId: module.id,
            selector: 'main-page',
            templateUrl: 'main-page.component.html'
        }),
        __param(0, core_1.Inject(platform_browser_1.DOCUMENT)), 
        __metadata('design:paramtypes', [Document])
    ], MainPageComponent);
    return MainPageComponent;
}());
Example #6
0
var ModalCmp = (function () {
    function ModalCmp(_compiler, _renderer, _navParams, _viewCtrl) {
        this._compiler = _compiler;
        this._renderer = _renderer;
        this._navParams = _navParams;
        this._viewCtrl = _viewCtrl;
        this.d = _navParams.data.opts;
    }
    ModalCmp.prototype.loadComponent = function (done) {
        var _this = this;
        var componentType = this._navParams.data.componentType;
        bootstrap_1.addSelector(componentType, 'ion-page');
        this._compiler.resolveComponent(componentType).then(function (componentFactory) {
            var componentRef = _this.viewport.createComponent(componentFactory, _this.viewport.length, _this.viewport.parentInjector);
            _this._renderer.setElementClass(componentRef.location.nativeElement, 'show-page', true);
            // auto-add page css className created from component JS class name
            var cssClassName = util_1.pascalCaseToDashCase(componentType.name);
            _this._renderer.setElementClass(componentRef.location.nativeElement, cssClassName, true);
            _this._viewCtrl.setInstance(componentRef.instance);
            _this.enabled = true;
            done();
        });
    };
    ModalCmp.prototype.ngAfterViewInit = function () {
        // intentionally kept empty
    };
    ModalCmp.prototype.dismiss = function (role) {
        return this._viewCtrl.dismiss(null, role);
    };
    ModalCmp.prototype.bdClick = function () {
        if (this.enabled && this.d.enableBackdropDismiss) {
            this.dismiss('backdrop');
        }
    };
    ModalCmp.prototype._keyUp = function (ev) {
        if (this.enabled && this._viewCtrl.isLast() && ev.keyCode === key_1.Key.ESCAPE) {
            this.bdClick();
        }
    };
    __decorate([
        core_1.ViewChild('viewport', { read: core_1.ViewContainerRef }), 
        __metadata('design:type', (typeof (_a = typeof core_1.ViewContainerRef !== 'undefined' && core_1.ViewContainerRef) === 'function' && _a) || Object)
    ], ModalCmp.prototype, "viewport", void 0);
    __decorate([
        core_1.HostListener('body:keyup', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [Object]), 
        __metadata('design:returntype', void 0)
    ], ModalCmp.prototype, "_keyUp", null);
    ModalCmp = __decorate([
        core_1.Component({
            selector: 'ion-modal',
            template: "\n    <ion-backdrop disableScroll=\"false\" (click)=\"bdClick($event)\"></ion-backdrop>\n    <div class=\"modal-wrapper\">\n      <div #viewport nav-viewport></div>\n    </div>\n  ",
            directives: [backdrop_1.Backdrop]
        }), 
        __metadata('design:paramtypes', [(typeof (_b = typeof core_1.ComponentResolver !== 'undefined' && core_1.ComponentResolver) === 'function' && _b) || Object, (typeof (_c = typeof core_1.Renderer !== 'undefined' && core_1.Renderer) === 'function' && _c) || Object, (typeof (_d = typeof nav_params_1.NavParams !== 'undefined' && nav_params_1.NavParams) === 'function' && _d) || Object, (typeof (_e = typeof view_controller_1.ViewController !== 'undefined' && view_controller_1.ViewController) === 'function' && _e) || Object])
    ], ModalCmp);
    return ModalCmp;
    var _a, _b, _c, _d, _e;
}());
var Autosize = (function () {
    function Autosize(element) {
        this.element = element;
    }
    Autosize.prototype.onInput = function (textArea) {
        this.adjust();
    };
    Autosize.prototype.ngOnInit = function () {
        this.adjust();
    };
    Autosize.prototype.adjust = function () {
        this.element.nativeElement.style.overflow = 'hidden';
        this.element.nativeElement.style.height = 'auto';
        this.element.nativeElement.style.height = this.element.nativeElement.scrollHeight + "px";
    };
    __decorate([
        core_1.HostListener('input', ['$event.target']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [HTMLTextAreaElement]), 
        __metadata('design:returntype', void 0)
    ], Autosize.prototype, "onInput", null);
    Autosize = __decorate([
        core_1.Directive({
            selector: 'textarea[autosize]'
        }), 
        __metadata('design:paramtypes', [core_1.ElementRef])
    ], Autosize);
    return Autosize;
}());
Example #8
0
var MenuToggle = (function () {
    function MenuToggle(_menu, elementRef, _viewCtrl, _navbar) {
        this._menu = _menu;
        this._viewCtrl = _viewCtrl;
        this._navbar = _navbar;
        this._inNavbar = !!_navbar;
    }
    /**
    * @private
    */
    MenuToggle.prototype.toggle = function () {
        var menu = this._menu.get(this.menuToggle);
        menu && menu.toggle();
    };
    Object.defineProperty(MenuToggle.prototype, "isHidden", {
        /**
        * @private
        */
        get: function () {
            if (this._inNavbar && this._viewCtrl) {
                if (this._viewCtrl.isFirst()) {
                    // this is the first view, so it should always show
                    return false;
                }
                var menu = this._menu.get(this.menuToggle);
                if (menu) {
                    // this is not the root view, so see if this menu
                    // is configured to still be enabled if it's not the root view
                    return !menu.persistent;
                }
            }
            return false;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], MenuToggle.prototype, "menuToggle", void 0);
    __decorate([
        core_1.HostListener('click'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], MenuToggle.prototype, "toggle", null);
    MenuToggle = __decorate([
        core_1.Directive({
            selector: '[menuToggle]',
            host: {
                '[hidden]': 'isHidden',
                'menuToggle': '' // ensures the attr is there for css when using [menuToggle]
            }
        }),
        __param(2, core_1.Optional()),
        __param(3, core_1.Optional()), 
        __metadata('design:paramtypes', [menu_controller_1.MenuController, core_1.ElementRef, view_controller_1.ViewController, navbar_1.Navbar])
    ], MenuToggle);
    return MenuToggle;
}());
var AutosizeDirective = /** @class */ (function () {
    function AutosizeDirective(element, renderer) {
        this.element = element;
        this.renderer = renderer;
    }
    AutosizeDirective.prototype.ngAfterContentChecked = function () {
        this.adjust();
    };
    AutosizeDirective.prototype.onInput = function (textArea) {
        this.adjust();
    };
    AutosizeDirective.prototype.adjust = function () {
        var height = this.element.nativeElement.scrollHeight + 'px';
        this.renderer.setElementStyle(this.element.nativeElement, 'overflow', 'hidden');
        this.renderer.setElementStyle(this.element.nativeElement, 'height', height);
    };
    __decorate([
        HostListener('input', ['$event.target']),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [HTMLTextAreaElement]),
        __metadata("design:returntype", void 0)
    ], AutosizeDirective.prototype, "onInput", null);
    AutosizeDirective = __decorate([
        Directive({
            selector: 'textarea[autosize]'
        }),
        __metadata("design:paramtypes", [ElementRef, Renderer])
    ], AutosizeDirective);
    return AutosizeDirective;
}());
Example #10
0
var HighlightDirective = (function () {
    function HighlightDirective(el) {
        this.el = el.nativeElement;
    }
    Object.defineProperty(HighlightDirective.prototype, "defaultColor", {
        set: function (colorName) {
            this._defaultColor = colorName || this._defaultColor;
        },
        enumerable: true,
        configurable: true
    });
    HighlightDirective.prototype.onMouseEnter = function () {
        this.highlight(this.highlightColor || this._defaultColor);
    };
    HighlightDirective.prototype.onMouseLeave = function () {
        this.highlight(null);
    };
    HighlightDirective.prototype.highlight = function (color) {
        this.el.style.backgroundColor = color;
    };
    __decorate([
        core_1.Input('myHighlight'), 
        __metadata('design:type', String)
    ], HighlightDirective.prototype, "highlightColor", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String), 
        __metadata('design:paramtypes', [String])
    ], HighlightDirective.prototype, "defaultColor", null);
    __decorate([
        core_1.HostListener('mouseenter'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], HighlightDirective.prototype, "onMouseEnter", null);
    __decorate([
        core_1.HostListener('mouseleave'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], HighlightDirective.prototype, "onMouseLeave", null);
    HighlightDirective = __decorate([
        core_1.Directive({ selector: '[myHighlight]' }), 
        __metadata('design:paramtypes', [core_1.ElementRef])
    ], HighlightDirective);
    return HighlightDirective;
}());
var ItemSlotComponent = (function () {
    function ItemSlotComponent() {
        this.itemSelected = new core_1.EventEmitter();
    }
    ItemSlotComponent.prototype.onMouseOver = function () {
        this.itemSelected.emit(this.itemSlot.item ? this.itemSlot : null);
    };
    ItemSlotComponent.prototype.onMouseOut = function () {
        this.itemSelected.emit(null);
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', itemviewmodel_1.ItemViewModel)
    ], ItemSlotComponent.prototype, "itemSlot", void 0);
    __decorate([
        core_1.Output(), 
        __metadata('design:type', Object)
    ], ItemSlotComponent.prototype, "itemSelected", void 0);
    __decorate([
        core_1.HostListener('mouseover'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], ItemSlotComponent.prototype, "onMouseOver", null);
    __decorate([
        core_1.HostListener('mouseout'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], ItemSlotComponent.prototype, "onMouseOut", null);
    ItemSlotComponent = __decorate([
        core_1.Component({
            selector: 'item-slot',
            pipes: [safe_1.SafeUrlPipe, safe_1.SafeStylePipe],
            directives: [item_card_component_1.ItemCardComponent],
            styles: [
                ".item-icon, .item-text {\n    padding-top: 3px;\n    height: 72px;\n}\n.d3-icon-item-white {\n    opacity: 0.4;\n}\n@media (min-width: 768px) and (max-width: 1200px) {\n  .item-text, .item-icon {\n    padding-top: 0px;\n    height: 44px;\n  }\n  .item-text {\n    padding-top: 6px;\n  }\n  .d3-icon-item-small .icon-item-default \n  { \n    width: 32px; \n    height: 39px; \n  }\n}\n"
            ],
            // styleUrls: ['/app/components/css/item.slot.css'],
            templateUrl: '/app/components/html/item.slot.html'
        }), 
        __metadata('design:paramtypes', [])
    ], ItemSlotComponent);
    return ItemSlotComponent;
}());
Example #12
0
var RouterLink = (function () {
    function RouterLink(router, route) {
        this.router = router;
        this.route = route;
        this.commands = [];
    }
    Object.defineProperty(RouterLink.prototype, "routerLink", {
        set: function (data) {
            if (Array.isArray(data)) {
                this.commands = data;
            }
            else {
                this.commands = [data];
            }
            this.updateTargetUrlAndHref();
        },
        enumerable: true,
        configurable: true
    });
    RouterLink.prototype.onClick = function () {
        if (!(typeof this.target === "string") || this.target == '_self') {
            this.router.navigate(this.commands, { relativeTo: this.route });
            return false;
        }
        return true;
    };
    RouterLink.prototype.updateTargetUrlAndHref = function () {
        var tree = this.router.createUrlTree(this.commands, { relativeTo: this.route });
        if (tree) {
            this.href = this.router.serializeUrl(tree);
        }
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], RouterLink.prototype, "target", void 0);
    __decorate([
        core_1.HostBinding(), 
        __metadata('design:type', String)
    ], RouterLink.prototype, "href", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object), 
        __metadata('design:paramtypes', [Object])
    ], RouterLink.prototype, "routerLink", null);
    __decorate([
        core_1.HostListener("click"), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', Boolean)
    ], RouterLink.prototype, "onClick", null);
    RouterLink = __decorate([
        core_1.Directive({ selector: '[routerLink]' }), 
        __metadata('design:paramtypes', [router_1.Router, router_state_1.ActivatedRoute])
    ], RouterLink);
    return RouterLink;
}());
Example #13
0
var TabButton = (function (_super) {
    __extends(TabButton, _super);
    function TabButton(config, elementRef) {
        _super.call(this, elementRef);
        this.ionSelect = new core_1.EventEmitter();
        this.disHover = (config.get('hoverCSS') === false);
        this._layout = config.get('tabbarLayout');
    }
    TabButton.prototype.ngOnInit = function () {
        this.tab.btn = this;
        this._layout = this.tab.parent.tabbarLayout || this._layout;
        this.hasTitle = !!this.tab.tabTitle;
        this.hasIcon = !!this.tab.tabIcon && this._layout !== 'icon-hide';
        this.hasTitleOnly = (this.hasTitle && !this.hasIcon);
        this.hasIconOnly = (this.hasIcon && !this.hasTitle);
        this.hasBadge = !!this.tab.tabBadge;
    };
    TabButton.prototype.onClick = function (ev) {
        this.ionSelect.emit(this.tab);
        ev.preventDefault();
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', tab_1.Tab)
    ], TabButton.prototype, "tab", void 0);
    __decorate([
        core_1.Output(), 
        __metadata('design:type', core_1.EventEmitter)
    ], TabButton.prototype, "ionSelect", void 0);
    __decorate([
        core_1.HostListener('click', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [UIEvent]), 
        __metadata('design:returntype', void 0)
    ], TabButton.prototype, "onClick", null);
    TabButton = __decorate([
        core_1.Directive({
            selector: '.tab-button',
            host: {
                '[attr.id]': 'tab._btnId',
                '[attr.aria-controls]': 'tab._panelId',
                '[attr.aria-selected]': 'tab.isSelected',
                '[class.has-title]': 'hasTitle',
                '[class.has-icon]': 'hasIcon',
                '[class.has-title-only]': 'hasTitleOnly',
                '[class.icon-only]': 'hasIconOnly',
                '[class.has-badge]': 'hasBadge',
                '[class.disable-hover]': 'disHover'
            }
        }), 
        __metadata('design:paramtypes', [config_1.Config, core_1.ElementRef])
    ], TabButton);
    return TabButton;
}(ion_1.Ion));
Example #14
0
var DropdownDirective = (function () {
    function DropdownDirective() {
        this.isOpen = false;
    }
    Object.defineProperty(DropdownDirective.prototype, "opened", {
        get: function () {
            return this.isOpen;
        },
        enumerable: true,
        configurable: true
    });
    DropdownDirective.prototype.open = function () {
        this.isOpen = true;
    };
    DropdownDirective.prototype.close = function () {
        this.isOpen = false;
    };
    __decorate([
        core_1.HostBinding('class.open'), 
        __metadata('design:type', Object)
    ], DropdownDirective.prototype, "opened", null);
    __decorate([
        core_1.HostListener('click'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], DropdownDirective.prototype, "open", null);
    __decorate([
        core_1.HostListener('mouseleave'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], DropdownDirective.prototype, "close", null);
    DropdownDirective = __decorate([
        core_1.Directive({
            selector: '[rbDropdown]'
        }), 
        __metadata('design:paramtypes', [])
    ], DropdownDirective);
    return DropdownDirective;
}());
var ErrorHandlerDirective = (function () {
    // Assigne l'élement HTML sur lequel est placé ErrorHandlerDirective
    function ErrorHandlerDirective(el) {
        this._selectedBorder = "3px solid rgb(255, 0, 0)";
        this._selectedShadow = "1px 1px 12px rgb(255, 0, 0)";
        this._displayedBorder = "3px solid rgb(252,166,38)";
        this._displayedShadow = "1px 1px 12px rgb(252,166,38)";
        this.isDisplayed = 0;
        this.el = el.nativeElement;
    }
    // Surveille les changements et assigne le style displayed
    ErrorHandlerDirective.prototype.ngOnChanges = function (changes) {
        for (var propName in changes) {
            var chng = changes[propName];
            var cur = chng.currentValue;
            var prev = chng.previousValue;
            if (1 == cur) {
                this.el.style.border = this._displayedBorder;
                this.el.style.boxShadow = this._displayedShadow;
            }
        }
    };
    // Surveille le clic de l'utilisateur sur l'élément du DOM associé et assigne le style selected
    ErrorHandlerDirective.prototype.onClick = function () {
        this.el.style.border = this._selectedBorder;
        this.el.style.boxShadow = this._selectedShadow;
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Number)
    ], ErrorHandlerDirective.prototype, "isDisplayed", void 0);
    __decorate([
        core_1.HostListener('click'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], ErrorHandlerDirective.prototype, "onClick", null);
    ErrorHandlerDirective = __decorate([
        core_1.Directive({
            selector: '[myErrorHandler]'
        }), 
        __metadata('design:paramtypes', [core_1.ElementRef])
    ], ErrorHandlerDirective);
    return ErrorHandlerDirective;
}());
var PaAttrDirective = (function () {
    function PaAttrDirective() {
        this.click = new core_1.EventEmitter();
    }
    PaAttrDirective.prototype.triggerCustomEvent = function () {
        if (this.product != null) {
            this.click.emit(this.product.category);
        }
    };
    __decorate([
        core_1.Input("pa-attr"),
        core_1.HostBinding("class"), 
        __metadata('design:type', String)
    ], PaAttrDirective.prototype, "bgClass", void 0);
    __decorate([
        core_1.Input("pa-product"), 
        __metadata('design:type', product_model_1.Product)
    ], PaAttrDirective.prototype, "product", void 0);
    __decorate([
        core_1.Output("pa-category"), 
        __metadata('design:type', Object)
    ], PaAttrDirective.prototype, "click", void 0);
    __decorate([
        core_1.HostListener("click"), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], PaAttrDirective.prototype, "triggerCustomEvent", null);
    PaAttrDirective = __decorate([
        core_1.Directive({
            selector: "[pa-attr]"
        }), 
        __metadata('design:paramtypes', [])
    ], PaAttrDirective);
    return PaAttrDirective;
}());
Example #17
0
var Popover = /** @class */ (function () {
    // -------------------------------------------------------------------------
    // Constructor
    // -------------------------------------------------------------------------
    function Popover(viewContainerRef, resolver) {
        this.viewContainerRef = viewContainerRef;
        this.resolver = resolver;
        // -------------------------------------------------------------------------
        // Properties
        // -------------------------------------------------------------------------
        this.PopoverComponent = PopoverContent_1.PopoverContent;
        this.popoverOnHover = false;
        this.popoverDismissTimeout = 0;
        this.onShown = new core_1.EventEmitter();
        this.onHidden = new core_1.EventEmitter();
    }
    // -------------------------------------------------------------------------
    // Event listeners
    // -------------------------------------------------------------------------
    Popover.prototype.showOrHideOnClick = function () {
        if (this.popoverOnHover)
            return;
        if (this.popoverDisabled)
            return;
        this.toggle();
    };
    Popover.prototype.showOnHover = function () {
        if (!this.popoverOnHover)
            return;
        if (this.popoverDisabled)
            return;
        this.show();
    };
    Popover.prototype.hideOnHover = function () {
        if (this.popoverCloseOnMouseOutside)
            return; // don't do anything since not we control this
        if (!this.popoverOnHover)
            return;
        if (this.popoverDisabled)
            return;
        this.hide();
    };
    Popover.prototype.ngOnChanges = function (changes) {
        if (changes["popoverDisabled"]) {
            if (changes["popoverDisabled"].currentValue) {
                this.hide();
            }
        }
    };
    // -------------------------------------------------------------------------
    // Public Methods
    // -------------------------------------------------------------------------
    Popover.prototype.toggle = function () {
        if (!this.visible) {
            this.show();
        }
        else {
            this.hide();
        }
    };
    Popover.prototype.show = function () {
        var _this = this;
        if (this.visible)
            return;
        this.visible = true;
        if (typeof this.content === "string") {
            var factory = this.resolver.resolveComponentFactory(this.PopoverComponent);
            if (!this.visible)
                return;
            this.popover = this.viewContainerRef.createComponent(factory);
            var popover = this.popover.instance;
            popover.popover = this;
            popover.content = this.content;
            if (this.popoverPlacement !== undefined)
                popover.placement = this.popoverPlacement;
            if (this.popoverAnimation !== undefined)
                popover.animation = this.popoverAnimation;
            if (this.popoverTitle !== undefined)
                popover.title = this.popoverTitle;
            if (this.popoverCloseOnClickOutside !== undefined)
                popover.closeOnClickOutside = this.popoverCloseOnClickOutside;
            if (this.popoverCloseOnMouseOutside !== undefined)
                popover.closeOnMouseOutside = this.popoverCloseOnMouseOutside;
            popover.onCloseFromOutside.subscribe(function () { return _this.hide(); });
            // if dismissTimeout option is set, then this popover will be dismissed in dismissTimeout time
            if (this.popoverDismissTimeout > 0)
                setTimeout(function () { return _this.hide(); }, this.popoverDismissTimeout);
        }
        else {
            var popover = this.content;
            popover.popover = this;
            if (this.popoverPlacement !== undefined)
                popover.placement = this.popoverPlacement;
            if (this.popoverAnimation !== undefined)
                popover.animation = this.popoverAnimation;
            if (this.popoverTitle !== undefined)
                popover.title = this.popoverTitle;
            if (this.popoverCloseOnClickOutside !== undefined)
                popover.closeOnClickOutside = this.popoverCloseOnClickOutside;
            if (this.popoverCloseOnMouseOutside !== undefined)
                popover.closeOnMouseOutside = this.popoverCloseOnMouseOutside;
            popover.onCloseFromOutside.subscribe(function () { return _this.hide(); });
            // if dismissTimeout option is set, then this popover will be dismissed in dismissTimeout time
            if (this.popoverDismissTimeout > 0)
                setTimeout(function () { return _this.hide(); }, this.popoverDismissTimeout);
            popover.show();
        }
        this.onShown.emit(this);
    };
    Popover.prototype.hide = function () {
        if (!this.visible)
            return;
        this.visible = false;
        if (this.popover)
            this.popover.destroy();
        if (this.content instanceof PopoverContent_1.PopoverContent)
            this.content.hideFromPopover();
        this.onHidden.emit(this);
    };
    Popover.prototype.getElement = function () {
        return this.viewContainerRef.element.nativeElement;
    };
    __decorate([
        core_1.Input("popover"),
        __metadata("design:type", Object)
    ], Popover.prototype, "content", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", Boolean)
    ], Popover.prototype, "popoverDisabled", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", Boolean)
    ], Popover.prototype, "popoverAnimation", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", String)
    ], Popover.prototype, "popoverPlacement", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", String)
    ], Popover.prototype, "popoverTitle", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", Boolean)
    ], Popover.prototype, "popoverOnHover", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", Boolean)
    ], Popover.prototype, "popoverCloseOnClickOutside", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", Boolean)
    ], Popover.prototype, "popoverCloseOnMouseOutside", void 0);
    __decorate([
        core_1.Input(),
        __metadata("design:type", Number)
    ], Popover.prototype, "popoverDismissTimeout", void 0);
    __decorate([
        core_1.Output(),
        __metadata("design:type", Object)
    ], Popover.prototype, "onShown", void 0);
    __decorate([
        core_1.Output(),
        __metadata("design:type", Object)
    ], Popover.prototype, "onHidden", void 0);
    __decorate([
        core_1.HostListener("click"),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], Popover.prototype, "showOrHideOnClick", null);
    __decorate([
        core_1.HostListener("focusin"),
        core_1.HostListener("mouseenter"),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], Popover.prototype, "showOnHover", null);
    __decorate([
        core_1.HostListener("focusout"),
        core_1.HostListener("mouseleave"),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], Popover.prototype, "hideOnHover", null);
    Popover = __decorate([
        core_1.Directive({
            selector: "[popover]",
            exportAs: "popover"
        }),
        __metadata("design:paramtypes", [core_1.ViewContainerRef,
            core_1.ComponentFactoryResolver])
    ], Popover);
    return Popover;
}());
var VaadinDatePicker = (function () {
    function VaadinDatePicker(renderer, el, _injector) {
        var _this = this;
        this._injector = _injector;
        this._initialValueSet = false;
        this.onChange = function (_) { };
        this.onTouched = function () { };
        this.valueChange = new core_1.EventEmitter(false);
        if (!Polymer || !Polymer.isInstance(el.nativeElement)) {
            console.error("vaadin-date-picker has not been imported yet, please remember to import vaadin-date-picker.html in your main HTML page.");
            return;
        }
        this._renderer = renderer;
        this._element = el.nativeElement;
        this._element.$$('paper-input-container').addEventListener('blur', function () {
            if (!_this._element.opened && !_this._element._opened) {
                _this.onTouched();
            }
        });
    }
    VaadinDatePicker.prototype.writeValue = function (value) {
        this._renderer.setElementProperty(this._element, 'value', value);
    };
    VaadinDatePicker.prototype.registerOnChange = function (fn) { this.onChange = fn; };
    VaadinDatePicker.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
    VaadinDatePicker.prototype.ngOnInit = function () {
        this._control = this._injector.get(common_1.NgControl, null);
    };
    VaadinDatePicker.prototype.valuechanged = function (value) {
        var _this = this;
        this.valueChange.emit(value);
        if (this._initialValueSet) {
            // Do not trigger onChange when the initial (empty) value is set
            // to keep the field as "pristine".
            this.onChange(value);
        }
        else {
            this._initialValueSet = true;
        }
        // Pass the invalid state to our native vaadin-date-picker element if
        // it is an ngControl.
        if (this._control != null) {
            setTimeout(function () {
                _this._element.invalid = !_this._control.pristine && !_this._control.valid;
            }, 0);
        }
    };
    __decorate([
        core_1.Output(), 
        __metadata('design:type', core_1.EventEmitter)
    ], VaadinDatePicker.prototype, "valueChange");
    Object.defineProperty(VaadinDatePicker.prototype, "valuechanged",
        __decorate([
            core_1.HostListener('value-changed', ['$event.detail.value']), 
            __metadata('design:type', Function), 
            __metadata('design:paramtypes', [Object]), 
            __metadata('design:returntype', void 0)
        ], VaadinDatePicker.prototype, "valuechanged", Object.getOwnPropertyDescriptor(VaadinDatePicker.prototype, "valuechanged")));
    VaadinDatePicker = __decorate([
        core_1.Directive({
            selector: 'vaadin-date-picker',
            providers: [VAADIN_DATE_PICKER_CONTROL_VALUE_ACCESSOR]
        }), 
        __metadata('design:paramtypes', [core_1.Renderer, core_1.ElementRef, core_1.Injector])
    ], VaadinDatePicker);
    return VaadinDatePicker;
})();
Example #19
0
var RadioButton = (function () {
    function RadioButton(_form, _item, _group) {
        this._form = _form;
        this._item = _item;
        this._group = _group;
        this._checked = false;
        this._disabled = false;
        this._value = null;
        /**
         * @output {any} expression to be evaluated when selected
         */
        this.ionSelect = new core_1.EventEmitter();
        _form.register(this);
        if (_group) {
            // register with the radiogroup
            this.id = 'rb-' + _group.add(this);
        }
        if (_item) {
            // register the input inside of the item
            // reset to the item's id instead of the radiogroup id
            this.id = 'rb-' + _item.registerInput('radio');
            this._labelId = 'lbl-' + _item.id;
            this._item.setCssClass('item-radio', true);
        }
    }
    Object.defineProperty(RadioButton.prototype, "value", {
        /**
         * @input {any} The value of the radio button. Defaults to the generated id.
         */
        get: function () {
            // if the value is not defined then use it's unique id
            return util_1.isBlank(this._value) ? this.id : this._value;
        },
        set: function (val) {
            this._value = val;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RadioButton.prototype, "checked", {
        /**
         * @input {boolean} Whether the radio button should be checked or not. Default false.
         */
        get: function () {
            return this._checked;
        },
        set: function (isChecked) {
            this._checked = util_1.isTrueProperty(isChecked);
            if (this._item) {
                this._item.setCssClass('item-radio-checked', this._checked);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RadioButton.prototype, "disabled", {
        /**
         * @input {boolean} Whether the radio button should be disabled or not. Default false.
         */
        get: function () {
            return this._disabled;
        },
        set: function (val) {
            this._disabled = util_1.isTrueProperty(val);
            this._item && this._item.setCssClass('item-radio-disabled', this._disabled);
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @private
     */
    RadioButton.prototype._click = function (ev) {
        void 0;
        ev.preventDefault();
        ev.stopPropagation();
        this.checked = true;
        this.ionSelect.emit(this.value);
    };
    /**
     * @private
     */
    RadioButton.prototype.ngOnInit = function () {
        if (this._group && util_1.isPresent(this._group.value)) {
            this.checked = util_1.isCheckedProperty(this._group.value, this.value);
        }
    };
    /**
     * @private
     */
    RadioButton.prototype.ngOnDestroy = function () {
        this._form.deregister(this);
        this._group && this._group.remove(this);
    };
    __decorate([
        core_1.Output(), 
        __metadata('design:type', core_1.EventEmitter)
    ], RadioButton.prototype, "ionSelect", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], RadioButton.prototype, "value", null);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Boolean)
    ], RadioButton.prototype, "checked", null);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Boolean)
    ], RadioButton.prototype, "disabled", null);
    __decorate([
        core_1.HostListener('click', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [UIEvent]), 
        __metadata('design:returntype', void 0)
    ], RadioButton.prototype, "_click", null);
    RadioButton = __decorate([
        core_1.Component({
            selector: 'ion-radio',
            template: '<div class="radio-icon" [class.radio-checked]="_checked">' +
                '<div class="radio-inner"></div>' +
                '</div>' +
                '<button role="radio" ' +
                'type="button" ' +
                'category="item-cover" ' +
                '[id]="id" ' +
                '[attr.aria-checked]="_checked" ' +
                '[attr.aria-labelledby]="_labelId" ' +
                '[attr.aria-disabled]="_disabled" ' +
                'class="item-cover">' +
                '</button>',
            host: {
                '[class.radio-disabled]': '_disabled'
            },
            encapsulation: core_1.ViewEncapsulation.None,
        }),
        __param(1, core_1.Optional()),
        __param(2, core_1.Optional()), 
        __metadata('design:paramtypes', [form_1.Form, item_1.Item, radio_group_1.RadioGroup])
    ], RadioButton);
    return RadioButton;
}());
Example #20
0
    SemanticContextMenuComponent.prototype.clickedOutside = function () {
        this.show = false;
    };
    return SemanticContextMenuComponent;
}());
__decorate([
    core_1.Input(),
    __metadata("design:type", Array)
], SemanticContextMenuComponent.prototype, "items", void 0);
__decorate([
    core_1.Input("position"),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], SemanticContextMenuComponent.prototype, "position", null);
__decorate([
    core_1.HostListener("document:click"),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], SemanticContextMenuComponent.prototype, "clickedOutside", null);
SemanticContextMenuComponent = __decorate([
    core_1.Component({
        changeDetection: core_1.ChangeDetectionStrategy.OnPush,
        selector: "sm-contextmenu",
        styles: [".sm-contextmenu { position: fixed; z-index: 1000; }"],
        template: "<div \n[style.left.px]=\"_position?.x\" [style.top.px]=\"_position?.y\"\n[ngClass]=\"{'active visible': show}\" class=\"ui dropdown sm-contextmenu\">\n <div \n [ngClass]=\"{'visible animating slide down in': show, 'hidden': !show}\"  class=\"ui menu transition\">\n <a (click)=\"menu.action()\" *ngFor=\"let menu of items\" class=\"item\">\n <i class=\"{{menu.icon}} icon\"></i>\n {{menu.title}}\n </a>\n </div>\n </div>\n"
    }),
    __metadata("design:paramtypes", [])
], SemanticContextMenuComponent);
exports.SemanticContextMenuComponent = SemanticContextMenuComponent;
Example #21
0
    return PhoneNumberDirective;
}());
__decorate([
    core_1.Input('myPhoneNumber'),
    __metadata("design:type", String)
], PhoneNumberDirective.prototype, "factNumber", void 0);
__decorate([
    core_1.Input('myPhoneNumberFormControl'),
    __metadata("design:type", forms_1.FormControl)
], PhoneNumberDirective.prototype, "factNumberControl", void 0);
__decorate([
    core_1.Output(),
    __metadata("design:type", Object)
], PhoneNumberDirective.prototype, "myPhoneNumberChange", void 0);
__decorate([
    core_1.HostListener('keypress', ['$event']),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [KeyboardEvent]),
    __metadata("design:returntype", void 0)
], PhoneNumberDirective.prototype, "onKeyPress", null);
__decorate([
    core_1.HostListener('keydown', ['$event']),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [KeyboardEvent]),
    __metadata("design:returntype", void 0)
], PhoneNumberDirective.prototype, "onKeyDown", null);
__decorate([
    core_1.HostListener('paste', ['$event']),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Event]),
    __metadata("design:returntype", void 0)
Example #22
0
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@angular/core");
const screenfull = require("screenfull");
let ToggleFullscreenDirective = class ToggleFullscreenDirective {
    onClick() {
        if (screenfull.enabled) {
            screenfull.toggle();
        }
    }
};
__decorate([
    core_1.HostListener('click')
], ToggleFullscreenDirective.prototype, "onClick", null);
ToggleFullscreenDirective = __decorate([
    core_1.Directive({
        selector: '[appToggleFullscreen]'
    })
], ToggleFullscreenDirective);
exports.ToggleFullscreenDirective = ToggleFullscreenDirective;
//# sourceMappingURL=toggle-fullscreen.directive.js.map
var ButtonRadioDirective = (function () {
    function ButtonRadioDirective(cd, el) {
        this.onChange = Function.prototype;
        this.onTouched = Function.prototype;
        // hack!
        this.cd = cd;
        this.el = el;
        cd.valueAccessor = this;
    }
    Object.defineProperty(ButtonRadioDirective.prototype, "isActive", {
        get: function () {
            return this.btnRadio === this.value;
        },
        enumerable: true,
        configurable: true
    });
    ButtonRadioDirective.prototype.onClick = function () {
        if (this.uncheckable && this.btnRadio === this.value) {
            return this.cd.viewToModelUpdate(void 0);
        }
        this.cd.viewToModelUpdate(this.btnRadio);
    };
    ButtonRadioDirective.prototype.ngOnInit = function () {
        this.uncheckable = typeof this.uncheckable !== 'undefined';
    };
    Object.defineProperty(ButtonRadioDirective.prototype, "value", {
        // hack view model!
        get: function () {
            return this.cd.viewModel;
        },
        set: function (value) {
            this.cd.viewModel = value;
        },
        enumerable: true,
        configurable: true
    });
    // ControlValueAccessor
    // model -> view
    ButtonRadioDirective.prototype.writeValue = function (value) {
        this.value = value;
    };
    ButtonRadioDirective.prototype.registerOnChange = function (fn) {
        this.onChange = fn;
    };
    ButtonRadioDirective.prototype.registerOnTouched = function (fn) {
        this.onTouched = fn;
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], ButtonRadioDirective.prototype, "btnRadio", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Boolean)
    ], ButtonRadioDirective.prototype, "uncheckable", void 0);
    __decorate([
        core_1.HostBinding('class.active'), 
        __metadata('design:type', Boolean)
    ], ButtonRadioDirective.prototype, "isActive", null);
    __decorate([
        core_1.HostListener('click'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], ButtonRadioDirective.prototype, "onClick", null);
    ButtonRadioDirective = __decorate([
        core_1.Directive({ selector: '[btnRadio][ngModel]' }),
        __param(0, core_1.Self()), 
        __metadata('design:paramtypes', [common_1.NgModel, core_1.ElementRef])
    ], ButtonRadioDirective);
    return ButtonRadioDirective;
}());
Example #24
0
            this.setCssClass('segment-button-disabled', this._disabled);
        }
    }, {
        key: "isActive",
        set: function set(isActive) {
            this._renderer.setElementClass(this._elementRef.nativeElement, 'segment-activated', isActive);
            this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-pressed', isActive);
        }
    }]);

    return SegmentButton;
}();
__decorate([Input(), __metadata('design:type', String)], SegmentButton.prototype, "value", void 0);
__decorate([Output(), __metadata('design:type', typeof (_a = typeof EventEmitter !== 'undefined' && EventEmitter) === 'function' && _a || Object)], SegmentButton.prototype, "ionSelect", void 0);
__decorate([Input(), __metadata('design:type', Boolean)], SegmentButton.prototype, "disabled", null);
__decorate([HostListener('click'), __metadata('design:type', Function), __metadata('design:paramtypes', []), __metadata('design:returntype', void 0)], SegmentButton.prototype, "onClick", null);
SegmentButton = __decorate([Component({
    selector: 'ion-segment-button',
    template: '<ng-content></ng-content>' + '<ion-button-effect></ion-button-effect>',
    host: {
        'tappable': '',
        'class': 'segment-button',
        'role': 'button'
    },
    encapsulation: ViewEncapsulation.None
}), __metadata('design:paramtypes', [typeof (_b = typeof Renderer !== 'undefined' && Renderer) === 'function' && _b || Object, typeof (_c = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _c || Object])], SegmentButton);
/**
 * @name Segment
 * @description
 * A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls.
 * Segments provide functionality similar to tabs, selecting one will unselect all others. You should use a tab bar instead of a segmented control when you want to let the user move back and forth between distinct pages in your app.
Example #25
0
            this._disabled = isTrueProperty(val);
            this._item && this._item.setCssClass('item-select-disabled', this._disabled);
        }
    }]);

    return Select;
}();
__decorate([Input(), __metadata('design:type', String)], Select.prototype, "cancelText", void 0);
__decorate([Input(), __metadata('design:type', String)], Select.prototype, "okText", void 0);
__decorate([Input(), __metadata('design:type', String)], Select.prototype, "placeholder", void 0);
__decorate([Input(), __metadata('design:type', Object)], Select.prototype, "alertOptions", void 0);
__decorate([Input(), __metadata('design:type', Object)], Select.prototype, "checked", void 0);
__decorate([Input(), __metadata('design:type', String)], Select.prototype, "interface", void 0);
__decorate([Output(), __metadata('design:type', typeof (_a = typeof EventEmitter !== 'undefined' && EventEmitter) === 'function' && _a || Object)], Select.prototype, "ionChange", void 0);
__decorate([Output(), __metadata('design:type', typeof (_b = typeof EventEmitter !== 'undefined' && EventEmitter) === 'function' && _b || Object)], Select.prototype, "ionCancel", void 0);
__decorate([HostListener('click', ['$event']), __metadata('design:type', Function), __metadata('design:paramtypes', [Object]), __metadata('design:returntype', void 0)], Select.prototype, "_click", null);
__decorate([HostListener('keyup.space'), __metadata('design:type', Function), __metadata('design:paramtypes', []), __metadata('design:returntype', void 0)], Select.prototype, "_keyup", null);
__decorate([Input(), __metadata('design:type', Object)], Select.prototype, "multiple", null);
__decorate([ContentChildren(Option), __metadata('design:type', typeof (_c = typeof QueryList !== 'undefined' && QueryList) === 'function' && _c || Object), __metadata('design:paramtypes', [typeof (_d = typeof QueryList !== 'undefined' && QueryList) === 'function' && _d || Object])], Select.prototype, "options", null);
__decorate([Input(), __metadata('design:type', Object)], Select.prototype, "disabled", null);
Select = __decorate([Component({
    selector: 'ion-select',
    template: "\n    <div *ngIf=\"!_text\" class=\"select-placeholder select-text\">{{placeholder}}</div>\n    <div *ngIf=\"_text\" class=\"select-text\">{{_text}}</div>\n    <div class=\"select-icon\">\n      <div class=\"select-icon-inner\"></div>\n    </div>\n    <button aria-haspopup=\"true\"\n            [id]=\"id\"\n            category=\"item-cover\"\n            [attr.aria-labelledby]=\"_labelId\"\n            [attr.aria-disabled]=\"_disabled\"\n            class=\"item-cover\">\n    </button>\n  ",
    directives: [NgIf],
    host: {
        '[class.select-disabled]': '_disabled'
    },
    providers: [SELECT_VALUE_ACCESSOR],
    encapsulation: ViewEncapsulation.None
}), __param(4, Optional()), __param(5, Optional()), __metadata('design:paramtypes', [typeof (_e = typeof App !== 'undefined' && App) === 'function' && _e || Object, typeof (_f = typeof Form !== 'undefined' && Form) === 'function' && _f || Object, typeof (_g = typeof ElementRef !== 'undefined' && ElementRef) === 'function' && _g || Object, typeof (_h = typeof Renderer !== 'undefined' && Renderer) === 'function' && _h || Object, typeof (_j = typeof Item !== 'undefined' && Item) === 'function' && _j || Object, typeof (_k = typeof NavController !== 'undefined' && NavController) === 'function' && _k || Object])], Select);
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
Example #26
0
var Select = (function () {
    function Select(_app, _form, _elementRef, _renderer, _item, _nav) {
        this._app = _app;
        this._form = _form;
        this._elementRef = _elementRef;
        this._renderer = _renderer;
        this._item = _item;
        this._nav = _nav;
        this._disabled = false;
        this._multi = false;
        this._values = [];
        this._texts = [];
        this._text = '';
        this._isOpen = false;
        /**
         * @input {string} The text to display on the cancel button. Default: `Cancel`.
         */
        this.cancelText = 'Cancel';
        /**
         * @input {string} The text to display on the ok button. Default: `OK`.
         */
        this.okText = 'OK';
        /**
         * @input {any} Any addition options that the alert interface can take.
         * See the [Alert API docs](../../alert/Alert) for the create options.
         */
        this.alertOptions = {};
        /**
         * @input {string} The interface the select should use: `action-sheet` or `alert`. Default: `alert`.
         */
        this.interface = '';
        /**
         * @input {string} The text to display instead of the selected option's value.
         */
        this.selectedText = '';
        /**
         * @output {any} Any expression you want to evaluate when the selection has changed.
         */
        this.ionChange = new core_1.EventEmitter();
        /**
         * @output {any} Any expression you want to evaluate when the selection was cancelled.
         */
        this.ionCancel = new core_1.EventEmitter();
        this._form.register(this);
        if (_item) {
            this.id = 'sel-' + _item.registerInput('select');
            this._labelId = 'lbl-' + _item.id;
            this._item.setCssClass('item-select', true);
        }
    }
    Select.prototype._click = function (ev) {
        if (ev.detail === 0) {
            // do not continue if the click event came from a form submit
            return;
        }
        ev.preventDefault();
        ev.stopPropagation();
        this.open();
    };
    Select.prototype._keyup = function () {
        if (!this._isOpen) {
            this.open();
        }
    };
    /**
     * Open the select interface.
     */
    Select.prototype.open = function () {
        var _this = this;
        if (this._disabled) {
            return;
        }
        void 0;
        // the user may have assigned some options specifically for the alert
        var alertOptions = util_1.merge({}, this.alertOptions);
        // make sure their buttons array is removed from the options
        // and we create a new array for the alert's two buttons
        alertOptions.buttons = [{
                text: this.cancelText,
                role: 'cancel',
                handler: function () {
                    _this.ionCancel.emit(null);
                }
            }];
        // if the alertOptions didn't provide an title then use the label's text
        if (!alertOptions.title && this._item) {
            alertOptions.title = this._item.getLabelText();
        }
        var options = this._options.toArray();
        if (this.interface === 'action-sheet' && options.length > 6) {
            void 0;
            this.interface = 'alert';
        }
        if (this.interface === 'action-sheet' && this._multi) {
            void 0;
            this.interface = 'alert';
        }
        var overlay;
        if (this.interface === 'action-sheet') {
            alertOptions.buttons = alertOptions.buttons.concat(options.map(function (input) {
                return {
                    role: (input.selected ? 'selected' : ''),
                    text: input.text,
                    handler: function () {
                        _this.onChange(input.value);
                        _this.ionChange.emit(input.value);
                    }
                };
            }));
            alertOptions.cssClass = 'select-action-sheet';
            overlay = new action_sheet_1.ActionSheet(this._app, alertOptions);
        }
        else {
            // default to use the alert interface
            this.interface = 'alert';
            // user cannot provide inputs from alertOptions
            // alert inputs must be created by ionic from ion-options
            alertOptions.inputs = this._options.map(function (input) {
                return {
                    type: (_this._multi ? 'checkbox' : 'radio'),
                    label: input.text,
                    value: input.value,
                    checked: input.selected,
                    disabled: input.disabled
                };
            });
            var selectCssClass = 'select-alert';
            // create the alert instance from our built up alertOptions
            overlay = new alert_1.Alert(this._app, alertOptions);
            if (this._multi) {
                // use checkboxes
                selectCssClass += ' multiple-select-alert';
            }
            else {
                // use radio buttons
                selectCssClass += ' single-select-alert';
            }
            // If the user passed a cssClass for the select, add it
            selectCssClass += alertOptions.cssClass ? ' ' + alertOptions.cssClass : '';
            overlay.setCssClass(selectCssClass);
            overlay.addButton({
                text: this.okText,
                handler: function (selectedValues) {
                    _this.onChange(selectedValues);
                    _this.ionChange.emit(selectedValues);
                }
            });
        }
        overlay.present(alertOptions);
        this._isOpen = true;
        overlay.onDidDismiss(function () {
            _this._isOpen = false;
        });
    };
    Object.defineProperty(Select.prototype, "multiple", {
        /**
         * @input {boolean} Whether or not the select component can accept multiple values. Default: `false`.
         */
        get: function () {
            return this._multi;
        },
        set: function (val) {
            this._multi = util_1.isTrueProperty(val);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Select.prototype, "text", {
        /**
         * @private
         */
        get: function () {
            return (this._multi ? this._texts : this._texts.join());
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Select.prototype, "options", {
        /**
         * @private
         */
        set: function (val) {
            this._options = val;
            if (!this._values.length) {
                // there are no values set at this point
                // so check to see who should be selected
                this._values = val.filter(function (o) { return o.selected; }).map(function (o) { return o.value; });
            }
            this._updOpts();
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @private
     */
    Select.prototype._updOpts = function () {
        var _this = this;
        this._texts = [];
        if (this._options) {
            this._options.forEach(function (option) {
                // check this option if the option's value is in the values array
                option.selected = _this._values.some(function (selectValue) {
                    return util_1.isCheckedProperty(selectValue, option.value);
                });
                if (option.selected) {
                    _this._texts.push(option.text);
                }
            });
        }
        this._text = this._texts.join(', ');
    };
    Object.defineProperty(Select.prototype, "disabled", {
        /**
         * @input {boolean} Whether or not the select component is disabled. Default `false`.
         */
        get: function () {
            return this._disabled;
        },
        set: function (val) {
            this._disabled = util_1.isTrueProperty(val);
            this._item && this._item.setCssClass('item-select-disabled', this._disabled);
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @private
     */
    Select.prototype.writeValue = function (val) {
        void 0;
        this._values = (Array.isArray(val) ? val : util_1.isBlank(val) ? [] : [val]);
        this._updOpts();
    };
    /**
     * @private
     */
    Select.prototype.ngAfterContentInit = function () {
        this._updOpts();
    };
    /**
     * @private
     */
    Select.prototype.registerOnChange = function (fn) {
        var _this = this;
        this._fn = fn;
        this.onChange = function (val) {
            void 0;
            fn(val);
            _this._values = (Array.isArray(val) ? val : util_1.isBlank(val) ? [] : [val]);
            _this._updOpts();
            _this.onTouched();
        };
    };
    /**
     * @private
     */
    Select.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
    /**
     * @private
     */
    Select.prototype.onChange = function (val) {
        // onChange used when there is not an formControlName
        void 0;
        this._values = (Array.isArray(val) ? val : util_1.isBlank(val) ? [] : [val]);
        this._updOpts();
        this.onTouched();
    };
    /**
     * @private
     */
    Select.prototype.onTouched = function () { };
    /**
     * @private
     */
    Select.prototype.ngOnDestroy = function () {
        this._form.deregister(this);
    };
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], Select.prototype, "cancelText", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], Select.prototype, "okText", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], Select.prototype, "placeholder", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], Select.prototype, "alertOptions", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], Select.prototype, "interface", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', String)
    ], Select.prototype, "selectedText", void 0);
    __decorate([
        core_1.Output(), 
        __metadata('design:type', core_1.EventEmitter)
    ], Select.prototype, "ionChange", void 0);
    __decorate([
        core_1.Output(), 
        __metadata('design:type', core_1.EventEmitter)
    ], Select.prototype, "ionCancel", void 0);
    __decorate([
        core_1.HostListener('click', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [UIEvent]), 
        __metadata('design:returntype', void 0)
    ], Select.prototype, "_click", null);
    __decorate([
        core_1.HostListener('keyup.space'), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', []), 
        __metadata('design:returntype', void 0)
    ], Select.prototype, "_keyup", null);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], Select.prototype, "multiple", null);
    __decorate([
        core_1.ContentChildren(option_1.Option), 
        __metadata('design:type', core_1.QueryList), 
        __metadata('design:paramtypes', [core_1.QueryList])
    ], Select.prototype, "options", null);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], Select.prototype, "disabled", null);
    Select = __decorate([
        core_1.Component({
            selector: 'ion-select',
            template: "\n    <div *ngIf=\"!_text\" class=\"select-placeholder select-text\">{{placeholder}}</div>\n    <div *ngIf=\"_text\" class=\"select-text\">{{selectedText || _text}}</div>\n    <div class=\"select-icon\">\n      <div class=\"select-icon-inner\"></div>\n    </div>\n    <button aria-haspopup=\"true\"\n            [id]=\"id\"\n            category=\"item-cover\"\n            [attr.aria-labelledby]=\"_labelId\"\n            [attr.aria-disabled]=\"_disabled\"\n            class=\"item-cover\">\n    </button>\n  ",
            directives: [common_1.NgIf],
            host: {
                '[class.select-disabled]': '_disabled'
            },
            providers: [exports.SELECT_VALUE_ACCESSOR],
            encapsulation: core_1.ViewEncapsulation.None,
        }),
        __param(4, core_1.Optional()),
        __param(5, core_1.Optional()), 
        __metadata('design:paramtypes', [app_1.App, form_1.Form, core_1.ElementRef, core_1.Renderer, item_1.Item, nav_controller_1.NavController])
    ], Select);
    return Select;
}());
Example #27
0
var LineChartComponent = /** @class */ (function (_super) {
    __extends(LineChartComponent, _super);
    function LineChartComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.legendTitle = 'Legend';
        _this.legendPosition = 'right';
        _this.showGridLines = true;
        _this.curve = curveLinear;
        _this.activeEntries = [];
        _this.roundDomains = false;
        _this.tooltipDisabled = false;
        _this.showRefLines = false;
        _this.showRefLabels = true;
        _this.activate = new EventEmitter();
        _this.deactivate = new EventEmitter();
        _this.margin = [10, 20, 10, 20];
        _this.xAxisHeight = 0;
        _this.yAxisWidth = 0;
        _this.timelineHeight = 50;
        _this.timelinePadding = 10;
        return _this;
    }
    LineChartComponent.prototype.update = function () {
        _super.prototype.update.call(this);
        this.dims = calculateViewDimensions({
            width: this.width,
            height: this.height,
            margins: this.margin,
            showXAxis: this.xAxis,
            showYAxis: this.yAxis,
            xAxisHeight: this.xAxisHeight,
            yAxisWidth: this.yAxisWidth,
            showXLabel: this.showXAxisLabel,
            showYLabel: this.showYAxisLabel,
            showLegend: this.legend,
            legendType: this.schemeType,
            legendPosition: this.legendPosition
        });
        if (this.timeline) {
            this.dims.height -= (this.timelineHeight + this.margin[2] + this.timelinePadding);
        }
        this.xDomain = this.getXDomain();
        if (this.filteredDomain) {
            this.xDomain = this.filteredDomain;
        }
        this.yDomain = this.getYDomain();
        this.seriesDomain = this.getSeriesDomain();
        this.xScale = this.getXScale(this.xDomain, this.dims.width);
        this.yScale = this.getYScale(this.yDomain, this.dims.height);
        this.updateTimeline();
        this.setColors();
        this.legendOptions = this.getLegendOptions();
        this.transform = "translate(" + this.dims.xOffset + " , " + this.margin[0] + ")";
        this.clipPathId = 'clip' + id().toString();
        this.clipPath = "url(#" + this.clipPathId + ")";
    };
    LineChartComponent.prototype.updateTimeline = function () {
        if (this.timeline) {
            this.timelineWidth = this.dims.width;
            this.timelineXDomain = this.getXDomain();
            this.timelineXScale = this.getXScale(this.timelineXDomain, this.timelineWidth);
            this.timelineYScale = this.getYScale(this.yDomain, this.timelineHeight);
            this.timelineTransform = "translate(" + this.dims.xOffset + ", " + -this.margin[2] + ")";
        }
    };
    LineChartComponent.prototype.getXDomain = function () {
        var values = getUniqueXDomainValues(this.results);
        this.scaleType = getScaleType(values);
        var domain = [];
        if (this.scaleType === 'linear') {
            values = values.map(function (v) { return Number(v); });
        }
        var min;
        var max;
        if (this.scaleType === 'time' || this.scaleType === 'linear') {
            min = this.xScaleMin
                ? this.xScaleMin
                : Math.min.apply(Math, values);
            max = this.xScaleMax
                ? this.xScaleMax
                : Math.max.apply(Math, values);
        }
        if (this.scaleType === 'time') {
            domain = [new Date(min), new Date(max)];
            this.xSet = values.slice().sort(function (a, b) {
                var aDate = a.getTime();
                var bDate = b.getTime();
                if (aDate > bDate)
                    return 1;
                if (bDate > aDate)
                    return -1;
                return 0;
            });
        }
        else if (this.scaleType === 'linear') {
            domain = [min, max];
            // Use compare function to sort numbers numerically
            this.xSet = values.slice().sort(function (a, b) { return (a - b); });
        }
        else {
            domain = values;
            this.xSet = values;
        }
        return domain;
    };
    LineChartComponent.prototype.getYDomain = function () {
        var domain = [];
        for (var _i = 0, _a = this.results; _i < _a.length; _i++) {
            var results = _a[_i];
            for (var _b = 0, _c = results.series; _b < _c.length; _b++) {
                var d = _c[_b];
                if (domain.indexOf(d.value) < 0) {
                    domain.push(d.value);
                }
                if (d.min !== undefined) {
                    this.hasRange = true;
                    if (domain.indexOf(d.min) < 0) {
                        domain.push(d.min);
                    }
                }
                if (d.max !== undefined) {
                    this.hasRange = true;
                    if (domain.indexOf(d.max) < 0) {
                        domain.push(d.max);
                    }
                }
            }
        }
        var values = domain.slice();
        if (!this.autoScale) {
            values.push(0);
        }
        var min = this.yScaleMin
            ? this.yScaleMin
            : Math.min.apply(Math, values);
        var max = this.yScaleMax
            ? this.yScaleMax
            : Math.max.apply(Math, values);
        return [min, max];
    };
    LineChartComponent.prototype.getSeriesDomain = function () {
        return this.results.map(function (d) { return d.name; });
    };
    LineChartComponent.prototype.getXScale = function (domain, width) {
        var scale;
        if (this.scaleType === 'time') {
            scale = scaleTime()
                .range([0, width])
                .domain(domain);
        }
        else if (this.scaleType === 'linear') {
            scale = scaleLinear()
                .range([0, width])
                .domain(domain);
            if (this.roundDomains) {
                scale = scale.nice();
            }
        }
        else if (this.scaleType === 'ordinal') {
            scale = scalePoint()
                .range([0, width])
                .padding(0.1)
                .domain(domain);
        }
        return scale;
    };
    LineChartComponent.prototype.getYScale = function (domain, height) {
        var scale = scaleLinear()
            .range([height, 0])
            .domain(domain);
        return this.roundDomains ? scale.nice() : scale;
    };
    LineChartComponent.prototype.updateDomain = function (domain) {
        this.filteredDomain = domain;
        this.xDomain = this.filteredDomain;
        this.xScale = this.getXScale(this.xDomain, this.dims.width);
    };
    LineChartComponent.prototype.updateHoveredVertical = function (item) {
        this.hoveredVertical = item.value;
        this.deactivateAll();
    };
    LineChartComponent.prototype.hideCircles = function () {
        this.hoveredVertical = null;
        this.deactivateAll();
    };
    LineChartComponent.prototype.onClick = function (data, series) {
        if (series) {
            data.series = series.name;
        }
        this.select.emit(data);
    };
    LineChartComponent.prototype.trackBy = function (index, item) {
        return item.name;
    };
    LineChartComponent.prototype.setColors = function () {
        var domain;
        if (this.schemeType === 'ordinal') {
            domain = this.seriesDomain;
        }
        else {
            domain = this.yDomain;
        }
        this.colors = new ColorHelper(this.scheme, this.schemeType, domain, this.customColors);
    };
    LineChartComponent.prototype.getLegendOptions = function () {
        var opts = {
            scaleType: this.schemeType,
            colors: undefined,
            domain: [],
            title: undefined,
            position: this.legendPosition
        };
        if (opts.scaleType === 'ordinal') {
            opts.domain = this.seriesDomain;
            opts.colors = this.colors;
            opts.title = this.legendTitle;
        }
        else {
            opts.domain = this.yDomain;
            opts.colors = this.colors.scale;
        }
        return opts;
    };
    LineChartComponent.prototype.updateYAxisWidth = function (_a) {
        var width = _a.width;
        this.yAxisWidth = width;
        this.update();
    };
    LineChartComponent.prototype.updateXAxisHeight = function (_a) {
        var height = _a.height;
        this.xAxisHeight = height;
        this.update();
    };
    LineChartComponent.prototype.onActivate = function (item) {
        this.deactivateAll();
        var idx = this.activeEntries.findIndex(function (d) {
            return d.name === item.name && d.value === item.value;
        });
        if (idx > -1) {
            return;
        }
        this.activeEntries = [item];
        this.activate.emit({ value: item, entries: this.activeEntries });
    };
    LineChartComponent.prototype.onDeactivate = function (item) {
        var idx = this.activeEntries.findIndex(function (d) {
            return d.name === item.name && d.value === item.value;
        });
        this.activeEntries.splice(idx, 1);
        this.activeEntries = this.activeEntries.slice();
        this.deactivate.emit({ value: item, entries: this.activeEntries });
    };
    LineChartComponent.prototype.deactivateAll = function () {
        this.activeEntries = this.activeEntries.slice();
        for (var _i = 0, _a = this.activeEntries; _i < _a.length; _i++) {
            var entry = _a[_i];
            this.deactivate.emit({ value: entry, entries: [] });
        }
        this.activeEntries = [];
    };
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "legend", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], LineChartComponent.prototype, "legendTitle", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], LineChartComponent.prototype, "legendPosition", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "xAxis", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "yAxis", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "showXAxisLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "showYAxisLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "xAxisLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "yAxisLabel", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "autoScale", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "timeline", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LineChartComponent.prototype, "gradient", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LineChartComponent.prototype, "showGridLines", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "curve", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Array)
    ], LineChartComponent.prototype, "activeEntries", void 0);
    __decorate([
        Input(),
        __metadata("design:type", String)
    ], LineChartComponent.prototype, "schemeType", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Number)
    ], LineChartComponent.prototype, "rangeFillOpacity", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "xAxisTickFormatting", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "yAxisTickFormatting", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Array)
    ], LineChartComponent.prototype, "xAxisTicks", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Array)
    ], LineChartComponent.prototype, "yAxisTicks", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LineChartComponent.prototype, "roundDomains", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LineChartComponent.prototype, "tooltipDisabled", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LineChartComponent.prototype, "showRefLines", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "referenceLines", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LineChartComponent.prototype, "showRefLabels", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "xScaleMin", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Object)
    ], LineChartComponent.prototype, "xScaleMax", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Number)
    ], LineChartComponent.prototype, "yScaleMin", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Number)
    ], LineChartComponent.prototype, "yScaleMax", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], LineChartComponent.prototype, "activate", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], LineChartComponent.prototype, "deactivate", void 0);
    __decorate([
        ContentChild('tooltipTemplate'),
        __metadata("design:type", TemplateRef)
    ], LineChartComponent.prototype, "tooltipTemplate", void 0);
    __decorate([
        ContentChild('seriesTooltipTemplate'),
        __metadata("design:type", TemplateRef)
    ], LineChartComponent.prototype, "seriesTooltipTemplate", void 0);
    __decorate([
        HostListener('mouseleave'),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", []),
        __metadata("design:returntype", void 0)
    ], LineChartComponent.prototype, "hideCircles", null);
    LineChartComponent = __decorate([
        Component({
            selector: 'ngx-charts-line-chart',
            template: "\n    <ngx-charts-chart\n      [view]=\"[width, height]\"\n      [showLegend]=\"legend\"\n      [legendOptions]=\"legendOptions\"\n      [activeEntries]=\"activeEntries\"\n      [animations]=\"animations\"\n      (legendLabelClick)=\"onClick($event)\"\n      (legendLabelActivate)=\"onActivate($event)\"\n      (legendLabelDeactivate)=\"onDeactivate($event)\">\n      <svg:defs>\n        <svg:clipPath [attr.id]=\"clipPathId\">\n          <svg:rect\n            [attr.width]=\"dims.width + 10\"\n            [attr.height]=\"dims.height + 10\"\n            [attr.transform]=\"'translate(-5, -5)'\"/>\n        </svg:clipPath>\n      </svg:defs>\n      <svg:g [attr.transform]=\"transform\" class=\"line-chart chart\">\n        <svg:g ngx-charts-x-axis\n          *ngIf=\"xAxis\"\n          [xScale]=\"xScale\"\n          [dims]=\"dims\"\n          [showGridLines]=\"showGridLines\"\n          [showLabel]=\"showXAxisLabel\"\n          [labelText]=\"xAxisLabel\"\n          [tickFormatting]=\"xAxisTickFormatting\"\n          [ticks]=\"xAxisTicks\"\n          (dimensionsChanged)=\"updateXAxisHeight($event)\">\n        </svg:g>\n        <svg:g ngx-charts-y-axis\n          *ngIf=\"yAxis\"\n          [yScale]=\"yScale\"\n          [dims]=\"dims\"\n          [showGridLines]=\"showGridLines\"\n          [showLabel]=\"showYAxisLabel\"\n          [labelText]=\"yAxisLabel\"\n          [tickFormatting]=\"yAxisTickFormatting\"\n          [ticks]=\"yAxisTicks\"\n          [referenceLines]=\"referenceLines\"\n          [showRefLines]=\"showRefLines\"\n          [showRefLabels]=\"showRefLabels\"\n          (dimensionsChanged)=\"updateYAxisWidth($event)\">\n        </svg:g>\n        <svg:g [attr.clip-path]=\"clipPath\">\n          <svg:g *ngFor=\"let series of results; trackBy:trackBy\" [@animationState]=\"'active'\">\n            <svg:g ngx-charts-line-series\n              [xScale]=\"xScale\"\n              [yScale]=\"yScale\"\n              [colors]=\"colors\"\n              [data]=\"series\"\n              [activeEntries]=\"activeEntries\"\n              [scaleType]=\"scaleType\"\n              [curve]=\"curve\"\n              [rangeFillOpacity]=\"rangeFillOpacity\"\n              [hasRange]=\"hasRange\"\n              [animations]=\"animations\"\n            />\n          </svg:g>\n\n          <svg:g *ngIf=\"!tooltipDisabled\" (mouseleave)=\"hideCircles()\">\n            <svg:g ngx-charts-tooltip-area\n              [dims]=\"dims\"\n              [xSet]=\"xSet\"\n              [xScale]=\"xScale\"\n              [yScale]=\"yScale\"\n              [results]=\"results\"\n              [colors]=\"colors\"\n              [tooltipDisabled]=\"tooltipDisabled\"\n              [tooltipTemplate]=\"seriesTooltipTemplate\"\n              (hover)=\"updateHoveredVertical($event)\"\n            />\n\n            <svg:g *ngFor=\"let series of results\">\n              <svg:g ngx-charts-circle-series\n                [xScale]=\"xScale\"\n                [yScale]=\"yScale\"\n                [colors]=\"colors\"\n                [data]=\"series\"\n                [scaleType]=\"scaleType\"\n                [visibleValue]=\"hoveredVertical\"\n                [activeEntries]=\"activeEntries\"\n                [tooltipDisabled]=\"tooltipDisabled\"\n                [tooltipTemplate]=\"tooltipTemplate\"\n                (select)=\"onClick($event, series)\"\n                (activate)=\"onActivate($event)\"\n                (deactivate)=\"onDeactivate($event)\"\n              />\n            </svg:g>\n          </svg:g>\n        </svg:g>\n      </svg:g>\n      <svg:g ngx-charts-timeline\n        *ngIf=\"timeline && scaleType != 'ordinal'\"\n        [attr.transform]=\"timelineTransform\"\n        [results]=\"results\"\n        [view]=\"[timelineWidth, height]\"\n        [height]=\"timelineHeight\"\n        [scheme]=\"scheme\"\n        [customColors]=\"customColors\"\n        [scaleType]=\"scaleType\"\n        [legend]=\"legend\"\n        (onDomainChange)=\"updateDomain($event)\">\n        <svg:g *ngFor=\"let series of results; trackBy:trackBy\">\n          <svg:g ngx-charts-line-series\n            [xScale]=\"timelineXScale\"\n            [yScale]=\"timelineYScale\"\n            [colors]=\"colors\"\n            [data]=\"series\"\n            [scaleType]=\"scaleType\"\n            [curve]=\"curve\"\n            [hasRange]=\"hasRange\"\n            [animations]=\"animations\"\n          />\n        </svg:g>\n      </svg:g>\n    </ngx-charts-chart>\n  ",
            styleUrls: ['../common/base-chart.component.css'],
            encapsulation: ViewEncapsulation.None,
            changeDetection: ChangeDetectionStrategy.OnPush,
            animations: [
                trigger('animationState', [
                    transition(':leave', [
                        style({
                            opacity: 1,
                        }),
                        animate(500, style({
                            opacity: 0
                        }))
                    ])
                ])
            ]
        })
    ], LineChartComponent);
    return LineChartComponent;
}(BaseChartComponent));
var LongPressDirective = /** @class */ (function () {
    function LongPressDirective() {
        this.duration = 3000;
        this.disabled = false;
        this.longPressStart = new EventEmitter();
        this.longPressFinish = new EventEmitter();
        this.longPressCancel = new EventEmitter();
        this.pressed = false;
    }
    LongPressDirective.prototype.onPress = function (event) {
        var _this = this;
        if (this.disabled) {
            event.stopPropagation();
            event.preventDefault();
            return;
        }
        this.pressed = true;
        this.longPressStart.emit(true);
        this.pressTimeout = setTimeout(function () {
            if (_this.pressed) {
                _this.pressed = false;
                _this.longPressFinish.emit(true);
            }
        }, this.duration);
    };
    LongPressDirective.prototype.onRelease = function (event) {
        this.pressed = false;
        clearTimeout(this.pressTimeout);
        this.longPressCancel.emit(true);
    };
    __decorate([
        Input(),
        __metadata("design:type", Number)
    ], LongPressDirective.prototype, "duration", void 0);
    __decorate([
        Input(),
        __metadata("design:type", Boolean)
    ], LongPressDirective.prototype, "disabled", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], LongPressDirective.prototype, "longPressStart", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], LongPressDirective.prototype, "longPressFinish", void 0);
    __decorate([
        Output(),
        __metadata("design:type", EventEmitter)
    ], LongPressDirective.prototype, "longPressCancel", void 0);
    __decorate([
        HostListener('mousedown', ['$event']),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [Object]),
        __metadata("design:returntype", void 0)
    ], LongPressDirective.prototype, "onPress", null);
    __decorate([
        HostListener('mouseout', ['$event']),
        HostListener('mouseup', ['$event']),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [Object]),
        __metadata("design:returntype", void 0)
    ], LongPressDirective.prototype, "onRelease", null);
    LongPressDirective = __decorate([
        Directive({ selector: '[long-press]' })
    ], LongPressDirective);
    return LongPressDirective;
}());
Example #29
0
var MdSidenav = (function () {
    /**
     * @param _elementRef The DOM element reference. Used for transition and width calculation.
     *     If not available we do not hook on transitions.
     */
    function MdSidenav(_elementRef) {
        this._elementRef = _elementRef;
        /** Alignment of the sidenav (direction neutral); whether 'start' or 'end'. */
        this.align = 'start';
        /** Mode of the sidenav; whether 'over' or 'side'. */
        this.mode = 'over';
        /** Whether the sidenav is opened. */
        this._opened = false;
        /** Event emitted when the sidenav is being opened. Use this to synchronize animations. */
        this.onOpenStart = new core_1.EventEmitter();
        /** Event emitted when the sidenav is fully opened. */
        this.onOpen = new core_1.EventEmitter();
        /** Event emitted when the sidenav is being closed. Use this to synchronize animations. */
        this.onCloseStart = new core_1.EventEmitter();
        /** Event emitted when the sidenav is fully closed. */
        this.onClose = new core_1.EventEmitter();
        this._transition = false;
    }
    Object.defineProperty(MdSidenav.prototype, "opened", {
        /**
         * Whether the sidenav is opened. We overload this because we trigger an event when it
         * starts or end.
         */
        get: function () { return this._opened; },
        set: function (v) {
            this.toggle(v);
        },
        enumerable: true,
        configurable: true
    });
    /** Open this sidenav, and return a Promise that will resolve when it's fully opened (or get
     * rejected if it didn't). */
    MdSidenav.prototype.open = function () {
        return this.toggle(true);
    };
    /**
     * Close this sidenav, and return a Promise that will resolve when it's fully closed (or get
     * rejected if it didn't).
     */
    MdSidenav.prototype.close = function () {
        return this.toggle(false);
    };
    /**
     * Toggle this sidenav. This is equivalent to calling open() when it's already opened, or
     * close() when it's closed.
     * @param isOpen
     */
    MdSidenav.prototype.toggle = function (isOpen) {
        if (isOpen === void 0) { isOpen = !this.opened; }
        // Shortcut it if we're already opened.
        if (isOpen === this.opened) {
            if (!this._transition) {
                return Promise.resolve();
            }
            else {
                return isOpen ? this._openPromise : this._closePromise;
            }
        }
        this._opened = isOpen;
        this._transition = true;
        if (isOpen) {
            this.onOpenStart.emit(null);
        }
        else {
            this.onCloseStart.emit(null);
        }
        if (isOpen) {
            if (this._openPromise == null) {
                var completer = new promise_completer_1.PromiseCompleter();
                this._openPromise = completer.promise;
                this._openPromiseReject = completer.reject;
                this._openPromiseResolve = completer.resolve;
            }
            return this._openPromise;
        }
        else {
            if (this._closePromise == null) {
                var completer = new promise_completer_1.PromiseCompleter();
                this._closePromise = completer.promise;
                this._closePromiseReject = completer.reject;
                this._closePromiseResolve = completer.resolve;
            }
            return this._closePromise;
        }
    };
    /**
     * When transition has finished, set the internal state for classes and emit the proper event.
     * The event passed is actually of type TransitionEvent, but that type is not available in
     * Android so we use any.
     * @param e The event.
     * @private
     */
    MdSidenav.prototype.onTransitionEnd = function (e) {
        if (e.target == this._elementRef.nativeElement
            && e.propertyName.endsWith('transform')) {
            this._transition = false;
            if (this._opened) {
                if (this._openPromise != null) {
                    this._openPromiseResolve();
                }
                if (this._closePromise != null) {
                    this._closePromiseReject();
                }
                this.onOpen.emit(null);
            }
            else {
                if (this._closePromise != null) {
                    this._closePromiseResolve();
                }
                if (this._openPromise != null) {
                    this._openPromiseReject();
                }
                this.onClose.emit(null);
            }
            this._openPromise = null;
            this._closePromise = null;
        }
    };
    Object.defineProperty(MdSidenav.prototype, "_isClosing", {
        get: function () {
            return !this._opened && this._transition;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_isOpening", {
        get: function () {
            return this._opened && this._transition;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_isClosed", {
        get: function () {
            return !this._opened && !this._transition;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_isOpened", {
        get: function () {
            return this._opened && !this._transition;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_isEnd", {
        get: function () {
            return this.align == 'end';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_modeSide", {
        get: function () {
            return this.mode == 'side';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_modeOver", {
        get: function () {
            return this.mode == 'over';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_modePush", {
        get: function () {
            return this.mode == 'push';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(MdSidenav.prototype, "_width", {
        /**
         * This is public because we need it from MdSidenavLayout, but it's undocumented and should
         * not be used outside.
         * @private
         */
        get: function () {
            if (this._elementRef.nativeElement) {
                return this._elementRef.nativeElement.offsetWidth;
            }
            return 0;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "align", void 0);
    __decorate([
        core_1.Input(), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "mode", void 0);
    __decorate([
        core_1.Input('opened'), 
        __metadata('design:type', Boolean)
    ], MdSidenav.prototype, "_opened", void 0);
    __decorate([
        core_1.Output('open-start'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "onOpenStart", void 0);
    __decorate([
        core_1.Output('open'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "onOpen", void 0);
    __decorate([
        core_1.Output('close-start'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "onCloseStart", void 0);
    __decorate([
        core_1.Output('close'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "onClose", void 0);
    __decorate([
        core_1.HostListener('transitionend', ['$event']), 
        __metadata('design:type', Function), 
        __metadata('design:paramtypes', [Object]), 
        __metadata('design:returntype', void 0)
    ], MdSidenav.prototype, "onTransitionEnd", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-closing'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_isClosing", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-opening'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_isOpening", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-closed'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_isClosed", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-opened'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_isOpened", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-end'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_isEnd", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-side'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_modeSide", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-over'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_modeOver", null);
    __decorate([
        core_1.HostBinding('class.md-sidenav-push'), 
        __metadata('design:type', Object)
    ], MdSidenav.prototype, "_modePush", null);
    MdSidenav = __decorate([
        core_1.Component({
            selector: 'md-sidenav',
            template: '<ng-content></ng-content>',
            changeDetection: core_1.ChangeDetectionStrategy.OnPush,
        }), 
        __metadata('design:paramtypes', [core_1.ElementRef])
    ], MdSidenav);
    return MdSidenav;
}());
var ContextualCommComponent = (function () {
    function ContextualCommComponent(el, router, route, appService, contextualCommDataService, contactService) {
        var _this = this;
        this.el = el;
        this.router = router;
        this.route = route;
        this.appService = appService;
        this.contextualCommDataService = contextualCommDataService;
        this.contactService = contactService;
        this.hostClass = 'context-view row no-gutters';
        this.allowAddUser = false;
        this.userList = new BehaviorSubject_1.BehaviorSubject([]);
        this.route.data.subscribe(function (data) {
            _this.updateCurrentContext(data.context);
        });
        this.contextualCommDataService.currentContext().subscribe(function (context) {
            console.log('[ContextualComm View - active context change]:', context);
            _this.updateCurrentContext(context);
        });
    }
    ContextualCommComponent.prototype.onResize = function (event) {
        this.updateView();
    };
    ContextualCommComponent.prototype.updateCurrentContext = function (context) {
        var _this = this;
        console.log('[ContextualComm View - active context change]:', context);
        this.allowAddUser = context.reporter ? true : false;
        // Check if the context is not an atomicContext
        // TODO: we should check for an instance of Atomic and Composite Context;
        if (!context.id.includes('@')) {
            console.log('[ContextualComm View - is not an Atomic Context]:', context);
            this.userList.next(context.users);
        }
        else {
            var normalizedPath = utils_1.normalizeFromURL(this.router.url, this.contactService.sessionUser.username);
            var normalizedName = utils_1.normalizeName(normalizedPath);
            console.log('[ContextualComm View - get parent active context]:', normalizedPath);
            console.log('[ContextualComm View - get parent active context]:', normalizedName);
            var result = void 0;
            if (utils_1.isAnUser(normalizedName.name)) {
                result = this.contextualCommDataService.getContext(normalizedName.name);
            }
            else {
                result = this.contextualCommDataService.getContextById(normalizedName.id);
            }
            result.subscribe(function (parentContext) {
                console.log('[ContextualComm View - get parent context]:', parentContext);
                _this.userList.next(parentContext.users);
            });
            this.allowAddUser = false;
        }
    };
    // Load data ones componet is ready
    ContextualCommComponent.prototype.ngOnInit = function () {
        console.log('[ContextualComm View - onInit]', this.content);
    };
    ContextualCommComponent.prototype.ngAfterViewInit = function () {
        this.updateView();
    };
    ContextualCommComponent.prototype.updateView = function () {
        var parentEl = this.content.element.nativeElement.parentElement;
        var currentEl = this.content.element.nativeElement;
        var parentHeight = parentEl.offsetHeight;
        var topMargin = 60;
        var bottomPadding = 60;
        var height = parentHeight - (topMargin + bottomPadding) + 'px';
        currentEl.style.height = height;
    };
    ContextualCommComponent.prototype.onInviteEvent = function (value) {
        console.log('Invite some one: ', value);
    };
    ContextualCommComponent.prototype.onCloseEvent = function () {
    };
    ContextualCommComponent.prototype.onContactClick = function () {
    };
    __decorate([
        core_1.HostBinding('class'),
        __metadata("design:type", Object)
    ], ContextualCommComponent.prototype, "hostClass", void 0);
    __decorate([
        core_1.ViewChild('content', { read: core_1.ViewContainerRef }),
        __metadata("design:type", core_1.ViewContainerRef)
    ], ContextualCommComponent.prototype, "content", void 0);
    __decorate([
        core_1.ViewChild(add_user_component_1.AddUserComponent),
        __metadata("design:type", add_user_component_1.AddUserComponent)
    ], ContextualCommComponent.prototype, "addUserComponent", void 0);
    __decorate([
        core_1.HostListener('window:resize', ['$event']),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [Object]),
        __metadata("design:returntype", void 0)
    ], ContextualCommComponent.prototype, "onResize", null);
    ContextualCommComponent = __decorate([
        core_1.Component({
            moduleId: module.id,
            selector: 'context-view',
            templateUrl: './contextualComm.component.html',
        }),
        __metadata("design:paramtypes", [core_1.ElementRef,
            router_1.Router,
            router_1.ActivatedRoute,
            services_1.RethinkService,
            services_1.ContextualCommDataService,
            services_1.ContactService])
    ], ContextualCommComponent);
    return ContextualCommComponent;
}());