@theseam/ui-common 0.4.4 → 0.4.6

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.
Files changed (59) hide show
  1. package/datatable/models/preferences-accessor.d.ts +3 -15
  2. package/datatable/models/preferences.d.ts +2 -1
  3. package/datatable/services/datatable-preferences.service.d.ts +11 -14
  4. package/datatable/tokens/datatable-preferences-accessor.d.ts +2 -2
  5. package/esm2020/datatable/datatable/datatable.component.mjs +3 -3
  6. package/esm2020/datatable/models/preferences-accessor.mjs +1 -1
  7. package/esm2020/datatable/models/preferences.mjs +1 -1
  8. package/esm2020/datatable/services/datatable-preferences.service.mjs +34 -106
  9. package/esm2020/datatable/tokens/datatable-preferences-accessor.mjs +1 -1
  10. package/esm2020/framework/dashboard/dashboard-widgets/dashboard-widgets.service.mjs +9 -3
  11. package/esm2020/services/preferences/preferences-accessor.mjs +2 -0
  12. package/esm2020/services/preferences/preferences-manager.service.mjs +69 -0
  13. package/esm2020/services/preferences/preferences-record.mjs +74 -0
  14. package/esm2020/services/preferences/preferences.models.mjs +2 -0
  15. package/esm2020/services/public-api.mjs +5 -1
  16. package/esm2020/story-helpers/public-api.mjs +2 -1
  17. package/esm2020/story-helpers/story-preferences-accessor.service.mjs +34 -0
  18. package/esm2020/widget/preferences/widget-preferences.models.mjs +5 -0
  19. package/esm2020/widget/preferences/widget-preferences.service.mjs +78 -0
  20. package/esm2020/widget/preferences/widget-preferences.token.mjs +3 -0
  21. package/esm2020/widget/public-api.mjs +2 -1
  22. package/esm2020/widget/widget/widget.component.mjs +81 -30
  23. package/esm2020/widget/widget-token.mjs +3 -1
  24. package/esm2020/widget/widget.models.mjs +2 -0
  25. package/fesm2015/theseam-ui-common-datatable.mjs +45 -116
  26. package/fesm2015/theseam-ui-common-datatable.mjs.map +1 -1
  27. package/fesm2015/theseam-ui-common-framework.mjs +9 -3
  28. package/fesm2015/theseam-ui-common-framework.mjs.map +1 -1
  29. package/fesm2015/theseam-ui-common-services.mjs +144 -8
  30. package/fesm2015/theseam-ui-common-services.mjs.map +1 -1
  31. package/fesm2015/theseam-ui-common-story-helpers.mjs +32 -1
  32. package/fesm2015/theseam-ui-common-story-helpers.mjs.map +1 -1
  33. package/fesm2015/theseam-ui-common-widget.mjs +166 -35
  34. package/fesm2015/theseam-ui-common-widget.mjs.map +1 -1
  35. package/fesm2020/theseam-ui-common-datatable.mjs +45 -116
  36. package/fesm2020/theseam-ui-common-datatable.mjs.map +1 -1
  37. package/fesm2020/theseam-ui-common-framework.mjs +8 -3
  38. package/fesm2020/theseam-ui-common-framework.mjs.map +1 -1
  39. package/fesm2020/theseam-ui-common-services.mjs +144 -8
  40. package/fesm2020/theseam-ui-common-services.mjs.map +1 -1
  41. package/fesm2020/theseam-ui-common-story-helpers.mjs +32 -1
  42. package/fesm2020/theseam-ui-common-story-helpers.mjs.map +1 -1
  43. package/fesm2020/theseam-ui-common-widget.mjs +162 -35
  44. package/fesm2020/theseam-ui-common-widget.mjs.map +1 -1
  45. package/package.json +1 -1
  46. package/services/preferences/preferences-accessor.d.ts +15 -0
  47. package/services/preferences/preferences-manager.service.d.ts +15 -0
  48. package/services/preferences/preferences-record.d.ts +28 -0
  49. package/services/preferences/preferences.models.d.ts +3 -0
  50. package/services/public-api.d.ts +4 -0
  51. package/story-helpers/public-api.d.ts +1 -0
  52. package/story-helpers/story-preferences-accessor.service.d.ts +19 -0
  53. package/widget/preferences/widget-preferences.models.d.ts +8 -0
  54. package/widget/preferences/widget-preferences.service.d.ts +21 -0
  55. package/widget/preferences/widget-preferences.token.d.ts +3 -0
  56. package/widget/public-api.d.ts +1 -0
  57. package/widget/widget/widget.component.d.ts +12 -2
  58. package/widget/widget-token.d.ts +3 -0
  59. package/widget/widget.models.d.ts +7 -0
