@record-evolution/widget-linechart 1.4.10 → 1.4.12

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