chbim-time-axis-v2 0.0.193 → 0.0.195

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.
@@ -12346,25 +12346,27 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
12346
12346
  return !(i.left < scrollLeft.value - 100 || i.left > scrollLeft.value + containerWidth.value + 100);
12347
12347
  });
12348
12348
  }
12349
- const shouldRender = isVisible || task.type === "instant" || task.type === "block" && task.allowInstant;
12350
- if (shouldRender) {
12351
- const barData = {
12352
- id: task.id,
12353
- top: index * 30,
12354
- left: hasMainBar ? startX : 0,
12355
- width: hasMainBar ? width : 0,
12356
- hasMainBar,
12357
- name: task.name,
12358
- color: task.type === "group" ? "#4a90e2" : "#50e3c2",
12359
- originalTask: task,
12360
- blocks: blocks.length > 0 ? blocks : void 0,
12361
- instants: instants.length > 0 ? instants : void 0
12362
- };
12363
- if (hasLimit) {
12364
- barData.limitLeft = limitLeft;
12365
- barData.limitWidth = limitWidth;
12349
+ if (isVisible || task.type === "instant") {
12350
+ const shouldRender = isVisible || task.type === "instant";
12351
+ if (shouldRender) {
12352
+ const barData = {
12353
+ id: task.id,
12354
+ top: index * 30,
12355
+ left: hasMainBar ? startX : 0,
12356
+ width: hasMainBar ? width : 0,
12357
+ hasMainBar,
12358
+ name: task.name,
12359
+ color: task.type === "group" ? "#4a90e2" : "#50e3c2",
12360
+ originalTask: task,
12361
+ blocks: blocks.length > 0 ? blocks : void 0,
12362
+ instants: instants.length > 0 ? instants : void 0
12363
+ };
12364
+ if (hasLimit) {
12365
+ barData.limitLeft = limitLeft;
12366
+ barData.limitWidth = limitWidth;
12367
+ }
12368
+ bars.push(barData);
12366
12369
  }
12367
- bars.push(barData);
12368
12370
  }
12369
12371
  });
12370
12372
  return bars;
@@ -12376,6 +12378,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
12376
12378
  const minTickSpacing = 100;
12377
12379
  const targetInterval = props.scale * minTickSpacing;
12378
12380
  const steps = [
12381
+ { unit: "minute", step: 1, format: "HH:mm" },
12382
+ { unit: "minute", step: 5, format: "HH:mm" },
12383
+ { unit: "minute", step: 15, format: "HH:mm" },
12384
+ { unit: "minute", step: 30, format: "HH:mm" },
12379
12385
  { unit: "hour", step: 1, format: "HH:mm" },
12380
12386
  { unit: "hour", step: 6, format: "HH:mm" },
12381
12387
  { unit: "hour", step: 12, format: "HH:mm" },
@@ -12736,8 +12742,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
12736
12742
  };
12737
12743
  }
12738
12744
  });
12739
- const TimelineChart_vue_vue_type_style_index_0_scoped_761ad497_lang = "";
12740
- const TimelineChart = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-761ad497"]]);
12745
+ const TimelineChart_vue_vue_type_style_index_0_scoped_de1c4fcb_lang = "";
12746
+ const TimelineChart = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-de1c4fcb"]]);
12741
12747
  const _hoisted_1 = { class: "toolbar" };
12742
12748
  const _hoisted_2 = { style: { "flex": "1", "display": "flex", "align-items": "center", "height": "100%" } };
12743
12749
  const _hoisted_3 = { class: "left-controls" };
@@ -12784,9 +12790,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12784
12790
  props: {
12785
12791
  viewer: {},
12786
12792
  clock: {},
12787
- tasks: {}
12793
+ tasks: {},
12794
+ minZoomLevel: {}
12788
12795
  },
12789
- emits: ["taskUpdate", "update:tasks", "add", "delete", "task-enter", "task-leave", "blockUpdate"],
12796
+ emits: ["taskUpdate", "update:tasks", "add", "delete", "task-enter", "task-leave", "blockUpdate", "instantUpdate"],
12790
12797
  setup(__props, { expose: __expose, emit: __emit }) {
12791
12798
  const slots = useSlots();
12792
12799
  const props = __props;
@@ -12955,7 +12962,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12955
12962
  { immediate: true, deep: true }
12956
12963
  );
12957
12964
  const activeTaskIds = /* @__PURE__ */ new Set();
12958
- watch(currentTime, (newTime, oldTime) => {
12965
+ const checkActiveTasks = (newTime, oldTime) => {
12959
12966
  if (!newTime)
12960
12967
  return;
12961
12968
  const entered = [];
@@ -12974,7 +12981,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12974
12981
  left.push({ task, block });
12975
12982
  }
12976
12983
  });
