@theseam/ui-common 1.0.0-beta.0 → 1.0.0-beta.10

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 (153) hide show
  1. package/breadcrumbs/index.d.ts +1 -2
  2. package/buttons/index.d.ts +20 -13
  3. package/datatable/index.d.ts +77 -39
  4. package/dynamic/index.d.ts +5 -5
  5. package/fesm2022/theseam-ui-common-asset-reader.mjs +28 -29
  6. package/fesm2022/theseam-ui-common-asset-reader.mjs.map +1 -1
  7. package/fesm2022/theseam-ui-common-breadcrumbs.mjs +25 -31
  8. package/fesm2022/theseam-ui-common-breadcrumbs.mjs.map +1 -1
  9. package/fesm2022/theseam-ui-common-buttons.mjs +108 -66
  10. package/fesm2022/theseam-ui-common-buttons.mjs.map +1 -1
  11. package/fesm2022/theseam-ui-common-card.mjs +21 -21
  12. package/fesm2022/theseam-ui-common-card.mjs.map +1 -1
  13. package/fesm2022/theseam-ui-common-carousel.mjs +28 -30
  14. package/fesm2022/theseam-ui-common-carousel.mjs.map +1 -1
  15. package/fesm2022/theseam-ui-common-checkbox.mjs +27 -27
  16. package/fesm2022/theseam-ui-common-checkbox.mjs.map +1 -1
  17. package/fesm2022/theseam-ui-common-confirm-dialog.mjs +23 -27
  18. package/fesm2022/theseam-ui-common-confirm-dialog.mjs.map +1 -1
  19. package/fesm2022/theseam-ui-common-core.mjs +31 -11
  20. package/fesm2022/theseam-ui-common-core.mjs.map +1 -1
  21. package/fesm2022/theseam-ui-common-data-exporter.mjs +18 -19
  22. package/fesm2022/theseam-ui-common-data-exporter.mjs.map +1 -1
  23. package/fesm2022/theseam-ui-common-data-filters.mjs +80 -64
  24. package/fesm2022/theseam-ui-common-data-filters.mjs.map +1 -1
  25. package/fesm2022/theseam-ui-common-datatable-alterations-display.mjs +51 -49
  26. package/fesm2022/theseam-ui-common-datatable-alterations-display.mjs.map +1 -1
  27. package/fesm2022/theseam-ui-common-datatable-dynamic.mjs +145 -112
  28. package/fesm2022/theseam-ui-common-datatable-dynamic.mjs.map +1 -1
  29. package/fesm2022/theseam-ui-common-datatable.mjs +727 -420
  30. package/fesm2022/theseam-ui-common-datatable.mjs.map +1 -1
  31. package/fesm2022/theseam-ui-common-dynamic-component-loader.mjs +12 -14
  32. package/fesm2022/theseam-ui-common-dynamic-component-loader.mjs.map +1 -1
  33. package/fesm2022/theseam-ui-common-dynamic.mjs +60 -48
  34. package/fesm2022/theseam-ui-common-dynamic.mjs.map +1 -1
  35. package/fesm2022/theseam-ui-common-footer-bar.mjs +9 -15
  36. package/fesm2022/theseam-ui-common-footer-bar.mjs.map +1 -1
  37. package/fesm2022/theseam-ui-common-form-field-error.mjs +60 -43
  38. package/fesm2022/theseam-ui-common-form-field-error.mjs.map +1 -1
  39. package/fesm2022/theseam-ui-common-form-field.mjs +129 -76
  40. package/fesm2022/theseam-ui-common-form-field.mjs.map +1 -1
  41. package/fesm2022/theseam-ui-common-framework.mjs +669 -543
  42. package/fesm2022/theseam-ui-common-framework.mjs.map +1 -1
  43. package/fesm2022/theseam-ui-common-google-maps.mjs +206 -149
  44. package/fesm2022/theseam-ui-common-google-maps.mjs.map +1 -1
  45. package/fesm2022/theseam-ui-common-graphql.mjs +311 -254
  46. package/fesm2022/theseam-ui-common-graphql.mjs.map +1 -1
  47. package/fesm2022/theseam-ui-common-icon.mjs +125 -89
  48. package/fesm2022/theseam-ui-common-icon.mjs.map +1 -1
  49. package/fesm2022/theseam-ui-common-layout.mjs +18 -26
  50. package/fesm2022/theseam-ui-common-layout.mjs.map +1 -1
  51. package/fesm2022/theseam-ui-common-loading.mjs +19 -28
  52. package/fesm2022/theseam-ui-common-loading.mjs.map +1 -1
  53. package/fesm2022/theseam-ui-common-menu.mjs +124 -95
  54. package/fesm2022/theseam-ui-common-menu.mjs.map +1 -1
  55. package/fesm2022/theseam-ui-common-modal.mjs +178 -129
  56. package/fesm2022/theseam-ui-common-modal.mjs.map +1 -1
  57. package/fesm2022/theseam-ui-common-models.mjs +3 -3
  58. package/fesm2022/theseam-ui-common-models.mjs.map +1 -1
  59. package/fesm2022/theseam-ui-common-navigation-reload.mjs +13 -11
  60. package/fesm2022/theseam-ui-common-navigation-reload.mjs.map +1 -1
  61. package/fesm2022/theseam-ui-common-popover.mjs +81 -88
  62. package/fesm2022/theseam-ui-common-popover.mjs.map +1 -1
  63. package/fesm2022/theseam-ui-common-progress.mjs +15 -19
  64. package/fesm2022/theseam-ui-common-progress.mjs.map +1 -1
  65. package/fesm2022/theseam-ui-common-rich-text.mjs +65 -52
  66. package/fesm2022/theseam-ui-common-rich-text.mjs.map +1 -1
  67. package/fesm2022/theseam-ui-common-scrollbar.mjs +12 -9
  68. package/fesm2022/theseam-ui-common-scrollbar.mjs.map +1 -1
  69. package/fesm2022/theseam-ui-common-services.mjs +41 -26
  70. package/fesm2022/theseam-ui-common-services.mjs.map +1 -1
  71. package/fesm2022/theseam-ui-common-shared.mjs +149 -159
  72. package/fesm2022/theseam-ui-common-shared.mjs.map +1 -1
  73. package/fesm2022/theseam-ui-common-storage.mjs +9 -6
  74. package/fesm2022/theseam-ui-common-storage.mjs.map +1 -1
  75. package/fesm2022/theseam-ui-common-story-helpers.mjs +148 -86
  76. package/fesm2022/theseam-ui-common-story-helpers.mjs.map +1 -1
  77. package/fesm2022/theseam-ui-common-tabbed.mjs +43 -39
  78. package/fesm2022/theseam-ui-common-tabbed.mjs.map +1 -1
  79. package/fesm2022/theseam-ui-common-table-cell-type.mjs +63 -39
  80. package/fesm2022/theseam-ui-common-table-cell-type.mjs.map +1 -1
  81. package/fesm2022/theseam-ui-common-table-cell-types.mjs +182 -144
  82. package/fesm2022/theseam-ui-common-table-cell-types.mjs.map +1 -1
  83. package/fesm2022/theseam-ui-common-table.mjs +62 -41
  84. package/fesm2022/theseam-ui-common-table.mjs.map +1 -1
  85. package/fesm2022/theseam-ui-common-tel-input.mjs +98 -63
  86. package/fesm2022/theseam-ui-common-tel-input.mjs.map +1 -1
  87. package/fesm2022/theseam-ui-common-testing.mjs +13 -10
  88. package/fesm2022/theseam-ui-common-testing.mjs.map +1 -1
  89. package/fesm2022/theseam-ui-common-tiled-select.mjs +54 -50
  90. package/fesm2022/theseam-ui-common-tiled-select.mjs.map +1 -1
  91. package/fesm2022/theseam-ui-common-toggle-edit.mjs +41 -37
  92. package/fesm2022/theseam-ui-common-toggle-edit.mjs.map +1 -1
  93. package/fesm2022/theseam-ui-common-toggle-group.mjs +30 -31
  94. package/fesm2022/theseam-ui-common-toggle-group.mjs.map +1 -1
  95. package/fesm2022/theseam-ui-common-tooltip.mjs +225 -66
  96. package/fesm2022/theseam-ui-common-tooltip.mjs.map +1 -1
  97. package/fesm2022/theseam-ui-common-unsaved-changes-dialog.mjs +14 -12
  98. package/fesm2022/theseam-ui-common-unsaved-changes-dialog.mjs.map +1 -1
  99. package/fesm2022/theseam-ui-common-utils.mjs +113 -77
  100. package/fesm2022/theseam-ui-common-utils.mjs.map +1 -1
  101. package/fesm2022/theseam-ui-common-validators.mjs +10 -9
  102. package/fesm2022/theseam-ui-common-validators.mjs.map +1 -1
  103. package/fesm2022/theseam-ui-common-vertical-list-filter.mjs +39 -17
  104. package/fesm2022/theseam-ui-common-vertical-list-filter.mjs.map +1 -1
  105. package/fesm2022/theseam-ui-common-viewers.mjs +80 -53
  106. package/fesm2022/theseam-ui-common-viewers.mjs.map +1 -1
  107. package/fesm2022/theseam-ui-common-widget.mjs +288 -314
  108. package/fesm2022/theseam-ui-common-widget.mjs.map +1 -1
  109. package/form-field/index.d.ts +1 -1
  110. package/framework/base-layout/base-layout.component.scss +9 -4
  111. package/framework/base-layout/styles/_variables.scss +4 -9
  112. package/framework/dashboard/dashboard-widgets/dashboard-widgets.component.scss +6 -4
  113. package/framework/index.d.ts +6 -6
  114. package/framework/nav/nav-item/nav-item.component.scss +7 -6
  115. package/framework/nav/styles/_themes/light/_variables.scss +21 -5
  116. package/framework/nav/styles/_themes/primary/_variables.scss +21 -5
  117. package/framework/side-nav/side-nav-item/side-nav-item.component.scss +5 -2
  118. package/framework/side-nav/styles/_themes/light/_variables.scss +5 -1
  119. package/framework/side-nav/styles/_themes/primary/_variables.scss +25 -5
  120. package/graphql/index.d.ts +49 -7
  121. package/modal/README.md +5 -5
  122. package/modal/index.d.ts +1 -1
  123. package/models/index.d.ts +1 -1
  124. package/package.json +59 -60
  125. package/popover/index.d.ts +0 -2
  126. package/progress/progress-circle/styles/_variables.scss +15 -3
  127. package/shared/index.d.ts +0 -13
  128. package/story-helpers/index.d.ts +11 -1
  129. package/styles/bootstrap/_bootstrap.scss +34 -34
  130. package/styles/bootstrap/_bs-styles.scss +4 -8
  131. package/styles/bootstrap/_bs-utilities.scss +4 -4
  132. package/styles/bootstrap/_bs-variables.scss +65 -70
  133. package/styles/common/_forms.scss +9 -10
  134. package/styles/common/_global.scss +0 -1
  135. package/styles/common/_hacks.scss +1 -1
  136. package/styles/common/_table.scss +0 -1
  137. package/styles/common/_text.scss +3 -1
  138. package/styles/theme.scss +1 -1
  139. package/styles/vendor/ng-select/_ng-select-bs4.scss +292 -294
  140. package/styles/vendor/ngx-datatable/_ngx-datatable.scss +63 -32
  141. package/styles/vendor/ngx-datatable/_themes/bootstrap/_variables.scss +37 -10
  142. package/styles/vendor/ngx-datatable/_themes/material/_variables.scss +3 -1
  143. package/styles/vendor/quill/_quill.scss +15 -9
  144. package/table/index.d.ts +4 -1
  145. package/table-cell-type/index.d.ts +27 -2
  146. package/tel-input/README.md +27 -27
  147. package/utils/index.d.ts +3 -3
  148. package/viewers/index.d.ts +9 -2
  149. package/widget/_widget-theme.scss +1 -1
  150. package/widget/styles/_variables.scss +2 -2
  151. package/widget/widget/widget.component.scss +0 -2
  152. package/widget/widget-content-components/widget-tile/widget-tile.component.scss +1 -3
  153. package/widget/widget-footer/widget-footer.component.scss +0 -1
