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

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,25 +21954,61 @@ 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: 6
21965
+ },
21966
+ lineWidth: {
21967
+ type: Number,
21968
+ default: 2
21969
+ },
21970
+ lineHeight: {
21971
+ type: Number,
21972
+ default: 16
21973
+ },
21974
+ hoveredLineHeight: {
21975
+ type: Number,
21976
+ default: 28
21951
21977
  }
21952
21978
  },
21953
21979
  data() {
21954
21980
  return {
21955
21981
  milestoneClasses: Ye,
21956
21982
  timeouts: [],
21957
- isInitialRender: !0
21983
+ isInitialRender: !0,
21984
+ isHoveringDot: !1,
21985
+ isMouseOver: !1
21958
21986
  };
21959
21987
  },
21960
21988
  computed: {
21989
+ computedLineHeight() {
21990
+ return this.isHoveringDot ? this.hoveredLineHeight : this.lineHeight;
21991
+ },
21961
21992
  transitionStyles() {
21962
21993
  return this.isInitialRender ? {} : {
21963
21994
  transition: `transform ${this.transitionDuration}ms, width ${this.transitionDuration}ms, height ${this.transitionDuration}ms, padding ${this.transitionDuration}ms, border-radius ${this.transitionDuration}ms`
21964
21995
  };
21965
21996
  },
21997
+ sizeStyles() {
21998
+ return this.dot ? {} : {
21999
+ width: `${this.size}px`,
22000
+ height: `${this.size}px`
22001
+ };
22002
+ },
22003
+ positionStyles() {
22004
+ return this.dot ? {
22005
+ transform: `translateY(calc(-100% - ${this.computedLineHeight}px))`
22006
+ } : {};
22007
+ },
21966
22008
  styles() {
21967
22009
  return {
21968
- width: `${this.size}px`,
21969
- height: `${this.size}px`,
22010
+ ...this.sizeStyles,
22011
+ ...this.positionStyles,
21970
22012
  backgroundColor: this.backgroundColor,
21971
22013
  borderColor: this.borderColor,
21972
22014
  borderWidth: `${this.borderWidth}px`,
@@ -21977,17 +22019,54 @@ const Ah = {
21977
22019
  contentStyles() {
21978
22020
  return this.transitionStyles;
21979
22021
  },
22022
+ computedTransitionDuration() {
22023
+ return this.isInitialRender ? 0 : this.transitionDuration;
22024
+ },
21980
22025
  labelStyles() {
21981
22026
  return {
21982
- transition: `opacity ${this.transitionDuration}ms`
22027
+ transition: `opacity ${this.computedTransitionDuration}ms`
22028
+ };
22029
+ },
22030
+ dotContainerStyles() {
22031
+ return {
22032
+ top: `calc(100% - ${this.borderWidth}px)`,
22033
+ height: `calc(${this.computedLineHeight}px + ${this.dotSize}px)`,
22034
+ left: `calc(50% - ${this.lineWidth}px / 2)`,
22035
+ transition: `${this.computedTransitionDuration}ms`
22036
+ };
22037
+ },
22038
+ lineStyles() {
22039
+ return {
22040
+ top: `${this.borderWidth}px`,
22041
+ left: `calc(50% - ${this.lineWidth}px / 2)`,
22042
+ width: `${this.lineWidth}px`,
22043
+ height: `calc(${this.computedLineHeight}px)`,
22044
+ backgroundColor: this.borderColor,
22045
+ transition: `${this.computedTransitionDuration}ms`
22046
+ };
22047
+ },
22048
+ dotStyles() {
22049
+ return {
22050
+ top: `calc(${this.computedLineHeight}px + 1px)`,
22051
+ left: `calc(50% - ${this.dotSize}px / 2)`,
22052
+ width: `${this.dotSize}px`,
22053
+ height: `${this.dotSize}px`,
22054
+ backgroundColor: this.borderColor,
22055
+ transition: `${this.computedTransitionDuration}ms`
21983
22056
  };
21984
22057
  }
21985
22058
  },
21986
22059
  updated() {
21987
- this.isInitialRender = !1;
22060
+ this.$nextTick(() => {
22061
+ this.isInitialRender = !1;
22062
+ });
21988
22063
  },
21989
22064
  methods: {
21990
22065
  onMilestoneMouseOver(s, e) {
22066
+ if (this.dot) {
22067
+ this.isHoveringDot = !0;
22068
+ return;
22069
+ }
21991
22070
  const t = s.target;
21992
22071
  if (!t)
21993
22072
  return;
@@ -22000,7 +22079,18 @@ const Ah = {
22000
22079
  const n = r.getBoundingClientRect(), a = t.dataset.timeoutId;
22001
22080
  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
22081
  },
22082
+ onMilestoneMouseMove() {
22083
+ this.isMouseOver = !0;
22084
+ },
22003
22085
  onMilestoneMouseLeave(s, e) {
22086
+ if (this.dot) {
22087
+ this.timeouts.push(
22088
+ setTimeout(() => {
22089
+ this.isHoveringDot = !this.isMouseOver;
22090
+ }, 600)
22091
+ );
22092
+ return;
22093
+ }
22004
22094
  const t = s.target;
22005
22095
  if (!t)
22006
22096
  return;
@@ -22021,9 +22111,14 @@ const Ah = {
22021
22111
  });
22022
22112
  var Ch = function() {
22023
22113
  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() {
22114
+ return t("div", { class: {
22115
+ [e.milestoneClasses.milestone]: !0,
22116
+ [e.milestoneClasses.milestoneDot]: e.dot,
22117
+ [e.milestoneClasses.milestoneBullet]: !e.dot,
22118
+ [e.milestoneClasses.milestoneDotHovered]: e.isHoveringDot
22119
+ }, style: e.styles, attrs: { tabindex: "0" }, on: { mouseover: (i) => e.onMilestoneMouseOver(i, e.milestone), mousemove: (i) => e.onMilestoneMouseMove(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() {
22025
22120
  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)]);
22121
+ })], 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
22122
  }, Dh = [], _h = /* @__PURE__ */ Ne(
22028
22123
  Rh,
22029
22124
  Ch,
@@ -23125,19 +23220,19 @@ const Ih = _h.exports, G = {
23125
23220
  Object.entries(this.milestonesGroups).forEach(([s, e]) => {
23126
23221
  const t = this.getMilestoneGroupYPosition(s), i = this.svg.select(
23127
23222
  `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(
23223
+ ), r = 2, n = e.height || this.barChartHeight, a = e.dots ? n : n / 2, o = t + a - r / 2;
23224
+ i.attr("x1", 0).attr("x2", this.timeline.offsetWidth).select(`.${Ye.milestoneLine}`).attr("y1", o).attr("y2", o);
23225
+ const l = w.select(
23131
23226
  `.${Ye.milestonesContainer}-${s}`
23132
23227
  );
23133
- n.style("top", `${t}px`).style("height", `${e.height || this.barChartHeight}px`);
23134
- const a = n.selectAll(
23228
+ l.style("top", `${t}px`).style("height", `${e.height || this.barChartHeight}px`);
23229
+ const c = l.selectAll(
23135
23230
  `.${Ye.milestone}`
23136
23231
  ).data(e.events);
23137
- a.exit().remove(), a.enter().append("div").merge(a).style(
23232
+ c.exit().remove(), c.enter().append("div").merge(c).style(
23138
23233
  "left",
23139
- (o) => `${this.timeScale(this.tzStringToDate(o.timestamp))}px`
23140
- ).style("top", `${r}px`).style("transform", "translate(-50%, -50%)");
23234
+ (u) => `${this.timeScale(this.tzStringToDate(u.timestamp))}px`
23235
+ ).style("top", `${o}px`);
23141
23236
  });
23142
23237
  },
23143
23238
  drawBarChartEventsGroups() {
@@ -23255,6 +23350,11 @@ const Ih = _h.exports, G = {
23255
23350
  }, o = s.append("g").attr("class", `${G.labelGroup} ${G.labelGroup}-${r}`).style("cursor", "pointer").on("click", () => this.toggleGroupVisibility(r));
23256
23351
  o.append("rect").attr("class", G.labelBg).attr("data-color", t).attr("x", a.x).attr("y", a.y).attr("width", a.w).attr("height", a.h).attr("rx", a.radius).attr("ry", a.radius).style("fill", this.dark ? "#131a29" : "white"), o.append("rect").attr("class", G.labelBgFill).attr("data-color", t).attr("x", a.x).attr("y", a.y).attr("width", a.w).attr("height", a.h).attr("rx", a.radius).attr("ry", a.radius).style("fill", this.getLabelBackgroundColor(t)).style("stroke", this.getTextFillColor(t)).style("stroke-width", 0.25), o.append("text").attr("class", G.labelText).attr("data-color", t).attr("x", 5).attr("y", e + (n || this.barChartHeight) / 2).attr("dy", "0.35em").style("text-anchor", "start").style("font-size", "12px").style("font-weight", 500).style("stroke-linejoin", "round").style("paint-order", "stroke").style("fill", this.getTextFillColor(t)).text(i);
23257
23352
  },
23353
+ getSortedEvents(s) {
23354
+ return [...s].sort(
23355
+ (e, t) => new Date(e.timestamp || e.startDate) > new Date(t.timestamp || t.startDate) ? 1 : -1
23356
+ );
23357
+ },
23258
23358
  getTextFillColor(s, e = 0) {
23259
23359
  var t, i;
23260
23360
  return (this.dark ? (t = w.color(s)) == null ? void 0 : t.brighter(1.5 + e) : (i = w.color(s)) == null ? void 0 : i.darker(2 + e)).toString();
@@ -23374,8 +23474,8 @@ var kh = function() {
23374
23474
  return [e._v(" " + e._s(i.label) + " ")];
23375
23475
  }, { marker: i })], 2)]), t("div", { staticClass: "marker-line e-absolute e-pointer-events-none", style: e.getMarkerLineStyle(i) })]);
23376
23476
  }), 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) {
23477
+ 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) {
23478
+ return t("ETimelineMilestone", { key: `${n.milestoneType}-${a}`, class: e.getMilestoneClass(n), attrs: { milestone: n, dot: i.dots, size: n.size || e.milestoneBulletSize, "transition-duration": i.milestonesTransitionDuration, "line-height": i.milestonesLineHeight, "hovered-line-height": i.milestonesHoveredLineHeight, "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
23479
  return e.onMilestoneClick(n, r);
23380
23480
  } }, scopedSlots: e._u([{ key: "content", fn: function() {
23381
23481
  return [e._t(`milestoneContent.${n.milestoneType}`, function() {