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