@circutor/charts 0.1.0 → 0.3.0

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.
Files changed (32) hide show
  1. package/dist/bundler/index.d.ts +35 -0
  2. package/dist/bundler/index.js +1 -0
  3. package/dist/bundler/itic-chart.d.ts +11 -0
  4. package/dist/bundler/itic-chart.js +1 -0
  5. package/dist/charts/charts.esm.js +1 -1
  6. package/dist/charts/p-7d11d611.entry.js +25 -0
  7. package/dist/charts/p-BPCJmLvQ.js +3 -0
  8. package/dist/cjs/charts.cjs.js +2 -2
  9. package/dist/cjs/{index-_N-tWlJj.js → index-dJHivNOd.js} +21 -0
  10. package/dist/cjs/itic-chart.cjs.entry.js +489 -77
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/collection/components/itic-chart/index.js +133 -6
  13. package/dist/collection/components/itic-chart/itic-chart.css +5 -0
  14. package/dist/collection/components/itic-chart/itic-chart.i18n.js +26 -0
  15. package/dist/collection/components/itic-chart/itic-chart.options.js +115 -32
  16. package/dist/collection/components/itic-chart/itic-chart.phases.js +55 -0
  17. package/dist/components/index.js +1 -1
  18. package/dist/components/itic-chart.js +3 -3
  19. package/dist/esm/charts.js +3 -3
  20. package/dist/esm/{index--cwjvYaF.js → index-BPCJmLvQ.js} +20 -1
  21. package/dist/esm/itic-chart.entry.js +489 -77
  22. package/dist/esm/loader.js +3 -3
  23. package/dist/types/components/itic-chart/index.d.ts +29 -2
  24. package/dist/types/components/itic-chart/itic-chart.i18n.d.ts +13 -0
  25. package/dist/types/components/itic-chart/itic-chart.options.d.ts +53 -4
  26. package/dist/types/components/itic-chart/itic-chart.phases.d.ts +17 -0
  27. package/dist/types/components.d.ts +43 -4
  28. package/dist/types/index.d.ts +1 -1
  29. package/package.json +11 -7
  30. package/readme.md +273 -37
  31. package/dist/charts/p--cwjvYaF.js +0 -3
  32. package/dist/charts/p-35caac53.entry.js +0 -25
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-_N-tWlJj.js');
3
+ var index = require('./index-dJHivNOd.js');
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -721,7 +721,7 @@ function disableUserSelect(dom) {
721
721
  domStyle.webkitTapHighlightColor = 'rgba(0,0,0,0)';
722
722
  domStyle['-webkit-touch-callout'] = 'none';
723
723
  }
