sortable-lane-schedule

Description and templates for SortableJS drag-and-drop use: intention-pool priority ordering, kanban swimlane and card cross-column dragging, and schedule ordering. Covers guidance points for Vue 3 list reorder, multi-container group drag, payload sync, and persistence; used when the user asks about drag-and-drop sorting, Sortable, intention-pool priority, kanban swimlanes, card cross-column drag, or schedule ordering.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "sortable-lane-schedule" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-b025cbce088db0c01f943e0d9d2448a1177d6a02c55094ff47ee5a172d2d09d2. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/sortable-lane-schedule before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Description and templates for SortableJS drag-and-drop use: intention-pool priority ordering, kanban swimlane and card cross-column dragging, and schedule ordering. Covers guidance points for Vue 3 list reorder, multi-container group drag, payload sync, and persistence; used when the user asks about drag-and-drop sorting, Sortable, intention-pool priority, kanban swimlanes, card cross-column drag, or schedule ordering.

0 Downloads

Introduction source: third_party · user_f1b049da · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: sortable-lane-schedule
description: >-
  Use when implementing SortableJS drag-and-drop for intention-pool priority
  ordering or kanban swimlane scheduling, or when the user asks for 拖拽排序、
  Sortable、意向池优先级、看板泳道、卡片跨列拖拽、排程排序。 Guides Vue 3 list
  reorder, multi-container group drag, payload sync, and persistence.

Sortable Lane Schedule(拖拽排序 / 泳道排程)

用 SortableJS(本仓库常见依赖 sortablejs)实现两类交互:

  1. 意向池优先级:单列表纵向拖拽,改 priority / sort
  2. 看板泳道排程:多容器(泳道)互拖,改 laneId + 列内顺序

何时启用

  • 意向池、线索池、待办池需要「拖一下就改优先级」
  • 看板 / 阶段泳道需要跨列拖卡片排程
  • 用户点名 Sortable、拖拽排序、泳道拖拽

硬约束

  1. 数据源是真相:DOM 顺序变了必须同步到数组(splice / 重写 sort),不能只动 DOM。
  2. 拖完必落库或可撤销:onEnd 后调用保存 API,或提供 Undo;禁止静默只改本地。
  3. 句柄优先:复杂卡片用 .drag-handle,避免与按钮、链接、输入框抢事件(filter / handle)。
  4. 跨泳道用同一 group:意向池单列用独立 group 名;看板多列共享 group: 'kanban'(或等价)。
  5. 销毁防泄漏:组件 onBeforeUnmount 调用 sortable.destroy()。
  6. 触摸与无障碍:移动端可开 forceFallback(按需);关键操作保留非拖拽入口(上移/下移按钮可选)。

标准工作流

Sortable Lane Schedule
- [ ] 确认已依赖 sortablejs(及 @types/sortablejs)
- [ ] 场景分流:单列优先级 / 多列泳道
- [ ] 绑定容器 ref + Sortable.create
- [ ] onEnd:重排数组 + 写回 priority/laneId
- [ ] 持久化(API / store)+ 失败回滚
- [ ] 卸载 destroy
- [ ] 验收:拖拽、跨列、点按钮仍可用

Step 1:依赖

npm i sortablejs
npm i -D @types/sortablejs
import Sortable from 'sortablejs';

Step 2A:意向池优先级(单列表)

function bindPriorityList(el: HTMLElement, items: Ref<PoolItem[]>, save: () => Promise<void>) {
  return Sortable.create(el, {
    animation: 150,
    handle: '.drag-handle',
    draggable: '.pool-row',
    ghostClass: 'is-ghost',
    chosenClass: 'is-chosen',
    onEnd: async (evt) => {
      const { oldIndex, newIndex } = evt;
      if (oldIndex == null || newIndex == null || oldIndex === newIndex) return;
      const next = items.value.slice();
      const [moved] = next.splice(oldIndex, 1);
      next.splice(newIndex, 0, moved);
      items.value = next.map((row, i) => ({ ...row, priority: i + 1 }));
      try {
        await save();
      } catch {
        // 失败:重新拉列表回滚
      }
    },
  });
}