@@ -1,14 +1,14 @@
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, isDevMode, Injectable } from '@angular/core';
4
- import { Subject, BehaviorSubject, throwError, of } from 'rxjs';
5
- import { auditTime, takeUntil, take, switchMap, filter, map } from 'rxjs/operators';
6
- import { getClosestWidgetCdkDrag } from '@theseam/ui-common/utils';
3
+ import { InjectionToken, Directive, Optional, Inject, Input, Component, ChangeDetectionStrategy, NgModule, ViewEncapsulation, HostBinding, ContentChild, EventEmitter, Output, Injectable, isDevMode } from '@angular/core';
4
+ import { Subject, BehaviorSubject, of, tap as tap$1, takeUntil as takeUntil$1, throwError } from 'rxjs';
5
+ import { auditTime, takeUntil, take, switchMap, filter, map, tap } from 'rxjs/operators';
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
9
  import * as i2 from '@angular/common';
10
10
  import { CommonModule } from '@angular/common';
11
- import * as i5 from '@theseam/ui-common/buttons';
11
+ import * as i6 from '@theseam/ui-common/buttons';
12
12
  import { TheSeamButtonsModule } from '@theseam/ui-common/buttons';
13
13
  import { mixinTheme, mixinActive, mixinDisabled, InputBoolean, mixinTabIndex } from '@theseam/ui-common/core';
14
14
  import * as i1$1 from '@angular/cdk/a11y';
@@ -20,12 +20,13 @@ import { TheSeamTableModule } from '@theseam/ui-common/table';
20
20
  import { TheSeamTableCellTypesModule } from '@theseam/ui-common/table-cell-types';
21
21
  import { trigger, transition, style, animate, state } from '@angular/animations';
22
22
  import { faCog, faAngleDown } from '@fortawesome/free-solid-svg-icons';
23
- import * as i2$1 from '@fortawesome/angular-fontawesome';
23
+ import * as i1$3 from '@theseam/ui-common/services';
24
+ import * as i3$1 from '@fortawesome/angular-fontawesome';
24
25
  import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
25
- import * as i4 from '@theseam/ui-common/loading';
26
+ import * as i5 from '@theseam/ui-common/loading';
26
27
  import { TheSeamLoadingModule } from '@theseam/ui-common/loading';
27
28
  import { ComponentPortal } from '@angular/cdk/portal';
28
- import * as i1$3 from '@theseam/ui-common/dynamic-component-loader';
29
+ import * as i1$4 from '@theseam/ui-common/dynamic-component-loader';
29
30
  import { CdkTableModule } from '@angular/cdk/table';
30
31
  import { RouterModule } from '@angular/router';
31
32
 
@@ -944,6 +945,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
944
945
  }]
945
946
  }] });
946
947
 
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
+ const THESEAM_WIDGETS = new InjectionToken('TheSeamWidgets');
1027
+ const THESEAM_WIDGET_DATA = new InjectionToken('TheSeamWidgetData');
1028
+ const THESEAM_WIDGET_DEFAULTS = new InjectionToken('TheSeamWidgetDefaults');
1029
+
947
1030
  const EXPANDED_STATE = 'expanded';
948
1031
  const COLLAPSED_STATE = 'collapsed';
949
1032
  const EXPAND_TRANSITION = `${EXPANDED_STATE} <=> ${COLLAPSED_STATE}`;
