wp-charts
Advanced tools
Comparing version 1.1.14 to 1.1.15
@@ -54,6 +54,9 @@ var indicator = ""; | ||
}); | ||
this.table = null; | ||
this.themeTdList = []; | ||
this.init(); | ||
} | ||
init() { | ||
const table2 = document.createElement("table"); | ||
this.table = document.createElement("table"); | ||
const tbody = document.createElement("tbody"); | ||
const fragment = document.createDocumentFragment(); | ||
@@ -69,3 +72,3 @@ for (let i = 0, len = this.data.length; i < len; i++) { | ||
td.setAttribute("valign", "middle"); | ||
td.style.borderColor = "#3b56aa"; | ||
td.style.borderColor = "#536fc5"; | ||
td.setAttribute("class", "wp-table-td"); | ||
@@ -75,2 +78,3 @@ if (t === "index" || i === 0) { | ||
td.style.backgroundColor = "#536fc5"; | ||
this.themeTdList.push(td); | ||
} | ||
@@ -86,9 +90,21 @@ if (t === "index") { | ||
} | ||
table2.style.borderColor = "#3b56aa"; | ||
table2.classList.add("wp-table"); | ||
table2.setAttribute("cellspacing", 0); | ||
table2.appendChild(fragment); | ||
this.dom.appendChild(table2); | ||
tbody.appendChild(fragment); | ||
const colgroup = document.createElement("colgroup"); | ||
const col = document.createElement("col"); | ||
col.setAttribute("name", "wp-table-td-index"); | ||
col.setAttribute("style", "width: 52px"); | ||
colgroup.appendChild(col); | ||
this.table.setAttribute("cellspacing", 0); | ||
this.table.style.borderColor = "#3b56aa"; | ||
this.table.classList.add("wp-table"); | ||
this.table.append(colgroup, tbody); | ||
this.dom.appendChild(this.table); | ||
} | ||
changeColor(color) { | ||
const tdList = this.table.querySelectorAll("td"); | ||
tdList.forEach((td) => td.style.borderColor = color); | ||
this.themeTdList.forEach((td) => td.style.backgroundColor = color); | ||
this.table.style.borderColor = color; | ||
} | ||
} | ||
export { CreateIndicator, CreateTable }; |
@@ -1,1 +0,1 @@ | ||
(function(i,d){typeof exports=="object"&&typeof module!="undefined"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(i=typeof globalThis!="undefined"?globalThis:i||self,d(i.wpCharts={}))})(this,function(i){"use strict";var d="";function g(b){const t=/\d{1,3}(?=(\d{3})+$)/g;return(b+"").replace(t,"$&,")}class v{constructor(t,n){this.dom=t,this.option=n,this.labelList=[],this.valueList=[],this.init()}init(){const t=document.createElement("div");t.setAttribute("class","wp-indicator");const{data:n,labelColor:e,valueColor:f,labelSize:u,valueSize:p}=this.option;for(let s=0,l=n.length;s<l;s++){const h=document.createElement("div"),m=document.createDocumentFragment(),{label:o,value:a}=n[s],c=document.createElement("div");c.innerHTML=o,c.setAttribute("class","wp-indicator-label"),c.style.cssText=`color: ${e}; font-size: ${u}`,this.labelList.push(c);const r=document.createElement("div");r.innerHTML=g(a),r.setAttribute("class","wp-indicator-value"),r.style.cssText=`color: ${f}; font-size: ${p}`,this.valueList.push(r),m.append(c,r),h.appendChild(m),t.appendChild(h)}this.dom.appendChild(t)}changeColor(t,n){t==="label"&&this.labelList.forEach(e=>e.style.cssText=e.style.cssText+`color: ${n}`),t==="value"&&this.valueList.forEach(e=>e.style.cssText=e.style.cssText+`color: ${n}`)}}var T="";class C{constructor(t,n){this.dom=t,this.data=n.map(e=>[{t:"index"}].concat(e)),this.init()}init(){const t=document.createElement("table"),n=document.createDocumentFragment();for(let e=0,f=this.data.length;e<f;e++){const u=document.createDocumentFragment(),p=this.data[e],s=document.createElement("tr");for(let l=0,h=p.length;l<h;l++){const{v:m,t:o}=p[l],a=document.createElement("td");a.setAttribute("align","center"),a.setAttribute("valign","middle"),a.style.borderColor="#3b56aa",a.setAttribute("class","wp-table-td"),(o==="index"||e===0)&&(a.classList.add("wp-table-td-theme"),a.style.backgroundColor="#536fc5"),o==="index"&&a.classList.add("wp-table-td-index"),a.innerHTML=o==="index"?e>0?e:"":m,u.append(a)}s.appendChild(u),n.appendChild(s)}t.style.borderColor="#3b56aa",t.classList.add("wp-table"),t.setAttribute("cellspacing",0),t.appendChild(n),this.dom.appendChild(t)}}i.CreateIndicator=v,i.CreateTable=C,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"}); | ||
(function(l,u){typeof exports=="object"&&typeof module!="undefined"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis!="undefined"?globalThis:l||self,u(l.wpCharts={}))})(this,function(l){"use strict";var u="";function C(b){const t=/\d{1,3}(?=(\d{3})+$)/g;return(b+"").replace(t,"$&,")}class g{constructor(t,n){this.dom=t,this.option=n,this.labelList=[],this.valueList=[],this.init()}init(){const t=document.createElement("div");t.setAttribute("class","wp-indicator");const{data:n,labelColor:e,valueColor:d,labelSize:a,valueSize:p}=this.option;for(let o=0,h=n.length;o<h;o++){const r=document.createElement("div"),c=document.createDocumentFragment(),{label:m,value:f}=n[o],i=document.createElement("div");i.innerHTML=m,i.setAttribute("class","wp-indicator-label"),i.style.cssText=`color: ${e}; font-size: ${a}`,this.labelList.push(i);const s=document.createElement("div");s.innerHTML=C(f),s.setAttribute("class","wp-indicator-value"),s.style.cssText=`color: ${d}; font-size: ${p}`,this.valueList.push(s),c.append(i,s),r.appendChild(c),t.appendChild(r)}this.dom.appendChild(t)}changeColor(t,n){t==="label"&&this.labelList.forEach(e=>e.style.cssText=e.style.cssText+`color: ${n}`),t==="value"&&this.valueList.forEach(e=>e.style.cssText=e.style.cssText+`color: ${n}`)}}var v="";class y{constructor(t,n){this.dom=t,this.data=n.map(e=>[{t:"index"}].concat(e)),this.table=null,this.themeTdList=[],this.init()}init(){this.table=document.createElement("table");const t=document.createElement("tbody"),n=document.createDocumentFragment();for(let a=0,p=this.data.length;a<p;a++){const o=document.createDocumentFragment(),h=this.data[a],r=document.createElement("tr");for(let c=0,m=h.length;c<m;c++){const{v:f,t:i}=h[c],s=document.createElement("td");s.setAttribute("align","center"),s.setAttribute("valign","middle"),s.style.borderColor="#536fc5",s.setAttribute("class","wp-table-td"),(i==="index"||a===0)&&(s.classList.add("wp-table-td-theme"),s.style.backgroundColor="#536fc5",this.themeTdList.push(s)),i==="index"&&s.classList.add("wp-table-td-index"),s.innerHTML=i==="index"?a>0?a:"":f,o.append(s)}r.appendChild(o),n.appendChild(r)}t.appendChild(n);const e=document.createElement("colgroup"),d=document.createElement("col");d.setAttribute("name","wp-table-td-index"),d.setAttribute("style","width: 52px"),e.appendChild(d),this.table.setAttribute("cellspacing",0),this.table.style.borderColor="#3b56aa",this.table.classList.add("wp-table"),this.table.append(e,t),this.dom.appendChild(this.table)}changeColor(t){this.table.querySelectorAll("td").forEach(e=>e.style.borderColor=t),this.themeTdList.forEach(e=>e.style.backgroundColor=t),this.table.style.borderColor=t}}l.CreateIndicator=g,l.CreateTable=y,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"}); |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "1.1.14", | ||
"version": "1.1.15", | ||
"scripts": { | ||
@@ -17,0 +17,0 @@ "dev": "vite", |
Sorry, the diff of this file is not supported yet
7677
119