@@ -20,10 +20,16 @@ import { Observable } from 'rxjs';
20
20
  function mixinDisabled(base) {
21
21
  return class extends base {
22
22
  _disabled = false;
23
- get disabled() { return this._disabled; }
24
- set disabled(value) { this._disabled = coerceBooleanProperty(value); }
23
+ get disabled() {
24
+ return this._disabled;
25
+ }
26
+ set disabled(value) {
27
+ this._disabled = coerceBooleanProperty(value);
28
+ }
25
29
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
26
- constructor(...args) { super(...args); }
30
+ constructor(...args) {
31
+ super(...args);
32
+ }
27
33
  };
28
34
  }
29
35
 
@@ -49,7 +55,7 @@ function mixinInitialized(base) {
49
55
  * Observable stream that emits when the directive initializes. If already initialized, the
50
56
  * subscriber is stored to be notified once _markInitialized is called.
51
57
  */
52
- initialized = new Observable(subscriber => {
58
+ initialized = new Observable((subscriber) => {
53
59
  // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify
54
60
  // when _markInitialized is called.
55
61
  if (this._isInitialized) {
@@ -62,7 +68,9 @@ function mixinInitialized(base) {
62
68
  }
63
69
  });
64
70
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
65
- constructor(...args) { super(...args); }
71
+ constructor(...args) {
72
+ super(...args);
73
+ }
66
74
  /**
67
75
  * Marks the state as initialized and notifies pending subscribers. Should be called at the end
68
76
  * of ngOnInit.
@@ -91,7 +99,9 @@ function mixinInitialized(base) {
91
99
  function mixinSize(base, sizePrefix, defaultSize) {
92
100
  return class extends base {
93
101
  _size;
94
- get size() { return this._size; }
102
+ get size() {
103
+ return this._size;
104
+ }
95
105
  set size(value) {
96
106
  const themePalette = value || defaultSize;
97
107
  if (themePalette !== this._size) {
@@ -123,7 +133,9 @@ function mixinSize(base, sizePrefix, defaultSize) {
123
133
  function mixinTabIndex(base, defaultTabIndex = 0) {
124
134
  return class extends base {
125
135
  _tabIndex = defaultTabIndex;
126
- get tabIndex() { return this.disabled ? -1 : this._tabIndex; }
136
+ get tabIndex() {
137
+ return this.disabled ? -1 : this._tabIndex;
138
+ }
127
139
  set tabIndex(value) {
128
140
  // If the specified tabIndex value is null or undefined, fall back to the default value.
129
141
  this._tabIndex = value != null ? value : defaultTabIndex;
@@ -139,7 +151,9 @@ function mixinTabIndex(base, defaultTabIndex = 0) {
139
151
  function mixinTheme(base, themePrefix, defaultTheme) {
140
152
  return class extends base {
141
153
  _theme;
142
- get theme() { return this._theme; }
154
+ get theme() {
155
+ return this._theme;
156
+ }
143
157
  set theme(value) {
144
158
  const themePalette = value || defaultTheme;
145
159
  if (themePalette !== this._theme) {
@@ -164,10 +178,16 @@ function mixinTheme(base, themePrefix, defaultTheme) {
164
178
  function mixinActive(base) {
165
179
  return class extends base {
166
180
  _active = false;
167
- get active() { return this._active; }
168
- set active(value) { this._active = coerceBooleanProperty(value); }
181
+ get active() {
182
+ return this._active;
183
+ }
184
+ set active(value) {
185
+ this._active = coerceBooleanProperty(value);
186
+ }
169
187
  // eslint-disable-next-line @typescript-eslint/no-useless-constructor
170
- constructor(...args) { super(...args); }
188
+ constructor(...args) {
189
+ super(...args);
190
+ }
171
191
  };
172
192
  }
173
193
 
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-core.mjs","sources":["../../../projects/ui-common/core/common-behaviors/constructor.ts","../../../projects/ui-common/core/common-behaviors/disabled.ts","../../../projects/ui-common/core/common-behaviors/initialized.ts","../../../projects/ui-common/core/common-behaviors/size.ts","../../../projects/ui-common/core/common-behaviors/tabindex.ts","../../../projects/ui-common/core/common-behaviors/theme.ts","../../../projects/ui-common/core/common-behaviors/active.ts","../../../projects/ui-common/core/input-decorators/input-boolean.decorator.ts","../../../projects/ui-common/core/input-decorators/input-number.decorator.ts","../../../projects/ui-common/core/theseam-ui-common-core.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** @docs-private */\nexport type Constructor<T> = new(...args: any[]) => T\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport { Constructor } from './constructor'\n\n/** @docs-private */\nexport interface CanDisable {\n /** Whether the component is disabled. */\n disabled: boolean\n}\n\n/** @docs-private */\nexport type CanDisableCtor = Constructor<CanDisable>\n\n/** Mixin to augment a directive with a `disabled` property. */\nexport function mixinDisabled<T extends Constructor<object>>(base: T): CanDisableCtor & T {\n return class extends base {\n private _disabled = false\n\n get disabled() { return this._disabled }\n set disabled(value: any) { this._disabled = coerceBooleanProperty(value) }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) { super(...args) }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { Observable, Subscriber } from 'rxjs'\nimport { Constructor } from './constructor'\n\n/**\n * Mixin that adds an initialized property to a directive which, when subscribed to, will emit a\n * value once markInitialized has been called, which should be done during the ngOnInit function.\n * If the subscription is made after it has already been marked as initialized, then it will trigger\n * an emit immediately.\n * @docs-private\n */\nexport interface HasInitialized {\n /** Stream that emits once during the directive/component's ngOnInit. */\n initialized: Observable<void>\n\n /**\n * Sets the state as initialized and must be called during ngOnInit to notify subscribers that\n * the directive has been initialized.\n * @docs-private\n */\n _markInitialized: () => void\n}\n\n/** @docs-private */\nexport type HasInitializedCtor = Constructor<HasInitialized>\n\n/** Mixin to augment a directive with an initialized property that will emits when ngOnInit ends. */\nexport function mixinInitialized<T extends Constructor<object>>(base: T):\n HasInitializedCtor & T {\n return class extends base {\n /** Whether this directive has been marked as initialized. */\n _isInitialized = false\n\n /**\n * List of subscribers that subscribed before the directive was initialized. Should be notified\n * during _markInitialized. Set to null after pending subscribers are notified, and should\n * not expect to be populated after.\n */\n _pendingSubscribers: Subscriber<void>[] | null = []\n\n /**\n * Observable stream that emits when the directive initializes. If already initialized, the\n * subscriber is stored to be notified once _markInitialized is called.\n */\n initialized = new Observable<void>(subscriber => {\n // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify\n // when _markInitialized is called.\n if (this._isInitialized) {\n this._notifySubscriber(subscriber)\n } else {\n if (this._pendingSubscribers) {\n this._pendingSubscribers.push(subscriber)\n }\n }\n })\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) { super(...args) }\n\n /**\n * Marks the state as initialized and notifies pending subscribers. Should be called at the end\n * of ngOnInit.\n * @docs-private\n */\n _markInitialized(): void {\n if (this._isInitialized) {\n throw Error('This directive has already been marked as initialized and ' +\n 'should not be called twice.')\n }\n\n this._isInitialized = true\n\n if (this._pendingSubscribers) {\n this._pendingSubscribers.forEach(this._notifySubscriber)\n }\n this._pendingSubscribers = null\n }\n\n /** Emits and completes the subscriber stream (should only emit once). */\n _notifySubscriber(subscriber: Subscriber<void>): void {\n subscriber.next()\n subscriber.complete()\n }\n }\n}\n","import { SizePrefixes, SizeTypes } from '@theseam/ui-common/models'\n\nimport { Constructor } from './constructor'\nimport { HasElementRef } from './element-ref'\n\nexport interface CanSize {\n size: SizeTypes | undefined\n}\n\nexport type CanSizeCtor = Constructor<CanSize>\n\n/** Mixin to augment a directive with a `size` property. */\nexport function mixinSize<T extends Constructor<HasElementRef>>(\n base: T, sizePrefix: SizePrefixes, defaultSize?: SizeTypes): CanSizeCtor & T {\n return class extends base {\n private _size: SizeTypes | undefined\n\n get size(): SizeTypes | undefined { return this._size }\n set size(value: SizeTypes | undefined) {\n const themePalette = value || defaultSize\n\n if (themePalette !== this._size) {\n if (this._size) {\n this._elementRef.nativeElement.classList.remove(`${sizePrefix}-${this._size}`)\n }\n if (themePalette) {\n this._elementRef.nativeElement.classList.add(`${sizePrefix}-${themePalette}`)\n }\n\n this._size = themePalette\n }\n }\n\n constructor(...args: any[]) {\n super(...args)\n\n // Set the default size that can be specified from the mixin.\n this.size = defaultSize\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { Constructor } from './constructor'\nimport { CanDisable } from './disabled'\n\n/** @docs-private */\nexport interface HasTabIndex {\n /** Tabindex of the component. */\n tabIndex: number\n}\n\n/** @docs-private */\nexport type HasTabIndexCtor = Constructor<HasTabIndex>\n\n/** Mixin to augment a directive with a `tabIndex` property. */\nexport function mixinTabIndex<T extends Constructor<CanDisable>>(base: T, defaultTabIndex = 0)\n : HasTabIndexCtor & T {\n return class extends base {\n private _tabIndex: number = defaultTabIndex\n\n get tabIndex(): number { return this.disabled ? -1 : this._tabIndex }\n set tabIndex(value: number) {\n // If the specified tabIndex value is null or undefined, fall back to the default value.\n this._tabIndex = value != null ? value : defaultTabIndex\n }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) {\n super(...args)\n }\n }\n}\n","import { OutlineThemeTypes, ThemePrefixes, ThemeTypes } from '@theseam/ui-common/models'\n\nimport { Constructor } from './constructor'\nimport { HasElementRef } from './element-ref'\n\nexport interface CanTheme {\n /** Theme palette for the component. */\n theme: ThemeTypes | OutlineThemeTypes | undefined\n}\n\nexport type CanThemeCtor = Constructor<CanTheme>\n\n/** Mixin to augment a directive with a `theme` property. */\nexport function mixinTheme<T extends Constructor<HasElementRef>>(\n base: T, themePrefix: ThemePrefixes, defaultTheme?: ThemeTypes | OutlineThemeTypes): CanThemeCtor & T {\n return class extends base {\n private _theme: ThemeTypes | OutlineThemeTypes | undefined\n\n get theme(): ThemeTypes | OutlineThemeTypes | undefined { return this._theme }\n set theme(value: ThemeTypes | OutlineThemeTypes | undefined) {\n const themePalette = value || defaultTheme\n\n if (themePalette !== this._theme) {\n if (this._theme) {\n this._elementRef.nativeElement.classList.remove(`${themePrefix}-${this._theme}`)\n }\n if (themePalette) {\n this._elementRef.nativeElement.classList.add(`${themePrefix}-${themePalette}`)\n }\n\n this._theme = themePalette\n }\n }\n\n constructor(...args: any[]) {\n super(...args)\n\n // Set the default theme that can be specified from the mixin.\n this.theme = defaultTheme\n }\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport { Constructor } from './constructor'\n\nexport interface CanBeActive {\n /** Whether the component is active. */\n active: boolean\n}\n\nexport type CanBeActiveCtor = Constructor<CanBeActive>\n\n/** Mixin to augment a directive with a `disabled` property. */\nexport function mixinActive<T extends Constructor<object>>(base: T): CanBeActiveCtor & T {\n return class extends base {\n private _active = false\n\n get active() { return this._active }\n set active(value: any) { this._active = coerceBooleanProperty(value) }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) { super(...args) }\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\n\n/**\n * Use with `@Input()` to coerse the input to a boolean.\n *\n * Example:\n * ```ts\n * @Component({ template: '' })\n * class {\n * @Input() @InputBoolean() b: boolean\n * }\n * ```\n */\nexport function InputBoolean() {\n const cachedValueKey = Symbol('Cached boolean input value')\n return function(\n target: any,\n propertyKey: string,\n descriptor?: PropertyDescriptor\n ) {\n Object.defineProperty(target, propertyKey, {\n set(value: boolean) {\n this[cachedValueKey] = coerceBooleanProperty(value)\n },\n get() {\n return this[cachedValueKey]\n },\n })\n }\n}\n","import { coerceNumberProperty } from '@angular/cdk/coercion'\n\n/**\n * Use with `@Input()` to coerse the input to a number.\n *\n * Example:\n * ```ts\n * @Component({ template: '' })\n * class {\n * @Input() @InputNumber() b: number\n * }\n * ```\n */\nexport function InputNumber<TFallback>(fallback?: TFallback) {\n const cachedValueKey = Symbol('Cached input number value')\n return function(\n target: any,\n propertyKey: string,\n descriptor?: PropertyDescriptor\n ) {\n Object.defineProperty(target, propertyKey, {\n set(value: number) {\n this[cachedValueKey] = coerceNumberProperty(value, fallback)\n },\n get() {\n return this[cachedValueKey]\n },\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;;ACNH;;;;;;AAMG;AAcH;AACM,SAAU,aAAa,CAAgC,IAAO,EAAA;IAClE,OAAO,cA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core.mjs","sources":["../../../projects/ui-common/core/common-behaviors/constructor.ts","../../../projects/ui-common/core/common-behaviors/disabled.ts","../../../projects/ui-common/core/common-behaviors/initialized.ts","../../../projects/ui-common/core/common-behaviors/size.ts","../../../projects/ui-common/core/common-behaviors/tabindex.ts","../../../projects/ui-common/core/common-behaviors/theme.ts","../../../projects/ui-common/core/common-behaviors/active.ts","../../../projects/ui-common/core/input-decorators/input-boolean.decorator.ts","../../../projects/ui-common/core/input-decorators/input-number.decorator.ts","../../../projects/ui-common/core/theseam-ui-common-core.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** @docs-private */\nexport type Constructor<T> = new (...args: any[]) => T\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport { Constructor } from './constructor'\n\n/** @docs-private */\nexport interface CanDisable {\n /** Whether the component is disabled. */\n disabled: boolean\n}\n\n/** @docs-private */\nexport type CanDisableCtor = Constructor<CanDisable>\n\n/** Mixin to augment a directive with a `disabled` property. */\nexport function mixinDisabled<T extends Constructor<object>>(\n base: T,\n): CanDisableCtor & T {\n return class extends base {\n private _disabled = false\n\n get disabled() {\n return this._disabled\n }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) {\n super(...args)\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { Observable, Subscriber } from 'rxjs'\nimport { Constructor } from './constructor'\n\n/**\n * Mixin that adds an initialized property to a directive which, when subscribed to, will emit a\n * value once markInitialized has been called, which should be done during the ngOnInit function.\n * If the subscription is made after it has already been marked as initialized, then it will trigger\n * an emit immediately.\n * @docs-private\n */\nexport interface HasInitialized {\n /** Stream that emits once during the directive/component's ngOnInit. */\n initialized: Observable<void>\n\n /**\n * Sets the state as initialized and must be called during ngOnInit to notify subscribers that\n * the directive has been initialized.\n * @docs-private\n */\n _markInitialized: () => void\n}\n\n/** @docs-private */\nexport type HasInitializedCtor = Constructor<HasInitialized>\n\n/** Mixin to augment a directive with an initialized property that will emits when ngOnInit ends. */\nexport function mixinInitialized<T extends Constructor<object>>(\n base: T,\n): HasInitializedCtor & T {\n return class extends base {\n /** Whether this directive has been marked as initialized. */\n _isInitialized = false\n\n /**\n * List of subscribers that subscribed before the directive was initialized. Should be notified\n * during _markInitialized. Set to null after pending subscribers are notified, and should\n * not expect to be populated after.\n */\n _pendingSubscribers: Subscriber<void>[] | null = []\n\n /**\n * Observable stream that emits when the directive initializes. If already initialized, the\n * subscriber is stored to be notified once _markInitialized is called.\n */\n initialized = new Observable<void>((subscriber) => {\n // If initialized, immediately notify the subscriber. Otherwise store the subscriber to notify\n // when _markInitialized is called.\n if (this._isInitialized) {\n this._notifySubscriber(subscriber)\n } else {\n if (this._pendingSubscribers) {\n this._pendingSubscribers.push(subscriber)\n }\n }\n })\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) {\n super(...args)\n }\n\n /**\n * Marks the state as initialized and notifies pending subscribers. Should be called at the end\n * of ngOnInit.\n * @docs-private\n */\n _markInitialized(): void {\n if (this._isInitialized) {\n throw Error(\n 'This directive has already been marked as initialized and ' +\n 'should not be called twice.',\n )\n }\n\n this._isInitialized = true\n\n if (this._pendingSubscribers) {\n this._pendingSubscribers.forEach(this._notifySubscriber)\n }\n this._pendingSubscribers = null\n }\n\n /** Emits and completes the subscriber stream (should only emit once). */\n _notifySubscriber(subscriber: Subscriber<void>): void {\n subscriber.next()\n subscriber.complete()\n }\n }\n}\n","import { SizePrefixes, SizeTypes } from '@theseam/ui-common/models'\n\nimport { Constructor } from './constructor'\nimport { HasElementRef } from './element-ref'\n\nexport interface CanSize {\n size: SizeTypes | undefined\n}\n\nexport type CanSizeCtor = Constructor<CanSize>\n\n/** Mixin to augment a directive with a `size` property. */\nexport function mixinSize<T extends Constructor<HasElementRef>>(\n base: T,\n sizePrefix: SizePrefixes,\n defaultSize?: SizeTypes,\n): CanSizeCtor & T {\n return class extends base {\n private _size: SizeTypes | undefined\n\n get size(): SizeTypes | undefined {\n return this._size\n }\n set size(value: SizeTypes | undefined) {\n const themePalette = value || defaultSize\n\n if (themePalette !== this._size) {\n if (this._size) {\n this._elementRef.nativeElement.classList.remove(\n `${sizePrefix}-${this._size}`,\n )\n }\n if (themePalette) {\n this._elementRef.nativeElement.classList.add(\n `${sizePrefix}-${themePalette}`,\n )\n }\n\n this._size = themePalette\n }\n }\n\n constructor(...args: any[]) {\n super(...args)\n\n // Set the default size that can be specified from the mixin.\n this.size = defaultSize\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport { Constructor } from './constructor'\nimport { CanDisable } from './disabled'\n\n/** @docs-private */\nexport interface HasTabIndex {\n /** Tabindex of the component. */\n tabIndex: number\n}\n\n/** @docs-private */\nexport type HasTabIndexCtor = Constructor<HasTabIndex>\n\n/** Mixin to augment a directive with a `tabIndex` property. */\nexport function mixinTabIndex<T extends Constructor<CanDisable>>(\n base: T,\n defaultTabIndex = 0,\n): HasTabIndexCtor & T {\n return class extends base {\n private _tabIndex: number = defaultTabIndex\n\n get tabIndex(): number {\n return this.disabled ? -1 : this._tabIndex\n }\n set tabIndex(value: number) {\n // If the specified tabIndex value is null or undefined, fall back to the default value.\n this._tabIndex = value != null ? value : defaultTabIndex\n }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) {\n super(...args)\n }\n }\n}\n","import {\n OutlineThemeTypes,\n ThemePrefixes,\n ThemeTypes,\n} from '@theseam/ui-common/models'\n\nimport { Constructor } from './constructor'\nimport { HasElementRef } from './element-ref'\n\nexport interface CanTheme {\n /** Theme palette for the component. */\n theme: ThemeTypes | OutlineThemeTypes | undefined\n}\n\nexport type CanThemeCtor = Constructor<CanTheme>\n\n/** Mixin to augment a directive with a `theme` property. */\nexport function mixinTheme<T extends Constructor<HasElementRef>>(\n base: T,\n themePrefix: ThemePrefixes,\n defaultTheme?: ThemeTypes | OutlineThemeTypes,\n): CanThemeCtor & T {\n return class extends base {\n private _theme: ThemeTypes | OutlineThemeTypes | undefined\n\n get theme(): ThemeTypes | OutlineThemeTypes | undefined {\n return this._theme\n }\n set theme(value: ThemeTypes | OutlineThemeTypes | undefined) {\n const themePalette = value || defaultTheme\n\n if (themePalette !== this._theme) {\n if (this._theme) {\n this._elementRef.nativeElement.classList.remove(\n `${themePrefix}-${this._theme}`,\n )\n }\n if (themePalette) {\n this._elementRef.nativeElement.classList.add(\n `${themePrefix}-${themePalette}`,\n )\n }\n\n this._theme = themePalette\n }\n }\n\n constructor(...args: any[]) {\n super(...args)\n\n // Set the default theme that can be specified from the mixin.\n this.theme = defaultTheme\n }\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport { Constructor } from './constructor'\n\nexport interface CanBeActive {\n /** Whether the component is active. */\n active: boolean\n}\n\nexport type CanBeActiveCtor = Constructor<CanBeActive>\n\n/** Mixin to augment a directive with a `disabled` property. */\nexport function mixinActive<T extends Constructor<object>>(\n base: T,\n): CanBeActiveCtor & T {\n return class extends base {\n private _active = false\n\n get active() {\n return this._active\n }\n set active(value: any) {\n this._active = coerceBooleanProperty(value)\n }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(...args: any[]) {\n super(...args)\n }\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\n\n/**\n * Use with `@Input()` to coerse the input to a boolean.\n *\n * Example:\n * ```ts\n * @Component({ template: '' })\n * class {\n * @Input() @InputBoolean() b: boolean\n * }\n * ```\n */\nexport function InputBoolean() {\n const cachedValueKey = Symbol('Cached boolean input value')\n return function (\n target: any,\n propertyKey: string,\n descriptor?: PropertyDescriptor,\n ) {\n Object.defineProperty(target, propertyKey, {\n set(value: boolean) {\n this[cachedValueKey] = coerceBooleanProperty(value)\n },\n get() {\n return this[cachedValueKey]\n },\n })\n }\n}\n","import { coerceNumberProperty } from '@angular/cdk/coercion'\n\n/**\n * Use with `@Input()` to coerse the input to a number.\n *\n * Example:\n * ```ts\n * @Component({ template: '' })\n * class {\n * @Input() @InputNumber() b: number\n * }\n * ```\n */\nexport function InputNumber<TFallback>(fallback?: TFallback) {\n const cachedValueKey = Symbol('Cached input number value')\n return function (\n target: any,\n propertyKey: string,\n descriptor?: PropertyDescriptor,\n ) {\n Object.defineProperty(target, propertyKey, {\n set(value: number) {\n this[cachedValueKey] = coerceNumberProperty(value, fallback)\n },\n get() {\n return this[cachedValueKey]\n },\n })\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;;ACNH;;;;;;AAMG;AAcH;AACM,SAAU,aAAa,CAC3B,IAAO,EAAA;IAEP,OAAO,cAAc,IAAI,CAAA;QACf,SAAS,GAAG,KAAK;AAEzB,QAAA,IAAI,QAAQ,GAAA;YACV,OAAO,IAAI,CAAC,SAAS;QACvB;QACA,IAAI,QAAQ,CAAC,KAAU,EAAA;AACrB,YAAA,IAAI,CAAC,SAAS,GAAG,qBAAqB,CAAC,KAAK,CAAC;QAC/C;;AAGA,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;AACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC;QAChB;KACD;AACH;;ACvCA;;;;;;AAMG;AA2BH;AACM,SAAU,gBAAgB,CAC9B,IAAO,EAAA;IAEP,OAAO,cAAc,IAAI,CAAA;;QAEvB,cAAc,GAAG,KAAK;AAEtB;;;;AAIG;QACH,mBAAmB,GAA8B,EA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EAAE,WAAW,EAAE;AACzC,YAAA,GAAG,CAAC,KAAc,EAAA;gBAChB,IAAI,CAAC,cAAc,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC;YACrD,CAAC;YACD,GAAG,GAAA;AACD,gBAAA,OAAO,IAAI,CAAC,cAAc,CAAC;YAC7B,CAAC;AACF,SAAA,CAAC;AACJ,IAAA,CAAC;AACH;;AC3BA;;;;;;;;;;AAUG;AACG,SAAU,WAAW,CAAY,QAAoB,EAAA;AACzD,IAAA,MAAM,cAAc,GAAG,MAAM,CAAC,2BAA2B,CAAC;AAC1D,IAAA,OAAO,UACL,MAAW,EACX,WAAmB,EACnB,UAA+B,EAAA;AAE/B,QAAA,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE;AACzC,YAAA,GAAG,CAAC,KAAa,EAAA;gBACf,IAAI,CAAC,cAAc,CAAC,GAAG,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC;YAC9D,CAAC;YACD,GAAG,GAAA;AACD,gBAAA,OAAO,IAAI,CAAC,cAAc,CAAC;YAC7B,CAAC;AACF,SAAA,CAAC;AACJ,IAAA,CAAC;AACH;;AC7BA;;AAEG;;;;"}
@@ -24,17 +24,17 @@ class CSVDataExporter {
24
24
  // NOTE: `out` should not be passed as a string, but the fileDataFromBuffer
25
25
  // function happens to works with a string. When the build issue about the
26
26
  // function argument is figured out then this should be fixed.
27
- return from(fileDataFromBuffer(out))
27
+ return (from(fileDataFromBuffer(out))
28
28
  // return from(fileDataFromBuffer(Buffer.from(out)))
29
- .pipe(tap(fileData => {
29
+ .pipe(tap((fileData) => {
30
30
  FileSaver.saveAs(fileData.blob, `Export.csv`);
31
- }), mapTo(true));
31
+ }), mapTo(true)));
32
32
  }));
33
33
  }
34
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: CSVDataExporter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
35
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: CSVDataExporter });
34
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: CSVDataExporter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
35
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: CSVDataExporter });
36
36
  }
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: CSVDataExporter, decorators: [{
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: CSVDataExporter, decorators: [{
38
38
  type: Injectable
39
39
  }] });
40
40
 
@@ -46,38 +46,37 @@ class XLSXDataExporter {
46
46
  // TODO: Fix typing for the dynamic imports
47
47
  return wrapIntoObservable(import('xlsx')).pipe(switchMap((XLSX) => {
48
48
  const ws = XLSX.utils.json_to_sheet(data);
49
- const wb = { Sheets: { 'data': ws }, SheetNames: ['data'] };
49
+ const wb = { Sheets: { data: ws }, SheetNames: ['data'] };
50
50
  const excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
51
- return from(fileDataFromBuffer(Buffer.from(excelBuffer)))
52
- .pipe(tap(fileData => {
51
+ return from(fileDataFromBuffer(Buffer.from(excelBuffer))).pipe(tap((fileData) => {
53
52
  FileSaver.saveAs(fileData.blob, `Export.xlsx`);
54
53
  }), mapTo(true));
55
54
  }));
56
55
  }
57
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: XLSXDataExporter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
58
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: XLSXDataExporter });
56
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: XLSXDataExporter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
57
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: XLSXDataExporter });
59
58
  }
