@fluid-topics/ft-chart 1.0.35 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/ft-chart.js CHANGED
@@ -155,6 +155,9 @@ let FtChart = class FtChart extends FtLitElement {
155
155
  }
156
156
  getData(valueIndex) {
157
157
  return this.data.map(v => {
158
+ if (this.isThisPeriod(moment.unix(v[0]), this.period)) {
159
+ return { value: [v[0], v[valueIndex + 1]], itemStyle: { opacity: 0.5 } };
160
+ }
158
161
  return { value: [v[0], v[valueIndex + 1]] };
159
162
  });
160
163
  }
@@ -13,4 +13,4 @@ u.version="2.29.4",r=jn,u.fn=Wi,u.min=function(){return In("isBefore",[].slice.c
13
13
  }
14
14
  `;var ve=function(t,n,i,e){for(var r,s=arguments.length,u=s<3?n:null===e?e=Object.getOwnPropertyDescriptor(n,i):e,o=t.length-1;o>=0;o--)(r=t[o])&&(u=(s<3?r(u):s>3?r(n,i,u):r(n,i))||u);return s>3&&u&&Object.defineProperty(n,i,u),u};null==window.echarts&&console.warn("Echarts is not available"),t.FtChart=class extends n.FtLitElement{constructor(){super(...arguments),this.xAxisName="date",this.yAxisName="",this.valueLabels=void 0,this.valueLabelsSingular=void 0,this.barChart=!1,this.period=t.Period.DAY,this.data=[]}render(){return i.html`
15
15
  <div class="sessions-chart"></div>
16
- `}firstUpdated(t){var n;super.firstUpdated(t),this.myChart=null===(n=window.echarts)||void 0===n?void 0:n.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const n=this.getOptions();n&&this.myChart&&this.myChart.setOption(n)}getOptions(){const n=this;return{tooltip:{trigger:"axis",formatter:t=>n.getTooltip(t)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:i=>n.period===t.Period.DAY||n.period===t.Period.WEEK?u.utc(1e3*i).format("DD MMM YYYY"):(n.period,t.Period.MONTH,u.utc(1e3*i).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(n){const i=u.utc(1e3*n[0].data.value[0]),e=n.map((t=>t.data.value[1]));let r,s,o="";switch(this.period){case t.Period.DAY:r=i.format("DD MMM YYYY"),s="on",this.isThisPeriod(i,t.Period.DAY)&&(o=" so far");break;case t.Period.WEEK:r=i.format("DD MMM YYYY"),s="during the week of",this.isThisPeriod(i,t.Period.WEEK)&&(o=" so far");break;case t.Period.MONTH:s="in",r=i.format("MMMM YYYY"),this.isThisPeriod(i,t.Period.MONTH)&&(o=" so far")}let h="";for(let t=0;t<e.length;t++){let n=this.valueLabels?this.valueLabels[t]:this.yAxisName,i=this.valueLabelsSingular?this.valueLabelsSingular[t]:n;const u=1===e[t]?i:n;h+=`${e[t].toLocaleString()} ${u} ${s} ${r}${o}</br>`}return h.substring(0,h.length-5)}isThisPeriod(n,i,e=u.utc()){switch(i){case t.Period.DAY:return n.format("YYYY-MM-DD")===e.clone().startOf("day").format("YYYY-MM-DD");case t.Period.WEEK:return n.clone().startOf("isoWeek").format("YYYY-MM-DD")===e.clone().startOf("isoWeek").format("YYYY-MM-DD");case t.Period.MONTH:return n.month()===e.month()&&n.year()===e.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let n=[];for(let i=0;i<t;i++)n[i]={type:this.barChart?"bar":"line",data:this.getData(i)};return n}getData(t){return this.data.map((n=>({value:[n[0],n[t+1]]})))}},t.FtChart.styles=me,ve([e.property({type:String})],t.FtChart.prototype,"xAxisName",void 0),ve([e.property({type:String})],t.FtChart.prototype,"yAxisName",void 0),ve([n.jsonProperty(void 0)],t.FtChart.prototype,"valueLabels",void 0),ve([n.jsonProperty(void 0)],t.FtChart.prototype,"valueLabelsSingular",void 0),ve([e.property({type:Boolean})],t.FtChart.prototype,"barChart",void 0),ve([e.property({type:String})],t.FtChart.prototype,"period",void 0),ve([n.jsonProperty([])],t.FtChart.prototype,"data",void 0),ve([e.query(".sessions-chart")],t.FtChart.prototype,"container",void 0),t.FtChart=ve([n.customElement("ft-chart")],t.FtChart),n.customElement("ft-chart")(t.FtChart),t.styles=me}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
16
+ `}firstUpdated(t){var n;super.firstUpdated(t),this.myChart=null===(n=window.echarts)||void 0===n?void 0:n.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const n=this.getOptions();n&&this.myChart&&this.myChart.setOption(n)}getOptions(){const n=this;return{tooltip:{trigger:"axis",formatter:t=>n.getTooltip(t)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:i=>n.period===t.Period.DAY||n.period===t.Period.WEEK?u.utc(1e3*i).format("DD MMM YYYY"):(n.period,t.Period.MONTH,u.utc(1e3*i).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(n){const i=u.utc(1e3*n[0].data.value[0]),e=n.map((t=>t.data.value[1]));let r,s,o="";switch(this.period){case t.Period.DAY:r=i.format("DD MMM YYYY"),s="on",this.isThisPeriod(i,t.Period.DAY)&&(o=" so far");break;case t.Period.WEEK:r=i.format("DD MMM YYYY"),s="during the week of",this.isThisPeriod(i,t.Period.WEEK)&&(o=" so far");break;case t.Period.MONTH:s="in",r=i.format("MMMM YYYY"),this.isThisPeriod(i,t.Period.MONTH)&&(o=" so far")}let h="";for(let t=0;t<e.length;t++){let n=this.valueLabels?this.valueLabels[t]:this.yAxisName,i=this.valueLabelsSingular?this.valueLabelsSingular[t]:n;const u=1===e[t]?i:n;h+=`${e[t].toLocaleString()} ${u} ${s} ${r}${o}</br>`}return h.substring(0,h.length-5)}isThisPeriod(n,i,e=u.utc()){switch(i){case t.Period.DAY:return n.format("YYYY-MM-DD")===e.clone().startOf("day").format("YYYY-MM-DD");case t.Period.WEEK:return n.clone().startOf("isoWeek").format("YYYY-MM-DD")===e.clone().startOf("isoWeek").format("YYYY-MM-DD");case t.Period.MONTH:return n.month()===e.month()&&n.year()===e.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let n=[];for(let i=0;i<t;i++)n[i]={type:this.barChart?"bar":"line",data:this.getData(i)};return n}getData(t){return this.data.map((n=>this.isThisPeriod(u.unix(n[0]),this.period)?{value:[n[0],n[t+1]],itemStyle:{opacity:.5}}:{value:[n[0],n[t+1]]}))}},t.FtChart.styles=me,ve([e.property({type:String})],t.FtChart.prototype,"xAxisName",void 0),ve([e.property({type:String})],t.FtChart.prototype,"yAxisName",void 0),ve([n.jsonProperty(void 0)],t.FtChart.prototype,"valueLabels",void 0),ve([n.jsonProperty(void 0)],t.FtChart.prototype,"valueLabelsSingular",void 0),ve([e.property({type:Boolean})],t.FtChart.prototype,"barChart",void 0),ve([e.property({type:String})],t.FtChart.prototype,"period",void 0),ve([n.jsonProperty([])],t.FtChart.prototype,"data",void 0),ve([e.query(".sessions-chart")],t.FtChart.prototype,"container",void 0),t.FtChart=ve([n.customElement("ft-chart")],t.FtChart),n.customElement("ft-chart")(t.FtChart),t.styles=me}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
@@ -53,30 +53,30 @@ var D;N.finalized=!0,N.elementProperties=new Map,N.elementStyles=[],N.shadowRoot
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
54
  */
55
55
  var ht,ct;class lt extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const n=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=n.firstChild),n}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,n)=>{var e,r;const s=null!==(e=null==n?void 0:n.renderBefore)&&void 0!==e?e:i;let o=s._$litPart$;if(void 0===o){const t=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:null;s._$litPart$=o=new it(i.insertBefore(A(),t),t,void 0,null!=n?n:{})}return o._$AI(t),o})(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return z}}lt.finalized=!0,lt._$litElement$=!0,null===(ht=globalThis.litElementHydrateSupport)||void 0===ht||ht.call(globalThis,{LitElement:lt});const dt=globalThis.litElementPolyfillSupport;null==dt||dt({LitElement:lt}),(null!==(ct=globalThis.litElementVersions)&&void 0!==ct?ct:globalThis.litElementVersions=[]).push("3.3.2");class ft{static create(t,i,n){let e=t=>f(null!=t?t:n),r=v`var(${f(t)}, ${e(n)})`;return r.name=t,r.category=i,r.defaultValue=n,r.defaultCssValue=e,r.get=i=>v`var(${f(t)}, ${e(i)})`,r.breadcrumb=()=>[],r.lastResortDefaultValue=()=>n,r}static extend(t,i,n){let e=t=>i.get(null!=t?t:n),r=v`var(${f(t)}, ${e(n)})`;return r.name=t,r.category=i.category,r.fallbackVariable=i,r.defaultValue=n,r.defaultCssValue=e,r.get=i=>v`var(${f(t)}, ${e(i)})`,r.breadcrumb=()=>[i.name,...i.breadcrumb()],r.lastResortDefaultValue=()=>n,r}static external(t,i){let n=i=>t.fallbackVariable?t.fallbackVariable.get(null!=i?i:t.defaultValue):f(null!=i?i:t.defaultValue),e=v`var(${f(t.name)}, ${n(t.defaultValue)})`;return e.name=t.name,e.category=t.category,e.fallbackVariable=t.fallbackVariable,e.defaultValue=t.defaultValue,e.context=i,e.defaultCssValue=n,e.get=i=>v`var(${f(t.name)}, ${n(i)})`,e.breadcrumb=()=>t.fallbackVariable?[t.fallbackVariable.name,...t.fallbackVariable.breadcrumb()]:[],e.lastResortDefaultValue=()=>{var i,n;return null!==(i=t.defaultValue)&&void 0!==i?i:null===(n=t.fallbackVariable)||void 0===n?void 0:n.lastResortDefaultValue()},e}}ft.create("--ft-color-primary","COLOR","#2196F3"),ft.create("--ft-color-primary-variant","COLOR","#1976D2"),ft.create("--ft-color-secondary","COLOR","#FFCC80"),ft.create("--ft-color-secondary-variant","COLOR","#F57C00"),ft.create("--ft-color-surface","COLOR","#FFFFFF"),ft.create("--ft-color-content","COLOR","rgba(0, 0, 0, 0.87)"),ft.create("--ft-color-error","COLOR","#B00020"),ft.create("--ft-color-outline","COLOR","rgba(0, 0, 0, 0.14)"),ft.create("--ft-color-opacity-high","NUMBER","1"),ft.create("--ft-color-opacity-medium","NUMBER","0.74"),ft.create("--ft-color-opacity-disabled","NUMBER","0.38"),ft.create("--ft-color-on-primary","COLOR","#FFFFFF"),ft.create("--ft-color-on-primary-high","COLOR","#FFFFFF"),ft.create("--ft-color-on-primary-medium","COLOR","rgba(255, 255, 255, 0.74)"),ft.create("--ft-color-on-primary-disabled","COLOR","rgba(255, 255, 255, 0.38)"),ft.create("--ft-color-on-secondary","COLOR","#FFFFFF"),ft.create("--ft-color-on-secondary-high","COLOR","#FFFFFF"),ft.create("--ft-color-on-secondary-medium","COLOR","rgba(255, 255, 255, 0.74)"),ft.create("--ft-color-on-secondary-disabled","COLOR","rgba(255, 255, 255, 0.38)"),ft.create("--ft-color-on-surface","COLOR","rgba(0, 0, 0, 0.87)"),ft.create("--ft-color-on-surface-high","COLOR","rgba(0, 0, 0, 0.87)"),ft.create("--ft-color-on-surface-medium","COLOR","rgba(0, 0, 0, 0.60)"),ft.create("--ft-color-on-surface-disabled","COLOR","rgba(0, 0, 0, 0.38)"),ft.create("--ft-opacity-content-on-surface-disabled","NUMBER","0"),ft.create("--ft-opacity-content-on-surface-enable","NUMBER","0"),ft.create("--ft-opacity-content-on-surface-hover","NUMBER","0.04"),ft.create("--ft-opacity-content-on-surface-focused","NUMBER","0.12"),ft.create("--ft-opacity-content-on-surface-pressed","NUMBER","0.10"),ft.create("--ft-opacity-content-on-surface-selected","NUMBER","0.08"),ft.create("--ft-opacity-content-on-surface-dragged","NUMBER","0.08"),ft.create("--ft-opacity-primary-on-surface-disabled","NUMBER","0"),ft.create("--ft-opacity-primary-on-surface-enable","NUMBER","0"),ft.create("--ft-opacity-primary-on-surface-hover","NUMBER","0.04"),ft.create("--ft-opacity-primary-on-surface-focused","NUMBER","0.12"),ft.create("--ft-opacity-primary-on-surface-pressed","NUMBER","0.10"),ft.create("--ft-opacity-primary-on-surface-selected","NUMBER","0.08"),ft.create("--ft-opacity-primary-on-surface-dragged","NUMBER","0.08"),ft.create("--ft-opacity-surface-on-primary-disabled","NUMBER","0"),ft.create("--ft-opacity-surface-on-primary-enable","NUMBER","0"),ft.create("--ft-opacity-surface-on-primary-hover","NUMBER","0.04"),ft.create("--ft-opacity-surface-on-primary-focused","NUMBER","0.12"),ft.create("--ft-opacity-surface-on-primary-pressed","NUMBER","0.10"),ft.create("--ft-opacity-surface-on-primary-selected","NUMBER","0.08"),ft.create("--ft-opacity-surface-on-primary-dragged","NUMBER","0.08"),ft.create("--ft-elevation-00","UNKNOWN","0px 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px 0px rgba(0, 0, 0, 0), 0px 0px 0px 0px rgba(0, 0, 0, 0)"),ft.create("--ft-elevation-01","UNKNOWN","0px 1px 4px 0px rgba(0, 0, 0, 0.06), 0px 1px 2px 0px rgba(0, 0, 0, 0.14), 0px 0px 1px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-02","UNKNOWN","0px 4px 10px 0px rgba(0, 0, 0, 0.06), 0px 2px 5px 0px rgba(0, 0, 0, 0.14), 0px 0px 1px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-03","UNKNOWN","0px 6px 13px 0px rgba(0, 0, 0, 0.06), 0px 3px 7px 0px rgba(0, 0, 0, 0.14), 0px 1px 2px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-04","UNKNOWN","0px 8px 16px 0px rgba(0, 0, 0, 0.06), 0px 4px 9px 0px rgba(0, 0, 0, 0.14), 0px 2px 3px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-06","UNKNOWN","0px 12px 22px 0px rgba(0, 0, 0, 0.06), 0px 6px 13px 0px rgba(0, 0, 0, 0.14), 0px 4px 5px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-08","UNKNOWN","0px 16px 28px 0px rgba(0, 0, 0, 0.06), 0px 8px 17px 0px rgba(0, 0, 0, 0.14), 0px 6px 7px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-12","UNKNOWN","0px 22px 40px 0px rgba(0, 0, 0, 0.06), 0px 12px 23px 0px rgba(0, 0, 0, 0.14), 0px 10px 11px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-16","UNKNOWN","0px 28px 52px 0px rgba(0, 0, 0, 0.06), 0px 16px 29px 0px rgba(0, 0, 0, 0.14), 0px 14px 15px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-elevation-24","UNKNOWN","0px 40px 76px 0px rgba(0, 0, 0, 0.06), 0px 24px 41px 0px rgba(0, 0, 0, 0.14), 0px 22px 23px 0px rgba(0, 0, 0, 0.06)"),ft.create("--ft-border-radius-S","SIZE","4px"),ft.create("--ft-border-radius-M","SIZE","8px"),ft.create("--ft-border-radius-L","SIZE","12px"),ft.create("--ft-border-radius-XL","SIZE","16px"),ft.create("--ft-title-font","UNKNOWN","Ubuntu, system-ui, sans-serif"),ft.create("--ft-content-font","UNKNOWN","'Open Sans', system-ui, sans-serif"),ft.create("--ft-transition-duration","UNKNOWN","250ms"),ft.create("--ft-transition-timing-function","UNKNOWN","ease-in-out");class vt extends lt{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([i,n])=>t.registry.define(i,n))));const i={...t.shadowRootOptions,customElements:t.registry},n=this.renderOptions.creationScope=this.attachShadow(i);return m(n,t.elementStyles),n}}var mt,pt=function(t,i,n,e){for(var r,s=arguments.length,o=s<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,n):e,u=t.length-1;u>=0;u--)(r=t[u])&&(o=(s<3?r(o):s>3?r(i,n,o):r(i,n))||o);return s>3&&o&&Object.defineProperty(i,n,o),o};const yt=Symbol("constructorPrototype"),gt=Symbol("constructorName"),wt=Symbol("exportpartsDebouncer");class Mt extends vt{constructor(){super(),this[mt]=new i(5),this[gt]=this.constructor.name,this[yt]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[gt]&&Object.setPrototypeOf(this,this[yt])}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){var i,n;if((null!==(n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==n?n:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){this[wt].run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var i,n,e,r,s,o;const u=t=>null!=t&&t.trim().length>0,a=t.filter(u).map((t=>t.trim()));if(0===a.length)return void this.removeAttribute("exportparts");const h=new Set;for(let t of null!==(n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll("[part],[exportparts]"))&&void 0!==n?n:[]){const i=null!==(r=null===(e=t.getAttribute("part"))||void 0===e?void 0:e.split(" "))&&void 0!==r?r:[],n=null!==(o=null===(s=t.getAttribute("exportparts"))||void 0===s?void 0:s.split(",").map((t=>t.split(":")[1])))&&void 0!==o?o:[];new Array(...i,...n).filter(u).map((t=>t.trim())).forEach((t=>h.add(t)))}if(0===h.size)return void this.removeAttribute("exportparts");const c=[...h.values()].flatMap((t=>a.map((i=>`${t}:${i}--${t}`))));this.setAttribute("exportparts",[...this.part,...c].join(", "))}}var bt,Yt,xt,St;function Nt(){return xt.apply(null,arguments)}function Dt(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function kt(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function Ot(t,i){return Object.prototype.hasOwnProperty.call(t,i)}function Et(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var i;for(i in t)if(Ot(t,i))return!1;return!0}function Rt(t){return void 0===t}function Tt(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function _t(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function Ct(t,i){var n,e=[],r=t.length;for(n=0;n<r;++n)e.push(i(t[n],n));return e}function Wt(t,i){for(var n in i)Ot(i,n)&&(t[n]=i[n]);return Ot(i,"toString")&&(t.toString=i.toString),Ot(i,"valueOf")&&(t.valueOf=i.valueOf),t}function At(t,i,n,e){return ne(t,i,n,e,!0).utc()}function Ft(t){return null==t._pf&&(t._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),t._pf}function Ht(t){if(null==t._isValid){var i=Ft(t),n=St.call(i.parsedDateParts,(function(t){return null!=t})),e=!isNaN(t._d.getTime())&&i.overflow<0&&!i.empty&&!i.invalidEra&&!i.invalidMonth&&!i.invalidWeekday&&!i.weekdayMismatch&&!i.nullInput&&!i.invalidFormat&&!i.userInvalidated&&(!i.meridiem||i.meridiem&&n);if(t._strict&&(e=e&&0===i.charsLeftOver&&0===i.unusedTokens.length&&void 0===i.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return e;t._isValid=e}return t._isValid}function Lt(t){var i=At(NaN);return null!=t?Wt(Ft(i),t):Ft(i).userInvalidated=!0,i}mt=wt,pt([e()],Mt.prototype,"exportpartsPrefix",void 0),pt([u([])],Mt.prototype,"exportpartsPrefixes",void 0),pt([e()],Mt.prototype,"customStylesheet",void 0),v`
56
- .ft-no-text-select {
57
- -webkit-touch-callout: none;
58
- -webkit-user-select: none;
59
- -khtml-user-select: none;
60
- -moz-user-select: none;
61
- -ms-user-select: none;
62
- user-select: none;
63
- }
56
+ .ft-no-text-select {
57
+ -webkit-touch-callout: none;
58
+ -webkit-user-select: none;
59
+ -khtml-user-select: none;
60
+ -moz-user-select: none;
61
+ -ms-user-select: none;
62
+ user-select: none;
63
+ }
64
64
  `,v`
65
- .ft-word-wrap {
66
- white-space: normal;
67
- word-wrap: break-word;
68
- -ms-word-break: break-all;
69
- word-break: break-all;
70
- word-break: break-word;
71
- -ms-hyphens: auto;
72
- -moz-hyphens: auto;
73
- -webkit-hyphens: auto;
74
- hyphens: auto
75
- }
65
+ .ft-word-wrap {
66
+ white-space: normal;
67
+ word-wrap: break-word;
68
+ -ms-word-break: break-all;
69
+ word-break: break-all;
70
+ word-break: break-word;
71
+ -ms-hyphens: auto;
72
+ -moz-hyphens: auto;
73
+ -webkit-hyphens: auto;
74
+ hyphens: auto
75
+ }
76
76
  `,v`
77
77
  .ft-safari-ellipsis-fix {
78
78
  margin-right: 0;
79
-
79
+
80
80
  }
81
81
 
82
82
  .ft-safari-ellipsis-fix:after {
@@ -93,7 +93,7 @@ Nt.version="2.29.4",xt=ee,Nt.fn=qe,Nt.min=function(){return oe("isBefore",[].sli
93
93
  }
94
94
  `;var Wr=function(t,i,n,e){for(var r,s=arguments.length,o=s<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,n):e,u=t.length-1;u>=0;u--)(r=t[u])&&(o=(s<3?r(o):s>3?r(i,n,o):r(i,n))||o);return s>3&&o&&Object.defineProperty(i,n,o),o};null==window.echarts&&console.warn("Echarts is not available"),t.FtChart=class extends Mt{constructor(){super(...arguments),this.xAxisName="date",this.yAxisName="",this.valueLabels=void 0,this.valueLabelsSingular=void 0,this.barChart=!1,this.period=t.Period.DAY,this.data=[]}render(){return P`
95
95
  <div class="sessions-chart"></div>
96
- `}firstUpdated(t){var i;super.firstUpdated(t),this.myChart=null===(i=window.echarts)||void 0===i?void 0:i.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const i=this.getOptions();i&&this.myChart&&this.myChart.setOption(i)}getOptions(){const i=this;return{tooltip:{trigger:"axis",formatter:t=>i.getTooltip(t)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:n=>i.period===t.Period.DAY||i.period===t.Period.WEEK?Nt.utc(1e3*n).format("DD MMM YYYY"):(i.period,t.Period.MONTH,Nt.utc(1e3*n).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(i){const n=Nt.utc(1e3*i[0].data.value[0]),e=i.map((t=>t.data.value[1]));let r,s,o="";switch(this.period){case t.Period.DAY:r=n.format("DD MMM YYYY"),s="on",this.isThisPeriod(n,t.Period.DAY)&&(o=" so far");break;case t.Period.WEEK:r=n.format("DD MMM YYYY"),s="during the week of",this.isThisPeriod(n,t.Period.WEEK)&&(o=" so far");break;case t.Period.MONTH:s="in",r=n.format("MMMM YYYY"),this.isThisPeriod(n,t.Period.MONTH)&&(o=" so far")}let u="";for(let t=0;t<e.length;t++){let i=this.valueLabels?this.valueLabels[t]:this.yAxisName,n=this.valueLabelsSingular?this.valueLabelsSingular[t]:i;const a=1===e[t]?n:i;u+=`${e[t].toLocaleString()} ${a} ${s} ${r}${o}</br>`}return u.substring(0,u.length-5)}isThisPeriod(i,n,e=Nt.utc()){switch(n){case t.Period.DAY:return i.format("YYYY-MM-DD")===e.clone().startOf("day").format("YYYY-MM-DD");case t.Period.WEEK:return i.clone().startOf("isoWeek").format("YYYY-MM-DD")===e.clone().startOf("isoWeek").format("YYYY-MM-DD");case t.Period.MONTH:return i.month()===e.month()&&i.year()===e.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let i=[];for(let n=0;n<t;n++)i[n]={type:this.barChart?"bar":"line",data:this.getData(n)};return i}getData(t){return this.data.map((i=>({value:[i[0],i[t+1]]})))}},t.FtChart.styles=Cr,Wr([e({type:String})],t.FtChart.prototype,"xAxisName",void 0),Wr([e({type:String})],t.FtChart.prototype,"yAxisName",void 0),Wr([u(void 0)],t.FtChart.prototype,"valueLabels",void 0),Wr([u(void 0)],t.FtChart.prototype,"valueLabelsSingular",void 0),Wr([e({type:Boolean})],t.FtChart.prototype,"barChart",void 0),Wr([e({type:String})],t.FtChart.prototype,"period",void 0),Wr([u([])],t.FtChart.prototype,"data",void 0),Wr([
96
+ `}firstUpdated(t){var i;super.firstUpdated(t),this.myChart=null===(i=window.echarts)||void 0===i?void 0:i.init(this.container,void 0,{renderer:"svg"}),window.addEventListener("resize",(()=>{var t;null===(t=this.myChart)||void 0===t||t.resize()}))}updated(t){super.updated(t);const i=this.getOptions();i&&this.myChart&&this.myChart.setOption(i)}getOptions(){const i=this;return{tooltip:{trigger:"axis",formatter:t=>i.getTooltip(t)},grid:{left:"80px",right:"100px",top:"50px",bottom:"20px"},xAxis:{type:"category",name:this.xAxisName.toUpperCase(),axisTick:{alignWithLabel:!0},axisLabel:{formatter:n=>i.period===t.Period.DAY||i.period===t.Period.WEEK?Nt.utc(1e3*n).format("DD MMM YYYY"):(i.period,t.Period.MONTH,Nt.utc(1e3*n).format("MMMM YYYY"))}},yAxis:{type:"value",name:this.yAxisName.toUpperCase()},series:this.getSeries()}}getTooltip(i){const n=Nt.utc(1e3*i[0].data.value[0]),e=i.map((t=>t.data.value[1]));let r,s,o="";switch(this.period){case t.Period.DAY:r=n.format("DD MMM YYYY"),s="on",this.isThisPeriod(n,t.Period.DAY)&&(o=" so far");break;case t.Period.WEEK:r=n.format("DD MMM YYYY"),s="during the week of",this.isThisPeriod(n,t.Period.WEEK)&&(o=" so far");break;case t.Period.MONTH:s="in",r=n.format("MMMM YYYY"),this.isThisPeriod(n,t.Period.MONTH)&&(o=" so far")}let u="";for(let t=0;t<e.length;t++){let i=this.valueLabels?this.valueLabels[t]:this.yAxisName,n=this.valueLabelsSingular?this.valueLabelsSingular[t]:i;const a=1===e[t]?n:i;u+=`${e[t].toLocaleString()} ${a} ${s} ${r}${o}</br>`}return u.substring(0,u.length-5)}isThisPeriod(i,n,e=Nt.utc()){switch(n){case t.Period.DAY:return i.format("YYYY-MM-DD")===e.clone().startOf("day").format("YYYY-MM-DD");case t.Period.WEEK:return i.clone().startOf("isoWeek").format("YYYY-MM-DD")===e.clone().startOf("isoWeek").format("YYYY-MM-DD");case t.Period.MONTH:return i.month()===e.month()&&i.year()===e.year()}return!1}getSeries(){if(0==this.data.length)return[];const t=this.data[0].length-1;if(0==t)return[];let i=[];for(let n=0;n<t;n++)i[n]={type:this.barChart?"bar":"line",data:this.getData(n)};return i}getData(t){return this.data.map((i=>this.isThisPeriod(Nt.unix(i[0]),this.period)?{value:[i[0],i[t+1]],itemStyle:{opacity:.5}}:{value:[i[0],i[t+1]]}))}},t.FtChart.styles=Cr,Wr([e({type:String})],t.FtChart.prototype,"xAxisName",void 0),Wr([e({type:String})],t.FtChart.prototype,"yAxisName",void 0),Wr([u(void 0)],t.FtChart.prototype,"valueLabels",void 0),Wr([u(void 0)],t.FtChart.prototype,"valueLabelsSingular",void 0),Wr([e({type:Boolean})],t.FtChart.prototype,"barChart",void 0),Wr([e({type:String})],t.FtChart.prototype,"period",void 0),Wr([u([])],t.FtChart.prototype,"data",void 0),Wr([
97
97
  /**
98
98
  * @license
99
99
  * Copyright 2017 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-chart",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "Display charts from data",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,7 +19,7 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "1.0.35",
22
+ "@fluid-topics/ft-wc-utils": "1.0.37",
23
23
  "lit": "2.7.2",
24
24
  "moment": "2.29.4"
25
25
  },
@@ -29,5 +29,5 @@
29
29
  "peerDependencies": {
30
30
  "echarts": "^5.3.0"
31
31
  },
32
- "gitHead": "9d95cd4787fe699293f52b43352ae1594811b081"
32
+ "gitHead": "abb2109b58b81de01332c9f036f5ff1df0861f8f"
33
33
  }