@genesislcap/foundation-ui 14.307.2 → 14.307.4-alpha-0d4c6f2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { Connect } from '@genesislcap/foundation-comms';
1
2
  import { NotificationDataRow, ToastButton } from '@genesislcap/foundation-notifications';
2
3
  import { FoundationElement } from '@microsoft/fast-foundation';
3
4
  import { Subscription } from 'rxjs';
@@ -7,6 +8,7 @@ export declare const foundationNotificationListenerShadowOptions: ShadowRootInit
7
8
  */
8
9
  export declare class NotificationListener extends FoundationElement {
9
10
  notificationListener: HTMLElement;
11
+ connect: Connect;
10
12
  /**
11
13
  * The resource name holding new and existing notifications
12
14
  * @remarks usually 'ALL_NOTIFY_ALERT_RECORDS'
@@ -24,6 +26,7 @@ export declare class NotificationListener extends FoundationElement {
24
26
  */
25
27
  toastButtons: ToastButton[];
26
28
  protected dataSub: Subscription;
29
+ protected connectionSub: Subscription;
27
30
  private datasource;
28
31
  connectedCallback(): Promise<void>;
29
32
  disconnectedCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"notification-listener.d.ts","sourceRoot":"","sources":["../../../src/notification-listener/notification-listener.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,mBAAmB,EACnB,WAAW,EAEZ,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIpC,eAAO,MAAM,2CAA2C,EAAE,cAGzD,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IAC7C,oBAAoB,EAAG,WAAW,CAAC;IAE/C;;;;OAIG;IACmC,YAAY,MAAC;IACnD;;;OAGG;IACuE,YAAY,SAAK;IAC3F;;;OAGG;IACS,YAAY,EAAE,WAAW,EAAE,CAAM;IAE7C,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,UAAU,CAAa;IACrC,iBAAiB;IA8BvB,oBAAoB;IAWpB,OAAO,CAAC,kBAAkB;IAU1B,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI;CA2BhE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;+BAIzC,CAAC"}
1
+ {"version":3,"file":"notification-listener.d.ts","sourceRoot":"","sources":["../../../src/notification-listener/notification-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAIL,mBAAmB,EACnB,WAAW,EAEZ,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIpC,eAAO,MAAM,2CAA2C,EAAE,cAGzD,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IAC7C,oBAAoB,EAAG,WAAW,CAAC;IAEtC,OAAO,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACmC,YAAY,MAAC;IACnD;;;OAGG;IACuE,YAAY,SAAK;IAC3F;;;OAGG;IACS,YAAY,EAAE,WAAW,EAAE,CAAM;IAE7C,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;IAChC,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC;IAC1B,OAAO,CAAC,UAAU,CAAa;IACrC,iBAAiB;IAuCvB,oBAAoB;IAapB,OAAO,CAAC,kBAAkB;IAU1B,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI;CA2BhE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;+BAIzC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
- import { Datasource, dataServerResultFilter, } from '@genesislcap/foundation-comms';
2
+ import { Datasource, dataServerResultFilter, Connect, } from '@genesislcap/foundation-comms';
3
3
  import { showNotificationToast } from '@genesislcap/foundation-notifications';
4
4
  import { NotificationEvent, showNotification, } from '@genesislcap/foundation-notifications';
5
5
  import { attr, nullableNumberConverter, observable } from '@microsoft/fast-element';
@@ -32,37 +32,46 @@ export class NotificationListener extends FoundationElement {
32
32
  connectedCallback: { get: () => super.connectedCallback }
33
33
  });
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
- var _a;
36
35
  _super.connectedCallback.call(this);
37
36
  this.addEventListener(NotificationEvent.NOTIFICATION_EVENT, (e) => {
38
37
  e.stopImmediatePropagation();
39
38
  showNotification(e.detail, this.tagName, this.notificationListener);
40
39
  });
41
- if (this.resourceName) {
42
- const initOK = yield this.datasource.init({
43
- resourceName: this.resourceName,
44
- }, true);
45
- if (!initOK) {
46
- logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
47
- return;
48
- }
49
- this.dataSub = (_a = this.datasource.stream) === null || _a === void 0 ? void 0 : _a.subscribe((result) => {
50
- if (result.ROW && result.SEQUENCE_ID > 1) {
51
- this.handleStreamUpdate(dataServerResultFilter(result));
40
+ this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => __awaiter(this, void 0, void 0, function* () {
41
+ var _a;
42
+ if (isConnected) {
43
+ if (this.resourceName) {
44
+ if (this.datasource.initialized) {
45
+ this.datasource.destroy();
46
+ }
47
+ const initOK = yield this.datasource.init({
48
+ resourceName: this.resourceName,
49
+ }, true);
50
+ if (!initOK) {
51
+ logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
52
+ return;
53
+ }
54
+ this.dataSub = (_a = this.datasource.stream) === null || _a === void 0 ? void 0 : _a.subscribe((result) => {
55
+ if (result.ROW && result.SEQUENCE_ID > 1) {
56
+ this.handleStreamUpdate(dataServerResultFilter(result));
57
+ }
58
+ });
52
59
  }
53
- });
54
- }
60
+ }
61
+ }));
55
62
  });
