Comparing version 1.5.0 to 2.0.0-alfa.1
@@ -1,1 +0,1 @@ | ||
import React,{useMemo,useCallback}from"react";import{emphasizeStyle}from"emphasizer";var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},NumberUtil=function(){function l(){}return l.toFloat=function(e){var t;return"string"==typeof e?e===(t=parseFloat(e)).toString()?t:void 0:e},l.splitNumber=function(e,t){var r=[];if(void 0!==e){var n=t.decimalDigits,a=t.groupSeparator,i=void 0===a?",":a,a=t.decimalSeparator,t=t.groupDigits,e=e.toFixed(n||0).split(".");if(0<e.length){for(var o=l.toGroups(e[0],t),u=0;u<o.length;u++)r.push({text:o[u],separator:!(0<u)||void 0===i?void 0:i});2!==e.length||(n=e[1])&&r.push({text:n,isFraction:!0,separator:a||"."})}}return r},l.toGroups=function(e,t){return 0===t?[e]:(t=Math.abs(t||3),e.match(new RegExp("(\\d+?)(?=(\\d{".concat(t,"})+(?!\\d)|$)"),"g"))||[])},l}(),rootStyle={display:"inline-block"},defaultContentStyle={display:"flex",flexDirection:"row",alignItems:"flex-end"},numberPartStyle={lineHeight:"1em"},I2Number=function(e){var t=e.fromStyle,r=e.toStyle,n=e.decimalDigits,a=e.verticalAlign,i=e.className,o=e.style,u=e.groupSeparator,l=e.decimalSeparator,s=e.groupDigits,c=e.value,m=e.basicMaxValue,f=e.children,p=useMemo(function(){return{decimalDigits:n,decimalSeparator:l,groupSeparator:u,groupDigits:s}},[n,l,u,s]),g=useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(f||c),p)},[f,c,p]),d=useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(m),p)},[m,p]),y=useMemo(function(){return __assign({fontSize:"1em"},t)},[t]),v=useMemo(function(){return __assign({fontSize:"2em"},r)},[r]),e=useMemo(function(){var e=__assign({},defaultContentStyle);return"top"===a?e.alignItems="flex-start":"center"===a&&(e.alignItems="center"),e},[a]);return React.createElement("div",{className:i,style:__assign(__assign({},rootStyle),o)},React.createElement("div",{style:e},g.map(function(e,t){var r=e.text,e=e.separator,n=d.length;return React.createElement("div",{key:t,style:__assign(__assign({},emphasizeStyle(y,v,1,n,g.length-t)),numberPartStyle)},"".concat(e||"").concat(r))})))},TagUtil=function(){function e(){}return e.order=function(e,t,r){var n,a,i;return"desc"===t||"middle"===t?(a=e.sort(function(e,t){return r(e)>r(t)?-1:r(e)<r(t)?1:0}),"middle"===t&&(n=[],a.forEach(function(e,t){t%2==0?n.push(e):n.unshift(e)}),a=n),a):"asc"===t||"edge"===t?(a=e.sort(function(e,t){return r(e)<r(t)?-1:r(e)>r(t)?1:0}),"edge"===t&&(i=[],a.forEach(function(e,t){t%2==0?i.push(e):i.unshift(e)}),a=i),a):e},e}(),TagCloud=function(e){var t=e.data,n=e.fromStyle,a=e.toStyle,r=e.order,i=void 0===r?"middle":r,r=e.className,o=e.style,u=e.render,e=e.valueDataIndex,l=void 0===e?"value":e,s=useCallback(function(e){return NumberUtil.toFloat(e[l])||0},[l]),e=useMemo(function(){var e=t.map(function(e){return s(e)});return[Math.min.apply(Math,e),Math.max.apply(Math,e)]},[t,s]),c=e[0],m=e[1],e=useMemo(function(){return TagUtil.order(t,i,s)},[t,i,s]),f=useMemo(function(){return __assign({display:"flex",flexWrap:"wrap",justifyItems:"center",alignItems:"center",justifyContent:"center",alignContent:"center"},o)},[o]);return React.createElement("div",{className:r,style:f},e.map(function(e,t){var r=emphasizeStyle(n,a,c,m,e.rate);return React.createElement(React.Fragment,{key:t},u?u(r,e,t):React.createElement("div",{style:r},e.text))}))};export{I2Number,TagCloud}; | ||
import React,{useMemo,useCallback}from"react";import{emphasizeStyle}from"emphasizer";var __assign=function(){return(__assign=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)},NumberUtil=function(){function c(){}return c.toFloat=function(t){var e;return"string"==typeof t?t===(e=parseFloat(t)).toString()?e:void 0:t},c.splitNumber=function(t,e){var r=[];if(void 0!==t){var i=e.decimalDigits,n=e.groupSeparator,o=void 0===n?",":n,n=e.decimalSeparator,e=e.groupDigits,t=t.toFixed(i||0).split(".");if(0<t.length){for(var a=c.toGroups(t[0],e),s=0;s<a.length;s++)r.push({text:a[s],separator:!(0<s)||void 0===o?void 0:o});2!==t.length||(i=t[1])&&r.push({text:i,isFraction:!0,separator:n||"."})}}return r},c.toGroups=function(t,e){return 0===e?[t]:(e=Math.abs(e||3),t.match(new RegExp("(\\d+?)(?=(\\d{".concat(e,"})+(?!\\d)|$)"),"g"))||[])},c}(),rootStyle={display:"inline-block"},defaultContentStyle={display:"flex",flexDirection:"row",alignItems:"flex-end"},numberPartStyle={lineHeight:"1em"},I2Number=function(t){var e=t.fromStyle,r=t.toStyle,i=t.decimalDigits,n=t.verticalAlign,o=t.className,a=t.style,s=t.groupSeparator,c=t.decimalSeparator,u=t.groupDigits,l=t.value,d=t.basicMaxValue,h=t.children,f=useMemo(function(){return{decimalDigits:i,decimalSeparator:c,groupSeparator:s,groupDigits:u}},[i,c,s,u]),p=useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(h||l),f)},[h,l,f]),g=useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(d),f)},[d,f]),m=useMemo(function(){return __assign({fontSize:"1em"},e)},[e]),_=useMemo(function(){return __assign({fontSize:"2em"},r)},[r]),t=useMemo(function(){var t=__assign({},defaultContentStyle);return"top"===n?t.alignItems="flex-start":"center"===n&&(t.alignItems="center"),t},[n]);return React.createElement("div",{className:o,style:__assign(__assign({},rootStyle),a)},React.createElement("div",{style:t},p.map(function(t,e){var r=t.text,t=t.separator,i=g.length;return React.createElement("div",{key:e,style:__assign(__assign({},emphasizeStyle(m,_,1,i,p.length-e)),numberPartStyle)},"".concat(t||"").concat(r))})))},TagUtil=function(){function t(){}return t.order=function(t,e,r){var i,n,o;return"desc"===e||"middle"===e?(n=t.sort(function(t,e){return r(t)>r(e)?-1:r(t)<r(e)?1:0}),"middle"===e&&(i=[],n.forEach(function(t,e){e%2==0?i.push(t):i.unshift(t)}),n=i),n):"asc"===e||"edge"===e?(n=t.sort(function(t,e){return r(t)<r(e)?-1:r(t)>r(e)?1:0}),"edge"===e&&(o=[],n.forEach(function(t,e){e%2==0?o.push(t):o.unshift(t)}),n=o),n):t},t}(),TagCloud=function(t){var e=t.data,i=t.fromStyle,n=t.toStyle,r=t.order,o=void 0===r?"middle":r,r=t.className,a=t.style,s=t.render,t=t.valueDataIndex,c=void 0===t?"value":t,u=useCallback(function(t){return NumberUtil.toFloat(t[c])||0},[c]),t=useMemo(function(){var t=e.map(function(t){return u(t)});return[Math.min.apply(Math,t),Math.max.apply(Math,t)]},[e,u]),l=t[0],d=t[1],t=useMemo(function(){return TagUtil.order(e,o,u)},[e,o,u]),h=useMemo(function(){return __assign({display:"flex",flexWrap:"wrap",justifyItems:"center",alignItems:"center",justifyContent:"center",alignContent:"center"},a)},[a]);return React.createElement("div",{className:r,style:h},t.map(function(t,e){var r=emphasizeStyle(i,n,l,d,t.rate);return React.createElement(React.Fragment,{key:e},s?s(r,t,e):React.createElement("div",{style:r},t.text))}))},GridRectUtil=function(){function t(){}return t.rect=function(t,e,r,i){return{left:t,top:e,width:r,height:i}},t.split=function(t,e,r){var i=t.width-t.left,n=t.height-t.top,o=i<=n,e=Math.floor(e/(e+r)*(o?n:i));return o?(r=t.top+e,[__assign(__assign({},t),{height:r}),__assign(__assign({},t),{top:r})]):(n=t.left+e,[__assign(__assign({},t),{width:n}),__assign(__assign({},t),{left:n})])},t.square=function(t){return(t.width-t.left)*(t.height-t.top)},t}(),SPLIT_RATIO=.5,TreemapManager=function(){function t(){this._count=0,this._data=[],this._cols=0,this._rows=0,this._cards=[],this._valueDataIndex="",this.rootNode={rate:0,rootRate:0,rootSquare:0,rect:{top:0,left:0,width:100,height:100},record:void 0,children:[]}}return Object.defineProperty(t.prototype,"cards",{get:function(){return this._cards},enumerable:!1,configurable:!0}),t.prototype.init=function(t,e,r,i){void 0===i&&(i="rate"),this._count=0,this._cols=t,this._rows=e,this._data=r,this._valueDataIndex=i,this.refresh()},t.prototype.getRecordRate=function(t){t=t[this._valueDataIndex];if("number"==typeof t)return t;if("string"==typeof t){var e=parseFloat(t);if(e.toString()===t.toString())return e}return 0},t.prototype.refresh=function(){var r=this,t=this._data.map(function(t){return __assign({},t)}).sort(function(t,e){return r.getRecordRate(e)-r.getRecordRate(t)}),e={top:0,left:0,width:this._rows,height:this._cols},i=t.reduce(function(t,e){return t+r.getRecordRate(e)},0);this.rootNode=this.initNode(t,e,i,this._cols*this._rows),this._cards=[],this.initCard(this.rootNode,this._cards)},t.prototype.initNode=function(t,e,r,i){var n=this,o=(this._count++,t.reduce(function(t,e){return t+n.getRecordRate(e)},0)),a=[],s=void 0;if(1===t.length&&(s=t[0]),2===t.length){var c=t[0],u=t[1],l=GridRectUtil.split(e,this.getRecordRate(c),this.getRecordRate(u)),d=l[0],l=l[1];a.push({rate:this.getRecordRate(c),rootRate:r,rootSquare:i,rect:d,record:c,children:[]}),a.push({rate:this.getRecordRate(u),rootRate:r,rootSquare:i,rect:l,record:u,children:[]})}else if(2<t.length){for(var h=0,f=0,p=0,g=t;p<g.length;p++){var m=g[p];if(f++,h+=this.getRecordRate(m),o*SPLIT_RATIO<=h)break}c=GridRectUtil.split(e,h,o-h),d=c[0],l=c[1];a.push(this.initNode(t.slice(0,f),d,r,i)),a.push(this.initNode(t.slice(f),l,r,i))}return{rate:o,rootRate:r,rootSquare:i,rect:e,record:s,children:a}},t.prototype.initCard=function(t,e){var r=this;t.record&&e.push({record:t.record,rect:t.rect}),t.children.forEach(function(t){r.initCard(t,e)})},t}(),Treemap=function(t){var e=t.className,r=t.rows,i=void 0===r?100:r,r=t.cols,n=void 0===r?100:r,o=t.gap,r=t.valueDataIndex,a=void 0===r?"value":r,s=t.render,c=t.data,r=useMemo(function(){return{display:"grid",gridTemplateColumns:"repeat(".concat(n,", 1fr)"),gridTemplateRows:"repeat(".concat(i,", 1fr)"),gap:o}},[i,n,o]),t=useMemo(function(){var t=new TreemapManager;return t.init(i,n,c,a),t.cards},[i,n,c,a]);return React.createElement("div",{style:r,className:e},t.map(function(t,e){var r=t.rect,t=t.record,i=r.left,n=r.top,o=r.width,r=r.height,a={gridColumn:"".concat(i+1," / ").concat(o+1),gridRow:"".concat(n+1," / ").concat(r+1)};return s(a,t,e,{left:i,top:n,width:o,height:r,rootRate:0,rootSquare:0})}))};export{I2Number,TagCloud,Treemap}; |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),emphasizer=require("emphasizer"),__assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},NumberUtil=function(){function l(){}return l.toFloat=function(e){var t;return"string"==typeof e?e===(t=parseFloat(e)).toString()?t:void 0:e},l.splitNumber=function(e,t){var r=[];if(void 0!==e){var a=t.decimalDigits,n=t.groupSeparator,i=void 0===n?",":n,n=t.decimalSeparator,t=t.groupDigits,e=e.toFixed(a||0).split(".");if(0<e.length){for(var o=l.toGroups(e[0],t),u=0;u<o.length;u++)r.push({text:o[u],separator:!(0<u)||void 0===i?void 0:i});2!==e.length||(a=e[1])&&r.push({text:a,isFraction:!0,separator:n||"."})}}return r},l.toGroups=function(e,t){return 0===t?[e]:(t=Math.abs(t||3),e.match(new RegExp("(\\d+?)(?=(\\d{".concat(t,"})+(?!\\d)|$)"),"g"))||[])},l}(),rootStyle={display:"inline-block"},defaultContentStyle={display:"flex",flexDirection:"row",alignItems:"flex-end"},numberPartStyle={lineHeight:"1em"},I2Number=function(e){var t=e.fromStyle,r=e.toStyle,a=e.decimalDigits,n=e.verticalAlign,i=e.className,o=e.style,u=e.groupSeparator,l=e.decimalSeparator,s=e.groupDigits,c=e.value,f=e.basicMaxValue,m=e.children,d=React.useMemo(function(){return{decimalDigits:a,decimalSeparator:l,groupSeparator:u,groupDigits:s}},[a,l,u,s]),p=React.useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(m||c),d)},[m,c,d]),g=React.useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(f),d)},[f,d]),_=React.useMemo(function(){return __assign({fontSize:"1em"},t)},[t]),y=React.useMemo(function(){return __assign({fontSize:"2em"},r)},[r]),e=React.useMemo(function(){var e=__assign({},defaultContentStyle);return"top"===n?e.alignItems="flex-start":"center"===n&&(e.alignItems="center"),e},[n]);return React__default.createElement("div",{className:i,style:__assign(__assign({},rootStyle),o)},React__default.createElement("div",{style:e},p.map(function(e,t){var r=e.text,e=e.separator,a=g.length;return React__default.createElement("div",{key:t,style:__assign(__assign({},emphasizer.emphasizeStyle(_,y,1,a,p.length-t)),numberPartStyle)},"".concat(e||"").concat(r))})))},TagUtil=function(){function e(){}return e.order=function(e,t,r){var a,n,i;return"desc"===t||"middle"===t?(n=e.sort(function(e,t){return r(e)>r(t)?-1:r(e)<r(t)?1:0}),"middle"===t&&(a=[],n.forEach(function(e,t){t%2==0?a.push(e):a.unshift(e)}),n=a),n):"asc"===t||"edge"===t?(n=e.sort(function(e,t){return r(e)<r(t)?-1:r(e)>r(t)?1:0}),"edge"===t&&(i=[],n.forEach(function(e,t){t%2==0?i.push(e):i.unshift(e)}),n=i),n):e},e}(),TagCloud=function(e){var t=e.data,a=e.fromStyle,n=e.toStyle,r=e.order,i=void 0===r?"middle":r,r=e.className,o=e.style,u=e.render,e=e.valueDataIndex,l=void 0===e?"value":e,s=React.useCallback(function(e){return NumberUtil.toFloat(e[l])||0},[l]),e=React.useMemo(function(){var e=t.map(function(e){return s(e)});return[Math.min.apply(Math,e),Math.max.apply(Math,e)]},[t,s]),c=e[0],f=e[1],e=React.useMemo(function(){return TagUtil.order(t,i,s)},[t,i,s]),m=React.useMemo(function(){return __assign({display:"flex",flexWrap:"wrap",justifyItems:"center",alignItems:"center",justifyContent:"center",alignContent:"center"},o)},[o]);return React__default.createElement("div",{className:r,style:m},e.map(function(e,t){var r=emphasizer.emphasizeStyle(a,n,c,f,e.rate);return React__default.createElement(React__default.Fragment,{key:t},u?u(r,e,t):React__default.createElement("div",{style:r},e.text))}))};exports.I2Number=I2Number,exports.TagCloud=TagCloud; | ||
"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),emphasizer=require("emphasizer"),__assign=function(){return(__assign=Object.assign||function(t){for(var e,r=1,a=arguments.length;r<a;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},NumberUtil=function(){function c(){}return c.toFloat=function(t){var e;return"string"==typeof t?t===(e=parseFloat(t)).toString()?e:void 0:t},c.splitNumber=function(t,e){var r=[];if(void 0!==t){var a=e.decimalDigits,i=e.groupSeparator,n=void 0===i?",":i,i=e.decimalSeparator,e=e.groupDigits,t=t.toFixed(a||0).split(".");if(0<t.length){for(var o=c.toGroups(t[0],e),s=0;s<o.length;s++)r.push({text:o[s],separator:!(0<s)||void 0===n?void 0:n});2!==t.length||(a=t[1])&&r.push({text:a,isFraction:!0,separator:i||"."})}}return r},c.toGroups=function(t,e){return 0===e?[t]:(e=Math.abs(e||3),t.match(new RegExp("(\\d+?)(?=(\\d{".concat(e,"})+(?!\\d)|$)"),"g"))||[])},c}(),rootStyle={display:"inline-block"},defaultContentStyle={display:"flex",flexDirection:"row",alignItems:"flex-end"},numberPartStyle={lineHeight:"1em"},I2Number=function(t){var e=t.fromStyle,r=t.toStyle,a=t.decimalDigits,i=t.verticalAlign,n=t.className,o=t.style,s=t.groupSeparator,c=t.decimalSeparator,u=t.groupDigits,l=t.value,d=t.basicMaxValue,f=t.children,h=React.useMemo(function(){return{decimalDigits:a,decimalSeparator:c,groupSeparator:s,groupDigits:u}},[a,c,s,u]),p=React.useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(f||l),h)},[f,l,h]),g=React.useMemo(function(){return NumberUtil.splitNumber(NumberUtil.toFloat(d),h)},[d,h]),m=React.useMemo(function(){return __assign({fontSize:"1em"},e)},[e]),_=React.useMemo(function(){return __assign({fontSize:"2em"},r)},[r]),t=React.useMemo(function(){var t=__assign({},defaultContentStyle);return"top"===i?t.alignItems="flex-start":"center"===i&&(t.alignItems="center"),t},[i]);return React__default.createElement("div",{className:n,style:__assign(__assign({},rootStyle),o)},React__default.createElement("div",{style:t},p.map(function(t,e){var r=t.text,t=t.separator,a=g.length;return React__default.createElement("div",{key:e,style:__assign(__assign({},emphasizer.emphasizeStyle(m,_,1,a,p.length-e)),numberPartStyle)},"".concat(t||"").concat(r))})))},TagUtil=function(){function t(){}return t.order=function(t,e,r){var a,i,n;return"desc"===e||"middle"===e?(i=t.sort(function(t,e){return r(t)>r(e)?-1:r(t)<r(e)?1:0}),"middle"===e&&(a=[],i.forEach(function(t,e){e%2==0?a.push(t):a.unshift(t)}),i=a),i):"asc"===e||"edge"===e?(i=t.sort(function(t,e){return r(t)<r(e)?-1:r(t)>r(e)?1:0}),"edge"===e&&(n=[],i.forEach(function(t,e){e%2==0?n.push(t):n.unshift(t)}),i=n),i):t},t}(),TagCloud=function(t){var e=t.data,a=t.fromStyle,i=t.toStyle,r=t.order,n=void 0===r?"middle":r,r=t.className,o=t.style,s=t.render,t=t.valueDataIndex,c=void 0===t?"value":t,u=React.useCallback(function(t){return NumberUtil.toFloat(t[c])||0},[c]),t=React.useMemo(function(){var t=e.map(function(t){return u(t)});return[Math.min.apply(Math,t),Math.max.apply(Math,t)]},[e,u]),l=t[0],d=t[1],t=React.useMemo(function(){return TagUtil.order(e,n,u)},[e,n,u]),f=React.useMemo(function(){return __assign({display:"flex",flexWrap:"wrap",justifyItems:"center",alignItems:"center",justifyContent:"center",alignContent:"center"},o)},[o]);return React__default.createElement("div",{className:r,style:f},t.map(function(t,e){var r=emphasizer.emphasizeStyle(a,i,l,d,t.rate);return React__default.createElement(React__default.Fragment,{key:e},s?s(r,t,e):React__default.createElement("div",{style:r},t.text))}))},GridRectUtil=function(){function t(){}return t.rect=function(t,e,r,a){return{left:t,top:e,width:r,height:a}},t.split=function(t,e,r){var a=t.width-t.left,i=t.height-t.top,n=a<=i,e=Math.floor(e/(e+r)*(n?i:a));return n?(r=t.top+e,[__assign(__assign({},t),{height:r}),__assign(__assign({},t),{top:r})]):(i=t.left+e,[__assign(__assign({},t),{width:i}),__assign(__assign({},t),{left:i})])},t.square=function(t){return(t.width-t.left)*(t.height-t.top)},t}(),SPLIT_RATIO=.5,TreemapManager=function(){function t(){this._count=0,this._data=[],this._cols=0,this._rows=0,this._cards=[],this._valueDataIndex="",this.rootNode={rate:0,rootRate:0,rootSquare:0,rect:{top:0,left:0,width:100,height:100},record:void 0,children:[]}}return Object.defineProperty(t.prototype,"cards",{get:function(){return this._cards},enumerable:!1,configurable:!0}),t.prototype.init=function(t,e,r,a){void 0===a&&(a="rate"),this._count=0,this._cols=t,this._rows=e,this._data=r,this._valueDataIndex=a,this.refresh()},t.prototype.getRecordRate=function(t){t=t[this._valueDataIndex];if("number"==typeof t)return t;if("string"==typeof t){var e=parseFloat(t);if(e.toString()===t.toString())return e}return 0},t.prototype.refresh=function(){var r=this,t=this._data.map(function(t){return __assign({},t)}).sort(function(t,e){return r.getRecordRate(e)-r.getRecordRate(t)}),e={top:0,left:0,width:this._rows,height:this._cols},a=t.reduce(function(t,e){return t+r.getRecordRate(e)},0);this.rootNode=this.initNode(t,e,a,this._cols*this._rows),this._cards=[],this.initCard(this.rootNode,this._cards)},t.prototype.initNode=function(t,e,r,a){var i=this,n=(this._count++,t.reduce(function(t,e){return t+i.getRecordRate(e)},0)),o=[],s=void 0;if(1===t.length&&(s=t[0]),2===t.length){var c=t[0],u=t[1],l=GridRectUtil.split(e,this.getRecordRate(c),this.getRecordRate(u)),d=l[0],l=l[1];o.push({rate:this.getRecordRate(c),rootRate:r,rootSquare:a,rect:d,record:c,children:[]}),o.push({rate:this.getRecordRate(u),rootRate:r,rootSquare:a,rect:l,record:u,children:[]})}else if(2<t.length){for(var f=0,h=0,p=0,g=t;p<g.length;p++){var m=g[p];if(h++,f+=this.getRecordRate(m),n*SPLIT_RATIO<=f)break}c=GridRectUtil.split(e,f,n-f),d=c[0],l=c[1];o.push(this.initNode(t.slice(0,h),d,r,a)),o.push(this.initNode(t.slice(h),l,r,a))}return{rate:n,rootRate:r,rootSquare:a,rect:e,record:s,children:o}},t.prototype.initCard=function(t,e){var r=this;t.record&&e.push({record:t.record,rect:t.rect}),t.children.forEach(function(t){r.initCard(t,e)})},t}(),Treemap=function(t){var e=t.className,r=t.rows,a=void 0===r?100:r,r=t.cols,i=void 0===r?100:r,n=t.gap,r=t.valueDataIndex,o=void 0===r?"value":r,s=t.render,c=t.data,r=React.useMemo(function(){return{display:"grid",gridTemplateColumns:"repeat(".concat(i,", 1fr)"),gridTemplateRows:"repeat(".concat(a,", 1fr)"),gap:n}},[a,i,n]),t=React.useMemo(function(){var t=new TreemapManager;return t.init(a,i,c,o),t.cards},[a,i,c,o]);return React__default.createElement("div",{style:r,className:e},t.map(function(t,e){var r=t.rect,t=t.record,a=r.left,i=r.top,n=r.width,r=r.height,o={gridColumn:"".concat(a+1," / ").concat(n+1),gridRow:"".concat(i+1," / ").concat(r+1)};return s(o,t,e,{left:a,top:i,width:n,height:r,rootRate:0,rootSquare:0})}))};exports.I2Number=I2Number,exports.TagCloud=TagCloud,exports.Treemap=Treemap; |
{ | ||
"name": "i2ui", | ||
"version": "1.5.0", | ||
"version": "2.0.0-alfa.1", | ||
"description": "i2ui - Intuitively Understantable User Interface", | ||
@@ -15,2 +15,3 @@ "main": "dist/index.js", | ||
"concurrently": "^4.1.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^7.32.0", | ||
@@ -52,2 +53,3 @@ "eslint-config-prettier": "^8.8.0", | ||
"build": "rollup -c", | ||
"build:dev": "cross-env BUILD=dev rollup -c", | ||
"build-watch": "rollup -c -w", | ||
@@ -54,0 +56,0 @@ "install-all": "npm i && cd example && npm i", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28103
17
170
36
2
1