@theseam/ui-common 1.0.2-beta.16 → 1.0.2-beta.20
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/fesm2022/theseam-ui-common-datatable.mjs +8 -0
- package/fesm2022/theseam-ui-common-datatable.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-framework.mjs +150 -2
- package/fesm2022/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-graphql.mjs +3 -6
- package/fesm2022/theseam-ui-common-graphql.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-loading.mjs +84 -19
- package/fesm2022/theseam-ui-common-loading.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-menu.mjs +13 -0
- package/fesm2022/theseam-ui-common-menu.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-story-helpers.mjs +1 -36
- package/fesm2022/theseam-ui-common-story-helpers.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-testing.mjs +13 -8
- package/fesm2022/theseam-ui-common-testing.mjs.map +1 -1
- package/framework/index.d.ts +89 -3
- package/framework/route-transitions/route-transitions.css +166 -0
- package/graphql/index.d.ts +1 -1
- package/loading/index.d.ts +32 -4
- package/menu/index.d.ts +6 -0
- package/package.json +1 -1
- package/story-helpers/index.d.ts +1 -34
- package/testing/index.d.ts +12 -9
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { throwError } from 'rxjs';
|
|
2
|
+
import { tap, catchError, finalize } from 'rxjs/operators';
|
|
3
|
+
import { Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
4
|
+
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
3
5
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Input, Component,
|
|
6
|
+
import { Input, Component, inject, Injectable, NgModule, makeEnvironmentProviders, importProvidersFrom } from '@angular/core';
|
|
5
7
|
import * as i1 from 'ngx-loading';
|
|
6
8
|
import { ngxLoadingAnimationTypes, NgxLoadingModule } from 'ngx-loading';
|
|
7
|
-
import {
|
|
8
|
-
import { tap, catchError, finalize } from 'rxjs/operators';
|
|
9
|
+
import { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
9
10
|
|
|
10
11
|
const defaultThemeConfig = {
|
|
11
12
|
animationType: ngxLoadingAnimationTypes.threeBounce,
|
|
@@ -44,19 +45,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
44
45
|
type: Input
|
|
45
46
|
}] } });
|
|
46
47
|
|
|
47
|
-
class TheSeamLoadingModule {
|
|
48
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
49
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, imports: [TheSeamLoadingComponent], exports: [OverlayModule, PortalModule, TheSeamLoadingComponent] });
|
|
50
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, imports: [TheSeamLoadingComponent, OverlayModule, PortalModule] });
|
|
51
|
-
}
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, decorators: [{
|
|
53
|
-
type: NgModule,
|
|
54
|
-
args: [{
|
|
55
|
-
imports: [TheSeamLoadingComponent],
|
|
56
|
-
exports: [OverlayModule, PortalModule, TheSeamLoadingComponent],
|
|
57
|
-
}]
|
|
58
|
-
}] });
|
|
59
|
-
|
|
60
48
|
class TheSeamLoadingOverlayService {
|
|
61
49
|
_overlay = inject(Overlay);
|
|
62
50
|
_enabled = false;
|
|
@@ -107,6 +95,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
107
95
|
args: [{ providedIn: 'root' }]
|
|
108
96
|
}] });
|
|
109
97
|
|
|
98
|
+
class MockTheSeamLoadingOverlayService {
|
|
99
|
+
_enabled = false;
|
|
100
|
+
get enabled() {
|
|
101
|
+
return this._enabled;
|
|
102
|
+
}
|
|
103
|
+
toggle(enabled) {
|
|
104
|
+
const enable = enabled === undefined ? !this.enabled : enabled;
|
|
105
|
+
if (enable && !this.enabled) {
|
|
106
|
+
this.enable();
|
|
107
|
+
}
|
|
108
|
+
else if (!enable && this.enabled) {
|
|
109
|
+
this.disable();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
enable() {
|
|
113
|
+
if (this.enabled) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this._enabled = true;
|
|
117
|
+
}
|
|
118
|
+
disable() {
|
|
119
|
+
if (!this.enabled) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this._enabled = false;
|
|
123
|
+
}
|
|
124
|
+
while(source) {
|
|
125
|
+
this.enable();
|
|
126
|
+
return source.pipe(tap(() => this.disable()), catchError((err) => {
|
|
127
|
+
this.disable();
|
|
128
|
+
return throwError(err);
|
|
129
|
+
}), finalize(() => this.disable()));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function provideMockLoadingService() {
|
|
133
|
+
return {
|
|
134
|
+
provide: TheSeamLoadingOverlayService,
|
|
135
|
+
useClass: MockTheSeamLoadingOverlayService,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
class TheSeamLoadingComponentHarness extends ContentContainerComponentHarness {
|
|
140
|
+
/** The selector for the host element of a `TheSeamLoadingComponent` instance. */
|
|
141
|
+
static hostSelector = 'seam-loading';
|
|
142
|
+
_backdropElement = this.locatorFor('.backdrop');
|
|
143
|
+
/**
|
|
144
|
+
* Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
|
|
145
|
+
* @param options Options for filtering which menu item instances are considered a match.
|
|
146
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
147
|
+
*/
|
|
148
|
+
static with(options = {}) {
|
|
149
|
+
return new HarnessPredicate(this, options);
|
|
150
|
+
}
|
|
151
|
+
/** Gets the theme. */
|
|
152
|
+
async getTheme() {
|
|
153
|
+
const backdrop = await this._backdropElement();
|
|
154
|
+
const backgroundColor = await backdrop.getCssValue('background-color');
|
|
155
|
+
return backgroundColor.replace(/\s/g, '') ===
|
|
156
|
+
primaryThemeConfig.backdropBackgroundColour
|
|
157
|
+
? 'primary'
|
|
158
|
+
: 'default';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
class TheSeamLoadingModule {
|
|
163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
164
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, imports: [TheSeamLoadingComponent], exports: [OverlayModule, PortalModule, TheSeamLoadingComponent] });
|
|
165
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, imports: [TheSeamLoadingComponent, OverlayModule, PortalModule] });
|
|
166
|
+
}
|
|
167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TheSeamLoadingModule, decorators: [{
|
|
168
|
+
type: NgModule,
|
|
169
|
+
args: [{
|
|
170
|
+
imports: [TheSeamLoadingComponent],
|
|
171
|
+
exports: [OverlayModule, PortalModule, TheSeamLoadingComponent],
|
|
172
|
+
}]
|
|
173
|
+
}] });
|
|
174
|
+
|
|
110
175
|
function provideTheSeamLoading(loadingConfig = defaultThemeConfig) {
|
|
111
176
|
return makeEnvironmentProviders([
|
|
112
177
|
importProvidersFrom(NgxLoadingModule.forRoot(loadingConfig)),
|
|
@@ -117,5 +182,5 @@ function provideTheSeamLoading(loadingConfig = defaultThemeConfig) {
|
|
|
117
182
|
* Generated bundle index. Do not edit.
|
|
118
183
|
*/
|
|
119
184
|
|
|
120
|
-
export { TheSeamLoadingComponent, TheSeamLoadingModule, TheSeamLoadingOverlayService, defaultThemeConfig, primaryThemeConfig, provideTheSeamLoading };
|
|
185
|
+
export { MockTheSeamLoadingOverlayService, TheSeamLoadingComponent, TheSeamLoadingComponentHarness, TheSeamLoadingModule, TheSeamLoadingOverlayService, defaultThemeConfig, primaryThemeConfig, provideMockLoadingService, provideTheSeamLoading };
|
|
121
186
|
//# sourceMappingURL=theseam-ui-common-loading.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theseam-ui-common-loading.mjs","sources":["../../../projects/ui-common/loading/loading-themes.ts","../../../projects/ui-common/loading/loading/loading.component.ts","../../../projects/ui-common/loading/loading/loading.component.html","../../../projects/ui-common/loading/loading.module.ts","../../../projects/ui-common/loading/loading-overlay.service.ts","../../../projects/ui-common/loading/provide-loading.ts","../../../projects/ui-common/loading/theseam-ui-common-loading.ts"],"sourcesContent":["import { ngxLoadingAnimationTypes, NgxLoadingConfig } from 'ngx-loading'\n\nexport const defaultThemeConfig: NgxLoadingConfig = {\n animationType: ngxLoadingAnimationTypes.threeBounce,\n backdropBackgroundColour: 'rgba(0,0,0,0.3)',\n backdropBorderRadius: '0px',\n primaryColour: '#ffffff',\n secondaryColour: '#ffffff',\n tertiaryColour: '#ffffff',\n}\n\nexport const primaryThemeConfig: NgxLoadingConfig = {\n animationType: ngxLoadingAnimationTypes.threeBounce,\n backdropBackgroundColour: 'rgba(250,250,250,0.2)',\n backdropBorderRadius: '0px',\n primaryColour: 'rgba(53,126,189,0.7)',\n secondaryColour: 'rgba(53,126,189,0.7)',\n tertiaryColour: 'rgba(53,126,189,0.7)',\n}\n","import { Component, Input } from '@angular/core'\n\nimport { NgxLoadingConfig, NgxLoadingModule } from 'ngx-loading'\n\nimport { defaultThemeConfig, primaryThemeConfig } from '../loading-themes'\nimport { TheSeamLoadingTheme } from '../loading.models'\n\n@Component({\n selector: 'seam-loading',\n templateUrl: './loading.component.html',\n styleUrls: ['./loading.component.scss'],\n imports: [NgxLoadingModule],\n})\nexport class TheSeamLoadingComponent {\n @Input()\n set theme(value: TheSeamLoadingTheme) {\n if (value === 'primary') {\n this._theme = primaryThemeConfig\n } else {\n this._theme = defaultThemeConfig\n }\n }\n _theme: NgxLoadingConfig = defaultThemeConfig\n}\n","<ngx-loading [show]=\"true\" [config]=\"_theme\"></ngx-loading>\n","import { OverlayModule } from '@angular/cdk/overlay'\nimport { PortalModule } from '@angular/cdk/portal'\nimport { NgModule } from '@angular/core'\n\nimport { TheSeamLoadingComponent } from './loading/loading.component'\n\n@NgModule({\n imports: [TheSeamLoadingComponent],\n exports: [OverlayModule, PortalModule, TheSeamLoadingComponent],\n})\nexport class TheSeamLoadingModule {}\n","import { Overlay, OverlayRef } from '@angular/cdk/overlay'\nimport { ComponentPortal } from '@angular/cdk/portal'\nimport { inject, Injectable } from '@angular/core'\nimport { Observable, throwError } from 'rxjs'\nimport { catchError, finalize, tap } from 'rxjs/operators'\n\nimport { TheSeamLoadingComponent } from './loading/loading.component'\n\n@Injectable({ providedIn: 'root' })\nexport class TheSeamLoadingOverlayService {\n private readonly _overlay = inject(Overlay)\n\n private _enabled = false\n\n private _overlayRef?: OverlayRef\n\n get enabled(): boolean {\n return this._enabled\n }\n\n public toggle(enabled?: boolean) {\n const enable = enabled === undefined ? !this.enabled : enabled\n if (enable && !this.enabled) {\n this.enable()\n } else if (!enable && this.enabled) {\n this.disable()\n }\n }\n\n public enable() {\n if (this.enabled) {\n return\n }\n\n this._overlayRef = this._overlay.create({\n hasBackdrop: false,\n width: '100%',\n height: '100%',\n })\n this._overlayRef.attach(new ComponentPortal(TheSeamLoadingComponent))\n\n this._enabled = true\n }\n\n public disable() {\n if (!this.enabled) {\n return\n }\n\n this._overlayRef?.dispose()\n\n this._enabled = false\n }\n\n public while<T = any>(source: Observable<T>): Observable<T> {\n this.enable()\n return source.pipe(\n tap(() => this.disable()),\n catchError((err) => {\n this.disable()\n return throwError(err)\n }),\n finalize(() => this.disable()),\n )\n }\n}\n","import {\n EnvironmentProviders,\n importProvidersFrom,\n makeEnvironmentProviders,\n} from '@angular/core'\n\nimport { INgxLoadingConfig, NgxLoadingModule } from 'ngx-loading'\n\nimport { defaultThemeConfig } from './loading-themes'\n\nexport function provideTheSeamLoading(\n loadingConfig: INgxLoadingConfig = defaultThemeConfig,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n importProvidersFrom(NgxLoadingModule.forRoot(loadingConfig)),\n ])\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAEO,MAAM,kBAAkB,GAAqB;IAClD,aAAa,EAAE,wBAAwB,CAAC,WAAW;AACnD,IAAA,wBAAwB,EAAE,iBAAiB;AAC3C,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,eAAe,EAAE,SAAS;AAC1B,IAAA,cAAc,EAAE,SAAS;;AAGpB,MAAM,kBAAkB,GAAqB;IAClD,aAAa,EAAE,wBAAwB,CAAC,WAAW;AACnD,IAAA,wBAAwB,EAAE,uBAAuB;AACjD,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,aAAa,EAAE,sBAAsB;AACrC,IAAA,eAAe,EAAE,sBAAsB;AACvC,IAAA,cAAc,EAAE,sBAAsB;;;MCJ3B,uBAAuB,CAAA;IAClC,IACI,KAAK,CAAC,KAA0B,EAAA;AAClC,QAAA,IAAI,KAAK,KAAK,SAAS,EAAE;AACvB,YAAA,IAAI,CAAC,MAAM,GAAG,kBAAkB;QAClC;aAAO;AACL,YAAA,IAAI,CAAC,MAAM,GAAG,kBAAkB;QAClC;IACF;IACA,MAAM,GA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AA;AACZ,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB;QACF;AAEA,QAAA,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE;AAE3B,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK;IACvB;AAEO,IAAA,KAAK,CAAU,MAAqB,EAAA;QACzC,IAAI,CAAC,MAAM,EAAE;QACb,OAAO,MAAM,CAAC,IAAI,CAChB,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,EACzB,UAAU,CAAC,CAAC,GAAG,KAAI;YACjB,IAAI,CAAC,OAAO,EAAE;AACd,YAAA,OAAO,UAAU,CAAC,GAAG,CAAC;AACxB,QAAA,CAAC,CAAC,EACF,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,CAC/B;IACH;wGAvDW,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAA5B,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,4BAA4B,cADf,MAAM,EAAA,CAAA;;4FACnB,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACE5B,SAAU,qBAAqB,CACnC,aAAA,GAAmC,kBAAkB,EAAA;AAErD,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,mBAAmB,CAAC,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAC7D,KAAA,CAAC;AACJ;;AChBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"theseam-ui-common-loading.mjs","sources":["../../../projects/ui-common/loading/loading-themes.ts","../../../projects/ui-common/loading/loading/loading.component.ts","../../../projects/ui-common/loading/loading/loading.component.html","../../../projects/ui-common/loading/loading-overlay.service.ts","../../../projects/ui-common/loading/testing/mock-loading-overlay.ts","../../../projects/ui-common/loading/testing/loading.harness.ts","../../../projects/ui-common/loading/loading.module.ts","../../../projects/ui-common/loading/provide-loading.ts","../../../projects/ui-common/loading/theseam-ui-common-loading.ts"],"sourcesContent":["import { ngxLoadingAnimationTypes, NgxLoadingConfig } from 'ngx-loading'\n\nexport const defaultThemeConfig: NgxLoadingConfig = {\n animationType: ngxLoadingAnimationTypes.threeBounce,\n backdropBackgroundColour: 'rgba(0,0,0,0.3)',\n backdropBorderRadius: '0px',\n primaryColour: '#ffffff',\n secondaryColour: '#ffffff',\n tertiaryColour: '#ffffff',\n}\n\nexport const primaryThemeConfig: NgxLoadingConfig = {\n animationType: ngxLoadingAnimationTypes.threeBounce,\n backdropBackgroundColour: 'rgba(250,250,250,0.2)',\n backdropBorderRadius: '0px',\n primaryColour: 'rgba(53,126,189,0.7)',\n secondaryColour: 'rgba(53,126,189,0.7)',\n tertiaryColour: 'rgba(53,126,189,0.7)',\n}\n","import { Component, Input } from '@angular/core'\n\nimport { NgxLoadingConfig, NgxLoadingModule } from 'ngx-loading'\n\nimport { defaultThemeConfig, primaryThemeConfig } from '../loading-themes'\nimport { TheSeamLoadingTheme } from '../loading.models'\n\n@Component({\n selector: 'seam-loading',\n templateUrl: './loading.component.html',\n styleUrls: ['./loading.component.scss'],\n imports: [NgxLoadingModule],\n})\nexport class TheSeamLoadingComponent {\n @Input()\n set theme(value: TheSeamLoadingTheme) {\n if (value === 'primary') {\n this._theme = primaryThemeConfig\n } else {\n this._theme = defaultThemeConfig\n }\n }\n _theme: NgxLoadingConfig = defaultThemeConfig\n}\n","<ngx-loading [show]=\"true\" [config]=\"_theme\"></ngx-loading>\n","import { Overlay, OverlayRef } from '@angular/cdk/overlay'\nimport { ComponentPortal } from '@angular/cdk/portal'\nimport { inject, Injectable } from '@angular/core'\nimport { Observable, throwError } from 'rxjs'\nimport { catchError, finalize, tap } from 'rxjs/operators'\n\nimport { TheSeamLoadingComponent } from './loading/loading.component'\n\n@Injectable({ providedIn: 'root' })\nexport class TheSeamLoadingOverlayService {\n private readonly _overlay = inject(Overlay)\n\n private _enabled = false\n\n private _overlayRef?: OverlayRef\n\n get enabled(): boolean {\n return this._enabled\n }\n\n public toggle(enabled?: boolean) {\n const enable = enabled === undefined ? !this.enabled : enabled\n if (enable && !this.enabled) {\n this.enable()\n } else if (!enable && this.enabled) {\n this.disable()\n }\n }\n\n public enable() {\n if (this.enabled) {\n return\n }\n\n this._overlayRef = this._overlay.create({\n hasBackdrop: false,\n width: '100%',\n height: '100%',\n })\n this._overlayRef.attach(new ComponentPortal(TheSeamLoadingComponent))\n\n this._enabled = true\n }\n\n public disable() {\n if (!this.enabled) {\n return\n }\n\n this._overlayRef?.dispose()\n\n this._enabled = false\n }\n\n public while<T = any>(source: Observable<T>): Observable<T> {\n this.enable()\n return source.pipe(\n tap(() => this.disable()),\n catchError((err) => {\n this.disable()\n return throwError(err)\n }),\n finalize(() => this.disable()),\n )\n }\n}\n","import { Observable, throwError } from 'rxjs'\nimport { catchError, finalize, tap } from 'rxjs/operators'\n\nimport { TheSeamLoadingOverlayService } from '../loading-overlay.service'\nimport { Provider } from '@angular/core'\n\nexport class MockTheSeamLoadingOverlayService {\n private _enabled = false\n\n get enabled(): boolean {\n return this._enabled\n }\n\n public toggle(enabled?: boolean) {\n const enable = enabled === undefined ? !this.enabled : enabled\n if (enable && !this.enabled) {\n this.enable()\n } else if (!enable && this.enabled) {\n this.disable()\n }\n }\n\n public enable() {\n if (this.enabled) {\n return\n }\n\n this._enabled = true\n }\n\n public disable() {\n if (!this.enabled) {\n return\n }\n\n this._enabled = false\n }\n\n public while(source: Observable<any>) {\n this.enable()\n return source.pipe(\n tap(() => this.disable()),\n catchError((err) => {\n this.disable()\n return throwError(err)\n }),\n finalize(() => this.disable()),\n )\n }\n}\n\nexport function provideMockLoadingService(): Provider {\n return {\n provide: TheSeamLoadingOverlayService,\n useClass: MockTheSeamLoadingOverlayService,\n }\n}\n","import {\n BaseHarnessFilters,\n ComponentHarnessConstructor,\n ContentContainerComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nimport { TheSeamLoadingTheme } from '../loading.models'\nimport { primaryThemeConfig } from '../loading-themes'\n\n/** A set of criteria that can be used to filter a list of `TheSeamLoadingComponentHarness` instances. */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface TheSeamLoadingComponentHarnessFilters\n extends BaseHarnessFilters {}\n\nexport class TheSeamLoadingComponentHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `TheSeamLoadingComponent` instance. */\n static hostSelector = 'seam-loading'\n\n private readonly _backdropElement = this.locatorFor('.backdrop')\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.\n * @param options Options for filtering which menu item instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends TheSeamLoadingComponentHarness>(\n this: ComponentHarnessConstructor<T>,\n options: TheSeamLoadingComponentHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n }\n\n /** Gets the theme. */\n async getTheme(): Promise<TheSeamLoadingTheme> {\n const backdrop = await this._backdropElement()\n const backgroundColor = await backdrop.getCssValue('background-color')\n return backgroundColor.replace(/\\s/g, '') ===\n primaryThemeConfig.backdropBackgroundColour\n ? 'primary'\n : 'default'\n }\n}\n","import { OverlayModule } from '@angular/cdk/overlay'\nimport { PortalModule } from '@angular/cdk/portal'\nimport { NgModule } from '@angular/core'\n\nimport { TheSeamLoadingComponent } from './loading/loading.component'\n\n@NgModule({\n imports: [TheSeamLoadingComponent],\n exports: [OverlayModule, PortalModule, TheSeamLoadingComponent],\n})\nexport class TheSeamLoadingModule {}\n","import {\n EnvironmentProviders,\n importProvidersFrom,\n makeEnvironmentProviders,\n} from '@angular/core'\n\nimport { INgxLoadingConfig, NgxLoadingModule } from 'ngx-loading'\n\nimport { defaultThemeConfig } from './loading-themes'\n\nexport function provideTheSeamLoading(\n loadingConfig: INgxLoadingConfig = defaultThemeConfig,\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n importProvidersFrom(NgxLoadingModule.forRoot(loadingConfig)),\n ])\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAEO,MAAM,kBAAkB,GAAqB;IAClD,aAAa,EAAE,wBAAwB,CAAC,WAAW;AACnD,IAAA,wBAAwB,EAAE,iBAAiB;AAC3C,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,eAAe,EAAE,SAAS;AAC1B,IAAA,cAAc,EAAE,SAAS;;AAGpB,MAAM,kBAAkB,GAAqB;IAClD,aAAa,EAAE,wBAAwB,CAAC,WAAW;AACnD,IAAA,wBAAwB,EAAE,uBAAuB;AACjD,IAAA,oBAAoB,EAAE,KAAK;AAC3B,IAAA,aAAa,EAAE,sBAAsB;AACrC,IAAA,eAAe,EAAE,sBAAsB;AACvC,IAAA,cAAc,EAAE,sBAAsB;;;MCJ3B,uBAAuB,CAAA;IAClC,IACI,KAAK,CAAC,KAA0B,EAAA;AAClC,QAAA,IAAI,KAAK,KAAK,SAAS,EAAE;AACvB,YAAA,IAAI,CAAC,MAAM,GAAG,kBAAkB;QAClC;aAAO;AACL,YAAA,IAAI,CAAC,MAAM,GAAG,kBAAkB;QAClC;IACF;IACA,MAAM,GAAqB,kBAAkB;wGATlC,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECbpC,mEACA,EAAA,MAAA,EAAA,CAAA,+DAAA,CAAA,EAAA,YAAA,EAAA,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BA;;AAEG;;;;"}
|
|
@@ -278,6 +278,19 @@ class TheSeamMenuItemHarness extends ContentContainerComponentHarness {
|
|
|
278
278
|
async hover() {
|
|
279
279
|
return (await this.host()).hover().then(() => animatingWait());
|
|
280
280
|
}
|
|
281
|
+
/** Whether this item is rendered as a link (`<a>`) rather than a `<button>`. */
|
|
282
|
+
async isLink() {
|
|
283
|
+
const tagName = await (await this.host()).getProperty('tagName');
|
|
284
|
+
return tagName.toLowerCase() === 'a';
|
|
285
|
+
}
|
|
286
|
+
/** Gets the `href` attribute, or `null` if not a link. */
|
|
287
|
+
async getHref() {
|
|
288
|
+
return (await this.host()).getAttribute('href');
|
|
289
|
+
}
|
|
290
|
+
/** Gets the `target` attribute (e.g. `_blank`), or `null` if not set. */
|
|
291
|
+
async getTarget() {
|
|
292
|
+
return (await this.host()).getAttribute('target');
|
|
293
|
+
}
|
|
281
294
|
/** Whether this item has a submenu. */
|
|
282
295
|
async hasSubmenu() {
|
|
283
296
|
return (await this.host()).matchesSelector(TheSeamMenuHarness.hostSelector);
|