@evercam/ui 0.0.55-beta.1 → 0.0.55-beta.3

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/index.mjs CHANGED
@@ -21913,12 +21913,18 @@ const Ah = {
21913
21913
  }
21914
21914
  ], Ye = {
21915
21915
  milestone: "e-tl-milestone",
21916
+ milestoneBullet: "e-tl-milestone--bullet",
21917
+ milestoneDot: "e-tl-milestone--dot",
21916
21918
  milestoneContent: "e-tl-milestone-content",
21917
21919
  milestoneLine: "e-tl-milestone-line",
21918
21920
  milestonesContainer: "e-tl-milestones",
21919
21921
  milestoneHovered: "e-tl-milestone--hovered",
21920
21922
  milestoneSelected: "e-tl-milestone--selected",
21921
- milestoneLabel: "e-tl-milestone-label"
21923
+ milestoneLabel: "e-tl-milestone-label",
21924
+ milestoneDotContainer: "e-tl-milestone-dot-container",
21925
+ milestoneDotLine: "e-tl-milestone-dot-line",
21926
+ milestoneDotDot: "e-tl-milestone-dot-dot",
21927
+ milestoneDotHovered: "e-tl-milestone-dot--hovered"
21922
21928
  }, Rh = He.extend({
21923
21929
  name: "ETimeline",
21924
21930
  directives: {
@@ -21948,13 +21954,30 @@ const Ah = {
21948
21954
  transitionDuration: {
21949
21955
  type: Number,
21950
21956
  default: 500
21957
+ },
21958
+ dot: {
21959
+ type: Boolean,
21960
+ default: !1
21961
+ },
21962
+ dotSize: {
21963
+ type: Number,
21964
+ default: 8
21965
+ },
21966
+ lineWidth: {
21967
+ type: Number,
21968
+ default: 2
21969
+ },
21970
+ lineHeight: {
21971
+ type: Number,
21972
+ default: 28
21951
21973
  }
21952
21974
  },
21953
21975
  data() {
21954
21976
  return {
21955
21977
  milestoneClasses: Ye,
21956
21978
  timeouts: [],
21957
- isInitialRender: !0
21979
+ isInitialRender: !0,
21980
+ isMouseOver: !1
21958
21981
  };
21959
21982
  },
21960
21983
  computed: {
@@ -21963,10 +21986,21 @@ const Ah = {
21963
21986
  transition: `transform ${this.transitionDuration}ms, width ${this.transitionDuration}ms, height ${this.transitionDuration}ms, padding ${this.transitionDuration}ms, border-radius ${this.transitionDuration}ms`
21964
21987
  };
21965
21988
  },
21989
+ sizeStyles() {
21990
+ return this.dot ? {} : {
21991
+ width: `${this.size}px`,
21992
+ height: `${this.size}px`
21993
+ };
21994
+ },
21995
+ positionStyles() {
21996
+ return !this.dot || !this.isMouseOver ? {} : {
21997
+ transform: `translateY(calc(-100% - ${this.lineHeight}px))`
21998
+ };
21999
+ },
21966
22000
  styles() {
21967
22001
  return {
21968
- width: `${this.size}px`,
21969
- height: `${this.size}px`,
22002
+ ...this.sizeStyles,
22003
+ ...this.positionStyles,
21970
22004
  backgroundColor: this.backgroundColor,
21971
22005
  borderColor: this.borderColor,
21972
22006
  borderWidth: `${this.borderWidth}px`,
@@ -21977,17 +22011,54 @@ const Ah = {
21977
22011
  contentStyles() {
21978
22012
  return this.transitionStyles;
21979
22013
  },
22014
+ computedTransitionDuration() {
22015
+ return this.isInitialRender ? 0 : this.transitionDuration;
22016
+ },
21980
22017
  labelStyles() {
21981
22018
  return {
21982
- transition: `opacity ${this.transitionDuration}ms`
22019
+ transition: `opacity ${this.computedTransitionDuration}ms`
22020
+ };
22021
+ },
22022
+ dotContainerStyles() {
22023
+ return {
22024
+ top: this.isMouseOver ? `calc(100% - ${this.borderWidth}px)` : `calc(50% + ${this.dotSize / 2}px)`,
22025
+ height: `calc(${this.lineHeight}px + ${this.dotSize}px)`,
22026
+ left: `calc(50% - ${this.lineWidth}px / 2)`,
22027
+ transition: `${this.computedTransitionDuration}ms`
22028
+ };
22029
+ },
22030
+ lineStyles() {
22031
+ return {
22032
+ bottom: `${this.dotSize / 2}px`,
22033
+ left: `calc(50% - ${this.lineWidth}px / 2)`,
22034
+ width: `${this.lineWidth}px`,
22035
+ height: this.isMouseOver ? `${this.lineHeight}px` : "0",
22036
+ backgroundColor: this.borderColor,
22037
+ transition: `${this.computedTransitionDuration}ms`
22038
+ };
22039
+ },
22040
+ dotStyles() {
22041
+ return {
22042
+ top: `${this.lineHeight}px`,
22043
+ left: `calc(50% - ${this.dotSize}px / 2)`,
22044
+ width: `${this.dotSize}px`,
22045
+ height: `${this.dotSize}px`,
22046
+ backgroundColor: this.borderColor,
22047
+ transition: `${this.computedTransitionDuration}ms`
21983
22048
  };
21984
22049
  }
21985
22050
  },
21986
22051
  updated() {
21987
- this.isInitialRender = !1;
22052
+ this.$nextTick(() => {
22053
+ this.isInitialRender = !1;
22054
+ });
21988
22055
  },
21989
22056
  methods: {
21990
22057
  onMilestoneMouseOver(s, e) {
22058
+ if (this.dot) {
22059
+ this.isMouseOver = !0;
22060
+ return;
22061
+ }
21991
22062
  const t = s.target;
21992
22063
  if (!t)
21993
22064
  return;
@@ -22000,7 +22071,18 @@ const Ah = {
22000
22071
  const n = r.getBoundingClientRect(), a = t.dataset.timeoutId;
22001
22072
  a && (clearTimeout(Number(a)), t.dataset.timeoutId = ""), t.dataset.initialWidth || (t.dataset.initialWidth = t.style.width), t.dataset.initialHeight || (t.dataset.initialHeight = t.style.height), t.dataset.initialContentWidth || (t.dataset.initialContentWidth = String(n.width)), t.dataset.initialContentHeight || (t.dataset.initialContentHeight = String(n.height)), t.dataset.transitionStart = String(Date.now()), t.style.width = t.dataset.initialContentWidth + "px", t.style.height = t.dataset.initialContentHeight + "px", t.style.borderRadius = "0.5em", t.classList.add(Ye.milestoneHovered), i.style.opacity = "1", i.style.width = t.dataset.initialContentWidth + "px", i.style.height = t.dataset.initialContentHeight + "px";
22002
22073
  },
22074
+ onMilestoneMouseMove() {
22075
+ this.timeouts.forEach((s) => clearTimeout(s)), this.isMouseOver = !0;
22076
+ },
22003
22077
  onMilestoneMouseLeave(s, e) {
22078
+ if (this.dot) {
22079
+ this.timeouts.push(
22080
+ setTimeout(() => {
22081
+ this.isMouseOver = !1;
22082
+ }, this.transitionDuration + 100)
22083
+ );
22084
+ return;
22085
+ }
22004
22086
  const t = s.target;
22005
22087
  if (!t)
22006
22088
  return;
@@ -22021,9 +22103,14 @@ const Ah = {
22021
22103
  });
22022
22104
  var Ch = function() {
22023
22105
  var e = this, t = e._self._c;
22024
- return t("div", { class: e.milestoneClasses.milestone, style: e.styles, attrs: { tabindex: "0" }, on: { mouseover: (i) => e.onMilestoneMouseOver(i, e.milestone), mouseleave: (i) => e.onMilestoneMouseLeave(i, e.milestone), click: (i) => e.onMilestoneClick(i, e.milestone) } }, [t("div", { class: e.milestoneClasses.milestoneContent, style: e.contentStyles }, [e._t("content", function() {
22106
+ return t("div", { class: {
22107
+ [e.milestoneClasses.milestone]: !0,
22108
+ [e.milestoneClasses.milestoneDot]: e.dot,
22109
+ [e.milestoneClasses.milestoneBullet]: !e.dot,
22110
+ [e.milestoneClasses.milestoneDotHovered]: e.isMouseOver
22111
+ }, style: e.styles, attrs: { tabindex: "0" }, on: { mouseover: (i) => e.onMilestoneMouseOver(i, e.milestone), mousemove: e.onMilestoneMouseMove, mouseleave: (i) => e.onMilestoneMouseLeave(i, e.milestone), click: (i) => e.onMilestoneClick(i, e.milestone) } }, [t("div", { class: e.milestoneClasses.milestoneContent, style: e.contentStyles }, [e._t("content", function() {
22025
22112
  return [t("span", [e._v(" " + e._s(e.milestone.text) + " ")])];
22026
- })], 2), t("div", { class: e.milestoneClasses.milestoneLabel, style: e.labelStyles }, [e._t("label")], 2)]);
22113
+ })], 2), e.dot ? t("div", { class: e.milestoneClasses.milestoneDotContainer, style: e.dotContainerStyles }, [t("div", { class: e.milestoneClasses.milestoneDotLine, style: e.lineStyles }), t("div", { class: e.milestoneClasses.milestoneDotDot, style: e.dotStyles })]) : t("div", { class: e.milestoneClasses.milestoneLabel, style: e.labelStyles }, [e._t("label")], 2)]);
22027
22114
  }, Dh = [], _h = /* @__PURE__ */ Ne(
22028
22115
  Rh,
22029
22116
  Ch,
@@ -22341,9 +22428,8 @@ const Ih = _h.exports, G = {
22341
22428
  return Object.fromEntries(s);
22342
22429
  },
22343
22430
  allEventsSorted() {
22344
- return Object.values(this.filteredEventsGroups).map((e) => e.events).flat().sort(
22345
- (e, t) => new Date(e.timestamp || e.startDate) > new Date(t.timestamp || t.startDate) ? 1 : -1
22346
- );
22431
+ const s = Object.values(this.filteredEventsGroups).map((e) => e.events).flat();
22432
+ return this.getSortedEvents(s);
22347
22433
  },
22348
22434
  oldestEvent() {
22349
22435
  let s;
@@ -22887,13 +22973,17 @@ const Ih = _h.exports, G = {
22887
22973
  r,
22888
22974
  s
22889
22975
  );
22890
- t.type === "drag" && a && e.attr("style", `left: ${n}px`), t.type === "end" && a && (this.markersPositions = {
22891
- ...this.markersPositions,
22892
- [s.id || s.timestamp]: {
22893
- ...this.markersPositions[s.id || s.timestamp],
22894
- position: n
22895
- }
22896
- }, e.classed(G.markerDragged, !1)), t.type !== "start" && this.$emit(`marker-drag-${t.type}`, {
22976
+ if (t.type === "drag" && a && e.attr("style", `left: ${n}px`), t.type === "end" && a) {
22977
+ const o = s.id || s.timestamp;
22978
+ this.markersPositions = {
22979
+ ...this.markersPositions,
22980
+ [o]: {
22981
+ ...this.markersPositions[o],
22982
+ position: n
22983
+ }
22984
+ }, e.classed(G.markerDragged, !1);
22985
+ }
22986
+ t.type !== "start" && this.$emit(`marker-drag-${t.type}`, {
22897
22987
  marker: s,
22898
22988
  newTimestamp: r.toISOString()
22899
22989
  });
@@ -23125,19 +23215,19 @@ const Ih = _h.exports, G = {
23125
23215
  Object.entries(this.milestonesGroups).forEach(([s, e]) => {
23126
23216
  const t = this.getMilestoneGroupYPosition(s), i = this.svg.select(
23127
23217
  `g.${G.eventGroup}-${s}`
23128
- ), r = t + (e.height || this.barChartHeight) / 2;
23129
- i.attr("x1", 0).attr("x2", this.timeline.offsetWidth).select(`.${Ye.milestoneLine}`).attr("y1", r).attr("y2", r);
23130
- const n = w.select(
23218
+ ), r = 2, a = (e.height || this.barChartHeight) / 2, o = t + a - r / 2;
23219
+ i.attr("x1", 0).attr("x2", this.timeline.offsetWidth).select(`.${Ye.milestoneLine}`).attr("y1", o).attr("y2", o);
23220
+ const l = w.select(
23131
23221
  `.${Ye.milestonesContainer}-${s}`
23132
23222
  );
23133
- n.style("top", `${t}px`).style("height", `${e.height || this.barChartHeight}px`);
23134
- const a = n.selectAll(
23223
+ l.style("top", `${t}px`).style("height", `${e.height || this.barChartHeight}px`);
23224
+ const c = l.selectAll(
23135
23225
  `.${Ye.milestone}`
23136
- ).data(e.events);
23137
- a.exit().remove(), a.enter().append("div").merge(a).style(
23226
+ ).data(this.getSortedEvents(e.events));
23227
+ c.exit().remove(), c.enter().append("div").merge(c).style(
23138
23228
  "left",
23139
- (o) => `${this.timeScale(this.tzStringToDate(o.timestamp))}px`
23140
- ).style("top", `${r}px`).style("transform", "translate(-50%, -50%)");
23229
+ (u) => `${this.timeScale(this.tzStringToDate(u.timestamp))}px`
23230
+ ).style("top", `${o}px`);
23141
23231
  });
23142
23232
  },
23143
23233
  drawBarChartEventsGroups() {
@@ -23362,6 +23452,11 @@ const Ih = _h.exports, G = {
23362
23452
  },
23363
23453
  onMilestoneClick(s, e) {
23364
23454
  this.panOnDateClick && this.panToTimestamp(s.timestamp), this.selectedMilestoneId = s.id || s.timestamp, this.$emit("milestone-click", { milestone: s, milestoneType: e });
23455
+ },
23456
+ getSortedEvents(s) {
23457
+ return [...s].sort(
23458
+ (e, t) => new Date(e.timestamp || e.startDate) > new Date(t.timestamp || t.startDate) ? 1 : -1
23459
+ );
23365
23460
  }
23366
23461
  }
23367
23462
  });
@@ -23374,13 +23469,13 @@ var kh = function() {
23374
23469
  return [e._v(" " + e._s(i.label) + " ")];
23375
23470
  }, { marker: i })], 2)]), t("div", { staticClass: "marker-line e-absolute e-pointer-events-none", style: e.getMarkerLineStyle(i) })]);
23376
23471
  }), e.autoResize ? t("div", { directives: [{ name: "resize-observer", rawName: "v-resize-observer", value: e.onResize, expression: "onResize" }], ref: "timelineContainer", staticClass: "e-timeline__svg-container e-relative e-h-13 e-rounded e-select-none e-overflow-x-hidden" }) : t("div", { ref: "timelineContainer", staticClass: "e-timeline__svg-container e-relative e-h-13 e-rounded e-select-none e-overflow-x-hidden" }), e._l(e.milestonesGroups, function(i, r) {
23377
- return t("div", { key: `${r}`, staticClass: "e-timeline-milestones" }, [t("div", { class: `e-tl-milestones e-tl-milestones-${r}` }, e._l(i.events, function(n, a) {
23378
- return t("ETimelineMilestone", { key: `${n.milestoneType}-${a}`, class: e.getMilestoneClass(n), attrs: { size: n.size || e.milestoneBulletSize, milestone: n, "background-color": e.getMilestoneColors(n.color, i.color).background, "border-color": e.getMilestoneColors(n.color, i.color).border }, on: { "milestone-click": function(o) {
23472
+ return t("div", { key: `${r}`, staticClass: "e-timeline-milestones" }, [t("div", { class: `e-tl-milestones e-tl-milestones-${r}` }, e._l(e.getSortedEvents(i.events), function(n, a) {
23473
+ return t("ETimelineMilestone", { key: `${n.milestoneType}-${a}`, class: e.getMilestoneClass(n), attrs: { "data-timestamp": n.timestamp, milestone: n, dot: i.dots, size: n.size || e.milestoneBulletSize, "transition-duration": i.milestonesTransitionDuration, "line-height": i.milestonesLineHeight, "dot-size": i.milestonesDotSize, "background-color": e.getMilestoneColors(n.color, i.color).background, "border-color": e.getMilestoneColors(n.color, i.color).border }, on: { "milestone-click": function(o) {
23379
23474
  return e.onMilestoneClick(n, r);
23380
23475
  } }, scopedSlots: e._u([{ key: "content", fn: function() {
23381
23476
  return [e._t(`milestoneContent.${n.milestoneType}`, function() {
23382
- return [t("span", [e._v(" " + e._s(n.text) + " ")])];
23383
- }, { milestone: n })];
23477
+ return [t("span", { staticClass: "e-px-2" }, [e._v(" " + e._s(n.text) + " ")])];
23478
+ }, { milestone: n, index: a })];
23384
23479
  }, proxy: !0 }, { key: "label", fn: function() {
23385
23480
  return [e._t(`milestoneLabel.${n.milestoneType}`, null, { milestone: n })];
23386
23481
  }, proxy: !0 }], null, !0) });