New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@flourish/info-popup

Package Overview
Dependencies
Maintainers
22
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flourish/info-popup - npm Package Compare versions

Comparing version 3.2.1 to 3.3.0

2

package.json
{
"name": "@flourish/info-popup",
"version": "3.2.1",
"version": "3.3.0",
"description": "Popup with data insertion",

@@ -5,0 +5,0 @@ "main": "info-popup.js",

@@ -15,3 +15,3 @@ # Flourish Info Popup

```
``` js
var state = {

@@ -24,3 +24,3 @@ my_popup: {} // Add any properties to this object to override the default settings

```
``` js
import InfoPopup from "@flourish/info-popup";

@@ -136,3 +136,3 @@

```
``` js
import InfoPopup from "@flourish/info-popup";

@@ -170,3 +170,3 @@ import data from "./data";

```
``` js
import { popup } from "./popup";

@@ -201,3 +201,3 @@

```
``` js
import { updateChart } from "./update-chart";

@@ -204,0 +204,0 @@

@@ -0,1 +1,4 @@

# 3.3.0
* Don't show popup or panel when empty
# 3.2.1

@@ -2,0 +5,0 @@ * Change default vertical position

@@ -88,16 +88,27 @@ function getDefaultHTML(instance, d, mode) {

function getCustomHTML(instance, content_header, content_main, d) {
function getCustomHTML(instance, content_header_raw, content_main_raw, d) {
var content = "";
if (content_header) content += "<header>" + content_header + "</header>";
if (content_main) content += "<main>" + content_main + "</main>";
// TODO. Add handlebars proper to extend this to support else statements and nested conditions
var condition_content = content.replace(/\{\{#if ((?:[^}]|\}[^}])*)\}\}(.*)\{\{\/if\}\}/g, function(_, target_col_name, if_contents) {
return getValueFromColumnName(instance, target_col_name, d) == "" ? "" : if_contents;
});
var content_header_parsed = getParsedContent(content_header_raw, instance, d);
var content_main_parsed = getParsedContent(content_main_raw, instance, d);
return condition_content.replace(/\{\{((?:[^}]|\}[^}])*)\}\}/g, function(_, target_col_name) {
return getValueFromColumnName(instance, target_col_name, d);
});
if (content_header_parsed) content += "<header>" + content_header_parsed + "</header>";
if (content_main_parsed) content += "<main>" + content_main_parsed + "</main>";
return content;
}
function getParsedContent(content_raw, instance, d) {
var condition_regex = /\{\{#if ((?:[^}]|\}[^}])*)\}\}(.*)\{\{\/if\}\}/g;
var variable_regex = /\{\{((?:[^}]|\}[^}])*)\}\}/g;
return content_raw
.replace(condition_regex, function (_, target_col_name, if_contents) {
return getValueFromColumnName(instance, target_col_name, d) == "" ? "" : if_contents;
})
.replace(variable_regex, function (_, target_col_name) {
return getValueFromColumnName(instance, target_col_name, d);
});
}
export function getPopupHTML(instance, d, teaser) {

@@ -104,0 +115,0 @@ var html = "";

@@ -73,2 +73,5 @@ import Popup from "@flourish/popup";

InfoPopup.prototype.click = function(coords_or_node, d, id, callback) {
var target = this._state.mode == "popup" ? "popup" : "panel";
if (this._checkIfPopupIsEmpty(d, target)) return;
// TODO: Check if popup content is empty
this._point(coords_or_node);

@@ -80,3 +83,3 @@ if (id != undefined) {

else this._state.locked_id = null;
if (this._state.mode == "both" || this._state.mode == "panel") {
if (target == "panel") {
clearTimeout(this._show_default_content_timer);

@@ -86,3 +89,3 @@ this.popup.hide();

}
else if (this._state.mode == "popup") {
else if (target == "popup") {
this.panel.hide();

@@ -113,2 +116,4 @@ this._drawPopup(d, callback);

InfoPopup.prototype.mouseover = function(coords_or_node, d, callback, touch, touch_id) {
var target = this._state.mode == "popup" ? "popup" : "panel";
if (this._checkIfPopupIsEmpty(d, target, this._state.mode == "both")) return;
var instance = this;

@@ -187,2 +192,7 @@ if (this._state.mode == "both") {

InfoPopup.prototype._checkIfPopupIsEmpty = function (d, target, teaser) {
var popup_content = target == "panel" ? getPanelHTML(this, d) : getPopupHTML(this, d, teaser);
return popup_content.trim() == "";
};
// =================== //

@@ -189,0 +199,0 @@ // DRAW & HIDE METHODS //

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc