@theseam/ui-common 0.4.6 → 0.4.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,26 +1,26 @@
1
1
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, Directive, Optional, Inject, Input, Component, ChangeDetectionStrategy, NgModule, ViewEncapsulation, HostBinding, ContentChild, EventEmitter, Output, Injectable, isDevMode } from '@angular/core';
3
+ import { InjectionToken, Directive, Optional, Inject, Input, Injectable, Component, ChangeDetectionStrategy, NgModule, ViewEncapsulation, HostBinding, ContentChild, EventEmitter, Output, isDevMode } from '@angular/core';
4
4
  import { Subject, BehaviorSubject, of, tap as tap$1, takeUntil as takeUntil$1, throwError } from 'rxjs';
5
5
  import { auditTime, takeUntil, take, switchMap, filter, map, tap } from 'rxjs/operators';
6
6
  import { getClosestWidgetCdkDrag, hasProperty } from '@theseam/ui-common/utils';
7
7
  import * as i1 from '@angular/cdk/drag-drop';
8
8
  import { DragDropModule } from '@angular/cdk/drag-drop';
9
+ import * as i1$1 from '@theseam/ui-common/services';
9
10
  import * as i2 from '@angular/common';
10
11
  import { CommonModule } from '@angular/common';
11
12
  import * as i6 from '@theseam/ui-common/buttons';
12
13
  import { TheSeamButtonsModule } from '@theseam/ui-common/buttons';
13
14
  import { mixinTheme, mixinActive, mixinDisabled, InputBoolean, mixinTabIndex } from '@theseam/ui-common/core';
14
- import * as i1$1 from '@angular/cdk/a11y';
15
+ import * as i1$2 from '@angular/cdk/a11y';
15
16
  import * as i3 from '@theseam/ui-common/icon';
16
17
  import { TheSeamIconModule } from '@theseam/ui-common/icon';
17
18
  import { __decorate } from 'tslib';
18
- import * as i1$2 from '@theseam/ui-common/table';
19
+ import * as i1$3 from '@theseam/ui-common/table';
19
20
  import { TheSeamTableModule } from '@theseam/ui-common/table';
20
21
  import { TheSeamTableCellTypesModule } from '@theseam/ui-common/table-cell-types';
21
22
  import { trigger, transition, style, animate, state } from '@angular/animations';
22
23
  import { faCog, faAngleDown } from '@fortawesome/free-solid-svg-icons';
23
- import * as i1$3 from '@theseam/ui-common/services';
24
24
  import * as i3$1 from '@fortawesome/angular-fontawesome';
25
25
  import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
26
26
  import * as i5 from '@theseam/ui-common/loading';
@@ -201,6 +201,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
201
201
  }]
202
202
  }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
203
203
 
204
+ const CURRENT_WIDGET_PREFERENCES_VERSION = 1;
205
+ const EMPTY_WIDGET_PREFERENCES = {
206
+ version: 1,
207
+ };
208
+
209
+ const THESEAM_WIDGET_PREFERENCES_ACCESSOR = new InjectionToken('TheSeamWidgetPreferencesAccessor');
210
+
211
+ // TODO: Rethink this. I originally implemented this to be shared widget's then
212
+ // changed it to be per widget, for the accessor injection.
213
+ // @Injectable({ providedIn: 'root' })
214
+ class WidgetPreferencesService {
215
+ constructor(_preferencesManager, _prefsAccessor) {
216
+ this._preferencesManager = _preferencesManager;
217
+ this._prefsAccessor = _prefsAccessor;
218
+ this._pendingPatches = {};
219
+ }
220
+ isPatchPending(preferenceKey) {
221
+ return this._pendingPatches[preferenceKey] && this._pendingPatches[preferenceKey].length > 0;
222
+ }
223
+ isPending(preferenceKey) {
224
+ return this._preferencesManager.isPending(preferenceKey);
225
+ }
226
+ isLoaded(preferenceKey) {
227
+ return this._preferencesManager.isLoaded(preferenceKey);
228
+ }
229
+ preferences(preferenceKey) {
230
+ if (!this._prefsAccessor) {
231
+ return of(JSON.parse(JSON.stringify(EMPTY_WIDGET_PREFERENCES)));
232
+ }
233
+ return this._preferencesManager.preferences(preferenceKey, this._prefsAccessor, EMPTY_WIDGET_PREFERENCES).pipe(map(prefs => {
234
+ if (this._isValidPreferences(prefs)) {
235
+ return prefs;
236
+ }
237
+ throw Error(`Preferences for key '${preferenceKey}' is not a valid widget preferences.`);
238
+ }));
239
+ }
240
+ refresh(preferenceKey) {
241
+ this._preferencesManager.refresh(preferenceKey);
242
+ }
243
+ patchPreferences(preferenceKey, preferences) {
244
+ if (!this._prefsAccessor) {
245
+ return;
246
+ }
247
+ if (!this._pendingPatches[preferenceKey]) {
248
+ this._pendingPatches[preferenceKey] = [];
249
+ }
250
+ if (this._pendingPatches[preferenceKey].length > 0) {
251
+ this._pendingPatches[preferenceKey].push(preferences);
252
+ return;
253
+ }
254
+ this._pendingPatches[preferenceKey].push(preferences);
255
+ this.preferences(preferenceKey).pipe(take(1), map(prefs => {
256
+ const pendingPatches = this._pendingPatches[preferenceKey];
257
+ this._pendingPatches[preferenceKey] = [];
258
+ const newPrefs = pendingPatches.reduce((acc, patch) => {
259
+ return { ...acc, ...patch };
260
+ }, prefs); // Typescript isn't recognizing that 'version' is included in the initial value.
261
+ if (!this._isValidPreferences(newPrefs)) {
262
+ throw Error(`Attempted to patch preferences for key '${preferenceKey}' with invalid preferences.`);
263
+ }
264
+ this._preferencesManager.update(preferenceKey, newPrefs);
265
+ }), tap(() => this.refresh(preferenceKey))).subscribe();
266
+ }
267
+ _isValidPreferences(prefs) {
268
+ return prefs.version === CURRENT_WIDGET_PREFERENCES_VERSION;
269
+ }
270
+ }
271
+ WidgetPreferencesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetPreferencesService, deps: [{ token: i1$1.TheSeamPreferencesManagerService }, { token: THESEAM_WIDGET_PREFERENCES_ACCESSOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
272
+ WidgetPreferencesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetPreferencesService });
273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetPreferencesService, decorators: [{
274
+ type: Injectable
275
+ }], ctorParameters: function () { return [{ type: i1$1.TheSeamPreferencesManagerService }, { type: undefined, decorators: [{
276
+ type: Optional
277
+ }, {
278
+ type: Inject,
279
+ args: [THESEAM_WIDGET_PREFERENCES_ACCESSOR]
280
+ }] }]; } });
281
+
204
282
  class WidgetButtonGroupComponent {
205
283
  }
206
284
  WidgetButtonGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetButtonGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -497,11 +575,11 @@ class WidgetListGroupItemActionableBase extends WidgetListGroupItemBase {
497
575
  this._focusMonitor.stopMonitoring(this._elementRef);
498
576
  }
499
577
  }
500
- WidgetListGroupItemActionableBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemActionableBase, deps: [{ token: i0.ElementRef }, { token: i1$1.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
578
+ WidgetListGroupItemActionableBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemActionableBase, deps: [{ token: i0.ElementRef }, { token: i1$2.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
501
579
  WidgetListGroupItemActionableBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: WidgetListGroupItemActionableBase, usesInheritance: true, ngImport: i0 });
502
580
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemActionableBase, decorators: [{
503
581
  type: Directive
504
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.FocusMonitor }, { type: i0.Renderer2 }]; } });
582
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.FocusMonitor }, { type: i0.Renderer2 }]; } });
505
583
  const _WidgetListGroupItemBase = mixinActive(mixinTheme(mixinDisabled(WidgetListGroupItemBase), 'list-group-item'));
506
584
  const _WidgetListGroupItemActionableBase = mixinActive(mixinTheme(mixinDisabled(WidgetListGroupItemActionableBase), 'list-group-item'));
507
585
  class WidgetListGroupItemComponent extends _WidgetListGroupItemBase {
@@ -533,7 +611,7 @@ class WidgetListGroupItemButtonComponent extends _WidgetListGroupItemActionableB
533
611
  }
534
612
  ngOnDestroy() { super.ngOnDestroy(); }
535
613
  }