语义:priority 越小越靠前(或按产品约定;Skill 内保持一种并写进 README)。

Step 2B:看板泳道(多容器)

每条泳道一个容器,共享 group:

function bindLane(el: HTMLElement, laneId: string, board: Ref<LaneCard[]>, persist: () => Promise<void>) {
  return Sortable.create(el, {
    group: 'kanban-lanes',
    animation: 150,
    handle: '.drag-handle',
    draggable: '.lane-card',
    emptyInsertThreshold: 24,
    onAdd: (evt) => syncBoardFromDom(board), // 或按 evt 精确改 laneId
    onUpdate: () => syncBoardFromDom(board),
    onEnd: async () => {
      await persist();
    },
  });
}

跨列时至少更新:

  • card.laneId = targetLaneId(阶段 / 负责人泳道)
  • 目标列内 sort / order 重排
  • 源列剩余项 order 重排

Step 3:从事件精确改数据(推荐)

避免「读 DOM 猜顺序」出错时,用索引法:

onEnd(evt) {
  const fromLane = evt.from.dataset.laneId!;
  const toLane = evt.to.dataset.laneId!;
  const oldIndex = evt.oldIndex!;
  const newIndex = evt.newIndex!;
  moveCard({ fromLane, toLane, oldIndex, newIndex });
}

moveCard 内操作同一份 board 状态,再 persist()。

Step 4:Vue 3 生命周期

let sortable: Sortable | null = null;
onMounted(() => {
  if (listRef.value) sortable = bindPriorityList(listRef.value, items, saveOrder);
});
onBeforeUnmount(() => {
  sortable?.destroy();
  sortable = null;
});

多泳道:用 Map<string, Sortable>,卸载时全部 destroy。

意向池 vs 泳道对照

维度 意向池优先级 看板泳道排程
容器数 1 N(每泳道 1 个)
group 可省略或独占名 必须相同才能互拖
写入字段 priority / sort laneId + sort
空列 少见 需 min-height + emptyInsertThreshold

反模式

禁止 原因
只 Sortable.create 不改数组 刷新后顺序丢失 / Vue 抽风
在 onMove 里打重度 API 拖拽卡顿
整卡可拖且无 filter 点不开详情/按钮
泳道 group 名不一致 无法跨列
忘记 destroy 重复绑定、幽灵拖拽

Agent 交付检查

  • [ ] 单列或/与多列场景按需求实现
  • [ ] onEnd 后数据与展示一致
  • [ ] 有保存或明确的本地持久化策略
  • [ ] 句柄/过滤不挡业务点击
  • [ ] 卸载已 destroy

附加资源

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • SortableJS 拖拽排序与看板泳道排程是前端开发高频刚需场景
  • 提供单列优先级与多列泳道两种典型实现方案
  • 覆盖 Vue 3 完整生命周期与数据同步最佳实践
Trigger Precision90/100

Highlights

  • 中英文关键词覆盖全面(拖拽排序、Sortable、意向池、看板泳道等)
  • 触发边界清晰,能有效命中目标用户场景
Structure and Standards95/100

Areas to improve

  • description写错位置 Reported severity: Minor

    顶层 frontmatter 中 description 为空,实际描述内容在 skill_body 内部

    Recommendation: 将 description 内容移至顶层 frontmatter

  • 缺少When to Use显式章节 Reported severity: Minor

    未使用显式 'When to Use' 章节标题,但相关内容已覆盖

    Recommendation: 建议增加显式 'When to Use' 章节以提升可读性

Highlights

  • 标准工作流 checklist 清晰明确
  • Step 1~4 分步指导完整,含端到端代码示例
  • frontmatter 完整,文档结构规范
Execution Reliability90/100

Areas to improve

  • 引用文件缺失 Reported severity: Minor

    SKILL.md 引用了 reference.md 和 templates/vue-pool-and-board.md 但未传入

    Recommendation: 请补充被引用的文件,或移除引用链接

Highlights

  • 工具来源明确(sortablejs),参数配置正确
  • 覆盖主要异常处理(失败回滚、destroy 防泄漏)
  • 提供持久化策略与卸载清理机制
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 48, 49

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.