Socket
Socket
Sign inDemoInstall

wp-charts

Package Overview
Dependencies
Maintainers
1
Versions
296
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wp-charts - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

33

dist/wp-charts.es.js

@@ -14,2 +14,3 @@ var indicator = "";

this.option = option;
this.wpIndicator = null;
this.labelList = [];

@@ -20,4 +21,4 @@ this.valueList = [];

init() {
const wpIndicator = document.createElement("div");
wpIndicator.setAttribute("class", "wp-indicator");
this.wpIndicator = document.createElement("div");
this.wpIndicator.setAttribute("class", "wp-indicator");
const { data, labelColor, valueColor, labelSize, valueSize } = this.option;

@@ -40,5 +41,5 @@ for (let i = 0, len = data.length; i < len; i++) {

indicator2.appendChild(fragment);
wpIndicator.appendChild(indicator2);
this.wpIndicator.appendChild(indicator2);
}
this.dom.appendChild(wpIndicator);
this.dom.appendChild(this.wpIndicator);
}

@@ -53,2 +54,5 @@ changeColor(type, color) {

}
dispose() {
this.dom.removeChild(this.wpIndicator);
}
}

@@ -65,3 +69,3 @@ var table = "";

});
this.table = null;
this.wpTable = null;
this.themeTdList = [];

@@ -71,3 +75,3 @@ this.init();

init() {
this.table = document.createElement("table");
this.wpTable = document.createElement("table");
const tbody = document.createElement("tbody");

@@ -106,16 +110,19 @@ const fragment = document.createDocumentFragment();

colgroup.appendChild(col);
this.table.setAttribute("cellspacing", 0);
this.table.style.borderColor = this.borderColor;
this.table.classList.add("wp-table");
this.table.append(colgroup, tbody);
this.dom.appendChild(this.table);
this.wpTable.setAttribute("cellspacing", 0);
this.wpTable.style.borderColor = this.borderColor;
this.wpTable.classList.add("wp-table");
this.wpTable.append(colgroup, tbody);
this.dom.appendChild(this.wpTable);
}
changeColor(color) {
const bgColor = hex2Rgba(color, 0.8);
const tdList = this.table.querySelectorAll("td");
const tdList = this.wpTable.querySelectorAll("td");
tdList.forEach((td) => td.style.borderColor = color);
this.themeTdList.forEach((td) => td.style.backgroundColor = bgColor);
this.table.style.borderColor = color;
this.wpTable.style.borderColor = color;
}
dispose() {
this.dom.removeChild(this.wpTable);
}
}
export { CreateIndicator, CreateTable };

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