536
- WidgetListGroupItemButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemButtonComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
614
+ WidgetListGroupItemButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemButtonComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
537
615
  WidgetListGroupItemButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetListGroupItemButtonComponent, selector: "button[seam-widget-list-group-item],button[seamWidgetListGroupItem]", inputs: { disabled: "disabled", theme: "theme", active: "active", icon: "icon", iconClass: "iconClass", label: "label", secondaryIcon: "secondaryIcon", secondaryIconClass: "secondaryIconClass", secondaryIconTitle: "secondaryIconTitle", type: "type" }, host: { properties: { "attr.type": "type", "class.active": "active", "attr.aria-disabled": "disabled.toString()", "attr.disabled": "disabled || null" }, classAttribute: "list-group-item list-group-item-action" }, exportAs: ["seamWidgetListGroupItem"], usesInheritance: true, ngImport: i0, template: "<div class=\"d-flex flex-row\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <span class=\"pr-2\">\n <ng-container *ngTemplateOutlet=\"$any(iconTpl)\"></ng-container>\n </span>\n </ng-container>\n <ng-template #noIconTpl>\n <span class=\"pr-2\">\n <seam-icon *ngIf=\"icon\"\n [icon]=\"icon\"\n [iconClass]=\"iconClass\"\n iconType=\"borderless-styled-square\">\n </seam-icon>\n </span>\n </ng-template>\n\n <div class=\"d-flex flex-column justify-content-center flex-grow-1\">\n {{ label }}\n </div>\n\n <seam-icon *ngIf=\"secondaryIcon\"\n iconType=\"borderless-styled-square\"\n class=\"secondary-icon align-self-center ml-1\"\n [icon]=\"secondaryIcon\"\n [iconClass]=\"secondaryIconClass\"\n [title]=\"secondaryIconTitle\"\n size=\"lg\">\n </seam-icon>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
538
616
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemButtonComponent, decorators: [{
539
617
  type: Component,
@@ -544,7 +622,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
544
622
  '[attr.aria-disabled]': 'disabled.toString()',
545
623
  '[attr.disabled]': 'disabled || null',
546
624
  }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"d-flex flex-row\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <span class=\"pr-2\">\n <ng-container *ngTemplateOutlet=\"$any(iconTpl)\"></ng-container>\n </span>\n </ng-container>\n <ng-template #noIconTpl>\n <span class=\"pr-2\">\n <seam-icon *ngIf=\"icon\"\n [icon]=\"icon\"\n [iconClass]=\"iconClass\"\n iconType=\"borderless-styled-square\">\n </seam-icon>\n </span>\n </ng-template>\n\n <div class=\"d-flex flex-column justify-content-center flex-grow-1\">\n {{ label }}\n </div>\n\n <seam-icon *ngIf=\"secondaryIcon\"\n iconType=\"borderless-styled-square\"\n class=\"secondary-icon align-self-center ml-1\"\n [icon]=\"secondaryIcon\"\n [iconClass]=\"secondaryIconClass\"\n [title]=\"secondaryIconTitle\"\n size=\"lg\">\n </seam-icon>\n</div>\n" }]
547
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.FocusMonitor }, { type: i0.Renderer2 }]; }, propDecorators: { type: [{
625
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.FocusMonitor }, { type: i0.Renderer2 }]; }, propDecorators: { type: [{
548
626
  type: Input
549
627
  }] } });
550
628
  class WidgetListGroupItemAnchorComponent extends _WidgetListGroupItemActionableBase {
@@ -563,7 +641,7 @@ class WidgetListGroupItemAnchorComponent extends _WidgetListGroupItemActionableB
563
641
  }
564
642
  }
565
643
  }