724
- function hasOwn(own, prop) {
724
+ function hasOwn$1(own, prop) {
725
725
  return own.hasOwnProperty(prop);
726
726
  }
727
727
  function noop() { }
@@ -14810,7 +14810,7 @@ function setTooltipConfig(opt) {
14810
14810
  var formatterParamsExtra = opt.formatterParamsExtra;
14811
14811
  if (formatterParamsExtra) {
14812
14812
  each$4(keys(formatterParamsExtra), function (key) {
14813
- if (!hasOwn(formatterParams, key)) {
14813
+ if (!hasOwn$1(formatterParams, key)) {
14814
14814
  formatterParams[key] = formatterParamsExtra[key];
14815
14815
  formatterParams.$vars.push(key);
14816
14816
  }
@@ -16140,12 +16140,12 @@ var langZH = {
16140
16140
 
16141
16141
  var LOCALE_ZH = 'ZH';
16142
16142
  var LOCALE_EN = 'EN';
16143
- var DEFAULT_LOCALE = LOCALE_EN;
16143
+ var DEFAULT_LOCALE$1 = LOCALE_EN;
16144
16144
  var localeStorage = {};
16145
16145
  var localeModels = {};
16146
- var SYSTEM_LANG = !env.domSupported ? DEFAULT_LOCALE : function () {
16147
- var langStr = (document.documentElement.lang || navigator.language || navigator.browserLanguage || DEFAULT_LOCALE).toUpperCase();
16148
- return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE;
16146
+ var SYSTEM_LANG = !env.domSupported ? DEFAULT_LOCALE$1 : function () {
16147
+ var langStr = (document.documentElement.lang || navigator.language || navigator.browserLanguage || DEFAULT_LOCALE$1).toUpperCase();
16148
+ return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE$1;
16149
16149
  }();
16150
16150
  function registerLocale(locale, localeObj) {
16151
16151
  locale = locale.toUpperCase();
@@ -16161,17 +16161,17 @@ function createLocaleObject(locale) {
16161
16161
  if (locale === LOCALE_ZH || locale === LOCALE_EN) {
16162
16162
  return clone$2(localeObj);
16163
16163
  } else {
16164
- return merge(clone$2(localeObj), clone$2(localeStorage[DEFAULT_LOCALE]), false);
16164
+ return merge(clone$2(localeObj), clone$2(localeStorage[DEFAULT_LOCALE$1]), false);
16165
16165
  }
16166
16166
  } else {
16167
- return merge(clone$2(locale), clone$2(localeStorage[DEFAULT_LOCALE]), false);
16167
+ return merge(clone$2(locale), clone$2(localeStorage[DEFAULT_LOCALE$1]), false);
16168
16168
  }
16169
16169
  }
16170
16170
  function getLocaleModel(lang) {
16171
16171
  return localeModels[lang];
16172
16172
  }
16173
16173
  function getDefaultLocaleModel() {
16174
- return localeModels[DEFAULT_LOCALE];
16174
+ return localeModels[DEFAULT_LOCALE$1];
16175
16175
  }
16176
16176
  // Default locale
16177
16177
  registerLocale(LOCALE_EN, langEN);
@@ -17207,7 +17207,7 @@ function mergeLayoutParam(targetOption, newOption, opt) {
17207
17207
  each$3(names, function (name) {
17208
17208
  // Consider case: newOption.width is null, which is
17209
17209
  // set by user for removing width setting.
17210
- hasOwn(newOption, name) && (newParams[name] = merged[name] = newOption[name]);
17210
+ hasOwn$1(newOption, name) && (newParams[name] = merged[name] = newOption[name]);
17211
17211
  hasValue(newParams, name) && newValueCount++;
17212
17212
  hasValue(merged, name) && mergedValueCount++;
17213
17213
  });
@@ -17236,7 +17236,7 @@ function mergeLayoutParam(targetOption, newOption, opt) {
17236
17236
  // Chose another param from targetOption by priority.
17237
17237
  for (var i = 0; i < names.length; i++) {
17238
17238
  var name_1 = names[i];
17239
- if (!hasOwn(newParams, name_1) && hasOwn(targetOption, name_1)) {
17239
+ if (!hasOwn$1(newParams, name_1) && hasOwn$1(targetOption, name_1)) {
17240
17240
  newParams[name_1] = targetOption[name_1];
17241
17241
  break;
17242
17242
  }
@@ -17266,7 +17266,7 @@ function getLayoutParams(source) {
17266
17266
  */
17267
17267
  function copyLayoutParams(target, source) {
17268
17268
  source && target && each$3(LOCATION_PARAMS, function (name) {
17269
- hasOwn(source, name) && (target[name] = source[name]);
17269
+ hasOwn$1(source, name) && (target[name] = source[name]);
17270
17270
  });
17271
17271
  return target;
17272
17272
  }
@@ -18833,13 +18833,13 @@ function applyMediaQuery(query, ecWidth, ecHeight) {
18833
18833
  }
18834
18834
  var operator = matched[1];
18835
18835
  var realAttr = matched[2].toLowerCase();
18836
- if (!compare(realMap[realAttr], value, operator)) {
18836
+ if (!compare$1(realMap[realAttr], value, operator)) {
18837
18837
  applicable = false;
18838
18838
  }
18839
18839
  });
18840
18840
  return applicable;
18841
18841
  }
18842
- function compare(real, expect, operator) {
18842
+ function compare$1(real, expect, operator) {
18843
18843
  if (operator === 'min') {
18844
18844
  return real >= expect;
18845
18845
  } else if (operator === 'max') {
@@ -19487,7 +19487,7 @@ function detectSourceFormat(data) {
19487
19487
  }
19488
19488
  } else if (isObject$2(data)) {
19489
19489
  for (var key in data) {
19490
- if (hasOwn(data, key) && isArrayLike(data[key])) {
19490
+ if (hasOwn$1(data, key) && isArrayLike(data[key])) {
19491
19491
  sourceFormat = SOURCE_FORMAT_KEYED_COLUMNS;
19492
19492
  break;
19493
19493
  }
@@ -20599,7 +20599,7 @@ function createExternalSource(internalSource, externalTransform) {
20599
20599
  // For simplicity, data transform forbids name duplication, do not generate
20600
20600
  // new name like module `completeDimensions.ts` did, but just tell users.
20601
20601
  var errMsg_1 = '';
20602
- if (hasOwn(dimsByName, name)) {
20602
+ if (hasOwn$1(dimsByName, name)) {
20603
20603
  throwError(errMsg_1);
20604
20604
  }
20605
20605
  dimsByName[name] = dimDefExt;
@@ -20685,9 +20685,9 @@ function getDimensionInfo(dimensions, dimsByName, dim) {
20685
20685
  // Keep the same logic as `List::getDimension` did.
20686
20686
  if (isNumber(dim)
20687
20687
  // If being a number-like string but not being defined a dimension name.
20688
- || !isNaN(dim) && !hasOwn(dimsByName, dim)) {
20688
+ || !isNaN(dim) && !hasOwn$1(dimsByName, dim)) {
20689
20689
  return dimensions[dim];
20690
- } else if (hasOwn(dimsByName, dim)) {
20690
+ } else if (hasOwn$1(dimsByName, dim)) {
20691
20691
  return dimsByName[dim];
20692
20692
  }
20693
20693
  }
@@ -22219,7 +22219,7 @@ function buildSection(ctx, fragment, topMarginForOuterGap, toolTipTextStyle) {
22219
22219
  valueAsc: 'asc',
22220
22220
  valueDesc: 'desc'
22221
22221
  };
22222
- if (hasOwn(orderMap, orderMode)) {
22222
+ if (hasOwn$1(orderMap, orderMode)) {
22223
22223
  var comparator_1 = new SortOrderComparator(orderMap[orderMode], null);
22224
22224
  subBlocks.sort(function (a, b) {
22225
22225
  return comparator_1.evaluate(a.sortParam, b.sortParam);
@@ -31938,7 +31938,7 @@ function determineAxisType(model) {
31938
31938
  // PENDING: Theoretically, a customized `Scale` is probably impossible, since
31939
31939
  // the interface of `Scale` does not guarantee stability. But we still literally
31940
31940
  // support it for backward compat, though type incorrect.
31941
- || !hasOwn(AXIS_TYPES, type) && !Scale.getClass(type)) {
31941
+ || !hasOwn$1(AXIS_TYPES, type) && !Scale.getClass(type)) {
31942
31942
  type = 'value';
31943
31943
  }
31944
31944
  return type;
@@ -39093,7 +39093,7 @@ onZeroRecords) {
39093
39093
  } else {
39094
39094
  // Find the first available other axis.
39095
39095
  for (var idx in otherAxes) {
39096
- if (hasOwn(otherAxes, idx) && canOnZeroToAxis(onZero, otherAxes[idx])
39096
+ if (hasOwn$1(otherAxes, idx) && canOnZeroToAxis(onZero, otherAxes[idx])
39097
39097
  // Consider that two Y axes on one value axis,
39098
39098
  // if both onZero, the two Y axes overlap.
39099
39099
  && !onZeroRecords[getOnZeroRecordKey(otherAxes[idx])]) {
@@ -43537,7 +43537,7 @@ function makeSelectedMap(legendModel, out) {
43537
43537
  return;
43538
43538
  }
43539
43539
  var isItemSelected = legendModel.isSelected(name);
43540
- if (hasOwn(selectedMap, name)) {
43540
+ if (hasOwn$1(selectedMap, name)) {
43541
43541
  // Unselected if any legend is unselected
43542
43542
  selectedMap[name] = selectedMap[name] && isItemSelected;
43543
43543
  } else {
@@ -45099,28 +45099,299 @@ function install(registers) {
45099
45099
  registers.registerPainter('canvas', CanvasPainter);
45100
45100
  }
45101
45101
 
45102
- function getDefaultExportFromCjs (x) {
45103
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
45104
- }
45102
+ const ariaLabel$5 = "Corba ITIC";
45103
+ const xAxisName$5 = "Durada (ms)";
45104
+ const yAxisName$5 = "Voltatge (% del voltatge nominal)";
45105
+ const tooltip$5 = {
45106
+ asset: "Actiu",
45107
+ date: "Data",
45108
+ eventType: "Esdeveniment",
45109
+ duration: "Durada",
45110
+ voltage: "Voltatge",
45111
+ status: "Estat",
45112
+ phase: "Fase",
45113
+ min: "Mín.",
45114
+ max: "Màx."
45115
+ };
45116
+ const eventTypes$5 = {
45117
+ VOLTAGE_DIP: "Buit de tensió",
45118
+ VOLTAGE_SWELL: "Augment de tensió",
45119
+ POWER_INTERRUPT: "Interrupció",
45120
+ VOLTAGE_TRANSIENT: "Transitori de voltatge",
45121
+ VOLTAGE_VARIATION: "Variació de voltatge",
45122
+ OVER_VOLTAGE: "Sobretensió",
45123
+ SUB_VOLTAGE: "Subtensió"
45124
+ };
45125
+ const phases$5 = {
45126
+ ALL: "Totes",
45127
+ NONE: ""
45128
+ };
45129
+ var ca = {
45130
+ ariaLabel: ariaLabel$5,
45131
+ xAxisName: xAxisName$5,
45132
+ yAxisName: yAxisName$5,
45133
+ tooltip: tooltip$5,
45134
+ eventTypes: eventTypes$5,
45135
+ phases: phases$5
45136
+ };
45105
45137
 
45106
- var dayjs_min$1 = {exports: {}};
45138
+ const ariaLabel$4 = "ITIC-Diagramm";
45139
+ const xAxisName$4 = "Dauer (ms)";
45140
+ const yAxisName$4 = "Spannung (% der Nennspannung)";
45141
+ const tooltip$4 = {
45142
+ asset: "Vermögenswert",
45143
+ date: "Datum",
45144
+ eventType: "Ereignis",
45145
+ duration: "Dauer",
45146
+ voltage: "Spannung",
45147
+ status: "Status",
45148
+ phase: "Phase",
45149
+ min: "Min.",
45150
+ max: "Max."
45151
+ };
45152
+ const eventTypes$4 = {
45153
+ VOLTAGE_DIP: "Spannungseinbruch",
45154
+ VOLTAGE_SWELL: "Spannungserhöhung",
45155
+ POWER_INTERRUPT: "Stromunterbrechung",
45156
+ VOLTAGE_TRANSIENT: "Spannungstransient",
45157
+ VOLTAGE_VARIATION: "Spannungsschwankung",
45158
+ OVER_VOLTAGE: "Überspannung",
45159
+ SUB_VOLTAGE: "Unterspannung"
45160
+ };
45161
+ const phases$4 = {
45162
+ ALL: "Alle",
45163
+ NONE: ""
45164
+ };
45165
+ var de = {
45166
+ ariaLabel: ariaLabel$4,
45167
+ xAxisName: xAxisName$4,
45168
+ yAxisName: yAxisName$4,
45169
+ tooltip: tooltip$4,
45170
+ eventTypes: eventTypes$4,
45171
+ phases: phases$4
45172
+ };
45107
45173
 
45108
- var dayjs_min = dayjs_min$1.exports;
45174
+ const ariaLabel$3 = "ITIC chart";
45175
+ const xAxisName$3 = "Duration (ms)";
45176
+ const yAxisName$3 = "Voltage (% of nominal voltage)";
45177
+ const tooltip$3 = {
45178
+ asset: "Asset",
45179
+ date: "Date",
45180
+ eventType: "Event",
45181
+ duration: "Duration",
45182
+ voltage: "Voltage",
45183
+ status: "Status",
45184
+ phase: "Phase",
45185
+ min: "Min",
45186
+ max: "Max"
45187
+ };
45188
+ const eventTypes$3 = {
45189
+ VOLTAGE_DIP: "Voltage dip",
45190
+ VOLTAGE_SWELL: "Voltage swell",
45191
+ POWER_INTERRUPT: "Power interruption",
45192
+ VOLTAGE_TRANSIENT: "Voltage transient",
45193
+ VOLTAGE_VARIATION: "Voltage variation",
45194
+ OVER_VOLTAGE: "Overvoltage",
45195
+ SUB_VOLTAGE: "Subvoltage"
45196
+ };
45197
+ const phases$3 = {
45198
+ ALL: "All",
45199
+ NONE: ""
45200
+ };
45201
+ var en = {
45202
+ ariaLabel: ariaLabel$3,
45203
+ xAxisName: xAxisName$3,
45204
+ yAxisName: yAxisName$3,
45205
+ tooltip: tooltip$3,
45206
+ eventTypes: eventTypes$3,
45207
+ phases: phases$3
45208
+ };
45109
45209
 
45110
- var hasRequiredDayjs_min;
45210
+ const ariaLabel$2 = "Curva ITIC";
45211
+ const xAxisName$2 = "Duración (ms)";
45212
+ const yAxisName$2 = "Voltaje (% del voltaje nominal)";
45213
+ const tooltip$2 = {
45214
+ asset: "Activo",
45215
+ date: "Fecha",
45216
+ eventType: "Evento",
45217
+ duration: "Duración",
45218
+ voltage: "Voltaje",
45219
+ status: "Estado",
45220
+ phase: "Fase",
45221
+ min: "Mín.",
45222
+ max: "Máx."
45223
+ };
45224
+ const eventTypes$2 = {
45225
+ VOLTAGE_DIP: "Hueco de tensión",
45226
+ VOLTAGE_SWELL: "Aumento de tensión",
45227
+ POWER_INTERRUPT: "Interrupción",
45228
+ VOLTAGE_TRANSIENT: "Transitorio de voltaje",
45229
+ VOLTAGE_VARIATION: "Variación de voltaje",
45230
+ OVER_VOLTAGE: "Sobretensión",
45231
+ SUB_VOLTAGE: "Subtensión"
45232
+ };
45233
+ const phases$2 = {
45234
+ ALL: "Todas",
45235
+ NONE: ""
45236
+ };
45237
+ var es = {
45238
+ ariaLabel: ariaLabel$2,
45239
+ xAxisName: xAxisName$2,
45240
+ yAxisName: yAxisName$2,
45241
+ tooltip: tooltip$2,
45242
+ eventTypes: eventTypes$2,
45243
+ phases: phases$2
45244
+ };
45111
45245
 
45112
- function requireDayjs_min () {
45113
- if (hasRequiredDayjs_min) return dayjs_min$1.exports;
45114
- hasRequiredDayjs_min = 1;
45115
- (function (module, exports) {
45116
- !function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),Y=_.prototype;return O.prototype=Y,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){Y[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
45117
- } (dayjs_min$1));
45118
- return dayjs_min$1.exports;
45119
- }
45246
+ const ariaLabel$1 = "Courbe ITIC";
45247
+ const xAxisName$1 = "Durée (ms)";
45248
+ const yAxisName$1 = "Tension (% de la tension nominale)";
45249
+ const tooltip$1 = {
45250
+ asset: "Dispositif",
45251
+ date: "Date",
45252
+ eventType: "Événement",
45253
+ duration: "Durée",
45254
+ voltage: "Tension",
45255
+ status: "Statut",
45256
+ phase: "Phase",
45257
+ min: "Min.",
45258
+ max: "Max."
45259
+ };
45260
+ const eventTypes$1 = {
45261
+ VOLTAGE_DIP: "Creux de tension",
45262
+ VOLTAGE_SWELL: "Augmentation de tension",
45263
+ POWER_INTERRUPT: "Interruption",
45264
+ VOLTAGE_TRANSIENT: "Tension transitoire",
45265
+ VOLTAGE_VARIATION: "Variation de tension",
45266
+ OVER_VOLTAGE: "Surtension",
45267
+ SUB_VOLTAGE: "Sous-tension"
45268
+ };
45269
+ const phases$1 = {
45270
+ ALL: "Toutes",
45271
+ NONE: ""
45272
+ };
45273
+ var fr = {
45274
+ ariaLabel: ariaLabel$1,
45275
+ xAxisName: xAxisName$1,
45276
+ yAxisName: yAxisName$1,
45277
+ tooltip: tooltip$1,
45278
+ eventTypes: eventTypes$1,
45279
+ phases: phases$1
45280
+ };
45120
45281
 
45121
- var dayjs_minExports = requireDayjs_min();
45122
- var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
45282
+ const ariaLabel = "Curva ITIC";
45283
+ const xAxisName = "Duração (ms)";
45284
+ const yAxisName = "Tensão (% da tensão nominal)";
45285
+ const tooltip = {
45286
+ asset: "Ativo",
45287
+ date: "Data",
45288
+ eventType: "Evento",
45289
+ duration: "Duração",
45290
+ voltage: "Tensão",
45291
+ status: "Status",
45292
+ phase: "Fase",
45293
+ min: "Mín.",
45294
+ max: "Máx."
45295
+ };
45296
+ const eventTypes = {
45297
+ VOLTAGE_DIP: "Queda de tensão",
45298
+ VOLTAGE_SWELL: "Aumento de tensão",
45299
+ POWER_INTERRUPT: "Interrupção",
45300
+ VOLTAGE_TRANSIENT: "Tensão transitória",
45301
+ VOLTAGE_VARIATION: "Variação de tensão",
45302
+ OVER_VOLTAGE: "Sobretensão",
45303
+ SUB_VOLTAGE: "Subtensão"
45304
+ };
45305
+ const phases = {
45306
+ ALL: "Todas",
45307
+ NONE: ""
45308
+ };
45309
+ var pt = {
45310
+ ariaLabel: ariaLabel,
45311
+ xAxisName: xAxisName,
45312
+ yAxisName: yAxisName,
45313
+ tooltip: tooltip,
45314
+ eventTypes: eventTypes,
45315
+ phases: phases
45316
+ };
45123
45317
 
45318
+ const LOCALES = ['ca', 'de', 'en', 'es', 'fr', 'pt'];
45319
+ const DEFAULT_LOCALE = 'en';
45320
+ const MESSAGES = { ca, de, en, es, fr, pt };
45321
+ /** Keeps the language of a locale (`es-ES` → `es`), falling back to `en` when it isn't translated. */
45322
+ function normalizeLocale(locale) {
45323
+ const language = String(locale !== null && locale !== void 0 ? locale : '')
45324
+ .split(/[-_]/)[0]
45325
+ .toLowerCase();
45326
+ return LOCALES.includes(language) ? language : DEFAULT_LOCALE;
45327
+ }
45328
+ const getMessages = (locale) => MESSAGES[locale];
45329
+ const hasOwn = (object, key) => Object.prototype.hasOwnProperty.call(object, key);
45330
+ /** Translated event type, or the code as is when it isn't in the catalog. */
45331
+ function translateEventType(messages, code) {
45332
+ return hasOwn(messages.eventTypes, code) ? messages.eventTypes[code] : code;
45333
+ }
45334
+ /** Translated name of a phase code that has one (`ALL`, `NONE`), or `undefined`. */
45335
+ function translatePhase(messages, code) {
45336
+ return hasOwn(messages.phases, code) ? messages.phases[code] : undefined;
45337
+ }
45338
+
45339
+ const L1 = '#a67c52';
45340
+ const L2 = '#20262C';
45341
+ const L3 = '#B9BDC0';
45342
+ const THREE_PHASE = '#00B388';
45343
+ // Same catalog as Scout. Names that change with the language (`ALL`, `NONE`) are in the i18n JSON files.
45344
+ const PHASES = {
45345
+ AN: { name: 'L1', color: L1 },
45346
+ BN: { name: 'L2', color: L2 },
45347
+ CN: { name: 'L3', color: L3 },
45348
+ AB: { name: 'L1', color: L1 },
45349
+ BC: { name: 'L2', color: L2 },
45350
+ CA: { name: 'L3', color: L3 },
45351
+ 'AN,BN,CN': { name: 'L1,L2,L3', color: THREE_PHASE },
45352
+ 'AB,BC,CA': { name: 'L1,L2,L3', color: THREE_PHASE },
45353
+ ALL: { name: '', color: '#4C5CC5' },
45354
+ A: { name: 'L1' },
45355
+ B: { name: 'L2' },
45356
+ C: { name: 'L3' },
45357
+ 'AN,BN': { name: 'L1,L2' },
45358
+ 'AN,CN': { name: 'L1,L3' },
45359
+ 'BN,CN': { name: 'L2,L3' },
45360
+ 'AB,BC': { name: 'L1,L2' },
45361
+ 'AB,CA': { name: 'L1,L3' },
45362
+ 'BC,CA': { name: 'L2,L3' },
45363
+ NONE: { name: '' },
45364
+ };
45365
+ const phaseCode = (phase) => (phase == null ? '' : String(phase));
45366
+ // Unknown codes keep the code as name and have no color
45367
+ const catalogPhase = (code) => Object.prototype.hasOwnProperty.call(PHASES, code) ? PHASES[code] : { name: code };
45368
+ /** Name, in the given language, and color of a phase code. */
45369
+ function getPhase(phase, messages) {
45370
+ var _a;
45371
+ const code = phaseCode(phase);
45372
+ const known = catalogPhase(code);
45373
+ return Object.assign(Object.assign({}, known), { name: (_a = translatePhase(messages, code)) !== null && _a !== void 0 ? _a : known.name });
45374
+ }
45375
+ // `NONE` (no name) goes after the named phases and `ALL` always last. Only these two names are translated,
45376
+ // so ranking them by code keeps the order the same in every language.
45377
+ const rank = (code) => (code === 'ALL' ? 2 : code === 'NONE' ? 1 : 0);
45378
+ /**
45379
+ * Sorts groups by phase name, then by code (e.g. `AN` and `AB` are both "L1"), with `NONE` and `ALL` last.
45380
+ * Compares characters, not with a locale's rules, so the legend is the same in every language.
45381
+ * Returns a new array with the same group objects; groups with the same code keep their order.
45382
+ */
45383
+ function sortGroups(groups) {
45384
+ const keyed = groups.map(group => {
45385
+ const code = phaseCode(group.phase);
45386
+ return { group, code, rank: rank(code), name: catalogPhase(code).name };
45387
+ });
45388
+ return keyed
45389
+ .sort((a, b) => a.rank - b.rank || compare(a.name, b.name) || compare(a.code, b.code))
45390
+ .map(({ group }) => group);
45391
+ }
45392
+ const compare = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
45393
+
45394
+ const DEFAULT_SETTINGS = { locale: DEFAULT_LOCALE };
45124
45395
  /**
45125
45396
  * Normalizes the `groups` prop, which arrives as an array from JS/React
45126
45397
  * or as a JSON string when set as an HTML attribute.
@@ -45135,6 +45406,14 @@ function parseGroups(groups) {
45135
45406
  }
45136
45407
  return parsed;
45137
45408
  }
45409
+ function isValidTimeZone(timeZone) {
45410
+ try {
45411
+ return true;
45412
+ }
45413
+ catch (_a) {
45414
+ return false;
45415
+ }
45416
+ }
45138
45417
  function escapeHtml(value) {
45139
45418
  return value
45140
45419
  .replace(/&/g, '&amp;')
@@ -45143,36 +45422,101 @@ function escapeHtml(value) {
45143
45422
  .replace(/"/g, '&quot;')
45144
45423
  .replace(/'/g, '&#39;');
45145
45424
  }
45146
- function formatTooltip(groupName, [duration, voltage, ts]) {
45147
- const rows = {
45148
- phase: escapeHtml(groupName),
45149
- duration: `${duration} ms`,
45150
- voltage: `${Math.round(voltage * 10) / 10}%`,
45151
- ts: dayjs(ts).locale('en').format('DD MMM, HH:mm:ss.SSS'),
45152
- };
45153
- return Object.entries(rows)
45154
- .map(([label, value]) => ` <strong>${label}</strong>: ${value}`)
45155
- .join('<br/>');
45156
- }
45157
- function buildChartOptions(groups) {
45158
- return Object.assign(Object.assign({}, BASE_OPTIONS), { series: [
45425
+ const isBlank = (value) => value == null || value === '';
45426
+ /**
45427
+ * Returns the tooltip HTML of a point: one row per field, in the chart's language. Rows without a value
45428
+ * are left out, and every value is escaped, since it comes from the consumer's data.
45429
+ */
45430
+ function createTooltipFormatter({ locale, timeZone }) {
45431
+ const messages = getMessages(locale);
45432
+ const dateFormat = new Intl.DateTimeFormat(locale, {
45433
+ day: '2-digit',
45434
+ month: 'short',
45435
+ hour: '2-digit',
45436
+ minute: '2-digit',
45437
+ second: '2-digit',
45438
+ // Short events are milliseconds apart
45439
+ fractionalSecondDigits: 3,
45440
+ hourCycle: 'h23',
45441
+ timeZone,
45442
+ });
45443
+ const durationFormat = new Intl.NumberFormat(locale, { style: 'unit', unit: 'millisecond', maximumFractionDigits: 3 });
45444
+ const voltageFormat = new Intl.NumberFormat(locale, { style: 'percent', maximumFractionDigits: 1 });
45445
+ // `volt` isn't a unit supported by Intl
45446
+ const voltsFormat = new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
45447
+ const formatDate = (ts) => {
45448
+ const date = new Date(ts);
45449
+ return Number.isNaN(date.getTime()) ? String(ts !== null && ts !== void 0 ? ts : '') : dateFormat.format(date);
45450
+ };
45451
+ const formatVolts = (value) => (Number(value) ? `${voltsFormat.format(Number(value))} V` : undefined);
45452
+ return (point, group) => {
45453
+ const rows = [
45454
+ ['asset', isBlank(group.assetName) ? undefined : String(group.assetName)],
45455
+ ['date', formatDate(point.ts)],
45456
+ ['eventType', isBlank(point.eventType) ? undefined : translateEventType(messages, String(point.eventType))],
45457
+ ['duration', durationFormat.format(Number(point.duration))],
45458
+ // The value is already in %
45459
+ ['voltage', voltageFormat.format(Number(point.voltage) / 100)],
45460
+ ['status', isBlank(point.status) ? undefined : String(point.status)],
45461
+ ['phase', getPhase(group.phase, messages).name || '-'],
45462
+ ['min', formatVolts(point.min)],
45463
+ ['max', formatVolts(point.max)],
45464
+ ];
45465
+ return rows
45466
+ .filter((row) => row[1] !== undefined)
45467
+ .map(([key, value]) => ` <strong>${messages.tooltip[key]}</strong>: ${escapeHtml(value)}`)
45468
+ .join('<br/>');
45469
+ };
45470
+ }
45471
+ /** Formats the axis labels in the chart's language; ECharts always uses English separators. */
45472
+ function createAxisLabelFormatter(locale) {
45473
+ const numberFormat = new Intl.NumberFormat(locale);
45474
+ return value => numberFormat.format(value);
45475
+ }
45476
+ const isClickable = (point) => point.clickable !== false;
45477
+ function buildChartOptions(groups, settings = DEFAULT_SETTINGS) {
45478
+ const messages = getMessages(settings.locale);
45479
+ const formatTooltip = createTooltipFormatter(settings);
45480
+ const axisLabel = { formatter: createAxisLabelFormatter(settings.locale) };
45481
+ return Object.assign(Object.assign({}, BASE_OPTIONS), { xAxis: Object.assign(Object.assign({}, BASE_OPTIONS.xAxis), { name: messages.xAxisName, axisLabel }), yAxis: Object.assign(Object.assign({}, BASE_OPTIONS.yAxis), { name: messages.yAxisName, axisLabel }), series: [
45159
45482
  ...CURVE_SERIES,
45160
- ...groups.map(({ groupName, points, color }) => ({
45161
- type: 'scatter',
45162
- name: groupName,
45163
- data: points.map(point => [point.duration, point.voltage, point.ts]),
45164
- symbolSize: 12,
45165
- z: 4,
45166
- itemStyle: {
45167
- color,
45168
- opacity: 1,
45169
- },
45170
- tooltip: {
45171
- formatter: params => formatTooltip(groupName, params.value),
45172
- },
45173
- })),
45483
+ ...sortGroups(groups).map((group) => {
45484
+ const { name, color } = getPhase(group.phase, messages);
45485
+ return {
45486
+ type: 'scatter',
45487
+ name,
45488
+ // ECharts 6 reads `cursor` per data item, although its types only declare it per series
45489
+ data: group.points.map(point => ({
45490
+ value: [point.duration, point.voltage],
45491
+ cursor: isClickable(point) ? 'pointer' : 'default',
45492
+ })),
45493
+ symbolSize: 12,
45494
+ z: 4,
45495
+ // Phases without a color take the next one of the ECharts palette
45496
+ itemStyle: color ? { color, opacity: 1 } : { opacity: 1 },
45497
+ tooltip: {
45498
+ formatter: params => formatTooltip(group.points[params.dataIndex], group),
45499
+ },
45500
+ };
45501
+ }),
45174
45502
  ] });
45175
45503
  }
45504
+ /**
45505
+ * Maps an ECharts click back to the original point and group. `buildChartOptions` draws the groups as
45506
+ * scatter series after the ITIC curve series, sorted with `sortGroups`.
45507
+ * Returns `undefined` for clicks outside the points and on points that aren't clickable.
45508
+ */
45509
+ function findClickedPoint(groups, { componentType, seriesIndex, dataIndex }) {
45510
+ if (componentType !== 'series' || seriesIndex == null || dataIndex == null) {
45511
+ return undefined;
45512
+ }
45513
+ const group = sortGroups(groups)[seriesIndex - CURVE_SERIES.length];
45514
+ const point = group === null || group === void 0 ? void 0 : group.points[dataIndex];
45515
+ if (!point || !isClickable(point)) {
45516
+ return undefined;
45517
+ }
45518
+ return { point, group };
45519
+ }
45176
45520
  const ITIC_CURVE_PROHIBITED_REGION = [
45177
45521
  [0.167, 500],
45178
45522
  [1, 200],
@@ -45191,23 +45535,24 @@ const ITIC_CURVE_NODAMAGE_REGION = [
45191
45535
  [10000, 90],
45192
45536
  [100000, 90],
45193
45537
  ];
45538
+ // Fixed ranges, as in Scout: ECharts clips points outside them (duration < 1 ms or voltage > 200%)
45194
45539
  const BASE_OPTIONS = {
45195
45540
  animation: false,
45196
45541
  grid: {
45197
- right: '40px',
45542
+ right: '20px',
45198
45543
  left: '60px',
45199
45544
  },
45200
45545
  // ECharts 6 moved the default legend to the bottom; keep it on top as in previous versions
45201
45546
  legend: { top: 0 },
45202
- tooltip: {},
45547
+ // Outside the shadow root, so containers with `overflow: hidden` don't clip it. Its styles are inline.
45548
+ tooltip: { appendTo: 'body' },
45203
45549
  textStyle: {
45204
45550
  fontFamily: 'CDS-Regular, Arial',
45205
45551
  },
45206
45552
  xAxis: {
45207
45553
  type: 'log',
45208
- min: 0.1,
45554
+ min: 1,
45209
45555
  max: 100000,
45210
- name: 'Duration (ms)',
45211
45556
  nameGap: 30,
45212
45557
  nameLocation: 'middle',
45213
45558
  nameTextStyle: {
@@ -45218,17 +45563,17 @@ const BASE_OPTIONS = {
45218
45563
  yAxis: {
45219
45564
  type: 'value',
45220
45565
  min: 0,
45221
- max: 500,
45566
+ max: 200,
45222
45567
  nameTextStyle: {
45223
45568
  fontSize: 16,
45224
45569
  fontWeight: 'bold',
45225
45570
  },
45226
- name: 'Voltage (% of nominal voltage)',
45227
45571
  nameRotate: 90,
45228
45572
  nameGap: 40,
45229
45573
  nameLocation: 'middle',
45230
45574
  },
45231
45575
  };
45576
+ // `silent`: the curve doesn't react to the mouse (no tooltip, cursor or click)
45232
45577
  const CURVE_SERIES = [
45233
45578
  {
45234
45579
  type: 'line',
@@ -45240,6 +45585,7 @@ const CURVE_SERIES = [
45240
45585
  lineStyle: {
45241
45586
  color: '#000',
45242
45587
  },
45588
+ silent: true,
45243
45589
  showSymbol: false,
45244
45590
  emphasis: {
45245
45591
  disabled: true,
@@ -45252,6 +45598,7 @@ const CURVE_SERIES = [
45252
45598
  origin: 'start',
45253
45599
  color: '#FFF5DF',
45254
45600
  },
45601
+ silent: true,
45255
45602
  showSymbol: false,
45256
45603
  lineStyle: {
45257
45604
  color: '#000',
@@ -45267,6 +45614,7 @@ const CURVE_SERIES = [
45267
45614
  origin: 100,
45268
45615
  color: '#DDFAF1',
45269
45616
  },
45617
+ silent: true,
45270
45618
  showSymbol: false,
45271
45619
  lineStyle: {
45272
45620
  color: '#000',
@@ -45282,6 +45630,7 @@ const CURVE_SERIES = [
45282
45630
  origin: 100,
45283
45631
  color: '#DDFAF1',
45284
45632
  },
45633
+ silent: true,
45285
45634
  showSymbol: false,
45286
45635
  lineStyle: {
45287
45636
  color: '#000',
@@ -45300,6 +45649,7 @@ const CURVE_SERIES = [
45300
45649
  origin: 100,
45301
45650
  color: '#DDFAF1',
45302
45651
  },
45652
+ silent: true,
45303
45653
  showSymbol: false,
45304
45654
  lineStyle: {
45305
45655
  color: 'transparent',
@@ -45318,6 +45668,7 @@ const CURVE_SERIES = [
45318
45668
  origin: 100,
45319
45669
  color: '#DDFAF1',
45320
45670
  },
45671
+ silent: true,
45321
45672
  showSymbol: false,
45322
45673
  lineStyle: {
45323
45674
  color: 'transparent',
@@ -45328,21 +45679,44 @@ const CURVE_SERIES = [
45328
45679
  },
45329
45680
  ];
45330
45681
 
45331
- const iticChartCss = () => `:host{display:block;height:400px}.chart{width:100%;height:100%}`;
45682
+ const iticChartCss = () => `:host{display:block;height:400px;background:var(--itic-chart-background, transparent)}.chart{width:100%;height:100%}`;
45332
45683
 
45333
45684
  // Register only what this chart uses, so bundles don't ship all of ECharts
45334
45685
  use([install$9, install$7, install$5, install$1, install$4, install]);
45335
45686
  const IticChart = class {
45336
45687
  constructor(hostRef) {
45337
45688
  index.registerInstance(this, hostRef);
45689
+ this.pointClick = index.createEvent(this, "pointClick");
45690
+ /**
45691
+ * Language of the texts, dates and numbers: `ca`, `de`, `en`, `es`, `fr` or `pt`. Only the language
45692
+ * is used (`es-ES` → `es`); any other value falls back to `en`.
45693
+ */
45694
+ this.locale = 'en';
45695
+ this.parsedGroups = [];
45338
45696
  }
45339
45697
  onGroupsChange() {
45340
45698
  this.updateChart();
45341
45699
  }
45700
+ onLocaleChange() {
45701
+ this.updateAriaLabel();
45702
+ this.updateChart();
45703
+ }
45704
+ onTimeZoneChange() {
45705
+ this.validateTimeZone();
45706
+ this.updateChart();
45707
+ }
45342
45708
  connectedCallback() {
45709
+ // The chart is a canvas: expose it as an image, labelled with `aria-label`, unless the consumer sets a role
45710
+ if (!this.el.hasAttribute('role')) {
45711
+ this.el.setAttribute('role', 'img');
45712
+ }
45713
+ this.updateAriaLabel();
45343
45714
  // componentDidLoad only fires once, so re-create the chart when the element is re-attached
45344
45715
  this.initChart();
45345
45716
  }
45717
+ componentWillLoad() {
45718
+ this.validateTimeZone();
45719
+ }
45346
45720
  componentDidLoad() {
45347
45721
  this.initChart();
45348
45722
  }
@@ -45353,11 +45727,38 @@ const IticChart = class {
45353
45727
  (_b = this.chart) === null || _b === void 0 ? void 0 : _b.dispose();
45354
45728
  this.chart = undefined;
45355
45729
  }
45730
+ updateAriaLabel() {
45731
+ const current = this.el.getAttribute('aria-label');
45732
+ if (current !== null && current !== this.defaultAriaLabel) {
45733
+ return;
45734
+ }
45735
+ this.defaultAriaLabel = getMessages(normalizeLocale(this.locale)).ariaLabel;
45736
+ this.el.setAttribute('aria-label', this.defaultAriaLabel);
45737
+ }
45738
+ // Validated when it changes, not on every redraw, so an invalid value is only reported once
45739
+ validateTimeZone() {
45740
+ this.validTimeZone = undefined;
45741
+ if (!this.timeZone) {
45742
+ return;
45743
+ }
45744
+ if (isValidTimeZone()) {
45745
+ this.validTimeZone = this.timeZone;
45746
+ }
45747
+ else {
45748
+ console.error(`[itic-chart] Invalid "timeZone" prop: "${this.timeZone}". Using the browser's time zone.`);
45749
+ }
45750
+ }
45356
45751
  initChart() {
45357
45752
  if (!this.container || this.chart) {
45358
45753
  return;
45359
45754
  }
45360
45755
  this.chart = init(this.container);
45756
+ this.chart.on('click', params => {
45757
+ const detail = findClickedPoint(this.parsedGroups, params);
45758
+ if (detail) {
45759
+ this.pointClick.emit(detail);
45760
+ }
45761
+ });
45361
45762
  if (typeof ResizeObserver !== 'undefined') {
45362
45763
  this.resizeObserver = new ResizeObserver(() => { var _a; return (_a = this.chart) === null || _a === void 0 ? void 0 : _a.resize(); });
45363
45764
  this.resizeObserver.observe(this.container);
@@ -45368,21 +45769,32 @@ const IticChart = class {
45368
45769
  if (!this.chart) {
45369
45770
  return;
45370
45771
  }
45371
- let groups = [];
45772
+ this.parsedGroups = [];
45372
45773
  try {
45373
- groups = parseGroups(this.groups);
45774
+ this.parsedGroups = parseGroups(this.groups);
45374
45775
  }
45375
45776
  catch (error) {
45376
45777
  console.error('[itic-chart] Invalid "groups" prop:', error);
45377
45778
  }
45378
- this.chart.setOption(buildChartOptions(groups), { notMerge: true });
45779
+ const options = buildChartOptions(this.parsedGroups, {
45780
+ locale: normalizeLocale(this.locale),
45781
+ timeZone: this.validTimeZone,
45782
+ });
45783
+ this.chart.setOption(options, { notMerge: true });
45379
45784
  }
45380
45785
  render() {
45381
- return index.h("div", { key: '98e14b7d6df922dc2a17dd09913bfad089ec4bf2', class: "chart", ref: el => (this.container = el) });
45786
+ return index.h("div", { key: '2bb964d590a36c9c9501761c3f848ad364a29030', class: "chart", ref: el => (this.container = el) });
45382
45787
  }
45788
+ get el() { return index.getElement(this); }
45383
45789
  static get watchers() { return {
45384
45790
  "groups": [{
45385
45791
  "onGroupsChange": 0
45792
+ }],
45793
+ "locale": [{
45794
+ "onLocaleChange": 0
45795
+ }],
45796
+ "timeZone": [{
45797
+ "onTimeZoneChange": 0
45386
45798
  }]
45387
45799
  }; }
45388
45800
  };