@record-evolution/widget-linechart 1.4.9 → 1.4.11

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.
@@ -23978,9 +23978,8 @@ function validateTimezone(_hours, minutes) {
23978
23978
  class WidgetLinechart extends s$1 {
23979
23979
  constructor() {
23980
23980
  super(...arguments);
23981
- this.inputData = {};
23982
23981
  this.canvasList = new Map();
23983
- this.version = '1.4.9';
23982
+ this.version = '1.4.11';
23984
23983
  }
23985
23984
  update(changedProperties) {
23986
23985
  if (changedProperties.has('inputData')) {
@@ -23993,13 +23992,13 @@ class WidgetLinechart extends s$1 {
23993
23992
  this.applyInputData();
23994
23993
  }
23995
23994
  transformInputData() {
23996
- var _a;
23997
- if (!((_a = this === null || this === void 0 ? void 0 : this.inputData) === null || _a === void 0 ? void 0 : _a.dataseries.length))
23995
+ var _a, _b;
23996
+ if (!((_b = (_a = this === null || this === void 0 ? void 0 : this.inputData) === null || _a === void 0 ? void 0 : _a.dataseries) === null || _b === void 0 ? void 0 : _b.length))
23998
23997
  return;
23999
23998
  // reset all existing chart dataseries
24000
- this.canvasList.forEach(chartM => chartM.dataSets = []);
24001
- this.inputData.dataseries.forEach(ds => {
24002
- var _a, _b;
23999
+ this.canvasList.forEach((chartM) => (chartM.dataSets = []));
24000
+ this.inputData.dataseries.forEach((ds) => {
24001
+ var _a, _b, _c;
24003
24002
  ds.chartName = (_a = ds.chartName) !== null && _a !== void 0 ? _a : '';
24004
24003
  if (ds.borderDash && typeof ds.borderDash === 'string') {
24005
24004
  ds.borderDash = JSON.parse(ds.borderDash);
@@ -24008,12 +24007,16 @@ class WidgetLinechart extends s$1 {
24008
24007
  ds.borderDash = undefined;
24009
24008
  }
24010
24009
  // pivot data
24011
- const distincts = [...new Set(ds.data.map((d) => d.pivot))];
24012
- const derivedBgColors = tinycolor(ds.backgroundColor).monochromatic(distincts.length).map((c) => c.toHexString());
24013
- const derivedBdColors = tinycolor(ds.borderColor).monochromatic(distincts.length).map((c) => c.toHexString());
24010
+ const distincts = [...new Set((_b = ds.data) === null || _b === void 0 ? void 0 : _b.map((d) => d.pivot))];
24011
+ const derivedBgColors = tinycolor(ds.backgroundColor)
24012
+ .monochromatic(distincts.length)
24013
+ .map((c) => c.toHexString());
24014
+ const derivedBdColors = tinycolor(ds.borderColor)
24015
+ .monochromatic(distincts.length)
24016
+ .map((c) => c.toHexString());
24014
24017
  if (distincts.length > 1) {
24015
24018
  distincts.forEach((piv, i) => {
24016
- var _a;
24019
+ var _a, _b, _c, _d;
24017
24020
  const pds = {
24018
24021
  label: ds.label + ' ' + piv,
24019
24022
  type: ds.type,
@@ -24025,15 +24028,17 @@ class WidgetLinechart extends s$1 {
24025
24028
  borderWidth: ds.borderWidth,
24026
24029
  borderDash: ds.borderDash,
24027
24030
  fill: ds.fill,
24028
- data: ds.data.filter(d => d.pivot === piv)
24031
+ data: (_a = ds.data) === null || _a === void 0 ? void 0 : _a.filter((d) => d.pivot === piv)
24029
24032
  };
24030
24033
  // If the chartName ends with :pivot: then create a seperate chart for each pivoted dataseries
24031
- const chartName = ds.chartName.endsWith('#pivot#') ? ds.chartName + piv : ds.chartName;
24034
+ const chartName = ((_b = ds.chartName) === null || _b === void 0 ? void 0 : _b.endsWith('#pivot#'))
24035
+ ? ds.chartName + piv
24036
+ : (_c = ds.chartName) !== null && _c !== void 0 ? _c : '';
24032
24037
  if (!this.canvasList.has(chartName)) {
24033
24038
  // initialize new charts
24034
24039
  this.canvasList.set(chartName, { chart: undefined, dataSets: [] });
24035
24040
  }
24036
- (_a = this.canvasList.get(chartName)) === null || _a === void 0 ? void 0 : _a.dataSets.push(pds);
24041
+ (_d = this.canvasList.get(chartName)) === null || _d === void 0 ? void 0 : _d.dataSets.push(pds);
24037
24042
  });
24038
24043
  }
24039
24044
  else {
@@ -24041,7 +24046,7 @@ class WidgetLinechart extends s$1 {
24041
24046
  // initialize new charts
24042
24047
  this.canvasList.set(ds.chartName, { chart: undefined, dataSets: [] });
24043
24048
  }
24044
- (_b = this.canvasList.get(ds.chartName)) === null || _b === void 0 ? void 0 : _b.dataSets.push(ds);
24049
+ (_c = this.canvasList.get(ds.chartName)) === null || _c === void 0 ? void 0 : _c.dataSets.push(ds);
24045
24050
  }
24046
24051
  });
24047
24052
  // prevent duplicate transformation
@@ -24050,6 +24055,7 @@ class WidgetLinechart extends s$1 {
24050
24055
  }
24051
24056
  applyInputData() {
24052
24057
  this.setupCharts();
24058
+ this.requestUpdate();
24053
24059
  this.canvasList.forEach(({ chart, dataSets }) => {
24054
24060
  var _a, _b, _c, _d, _e, _f, _g, _h;
24055
24061
  if (chart) {
@@ -24064,12 +24070,11 @@ class WidgetLinechart extends s$1 {
24064
24070
  });
24065
24071
  }
24066
24072
  xAxisType() {
24067
- var _a, _b, _c, _d;
24073
+ var _a, _b, _c, _d, _e;
24068
24074
  if ((_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.timeseries)
24069
24075
  return 'time';
24070
- const onePoint = (_d = (_c = this.inputData.dataseries) === null || _c === void 0 ? void 0 : _c[0].data) === null || _d === void 0 ? void 0 : _d[0];
24071
- // @ts-ignore
24072
- if (onePoint && !isNaN(onePoint.x))
24076
+ const onePoint = (_e = (_d = (_c = this.inputData) === null || _c === void 0 ? void 0 : _c.dataseries) === null || _d === void 0 ? void 0 : _d[0].data) === null || _e === void 0 ? void 0 : _e[0];
24077
+ if (!isNaN(Number(onePoint === null || onePoint === void 0 ? void 0 : onePoint.x)))
24073
24078
  return 'linear';
24074
24079
  return 'category';
24075
24080
  }
@@ -24094,13 +24099,13 @@ class WidgetLinechart extends s$1 {
24094
24099
  responsive: true,
24095
24100
  maintainAspectRatio: false,
24096
24101
  animations: {
24097
- "colors": false,
24098
- "x": false,
24102
+ colors: false,
24103
+ x: false
24099
24104
  },
24100
24105
  transitions: {
24101
- "active": {
24102
- "animation": {
24103
- "duration": 100
24106
+ active: {
24107
+ animation: {
24108
+ duration: 100
24104
24109
  }
24105
24110
  }
24106
24111
  },
@@ -24118,94 +24123,100 @@ class WidgetLinechart extends s$1 {
24118
24123
  text: (_j = (_h = this.inputData) === null || _h === void 0 ? void 0 : _h.settings) === null || _j === void 0 ? void 0 : _j.yAxisLabel
24119
24124
  }
24120
24125
  }
24121
- },
24122
- },
24126
+ }
24127
+ }
24123
24128
  });
24124
24129
  });
24125
24130
  }
24126
24131
  render() {
24127
24132
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24128
24133
  return x `
24129
- <div class="wrapper">
24130
- <header>
24131
- <h3 class="paging" ?active=${(_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.title}>${(_d = (_c = this.inputData) === null || _c === void 0 ? void 0 : _c.settings) === null || _d === void 0 ? void 0 : _d.title}</h3>
24132
- <p class="paging" ?active=${(_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.settings) === null || _f === void 0 ? void 0 : _f.subTitle}>${(_h = (_g = this.inputData) === null || _g === void 0 ? void 0 : _g.settings) === null || _h === void 0 ? void 0 : _h.subTitle}</p>
24133
- </header>
24134
-
24135
- <div class="chart-container ${((_k = (_j = this === null || this === void 0 ? void 0 : this.inputData) === null || _j === void 0 ? void 0 : _j.settings) === null || _k === void 0 ? void 0 : _k.columnLayout) ? 'columnLayout' : ''}">
24136
- ${c(this.canvasList, ([chartName, chartM]) => chartName, ([chartName]) => x `
24137
- <div class="sizer">
24138
- <canvas name="${chartName}"></canvas>
24134
+ <div class="wrapper">
24135
+ <header>
24136
+ <h3 class="paging" ?active=${(_b = (_a = this.inputData) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.title}>
24137
+ ${(_d = (_c = this.inputData) === null || _c === void 0 ? void 0 : _c.settings) === null || _d === void 0 ? void 0 : _d.title}
24138
+ </h3>
24139
+ <p class="paging" ?active=${(_f = (_e = this.inputData) === null || _e === void 0 ? void 0 : _e.settings) === null || _f === void 0 ? void 0 : _f.subTitle}>
24140
+ ${(_h = (_g = this.inputData) === null || _g === void 0 ? void 0 : _g.settings) === null || _h === void 0 ? void 0 : _h.subTitle}
24141
+ </p>
24142
+ </header>
24143
+
24144
+ <div class="chart-container ${((_k = (_j = this === null || this === void 0 ? void 0 : this.inputData) === null || _j === void 0 ? void 0 : _j.settings) === null || _k === void 0 ? void 0 : _k.columnLayout) ? 'columnLayout' : ''}">
24145
+ ${c([...this.canvasList.entries()].sort(), ([chartName, chartM]) => chartName, ([chartName]) => x `
24146
+ <div class="sizer">
24147
+ <canvas name="${chartName}"></canvas>
24148
+ </div>
24149
+ `)}
24150
+ </div>
24139
24151
  </div>
24140
- `)}
24141
- </div>
24142
- </div>
24143
- `;
24152
+ `;
24144
24153
  }
24145
24154
  }
24146
24155
  WidgetLinechart.styles = i$3 `
24147
- :host {
24148
- display: block;
24149
- color: var(--re-text-color, #000);
24150
-
24151
- font-family: sans-serif;
24152
- padding: 16px;
24153
- box-sizing: border-box;
24154
- margin: auto;
24155
- }
24156
+ :host {
24157
+ display: block;
24158
+ color: var(--re-text-color, #000);
24159
+
24160
+ font-family: sans-serif;
24161
+ padding: 16px;
24162
+ box-sizing: border-box;
24163
+ margin: auto;
24164
+ }
24156
24165
 
24157
- .paging:not([active]) { display: none !important; }
24166
+ .paging:not([active]) {
24167
+ display: none !important;
24168
+ }
24158
24169
 
24159
- .columnLayout {
24160
- flex-direction: column;
24161
- }
24170
+ .columnLayout {
24171
+ flex-direction: column;
24172
+ }
24162
24173
 
24163
- .wrapper {
24164
- display: flex;
24165
- flex-direction: column;
24166
- height: 100%;
24167
- width: 100%;
24168
- }
24174
+ .wrapper {
24175
+ display: flex;
24176
+ flex-direction: column;
24177
+ height: 100%;
24178
+ width: 100%;
24179
+ }
24169
24180
 
24170
- .chart-container {
24171
- display: flex;
24172
- flex: 1;
24173
- overflow: hidden;
24174
- position: relative;
24175
- }
24181
+ .chart-container {
24182
+ display: flex;
24183
+ flex: 1;
24184
+ overflow: hidden;
24185
+ position: relative;
24186
+ }
24176
24187
 
24177
- .sizer {
24178
- flex: 1;
24179
- overflow: hidden;
24180
- position: relative;
24181
- }
24188
+ .sizer {
24189
+ flex: 1;
24190
+ overflow: hidden;
24191
+ position: relative;
24192
+ }
24182
24193
 
24183
- header {
24184
- display: flex;
24185
- flex-direction: column;
24186
- margin: 0 0 16px 0;
24187
- }
24188
- h3 {
24189
- margin: 0;
24190
- max-width: 300px;
24191
- overflow: hidden;
24192
- text-overflow: ellipsis;
24193
- white-space: nowrap;
24194
- }
24195
- p {
24196
- margin: 10px 0 0 0;
24197
- max-width: 300px;
24198
- font-size: 14px;
24199
- line-height: 17px;
24200
- }
24201
- `;
24194
+ header {
24195
+ display: flex;
24196
+ flex-direction: column;
24197
+ margin: 0 0 16px 0;
24198
+ }
24199
+ h3 {
24200
+ margin: 0;
24201
+ max-width: 300px;
24202
+ overflow: hidden;
24203
+ text-overflow: ellipsis;
24204
+ white-space: nowrap;
24205
+ }
24206
+ p {
24207
+ margin: 10px 0 0 0;
24208
+ max-width: 300px;
24209
+ font-size: 14px;
24210
+ line-height: 17px;
24211
+ }
24212
+ `;
24202
24213
  __decorate([
24203
24214
  n({ type: Object })
24204
24215
  ], WidgetLinechart.prototype, "inputData", void 0);
24205
24216
  __decorate([
24206
24217
  r()
24207
24218
  ], WidgetLinechart.prototype, "canvasList", void 0);
24208
- window.customElements.define('widget-linechart-1.4.9', WidgetLinechart);
24219
+ window.customElements.define('widget-linechart-1.4.11', WidgetLinechart);
24209
24220
  const FORMATS = {
24210
24221
  datetime: 'MMM d, yyyy, h:mm:ss aaaa',
24211
24222
  millisecond: 'h:mm:ss.SSS aaaa',
@@ -24251,60 +24262,99 @@ adapters._date.override({
24251
24262
  // @ts-ignore
24252
24263
  add: function (time, amount, unit) {
24253
24264
  switch (unit) {
24254
- case 'millisecond': return addMilliseconds(time, amount);
24255
- case 'second': return addSeconds(time, amount);
24256
- case 'minute': return addMinutes(time, amount);
24257
- case 'hour': return addHours(time, amount);
24258
- case 'day': return addDays(time, amount);
24259
- case 'week': return addWeeks(time, amount);
24260
- case 'month': return addMonths(time, amount);
24261
- case 'quarter': return addQuarters(time, amount);
24262
- case 'year': return addYears(time, amount);
24263
- default: return time;
24265
+ case 'millisecond':
24266
+ return addMilliseconds(time, amount);
24267
+ case 'second':
24268
+ return addSeconds(time, amount);
24269
+ case 'minute':
24270
+ return addMinutes(time, amount);
24271
+ case 'hour':
24272
+ return addHours(time, amount);
24273
+ case 'day':
24274
+ return addDays(time, amount);
24275
+ case 'week':
24276
+ return addWeeks(time, amount);
24277
+ case 'month':
24278
+ return addMonths(time, amount);
24279
+ case 'quarter':
24280
+ return addQuarters(time, amount);
24281
+ case 'year':
24282
+ return addYears(time, amount);
24283
+ default:
24284
+ return time;
24264
24285
  }
24265
24286
  },
24266
24287
  diff: function (max, min, unit) {
24267
24288
  switch (unit) {
24268
- case 'millisecond': return differenceInMilliseconds(max, min);
24269
- case 'second': return differenceInSeconds(max, min);
24270
- case 'minute': return differenceInMinutes(max, min);
24271
- case 'hour': return differenceInHours(max, min);
24272
- case 'day': return differenceInDays(max, min);
24273
- case 'week': return differenceInWeeks(max, min);
24274
- case 'month': return differenceInMonths(max, min);
24275
- case 'quarter': return differenceInQuarters(max, min);
24276
- case 'year': return differenceInYears(max, min);
24277
- default: return 0;
24289
+ case 'millisecond':
24290
+ return differenceInMilliseconds(max, min);
24291
+ case 'second':
24292
+ return differenceInSeconds(max, min);
24293
+ case 'minute':
24294
+ return differenceInMinutes(max, min);
24295
+ case 'hour':
24296
+ return differenceInHours(max, min);
24297
+ case 'day':
24298
+ return differenceInDays(max, min);
24299
+ case 'week':
24300
+ return differenceInWeeks(max, min);
24301
+ case 'month':
24302
+ return differenceInMonths(max, min);
24303
+ case 'quarter':
24304
+ return differenceInQuarters(max, min);
24305
+ case 'year':
24306
+ return differenceInYears(max, min);
24307
+ default:
24308
+ return 0;
24278
24309
  }
24279
24310
  },
24280
24311
  // @ts-ignore
24281
24312
  startOf: function (time, unit, weekday) {
24282
24313
  switch (unit) {
24283
- case 'second': return startOfSecond(time);
24284
- case 'minute': return startOfMinute(time);
24285
- case 'hour': return startOfHour(time);
24286
- case 'day': return startOfDay(time);
24287
- case 'week': return startOfWeek(time);
24288
- // @ts-ignore
24289
- case 'isoWeek': return startOfWeek(time, { weekStartsOn: +weekday });
24290
- case 'month': return startOfMonth(time);
24291
- case 'quarter': return startOfQuarter(time);
24292
- case 'year': return startOfYear(time);
24293
- default: return time;
24314
+ case 'second':
24315
+ return startOfSecond(time);
24316
+ case 'minute':
24317
+ return startOfMinute(time);
24318
+ case 'hour':
24319
+ return startOfHour(time);
24320
+ case 'day':
24321
+ return startOfDay(time);
24322
+ case 'week':
24323
+ return startOfWeek(time);
24324
+ case 'isoWeek':
24325
+ // @ts-ignore
24326
+ return startOfWeek(time, { weekStartsOn: +weekday });
24327
+ case 'month':
24328
+ return startOfMonth(time);
24329
+ case 'quarter':
24330
+ return startOfQuarter(time);
24331
+ case 'year':
24332
+ return startOfYear(time);
24333
+ default:
24334
+ return time;
24294
24335
  }
24295
24336
  },
24296
24337
  // @ts-ignore
24297
24338
  endOf: function (time, unit) {
24298
24339
  switch (unit) {
24299
- case 'second': return endOfSecond(time);
24300
- case 'minute': return endOfMinute(time);
24301
- case 'hour': return endOfHour(time);
24302
- case 'day': return endOfDay(time);
24303
- case 'week': return endOfWeek(time);
24304
- case 'month': return endOfMonth(time);
24305
- case 'quarter': return endOfQuarter(time);
24306
- case 'year': return endOfYear(time);
24307
- default: return time;
24340
+ case 'second':
24341
+ return endOfSecond(time);
24342
+ case 'minute':
24343
+ return endOfMinute(time);
24344
+ case 'hour':
24345
+ return endOfHour(time);
24346
+ case 'day':
24347
+ return endOfDay(time);
24348
+ case 'week':
24349
+ return endOfWeek(time);
24350
+ case 'month':
24351
+ return endOfMonth(time);
24352
+ case 'quarter':
24353
+ return endOfQuarter(time);
24354
+ case 'year':
24355
+ return endOfYear(time);
24356
+ default:
24357
+ return time;
24308
24358
  }
24309
24359
  }
24310
24360
  });