chbim-time-axis-v2 0.0.8 → 0.0.11
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/README.md +228 -129
- package/dist/chbim-time-axis-v2.es.js +141 -42
- package/dist/chbim-time-axis-v2.umd.js +1 -1
- package/dist/components/CesiumGantt.vue.d.ts +21 -0
- package/dist/components/TimelineChart.vue.d.ts +22 -1
- package/dist/components/types.d.ts +9 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -11823,7 +11823,7 @@ const _hoisted_4$1 = ["onMouseenter", "onContextmenu"];
|
|
|
11823
11823
|
const _hoisted_5$1 = ["onMousedown", "onContextmenu"];
|
|
11824
11824
|
const _hoisted_6$1 = ["onMousedown"];
|
|
11825
11825
|
const _hoisted_7$1 = {
|
|
11826
|
-
key:
|
|
11826
|
+
key: 0,
|
|
11827
11827
|
class: "barLabel"
|
|
11828
11828
|
};
|
|
11829
11829
|
const _hoisted_8$1 = ["onMousedown"];
|
|
@@ -11865,7 +11865,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
11865
11865
|
}
|
|
11866
11866
|
});
|
|
11867
11867
|
resizeObserver.observe(containerRef.value);
|
|
11868
|
-
containerRef.value.addEventListener("wheel", handleWheelNative, {
|
|
11868
|
+
containerRef.value.addEventListener("wheel", handleWheelNative, {
|
|
11869
|
+
passive: false
|
|
11870
|
+
});
|
|
11869
11871
|
}
|
|
11870
11872
|
});
|
|
11871
11873
|
onUnmounted(() => {
|
|
@@ -11940,7 +11942,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
11940
11942
|
return;
|
|
11941
11943
|
const deltaPixels = e.clientX - resizeStartX.value;
|
|
11942
11944
|
const deltaTime = deltaPixels * props.scale;
|
|
11943
|
-
const taskItem = flatTasks.value.find(
|
|
11945
|
+
const taskItem = flatTasks.value.find(
|
|
11946
|
+
(item) => item.task.id === resizeTaskId.value
|
|
11947
|
+
);
|
|
11944
11948
|
if (taskItem) {
|
|
11945
11949
|
let newStart = resizeInitialStart.value;
|
|
11946
11950
|
let newEnd = resizeInitialEnd.value;
|
|
@@ -12011,7 +12015,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12011
12015
|
const incrementalPixels = currentClientX - dragLastX.value;
|
|
12012
12016
|
const incrementalTime = incrementalPixels * props.scale;
|
|
12013
12017
|
dragLastX.value = currentClientX;
|
|
12014
|
-
const taskItem = flatTasks.value.find(
|
|
12018
|
+
const taskItem = flatTasks.value.find(
|
|
12019
|
+
(item) => item.task.id === dragTaskId.value
|
|
12020
|
+
);
|
|
12015
12021
|
if (taskItem) {
|
|
12016
12022
|
if (taskItem.task.type === "group") {
|
|
12017
12023
|
if (incrementalTime !== 0) {
|
|
@@ -12208,7 +12214,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12208
12214
|
document.removeEventListener("mousemove", handleTimeDragMove);
|
|
12209
12215
|
document.removeEventListener("mouseup", handleTimeDragEnd);
|
|
12210
12216
|
};
|
|
12211
|
-
const totalWidth = computed(
|
|
12217
|
+
const totalWidth = computed(
|
|
12218
|
+
() => (props.viewEndTime - props.viewStartTime) / props.scale
|
|
12219
|
+
);
|
|
12212
12220
|
const getPosition = (timeIso) => {
|
|
12213
12221
|
const t = dayjs(timeIso).valueOf();
|
|
12214
12222
|
return (t - props.viewStartTime) / props.scale;
|
|
@@ -12252,7 +12260,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12252
12260
|
const tasksEndX = (maxTaskEnd - props.viewStartTime) / props.scale;
|
|
12253
12261
|
const currentScrollEnd = scrollLeft.value + containerWidth.value;
|
|
12254
12262
|
const neededWidthForBuffer = currentScrollEnd + containerWidth.value * 0.6;
|
|
12255
|
-
const nominalWidth = Math.max(
|
|
12263
|
+
const nominalWidth = Math.max(
|
|
12264
|
+
Math.min(totalWidth.value, 3e7),
|
|
12265
|
+
containerWidth.value
|
|
12266
|
+
);
|
|
12256
12267
|
const widthWithTasks = Math.max(nominalWidth, tasksEndX);
|
|
12257
12268
|
return Math.max(widthWithTasks, neededWidthForBuffer);
|
|
12258
12269
|
});
|
|
@@ -12291,7 +12302,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12291
12302
|
name: b.name || "",
|
|
12292
12303
|
color: b.color,
|
|
12293
12304
|
startTime: b.startTime,
|
|
12294
|
-
endTime: b.endTime
|
|
12305
|
+
endTime: b.endTime,
|
|
12306
|
+
attr: b.attr,
|
|
12307
|
+
class: b.class
|
|
12295
12308
|
});
|
|
12296
12309
|
}
|
|
12297
12310
|
});
|
|
@@ -12306,7 +12319,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12306
12319
|
id: i.id,
|
|
12307
12320
|
name: i.name || "",
|
|
12308
12321
|
color: i.color,
|
|
12309
|
-
time: i.time
|
|
12322
|
+
time: i.time,
|
|
12323
|
+
attr: i.attr,
|
|
12324
|
+
class: i.class
|
|
12310
12325
|
});
|
|
12311
12326
|
}
|
|
12312
12327
|
});
|
|
@@ -12436,7 +12451,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12436
12451
|
}
|
|
12437
12452
|
const endTimeVal = visibleEndTime + bufferTime;
|
|
12438
12453
|
const unit = bestStep.unit;
|
|
12439
|
-
const useMathLoop = ["second", "minute", "hour", "day"].includes(
|
|
12454
|
+
const useMathLoop = ["second", "minute", "hour", "day"].includes(
|
|
12455
|
+
bestStep.unit
|
|
12456
|
+
);
|
|
12440
12457
|
let currentVal = t.valueOf();
|
|
12441
12458
|
const stepDuration = getDuration(bestStep.step, bestStep.unit);
|
|
12442
12459
|
while (currentVal < endTimeVal) {
|
|
@@ -12577,7 +12594,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12577
12594
|
style: normalizeStyle({ top: bar.top + "px", height: "30px" }),
|
|
12578
12595
|
onMouseenter: ($event) => _ctx.$emit("row-mouseenter", bar.id),
|
|
12579
12596
|
onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("row-mouseleave")),
|
|
12580
|
-
onContextmenu: withModifiers(
|
|
12597
|
+
onContextmenu: withModifiers(
|
|
12598
|
+
(e) => _ctx.$emit("row-contextmenu", {
|
|
12599
|
+
event: e,
|
|
12600
|
+
task: bar.originalTask,
|
|
12601
|
+
time: getTimeFromEvent(e)
|
|
12602
|
+
}),
|
|
12603
|
+
["stop", "prevent"]
|
|
12604
|
+
)
|
|
12581
12605
|
}, [
|
|
12582
12606
|
bar.limitLeft !== void 0 ? (openBlock(), createElementBlock("div", {
|
|
12583
12607
|
key: 0,
|
|
@@ -12589,31 +12613,46 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12589
12613
|
}, null, 4)) : createCommentVNode("", true),
|
|
12590
12614
|
bar.hasMainBar && bar.originalTask.type !== "block" && bar.originalTask.type !== "instant" ? (openBlock(), createElementBlock("div", {
|
|
12591
12615
|
key: 1,
|
|
12592
|
-
class: "taskBar draggable",
|
|
12616
|
+
class: normalizeClass(["taskBar draggable", bar.originalTask.class]),
|
|
12593
12617
|
style: normalizeStyle({
|
|
12594
12618
|
left: bar.left + "px",
|
|
12595
12619
|
width: bar.width + "px",
|
|
12596
12620
|
backgroundColor: bar.color
|
|
12597
12621
|
}),
|
|
12598
12622
|
onMousedown: (e) => handleDragStart(e, bar.originalTask),
|
|
12599
|
-
onContextmenu: withModifiers(
|
|
12623
|
+
onContextmenu: withModifiers(
|
|
12624
|
+
(e) => _ctx.$emit("bar-contextmenu", {
|
|
12625
|
+
event: e,
|
|
12626
|
+
task: bar.originalTask,
|
|
12627
|
+
time: getTimeFromEvent(e)
|
|
12628
|
+
}),
|
|
12629
|
+
["stop", "prevent"]
|
|
12630
|
+
)
|
|
12600
12631
|
}, [
|
|
12601
12632
|
bar.originalTask.type !== "group" ? (openBlock(), createElementBlock("div", {
|
|
12602
12633
|
key: 0,
|
|
12603
12634
|
class: "resize-handle left",
|
|
12604
|
-
onMousedown: withModifiers(
|
|
12635
|
+
onMousedown: withModifiers(
|
|
12636
|
+
(e) => handleResizeStart(e, bar.originalTask, "left"),
|
|
12637
|
+
["stop"]
|
|
12638
|
+
)
|
|
12605
12639
|
}, null, 40, _hoisted_6$1)) : createCommentVNode("", true),
|
|
12606
|
-
|
|
12640
|
+
renderSlot(_ctx.$slots, "barContent", { bar }, () => [
|
|
12641
|
+
bar.width > 50 ? (openBlock(), createElementBlock("span", _hoisted_7$1, toDisplayString(bar.name), 1)) : createCommentVNode("", true)
|
|
12642
|
+
], true),
|
|
12607
12643
|
bar.originalTask.type !== "group" ? (openBlock(), createElementBlock("div", {
|
|
12608
|
-
key:
|
|
12644
|
+
key: 1,
|
|
12609
12645
|
class: "resize-handle right",
|
|
12610
|
-
onMousedown: withModifiers(
|
|
12646
|
+
onMousedown: withModifiers(
|
|
12647
|
+
(e) => handleResizeStart(e, bar.originalTask, "right"),
|
|
12648
|
+
["stop"]
|
|
12649
|
+
)
|
|
12611
12650
|
}, null, 40, _hoisted_8$1)) : createCommentVNode("", true)
|
|
12612
|
-
],
|
|
12651
|
+
], 46, _hoisted_5$1)) : createCommentVNode("", true),
|
|
12613
12652
|
bar.originalTask.type === "block" && bar.blocks ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(bar.blocks, (blk, idx) => {
|
|
12614
12653
|
return openBlock(), createElementBlock("div", {
|
|
12615
12654
|
key: idx,
|
|
12616
|
-
class: "taskBar draggable",
|
|
12655
|
+
class: normalizeClass(["taskBar draggable", blk.class]),
|
|
12617
12656
|
style: normalizeStyle({
|
|
12618
12657
|
left: blk.left + "px",
|
|
12619
12658
|
width: blk.width + "px",
|
|
@@ -12622,38 +12661,66 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12622
12661
|
}),
|
|
12623
12662
|
title: blk.name,
|
|
12624
12663
|
onMousedown: (e) => handleBlockDragStart(e, bar.originalTask, idx),
|
|
12625
|
-
onContextmenu: withModifiers(
|
|
12664
|
+
onContextmenu: withModifiers(
|
|
12665
|
+
(e) => _ctx.$emit("bar-contextmenu", {
|
|
12666
|
+
event: e,
|
|
12667
|
+
task: bar.originalTask,
|
|
12668
|
+
block: blk,
|
|
12669
|
+
time: getTimeFromEvent(e)
|
|
12670
|
+
}),
|
|
12671
|
+
["stop", "prevent"]
|
|
12672
|
+
)
|
|
12626
12673
|
}, [
|
|
12627
12674
|
createElementVNode("div", {
|
|
12628
12675
|
class: "resize-handle left",
|
|
12629
|
-
onMousedown: withModifiers(
|
|
12676
|
+
onMousedown: withModifiers(
|
|
12677
|
+
(e) => handleBlockResizeStart(e, bar.originalTask, idx, "left"),
|
|
12678
|
+
["stop"]
|
|
12679
|
+
)
|
|
12630
12680
|
}, null, 40, _hoisted_10$1),
|
|
12631
|
-
|
|
12681
|
+
renderSlot(_ctx.$slots, "blockContent", {
|
|
12682
|
+
block: blk,
|
|
12683
|
+
task: bar.originalTask
|
|
12684
|
+
}, () => [
|
|
12685
|
+
blk.width > 50 ? (openBlock(), createElementBlock("span", _hoisted_11$1, toDisplayString(blk.name), 1)) : createCommentVNode("", true)
|
|
12686
|
+
], true),
|
|
12632
12687
|
createElementVNode("div", {
|
|
12633
12688
|
class: "resize-handle right",
|
|
12634
|
-
onMousedown: withModifiers(
|
|
12689
|
+
onMousedown: withModifiers(
|
|
12690
|
+
(e) => handleBlockResizeStart(e, bar.originalTask, idx, "right"),
|
|
12691
|
+
["stop"]
|
|
12692
|
+
)
|
|
12635
12693
|
}, null, 40, _hoisted_12$1)
|
|
12636
|
-
],
|
|
12694
|
+
], 46, _hoisted_9$1);
|
|
12637
12695
|
}), 128)) : createCommentVNode("", true),
|
|
12638
12696
|
bar.instants ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(bar.instants, (inst, idx) => {
|
|
12639
12697
|
return openBlock(), createElementBlock("div", {
|
|
12640
12698
|
key: inst.id,
|
|
12641
|
-
class: "instantTaskPoint draggable",
|
|
12699
|
+
class: normalizeClass(["instantTaskPoint draggable", inst.class]),
|
|
12642
12700
|
style: normalizeStyle({
|
|
12643
12701
|
left: inst.left - 10 + "px",
|
|
12644
|
-
/* 居中圆圈 */
|
|
12645
|
-
width: "18px",
|
|
12646
|
-
height: "18px",
|
|
12647
12702
|
backgroundColor: inst.color || "#ffffff",
|
|
12648
|
-
|
|
12649
|
-
borderRadius: "50%",
|
|
12650
|
-
position: "absolute",
|
|
12651
|
-
cursor: "pointer"
|
|
12703
|
+
position: "absolute"
|
|
12652
12704
|
}),
|
|
12653
|
-
title: `${inst.name ? inst.name + "\n" : ""}${unref(dayjs)(
|
|
12705
|
+
title: `${inst.name ? inst.name + "\n" : ""}${unref(dayjs)(
|
|
12706
|
+
inst.time
|
|
12707
|
+
).format("YYYY-MM-DD")}`,
|
|
12654
12708
|
onMousedown: (e) => handleInstantDragStart(e, bar.originalTask, idx),
|
|
12655
|
-
onContextmenu: withModifiers(
|
|
12656
|
-
|
|
12709
|
+
onContextmenu: withModifiers(
|
|
12710
|
+
(e) => _ctx.$emit("bar-contextmenu", {
|
|
12711
|
+
event: e,
|
|
12712
|
+
task: bar.originalTask,
|
|
12713
|
+
instant: inst,
|
|
12714
|
+
time: getTimeFromEvent(e)
|
|
12715
|
+
}),
|
|
12716
|
+
["stop", "prevent"]
|
|
12717
|
+
)
|
|
12718
|
+
}, [
|
|
12719
|
+
renderSlot(_ctx.$slots, "instantContent", {
|
|
12720
|
+
instant: inst,
|
|
12721
|
+
task: bar.originalTask
|
|
12722
|
+
}, void 0, true)
|
|
12723
|
+
], 46, _hoisted_13$1);
|
|
12657
12724
|
}), 128)) : createCommentVNode("", true)
|
|
12658
12725
|
], 46, _hoisted_4$1);
|
|
12659
12726
|
}), 128))
|
|
@@ -12670,8 +12737,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
12670
12737
|
};
|
|
12671
12738
|
}
|
|
12672
12739
|
});
|
|
12673
|
-
const
|
|
12674
|
-
const TimelineChart = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
12740
|
+
const TimelineChart_vue_vue_type_style_index_0_scoped_7a1f218b_lang = "";
|
|
12741
|
+
const TimelineChart = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7a1f218b"]]);
|
|
12675
12742
|
const _hoisted_1 = { class: "toolbar" };
|
|
12676
12743
|
const _hoisted_2 = { style: { "flex": "1", "display": "flex", "align-items": "center", "height": "100%" } };
|
|
12677
12744
|
const _hoisted_3 = { class: "left-controls" };
|
|
@@ -12729,8 +12796,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12729
12796
|
const contextMenuTask = ref(null);
|
|
12730
12797
|
const contextMenuBlock = ref(null);
|
|
12731
12798
|
const contextMenuInstant = ref(null);
|
|
12799
|
+
const contextMenuTime = ref(null);
|
|
12732
12800
|
const openBarContextMenu = (payload) => {
|
|
12733
|
-
const { event, task, block, instant } = payload;
|
|
12801
|
+
const { event, task, block, instant, time } = payload;
|
|
12734
12802
|
event.preventDefault();
|
|
12735
12803
|
event.stopPropagation();
|
|
12736
12804
|
closeBuiltinMenu();
|
|
@@ -12749,12 +12817,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12749
12817
|
contextMenuTask.value = task;
|
|
12750
12818
|
contextMenuBlock.value = block || null;
|
|
12751
12819
|
contextMenuInstant.value = instant || null;
|
|
12820
|
+
contextMenuTime.value = time || null;
|
|
12752
12821
|
};
|
|
12753
12822
|
const closeContextMenu = () => {
|
|
12754
12823
|
contextMenuVisible.value = false;
|
|
12755
12824
|
contextMenuTask.value = null;
|
|
12756
12825
|
contextMenuBlock.value = null;
|
|
12757
12826
|
contextMenuInstant.value = null;
|
|
12827
|
+
contextMenuTime.value = null;
|
|
12758
12828
|
};
|
|
12759
12829
|
const builtinMenuVisible = ref(false);
|
|
12760
12830
|
const builtinMenuStyle = ref({});
|
|
@@ -12937,8 +13007,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12937
13007
|
const processedChildren = process(rawChildren);
|
|
12938
13008
|
let minTime = Number.MAX_SAFE_INTEGER;
|
|
12939
13009
|
let maxTime = Number.MIN_SAFE_INTEGER;
|
|
12940
|
-
if (
|
|
12941
|
-
|
|
13010
|
+
if (processedChildren.length > 0) {
|
|
13011
|
+
processedChildren.forEach((child) => {
|
|
12942
13012
|
const start = new Date(child.startTime).getTime();
|
|
12943
13013
|
const end = new Date(child.endTime).getTime();
|
|
12944
13014
|
if (!isNaN(start)) {
|
|
@@ -13459,7 +13529,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13459
13529
|
onRowMouseleave: handleRowMouseLeave,
|
|
13460
13530
|
onBarContextmenu: openBarContextMenu,
|
|
13461
13531
|
onRowContextmenu: openRowContextMenu
|
|
13462
|
-
},
|
|
13532
|
+
}, createSlots({ _: 2 }, [
|
|
13533
|
+
_ctx.$slots.barContent ? {
|
|
13534
|
+
name: "barContent",
|
|
13535
|
+
fn: withCtx(({ bar }) => [
|
|
13536
|
+
renderSlot(_ctx.$slots, "barContent", { bar }, void 0, true)
|
|
13537
|
+
]),
|
|
13538
|
+
key: "0"
|
|
13539
|
+
} : void 0,
|
|
13540
|
+
_ctx.$slots.blockContent ? {
|
|
13541
|
+
name: "blockContent",
|
|
13542
|
+
fn: withCtx(({ block, task }) => [
|
|
13543
|
+
renderSlot(_ctx.$slots, "blockContent", {
|
|
13544
|
+
block,
|
|
13545
|
+
task
|
|
13546
|
+
}, void 0, true)
|
|
13547
|
+
]),
|
|
13548
|
+
key: "1"
|
|
13549
|
+
} : void 0,
|
|
13550
|
+
_ctx.$slots.instantContent ? {
|
|
13551
|
+
name: "instantContent",
|
|
13552
|
+
fn: withCtx(({ instant, task }) => [
|
|
13553
|
+
renderSlot(_ctx.$slots, "instantContent", {
|
|
13554
|
+
instant,
|
|
13555
|
+
task
|
|
13556
|
+
}, void 0, true)
|
|
13557
|
+
]),
|
|
13558
|
+
key: "2"
|
|
13559
|
+
} : void 0
|
|
13560
|
+
]), 1032, ["tasks", "currentTime", "scale", "viewStartTime", "viewEndTime", "hoveredTaskId"])
|
|
13463
13561
|
])
|
|
13464
13562
|
], 512), [
|
|
13465
13563
|
[vShow, !isMinimized.value]
|
|
@@ -13475,6 +13573,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13475
13573
|
task: contextMenuTask.value,
|
|
13476
13574
|
block: contextMenuBlock.value,
|
|
13477
13575
|
instant: contextMenuInstant.value,
|
|
13576
|
+
time: contextMenuTime.value,
|
|
13478
13577
|
close: closeContextMenu
|
|
13479
13578
|
}, () => [
|
|
13480
13579
|
contextMenuTask.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -13517,8 +13616,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13517
13616
|
};
|
|
13518
13617
|
}
|
|
13519
13618
|
});
|
|
13520
|
-
const
|
|
13521
|
-
const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
13619
|
+
const CesiumGantt_vue_vue_type_style_index_0_scoped_ea905489_lang = "";
|
|
13620
|
+
const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ea905489"]]);
|
|
13522
13621
|
CesiumGantt.install = (app) => {
|
|
13523
13622
|
app.component("CesiumGantt", CesiumGantt);
|
|
13524
13623
|
};
|