566
- WidgetListGroupItemAnchorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemAnchorComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
644
+ WidgetListGroupItemAnchorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemAnchorComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
567
645
  WidgetListGroupItemAnchorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetListGroupItemAnchorComponent, selector: "a[seam-widget-list-group-item],a[seamWidgetListGroupItem]", inputs: { disabled: "disabled", theme: "theme", active: "active", icon: "icon", iconClass: "iconClass", label: "label", secondaryIcon: "secondaryIcon", secondaryIconClass: "secondaryIconClass", secondaryIconTitle: "secondaryIconTitle", tabIndex: "tabIndex" }, host: { listeners: { "click": "_haltDisabledEvents($event)" }, properties: { "class.active": "active", "attr.tabindex": "disabled ? -1 : (tabIndex || 0)", "attr.aria-disabled": "disabled.toString()", "attr.disabled": "disabled || null" }, classAttribute: "list-group-item list-group-item-action" }, exportAs: ["seamWidgetListGroupItem"], usesInheritance: true, ngImport: i0, template: "<div class=\"d-flex flex-row\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <span class=\"pr-2\">\n <ng-container *ngTemplateOutlet=\"$any(iconTpl)\"></ng-container>\n </span>\n </ng-container>\n <ng-template #noIconTpl>\n <span class=\"pr-2\">\n <seam-icon *ngIf=\"icon\"\n [icon]=\"icon\"\n [iconClass]=\"iconClass\"\n iconType=\"borderless-styled-square\">\n </seam-icon>\n </span>\n </ng-template>\n\n <div class=\"d-flex flex-column justify-content-center flex-grow-1\">\n {{ label }}\n </div>\n\n <seam-icon *ngIf=\"secondaryIcon\"\n iconType=\"borderless-styled-square\"\n class=\"secondary-icon align-self-center ml-1\"\n [icon]=\"secondaryIcon\"\n [iconClass]=\"secondaryIconClass\"\n [title]=\"secondaryIconTitle\"\n size=\"lg\">\n </seam-icon>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
568
646
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetListGroupItemAnchorComponent, decorators: [{
569
647
  type: Component,
@@ -575,7 +653,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
575
653
  '[attr.disabled]': 'disabled || null',
576
654
  '(click)': '_haltDisabledEvents($event)',
577
655
  }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"d-flex flex-row\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <span class=\"pr-2\">\n <ng-container *ngTemplateOutlet=\"$any(iconTpl)\"></ng-container>\n </span>\n </ng-container>\n <ng-template #noIconTpl>\n <span class=\"pr-2\">\n <seam-icon *ngIf=\"icon\"\n [icon]=\"icon\"\n [iconClass]=\"iconClass\"\n iconType=\"borderless-styled-square\">\n </seam-icon>\n </span>\n </ng-template>\n\n <div class=\"d-flex flex-column justify-content-center flex-grow-1\">\n {{ label }}\n </div>\n\n <seam-icon *ngIf=\"secondaryIcon\"\n iconType=\"borderless-styled-square\"\n class=\"secondary-icon align-self-center ml-1\"\n [icon]=\"secondaryIcon\"\n [iconClass]=\"secondaryIconClass\"\n [title]=\"secondaryIconTitle\"\n size=\"lg\">\n </seam-icon>\n</div>\n" }]
578
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.FocusMonitor }, { type: i0.Renderer2 }]; }, propDecorators: { tabIndex: [{
656
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.FocusMonitor }, { type: i0.Renderer2 }]; }, propDecorators: { tabIndex: [{
579
657
  type: Input
580
658
  }] } });
581
659
 
@@ -642,7 +720,7 @@ class WidgetTableComponent {
642
720
  }
643
721
  }
644
722
  WidgetTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