@@ -985,9 +1068,32 @@ const collapseAnimation = trigger('collapseAnim', [
985
1068
  * used then the situation should be considered for becoming a widget component.
986
1069
  */
987
1070
  class WidgetComponent {
988
- constructor() {
1071
+ /**
1072
+ * Icon displayed in the top header.
1073
+ *
1074
+ * If a more advanced icon is needed you can use `seamWidgetIconTpl` template
1075
+ * directive, but a `SeamIcon` input is recommended, because allowing custom
1076
+ * icons that do not follow the tested types can lead to inconsitency quickly
1077
+ * as different developers keep making tweaks.
1078
+ */
1079
+ get icon() { return this._iconUrl || this._iconObj; }
1080
+ set icon(value) {
1081
+ if (typeof value === 'string') {
1082
+ this._iconUrl = value;
1083
+ this._iconObj = undefined;
1084
+ }
1085
+ else {
1086
+ this._iconUrl = undefined;
1087
+ this._iconObj = value;
1088
+ }
1089
+ }
1090
+ constructor(_widgetPreferences, _defaults, _data) {
1091
+ this._widgetPreferences = _widgetPreferences;
1092
+ this._defaults = _defaults;
1093
+ this._data = _data;
989
1094
  this.configIcon = faCog;
990
1095
  this.collapseIcon = faAngleDown;
1096
+ this._ngUnsubscribe = new Subject();
991
1097
  /**
992
1098
  * Toggles the collapsed state of a widget.
993
1099
  */
@@ -1007,26 +1113,27 @@ class WidgetComponent {
1007
1113
  * header to toggle the collapsed state.
1008
1114
  */
1009
1115
  this.canCollapse = false;
1010
- }
1011
- /**
1012
- * Icon displayed in the top header.
1013
- *
1014
- * If a more advanced icon is needed you can use `seamWidgetIconTpl` template
1015
- * directive, but a `SeamIcon` input is recommended, because allowing custom
1016
- * icons that do not follow the tested types can lead to inconsitency quickly
1017
- * as different developers keep making tweaks.
1018
- */
1019
- get icon() { return this._iconUrl || this._iconObj; }
1020
- set icon(value) {
1021
- if (typeof value === 'string') {
1022
- this._iconUrl = value;
1023
- this._iconObj = undefined;
1116
+ if (this._defaults) {
1117
+ if (hasProperty(this._defaults, 'canCollapse')) {
1118
+ this.canCollapse = this._defaults.canCollapse;
1119
+ }
1120
+ if (hasProperty(this._defaults, 'collapsed')) {
1121
+ this.collapsed = this._defaults.collapsed;
1122
+ }
1024
1123
  }
1025
- else {
1026
- this._iconUrl = undefined;
1027
- this._iconObj = value;
1124
+ if (this._data && this._data.widgetId) {
1125
+ this._preferencesKey = `widget:${this._data.widgetId}`;
1126
+ this._widgetPreferences.preferences(this._preferencesKey).pipe(tap$1(prefs => {
1127
+ if (hasProperty(prefs, 'collapsed')) {
1128
+ this.collapsed = prefs.collapsed;
1129
+ }
1130
+ }), takeUntil$1(this._ngUnsubscribe)).subscribe();
1028
1131
  }
1029
1132
  }
1133
+ ngOnDestroy() {
1134
+ this._ngUnsubscribe.next();
1135
+ this._ngUnsubscribe.complete();
1136
+ }
1030
1137
  /**
1031
1138
  * Toggles a widget's collapsed state.
1032
1139
  */
@@ -1038,11 +1145,21 @@ class WidgetComponent {
1038
1145
  return;
1039
1146
  }
1040
1147
  this.collapsed = !this.collapsed;
1148
+ // Only update the preference, if collapse method is called, because it is
1149
+ // assumed that the user is collapsing the widget. If the collapsed state is
1150
+ // changed by other means, such using the widget's `collapsed` input, then
1151
+ // the preference should not be updated, because that is assumed to be an
1152
+ // app controlled change that should not be persisted.
1153
+ if (this._preferencesKey) {
1154
+ this._widgetPreferences.patchPreferences(this._preferencesKey, { collapsed: this.collapsed });
1155
+ }
1041
1156
  }
1042
1157
  get collapseState() { return this.collapsed ? COLLAPSED_STATE : EXPANDED_STATE; }
1043
1158
  }
1044
- WidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1045
- WidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetComponent, selector: "seam-widget", inputs: { collapsed: "collapsed", hasHeader: "hasHeader", titleText: "titleText", icon: "icon", iconClass: "iconClass", loading: "loading", hasConfig: "hasConfig", canCollapse: "canCollapse" }, queries: [{ propertyName: "iconTpl", first: true, predicate: WidgetIconTplDirective, descendants: true, static: true }, { propertyName: "titleTpl", first: true, predicate: WidgetTitleTplDirective, descendants: true, static: true }], ngImport: i0, template: "<div class=\"seam-widget border rounded overflow-hidden\">\n <div class=\"widget-header\" seamWidgetDragHandle *ngIf=\"hasHeader\">\n <div class=\"widget-header-content p-2 text-nowrap\">\n <span class=\"mr-1 widget-header-icon\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <ng-template\n [ngTemplateOutlet]=\"iconTpl.template\"\n [ngTemplateOutletContext]=\"{ $implicit: icon, icon: icon, title: titleText }\">\n </ng-template>\n </ng-container>\n <ng-template #noIconTpl>\n <fa-icon *ngIf=\"_iconObj\"\n class=\"widget-header-icon--fa {{ iconClass }}\"\n [icon]=\"_iconObj\"></fa-icon>\n <img *ngIf=\"_iconUrl\"\n class=\"widget-header-icon--img {{ iconClass }}\"\n [src]=\"_iconUrl\" [alt]=\"titleText\">\n </ng-template>\n </span>\n <span class=\"widget-header-title text-truncate\">\n <ng-container *ngIf=\"titleTpl; else noTitleTpl\">\n <ng-template\n [ngTemplateOutlet]=\"titleTpl.template\"\n [ngTemplateOutletContext]=\"{ $implicit: titleText, icon: icon, title: titleText }\">\n </ng-template>\n </ng-container>\n <ng-template #noTitleTpl>{{ titleText }}</ng-template>\n </span>\n </div>\n <div class=\"widget-header-btns-container\" *ngIf=\"hasConfig || canCollapse\">\n <!-- <div *ngIf=\"hasConfig\">\n <button seamIconBtn [icon]=\"configIcon\"\n class=\"widget-header-btn-config\"\n [iconType]=\"null\">\n <span class=\"sr-only\">Widget configuration menu</span>\n </button>\n <button seamButton class=\"widget-header-btn-config p-0\">\n <seam-icon class=\"d-block\" [icon]=\"configIcon\" iconClass=\"text-secondary\"></seam-icon>\n <span class=\"sr-only\">Widget configuration menu</span>\n </button>\n </div> -->\n\n <div *ngIf=\"canCollapse\" class=\"px-0\">\n\n <button seamButton class=\"widget-header-btn-collapse p-0 mr-1 h-100\" (click)=\"collapse()\" [class.widget-header-btn-collapse--active]=\"collapsed\">\n <seam-icon class=\"d-block\"\n [icon]=\"collapseIcon\"\n iconClass=\"text-secondary\">\n </seam-icon>\n <span class=\"sr-only\">Widget collapse</span>\n </button>\n <!-- iconType=\"borderless-styled-square\" -->\n <!-- style=\"margin-left: -10px; margin-right: -5px;\" -->\n\n <!-- <button seamIconBtn class=\"widget-header-btn-collapse\" (click)=\"collapse()\" [class.widget-header-btn-collapse--active]=\"collapsed\"\n btnTheme=\"secondary\"\n [icon]=\"collapseIcon\"\n iconType=\"borderless-styled-square\"\n size=\"xs\"\n btnSize=\"sm\"\n >\n <seam-icon class=\"d-block\"\n [icon]=\"collapseIcon\"\n iconClass=\"text-secondary\"\n style=\"margin-left: -10px; margin-right: -5px;\"\n iconType=\"borderless-styled-square\"></seam-icon>\n <span class=\"sr-only\">Widget collapse</span>\n </button> -->\n </div>\n </div>\n </div>\n <div class=\"position-relative overflow-hidden\" [style.height.px]=\"loading ? 150 : undefined\" [@collapseAnim]=\"collapseState\">\n <ng-container *ngIf=\"!collapsed\">\n <div class=\"p-2\" *ngIf=\"!loading else loadingTpl\" @keepContentAnim>\n <ng-content></ng-content>\n </div>\n <ng-content select=\"seam-widget-footer\"></ng-content>\n <ng-template #loadingTpl>\n <div class=\"position-absolute\" @loadingAnim style=\"top:0;right:0;bottom:0;left:0\">\n <seam-loading [theme]=\"'primary'\"></seam-loading>\n </div>\n </ng-template>\n </ng-container>\n </div>\n</div>\n", styles: ["seam-widget{display:block;font-size:15px}seam-widget .seam-widget{background:#FFFFFF;box-shadow:none}seam-widget .widget-header{display:flex;flex-direction:row;border-bottom:1px solid #dee2e6;background:#F4F4F4;font-size:17px}seam-widget .widget-header .widget-header-content{flex:1 1 100%}seam-widget .widget-header .widget-header-btns-container{display:flex;flex-direction:row}seam-widget .widget-header .widget-header-btns-container>div{display:flex;flex-direction:column;justify-content:center;padding:4px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-config .seam-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;height:25px;width:30px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-config .seam-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .seam-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;height:25px;width:30px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .seam-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .svg-inline--fa{transform:rotate(0);transition:.3s ease-in-out transform}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse.widget-header-btn-collapse--active .svg-inline--fa{transform:rotate(90deg)}seam-widget .widget-header .widget-header-title{font-size:17px}seam-widget .widget-header-icon{display:inline-block;vertical-align:top;max-height:20px;max-width:20px;height:20px;width:20px;color:currentColor}seam-widget .widget-header-icon .widget-header-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;max-height:20px;max-width:20px;height:20px;width:20px}seam-widget .widget-header-icon .widget-header-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header-icon .widget-header-icon--img{height:100%;max-height:20px;max-width:20px}\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: i2$1.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { kind: "component", type: i3.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }, { kind: "component", type: i4.LoadingComponent, selector: "seam-loading", inputs: ["theme"] }, { kind: "component", type: i5.ButtonComponent, selector: "button[seamButton]", inputs: ["disabled", "theme", "size", "type"], exportAs: ["seamButton"] }, { kind: "directive", type: WidgetDragHandleDirective, selector: "[seamWidgetDragHandle]", inputs: ["cdkDragHandleDisabled"] }], animations: [
1159
+ WidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetComponent, deps: [{ token: WidgetPreferencesService }, { token: THESEAM_WIDGET_DEFAULTS, optional: true }, { token: THESEAM_WIDGET_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1160
+ WidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: WidgetComponent, selector: "seam-widget", inputs: { collapsed: "collapsed", hasHeader: "hasHeader", titleText: "titleText", icon: "icon", iconClass: "iconClass", loading: "loading", hasConfig: "hasConfig", canCollapse: "canCollapse" }, providers: [
1161
+ WidgetPreferencesService,
1162
+ ], queries: [{ propertyName: "iconTpl", first: true, predicate: WidgetIconTplDirective, descendants: true, static: true }, { propertyName: "titleTpl", first: true, predicate: WidgetTitleTplDirective, descendants: true, static: true }], ngImport: i0, template: "<div class=\"seam-widget border rounded overflow-hidden\">\n <div class=\"widget-header\" seamWidgetDragHandle *ngIf=\"hasHeader\">\n <div class=\"widget-header-content p-2 text-nowrap\">\n <span class=\"mr-1 widget-header-icon\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <ng-template\n [ngTemplateOutlet]=\"iconTpl.template\"\n [ngTemplateOutletContext]=\"{ $implicit: icon, icon: icon, title: titleText }\">\n </ng-template>\n </ng-container>\n <ng-template #noIconTpl>\n <fa-icon *ngIf=\"_iconObj\"\n class=\"widget-header-icon--fa {{ iconClass }}\"\n [icon]=\"_iconObj\"></fa-icon>\n <img *ngIf=\"_iconUrl\"\n class=\"widget-header-icon--img {{ iconClass }}\"\n [src]=\"_iconUrl\" [alt]=\"titleText\">\n </ng-template>\n </span>\n <span class=\"widget-header-title text-truncate\">\n <ng-container *ngIf=\"titleTpl; else noTitleTpl\">\n <ng-template\n [ngTemplateOutlet]=\"titleTpl.template\"\n [ngTemplateOutletContext]=\"{ $implicit: titleText, icon: icon, title: titleText }\">\n </ng-template>\n </ng-container>\n <ng-template #noTitleTpl>{{ titleText }}</ng-template>\n </span>\n </div>\n <div class=\"widget-header-btns-container\" *ngIf=\"hasConfig || canCollapse\">\n <!-- <div *ngIf=\"hasConfig\">\n <button seamIconBtn [icon]=\"configIcon\"\n class=\"widget-header-btn-config\"\n [iconType]=\"null\">\n <span class=\"sr-only\">Widget configuration menu</span>\n </button>\n <button seamButton class=\"widget-header-btn-config p-0\">\n <seam-icon class=\"d-block\" [icon]=\"configIcon\" iconClass=\"text-secondary\"></seam-icon>\n <span class=\"sr-only\">Widget configuration menu</span>\n </button>\n </div> -->\n\n <div *ngIf=\"canCollapse\" class=\"px-0\">\n\n <button seamButton class=\"widget-header-btn-collapse p-0 mr-1 h-100\" (click)=\"collapse()\" [class.widget-header-btn-collapse--active]=\"collapsed\">\n <seam-icon class=\"d-block\"\n [icon]=\"collapseIcon\"\n iconClass=\"text-secondary\">\n </seam-icon>\n <span class=\"sr-only\">Widget collapse</span>\n </button>\n <!-- iconType=\"borderless-styled-square\" -->\n <!-- style=\"margin-left: -10px; margin-right: -5px;\" -->\n\n <!-- <button seamIconBtn class=\"widget-header-btn-collapse\" (click)=\"collapse()\" [class.widget-header-btn-collapse--active]=\"collapsed\"\n btnTheme=\"secondary\"\n [icon]=\"collapseIcon\"\n iconType=\"borderless-styled-square\"\n size=\"xs\"\n btnSize=\"sm\"\n >\n <seam-icon class=\"d-block\"\n [icon]=\"collapseIcon\"\n iconClass=\"text-secondary\"\n style=\"margin-left: -10px; margin-right: -5px;\"\n iconType=\"borderless-styled-square\"></seam-icon>\n <span class=\"sr-only\">Widget collapse</span>\n </button> -->\n </div>\n </div>\n </div>\n <div class=\"position-relative overflow-hidden\" [style.height.px]=\"loading ? 150 : undefined\" [@collapseAnim]=\"collapseState\">\n <ng-container *ngIf=\"!collapsed\">\n <div class=\"p-2\" *ngIf=\"!loading else loadingTpl\" @keepContentAnim>\n <ng-content></ng-content>\n </div>\n <ng-content select=\"seam-widget-footer\"></ng-content>\n <ng-template #loadingTpl>\n <div class=\"position-absolute\" @loadingAnim style=\"top:0;right:0;bottom:0;left:0\">\n <seam-loading [theme]=\"'primary'\"></seam-loading>\n </div>\n </ng-template>\n </ng-container>\n </div>\n</div>\n", styles: ["seam-widget{display:block;font-size:15px}seam-widget .seam-widget{background:#FFFFFF;box-shadow:none}seam-widget .widget-header{display:flex;flex-direction:row;border-bottom:1px solid #dee2e6;background:#F4F4F4;font-size:17px}seam-widget .widget-header .widget-header-content{flex:1 1 100%}seam-widget .widget-header .widget-header-btns-container{display:flex;flex-direction:row}seam-widget .widget-header .widget-header-btns-container>div{display:flex;flex-direction:column;justify-content:center;padding:4px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-config .seam-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;height:25px;width:30px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-config .seam-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .seam-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;height:25px;width:30px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .seam-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .svg-inline--fa{transform:rotate(0);transition:.3s ease-in-out transform}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse.widget-header-btn-collapse--active .svg-inline--fa{transform:rotate(90deg)}seam-widget .widget-header .widget-header-title{font-size:17px}seam-widget .widget-header-icon{display:inline-block;vertical-align:top;max-height:20px;max-width:20px;height:20px;width:20px;color:currentColor}seam-widget .widget-header-icon .widget-header-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;max-height:20px;max-width:20px;height:20px;width:20px}seam-widget .widget-header-icon .widget-header-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header-icon .widget-header-icon--img{height:100%;max-height:20px;max-width:20px}\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$1.FaIconComponent, selector: "fa-icon", inputs: ["classes", "icon", "title", "spin", "pulse", "mask", "styles", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"] }, { kind: "component", type: i3.IconComponent, selector: "seam-icon", inputs: ["grayscaleOnDisable", "disabled", "iconClass", "icon", "size", "showDefaultOnError", "defaultIcon", "iconType"] }, { kind: "component", type: i5.LoadingComponent, selector: "seam-loading", inputs: ["theme"] }, { kind: "component", type: i6.ButtonComponent, selector: "button[seamButton]", inputs: ["disabled", "theme", "size", "type"], exportAs: ["seamButton"] }, { kind: "directive", type: WidgetDragHandleDirective, selector: "[seamWidgetDragHandle]", inputs: ["cdkDragHandleDisabled"] }], animations: [
1046
1163
  loadingAnimation,
1047
1164
  collapseAnimation,
1048
1165
  keepContentAnimation,
@@ -1064,12 +1181,24 @@ __decorate([
1064
1181
  ], WidgetComponent.prototype, "canCollapse", void 0);
1065
1182
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetComponent, decorators: [{
1066
1183
  type: Component,
1067
- args: [{ selector: 'seam-widget', encapsulation: ViewEncapsulation.None, animations: [
1184
+ args: [{ selector: 'seam-widget', providers: [
1185
+ WidgetPreferencesService,
1186
+ ], encapsulation: ViewEncapsulation.None, animations: [
1068
1187
  loadingAnimation,
1069
1188
  collapseAnimation,
1070
1189
  keepContentAnimation,
1071
1190
  ], template: "<div class=\"seam-widget border rounded overflow-hidden\">\n <div class=\"widget-header\" seamWidgetDragHandle *ngIf=\"hasHeader\">\n <div class=\"widget-header-content p-2 text-nowrap\">\n <span class=\"mr-1 widget-header-icon\">\n <ng-container *ngIf=\"iconTpl; else noIconTpl\">\n <ng-template\n [ngTemplateOutlet]=\"iconTpl.template\"\n [ngTemplateOutletContext]=\"{ $implicit: icon, icon: icon, title: titleText }\">\n </ng-template>\n </ng-container>\n <ng-template #noIconTpl>\n <fa-icon *ngIf=\"_iconObj\"\n class=\"widget-header-icon--fa {{ iconClass }}\"\n [icon]=\"_iconObj\"></fa-icon>\n <img *ngIf=\"_iconUrl\"\n class=\"widget-header-icon--img {{ iconClass }}\"\n [src]=\"_iconUrl\" [alt]=\"titleText\">\n </ng-template>\n </span>\n <span class=\"widget-header-title text-truncate\">\n <ng-container *ngIf=\"titleTpl; else noTitleTpl\">\n <ng-template\n [ngTemplateOutlet]=\"titleTpl.template\"\n [ngTemplateOutletContext]=\"{ $implicit: titleText, icon: icon, title: titleText }\">\n </ng-template>\n </ng-container>\n <ng-template #noTitleTpl>{{ titleText }}</ng-template>\n </span>\n </div>\n <div class=\"widget-header-btns-container\" *ngIf=\"hasConfig || canCollapse\">\n <!-- <div *ngIf=\"hasConfig\">\n <button seamIconBtn [icon]=\"configIcon\"\n class=\"widget-header-btn-config\"\n [iconType]=\"null\">\n <span class=\"sr-only\">Widget configuration menu</span>\n </button>\n <button seamButton class=\"widget-header-btn-config p-0\">\n <seam-icon class=\"d-block\" [icon]=\"configIcon\" iconClass=\"text-secondary\"></seam-icon>\n <span class=\"sr-only\">Widget configuration menu</span>\n </button>\n </div> -->\n\n <div *ngIf=\"canCollapse\" class=\"px-0\">\n\n <button seamButton class=\"widget-header-btn-collapse p-0 mr-1 h-100\" (click)=\"collapse()\" [class.widget-header-btn-collapse--active]=\"collapsed\">\n <seam-icon class=\"d-block\"\n [icon]=\"collapseIcon\"\n iconClass=\"text-secondary\">\n </seam-icon>\n <span class=\"sr-only\">Widget collapse</span>\n </button>\n <!-- iconType=\"borderless-styled-square\" -->\n <!-- style=\"margin-left: -10px; margin-right: -5px;\" -->\n\n <!-- <button seamIconBtn class=\"widget-header-btn-collapse\" (click)=\"collapse()\" [class.widget-header-btn-collapse--active]=\"collapsed\"\n btnTheme=\"secondary\"\n [icon]=\"collapseIcon\"\n iconType=\"borderless-styled-square\"\n size=\"xs\"\n btnSize=\"sm\"\n >\n <seam-icon class=\"d-block\"\n [icon]=\"collapseIcon\"\n iconClass=\"text-secondary\"\n style=\"margin-left: -10px; margin-right: -5px;\"\n iconType=\"borderless-styled-square\"></seam-icon>\n <span class=\"sr-only\">Widget collapse</span>\n </button> -->\n </div>\n </div>\n </div>\n <div class=\"position-relative overflow-hidden\" [style.height.px]=\"loading ? 150 : undefined\" [@collapseAnim]=\"collapseState\">\n <ng-container *ngIf=\"!collapsed\">\n <div class=\"p-2\" *ngIf=\"!loading else loadingTpl\" @keepContentAnim>\n <ng-content></ng-content>\n </div>\n <ng-content select=\"seam-widget-footer\"></ng-content>\n <ng-template #loadingTpl>\n <div class=\"position-absolute\" @loadingAnim style=\"top:0;right:0;bottom:0;left:0\">\n <seam-loading [theme]=\"'primary'\"></seam-loading>\n </div>\n </ng-template>\n </ng-container>\n </div>\n</div>\n", styles: ["seam-widget{display:block;font-size:15px}seam-widget .seam-widget{background:#FFFFFF;box-shadow:none}seam-widget .widget-header{display:flex;flex-direction:row;border-bottom:1px solid #dee2e6;background:#F4F4F4;font-size:17px}seam-widget .widget-header .widget-header-content{flex:1 1 100%}seam-widget .widget-header .widget-header-btns-container{display:flex;flex-direction:row}seam-widget .widget-header .widget-header-btns-container>div{display:flex;flex-direction:column;justify-content:center;padding:4px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-config .seam-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;height:25px;width:30px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-config .seam-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .seam-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;height:25px;width:30px}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .seam-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse .svg-inline--fa{transform:rotate(0);transition:.3s ease-in-out transform}seam-widget .widget-header .widget-header-btns-container .widget-header-btn-collapse.widget-header-btn-collapse--active .svg-inline--fa{transform:rotate(90deg)}seam-widget .widget-header .widget-header-title{font-size:17px}seam-widget .widget-header-icon{display:inline-block;vertical-align:top;max-height:20px;max-width:20px;height:20px;width:20px;color:currentColor}seam-widget .widget-header-icon .widget-header-icon--fa{display:flex;flex-direction:row;justify-content:center;text-align:center;max-height:20px;max-width:20px;height:20px;width:20px}seam-widget .widget-header-icon .widget-header-icon--fa .svg-inline--fa{max-width:100%;height:100%;width:100%}seam-widget .widget-header-icon .widget-header-icon--img{height:100%;max-height:20px;max-width:20px}\n"] }]
1072
- }], propDecorators: { collapsed: [{
1191
+ }], ctorParameters: function () { return [{ type: WidgetPreferencesService }, { type: undefined, decorators: [{
1192
+ type: Optional
1193
+ }, {
1194
+ type: Inject,
1195
+ args: [THESEAM_WIDGET_DEFAULTS]
1196
+ }] }, { type: undefined, decorators: [{
1197
+ type: Optional
1198
+ }, {
1199
+ type: Inject,
1200
+ args: [THESEAM_WIDGET_DATA]
1201
+ }] }]; }, propDecorators: { collapsed: [{
1073
1202
  type: Input
1074
1203
  }], hasHeader: [{
1075
1204
  type: Input
@@ -1102,8 +1231,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1102
1231
  args: [{ selector: 'seam-widget-footer', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div class=\"widget-footer--left\">\n <ng-content select=\"seam-widget-footer-text\"></ng-content>\n</div>\n<div class=\"widget-footer--right\">\n <ng-content select=\"seam-widget-button-group\"></ng-content>\n</div>\n", styles: ["seam-widget-footer{display:flex;flex-direction:row;margin:.25rem}seam-widget-footer .widget-footer--left{flex:1 1 100%}seam-widget-footer .widget-footer--right{flex:0 0 auto}\n"] }]
1103
1232
  }] });
1104
1233
 
1105
- const THESEAM_WIDGETS = new InjectionToken('TheSeamWidgets');
1106
-
1107
1234
  /**
1108
1235
  * Registry is to provide a way to manage widgets in a way that we can load them
1109
1236
  * the same way throughout the app, whether the component itself is registered,
@@ -1141,7 +1268,7 @@ class WidgetRegistryService {
1141
1268
  }
1142
1269
  }
1143
1270
  }
1144
- WidgetRegistryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetRegistryService, deps: [{ token: THESEAM_WIDGETS }, { token: i1$3.TheSeamDynamicComponentLoader }], target: i0.ɵɵFactoryTarget.Injectable });
1271
+ WidgetRegistryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetRegistryService, deps: [{ token: THESEAM_WIDGETS }, { token: i1$4.TheSeamDynamicComponentLoader }], target: i0.ɵɵFactoryTarget.Injectable });
1145
1272
  WidgetRegistryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetRegistryService, providedIn: 'root' });
1146
1273
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: WidgetRegistryService, decorators: [{
1147
1274
  type: Injectable,
@@ -1151,7 +1278,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1151
1278
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1152
1279
  type: Inject,
1153
1280
  args: [THESEAM_WIDGETS]
1154
- }] }, { type: i1$3.TheSeamDynamicComponentLoader }]; } });
1281
+ }] }, { type: i1$4.TheSeamDynamicComponentLoader }]; } });
1155
1282
 
1156
1283
  const contentModules = [
1157
1284
  TheSeamWidgetButtonGroupModule,
@@ -1256,5 +1383,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
1256
1383
  * Generated bundle index. Do not edit.
1257
1384
  */
1258
1385
 
1259
- export { THESEAM_WIDGETS, THESEAM_WIDGET_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, WidgetRegistryService, WidgetTableComponent, WidgetTileComponent, WidgetTileFooterComponent, WidgetTileFooterItemComponent, WidgetTileGroupComponent, WidgetTileListComponent, WidgetTileSecondaryIconDirective, WidgetTitleTplDirective, extendStyles, toggleNativeDragInteractions };
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 };
1260
1387
  //# sourceMappingURL=theseam-ui-common-widget.mjs.map