@steelbreeze/landscape
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -1,1 +0,1 @@ | ||
var landscape;(()=>{"use strict";var e={};(()=>{var t=e;function s(e,t,s){const n=t.x.map(((t,n)=>s?l(e,(e=>e[n].length)):1)),c=e.map((e=>s?1:l(e,(e=>e.length))));return o(e,c,((e,s,c,l)=>o(e,n,((e,t,n)=>({...e[Math.floor(e.length*(c+n)/(t*s))]})),t.y[l].map((e=>a(`axis y ${e.key}`,e.value))))),t.x[0].map(((e,s)=>o(t.x,n,(e=>a(`axis x ${e[s].key}`,e[s].value)),t.y[0].map((()=>a("axis xy")))))))}function n(e,t){t.index.forEach(((s,n)=>{e.index.includes(s)||(e.index.push(s),e.source.push(t.source[n]))}))}function o(e,t,s,n){return e.forEach(((e,o)=>{const c=t[o];for(let t=0;t<c;++t)n.push(s(e,c,t,o))})),n}Object.defineProperty(t,"__esModule",{value:!0}),t.merge=t.split=t.table=void 0,t.table=function(e,t,n,o){const c={index:0};return s(e.map((e=>e.map((e=>e.length?function(e,t,s){const n=[];for(const o of e){const e=t(o);let c=n.find((t=>u(t,e)));c||n.push(c=a(e.style,e.text)),c.index.push(s.index++),c.source.push(o)}return n}(e,n,c):[a("empty")])))),t,o)},t.split=s,t.merge=function(e,t,s){let o;c(e,((l,r)=>{c(l,((c,a)=>{s&&r&&(o=e[r-1][a])&&u(o,c)&&o.cols===c.cols?(o.rows+=c.rows,n(o,c),l.splice(a,1)):t&&a&&(o=l[a-1])&&u(o,c)&&o.rows===c.rows&&(o.cols+=c.cols,n(o,c),l.splice(a,1))}))}))};const c=(e,t)=>{for(let s=e.length;s--;)t(e[s],s)},l=(e,t)=>e.map((e=>t(e)||1)).reduce(((e,t)=>e*t/r(e,t))),r=(e,t)=>t?r(t,e%t):e,u=(e,t)=>e.text===t.text&&e.style===t.style,a=(e,t="")=>({text:t,style:e,index:[],source:[],rows:1,cols:1})})(),landscape=e})(); | ||
var landscape;(()=>{"use strict";var e={};(()=>{var t=e;function s(e,t,s){const n=t.x.map(((t,n)=>s?r(e,(e=>e[n].length)):1)),c=e.map((e=>s?1:r(e,(e=>e.length))));return o(e,c,((e,s,c,r)=>o(e,n,((e,t,n)=>({...e[Math.floor(e.length*(c+n)/(t*s))]})),t.y[r].map((e=>i(a(`axis y ${e.key}`,e.value)))))),t.x[0].map(((e,s)=>o(t.x,n,(e=>i(a(`axis x ${e[s].key}`,e[s].value))),t.y[0].map((()=>i(a("axis xy"))))))))}function n(e,t){t.index.forEach(((s,n)=>{e.index.includes(s)||(e.index.push(s),e.source.push(t.source[n]))}))}function o(e,t,s,n){return e.forEach(((e,o)=>{const c=t[o];for(let t=0;t<c;++t)n.push(s(e,c,t,o))})),n}Object.defineProperty(t,"__esModule",{value:!0}),t.merge=t.split=t.table=void 0,t.table=function(e,t,n,o){const c={index:0};return s(e.map((e=>e.map((e=>e.length?function(e,t,s){const n=[];for(const o of e){const e=t(o);let c=n.find((t=>u(t,e)));c||n.push(c=i(e)),c.index.push(s.index++),c.source.push(o)}return n}(e,n,c):[i(a("empty"))])))),t,o)},t.split=s,t.merge=function(e,t,s){let o;c(e,((r,l)=>{c(r,((c,a)=>{s&&l&&(o=e[l-1][a])&&u(o,c)&&o.cols===c.cols?(o.rows+=c.rows,n(o,c),r.splice(a,1)):t&&a&&(o=r[a-1])&&u(o,c)&&o.rows===c.rows&&(o.cols+=c.cols,n(o,c),r.splice(a,1))}))}))};const c=(e,t)=>{for(let s=e.length;s--;)t(e[s],s)},r=(e,t)=>e.map((e=>t(e)||1)).reduce(((e,t)=>e*t/l(e,t))),l=(e,t)=>t?l(t,e%t):e,u=(e,t)=>e.text===t.text&&e.style===t.style,a=(e,t="")=>({text:t,style:e}),i=e=>({...e,index:[],source:[],rows:1,cols:1})})(),landscape=e})(); |
@@ -1,1 +0,1 @@ | ||
var render;(()=>{"use strict";var e={};(()=>{var t=e;function n(e){const t=document.createElement("tr");for(const n of e)t.appendChild(c(n));return t}function c(e){const t=document.createElement(e.style.includes("axis")?"th":"td");t.colSpan=e.cols,t.rowSpan=e.rows,t.className=`cell ${e.style}`;const n=document.createElement("div");return n.appendChild(document.createTextNode(e.text)),t.appendChild(n),t}Object.defineProperty(t,"__esModule",{value:!0}),t.table=void 0,t.table=function(e,t,c){const o=document.createElement("table");o.id=t,o.classList.add(c);for(const t of e)o.appendChild(n(t));return o}})(),render=e})(); | ||
var render;(()=>{"use strict";var e={};(()=>{var t=e;function n(e){const t=document.createElement("tr");for(const n of e)t.appendChild(c(n));return t}function c(e){const t=document.createElement(e.style.includes("axis")?"th":"td");t.colSpan=e.cols,t.rowSpan=e.rows,t.className=`cell ${e.style}`;const n=document.createElement("div");return n.appendChild(document.createTextNode(e.altText||e.text)),t.appendChild(n),t}Object.defineProperty(t,"__esModule",{value:!0}),t.table=void 0,t.table=function(e,t,c){const o=document.createElement("table");o.id=t,o.classList.add(c);for(const t of e)o.appendChild(n(t));return o}})(),render=e})(); |
@@ -14,3 +14,3 @@ "use strict"; | ||
// convert the source data to keys and remove resulting duplicates; create the resultant table | ||
return split(cube.map(row => row.map(table => table.length ? cells(table, getKey, identity) : [cell('empty')])), axes, onX); | ||
return split(cube.map(row => row.map(table => table.length ? cells(table, getKey, identity) : [cell(makeKey('empty'))])), axes, onX); | ||
} | ||
@@ -35,3 +35,3 @@ exports.table = table; | ||
// generate the y axis row header cells | ||
}, axes.y[iY].map(criterion => cell(`axis y ${criterion.key}`, criterion.value))); | ||
}, axes.y[iY].map(criterion => cell(makeKey(`axis y ${criterion.key}`, criterion.value)))); | ||
// generate the x axis column header rows | ||
@@ -42,5 +42,5 @@ }, axes.x[0].map((_, iC) => { | ||
// generate the x axis cells | ||
return cell(`axis x ${x[iC].key}`, x[iC].value); | ||
return cell(makeKey(`axis x ${x[iC].key}`, x[iC].value)); | ||
// generate the x/y header | ||
}, axes.y[0].map(() => cell('axis xy'))); | ||
}, axes.y[0].map(() => cell(makeKey('axis xy')))); | ||
})); | ||
@@ -95,3 +95,3 @@ } | ||
if (!existing) { | ||
result.push(existing = cell(key.style, key.text)); | ||
result.push(existing = cell(key)); | ||
} | ||
@@ -141,5 +141,10 @@ existing.index.push(identity.index++); | ||
/** | ||
* Creates a key within a table. | ||
* @hidden | ||
*/ | ||
const makeKey = (style, text = '') => ({ text, style }); | ||
/** | ||
* Creates a cell within a table. | ||
* @hidden | ||
*/ | ||
const cell = (style, text = '') => ({ text, style, index: [], source: [], rows: 1, cols: 1 }); | ||
const cell = (key) => ({ ...key, index: [], source: [], rows: 1, cols: 1 }); |
@@ -34,5 +34,5 @@ "use strict"; | ||
const divElement = document.createElement('div'); | ||
divElement.appendChild(document.createTextNode(cellData.text)); | ||
divElement.appendChild(document.createTextNode(cellData.altText || cellData.text)); | ||
cellElement.appendChild(divElement); | ||
return cellElement; | ||
} |
@@ -1,1 +0,1 @@ | ||
var landscape;(()=>{"use strict";var e={};(()=>{var t=e;function s(e,t,s){const n=t.x.map(((t,n)=>s?l(e,(e=>e[n].length)):1)),c=e.map((e=>s?1:l(e,(e=>e.length))));return o(e,c,((e,s,c,l)=>o(e,n,((e,t,n)=>({...e[Math.floor(e.length*(c+n)/(t*s))]})),t.y[l].map((e=>a(`axis y ${e.key}`,e.value))))),t.x[0].map(((e,s)=>o(t.x,n,(e=>a(`axis x ${e[s].key}`,e[s].value)),t.y[0].map((()=>a("axis xy")))))))}function n(e,t){t.index.forEach(((s,n)=>{e.index.includes(s)||(e.index.push(s),e.source.push(t.source[n]))}))}function o(e,t,s,n){return e.forEach(((e,o)=>{const c=t[o];for(let t=0;t<c;++t)n.push(s(e,c,t,o))})),n}Object.defineProperty(t,"__esModule",{value:!0}),t.merge=t.split=t.table=void 0,t.table=function(e,t,n,o){const c={index:0};return s(e.map((e=>e.map((e=>e.length?function(e,t,s){const n=[];for(const o of e){const e=t(o);let c=n.find((t=>u(t,e)));c||n.push(c=a(e.style,e.text)),c.index.push(s.index++),c.source.push(o)}return n}(e,n,c):[a("empty")])))),t,o)},t.split=s,t.merge=function(e,t,s){let o;c(e,((l,r)=>{c(l,((c,a)=>{s&&r&&(o=e[r-1][a])&&u(o,c)&&o.cols===c.cols?(o.rows+=c.rows,n(o,c),l.splice(a,1)):t&&a&&(o=l[a-1])&&u(o,c)&&o.rows===c.rows&&(o.cols+=c.cols,n(o,c),l.splice(a,1))}))}))};const c=(e,t)=>{for(let s=e.length;s--;)t(e[s],s)},l=(e,t)=>e.map((e=>t(e)||1)).reduce(((e,t)=>e*t/r(e,t))),r=(e,t)=>t?r(t,e%t):e,u=(e,t)=>e.text===t.text&&e.style===t.style,a=(e,t="")=>({text:t,style:e,index:[],source:[],rows:1,cols:1})})(),landscape=e})(); | ||
var landscape;(()=>{"use strict";var e={};(()=>{var t=e;function s(e,t,s){const n=t.x.map(((t,n)=>s?r(e,(e=>e[n].length)):1)),c=e.map((e=>s?1:r(e,(e=>e.length))));return o(e,c,((e,s,c,r)=>o(e,n,((e,t,n)=>({...e[Math.floor(e.length*(c+n)/(t*s))]})),t.y[r].map((e=>i(a(`axis y ${e.key}`,e.value)))))),t.x[0].map(((e,s)=>o(t.x,n,(e=>i(a(`axis x ${e[s].key}`,e[s].value))),t.y[0].map((()=>i(a("axis xy"))))))))}function n(e,t){t.index.forEach(((s,n)=>{e.index.includes(s)||(e.index.push(s),e.source.push(t.source[n]))}))}function o(e,t,s,n){return e.forEach(((e,o)=>{const c=t[o];for(let t=0;t<c;++t)n.push(s(e,c,t,o))})),n}Object.defineProperty(t,"__esModule",{value:!0}),t.merge=t.split=t.table=void 0,t.table=function(e,t,n,o){const c={index:0};return s(e.map((e=>e.map((e=>e.length?function(e,t,s){const n=[];for(const o of e){const e=t(o);let c=n.find((t=>u(t,e)));c||n.push(c=i(e)),c.index.push(s.index++),c.source.push(o)}return n}(e,n,c):[i(a("empty"))])))),t,o)},t.split=s,t.merge=function(e,t,s){let o;c(e,((r,l)=>{c(r,((c,a)=>{s&&l&&(o=e[l-1][a])&&u(o,c)&&o.cols===c.cols?(o.rows+=c.rows,n(o,c),r.splice(a,1)):t&&a&&(o=r[a-1])&&u(o,c)&&o.rows===c.rows&&(o.cols+=c.cols,n(o,c),r.splice(a,1))}))}))};const c=(e,t)=>{for(let s=e.length;s--;)t(e[s],s)},r=(e,t)=>e.map((e=>t(e)||1)).reduce(((e,t)=>e*t/l(e,t))),l=(e,t)=>t?l(t,e%t):e,u=(e,t)=>e.text===t.text&&e.style===t.style,a=(e,t="")=>({text:t,style:e}),i=e=>({...e,index:[],source:[],rows:1,cols:1})})(),landscape=e})(); |
@@ -1,1 +0,1 @@ | ||
var render;(()=>{"use strict";var e={};(()=>{var t=e;function n(e){const t=document.createElement("tr");for(const n of e)t.appendChild(c(n));return t}function c(e){const t=document.createElement(e.style.includes("axis")?"th":"td");t.colSpan=e.cols,t.rowSpan=e.rows,t.className=`cell ${e.style}`;const n=document.createElement("div");return n.appendChild(document.createTextNode(e.text)),t.appendChild(n),t}Object.defineProperty(t,"__esModule",{value:!0}),t.table=void 0,t.table=function(e,t,c){const o=document.createElement("table");o.id=t,o.classList.add(c);for(const t of e)o.appendChild(n(t));return o}})(),render=e})(); | ||
var render;(()=>{"use strict";var e={};(()=>{var t=e;function n(e){const t=document.createElement("tr");for(const n of e)t.appendChild(c(n));return t}function c(e){const t=document.createElement(e.style.includes("axis")?"th":"td");t.colSpan=e.cols,t.rowSpan=e.rows,t.className=`cell ${e.style}`;const n=document.createElement("div");return n.appendChild(document.createTextNode(e.altText||e.text)),t.appendChild(n),t}Object.defineProperty(t,"__esModule",{value:!0}),t.table=void 0,t.table=function(e,t,c){const o=document.createElement("table");o.id=t,o.classList.add(c);for(const t of e)o.appendChild(n(t));return o}})(),render=e})(); |
{ | ||
"name": "@steelbreeze/landscape", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "Landscape map viewpoint visualisation", | ||
@@ -5,0 +5,0 @@ "main": "lib/node/index.js", |
@@ -38,3 +38,3 @@ import { Axes, Cube, Function, Row, Table } from '@steelbreeze/pivot'; | ||
// convert the source data to keys and remove resulting duplicates; create the resultant table | ||
return split(cube.map(row => row.map(table => table.length ? cells(table, getKey, identity) : <Cell<TRow>[]>[cell('empty')])), axes, onX); | ||
return split(cube.map(row => row.map(table => table.length ? cells(table, getKey, identity) : <Cell<TRow>[]>[cell(makeKey('empty'))])), axes, onX); | ||
} | ||
@@ -63,3 +63,3 @@ | ||
// generate the y axis row header cells | ||
}, axes.y[iY].map(criterion => cell(`axis y ${criterion.key}`, criterion.value))); | ||
}, axes.y[iY].map(criterion => cell(makeKey(`axis y ${criterion.key}`, criterion.value)))); | ||
@@ -73,6 +73,6 @@ // generate the x axis column header rows | ||
// generate the x axis cells | ||
return cell(`axis x ${x[iC].key}`, x[iC].value); | ||
return cell(makeKey(`axis x ${x[iC].key}`, x[iC].value)); | ||
// generate the x/y header | ||
}, axes.y[0].map(() => cell('axis xy'))); | ||
}, axes.y[0].map(() => cell(makeKey('axis xy')))); | ||
})); | ||
@@ -130,3 +130,3 @@ } | ||
if (!existing) { | ||
result.push(existing = cell(key.style, key.text)); | ||
result.push(existing = cell(key)); | ||
} | ||
@@ -189,6 +189,13 @@ | ||
/** | ||
* Creates a key within a table. | ||
* @hidden | ||
*/ | ||
const makeKey = (style: string, text: string = ''): Key => | ||
({ text, style }); | ||
/** | ||
* Creates a cell within a table. | ||
* @hidden | ||
*/ | ||
const cell = <TRow extends Row>(style: string, text: string = ''): Cell<TRow> => | ||
({ text, style, index: [], source: [], rows: 1, cols: 1 }); | ||
const cell = <TRow extends Row>(key: Key): Cell<TRow> => | ||
({ ...key, index: [], source: [], rows: 1, cols: 1 }); |
@@ -33,3 +33,3 @@ import { Row } from '@steelbreeze/pivot'; | ||
// render a cell in a table with a child div | ||
function cell<TRow extends Row>(cellData: Cell<TRow>): HTMLTableCellElement { | ||
function cell(cellData: any): HTMLTableCellElement { | ||
const cellElement = document.createElement(cellData.style.includes('axis') ? 'th' : 'td'); | ||
@@ -41,3 +41,3 @@ cellElement.colSpan = cellData.cols; | ||
const divElement = document.createElement('div'); | ||
divElement.appendChild(document.createTextNode(cellData.text)); | ||
divElement.appendChild(document.createTextNode(cellData.altText || cellData.text)); | ||
@@ -44,0 +44,0 @@ cellElement.appendChild(divElement); |
Sorry, the diff of this file is not supported yet
510365
3825