@abp/ng.theme.shared 5.0.0-beta.2 → 5.0.0-beta.3
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.
- package/bundles/abp-ng.theme.shared-extensions.umd.js +4 -4
- package/bundles/abp-ng.theme.shared-extensions.umd.js.map +1 -1
- package/bundles/abp-ng.theme.shared.umd.js +44 -110
- package/bundles/abp-ng.theme.shared.umd.js.map +1 -1
- package/esm2015/extensions/lib/components/date-time-picker/date-time-picker.component.js +1 -1
- package/esm2015/extensions/lib/components/date-time-picker/date-time-picker.component.js.map +1 -1
- package/esm2015/extensions/lib/components/extensible-form/extensible-form-prop.component.js +1 -1
- package/esm2015/extensions/lib/components/extensible-form/extensible-form-prop.component.js.map +1 -1
- package/esm2015/extensions/lib/components/grid-actions/grid-actions.component.js +1 -1
- package/esm2015/extensions/lib/components/grid-actions/grid-actions.component.js.map +1 -1
- package/esm2015/extensions/lib/components/page-toolbar/page-toolbar.component.js +1 -1
- package/esm2015/extensions/lib/components/page-toolbar/page-toolbar.component.js.map +1 -1
- package/esm2015/lib/components/button/button.component.js +2 -2
- package/esm2015/lib/components/button/button.component.js.map +1 -1
- package/esm2015/lib/components/http-error-wrapper/http-error-wrapper.component.js +1 -1
- package/esm2015/lib/components/http-error-wrapper/http-error-wrapper.component.js.map +1 -1
- package/esm2015/lib/components/modal/modal.component.js +1 -1
- package/esm2015/lib/components/modal/modal.component.js.map +1 -1
- package/esm2015/lib/constants/styles.js +3 -2
- package/esm2015/lib/constants/styles.js.map +1 -1
- package/esm2015/lib/handlers/document-dir.handler.js +33 -0
- package/esm2015/lib/handlers/document-dir.handler.js.map +1 -0
- package/esm2015/lib/handlers/index.js +1 -1
- package/esm2015/lib/handlers/index.js.map +1 -1
- package/esm2015/lib/theme-shared.module.js +10 -9
- package/esm2015/lib/theme-shared.module.js.map +1 -1
- package/esm2015/lib/tokens/index.js +0 -1
- package/esm2015/lib/tokens/index.js.map +1 -1
- package/esm2015/public-api.js +0 -1
- package/esm2015/public-api.js.map +1 -1
- package/fesm2015/abp-ng.theme.shared-extensions.js +4 -4
- package/fesm2015/abp-ng.theme.shared-extensions.js.map +1 -1
- package/fesm2015/abp-ng.theme.shared.js +225 -280
- package/fesm2015/abp-ng.theme.shared.js.map +1 -1
- package/lib/constants/styles.d.ts +1 -2
- package/lib/handlers/document-dir.handler.d.ts +13 -0
- package/lib/handlers/index.d.ts +1 -1
- package/lib/tokens/index.d.ts +0 -1
- package/package.json +4 -4
- package/public-api.d.ts +0 -1
- package/esm2015/lib/handlers/lazy-style.handler.js +0 -89
- package/esm2015/lib/handlers/lazy-style.handler.js.map +0 -1
- package/esm2015/lib/tokens/lazy-styles.token.js +0 -3
- package/esm2015/lib/tokens/lazy-styles.token.js.map +0 -1
- package/lib/handlers/lazy-style.handler.d.ts +0 -23
- package/lib/tokens/lazy-styles.token.d.ts +0 -2
- package/styles/bootstrap-rtl.min.css +0 -7
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare const _default: "\n.is-invalid .form-control {\n border-color: #dc3545;\n border-style: solid !important;\n padding-right: calc(1.5em + .75rem);\n background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e);\n background-repeat: no-repeat;\n background-position: right calc(.375em + .1875rem) center;\n background-size: calc(.75em + .375rem) calc(.75em + .375rem);\n}\n\n.is-invalid .invalid-feedback,\n.is-invalid + * .invalid-feedback {\n display: block;\n}\n\n.data-tables-filter {\n text-align: right;\n}\n\n[dir=rtl] .data-tables-filter {\n text-align: left;\n}\n\n.pointer {\n cursor: pointer;\n}\n\n.navbar .dropdown-submenu a::after {\n transform: rotate(-90deg);\n position: absolute;\n right: 16px;\n top: 18px;\n}\n\n.navbar .dropdown-menu {\n min-width: 215px;\n}\n\n.datatable-scroll {\n margin-bottom: 5px !important;\n width: unset !important;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar {\n height: 5px !important;\n width: 5px !important;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar-track {\n background: #ddd;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar-thumb {\n background: #8a8686;\n}\n\n.abp-ellipsis-inline {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.abp-ellipsis {\n overflow: hidden !important;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ui-widget-overlay {\n z-index: 1000;\n}\n\n.color-white {\n color: #FFF !important;\n}\n\n.custom-checkbox > label {\n cursor: pointer;\n}\n\n/* <animations */\n\n.fade-in-top {\n animation: fadeInTop 0.2s ease-in-out;\n}\n\n.fade-out-top {\n animation: fadeOutTop 0.2s ease-in-out;\n}\n\n.abp-collapsed-height {\n -moz-transition: max-height linear 0.35s;\n -ms-transition: max-height linear 0.35s;\n -o-transition: max-height linear 0.35s;\n -webkit-transition: max-height linear 0.35s;\n overflow:hidden;\n transition:max-height 0.35s linear;\n height:auto;\n max-height: 0;\n}\n\n.abp-mh-25 {\n max-height: 25vh;\n}\n\n.abp-mh-50 {\n transition:max-height 0.65s linear;\n max-height: 50vh;\n}\n\n.abp-mh-75 {\n transition:max-height 0.85s linear;\n max-height: 75vh;\n}\n\n.abp-mh-100 {\n transition:max-height 1s linear;\n max-height: 100vh;\n}\n\n[class^=\"sorting\"] {\n opacity: .3;\n cursor: pointer;\n}\n[class^=\"sorting\"]:before {\n right: 0.5rem;\n content: \"↑\";\n}\n[class^=\"sorting\"]:after {\n right: 0.5rem;\n content: \"↓\";\n}\n\n.sorting_desc {\n opacity: 1;\n}\n.sorting_desc:before {\n opacity: .3;\n}\n\n.sorting_asc {\n opacity: 1;\n}\n.sorting_asc:after {\n opacity: .3;\n}\n.ngx-datatable.material {\n box-shadow: none;\n}\nngb-typeahead-window, ngb-typeahead-window.dropdown-menu {\n max-height: 25em;\n overflow-y: scroll !important;\n z-index: 1050;\n}\n\n@keyframes fadeInTop {\n from {\n transform: translateY(-5px);\n opacity: 0;\n }\n\n to {\n transform: translateY(0px);\n opacity: 1;\n }\n}\n\n@keyframes fadeOutTop {\n to {\n transform: translateY(-5px);\n opacity: 0;\n }\n}\n\n/* </animations */\n\n";
|
|
1
|
+
declare const _default: "\n.is-invalid .form-control {\n border-color: #dc3545;\n border-style: solid !important;\n padding-right: calc(1.5em + .75rem);\n background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e);\n background-repeat: no-repeat;\n background-position: right calc(.375em + .1875rem) center;\n background-size: calc(.75em + .375rem) calc(.75em + .375rem);\n}\n\n.is-invalid .invalid-feedback,\n.is-invalid + * .invalid-feedback {\n display: block;\n}\n\n.data-tables-filter {\n text-align: right;\n}\n\n[dir=rtl] .data-tables-filter {\n text-align: left;\n}\n\n.pointer {\n cursor: pointer;\n}\n\n.navbar .dropdown-submenu a::after {\n transform: rotate(-90deg);\n position: absolute;\n right: 16px;\n top: 18px;\n}\n\n.navbar .dropdown-menu {\n min-width: 215px;\n}\n\n.datatable-scroll {\n margin-bottom: 5px !important;\n width: unset !important;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar {\n height: 5px !important;\n width: 5px !important;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar-track {\n background: #ddd;\n}\n\n.ui-table-scrollable-body::-webkit-scrollbar-thumb {\n background: #8a8686;\n}\n\n.abp-ellipsis-inline {\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.abp-ellipsis {\n overflow: hidden !important;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ui-widget-overlay {\n z-index: 1000;\n}\n\n.color-white {\n color: #FFF !important;\n}\n\n.custom-checkbox > label {\n cursor: pointer;\n}\n\n/* <animations */\n\n.fade-in-top {\n animation: fadeInTop 0.2s ease-in-out;\n}\n\n.fade-out-top {\n animation: fadeOutTop 0.2s ease-in-out;\n}\n\n.abp-collapsed-height {\n -moz-transition: max-height linear 0.35s;\n -ms-transition: max-height linear 0.35s;\n -o-transition: max-height linear 0.35s;\n -webkit-transition: max-height linear 0.35s;\n overflow:hidden;\n transition:max-height 0.35s linear;\n height:auto;\n max-height: 0;\n}\n\n.abp-mh-25 {\n max-height: 25vh;\n}\n\n.abp-mh-50 {\n transition:max-height 0.65s linear;\n max-height: 50vh;\n}\n\n.abp-mh-75 {\n transition:max-height 0.85s linear;\n max-height: 75vh;\n}\n\n.abp-mh-100 {\n transition:max-height 1s linear;\n max-height: 100vh;\n}\n\n[class^=\"sorting\"] {\n opacity: .3;\n cursor: pointer;\n}\n[class^=\"sorting\"]:before {\n right: 0.5rem;\n content: \"↑\";\n}\n[class^=\"sorting\"]:after {\n right: 0.5rem;\n content: \"↓\";\n}\n\n.sorting_desc {\n opacity: 1;\n}\n.sorting_desc:before {\n opacity: .3;\n}\n\n.sorting_asc {\n opacity: 1;\n}\n.sorting_asc:after {\n opacity: .3;\n}\n.ngx-datatable.material {\n box-shadow: none;\n}\nngb-typeahead-window, ngb-typeahead-window.dropdown-menu {\n max-height: 25em;\n overflow-y: scroll !important;\n z-index: 1050;\n}\n\n@keyframes fadeInTop {\n from {\n transform: translateY(-5px);\n opacity: 0;\n }\n\n to {\n transform: translateY(0px);\n opacity: 1;\n }\n}\n\n@keyframes fadeOutTop {\n to {\n transform: translateY(-5px);\n opacity: 0;\n }\n}\n\n/* </animations */\n.ngb-dp-body {\n z-index: 1055 !important;\n}\n";
|
|
2
2
|
export default _default;
|
|
3
|
-
export declare const BOOTSTRAP = "bootstrap-{{dir}}.min.css";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injector } from '@angular/core';
|
|
2
|
+
import { LocaleDirection } from '../models/common';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class DocumentDirHandlerService {
|
|
5
|
+
protected injector: Injector;
|
|
6
|
+
private dir;
|
|
7
|
+
dir$: import("rxjs").Observable<LocaleDirection>;
|
|
8
|
+
constructor(injector: Injector);
|
|
9
|
+
private listenToLanguageChanges;
|
|
10
|
+
private setBodyDir;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentDirHandlerService, never>;
|
|
12
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentDirHandlerService>;
|
|
13
|
+
}
|
package/lib/handlers/index.d.ts
CHANGED
package/lib/tokens/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abp/ng.theme.shared",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.3",
|
|
4
4
|
"homepage": "https://abp.io",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/abpframework/abp.git"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@abp/ng.core": "~5.0.0-beta.
|
|
10
|
+
"@abp/ng.core": "~5.0.0-beta.3",
|
|
11
11
|
"@fortawesome/fontawesome-free": "^5.15.4",
|
|
12
|
-
"@ng-bootstrap/ng-bootstrap": "^
|
|
12
|
+
"@ng-bootstrap/ng-bootstrap": "^11.0.0-beta.2",
|
|
13
13
|
"@ngx-validate/core": "^0.0.13",
|
|
14
14
|
"@swimlane/ngx-datatable": "^19.0.0",
|
|
15
|
-
"bootstrap": "
|
|
15
|
+
"bootstrap": "^5.1.1",
|
|
16
16
|
"tslib": "^2.0.0"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
package/public-api.d.ts
CHANGED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { getLocaleDirection, LazyLoadService, LOADING_STRATEGY, LocalizationService, } from '@abp/ng.core';
|
|
2
|
-
import { Injectable, Injector } from '@angular/core';
|
|
3
|
-
import { startWith } from 'rxjs/operators';
|
|
4
|
-
import { BOOTSTRAP } from '../constants/styles';
|
|
5
|
-
import { LAZY_STYLES } from '../tokens/lazy-styles.token';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
export class LazyStyleHandler {
|
|
8
|
-
constructor(injector) {
|
|
9
|
-
this._dir = 'ltr';
|
|
10
|
-
this.loaded = new Map();
|
|
11
|
-
this.setStyles(injector);
|
|
12
|
-
this.setLazyLoad(injector);
|
|
13
|
-
this.listenToLanguageChanges(injector);
|
|
14
|
-
}
|
|
15
|
-
set dir(dir) {
|
|
16
|
-
if (dir === this._dir)
|
|
17
|
-
return;
|
|
18
|
-
this.switchCSS(dir);
|
|
19
|
-
this.setBodyDir(dir);
|
|
20
|
-
this._dir = dir;
|
|
21
|
-
}
|
|
22
|
-
get dir() {
|
|
23
|
-
return this._dir;
|
|
24
|
-
}
|
|
25
|
-
getHrefFromLink(link) {
|
|
26
|
-
if (!link)
|
|
27
|
-
return '';
|
|
28
|
-
const a = document.createElement('a');
|
|
29
|
-
a.href = link.href;
|
|
30
|
-
return a.pathname.replace(/^\//, '');
|
|
31
|
-
}
|
|
32
|
-
getLoadedBootstrap() {
|
|
33
|
-
const href = createLazyStyleHref(BOOTSTRAP, this.dir);
|
|
34
|
-
const selector = `[href*="${href.replace(/\.css$/, '')}"]`;
|
|
35
|
-
const link = document.querySelector(selector);
|
|
36
|
-
return { href, link };
|
|
37
|
-
}
|
|
38
|
-
listenToLanguageChanges(injector) {
|
|
39
|
-
const l10n = injector.get(LocalizationService);
|
|
40
|
-
// will always listen, no need to unsubscribe
|
|
41
|
-
l10n.languageChange$.pipe(startWith(l10n.currentLang)).subscribe(locale => {
|
|
42
|
-
this.dir = getLocaleDirection(locale);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
setBodyDir(dir) {
|
|
46
|
-
document.body.dir = dir;
|
|
47
|
-
}
|
|
48
|
-
setLazyLoad(injector) {
|
|
49
|
-
this.lazyLoad = injector.get(LazyLoadService);
|
|
50
|
-
const { href, link } = this.getLoadedBootstrap();
|
|
51
|
-
this.lazyLoad.loaded.set(href, link);
|
|
52
|
-
}
|
|
53
|
-
setStyles(injector) {
|
|
54
|
-
this.styles = injector.get(LAZY_STYLES, [BOOTSTRAP]);
|
|
55
|
-
}
|
|
56
|
-
switchCSS(dir) {
|
|
57
|
-
this.styles.forEach(style => {
|
|
58
|
-
const oldHref = createLazyStyleHref(style, this.dir);
|
|
59
|
-
const newHref = createLazyStyleHref(style, dir);
|
|
60
|
-
const link = this.loaded.get(newHref);
|
|
61
|
-
const href = this.getHrefFromLink(link) || newHref;
|
|
62
|
-
const strategy = LOADING_STRATEGY.PrependAnonymousStyleToHead(href);
|
|
63
|
-
this.lazyLoad.load(strategy).subscribe(() => {
|
|
64
|
-
const oldLink = this.lazyLoad.loaded.get(oldHref);
|
|
65
|
-
this.loaded.delete(newHref);
|
|
66
|
-
this.loaded.set(oldHref, oldLink);
|
|
67
|
-
const newLink = this.lazyLoad.loaded.get(href);
|
|
68
|
-
this.lazyLoad.loaded.delete(href);
|
|
69
|
-
this.lazyLoad.loaded.set(newHref, newLink);
|
|
70
|
-
this.lazyLoad.remove(oldHref);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
LazyStyleHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: LazyStyleHandler, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
76
|
-
LazyStyleHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: LazyStyleHandler, providedIn: 'root' });
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: LazyStyleHandler, decorators: [{
|
|
78
|
-
type: Injectable,
|
|
79
|
-
args: [{
|
|
80
|
-
providedIn: 'root',
|
|
81
|
-
}]
|
|
82
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
83
|
-
export function createLazyStyleHref(style, dir) {
|
|
84
|
-
return style.replace(/{{\s*dir\s*}}/g, dir);
|
|
85
|
-
}
|
|
86
|
-
export function initLazyStyleHandler(injector) {
|
|
87
|
-
return () => new LazyStyleHandler(injector);
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=lazy-style.handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-style.handler.js","sourceRoot":"","sources":["../../../../../../packages/theme-shared/src/lib/handlers/lazy-style.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAO,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;;AAK1D,MAAM,OAAO,gBAAgB;IAmB3B,YAAY,QAAkB;QAhBtB,SAAI,GAAoB,KAAK,CAAC;QAE7B,WAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;QAenD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3B,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAhBD,IAAI,GAA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AM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAClC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAoB,CAAC;gBAClE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC3C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;;6GAjFU,gBAAgB;iHAAhB,gBAAgB,cAFf,MAAM;2FAEP,gBAAgB;kBAH5B,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;AAqFD,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,GAAW;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAkB;IACrD,OAAO,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import {\n getLocaleDirection,\n LazyLoadService,\n LOADING_STRATEGY,\n LocalizationService,\n} from '@abp/ng.core';\nimport { Injectable, Injector } from '@angular/core';\nimport { map, startWith } from 'rxjs/operators';\nimport { BOOTSTRAP } from '../constants/styles';\nimport { LocaleDirection } from '../models/common';\nimport { LAZY_STYLES } from '../tokens/lazy-styles.token';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LazyStyleHandler {\n private lazyLoad: LazyLoadService;\n private styles: string[];\n private _dir: LocaleDirection = 'ltr';\n\n readonly loaded = new Map<string, HTMLLinkElement>();\n\n set dir(dir: LocaleDirection) {\n if (dir === this._dir) return;\n\n this.switchCSS(dir);\n this.setBodyDir(dir);\n this._dir = dir;\n }\n\n get dir(): LocaleDirection {\n return this._dir;\n }\n\n constructor(injector: Injector) {\n this.setStyles(injector);\n this.setLazyLoad(injector);\n this.listenToLanguageChanges(injector);\n }\n\n private getHrefFromLink(link: HTMLLinkElement | null): string {\n if (!link) return '';\n\n const a = document.createElement('a');\n a.href = link.href;\n return a.pathname.replace(/^\\//, '');\n }\n\n private getLoadedBootstrap(): LoadedStyle {\n const href = createLazyStyleHref(BOOTSTRAP, this.dir);\n const selector = `[href*=\"${href.replace(/\\.css$/, '')}\"]`;\n const link = document.querySelector<HTMLLinkElement>(selector);\n return { href, link };\n }\n\n private listenToLanguageChanges(injector: Injector) {\n const l10n = injector.get(LocalizationService);\n\n // will always listen, no need to unsubscribe\n l10n.languageChange$.pipe(startWith(l10n.currentLang)).subscribe(locale => {\n this.dir = getLocaleDirection(locale);\n });\n }\n\n private setBodyDir(dir: LocaleDirection) {\n document.body.dir = dir;\n }\n\n private setLazyLoad(injector: Injector) {\n this.lazyLoad = injector.get(LazyLoadService);\n const { href, link } = this.getLoadedBootstrap();\n this.lazyLoad.loaded.set(href, link);\n }\n\n private setStyles(injector: Injector) {\n this.styles = injector.get(LAZY_STYLES, [BOOTSTRAP]);\n }\n\n private switchCSS(dir: LocaleDirection) {\n this.styles.forEach(style => {\n const oldHref = createLazyStyleHref(style, this.dir);\n const newHref = createLazyStyleHref(style, dir);\n const link = this.loaded.get(newHref);\n const href = this.getHrefFromLink(link) || newHref;\n\n const strategy = LOADING_STRATEGY.PrependAnonymousStyleToHead(href);\n this.lazyLoad.load(strategy).subscribe(() => {\n const oldLink = this.lazyLoad.loaded.get(oldHref) as HTMLLinkElement;\n this.loaded.delete(newHref);\n this.loaded.set(oldHref, oldLink);\n const newLink = this.lazyLoad.loaded.get(href) as HTMLLinkElement;\n this.lazyLoad.loaded.delete(href);\n this.lazyLoad.loaded.set(newHref, newLink);\n this.lazyLoad.remove(oldHref);\n });\n });\n }\n}\n\nexport function createLazyStyleHref(style: string, dir: string): string {\n return style.replace(/{{\\s*dir\\s*}}/g, dir);\n}\n\nexport function initLazyStyleHandler(injector: Injector) {\n return () => new LazyStyleHandler(injector);\n}\n\ninterface LoadedStyle {\n href: string;\n link: HTMLLinkElement;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-styles.token.js","sourceRoot":"","sources":["../../../../../../packages/theme-shared/src/lib/tokens/lazy-styles.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,cAAc,CAAW,aAAa,CAAC,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const LAZY_STYLES = new InjectionToken<string[]>('LAZY_STYLES');\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Injector } from '@angular/core';
|
|
2
|
-
import { LocaleDirection } from '../models/common';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class LazyStyleHandler {
|
|
5
|
-
private lazyLoad;
|
|
6
|
-
private styles;
|
|
7
|
-
private _dir;
|
|
8
|
-
readonly loaded: Map<string, HTMLLinkElement>;
|
|
9
|
-
set dir(dir: LocaleDirection);
|
|
10
|
-
get dir(): LocaleDirection;
|
|
11
|
-
constructor(injector: Injector);
|
|
12
|
-
private getHrefFromLink;
|
|
13
|
-
private getLoadedBootstrap;
|
|
14
|
-
private listenToLanguageChanges;
|
|
15
|
-
private setBodyDir;
|
|
16
|
-
private setLazyLoad;
|
|
17
|
-
private setStyles;
|
|
18
|
-
private switchCSS;
|
|
19
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LazyStyleHandler, never>;
|
|
20
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<LazyStyleHandler>;
|
|
21
|
-
}
|
|
22
|
-
export declare function createLazyStyleHref(style: string, dir: string): string;
|
|
23
|
-
export declare function initLazyStyleHandler(injector: Injector): () => LazyStyleHandler;
|