645
- WidgetTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetTableComponent, selector: "seam-widget-table", inputs: { columns: "columns", rows: "rows", trackBy: "trackBy", size: "size", hasHeader: "hasHeader" }, outputs: { actionRefreshRequest: "actionRefreshRequest" }, ngImport: i0, template: "<seam-table\n [columns]=\"columns\"\n [rows]=\"rows\"\n [trackBy]=\"trackBy\"\n [size]=\"size\"\n [hasHeader]=\"hasHeader\"\n (actionRefreshRequest)=\"_actionRefreshRequest()\">\n</seam-table>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.TableComponent, selector: "seam-table", inputs: ["columns", "rows", "trackBy", "size", "hasHeader"], outputs: ["actionRefreshRequest"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
723
+ WidgetTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetTableComponent, selector: "seam-widget-table", inputs: { columns: "columns", rows: "rows", trackBy: "trackBy", size: "size", hasHeader: "hasHeader" }, outputs: { actionRefreshRequest: "actionRefreshRequest" }, ngImport: i0, template: "<seam-table\n [columns]=\"columns\"\n [rows]=\"rows\"\n [trackBy]=\"trackBy\"\n [size]=\"size\"\n [hasHeader]=\"hasHeader\"\n (actionRefreshRequest)=\"_actionRefreshRequest()\">\n</seam-table>\n", styles: [""], dependencies: [{ kind: "component", type: i1$3.TableComponent, selector: "seam-table", inputs: ["columns", "rows", "trackBy", "size", "hasHeader"], outputs: ["actionRefreshRequest"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
646
724
  __decorate([
647
725
  InputBoolean()
648
726
  ], WidgetTableComponent.prototype, "hasHeader", void 0);
@@ -779,12 +857,12 @@ class TheSeamWidgetTileBase {
779
857
  return this._elementRef.nativeElement;
780
858
  }
781
859
  }
782
- TheSeamWidgetTileBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamWidgetTileBase, deps: [{ token: i0.ElementRef }, { token: i1$1.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
860
+ TheSeamWidgetTileBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamWidgetTileBase, deps: [{ token: i0.ElementRef }, { token: i1$2.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
783
861
  TheSeamWidgetTileBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: TheSeamWidgetTileBase, selector: "ng-component", ngImport: i0, template: '', isInline: true });
784
862
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: TheSeamWidgetTileBase, decorators: [{
785
863
  type: Component,
786
864
  args: [{ template: '' }]
787
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.FocusMonitor }, { type: i0.Renderer2 }]; } });
865
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.FocusMonitor }, { type: i0.Renderer2 }]; } });
788
866
  const _TheSeamWidgetTileMixinBase = mixinTabIndex(mixinDisabled(TheSeamWidgetTileBase));
789
867
  // TODO: Should this component be split into separate components for button and anchor.
790
868
  class WidgetTileComponent extends _TheSeamWidgetTileMixinBase {
@@ -830,7 +908,7 @@ class WidgetTileComponent extends _TheSeamWidgetTileMixinBase {
830
908
  return this._elementRef.nativeElement.nodeName.toLowerCase() === 'a';
831
909
  }
832
910
  }
