jconsumer-shared 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
export class ThemeService {
|
|
5
|
+
document;
|
|
4
6
|
renderer;
|
|
5
7
|
themeLinkElement = null;
|
|
6
|
-
constructor(rendererFactory
|
|
8
|
+
constructor(rendererFactory, document // Inject DOCUMENT
|
|
9
|
+
) {
|
|
10
|
+
this.document = document;
|
|
7
11
|
this.renderer = rendererFactory.createRenderer(null, null);
|
|
8
12
|
}
|
|
9
|
-
loadTheme(themeName) {
|
|
10
|
-
//
|
|
13
|
+
loadTheme(themeBasePath, themeName) {
|
|
14
|
+
// Construct the full CDN path
|
|
15
|
+
const themePath = `${themeBasePath}${themeName}.css`;
|
|
16
|
+
// Remove existing theme if it’s set
|
|
11
17
|
if (this.themeLinkElement) {
|
|
12
|
-
this.renderer.removeChild(document.head, this.themeLinkElement);
|
|
18
|
+
this.renderer.removeChild(this.document.head, this.themeLinkElement);
|
|
19
|
+
this.themeLinkElement = null; // Reset reference
|
|
13
20
|
}
|
|
14
21
|
// Create a new link element for the theme
|
|
15
22
|
this.themeLinkElement = this.renderer.createElement('link');
|
|
16
|
-
this.themeLinkElement
|
|
17
|
-
this.
|
|
23
|
+
this.renderer.setAttribute(this.themeLinkElement, 'rel', 'stylesheet');
|
|
24
|
+
this.renderer.setAttribute(this.themeLinkElement, 'href', themePath);
|
|
25
|
+
// Handle successful load
|
|
26
|
+
this.themeLinkElement.onload = () => {
|
|
27
|
+
console.log(`Theme loaded: ${themePath}`);
|
|
28
|
+
this.renderer.addClass(this.document.body, themeName); // Apply theme class to body
|
|
29
|
+
};
|
|
30
|
+
// Handle load failure
|
|
31
|
+
this.themeLinkElement.onerror = () => {
|
|
32
|
+
console.error(`Failed to load theme: ${themePath}`);
|
|
33
|
+
// Optionally load a fallback theme
|
|
34
|
+
};
|
|
18
35
|
// Append the new theme to the document head
|
|
19
|
-
this.renderer.appendChild(document.head, this.themeLinkElement);
|
|
36
|
+
this.renderer.appendChild(this.document.head, this.themeLinkElement);
|
|
20
37
|
}
|
|
21
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
38
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
22
39
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
23
40
|
}
|
|
24
41
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, decorators: [{
|
|
@@ -26,5 +43,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
26
43
|
args: [{
|
|
27
44
|
providedIn: 'root',
|
|
28
45
|
}]
|
|
29
|
-
}], ctorParameters: () => [{ type: i0.RendererFactory2 }
|
|
30
|
-
|
|
46
|
+
}], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: Document, decorators: [{
|
|
47
|
+
type: Inject,
|
|
48
|
+
args: [DOCUMENT]
|
|
49
|
+
}] }] });
|
|
50
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhlbWUuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2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xseSBsb2FkIGEgZmFsbGJhY2sgdGhlbWVcclxuICAgIH07XHJcblxyXG4gICAgLy8gQXBwZW5kIHRoZSBuZXcgdGhlbWUgdG8gdGhlIGRvY3VtZW50IGhlYWRcclxuICAgIHRoaXMucmVuZGVyZXIuYXBwZW5kQ2hpbGQodGhpcy5kb2N1bWVudC5oZWFkLCB0aGlzLnRoZW1lTGlua0VsZW1lbnQpO1xyXG4gIH1cclxufSJdfQ==
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { loadRemoteModule } from '@angular-architects/native-federation';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Injectable, NgModule, Component, Input,
|
|
3
|
+
import { Injectable, Inject, NgModule, Component, Input, Pipe, HostListener, EventEmitter, Output, ViewChild, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA, forwardRef, ENVIRONMENT_INITIALIZER, inject, Injector, runInInjectionContext } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/common/http';
|
|
5
5
|
import { HttpHeaders, HttpParams, HttpClient } from '@angular/common/http';
|
|
6
6
|
import { Subject, of, BehaviorSubject } from 'rxjs';
|
|
7
7
|
import * as i1$1 from 'primeng/api';
|
|
8
8
|
import * as i13 from '@angular/common';
|
|
9
|
-
import { CommonModule, DatePipe } from '@angular/common';
|
|
9
|
+
import { DOCUMENT, CommonModule, DatePipe } from '@angular/common';
|
|
10
10
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
11
11
|
import * as i1$2 from '@ngx-translate/core';
|
|
12
12
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
@@ -394,24 +394,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
394
394
|
}], ctorParameters: () => [] });
|
|
395
395
|
|
|
396
396
|
class ThemeService {
|
|
397
|
+
document;
|
|
397
398
|
renderer;
|
|
398
399
|
themeLinkElement = null;
|
|
399
|
-
constructor(rendererFactory
|
|
400
|
+
constructor(rendererFactory, document // Inject DOCUMENT
|
|
401
|
+
) {
|
|
402
|
+
this.document = document;
|
|
400
403
|
this.renderer = rendererFactory.createRenderer(null, null);
|
|
401
404
|
}
|
|
402
|
-
loadTheme(themeName) {
|
|
403
|
-
//
|
|
405
|
+
loadTheme(themeBasePath, themeName) {
|
|
406
|
+
// Construct the full CDN path
|
|
407
|
+
const themePath = `${themeBasePath}${themeName}.css`;
|
|
408
|
+
// Remove existing theme if it’s set
|
|
404
409
|
if (this.themeLinkElement) {
|
|
405
|
-
this.renderer.removeChild(document.head, this.themeLinkElement);
|
|
410
|
+
this.renderer.removeChild(this.document.head, this.themeLinkElement);
|
|
411
|
+
this.themeLinkElement = null; // Reset reference
|
|
406
412
|
}
|
|
407
413
|
// Create a new link element for the theme
|
|
408
414
|
this.themeLinkElement = this.renderer.createElement('link');
|
|
409
|
-
this.themeLinkElement
|
|
410
|
-
this.
|
|
415
|
+
this.renderer.setAttribute(this.themeLinkElement, 'rel', 'stylesheet');
|
|
416
|
+
this.renderer.setAttribute(this.themeLinkElement, 'href', themePath);
|
|
417
|
+
// Handle successful load
|
|
418
|
+
this.themeLinkElement.onload = () => {
|
|
419
|
+
console.log(`Theme loaded: ${themePath}`);
|
|
420
|
+
this.renderer.addClass(this.document.body, themeName); // Apply theme class to body
|
|
421
|
+
};
|
|
422
|
+
// Handle load failure
|
|
423
|
+
this.themeLinkElement.onerror = () => {
|
|
424
|
+
console.error(`Failed to load theme: ${themePath}`);
|
|
425
|
+
// Optionally load a fallback theme
|
|
426
|
+
};
|
|
411
427
|
// Append the new theme to the document head
|
|
412
|
-
this.renderer.appendChild(document.head, this.themeLinkElement);
|
|
428
|
+
this.renderer.appendChild(this.document.head, this.themeLinkElement);
|
|
413
429
|
}
|
|
414
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, deps: [{ token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
430
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
415
431
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
416
432
|
}
|
|
417
433
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ThemeService, decorators: [{
|
|
@@ -419,7 +435,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
419
435
|
args: [{
|
|
420
436
|
providedIn: 'root',
|
|
421
437
|
}]
|
|
422
|
-
}], ctorParameters: () => [{ type: i0.RendererFactory2 }
|
|
438
|
+
}], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: Document, decorators: [{
|
|
439
|
+
type: Inject,
|
|
440
|
+
args: [DOCUMENT]
|
|
441
|
+
}] }] });
|
|
423
442
|
|
|
424
443
|
function HttpLoaderFactory(http, sharedService) {
|
|
425
444
|
return new TranslateHttpLoader(http, sharedService.getI8nPath() + 'assets/i18n/', '.json');
|