56
63
  }
57
64
  disconnectedCallback() {
58
- var _a, _b;
65
+ var _a, _b, _c;
59
66
  super.disconnectedCallback();
60
67
  /**
61
68
  * Attempt to clean up after ourselves.
62
69
  */
63
70
  (_a = this.dataSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
64
71
  delete this.dataSub;
65
- (_b = this.datasource) === null || _b === void 0 ? void 0 : _b.destroy();
72
+ (_b = this.connectionSub) === null || _b === void 0 ? void 0 : _b.unsubscribe();
73
+ delete this.connectionSub;
74
+ (_c = this.datasource) === null || _c === void 0 ? void 0 : _c.destroy();
66
75
  delete this.datasource;
67
76
  }
68
77
  handleStreamUpdate(dataServerResult) {
@@ -99,6 +108,9 @@ export class NotificationListener extends FoundationElement {
99
108
  __decorate([
100
109
  observable
101
110
  ], NotificationListener.prototype, "notificationListener", void 0);
111
+ __decorate([
112
+ Connect
113
+ ], NotificationListener.prototype, "connect", void 0);
102
114
  __decorate([
103
115
  attr({ attribute: 'resource-name' })
104
116
  ], NotificationListener.prototype, "resourceName", void 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ui",
3
3
  "description": "Genesis Foundation UI",
4
- "version": "14.307.2",
4
+ "version": "14.307.4-alpha-0d4c6f2.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -83,13 +83,13 @@
83
83
  }
84
84
  },
85
85
  "devDependencies": {
86
- "@genesislcap/foundation-testing": "14.307.2",
87
- "@genesislcap/genx": "14.307.2",
88
- "@genesislcap/rollup-builder": "14.307.2",
89
- "@genesislcap/ts-builder": "14.307.2",
90
- "@genesislcap/uvu-playwright-builder": "14.307.2",
91
- "@genesislcap/vite-builder": "14.307.2",
92
- "@genesislcap/webpack-builder": "14.307.2",
86
+ "@genesislcap/foundation-testing": "14.307.4-alpha-0d4c6f2.0",
87
+ "@genesislcap/genx": "14.307.4-alpha-0d4c6f2.0",
88
+ "@genesislcap/rollup-builder": "14.307.4-alpha-0d4c6f2.0",
89
+ "@genesislcap/ts-builder": "14.307.4-alpha-0d4c6f2.0",
90
+ "@genesislcap/uvu-playwright-builder": "14.307.4-alpha-0d4c6f2.0",
91
+ "@genesislcap/vite-builder": "14.307.4-alpha-0d4c6f2.0",
92
+ "@genesislcap/webpack-builder": "14.307.4-alpha-0d4c6f2.0",
93
93
  "copyfiles": "^2.4.1",
94
94
  "rxjs": "^7.5.4"
95
95
  },
@@ -99,15 +99,15 @@
99
99
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
100
100
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
101
101
  "@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
102
- "@genesislcap/expression-builder": "14.307.2",
103
- "@genesislcap/foundation-comms": "14.307.2",
104
- "@genesislcap/foundation-criteria": "14.307.2",
105
- "@genesislcap/foundation-errors": "14.307.2",
106
- "@genesislcap/foundation-events": "14.307.2",
107
- "@genesislcap/foundation-logger": "14.307.2",
108
- "@genesislcap/foundation-notifications": "14.307.2",
109
- "@genesislcap/foundation-user": "14.307.2",
110
- "@genesislcap/foundation-utils": "14.307.2",
102
+ "@genesislcap/expression-builder": "14.307.4-alpha-0d4c6f2.0",
103
+ "@genesislcap/foundation-comms": "14.307.4-alpha-0d4c6f2.0",
104
+ "@genesislcap/foundation-criteria": "14.307.4-alpha-0d4c6f2.0",
105
+ "@genesislcap/foundation-errors": "14.307.4-alpha-0d4c6f2.0",
106
+ "@genesislcap/foundation-events": "14.307.4-alpha-0d4c6f2.0",
107
+ "@genesislcap/foundation-logger": "14.307.4-alpha-0d4c6f2.0",
108
+ "@genesislcap/foundation-notifications": "14.307.4-alpha-0d4c6f2.0",
109
+ "@genesislcap/foundation-user": "14.307.4-alpha-0d4c6f2.0",
110
+ "@genesislcap/foundation-utils": "14.307.4-alpha-0d4c6f2.0",
111
111
  "@microsoft/fast-colors": "5.3.1",
112
112
  "@microsoft/fast-components": "2.30.6",
113
113
  "@microsoft/fast-element": "1.14.0",
@@ -128,5 +128,5 @@
128
128
  "access": "public"
129
129
  },
130
130
  "customElements": "dist/custom-elements.json",
131
- "gitHead": "a3bfd4199f20640443c512431840c7e8dedc5b4c"
131
+ "gitHead": "ae54a5f20a2e08cc8447cd248cf5703062e0b13a"
132
132
  }