833
- WidgetTileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetTileComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
911
+ WidgetTileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetTileComponent, deps: [{ token: i0.ElementRef }, { token: i1$2.FocusMonitor }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
834
912
  WidgetTileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetTileComponent, selector: "seam-widget-tile, a[seam-widget-tile], button[seam-widget-tile]", inputs: { disabled: "disabled", type: "type", icon: "icon", grayscaleOnDisable: "grayscaleOnDisable", iconClass: "iconClass", iconType: "iconType", notificationIcon: "notificationIcon", notificationIconClass: "notificationIconClass" }, host: { properties: { "attr.type": "this._attrType", "class.btn": "this._btnCss", "class.disabled": "this._disabledCss", "attr.aria-disabled": "this._ariaDisabled", "attr.disabled": "this._attrDisabled", "attr.tabindex": "this._attrTabIndex" } }, queries: [{ propertyName: "secondaryIcon", first: true, predicate: WidgetTileSecondaryIconDirective, descendants: true, static: true }], exportAs: ["seamWidgetTile"], usesInheritance: true, ngImport: i0, template: "<div class=\"d-flex flex-row\">\n <div style=\"position: relative\">\n <seam-icon\n [icon]=\"icon\"\n [iconType]=\"iconType\"\n [iconClass]=\"iconClass\"\n [disabled]=\"disabled\">\n </seam-icon>\n\n <seam-icon *ngIf=\"notificationIcon\"\n class=\"widget-tile--notification-icon\"\n [icon]=\"notificationIcon\"\n iconType=\"image-fill\"\n [iconClass]=\"notificationIconClass\"\n [disabled]=\"disabled\">\n </seam-icon>\n </div>\n <div class=\"flex-grow-1 text-left pl-2\" style=\"margin: auto 0;\">\n <ng-content></ng-content>\n </div>\n <div *ngIf=\"secondaryIcon\">\n <ng-template [ngTemplateOutlet]=\"secondaryIcon.template\"></ng-template>\n </div>\n</div>\n", styles: ["seam-widget-tile,a[seam-widget-tile],button[seam-widget-tile]{display:block;width:100%;padding:4px;text-decoration:none;color:#212529;font-size:14px;font-weight:400;line-height:18px;border:1px solid #dee2e6;border-radius:10px;margin-bottom:.5rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}seam-widget-tile:hover,a[seam-widget-tile]:hover,button[seam-widget-tile]:hover{color:#212529;background-color:#f4f4f4;text-decoration:none}seam-widget-tile:focus,seam-widget-tile.focus,a[seam-widget-tile]:focus,a[seam-widget-tile].focus,button[seam-widget-tile]:focus,button[seam-widget-tile].focus{box-shadow:0 0 0 .2rem #357ebd40;outline:0}seam-widget-tile.disabled,seam-widget-tile:disabled,a[seam-widget-tile].disabled,a[seam-widget-tile]:disabled,button[seam-widget-tile].disabled,button[seam-widget-tile]:disabled{opacity:.65;pointer-events:none;cursor:default;filter:grayscale(1)}seam-widget-tile:last-child,a[seam-widget-tile]:last-child,button[seam-widget-tile]:last-child{margin-bottom:0}seam-widget-tile .widget-tile--notification-icon,a[seam-widget-tile] .widget-tile--notification-icon,button[seam-widget-tile] .widget-tile--notification-icon{position:absolute;bottom:-3px;right:-3px;width:15px!important;height:15px!important}seam-widget-tile seam-icon img[src$=\".svg\"],a[seam-widget-tile] seam-icon img[src$=\".svg\"],button[seam-widget-tile] seam-icon img[src$=\".svg\"]{height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }], encapsulation: i0.ViewEncapsulation.None });
835
913
  __decorate([
836
914
  InputBoolean()
@@ -838,7 +916,7 @@ __decorate([
838
916
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetTileComponent, decorators: [{
839
917
  type: Component,
840
918
  args: [{ selector: 'seam-widget-tile, a[seam-widget-tile], button[seam-widget-tile]', inputs: ['disabled'], exportAs: 'seamWidgetTile', encapsulation: ViewEncapsulation.None, template: "<div class=\"d-flex flex-row\">\n <div style=\"position: relative\">\n <seam-icon\n [icon]=\"icon\"\n [iconType]=\"iconType\"\n [iconClass]=\"iconClass\"\n [disabled]=\"disabled\">\n </seam-icon>\n\n <seam-icon *ngIf=\"notificationIcon\"\n class=\"widget-tile--notification-icon\"\n [icon]=\"notificationIcon\"\n iconType=\"image-fill\"\n [iconClass]=\"notificationIconClass\"\n [disabled]=\"disabled\">\n </seam-icon>\n </div>\n <div class=\"flex-grow-1 text-left pl-2\" style=\"margin: auto 0;\">\n <ng-content></ng-content>\n </div>\n <div *ngIf=\"secondaryIcon\">\n <ng-template [ngTemplateOutlet]=\"secondaryIcon.template\"></ng-template>\n </div>\n</div>\n", styles: ["seam-widget-tile,a[seam-widget-tile],button[seam-widget-tile]{display:block;width:100%;padding:4px;text-decoration:none;color:#212529;font-size:14px;font-weight:400;line-height:18px;border:1px solid #dee2e6;border-radius:10px;margin-bottom:.5rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}seam-widget-tile:hover,a[seam-widget-tile]:hover,button[seam-widget-tile]:hover{color:#212529;background-color:#f4f4f4;text-decoration:none}seam-widget-tile:focus,seam-widget-tile.focus,a[seam-widget-tile]:focus,a[seam-widget-tile].focus,button[seam-widget-tile]:focus,button[seam-widget-tile].focus{box-shadow:0 0 0 .2rem #357ebd40;outline:0}seam-widget-tile.disabled,seam-widget-tile:disabled,a[seam-widget-tile].disabled,a[seam-widget-tile]:disabled,button[seam-widget-tile].disabled,button[seam-widget-tile]:disabled{opacity:.65;pointer-events:none;cursor:default;filter:grayscale(1)}seam-widget-tile:last-child,a[seam-widget-tile]:last-child,button[seam-widget-tile]:last-child{margin-bottom:0}seam-widget-tile .widget-tile--notification-icon,a[seam-widget-tile] .widget-tile--notification-icon,button[seam-widget-tile] .widget-tile--notification-icon{position:absolute;bottom:-3px;right:-3px;width:15px!important;height:15px!important}seam-widget-tile seam-icon img[src$=\".svg\"],a[seam-widget-tile] seam-icon img[src$=\".svg\"],button[seam-widget-tile] seam-icon img[src$=\".svg\"]{height:100%}\n"] }]
841
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$1.FocusMonitor }, { type: i0.Renderer2 }]; }, propDecorators: { _attrType: [{
919
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$2.FocusMonitor }, { type: i0.Renderer2 }]; }, propDecorators: { _attrType: [{
842
920
  type: HostBinding,
843
921
  args: ['attr.type']
844
922
  }], _btnCss: [{
@@ -945,84 +1023,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
945
1023
  }]
946
1024
  }] });
947
1025
 
948
- const THESEAM_WIDGET_PREFERENCES_ACCESSOR = new InjectionToken('TheSeamWidgetPreferencesAccessor');
949
-
950
- const CURRENT_WIDGET_PREFERENCES_VERSION = 1;
951
- const EMPTY_WIDGET_PREFERENCES = {
952
- version: 1,
953
- };
954
-
955
- // TODO: Rethink this. I originally implemented this to be shared widget's then
956
- // changed it to be per widget, for the accessor injection.
957
- // @Injectable({ providedIn: 'root' })
958
- class WidgetPreferencesService {
959
- constructor(_preferencesManager, _prefsAccessor) {
960
- this._preferencesManager = _preferencesManager;
961
- this._prefsAccessor = _prefsAccessor;
962
- this._pendingPatches = {};
963
- }
964
- isPatchPending(preferenceKey) {
965
- return this._pendingPatches[preferenceKey] && this._pendingPatches[preferenceKey].length > 0;
966
- }
967
- isPending(preferenceKey) {
968
- return this._preferencesManager.isPending(preferenceKey);
969
- }
970
- isLoaded(preferenceKey) {
971
- return this._preferencesManager.isLoaded(preferenceKey);
972
- }
973
- preferences(preferenceKey) {
974
- if (!this._prefsAccessor) {
975
- return of(JSON.parse(JSON.stringify(EMPTY_WIDGET_PREFERENCES)));
976
- }
977
- return this._preferencesManager.preferences(preferenceKey, this._prefsAccessor, EMPTY_WIDGET_PREFERENCES).pipe(map(prefs => {
978
- if (this._isValidPreferences(prefs)) {
979
- return prefs;
980
- }
981
- throw Error(`Preferences for key '${preferenceKey}' is not a valid widget preferences.`);
982
- }));
983
- }
984
- refresh(preferenceKey) {
985
- this._preferencesManager.refresh(preferenceKey);
986
- }
987
- patchPreferences(preferenceKey, preferences) {
988
- if (!this._prefsAccessor) {
989
- return;
990
- }
991
- if (!this._pendingPatches[preferenceKey]) {
992
- this._pendingPatches[preferenceKey] = [];
993
- }
994
- if (this._pendingPatches[preferenceKey].length > 0) {
995
- this._pendingPatches[preferenceKey].push(preferences);
996
- return;
997
- }
998
- this._pendingPatches[preferenceKey].push(preferences);
999
- this.preferences(preferenceKey).pipe(take(1), map(prefs => {
1000
- const pendingPatches = this._pendingPatches[preferenceKey];
1001
- this._pendingPatches[preferenceKey] = [];
1002
- const newPrefs = pendingPatches.reduce((acc, patch) => {
1003
- return { ...acc, ...patch };
1004
- }, prefs); // Typescript isn't recognizing that 'version' is included in the initial value.
1005
- if (!this._isValidPreferences(newPrefs)) {
1006
- throw Error(`Attempted to patch preferences for key '${preferenceKey}' with invalid preferences.`);
1007
- }
1008
- this._preferencesManager.update(preferenceKey, newPrefs);
1009
- }), tap(() => this.refresh(preferenceKey))).subscribe();
1010
- }
1011
- _isValidPreferences(prefs) {
1012
- return prefs.version === CURRENT_WIDGET_PREFERENCES_VERSION;
1013
- }
1014
- }
1015
- WidgetPreferencesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetPreferencesService, deps: [{ token: i1$3.TheSeamPreferencesManagerService }, { token: THESEAM_WIDGET_PREFERENCES_ACCESSOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
1016
- WidgetPreferencesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetPreferencesService });
1017
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetPreferencesService, decorators: [{
1018
- type: Injectable
1019
- }], ctorParameters: function () { return [{ type: i1$3.TheSeamPreferencesManagerService }, { type: undefined, decorators: [{
1020
- type: Optional
1021
- }, {
1022
- type: Inject,
1023
- args: [THESEAM_WIDGET_PREFERENCES_ACCESSOR]
1024
- }] }]; } });
1025
-
1026
1026
  const THESEAM_WIDGETS = new InjectionToken('TheSeamWidgets');
