chbim-time-axis-v2 0.2.7 → 0.2.9

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 CHANGED
@@ -296,13 +296,13 @@ roamController.start();
296
296
 
297
297
  ### Props (属性)
298
298
 
299
- | 属性名 | 类型 | 必填 | 默认值 | 描述 |
300
- | :------------- | :-------------- | :--- | :------- | :------------------------------------------------------------------------- |
301
- | `tasks` | `GanttTask[]` | ✅ | `[]` | 任务数据源,支持 `v-model:tasks` 双向绑定。 |
302
- | `viewer` | `Cesium.Viewer` | ❌ | - | Cesium Viewer 实例。传入后组件会自动绑定时钟。 |
303
- | `clock` | `Cesium.Clock` | ❌ | - | 单独传入 Cesium Clock 实例。如果传入 `viewer`,则优先使用 `viewer.clock`。 |
304
- | `minZoomLevel` | `string` | ❌ | `"hour"` | 最小缩放层级。可选值:`"minute"` (分钟), `"hour"` (小时), `"day"` (天)。 |
305
- | `isLimitTime` | `boolean` | ❌ | `false` | 是否限制任务拖拽超出父级或全局限制范围。 |
299
+ | 属性名 | 类型 | 必填 | 默认值 | 描述 |
300
+ | :----------------- | :-------------- | :--- | :------- | :------------------------------------------------------------------------- |
301
+ | `tasks` | `GanttTask[]` | ✅ | `[]` | 任务数据源,支持 `v-model:tasks` 双向绑定。 |
302
+ | `viewer` | `Cesium.Viewer` | ❌ | - | Cesium Viewer 实例。传入后组件会自动绑定时钟。 |
303
+ | `clock` | `Cesium.Clock` | ❌ | - | 单独传入 Cesium Clock 实例。如果传入 `viewer`,则优先使用 `viewer.clock`。 |
304
+ | `minZoomLevel` | `string` | ❌ | `"hour"` | 最小缩放层级。可选值:`"minute"` (分钟), `"hour"` (小时), `"day"` (天)。 |
305
+ | `isLimitTime` | `boolean` | ❌ | `false` | 是否限制任务拖拽超出父级或全局限制范围。 |
306
306
  | `projectStartTime` | `string` | ❌ | - | 项目总开始时间(ISO 8601)。设置后,此时间之前的区域将显示为灰色背景。 |
307
307
  | `projectEndTime` | `string` | ❌ | - | 项目总结束时间(ISO 8601)。设置后,此时间之后的区域将显示为灰色背景。 |
308
308
  | `enableSnap` | `boolean` | ❌ | `true` | 是否启用拖拽吸附功能。 |
@@ -317,6 +317,7 @@ roamController.start();
317
317
  | `task-leave` | `items: { task, block?, instant?, group? }[]` | 当时间轴播放**离开**任务/块/瞬时点/分组的时间范围时触发。 |
318
318
  | `blockUpdate` | `{ task, block, index }` | 当块状任务中的某个时间块发生更新(如拖拽调整)时触发。 |
319
319
  | `instantUpdate` | `{ task, instant, index }` | 当瞬时点发生更新(如拖拽调整)时触发。 |
320
+ | `select` | `{ task }` | 当选中任务时触发。如果取消选中,则 `task` 为 `undefined`。 |
320
321
  | `add` | `parentId: string` | 点击分组行的 "+" 按钮时触发。 |
321
322
  | `delete` | `taskId: string` | 点击删除按钮时触发。 |
322
323
 
@@ -324,12 +325,12 @@ roamController.start();
324
325
 
325
326
  通过 `ref` 获取组件实例后可调用的方法:
326
327
 
327
- | 方法名 | 参数 | 描述 |
328
- | :--------------- | :--- | :--------------------------------------------------------------- |
329
- | `toggleMaximize` | - | 切换最大化模式 |
330
- | `toggleMinimize` | - | 切换最小化模式 |
331
- | `getSnapshot` | - | 获取当前时间点的快照(包含当前时间、活跃任务、块、瞬时点和分组) |
332
- | `handleResetView`| - | 自动调整视图范围以适应任务列表。如果没有任务,则尝试适应项目起止时间;如果也没有,则以当前时间为中心。 |
328
+ | 方法名 | 参数 | 描述 |
329
+ | :---------------- | :--- | :----------------------------------------------------------------------------------------------------- |
330
+ | `toggleMaximize` | - | 切换最大化模式 |
331
+ | `toggleMinimize` | - | 切换最小化模式 |
332
+ | `getSnapshot` | - | 获取当前时间点的快照(包含当前时间、活跃任务、块、瞬时点和分组) |
333
+ | `handleResetView` | - | 自动调整视图范围以适应任务列表。如果没有任务,则尝试适应项目起止时间;如果也没有,则以当前时间为中心。 |
333
334
 
334
335
  ### Slots (插槽)
335
336
 
@@ -13076,9 +13076,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13076
13076
  isLimitTime: { type: Boolean },
13077
13077
  projectStartTime: {},
13078
13078
  projectEndTime: {},
13079
- enableSnap: { type: Boolean }
13079
+ enableSnap: { type: Boolean },
13080
+ selectedTaskId: {}
13080
13081
  },
13081
- emits: ["taskUpdate", "update:tasks", "add", "delete", "task-enter", "task-leave", "blockUpdate", "instantUpdate"],
13082
+ emits: ["taskUpdate", "update:tasks", "update:selectedTaskId", "select", "add", "delete", "task-enter", "task-leave", "blockUpdate", "instantUpdate"],
13082
13083
  setup(__props, { expose: __expose, emit: __emit }) {
13083
13084
  const slots = useSlots();
13084
13085
  const props = __props;
@@ -13214,9 +13215,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13214
13215
  const handleRowMouseLeave = () => {
13215
13216
  hoveredTaskId.value = null;
13216
13217
  };
13217
- const selectedTaskId = ref(null);
13218
+ const internalSelectedTaskId = ref(null);
13219
+ const selectedTaskId = computed({
13220
+ get: () => props.selectedTaskId !== void 0 ? props.selectedTaskId : internalSelectedTaskId.value,
13221
+ set: (val) => {
13222
+ internalSelectedTaskId.value = val;
13223
+ emit("update:selectedTaskId", val);
13224
+ }
13225
+ });
13218
13226
  const handleRowClick = (id) => {
13219
13227
  selectedTaskId.value = id;
13228
+ const findTask = (list, targetId) => {
13229
+ for (const t of list) {
13230
+ if (t.id === targetId)
13231
+ return t;
13232
+ if (t.children) {
13233
+ const found = findTask(t.children, targetId);
13234
+ if (found)
13235
+ return found;
13236
+ }
13237
+ }
13238
+ return void 0;
13239
+ };
13240
+ const task = findTask(localTasks.value, id);
13241
+ emit("select", task);
13220
13242
  };
13221
13243
  const getInitialTime = () => {
13222
13244
  var _a;
@@ -14102,8 +14124,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14102
14124
  };
14103
14125
  }
14104
14126
  });
14105
- const CesiumGantt_vue_vue_type_style_index_0_scoped_fdeb98a9_lang = "";
14106
- const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-fdeb98a9"]]);
14127
+ const CesiumGantt_vue_vue_type_style_index_0_scoped_32655af0_lang = "";
14128
+ const CesiumGantt = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-32655af0"]]);
14107
14129
  class ViewportRoam {
14108
14130
  constructor(viewer, data, intervals) {
14109
14131
  __publicField(this, "viewer");