60
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: XLSXDataExporter, decorators: [{
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: XLSXDataExporter, decorators: [{
61
60
  type: Injectable
62
61
  }] });
63
62
 
64
63
  class TheSeamDataExporterModule {
65
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: TheSeamDataExporterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
66
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: i0, type: TheSeamDataExporterModule });
67
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: TheSeamDataExporterModule, providers: [
64
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TheSeamDataExporterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
65
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.7", ngImport: i0, type: TheSeamDataExporterModule });
66
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TheSeamDataExporterModule, providers: [
68
67
  { provide: THESEAM_DATA_EXPORTER, useClass: CSVDataExporter, multi: true },
69
- { provide: THESEAM_DATA_EXPORTER, useClass: XLSXDataExporter, multi: true }
68
+ { provide: THESEAM_DATA_EXPORTER, useClass: XLSXDataExporter, multi: true },
70
69
  ] });
71
70
  }
72
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: TheSeamDataExporterModule, decorators: [{
71
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TheSeamDataExporterModule, decorators: [{
73
72
  type: NgModule,
74
73
  args: [{
75
74
  declarations: [],
76
75
  imports: [],
77
76
  providers: [
78
77
  { provide: THESEAM_DATA_EXPORTER, useClass: CSVDataExporter, multi: true },
79
- { provide: THESEAM_DATA_EXPORTER, useClass: XLSXDataExporter, multi: true }
80
- ]
78
+ { provide: THESEAM_DATA_EXPORTER, useClass: XLSXDataExporter, multi: true },
79
+ ],
81
80
  }]
82
81
  }] });