12977
- } else if (task.type === "task" || task.type === "group" || !task.type) {
12984
+ } else if (task.type === "task" || !task.type) {
12978
12985
  if (task.startTime && task.endTime) {
12979
12986
  const inside = newTime >= task.startTime && newTime <= task.endTime;
12980
12987
  if (inside && !activeTaskIds.has(task.id)) {
@@ -12986,7 +12993,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12986
12993
  }
12987
12994
  }
12988
12995
  }
12989
- if (oldTime && task.instants) {
12996
+ if (oldTime && oldTime !== newTime && task.instants) {
12990
12997
  task.instants.forEach((inst) => {
12991
12998
  const t = inst.time;
12992
12999
  if (!t)
@@ -13006,7 +13013,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13006
13013
  emit("task-enter", entered);
13007
13014
  if (left.length > 0)
13008
13015
  emit("task-leave", left);
13016
+ };
13017
+ watch(currentTime, (newTime, oldTime) => {
13018
+ checkActiveTasks(newTime, oldTime);
13009
13019
  });
13020
+ watch(
13021
+ localTasks,
13022
+ () => {
13023
+ if (currentTime.value) {
13024
+ checkActiveTasks(currentTime.value, currentTime.value);
13025
+ }
13026
+ },
13027
+ { deep: true }
13028
+ );
13010
13029
  const handleToggleGroup = (id) => {
13011
13030
  if (collapsedGroups.value.has(id)) {
13012
13031
  collapsedGroups.value.delete(id);
@@ -13219,7 +13238,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13219
13238
  };
13220
13239
  const handleZoom = (delta, zoomCenterPixels) => {
13221
13240
  const newScaleRaw = scale.value * (delta > 0 ? 1.1 : 0.9);
13222
- const MIN_SCALE = 1e3 * 60 * 60 / 100;
13241
+ let minDuration = 1e3 * 60 * 60;
13242
+ if (props.minZoomLevel === "minute") {
13243
+ minDuration = 1e3 * 60;
13244
+ } else if (props.minZoomLevel === "day") {
13245
+ minDuration = 1e3 * 60 * 60 * 24;
13246
+ }
13247
+ const MIN_SCALE = minDuration / 100;
13223
13248
  const MAX_SCALE = 1e3 * 60 * 60 * 24 * 30;
13224
13249
  const newScale = Math.max(MIN_SCALE, Math.min(newScaleRaw, MAX_SCALE));
13225
13250
  const oldScale = scale.value;
@@ -13295,8 +13320,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13295
13320
  for (const t of list) {
13296
13321
  if (t.id === payload.taskId) {
13297
13322
  if (t.instants && t.instants[payload.instantIndex]) {
13298
- t.instants[payload.instantIndex].time = payload.time;
13323
+ const oldTime = t.instants[payload.instantIndex].time;
13324
+ const newTime = payload.time;
13325
+ t.instants[payload.instantIndex].time = newTime;
13326
+ emit("instantUpdate", {
13327
+ task: JSON.parse(JSON.stringify(t)),
13328
+ instant: JSON.parse(
13329
+ JSON.stringify(t.instants[payload.instantIndex])
13330
+ ),
13331
+ index: payload.instantIndex
13332
+ });
13299
13333
  emit("taskUpdate", JSON.parse(JSON.stringify(t)));
13334
+ if (currentTime.value && oldTime && newTime) {
13335
+ const currentT = new Date(currentTime.value).getTime();
13336
+ const t1 = new Date(oldTime).getTime();
13337
+ const t2 = new Date(newTime).getTime();
13338
+ const minT = Math.min(t1, t2);
13339
+ const maxT = Math.max(t1, t2);
13340
+ if (currentT >= minT && currentT <= maxT) {
13341
+ emit("task-enter", [
13342
+ { task: t, instant: t.instants[payload.instantIndex] }
13343
+ ]);
13344
+ }
13345
+ }
13300
13346
  return true;
13301
13347
  }
13302
13348
  }
@@ -13648,8 +13694,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13648
13694
  };
13649
13695
  }
13650
13696
  });
13651
- const CesiumGantt_vue_vue_type_style_index_0_scoped_87a98505_lang = "";
13652
- const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-87a98505"]]);
13697
+ const CesiumGantt_vue_vue_type_style_index_0_scoped_f03f42e8_lang = "";
13698
+ const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f03f42e8"]]);
13653
13699
  class ViewportRoam {
13654
13700
  constructor(viewer, data, intervals) {
13655
13701
  __publicField(this, "viewer");