@adaptabletools/adaptable 11.2.0-canary.0 → 11.2.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.
- package/bundle.cjs.js +5 -5
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/Api/EventApi.d.ts +13 -0
- package/src/Api/Implementation/EventApiImpl.js +1 -0
- package/src/Utilities/Emitter.js +5 -0
- package/src/View/Components/Popups/AdaptableToaster.js +11 -2
- package/src/metamodel/adaptable.metamodel.js +6 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "11.2.0
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1652269439987;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
package/src/Api/EventApi.d.ts
CHANGED
|
@@ -205,12 +205,25 @@ export interface EventApi {
|
|
|
205
205
|
* ```
|
|
206
206
|
*/
|
|
207
207
|
on(eventName: 'AdaptableReady', callback: (adaptableReadyInfo: AdaptableReadyInfo) => void): VoidFunction;
|
|
208
|
+
/**
|
|
209
|
+
* Fired when Adaptable is destroyed
|
|
210
|
+
* @param eventName - AdaptableDestroy
|
|
211
|
+
* @param callback - A callback for listening to `AdaptableDestroy`
|
|
212
|
+
* @returns the unsubscribe function
|
|
213
|
+
*
|
|
214
|
+
* @example Use as
|
|
215
|
+
* ```
|
|
216
|
+
* adaptableApi.eventApi.on('AdaptableDestroy', () => { .....[do stuff]...})
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
on(eventName: 'AdaptableDestroy', callback: () => void): VoidFunction;
|
|
208
220
|
/**
|
|
209
221
|
* Unsubscribe from AdaptableReady
|
|
210
222
|
*/
|
|
211
223
|
off(eventName: 'AdaptableReady', callback: (adaptableReadyInfo: AdaptableReadyInfo) => void): void;
|
|
212
224
|
emitSync(eventName: 'DashboardChanged', data?: any): any[];
|
|
213
225
|
emitSync(eventName: 'FlashingCellDisplayed', data?: any): any[];
|
|
226
|
+
emitSync(eventName: 'AdaptableDestroy'): any[];
|
|
214
227
|
emit(eventName: 'AdaptableReady' | 'AlertFired' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'AdaptableStateChanged' | 'DashboardChanged' | 'CellChanged' | 'GridDataChanged' | 'LayoutChanged' | 'LiveDataChanged' | 'SearchChanged' | 'SelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'FDC3MessageSent', data?: any): Promise<any>;
|
|
215
228
|
destroy(): void;
|
|
216
229
|
}
|
package/src/Utilities/Emitter.js
CHANGED
|
@@ -18,6 +18,11 @@ function assertListener(listener) {
|
|
|
18
18
|
}
|
|
19
19
|
function getListeners(instance, eventName) {
|
|
20
20
|
const events = eventsMap.get(instance);
|
|
21
|
+
if (!events) {
|
|
22
|
+
// we're hitting this case only when calling `off` after the instance has been destroyed (so extremely rarely)
|
|
23
|
+
// so we want to return an empty set in order not to make the code throw an error
|
|
24
|
+
return new Set();
|
|
25
|
+
}
|
|
21
26
|
if (!events.has(eventName)) {
|
|
22
27
|
events.set(eventName, new Set());
|
|
23
28
|
}
|
|
@@ -7,10 +7,19 @@ const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/Obje
|
|
|
7
7
|
const AdaptablePopupAlert_1 = require("./AdaptablePopupAlert");
|
|
8
8
|
const react_toastify_1 = require("react-toastify");
|
|
9
9
|
exports.showToast = (props) => {
|
|
10
|
+
// we're doing this hack and not simply using props.api in order not to have a memory
|
|
11
|
+
// leak where the api is still kept around in memory by the toaster
|
|
12
|
+
let api = props.api;
|
|
13
|
+
const off = api.eventApi.on('AdaptableDestroy', () => {
|
|
14
|
+
api = null;
|
|
15
|
+
});
|
|
10
16
|
const toastProps = ObjectFactory_1.default.CreateToastOptions(props.api.internalApi.getAdaptableOptions().notificationsOptions, {
|
|
11
17
|
onClose: () => {
|
|
12
|
-
if (
|
|
13
|
-
|
|
18
|
+
if (api) {
|
|
19
|
+
off();
|
|
20
|
+
if (!api.isDestroyed()) {
|
|
21
|
+
api.internalApi.hidePopupAlert();
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
},
|
|
16
25
|
});
|
|
@@ -5195,6 +5195,12 @@ exports.ADAPTABLE_METAMODEL = {
|
|
|
5195
5195
|
"description": "Fired when Adaptable is up and running - has no arguments.",
|
|
5196
5196
|
"uiLabel": "On"
|
|
5197
5197
|
},
|
|
5198
|
+
{
|
|
5199
|
+
"name": "on",
|
|
5200
|
+
"kind": "function",
|
|
5201
|
+
"description": "Fired when Adaptable is destroyed",
|
|
5202
|
+
"uiLabel": "On"
|
|
5203
|
+
},
|
|
5198
5204
|
{
|
|
5199
5205
|
"name": "on",
|
|
5200
5206
|
"kind": "function",
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "11.2.0
|
|
1
|
+
declare const _default: "11.2.0";
|
|
2
2
|
export default _default;
|
package/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = '11.2.0
|
|
3
|
+
exports.default = '11.2.0'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
|