@evercam/ui 0.0.55-beta.9 → 0.0.56

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.
@@ -345,7 +345,7 @@
345
345
  "description": "",
346
346
  "default": false
347
347
  },
348
- "ETimeline/fit-markers-transition-duration": {
348
+ "ETimeline/zoom-to-interval-transition-duration": {
349
349
  "type": "number",
350
350
  "description": "",
351
351
  "default": 800
@@ -373,5 +373,14 @@
373
373
  "type": "string",
374
374
  "description": "",
375
375
  "default": "#ddd"
376
+ },
377
+ "ETimeline/focused-interval": {
378
+ "type": "object|any",
379
+ "description": ""
380
+ },
381
+ "ETimeline/locked": {
382
+ "type": "boolean",
383
+ "description": "",
384
+ "default": false
376
385
  }
377
386
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import Ve from "vue";
2
2
  import * as I from "d3";
3
3
  import Ke from "moment-timezone";
4
- var Y = /* @__PURE__ */ ((s) => (s.dot = "dot", s.xs = "xs", s.sm = "sm", s.md = "base", s.base = "base", s.lg = "lg", s.xl = "xl", s["2xl"] = "2xl", s["3xl"] = "3xl", s["4xl"] = "4xl", s["5xl"] = "5xl", s["6xl"] = "6xl", s["7xl"] = "7xl", s["8xl"] = "8xl", s["9xl"] = "9xl", s))(Y || {}), ge = /* @__PURE__ */ ((s) => (s.warning = "warning", s.error = "error", s.info = "info", s.success = "success", s.primary = "primary", s.brand = "brand", s.default = "default", s))(ge || {}), kt = /* @__PURE__ */ ((s) => (s.overview = "overview", s.detailed = "detailed", s.detailedBackground = "detailedBackground", s))(kt || {}), Ae = /* @__PURE__ */ ((s) => (s.bars = "bars", s.dots = "dots", s.lineGraph = "lineGraph", s.barChart = "barGraph", s.milestones = "milestones", s.exclusion = "exclusion", s))(Ae || {}), Pt = /* @__PURE__ */ ((s) => (s.zoom = "zoom", s.autoPan = "autoPan", s.initial = "initial", s))(Pt || {});
4
+ var Y = /* @__PURE__ */ ((s) => (s.dot = "dot", s.xs = "xs", s.sm = "sm", s.md = "base", s.base = "base", s.lg = "lg", s.xl = "xl", s["2xl"] = "2xl", s["3xl"] = "3xl", s["4xl"] = "4xl", s["5xl"] = "5xl", s["6xl"] = "6xl", s["7xl"] = "7xl", s["8xl"] = "8xl", s["9xl"] = "9xl", s))(Y || {}), ge = /* @__PURE__ */ ((s) => (s.warning = "warning", s.error = "error", s.info = "info", s.success = "success", s.primary = "primary", s.brand = "brand", s.default = "default", s))(ge || {}), kt = /* @__PURE__ */ ((s) => (s.overview = "overview", s.detailed = "detailed", s.detailedBackground = "detailedBackground", s))(kt || {}), Ae = /* @__PURE__ */ ((s) => (s.bars = "bars", s.dots = "dots", s.lineGraph = "lineGraph", s.barChart = "barGraph", s.milestones = "milestones", s))(Ae || {}), Pt = /* @__PURE__ */ ((s) => (s.zoom = "zoom", s.autoPan = "autoPan", s.initial = "initial", s))(Pt || {});
5
5
  const ma = Ve.extend({
6
6
  name: "EBadge",
7
7
  props: {
@@ -21580,7 +21580,7 @@ const Ah = {
21580
21580
  },
21581
21581
  {
21582
21582
  precision: K._2_year,
21583
- interval: I.utcYear.every(2),
21583
+ interval: I.utcYear.every(1),
21584
21584
  format: "%Y"
21585
21585
  },
21586
21586
  {
@@ -21708,7 +21708,7 @@ const Ah = {
21708
21708
  {
21709
21709
  precision: K._2_year,
21710
21710
  interval: I.utcMonth.every(6),
21711
- format: "%Y"
21711
+ format: "Q%q"
21712
21712
  },
21713
21713
  {
21714
21714
  precision: K._5_years,
@@ -22294,7 +22294,7 @@ const Ih = _h.exports, G = {
22294
22294
  type: Boolean,
22295
22295
  default: !1
22296
22296
  },
22297
- fitMarkersTransitionDuration: {
22297
+ zoomToIntervalTransitionDuration: {
22298
22298
  type: Number,
22299
22299
  default: 800
22300
22300
  },
@@ -22317,6 +22317,14 @@ const Ih = _h.exports, G = {
22317
22317
  forbiddenIntervalColor: {
22318
22318
  type: String,
22319
22319
  default: "#ddd"
22320
+ },
22321
+ focusedInterval: {
22322
+ type: [Object, void 0],
22323
+ default: void 0
22324
+ },
22325
+ locked: {
22326
+ type: Boolean,
22327
+ default: !1
22320
22328
  }
22321
22329
  },
22322
22330
  data() {
@@ -22367,7 +22375,9 @@ const Ih = _h.exports, G = {
22367
22375
  initialMarkerDragMouseOffset: 0,
22368
22376
  selectedMilestoneId: null,
22369
22377
  isInitialized: !1,
22370
- lastValidTransform: I.zoomIdentity
22378
+ lastValidTransform: I.zoomIdentity,
22379
+ lastPanTransform: I.zoomIdentity,
22380
+ isZoomingInterval: !1
22371
22381
  };
22372
22382
  },
22373
22383
  computed: {
@@ -22568,13 +22578,16 @@ const Ih = _h.exports, G = {
22568
22578
  this.isHoveringTimeline = !1;
22569
22579
  },
22570
22580
  selectedDate(s) {
22571
- s && this.panToTimestamp(s);
22581
+ s && !this.locked && this.panToTimestamp(s);
22572
22582
  },
22573
22583
  groupsVisibility() {
22574
22584
  this.updateAndRedrawTimeline();
22575
22585
  },
22576
22586
  forbiddenIntervals() {
22577
22587
  this.updateForbiddenIntervals(!0);
22588
+ },
22589
+ focusedInterval(s) {
22590
+ s && (s != null && s.startDate) && (s != null && s.endDate) && this.zoomToTargetInterval(s.startDate, s.endDate);
22578
22591
  }
22579
22592
  },
22580
22593
  created() {
@@ -22670,27 +22683,33 @@ const Ih = _h.exports, G = {
22670
22683
  },
22671
22684
  zoomToFitMarkers() {
22672
22685
  const s = this.markers.map(
22673
- (u) => new Date(u.timestamp).getTime()
22686
+ (i) => new Date(i.timestamp).getTime()
22674
22687
  );
22675
22688
  if (s.length < 2)
22676
22689
  return;
22677
- const e = Math.min(...s), t = Math.max(...s), i = this.initialTimeScale.domain().map((u) => u.getTime()), r = i[1] - i[0], n = t - e, a = 0.1 * n, o = n + 2 * a;
22678
- let l = r / o;
22679
- const c = this.zoomBehavior.scaleExtent();
22680
- l = Math.min(
22681
- Math.max(l, c[0]),
22682
- c[1]
22683
- ), this.svg.transition().duration(this.fitMarkersTransitionDuration / 2).call(this.zoomBehavior.scaleTo, l).on(
22684
- "end",
22685
- () => this.translateMarkersIntoView(e, t, l)
22686
- );
22690
+ const e = Math.min(...s), t = Math.max(...s);
22691
+ this.zoomToTargetInterval(e, t);
22687
22692
  },
22688
- translateMarkersIntoView(s, e, t) {
22693
+ zoomToTargetInterval(s, e) {
22694
+ if (!s || !e)
22695
+ return;
22696
+ this.isZoomingInterval = !0;
22697
+ const t = new Date(s).getTime(), i = new Date(e).getTime(), r = this.initialTimeScale.domain().map((h) => h.getTime()), n = r[1] - r[0], a = i - t, o = 0.1 * a, l = a + 2 * o;
22698
+ let c = n / l;
22699
+ const u = this.zoomBehavior.scaleExtent();
22700
+ c = Math.min(
22701
+ Math.max(c, u[0]),
22702
+ u[1]
22703
+ ), this.svg.transition().duration(this.zoomToIntervalTransitionDuration / 2).call(this.zoomBehavior.scaleTo, c).on("end", () => this.translateIntervalIntoView(t, i, c));
22704
+ },
22705
+ translateIntervalIntoView(s, e, t) {
22689
22706
  const i = this.timeScale(new Date(s)), r = this.timeScale(new Date(e)), n = (i + r) / 2, o = this.svg.node().getBoundingClientRect().width / 2 - n, l = I.zoomTransform(this.svg.node());
22690
- this.svg.transition().duration(this.fitMarkersTransitionDuration / 2).call(
22707
+ this.svg.transition().duration(this.zoomToIntervalTransitionDuration / 2).call(
22691
22708
  this.zoomBehavior.transform,
22692
22709
  I.zoomIdentity.translate(l.x + o, l.y).scale(t)
22693
- );
22710
+ ).on("end", () => {
22711
+ this.isZoomingInterval = !1;
22712
+ });
22694
22713
  },
22695
22714
  initSelectedTimestampCursor() {
22696
22715
  this.svg.append("line").attr("class", G.selectedTimestampCursor).style("stroke", "red").style("stroke-width", "1px").style("opacity", 0).attr("x1", 0).attr("x2", 0).attr("y1", 0), this.repositionSelectedTimestampCursor();
@@ -22861,12 +22880,15 @@ const Ih = _h.exports, G = {
22861
22880
  );
22862
22881
  },
22863
22882
  isZoomAllowed(s) {
22883
+ if (this.isZoomingInterval)
22884
+ return !0;
22864
22885
  const e = this.initialTimeScale.copy(), t = s.transform.rescaleX(e).domain(), i = this.minDate ? this.tzStringToDate(this.minDate) : void 0, r = this.maxDate ? this.tzStringToDate(this.maxDate) : void 0;
22865
22886
  return (!i || t[0] >= i) && (!r || t[1] <= r);
22866
22887
  },
22867
22888
  handleZoom(s) {
22889
+ var i;
22868
22890
  if (!this.isZoomAllowed(s)) {
22869
- s.sourceEvent.preventDefault(), this.svg.call(this.zoomBehavior.transform, this.lastValidTransform);
22891
+ (i = s == null ? void 0 : s.sourceEvent) == null || i.preventDefault(), this.svg.call(this.zoomBehavior.transform, this.lastValidTransform);
22870
22892
  return;
22871
22893
  }
22872
22894
  this.lastValidTransform = s.transform;
@@ -22877,16 +22899,27 @@ const Ih = _h.exports, G = {
22877
22899
  scale: t,
22878
22900
  translation: s.transform.x - this.lastTransform.x
22879
22901
  }, this.lastTransform = { ...s.transform };
22880
- for (const i in this.xAxes)
22881
- this.rescaleAxis(i, e), this.translateTicksText(i);
22902
+ for (const r in this.xAxes)
22903
+ this.rescaleAxis(r, e), this.translateTicksText(r);
22882
22904
  this.updateEventsBars(), this.updateLineGraphs(), this.updateBarChart(), this.updateLineGraphHoverZones(), this.updateMilestonesPositions(), this.repositionSelectedTimestampCursor(), this.updateForbiddenIntervals(), this.updateMarkers(), this.emitVisibleInterval(Pt.zoom), this.curtains && this.emitCurtainChange();
22883
22905
  },
22884
22906
  panToTimestamp(s) {
22885
- const e = this.tzStringToDate(s), t = this.timeScale(e), i = I.zoomTransform(this.svg.node()), r = i.x - t + this.timeline.offsetWidth / 2;
22886
- this.svg.transition().duration(this.panTransitionDuration).call(
22907
+ const e = this.tzStringToDate(s), t = this.timeScale(e), i = I.zoomTransform(this.svg.node()), r = i.x - t + this.timeline.offsetWidth / 2, n = this.timeScale.invert(
22908
+ -r / i.k
22909
+ ), a = this.timeScale.invert(
22910
+ (this.timeline.offsetWidth - r) / i.k
22911
+ ), o = this.minDate ? this.tzStringToDate(this.minDate) : void 0, l = this.maxDate ? this.tzStringToDate(this.maxDate) : void 0;
22912
+ if (o && n < o || l && a > l) {
22913
+ console.log("Pan operation would exceed bounds. Operation cancelled.");
22914
+ return;
22915
+ }
22916
+ const u = i.k / this.lastPanTransform.k < 10 ? this.panTransitionDuration : 0;
22917
+ this.lastPanTransform = { ...i }, this.svg.transition().duration(u).call(
22887
22918
  this.zoomBehavior.transform,
22888
22919
  I.zoomIdentity.translate(r, 0).scale(i.k)
22889
- ), this.emitVisibleInterval(Pt.autoPan);
22920
+ ).on("end", () => {
22921
+ this.emitVisibleInterval(Pt.autoPan);
22922
+ });
22890
22923
  },
22891
22924
  emitCurtainChange() {
22892
22925
  const { startDate: s, endDate: e } = this.calculateDateRangeFromCurtains();
@@ -23216,7 +23249,7 @@ const Ih = _h.exports, G = {
23216
23249
  yPosition: m,
23217
23250
  height: y
23218
23251
  }), t || i) {
23219
- const T = i ? 0.5 : 2, x = m + y / 2;
23252
+ const T = i ? 1 : 2, x = m + y / 2;
23220
23253
  v.append("line").classed(je.milestoneLine, !0).attr("x1", 0).attr("x2", this.timeline.offsetWidth).attr("y1", x).attr("y2", x).style("stroke", a).style("stroke-width", T);
23221
23254
  }
23222
23255
  this.drawBars({
@@ -23371,7 +23404,7 @@ const Ih = _h.exports, G = {
23371
23404
  n && (d = a), e.selectAll(G.eventRect).data(s).enter().append("rect").attr(
23372
23405
  "class",
23373
23406
  (f) => G.eventRect + (n ? ` ${G.eventRect}--dot` : "") + (f.className ? ` ${f.className}` : "")
23374
- ).attr("x", this.getEventRectX).attr("y", u + h).attr("ry", n ? a : l).attr("rx", n ? a : l).attr("width", n ? a : this.getEventRectWidth).attr("height", d).attr("stroke-width", 5).attr("cursor", "pointer").attr("stroke", "#0000").style("fill", (f) => f.color || i).on("mouseover", function(f, m) {
23407
+ ).attr("x", this.getEventRectX).attr("y", u + h).attr("ry", n ? a : l).attr("rx", n ? a : l).attr("width", n ? a : this.getEventRectWidth).attr("height", d).attr("stroke-width", n ? a / 10 : 5).attr("cursor", "pointer").attr("stroke", (f) => n ? I.color(f.color || i).brighter(1).toString() : "#0000").style("fill", (f) => f.color || i).on("mouseover", function(f, m) {
23375
23408
  I.select(this).classed(G.eventRectHovered, !0), c.handleBarMouseOver(f, m, r);
23376
23409
  }).on("mouseout", function() {
23377
23410
  I.select(this).classed(G.eventRectHovered, !1), c.handleBarMouseOut();