|
1 | 1 | import { Component, ElementRef, HostListener, Inject, Input, ViewChild } from '@angular/core';
|
2 | 2 | import { Router,NavigationStart , NavigationEnd, ActivatedRoute } from '@angular/router';
|
3 |
| -import { select, isVisible, createElement } from '@syncfusion/ej2-base'; |
| 3 | +import { select, isVisible, createElement, Ajax } from '@syncfusion/ej2-base'; |
4 | 4 | import { Button } from '@syncfusion/ej2-buttons';
|
5 | 5 | import { Http, Response } from '@angular/http';
|
6 | 6 | import { Browser, enableRipple, detach } from '@syncfusion/ej2-base';
|
@@ -81,6 +81,13 @@ export class SBController {
|
81 | 81 |
|
82 | 82 | setSelectListItemSelect(id: string): void {
|
83 | 83 | this.enableNavClick();
|
| 84 | + let paths: string[] = this.pathRoutes; |
| 85 | + let path: string = ':theme/' + id; |
| 86 | + if (paths.length - 1 <= paths.indexOf(path)) { |
| 87 | + this.grpNavButton.children[1].classList.add('disabled'); |
| 88 | + } else if (paths.indexOf(path) <= 0) { |
| 89 | + this.grpNavButton.children[0].classList.add('disabled'); |
| 90 | + } |
84 | 91 | if (!window.isInteractedList) {
|
85 | 92 | let listObj: any = this.leftControl.listObj;
|
86 | 93 | if (this.prevControl !== this.currentControl && listObj) {
|
@@ -180,7 +187,8 @@ export class SBController {
|
180 | 187 | // Need to remove once created event has been supported
|
181 | 188 | setTimeout(() => {
|
182 | 189 | let hash: string[] = location.hash.split('/');
|
183 |
| - this.setSelectListItemSelect(hash[2] + '/' + hash[3]); |
| 190 | + hash = hash.slice(2); |
| 191 | + this.setSelectListItemSelect(hash.join('/')); |
184 | 192 | });
|
185 | 193 | });
|
186 | 194 | this.router.events
|
@@ -310,9 +318,8 @@ export class SBController {
|
310 | 318 |
|
311 | 319 | updateSourceTab(path: string): void {
|
312 | 320 | let pathArray: string[] = path.split('/');
|
313 |
| - let realPath: string[] = []; |
314 |
| - realPath.push('src', pathArray[2], pathArray[3]); |
315 |
| - let localPath: string = realPath.join('/'); |
| 321 | + pathArray = pathArray.slice(2); |
| 322 | + let localPath: string = 'src/' + pathArray.join('/'); |
316 | 323 | let tsRequest: Observable<Response> = this.http.get(localPath + '.component.ts');
|
317 | 324 | let htmlRequst: Observable<Response> = this.http.get(localPath + '.html');
|
318 | 325 | let plunk: Observable<Response> = this.http.get(localPath + '-plnkr.json');
|
@@ -460,16 +467,20 @@ export class SBController {
|
460 | 467 | }
|
461 | 468 | getHash(): string {
|
462 | 469 | let hash: string[] = location.hash.split('/');
|
463 |
| - return ':theme/' + hash[2] + '/' + hash[3]; |
| 470 | + hash = hash.slice(2); |
| 471 | + return ':theme/' + hash.join('/'); |
464 | 472 | }
|
465 | 473 | }
|
466 | 474 |
|
467 | 475 | function loadTheme(theme: string): void {
|
468 | 476 | selectedTheme = theme;
|
469 |
| - let doc: HTMLFormElement = <HTMLFormElement>select('#themelink'); |
470 |
| - doc.href = './styles/' + theme + '.css'; |
471 |
| - select('#themeswitcher-icon').setAttribute('src', 'styles/images/SB_icon/SB_Switcher_icon_' + theme + '.png'); |
472 |
| - document.body.classList.add(theme); |
| 477 | + let ajax: Ajax = new Ajax('./styles/' + theme + '.css','GET',true); |
| 478 | + ajax.send().then((result:any) =>{ |
| 479 | + let doc: HTMLFormElement = <HTMLFormElement>select('#themelink'); |
| 480 | + doc.href = './styles/' + theme + '.css'; |
| 481 | + select('#themeswitcher-icon').setAttribute('src', 'styles/images/SB_icon/SB_Switcher_icon_' + theme + '.png'); |
| 482 | + document.body.classList.add(theme); |
| 483 | + }); |
473 | 484 | }
|
474 | 485 |
|
475 | 486 | function hideLoader(): void {
|
|
0 commit comments