chbim-time-axis-v2 0.0.194 → 0.0.196
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
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12349
|
+
if (isVisible || task.type === "instant" || task.allowInstant) {
|
|
12350
|
+
const shouldRender = isVisible || task.type === "instant" || task.allowInstant;
|
|
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
|
|
12740
|
-
const TimelineChart = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
12745
|
+
const TimelineChart_vue_vue_type_style_index_0_scoped_77875d0b_lang = "";
|
|
12746
|
+
const TimelineChart = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-77875d0b"]]);
|
|
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,58 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12955
12962
|
{ immediate: true, deep: true }
|
|
12956
12963
|
);
|
|
12957
12964
|
const activeTaskIds = /* @__PURE__ */ new Set();
|
|
12958
|
-
|
|
12965
|
+
const tasksWithComputedData = computed(() => {
|
|
12966
|
+
const process = (list) => {
|
|
12967
|
+
return list.map((task) => {
|
|
12968
|
+
if (task.type === "group") {
|
|
12969
|
+
const group = task;
|
|
12970
|
+
const rawChildren = group.children || [];
|
|
12971
|
+
const processedChildren = process(rawChildren);
|
|
12972
|
+
let minTime = Number.MAX_SAFE_INTEGER;
|
|
12973
|
+
let maxTime = Number.MIN_SAFE_INTEGER;
|
|
12974
|
+
if (processedChildren.length > 0) {
|
|
12975
|
+
processedChildren.forEach((child) => {
|
|
12976
|
+
const start = new Date(child.startTime).getTime();
|
|
12977
|
+
const end = new Date(child.endTime).getTime();
|
|
12978
|
+
if (!isNaN(start)) {
|
|
12979
|
+
if (start < minTime)
|
|
12980
|
+
minTime = start;
|
|
12981
|
+
}
|
|
12982
|
+
if (!isNaN(end)) {
|
|
12983
|
+
if (end > maxTime)
|
|
12984
|
+
maxTime = end;
|
|
12985
|
+
}
|
|
12986
|
+
});
|
|
12987
|
+
}
|
|
12988
|
+
const calculatedStart = minTime !== Number.MAX_SAFE_INTEGER ? new Date(minTime).toISOString() : "";
|
|
12989
|
+
const calculatedEnd = maxTime !== Number.MIN_SAFE_INTEGER ? new Date(maxTime).toISOString() : "";
|
|
12990
|
+
const childrenWithWarnings = processedChildren.map((child) => {
|
|
12991
|
+
let warning = void 0;
|
|
12992
|
+
if (group.limitStartTime && dayjs(child.startTime).isBefore(dayjs(group.limitStartTime))) {
|
|
12993
|
+
warning = "开始时间早于分组限制";
|
|
12994
|
+
}
|
|
12995
|
+
if (group.limitEndTime && dayjs(child.endTime).isAfter(dayjs(group.limitEndTime))) {
|
|
12996
|
+
warning = warning ? warning + "; 结束时间晚于分组限制" : "结束时间晚于分组限制";
|
|
12997
|
+
}
|
|
12998
|
+
if (warning) {
|
|
12999
|
+
return { ...child, warning };
|
|
13000
|
+
}
|
|
13001
|
+
return child;
|
|
13002
|
+
});
|
|
13003
|
+
return {
|
|
13004
|
+
...group,
|
|
13005
|
+
startTime: calculatedStart,
|
|
13006
|
+
endTime: calculatedEnd,
|
|
13007
|
+
children: childrenWithWarnings,
|
|
13008
|
+
collapsed: collapsedGroups.value.has(group.id)
|
|
13009
|
+
};
|
|
13010
|
+
}
|
|
13011
|
+
return task;
|
|
13012
|
+
});
|
|
13013
|
+
};
|
|
13014
|
+
return process(localTasks.value);
|
|
13015
|
+
});
|
|
13016
|
+
const checkActiveTasks = (newTime, oldTime) => {
|
|
12959
13017
|
if (!newTime)
|
|
12960
13018
|
return;
|
|
12961
13019
|
const entered = [];
|
|
@@ -12979,14 +13037,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12979
13037
|
const inside = newTime >= task.startTime && newTime <= task.endTime;
|
|
12980
13038
|
if (inside && !activeTaskIds.has(task.id)) {
|
|
12981
13039
|
activeTaskIds.add(task.id);
|
|
12982
|
-
|
|
13040
|
+
if (task.type === "group") {
|
|
13041
|
+
entered.push({ task, group: task });
|
|
13042
|
+
} else {
|
|
13043
|
+
entered.push({ task });
|
|
13044
|
+
}
|
|
12983
13045
|
} else if (!inside && activeTaskIds.has(task.id)) {
|
|
12984
13046
|
activeTaskIds.delete(task.id);
|
|
12985
|
-
|
|
13047
|
+
if (task.type === "group") {
|
|
13048
|
+
left.push({ task, group: task });
|
|
13049
|
+
} else {
|
|
13050
|
+
left.push({ task });
|
|
13051
|
+
}
|
|
12986
13052
|
}
|
|
12987
13053
|
}
|
|
12988
13054
|
}
|
|
12989
|
-
if (oldTime && task.instants) {
|
|
13055
|
+
if (oldTime && oldTime !== newTime && task.instants) {
|
|
12990
13056
|
task.instants.forEach((inst) => {
|
|
12991
13057
|
const t = inst.time;
|
|
12992
13058
|
if (!t)
|
|
@@ -13001,12 +13067,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13001
13067
|
check(task.children);
|
|
13002
13068
|
});
|
|
13003
13069
|
};
|
|
13004
|
-
check(
|
|
13070
|
+
check(tasksWithComputedData.value);
|
|
13005
13071
|
if (entered.length > 0)
|
|
13006
13072
|
emit("task-enter", entered);
|
|
13007
13073
|
if (left.length > 0)
|
|
13008
13074
|
emit("task-leave", left);
|
|
13075
|
+
};
|
|
13076
|
+
watch(currentTime, (newTime, oldTime) => {
|
|
13077
|
+
checkActiveTasks(newTime, oldTime);
|
|
13009
13078
|
});
|
|
13079
|
+
watch(
|
|
13080
|
+
localTasks,
|
|
13081
|
+
() => {
|
|
13082
|
+
if (currentTime.value) {
|
|
13083
|
+
checkActiveTasks(currentTime.value, currentTime.value);
|
|
13084
|
+
}
|
|
13085
|
+
},
|
|
13086
|
+
{ deep: true }
|
|
13087
|
+
);
|
|
13010
13088
|
const handleToggleGroup = (id) => {
|
|
13011
13089
|
if (collapsedGroups.value.has(id)) {
|
|
13012
13090
|
collapsedGroups.value.delete(id);
|
|
@@ -13015,58 +13093,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13015
13093
|
}
|
|
13016
13094
|
};
|
|
13017
13095
|
const processedTasks = computed(() => {
|
|
13018
|
-
const
|
|
13096
|
+
const filterCollapsed = (list) => {
|
|
13019
13097
|
return list.map((task) => {
|
|
13020
13098
|
if (task.type === "group") {
|
|
13021
13099
|
const group = task;
|
|
13022
|
-
const rawChildren = group.children || [];
|
|
13023
|
-
const processedChildren = process(rawChildren);
|
|
13024
|
-
let minTime = Number.MAX_SAFE_INTEGER;
|
|
13025
|
-
let maxTime = Number.MIN_SAFE_INTEGER;
|
|
13026
|
-
if (processedChildren.length > 0) {
|
|
13027
|
-
processedChildren.forEach((child) => {
|
|
13028
|
-
const start = new Date(child.startTime).getTime();
|
|
13029
|
-
const end = new Date(child.endTime).getTime();
|
|
13030
|
-
if (!isNaN(start)) {
|
|
13031
|
-
if (start < minTime)
|
|
13032
|
-
minTime = start;
|
|
13033
|
-
}
|
|
13034
|
-
if (!isNaN(end)) {
|
|
13035
|
-
if (end > maxTime)
|
|
13036
|
-
maxTime = end;
|
|
13037
|
-
}
|
|
13038
|
-
});
|
|
13039
|
-
}
|
|
13040
|
-
const calculatedStart = minTime !== Number.MAX_SAFE_INTEGER ? new Date(minTime).toISOString() : "";
|
|
13041
|
-
const calculatedEnd = maxTime !== Number.MIN_SAFE_INTEGER ? new Date(maxTime).toISOString() : "";
|
|
13042
|
-
let displayChildren = processedChildren.map((child) => {
|
|
13043
|
-
let warning = void 0;
|
|
13044
|
-
if (group.limitStartTime && dayjs(child.startTime).isBefore(dayjs(group.limitStartTime))) {
|
|
13045
|
-
warning = "开始时间早于分组限制";
|
|
13046
|
-
}
|
|
13047
|
-
if (group.limitEndTime && dayjs(child.endTime).isAfter(dayjs(group.limitEndTime))) {
|
|
13048
|
-
warning = warning ? warning + "; 结束时间晚于分组限制" : "结束时间晚于分组限制";
|
|
13049
|
-
}
|
|
13050
|
-
if (warning) {
|
|
13051
|
-
return { ...child, warning };
|
|
13052
|
-
}
|
|
13053
|
-
return child;
|
|
13054
|
-
});
|
|
13055
13100
|
const isCollapsed = collapsedGroups.value.has(group.id);
|
|
13056
13101
|
return {
|
|
13057
13102
|
...group,
|
|
13058
|
-
|
|
13059
|
-
endTime: calculatedEnd,
|
|
13060
|
-
children: isCollapsed ? [] : displayChildren,
|
|
13061
|
-
// 如果折叠则隐藏子任务
|
|
13062
|
-
collapsed: isCollapsed
|
|
13063
|
-
// 传递折叠状态给 UI
|
|
13103
|
+
children: isCollapsed ? [] : filterCollapsed(group.children || [])
|
|
13064
13104
|
};
|
|
13065
13105
|
}
|
|
13066
13106
|
return task;
|
|
13067
13107
|
});
|
|
13068
13108
|
};
|
|
13069
|
-
return
|
|
13109
|
+
return filterCollapsed(tasksWithComputedData.value);
|
|
13070
13110
|
});
|
|
13071
13111
|
const fitToTasks = (tasks) => {
|
|
13072
13112
|
if (tasks.length === 0)
|
|
@@ -13219,7 +13259,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13219
13259
|
};
|
|
13220
13260
|
const handleZoom = (delta, zoomCenterPixels) => {
|
|
13221
13261
|
const newScaleRaw = scale.value * (delta > 0 ? 1.1 : 0.9);
|
|
13222
|
-
|
|
13262
|
+
let minDuration = 1e3 * 60 * 60;
|
|
13263
|
+
if (props.minZoomLevel === "minute") {
|
|
13264
|
+
minDuration = 1e3 * 60;
|
|
13265
|
+
} else if (props.minZoomLevel === "day") {
|
|
13266
|
+
minDuration = 1e3 * 60 * 60 * 24;
|
|
13267
|
+
}
|
|
13268
|
+
const MIN_SCALE = minDuration / 100;
|
|
13223
13269
|
const MAX_SCALE = 1e3 * 60 * 60 * 24 * 30;
|
|
13224
13270
|
const newScale = Math.max(MIN_SCALE, Math.min(newScaleRaw, MAX_SCALE));
|
|
13225
13271
|
const oldScale = scale.value;
|
|
@@ -13295,8 +13341,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13295
13341
|
for (const t of list) {
|
|
13296
13342
|
if (t.id === payload.taskId) {
|
|
13297
13343
|
if (t.instants && t.instants[payload.instantIndex]) {
|
|
13298
|
-
t.instants[payload.instantIndex].time
|
|
13344
|
+
const oldTime = t.instants[payload.instantIndex].time;
|
|
13345
|
+
const newTime = payload.time;
|
|
13346
|
+
t.instants[payload.instantIndex].time = newTime;
|
|
13347
|
+
emit("instantUpdate", {
|
|
13348
|
+
task: JSON.parse(JSON.stringify(t)),
|
|
13349
|
+
instant: JSON.parse(
|
|
13350
|
+
JSON.stringify(t.instants[payload.instantIndex])
|
|
13351
|
+
),
|
|
13352
|
+
index: payload.instantIndex
|
|
13353
|
+
});
|
|
13299
13354
|
emit("taskUpdate", JSON.parse(JSON.stringify(t)));
|
|
13355
|
+
if (currentTime.value && oldTime && newTime) {
|
|
13356
|
+
const currentT = new Date(currentTime.value).getTime();
|
|
13357
|
+
const t1 = new Date(oldTime).getTime();
|
|
13358
|
+
const t2 = new Date(newTime).getTime();
|
|
13359
|
+
const minT = Math.min(t1, t2);
|
|
13360
|
+
const maxT = Math.max(t1, t2);
|
|
13361
|
+
if (currentT >= minT && currentT <= maxT) {
|
|
13362
|
+
emit("task-enter", [
|
|
13363
|
+
{ task: t, instant: t.instants[payload.instantIndex] }
|
|
13364
|
+
]);
|
|
13365
|
+
}
|
|
13366
|
+
}
|
|
13300
13367
|
return true;
|
|
13301
13368
|
}
|
|
13302
13369
|
}
|
|
@@ -13648,8 +13715,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13648
13715
|
};
|
|
13649
13716
|
}
|
|
13650
13717
|
});
|
|
13651
|
-
const
|
|
13652
|
-
const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
13718
|
+
const CesiumGantt_vue_vue_type_style_index_0_scoped_1991ca92_lang = "";
|
|
13719
|
+
const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-1991ca92"]]);
|
|
13653
13720
|
class ViewportRoam {
|
|
13654
13721
|
constructor(viewer, data, intervals) {
|
|
13655
13722
|
__publicField(this, "viewer");
|