83
82
 
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-data-exporter.mjs","sources":["../../../projects/ui-common/data-exporter/data-exporter.ts","../../../projects/ui-common/data-exporter/exporters/csv-exporter.ts","../../../projects/ui-common/data-exporter/exporters/xlsx-exporter.ts","../../../projects/ui-common/data-exporter/data-exporter.module.ts","../../../projects/ui-common/data-exporter/theseam-ui-common-data-exporter.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { switchMap } from 'rxjs/operators'\n\nimport { IconProp } from '@fortawesome/fontawesome-svg-core'\n\nexport type IDataExporterFunction = <T>(data: T[]) => Observable<T[]>\n\nexport interface IDataExporter {\n /**\n * Name to identify the exporter.\n */\n readonly name: string\n\n /**\n * Label to use for exporter in user visible text.\n *\n * default: `name`\n */\n label?: string\n\n /**\n * Icon to represent exporter.\n */\n icon?: string | IconProp\n\n /**\n * Pass the rows directly to the export function without any mapping.\n */\n skipDataMapping?: boolean\n\n /**\n * Export the data based on the data to some format.\n */\n export<T>(data: T[]): Observable<boolean>\n}\n\nexport const THESEAM_DATA_EXPORTER = new InjectionToken<IDataExporter>('TheSeamDataExporter')\n\nexport function exportOperator<T>(exportFn: IDataExporterFunction) {\n return (source$: Observable<T[]>) =>\n source$.pipe(switchMap(exportFn))\n}\n","import { Injectable } from '@angular/core'\nimport { from, Observable } from 'rxjs'\nimport { mapTo, switchMap, tap } from 'rxjs/operators'\n\nimport { faFileCsv } from '@fortawesome/free-solid-svg-icons'\nimport FileSaver from 'file-saver'\n\nimport { fileDataFromBuffer, wrapIntoObservable } from '@theseam/ui-common/utils'\n\nimport { IDataExporter } from '../data-exporter'\n\n@Injectable()\nexport class CSVDataExporter implements IDataExporter {\n\n public readonly name = 'exporter:csv'\n\n public label = 'CSV'\n\n public icon = faFileCsv\n\n public export<T>(data: T[]): Observable<boolean> {\n // TODO: Fix typing for the dynamic imports\n return wrapIntoObservable(import('xlsx')).pipe(\n switchMap((XLSX: any) => {\n const ws = XLSX.utils.json_to_sheet(data)\n\n const out = XLSX.utils.sheet_to_csv(ws)\n\n // NOTE: `out` should not be passed as a string, but the fileDataFromBuffer\n // function happens to works with a string. When the build issue about the\n // function argument is figured out then this should be fixed.\n return from(fileDataFromBuffer(out as any))\n // return from(fileDataFromBuffer(Buffer.from(out)))\n .pipe(\n tap(fileData => {\n FileSaver.saveAs(fileData.blob, `Export.csv`)\n }),\n mapTo(true)\n )\n })\n )\n }\n\n}\n","import { Injectable } from '@angular/core'\nimport { from, Observable } from 'rxjs'\nimport { mapTo, switchMap, tap } from 'rxjs/operators'\n\nimport { faFileExcel } from '@fortawesome/free-solid-svg-icons'\nimport { Buffer } from 'buffer/'\nimport FileSaver from 'file-saver'\n\nimport { fileDataFromBuffer, wrapIntoObservable } from '@theseam/ui-common/utils'\n\nimport { IDataExporter } from '../data-exporter'\n\n@Injectable()\nexport class XLSXDataExporter implements IDataExporter {\n\n public readonly name = 'exporter:xlsx'\n\n public label = 'XLSX'\n\n public icon = faFileExcel\n\n public export<T>(data: T[]): Observable<boolean> {\n // TODO: Fix typing for the dynamic imports\n return wrapIntoObservable(import('xlsx')).pipe(\n switchMap((XLSX: any) => {\n const ws = XLSX.utils.json_to_sheet(data)\n const wb = { Sheets: { 'data': ws }, SheetNames: ['data'] }\n const excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' })\n\n return from(fileDataFromBuffer(Buffer.from(excelBuffer)))\n .pipe(\n tap(fileData => {\n FileSaver.saveAs(fileData.blob, `Export.xlsx`)\n }),\n mapTo(true)\n )\n })\n )\n }\n\n}\n","import { NgModule } from '@angular/core'\n\nimport { CSVDataExporter } from './exporters/csv-exporter'\nimport { XLSXDataExporter } from './exporters/xlsx-exporter'\n\nimport { THESEAM_DATA_EXPORTER } from './data-exporter'\n\n@NgModule({\n declarations: [],\n imports: [],\n providers: [\n { provide: THESEAM_DATA_EXPORTER, useClass: CSVDataExporter, multi: true },\n { provide: THESEAM_DATA_EXPORTER, useClass: XLSXDataExporter, multi: true }\n ]\n})\nexport class TheSeamDataExporterModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAqCa,qBAAqB,GAAG,IAAI,cAAc,CAAgB,qBAAqB;AAEtF,SAAU,cAAc,CAAI,QAA+B,EAAA;AAC/D,IAAA,OAAO,CAAC,OAAwB,KAC9B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AACrC;;MC9Ba,eAAe,CAAA;IAEV,IAAI,GAAG,cAAc;IAE9B,KAAK,GAAG,KAAK;IAEb,IAAI,GAAG,SAAS;AAEhB,IAAA,MAAM,CAAI,IAAS,EAAA;;AAExB,QAAA,OAAO,kBAAkB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAC5C,SAAS,CAAC,CAAC,IAAS,KAAI;YACtB,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC;YAEzC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC;;;;AAKvC,YAAA,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAU,CAAC;;AAEvC,iBAAA,IAAI,CACH,GAAG,CAAC,QAAQ,IAAG;gBACb,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,IAA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AA,EAAA,CAAA;2GAAhB,gBAAgB,EAAA,CAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B;;;MCGY,yBAAyB,CAAA;uGAAzB,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;wGAAzB,yBAAyB,EAAA,CAAA;AAAzB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,EAAA,SAAA,EALzB;YACT,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE;YAC1E,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI;AAC1E,SAAA,EAAA,CAAA;;2FAEU,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBARrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,SAAS,EAAE;wBACT,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE;wBAC1E,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI;AAC1E;AACF,iBAAA;;;ACdD;;AAEG;;;;"}
1
+ {"version":3,"file":"theseam-ui-common-data-exporter.mjs","sources":["../../../projects/ui-common/data-exporter/data-exporter.ts","../../../projects/ui-common/data-exporter/exporters/csv-exporter.ts","../../../projects/ui-common/data-exporter/exporters/xlsx-exporter.ts","../../../projects/ui-common/data-exporter/data-exporter.module.ts","../../../projects/ui-common/data-exporter/theseam-ui-common-data-exporter.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\nimport { Observable } from 'rxjs'\nimport { switchMap } from 'rxjs/operators'\n\nimport { IconProp } from '@fortawesome/fontawesome-svg-core'\n\nexport type IDataExporterFunction = <T>(data: T[]) => Observable<T[]>\n\nexport interface IDataExporter {\n /**\n * Name to identify the exporter.\n */\n readonly name: string\n\n /**\n * Label to use for exporter in user visible text.\n *\n * default: `name`\n */\n label?: string\n\n /**\n * Icon to represent exporter.\n */\n icon?: string | IconProp\n\n /**\n * Pass the rows directly to the export function without any mapping.\n */\n skipDataMapping?: boolean\n\n /**\n * Export the data based on the data to some format.\n */\n export<T>(data: T[]): Observable<boolean>\n}\n\nexport const THESEAM_DATA_EXPORTER = new InjectionToken<IDataExporter>(\n 'TheSeamDataExporter',\n)\n\nexport function exportOperator<T>(exportFn: IDataExporterFunction) {\n return (source$: Observable<T[]>) => source$.pipe(switchMap(exportFn))\n}\n","import { Injectable } from '@angular/core'\nimport { from, Observable } from 'rxjs'\nimport { mapTo, switchMap, tap } from 'rxjs/operators'\n\nimport { faFileCsv } from '@fortawesome/free-solid-svg-icons'\nimport FileSaver from 'file-saver'\n\nimport {\n fileDataFromBuffer,\n wrapIntoObservable,\n} from '@theseam/ui-common/utils'\n\nimport { IDataExporter } from '../data-exporter'\n\n@Injectable()\nexport class CSVDataExporter implements IDataExporter {\n public readonly name = 'exporter:csv'\n\n public label = 'CSV'\n\n public icon = faFileCsv\n\n public export<T>(data: T[]): Observable<boolean> {\n // TODO: Fix typing for the dynamic imports\n return wrapIntoObservable(import('xlsx')).pipe(\n switchMap((XLSX: any) => {\n const ws = XLSX.utils.json_to_sheet(data)\n\n const out = XLSX.utils.sheet_to_csv(ws)\n\n // NOTE: `out` should not be passed as a string, but the fileDataFromBuffer\n // function happens to works with a string. When the build issue about the\n // function argument is figured out then this should be fixed.\n return (\n from(fileDataFromBuffer(out as any))\n // return from(fileDataFromBuffer(Buffer.from(out)))\n .pipe(\n tap((fileData) => {\n FileSaver.saveAs(fileData.blob, `Export.csv`)\n }),\n mapTo(true),\n )\n )\n }),\n )\n }\n}\n","import { Injectable } from '@angular/core'\nimport { from, Observable } from 'rxjs'\nimport { mapTo, switchMap, tap } from 'rxjs/operators'\n\nimport { faFileExcel } from '@fortawesome/free-solid-svg-icons'\nimport { Buffer } from 'buffer/'\nimport FileSaver from 'file-saver'\n\nimport {\n fileDataFromBuffer,\n wrapIntoObservable,\n} from '@theseam/ui-common/utils'\n\nimport { IDataExporter } from '../data-exporter'\n\n@Injectable()\nexport class XLSXDataExporter implements IDataExporter {\n public readonly name = 'exporter:xlsx'\n\n public label = 'XLSX'\n\n public icon = faFileExcel\n\n public export<T>(data: T[]): Observable<boolean> {\n // TODO: Fix typing for the dynamic imports\n return wrapIntoObservable(import('xlsx')).pipe(\n switchMap((XLSX: any) => {\n const ws = XLSX.utils.json_to_sheet(data)\n const wb = { Sheets: { data: ws }, SheetNames: ['data'] }\n const excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' })\n\n return from(fileDataFromBuffer(Buffer.from(excelBuffer))).pipe(\n tap((fileData) => {\n FileSaver.saveAs(fileData.blob, `Export.xlsx`)\n }),\n mapTo(true),\n )\n }),\n )\n }\n}\n","import { NgModule } from '@angular/core'\n\nimport { CSVDataExporter } from './exporters/csv-exporter'\nimport { XLSXDataExporter } from './exporters/xlsx-exporter'\n\nimport { THESEAM_DATA_EXPORTER } from './data-exporter'\n\n@NgModule({\n declarations: [],\n imports: [],\n providers: [\n { provide: THESEAM_DATA_EXPORTER, useClass: CSVDataExporter, multi: true },\n { provide: THESEAM_DATA_EXPORTER, useClass: XLSXDataExporter, multi: true },\n ],\n})\nexport class TheSeamDataExporterModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAqCa,qBAAqB,GAAG,IAAI,cAAc,CACrD,qBAAqB;AAGjB,SAAU,cAAc,CAAI,QAA+B,EAAA;AAC/D,IAAA,OAAO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