(function(a,u){typeof exports=="object"&&typeof module!="undefined"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(a=typeof globalThis!="undefined"?globalThis:a||self,u(a.wpCharts={}))})(this,function(a){"use strict";var u="";function g(r){const t=/\d{1,3}(?=(\d{3})+$)/g;return(r+"").replace(t,"$&,")}function f(r,t){return"rgba("+parseInt("0x"+r.slice(1,3))+","+parseInt("0x"+r.slice(3,5))+","+parseInt("0x"+r.slice(5,7))+","+t+")"}class y{constructor(t,s){this.dom=t,this.option=s,this.labelList=[],this.valueList=[],this.init()}init(){const t=document.createElement("div");t.setAttribute("class","wp-indicator");const{data:s,labelColor:n,valueColor:o,labelSize:i,valueSize:p}=this.option;for(let c=0,b=s.length;c<b;c++){const h=document.createElement("div"),d=document.createDocumentFragment(),{label:m,value:C}=s[c],l=document.createElement("div");l.innerHTML=m,l.setAttribute("class","wp-indicator-label"),l.style.cssText=`color: ${n}; font-size: ${i}`,this.labelList.push(l);const e=document.createElement("div");e.innerHTML=g(C),e.setAttribute("class","wp-indicator-value"),e.style.cssText=`color: ${o}; font-size: ${p}`,this.valueList.push(e),d.append(l,e),h.appendChild(d),t.appendChild(h)}this.dom.appendChild(t)}changeColor(t,s){t==="label"&&this.labelList.forEach(n=>n.style.cssText=n.style.cssText+`color: ${s}`),t==="value"&&this.valueList.forEach(n=>n.style.cssText=n.style.cssText+`color: ${s}`)}}var L="";class v{constructor(t,s){const{themeColor:n,data:o}=s;this.dom=t,this.borderColor=n,this.bgColor=f(n,.8),this.data=o.map(i=>[{t:"index"}].concat(i)),this.table=null,this.themeTdList=[],this.init()}init(){this.table=document.createElement("table");const t=document.createElement("tbody"),s=document.createDocumentFragment();for(let i=0,p=this.data.length;i<p;i++){const c=document.createDocumentFragment(),b=this.data[i],h=document.createElement("tr");for(let d=0,m=b.length;d<m;d++){const{v:C,t:l}=b[d],e=document.createElement("td");e.setAttribute("align","center"),e.setAttribute("valign","middle"),e.style.borderColor=this.borderColor,e.setAttribute("class","wp-table-td"),(l==="index"||i===0)&&(e.classList.add("wp-table-td-theme"),e.style.backgroundColor=this.bgColor,this.themeTdList.push(e)),l==="index"&&e.classList.add("wp-table-td-index"),e.innerHTML=l==="index"?i>0?i:"":C,c.append(e)}h.appendChild(c),s.appendChild(h)}t.appendChild(s);const n=document.createElement("colgroup"),o=document.createElement("col");o.setAttribute("name","wp-table-td-index"),o.setAttribute("style","width: 52px"),n.appendChild(o),this.table.setAttribute("cellspacing",0),this.table.style.borderColor=this.borderColor,this.table.classList.add("wp-table"),this.table.append(n,t),this.dom.appendChild(this.table)}changeColor(t){const s=f(t,.8);this.table.querySelectorAll("td").forEach(o=>o.style.borderColor=t),this.themeTdList.forEach(o=>o.style.backgroundColor=s),this.table.style.borderColor=t}}a.CreateIndicator=y,a.CreateTable=v,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
(function(a,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(a=typeof globalThis!="undefined"?globalThis:a||self,b(a.wpCharts={}))})(this,function(a){"use strict";var b="";function g(r){const t=/\d{1,3}(?=(\d{3})+$)/g;return(r+"").replace(t,"$&,")}function f(r,t){return"rgba("+parseInt("0x"+r.slice(1,3))+","+parseInt("0x"+r.slice(3,5))+","+parseInt("0x"+r.slice(5,7))+","+t+")"}class T{constructor(t,e){this.dom=t,this.option=e,this.wpIndicator=null,this.labelList=[],this.valueList=[],this.init()}init(){this.wpIndicator=document.createElement("div"),this.wpIndicator.setAttribute("class","wp-indicator");const{data:t,labelColor:e,valueColor:s,labelSize:i,valueSize:o}=this.option;for(let c=0,m=t.length;c<m;c++){const h=document.createElement("div"),p=document.createDocumentFragment(),{label:u,value:C}=t[c],d=document.createElement("div");d.innerHTML=u,d.setAttribute("class","wp-indicator-label"),d.style.cssText=`color: ${e}; font-size: ${i}`,this.labelList.push(d);const l=document.createElement("div");l.innerHTML=g(C),l.setAttribute("class","wp-indicator-value"),l.style.cssText=`color: ${s}; font-size: ${o}`,this.valueList.push(l),p.append(d,l),h.appendChild(p),this.wpIndicator.appendChild(h)}this.dom.appendChild(this.wpIndicator)}changeColor(t,e){t==="label"&&this.labelList.forEach(s=>s.style.cssText=s.style.cssText+`color: ${e}`),t==="value"&&this.valueList.forEach(s=>s.style.cssText=s.style.cssText+`color: ${e}`)}dispose(){this.dom.removeChild(this.wpIndicator)}}var v="";class w{constructor(t,e){const{themeColor:s,data:i}=e;this.dom=t,this.borderColor=s,this.bgColor=f(s,.8),this.data=i.map(o=>[{t:"index"}].concat(o)),this.wpTable=null,this.themeTdList=[],this.init()}init(){this.wpTable=document.createElement("table");const t=document.createElement("tbody"),e=document.createDocumentFragment();for(let o=0,c=this.data.length;o<c;o++){const m=document.createDocumentFragment(),h=this.data[o],p=document.createElement("tr");for(let u=0,C=h.length;u<C;u++){const{v:d,t:l}=h[u],n=document.createElement("td");n.setAttribute("align","center"),n.setAttribute("valign","middle"),n.style.borderColor=this.borderColor,n.setAttribute("class","wp-table-td"),(l==="index"||o===0)&&(n.classList.add("wp-table-td-theme"),n.style.backgroundColor=this.bgColor,this.themeTdList.push(n)),l==="index"&&n.classList.add("wp-table-td-index"),n.innerHTML=l==="index"?o>0?o:"":d,m.append(n)}p.appendChild(m),e.appendChild(p)}t.appendChild(e);const s=document.createElement("colgroup"),i=document.createElement("col");i.setAttribute("name","wp-table-td-index"),i.setAttribute("style","width: 52px"),s.appendChild(i),this.wpTable.setAttribute("cellspacing",0),this.wpTable.style.borderColor=this.borderColor,this.wpTable.classList.add("wp-table"),this.wpTable.append(s,t),this.dom.appendChild(this.wpTable)}changeColor(t){const e=f(t,.8);this.wpTable.querySelectorAll("td").forEach(i=>i.style.borderColor=t),this.themeTdList.forEach(i=>i.style.backgroundColor=e),this.wpTable.style.borderColor=t}dispose(){this.dom.removeChild(this.wpTable)}}a.CreateIndicator=T,a.CreateTable=w,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});

@@ -14,3 +14,3 @@ {

},
"version": "1.2.2",
"version": "1.2.3",
"scripts": {

@@ -17,0 +17,0 @@ "dev": "vite",

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