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.6 to 1.2.7

5

dist/wp-charts.es.js

@@ -176,3 +176,3 @@ var indicator = "";

} else {
const averageWidth = (this.tableWidth - 70) / (this.dataLength - 1);
const averageWidth = ((this.tableWidth - 70) / (this.dataLength - 1)).toFixed(0);
col.setAttribute("width", averageWidth);

@@ -192,3 +192,4 @@ }

} else {
const averageWidth = (this.tableWidth - 52) / (this.dataLength - 1);
const averageWidth = ((this.tableWidth - 69) / (this.dataLength - 1)).toFixed(0);
console.log(averageWidth);
col.setAttribute("width", averageWidth);

@@ -195,0 +196,0 @@ }

2

dist/wp-charts.umd.js

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

(function(c,g){typeof exports=="object"&&typeof module!="undefined"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(c=typeof globalThis!="undefined"?globalThis:c||self,g(c.wpCharts={}))})(this,function(c){"use strict";var g="";function C(u){const e=/\d{1,3}(?=(\d{3})+$)/g;return(u+"").replace(e,"$&,")}function m(u,e){return"rgba("+parseInt("0x"+u.slice(1,3))+","+parseInt("0x"+u.slice(3,5))+","+parseInt("0x"+u.slice(5,7))+","+e+")"}class w{constructor(e,i){this.dom=e,this.option=i,this.wpIndicator=null,this.labelList=[],this.valueList=[],this.init()}init(){this.wpIndicator=document.createElement("div"),this.wpIndicator.setAttribute("class","wp-indicator");const{data:e,labelColor:i,valueColor:t,labelSize:l,valueSize:n}=this.option;for(let s=0,d=e.length;s<d;s++){const r=document.createElement("div"),h=document.createDocumentFragment(),{label:b,value:a}=e[s],p=document.createElement("div");p.innerHTML=b,p.setAttribute("class","wp-indicator-label"),p.style.cssText=`color: ${i}; font-size: ${l}`,this.labelList.push(p);const o=document.createElement("div");o.innerHTML=C(a),o.setAttribute("class","wp-indicator-value"),o.style.cssText=`color: ${t}; font-size: ${n}`,this.valueList.push(o),h.append(p,o),r.appendChild(h),this.wpIndicator.appendChild(r)}this.dom.appendChild(this.wpIndicator)}changeColor(e,i){e==="label"&&this.labelList.forEach(t=>t.style.cssText=t.style.cssText+`color: ${i}`),e==="value"&&this.valueList.forEach(t=>t.style.cssText=t.style.cssText+`color: ${i}`)}dispose(){this.dom.removeChild(this.wpIndicator)}}var f="";class y{constructor(e,i){this.dom=e;const{themeColor:t,data:l}=i;this.borderColor=t,this.bgColor=m(t,.8),this.data=l.map(n=>[{t:"index"}].concat(n)),this.wpTable=null,this.dataLength=0,this.themeCellList=[],this.getWidthAndHeight(),this.init()}init(){this.wpTable=document.createElement("div"),this.dataLength=this.data[0].length;const e=this.data.slice(0,1);this.initHead(e);const i=this.data.slice(1,this.data.length);this.initBody(i),this.dom.appendChild(this.wpTable);const t=document.querySelector(".wp-table__body");if(t.getBoundingClientRect().height+42<this.tableHeight){const n=document.querySelector(".wp-table__header-th-gutter");n.style.display="none";const s=document.querySelector(".wp-table__header-colgroup").children,d=s.length;s[d-1].setAttribute("width",0),t.setAttribute("style",`width: ${this.tableWidth+"px"}`)}}getWidthAndHeight(){const{width:e,height:i}=this.dom.getBoundingClientRect();this.tableWidth=Number(e.toFixed(0)),this.tableHeight=i}initHead(e){const i=document.createElement("div");i.setAttribute("class","wp-table__header-wrapper");const t=document.createElement("table");t.setAttribute("cellpadding",0),t.setAttribute("cellspacing",0),t.setAttribute("class","wp-table__header"),t.setAttribute("style",`width: ${this.tableWidth}px`);const l=this.initHeadColGroup(),n=document.createElement("thead"),s=document.createElement("tr");for(let r=0;r<this.dataLength;r++){const{v:h,t:b}=e[0][r],a=document.createElement("th");a.setAttribute("align","center"),a.setAttribute("valign","middle"),a.classList.add("wp-table-cell"),a.classList.add("wp-table-theme-cell"),a.innerHTML=b==="index"?"":h,a.style.backgroundColor=this.bgColor,a.style.borderColor=this.borderColor,s.appendChild(a),this.themeCellList.push(a)}const d=document.createElement("th");d.setAttribute("class","wp-table-theme-cell"),d.classList.add("wp-table__header-th-gutter"),d.style.backgroundColor=this.bgColor,s.appendChild(d),this.themeCellList.push(d),n.appendChild(s),t.append(l,n),i.appendChild(t),this.wpTable.appendChild(i)}initBody(e){const i=document.createElement("div");i.style.height=this.tableHeight-42+"px",i.style.overflowY="auto",i.setAttribute("class","wp-table__body-wrapper");const t=document.createElement("table");t.setAttribute("cellpadding",0),t.setAttribute("cellspacing",0),t.setAttribute("class","wp-table__body"),t.setAttribute("style",`width: ${this.tableWidth-17}px`);const l=this.initBodyColGroup(),n=document.createElement("tbody");for(let s=0,d=e.length;s<d;s++){const r=document.createElement("tr");for(let h=0,b=e[s].length;h<b;h++){const{t:a,v:p}=e[s][h],o=document.createElement("td");o.setAttribute("align","center"),o.setAttribute("valign","middle"),o.setAttribute("class","wp-table-cell"),a==="index"&&(o.classList.add("wp-table-theme-cell"),o.style.backgroundColor=this.bgColor,this.themeCellList.push(o)),o.innerHTML=a==="index"?s+1:p,o.style.borderColor=this.borderColor,r.append(o)}n.appendChild(r)}t.append(l,n),i.appendChild(t),this.wpTable.appendChild(i)}initHeadColGroup(){const e=document.createElement("colgroup");e.setAttribute("class","wp-table__header-colgroup");for(let i=0;i<=this.dataLength;i++){const t=document.createElement("col");if(i===0)t.setAttribute("width",52);else if(i===this.dataLength)t.setAttribute("width",17);else{const l=(this.tableWidth-70)/(this.dataLength-1);t.setAttribute("width",l)}e.appendChild(t)}return e}initBodyColGroup(){const e=document.createElement("colgroup");e.setAttribute("class","wp-table__body-colgroup");for(let i=0;i<this.dataLength;i++){const t=document.createElement("col");if(i===0)t.setAttribute("width",52);else{const l=(this.tableWidth-52)/(this.dataLength-1);t.setAttribute("width",l)}e.appendChild(t)}return e}changeColor(e){const i=m(e,.8);this.wpTable.querySelectorAll(".wp-table-cell").forEach(l=>l.style.borderColor=e),this.themeCellList.forEach(l=>l.style.backgroundColor=i),this.wpTable.style.borderColor=e}dispose(){this.dom.removeChild(this.wpTable)}resize(){this.dispose(),this.getWidthAndHeight(),this.init()}}c.CreateIndicator=w,c.CreateTable=y,Object.defineProperty(c,"__esModule",{value:!0}),c[Symbol.toStringTag]="Module"});
(function(c,g){typeof exports=="object"&&typeof module!="undefined"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(c=typeof globalThis!="undefined"?globalThis:c||self,g(c.wpCharts={}))})(this,function(c){"use strict";var g="";function C(u){const e=/\d{1,3}(?=(\d{3})+$)/g;return(u+"").replace(e,"$&,")}function m(u,e){return"rgba("+parseInt("0x"+u.slice(1,3))+","+parseInt("0x"+u.slice(3,5))+","+parseInt("0x"+u.slice(5,7))+","+e+")"}class w{constructor(e,i){this.dom=e,this.option=i,this.wpIndicator=null,this.labelList=[],this.valueList=[],this.init()}init(){this.wpIndicator=document.createElement("div"),this.wpIndicator.setAttribute("class","wp-indicator");const{data:e,labelColor:i,valueColor:t,labelSize:l,valueSize:a}=this.option;for(let s=0,d=e.length;s<d;s++){const r=document.createElement("div"),h=document.createDocumentFragment(),{label:b,value:n}=e[s],p=document.createElement("div");p.innerHTML=b,p.setAttribute("class","wp-indicator-label"),p.style.cssText=`color: ${i}; font-size: ${l}`,this.labelList.push(p);const o=document.createElement("div");o.innerHTML=C(n),o.setAttribute("class","wp-indicator-value"),o.style.cssText=`color: ${t}; font-size: ${a}`,this.valueList.push(o),h.append(p,o),r.appendChild(h),this.wpIndicator.appendChild(r)}this.dom.appendChild(this.wpIndicator)}changeColor(e,i){e==="label"&&this.labelList.forEach(t=>t.style.cssText=t.style.cssText+`color: ${i}`),e==="value"&&this.valueList.forEach(t=>t.style.cssText=t.style.cssText+`color: ${i}`)}dispose(){this.dom.removeChild(this.wpIndicator)}}var f="";class y{constructor(e,i){this.dom=e;const{themeColor:t,data:l}=i;this.borderColor=t,this.bgColor=m(t,.8),this.data=l.map(a=>[{t:"index"}].concat(a)),this.wpTable=null,this.dataLength=0,this.themeCellList=[],this.getWidthAndHeight(),this.init()}init(){this.wpTable=document.createElement("div"),this.dataLength=this.data[0].length;const e=this.data.slice(0,1);this.initHead(e);const i=this.data.slice(1,this.data.length);this.initBody(i),this.dom.appendChild(this.wpTable);const t=document.querySelector(".wp-table__body");if(t.getBoundingClientRect().height+42<this.tableHeight){const a=document.querySelector(".wp-table__header-th-gutter");a.style.display="none";const s=document.querySelector(".wp-table__header-colgroup").children,d=s.length;s[d-1].setAttribute("width",0),t.setAttribute("style",`width: ${this.tableWidth+"px"}`)}}getWidthAndHeight(){const{width:e,height:i}=this.dom.getBoundingClientRect();this.tableWidth=Number(e.toFixed(0)),this.tableHeight=i}initHead(e){const i=document.createElement("div");i.setAttribute("class","wp-table__header-wrapper");const t=document.createElement("table");t.setAttribute("cellpadding",0),t.setAttribute("cellspacing",0),t.setAttribute("class","wp-table__header"),t.setAttribute("style",`width: ${this.tableWidth}px`);const l=this.initHeadColGroup(),a=document.createElement("thead"),s=document.createElement("tr");for(let r=0;r<this.dataLength;r++){const{v:h,t:b}=e[0][r],n=document.createElement("th");n.setAttribute("align","center"),n.setAttribute("valign","middle"),n.classList.add("wp-table-cell"),n.classList.add("wp-table-theme-cell"),n.innerHTML=b==="index"?"":h,n.style.backgroundColor=this.bgColor,n.style.borderColor=this.borderColor,s.appendChild(n),this.themeCellList.push(n)}const d=document.createElement("th");d.setAttribute("class","wp-table-theme-cell"),d.classList.add("wp-table__header-th-gutter"),d.style.backgroundColor=this.bgColor,s.appendChild(d),this.themeCellList.push(d),a.appendChild(s),t.append(l,a),i.appendChild(t),this.wpTable.appendChild(i)}initBody(e){const i=document.createElement("div");i.style.height=this.tableHeight-42+"px",i.style.overflowY="auto",i.setAttribute("class","wp-table__body-wrapper");const t=document.createElement("table");t.setAttribute("cellpadding",0),t.setAttribute("cellspacing",0),t.setAttribute("class","wp-table__body"),t.setAttribute("style",`width: ${this.tableWidth-17}px`);const l=this.initBodyColGroup(),a=document.createElement("tbody");for(let s=0,d=e.length;s<d;s++){const r=document.createElement("tr");for(let h=0,b=e[s].length;h<b;h++){const{t:n,v:p}=e[s][h],o=document.createElement("td");o.setAttribute("align","center"),o.setAttribute("valign","middle"),o.setAttribute("class","wp-table-cell"),n==="index"&&(o.classList.add("wp-table-theme-cell"),o.style.backgroundColor=this.bgColor,this.themeCellList.push(o)),o.innerHTML=n==="index"?s+1:p,o.style.borderColor=this.borderColor,r.append(o)}a.appendChild(r)}t.append(l,a),i.appendChild(t),this.wpTable.appendChild(i)}initHeadColGroup(){const e=document.createElement("colgroup");e.setAttribute("class","wp-table__header-colgroup");for(let i=0;i<=this.dataLength;i++){const t=document.createElement("col");if(i===0)t.setAttribute("width",52);else if(i===this.dataLength)t.setAttribute("width",17);else{const l=((this.tableWidth-70)/(this.dataLength-1)).toFixed(0);t.setAttribute("width",l)}e.appendChild(t)}return e}initBodyColGroup(){const e=document.createElement("colgroup");e.setAttribute("class","wp-table__body-colgroup");for(let i=0;i<this.dataLength;i++){const t=document.createElement("col");if(i===0)t.setAttribute("width",52);else{const l=((this.tableWidth-69)/(this.dataLength-1)).toFixed(0);console.log(l),t.setAttribute("width",l)}e.appendChild(t)}return e}changeColor(e){const i=m(e,.8);this.wpTable.querySelectorAll(".wp-table-cell").forEach(l=>l.style.borderColor=e),this.themeCellList.forEach(l=>l.style.backgroundColor=i),this.wpTable.style.borderColor=e}dispose(){this.dom.removeChild(this.wpTable)}resize(){this.dispose(),this.getWidthAndHeight(),this.init()}}c.CreateIndicator=w,c.CreateTable=y,Object.defineProperty(c,"__esModule",{value:!0}),c[Symbol.toStringTag]="Module"});

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

},
"version": "1.2.6",
"version": "1.2.7",
"scripts": {

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

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