1027
1027
  const THESEAM_WIDGET_DATA = new InjectionToken('TheSeamWidgetData');
1028
1028
  const THESEAM_WIDGET_DEFAULTS = new InjectionToken('TheSeamWidgetDefaults');
@@ -1383,5 +1383,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1383
1383
  * Generated bundle index. Do not edit.
1384
1384
  */
1385
1385
 
1386
- export { THESEAM_WIDGETS, THESEAM_WIDGET_ACCESSOR, THESEAM_WIDGET_DATA, THESEAM_WIDGET_DEFAULTS, TheSeamWidgetButtonGroupModule, TheSeamWidgetContentHeaderModule, TheSeamWidgetDescriptionModule, TheSeamWidgetEmptyLabelModule, TheSeamWidgetFooterLinkModule, TheSeamWidgetFooterTextModule, TheSeamWidgetHeaderBadgeModule, TheSeamWidgetListGroupModule, TheSeamWidgetModule, TheSeamWidgetTableModule, TheSeamWidgetTileListModule, TheSeamWidgetTileModule, WidgetButtonGroupComponent, WidgetComponent, WidgetContentHeaderComponent, WidgetDescriptionComponent, WidgetDragHandleDirective, WidgetEmptyLabelComponent, WidgetFooterComponent, WidgetFooterLinkComponent, WidgetFooterTextComponent, WidgetHeaderBadgeComponent, WidgetIconTplDirective, WidgetListGroupComponent, WidgetListGroupItemAnchorComponent, WidgetListGroupItemButtonComponent, WidgetListGroupItemComponent, WidgetListGroupItemIconTplDirective, WidgetRegistryService, WidgetTableComponent, WidgetTileComponent, WidgetTileFooterComponent, WidgetTileFooterItemComponent, WidgetTileGroupComponent, WidgetTileListComponent, WidgetTileSecondaryIconDirective, WidgetTitleTplDirective, extendStyles, toggleNativeDragInteractions };
1386
+ export { CURRENT_WIDGET_PREFERENCES_VERSION, EMPTY_WIDGET_PREFERENCES, THESEAM_WIDGETS, THESEAM_WIDGET_ACCESSOR, THESEAM_WIDGET_DATA, THESEAM_WIDGET_DEFAULTS, THESEAM_WIDGET_PREFERENCES_ACCESSOR, TheSeamWidgetButtonGroupModule, TheSeamWidgetContentHeaderModule, TheSeamWidgetDescriptionModule, TheSeamWidgetEmptyLabelModule, TheSeamWidgetFooterLinkModule, TheSeamWidgetFooterTextModule, TheSeamWidgetHeaderBadgeModule, TheSeamWidgetListGroupModule, TheSeamWidgetModule, TheSeamWidgetTableModule, TheSeamWidgetTileListModule, TheSeamWidgetTileModule, WidgetButtonGroupComponent, WidgetComponent, WidgetContentHeaderComponent, WidgetDescriptionComponent, WidgetDragHandleDirective, WidgetEmptyLabelComponent, WidgetFooterComponent, WidgetFooterLinkComponent, WidgetFooterTextComponent, WidgetHeaderBadgeComponent, WidgetIconTplDirective, WidgetListGroupComponent, WidgetListGroupItemAnchorComponent, WidgetListGroupItemButtonComponent, WidgetListGroupItemComponent, WidgetListGroupItemIconTplDirective, WidgetPreferencesService, WidgetRegistryService, WidgetTableComponent, WidgetTileComponent, WidgetTileFooterComponent, WidgetTileFooterItemComponent, WidgetTileGroupComponent, WidgetTileListComponent, WidgetTileSecondaryIconDirective, WidgetTitleTplDirective, extendStyles, toggleNativeDragInteractions };
1387
1387
  //# sourceMappingURL=theseam-ui-common-widget.mjs.map