Updated cards from tuesch changes. Incorporated InteractionMapper memory leak fix.
This commit is contained in:
+49
-4
@@ -15,7 +15,7 @@ export default class ScatterCard extends Card {
|
||||
* @param {*} htmlString
|
||||
* @param {*} basePath
|
||||
* @param {*} [opts={}]
|
||||
* @memberof Card
|
||||
* @memberof ScatterCard
|
||||
*/
|
||||
static setup(context, htmlString, { basePath = './', modules = [] } = {}) {
|
||||
context.classList.add('info-card')
|
||||
@@ -29,7 +29,7 @@ export default class ScatterCard extends Card {
|
||||
/**
|
||||
* Conflicts with the FindTarget method of the Abstract scatter.
|
||||
*/
|
||||
this._replaceAttributes(html, 'onclick', this._replaceCallback)
|
||||
this._replaceAttributes(context, html, 'onclick', this._replaceCallback)
|
||||
|
||||
let content = html.querySelector('.mainview')
|
||||
context.appendChild(content)
|
||||
@@ -51,7 +51,16 @@ export default class ScatterCard extends Card {
|
||||
element.onClose = callback
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the close listener from a card element.
|
||||
*
|
||||
* @static
|
||||
* @param {HTMLElement} element - Context of the Card.
|
||||
* @memberof ScatterCard
|
||||
*/
|
||||
static removeOnCloseListener(element) {
|
||||
element.onClose = null
|
||||
}
|
||||
/**
|
||||
* Creates a scatter for the card and applies the card to it,
|
||||
*
|
||||
@@ -61,7 +70,7 @@ export default class ScatterCard extends Card {
|
||||
* @param {string} [basePath=""]
|
||||
* @param {*} [opts={}]
|
||||
* @returns
|
||||
* @memberof Card
|
||||
* @memberof ScatterCard
|
||||
*/
|
||||
static createCardScatter(html, scatterContainer, { basePath = './', modules = [] } = {}) {
|
||||
let element = document.createElement('div')
|
||||
@@ -79,6 +88,42 @@ export default class ScatterCard extends Card {
|
||||
return element
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes but NOT removes the scatter element.
|
||||
*
|
||||
* The remove must be called separately, it may be used in the close callback
|
||||
* of the scatter.
|
||||
*/
|
||||
static close(context) {
|
||||
|
||||
Card.close(context)
|
||||
|
||||
if (context['scatter']) {
|
||||
console.error('CLOSED CARD')
|
||||
context.scatter.close()
|
||||
} else {
|
||||
console.error('Expected a scatter element to close!', this)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up the card.
|
||||
*
|
||||
* @static
|
||||
* @override
|
||||
* @memberof ScatterCard
|
||||
*/
|
||||
static remove(context) {
|
||||
if (context['scatter']) {
|
||||
context.scatter = null
|
||||
console.error('REMOVED CARD')
|
||||
} else {
|
||||
console.error('Expected a scatter element to remove!', this)
|
||||
}
|
||||
|
||||
Card.remove(context)
|
||||
}
|
||||
|
||||
/**
|
||||
*Utility function to create a fully functional card scatter.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user