saibo-kanban 0.4.1 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1
4
+
5
+ - 表格去掉「编号」列(原始 id 不再展示)。
6
+ - 表头下加筛选行:类型 / 状态 / 范围;范围选项从现有数据生成。
7
+ - 列表改为滚动加载(每次 100 条,滚到底自动加载,另有「加载更多」兜底),显示总数。
8
+ - 列表上限从 200 提到 2000,已归档不再被截断。
9
+ - 导入默认跳过「节点说明」(CLI 加 `--include-notes` 才导入)。
10
+
11
+ ## 0.5.0
12
+
13
+ - 表格加表头(# / 编号 / 标题 / 类型 / 状态 / 范围 / 修订)和行序号。
14
+ - 归档条目默认隐藏,新增「显示归档 / 隐藏归档」切换;归档行淡化并带「已归档」徽标。
15
+ - 详情抽屉对归档条目显示「恢复」而不是「归档」。
16
+
3
17
  ## 0.4.1
4
18
 
5
19
  - 导入改为页面操作:看板面板 → 「导入 xlsx」→ 选文件 → 预览数量 → 确认导入。
package/bin/import.mjs CHANGED
@@ -62,5 +62,5 @@ const write = (item, note) => {
62
62
  };
63
63
  for (const item of plan.main) write(item, '导入:任务主表');
64
64
  for (const item of plan.rolling) write(item, '导入:长期滚动项');
65
- if (plan.notes) write(plan.notes, '导入:节点说明');
65
+ if (plan.notes && flags['include-notes'] === true) write(plan.notes, '导入:节点说明');
66
66
  console.log(`\n已导入 ${imported} 条,跳过重复 ${skipped} 条 → ${path.join(dataDir, 'records.jsonl')}`);
package/client.js CHANGED
@@ -72,6 +72,14 @@ window.__ModuleLoader__.load({
72
72
  .sk-sel { border:1px solid transparent; background:transparent; color:inherit; font:inherit; font-size:12px; border-radius:6px; padding:3px 4px; cursor:pointer; max-width:110px; }
73
73
  .sk-sel:hover { border-color:var(--dsw-alias-border-l1,#e6e7eb); background:var(--dsw-alias-bg-layer-1,#fff); }
74
74
  .sk-rev { width:44px; flex:none; text-align:right; font-size:11.5px; color:var(--dsw-alias-label-secondary,#6b7280); }
75
+ .sk-num { width:34px; flex:none; text-align:right; font-size:11.5px; color:var(--dsw-alias-label-secondary,#6b7280); }
76
+ .sk-th { background:var(--dsw-alias-bg-layer-2,#f7f8fa); font-size:11.5px; font-weight:600; color:var(--dsw-alias-label-secondary,#6b7280); position:sticky; top:0; z-index:1; }
77
+ .sk-filter { background:var(--dsw-alias-bg-layer-2,#fbfbfc); border-bottom:1px solid var(--dsw-alias-border-l1,#e6e7eb); padding:4px 12px; gap:8px; }
78
+ .sk-col-k { width:76px; flex:none; }
79
+ .sk-col-s { width:92px; flex:none; }
80
+ .sk-col-sc { width:120px; flex:none; }
81
+ .sk-row.arch { opacity:.6; }
82
+ .sk-badge { margin-left:6px; font-size:10.5px; color:var(--dsw-alias-label-secondary,#6b7280); border:1px solid var(--dsw-alias-border-l1,#e6e7eb); border-radius:999px; padding:0 6px; vertical-align:1px; }
75
83
  .sk-board { display:grid; grid-template-columns:repeat(6,minmax(160px,1fr)); gap:10px; align-items:start; }
76
84
  .sk-col { background:var(--dsw-alias-bg-layer-2,#f3f4f6); border:1px solid var(--dsw-alias-border-l1,#e6e7eb); border-radius:10px; min-height:110px; }
77
85
  .sk-col-head { display:flex; align-items:center; gap:6px; padding:9px 11px; font-weight:600; font-size:12.5px; color:var(--dsw-alias-label-secondary,#6b7280); border-bottom:1px solid var(--dsw-alias-border-l1,#e6e7eb); }
@@ -108,6 +116,12 @@ window.__ModuleLoader__.load({
108
116
  function Panel() {
109
117
  const [items, setItems] = useState([]);
110
118
  const [view, setView] = useState('table');
119
+ const [showArchived, setShowArchived] = useState(false);
120
+ const [fStatus, setFStatus] = useState('');
121
+ const [fKind, setFKind] = useState('');
122
+ const [fScope, setFScope] = useState('');
123
+ const [visibleCount, setVisibleCount] = useState(100);
124
+ const sentinelRef = useRef(null);
111
125
  const [query, setQuery] = useState('');
112
126
  const [error, setError] = useState('');
113
127
  const [detail, setDetail] = useState(null);
@@ -130,11 +144,11 @@ window.__ModuleLoader__.load({
130
144
 
131
145
  const load = useCallback(async () => {
132
146
  try {
133
- const r = await api('list');
147
+ const r = await api('list', { includeArchived: showArchived });
134
148
  setItems(r.items);
135
149
  setError('');
136
150
  } catch (e) { setError(e.message); }
137
- }, []);
151
+ }, [showArchived]);
138
152
 
139
153
  useEffect(() => { load(); }, [load]);
140
154
 
@@ -147,9 +161,35 @@ window.__ModuleLoader__.load({
147
161
 
148
162
  const visible = useMemo(() => {
149
163
  const q = query.trim().toLowerCase();
150
- if (!q) return items;
151
- return items.filter(i => (i.title + ' ' + i.id + ' ' + (i.scope || '')).toLowerCase().includes(q));
152
- }, [items, query]);
164
+ return items.filter(i => {
165
+ if (fStatus && i.status !== fStatus) return false;
166
+ if (fKind && i.kind !== fKind) return false;
167
+ if (fScope && (i.scope || '') !== fScope) return false;
168
+ if (!q) return true;
169
+ return (i.title + ' ' + (i.scope || '') + ' ' + i.id).toLowerCase().includes(q);
170
+ });
171
+ }, [items, query, fStatus, fKind, fScope]);
172
+
173
+ const scopeOptions = useMemo(() => {
174
+ const set = new Set();
175
+ for (const i of items) if (i.scope) set.add(i.scope);
176
+ return [...set].sort();
177
+ }, [items]);
178
+
179
+ useEffect(() => { setVisibleCount(100); }, [query, fStatus, fKind, fScope, view]);
180
+
181
+ useEffect(() => {
182
+ if (view !== 'table') return undefined;
183
+ const el = sentinelRef.current;
184
+ if (!el || typeof IntersectionObserver === 'undefined') return undefined;
185
+ const io = new IntersectionObserver(entries => {
186
+ if (entries.some(e => e.isIntersecting)) {
187
+ setVisibleCount(c => Math.min(c + 100, visible.length));
188
+ }
189
+ });
190
+ io.observe(el);
191
+ return () => io.disconnect();
192
+ }, [view, visible.length, visibleCount]);
153
193
 
154
194
  const openDetail = useCallback(async id => {
155
195
  try { setDetail(await api('get', { id })); }
@@ -190,6 +230,10 @@ window.__ModuleLoader__.load({
190
230
  className: 'sk-search', placeholder: '搜索标题 / 编号 / 范围',
191
231
  value: query, onChange: e => setQuery(e.target.value)
192
232
  }),
233
+ h('button', {
234
+ className: 'sk-btn' + (showArchived ? ' primary' : ''),
235
+ onClick: () => setShowArchived(v => !v)
236
+ }, showArchived ? '隐藏归档' : '显示归档'),
193
237
  h('button', { className: 'sk-btn', onClick: () => fileRef.current && fileRef.current.click() }, '导入 xlsx'),
194
238
  h('input', {
195
239
  ref: fileRef, type: 'file', accept: '.xlsx', style: { display: 'none' },
@@ -220,12 +264,48 @@ window.__ModuleLoader__.load({
220
264
 
221
265
  let content = null;
222
266
  if (view === 'table') {
267
+ const shown = visible.slice(0, visibleCount);
223
268
  content = h('div', null,
224
- quick,
269
+ h('div', { className: 'sk-quick' },
270
+ h('span', { className: 'sk-k' }, '+'),
271
+ h('input', {
272
+ placeholder: '快加一条(回车新建)',
273
+ onKeyDown: e => { if (e.key === 'Enter') { create(e.currentTarget.value); e.currentTarget.value = ''; } }
274
+ }),
275
+ h('span', { style: { color: 'var(--dsw-alias-label-secondary,#6b7280)', fontSize: 12, whiteSpace: 'nowrap' } },
276
+ '共 ' + visible.length + ' 条' + (visible.length > shown.length ? ' · 已显示 ' + shown.length : ''))
277
+ ),
225
278
  h('div', { className: 'sk-panel' },
226
- visible.length === 0 ? h('div', { className: 'sk-empty' }, '还没有条目。跟 agent 说“记一条…”,或在上面的输入框快加。') :
227
- visible.map(item => h('div', { key: item.id, className: 'sk-row' },
228
- h('span', { className: 'sk-id' }, item.id),
279
+ h('div', { className: 'sk-row sk-th' },
280
+ h('span', { className: 'sk-num' }, '#'),
281
+ h('span', { className: 'sk-name', style: { cursor: 'default' } }, '标题'),
282
+ h('span', { className: 'sk-col-k' }, '类型'),
283
+ h('span', { className: 'sk-col-s' }, '状态'),
284
+ h('span', { className: 'sk-col-sc' }, '范围'),
285
+ h('span', { className: 'sk-rev' }, '修订'),
286
+ h('span', { style: { width: 44 } }, '')
287
+ ),
288
+ h('div', { className: 'sk-row sk-filter' },
289
+ h('span', { className: 'sk-num' }, ''),
290
+ h('span', { className: 'sk-name' }, ''),
291
+ h('select', {
292
+ className: 'sk-sel sk-col-k', value: fKind,
293
+ onChange: e => setFKind(e.target.value)
294
+ }, h('option', { value: '' }, '全部'), KINDS.map(k => h('option', { key: k.id, value: k.id }, k.label))),
295
+ h('select', {
296
+ className: 'sk-sel sk-col-s', value: fStatus,
297
+ onChange: e => setFStatus(e.target.value)
298
+ }, h('option', { value: '' }, '全部'), STATUSES.map(s => h('option', { key: s.id, value: s.id }, s.label))),
299
+ h('select', {
300
+ className: 'sk-sel sk-col-sc', value: fScope,
301
+ onChange: e => setFScope(e.target.value)
302
+ }, h('option', { value: '' }, '全部'), scopeOptions.map(s => h('option', { key: s, value: s }, s))),
303
+ h('span', { className: 'sk-rev' }, ''),
304
+ h('span', { style: { width: 44 } }, '')
305
+ ),
306
+ visible.length === 0 ? h('div', { className: 'sk-empty' }, '没有匹配的条目。跟 agent 说“记一条…”,或在上面的输入框快加。') :
307
+ shown.map((item, index) => h('div', { key: item.id, className: 'sk-row' + (item.archived ? ' arch' : '') },
308
+ h('span', { className: 'sk-num' }, String(index + 1)),
229
309
  h('div', {
230
310
  className: 'sk-name',
231
311
  onClick: () => { setEditing(item.id); setDraft(item.title); }
@@ -237,22 +317,26 @@ window.__ModuleLoader__.load({
237
317
  if (e.key === 'Enter') e.currentTarget.blur();
238
318
  if (e.key === 'Escape') setEditing(null);
239
319
  }
240
- }) : item.title),
320
+ }) : item.title, item.archived ? h('span', { className: 'sk-badge' }, '已归档') : null),
241
321
  h('select', {
242
- className: 'sk-sel', value: item.kind,
322
+ className: 'sk-sel sk-col-k', value: item.kind,
243
323
  onChange: e => update(item.id, item.rev, { kind: e.target.value })
244
324
  }, KINDS.map(k => h('option', { key: k.id, value: k.id }, k.label))),
245
325
  h('select', {
246
- className: 'sk-sel', value: item.status,
326
+ className: 'sk-sel sk-col-s', value: item.status,
247
327
  onChange: e => setStatus(item, e.target.value)
248
328
  }, STATUSES.map(s => h('option', { key: s.id, value: s.id }, s.label))),
249
329
  h('select', {
250
- className: 'sk-sel', value: item.scope || '',
330
+ className: 'sk-sel sk-col-sc', value: item.scope || '',
251
331
  onChange: e => update(item.id, item.rev, { scope: e.target.value })
252
- }, h('option', { value: '' }, '范围'), SCOPES.map(s => h('option', { key: s, value: s }, s))),
332
+ }, h('option', { value: '' }, '未定'), scopeOptions.map(s => h('option', { key: s, value: s }, s))),
253
333
  h('span', { className: 'sk-rev' }, 'r' + item.rev),
254
334
  h('button', { className: 'sk-btn', onClick: () => openDetail(item.id) }, '详情')
255
- ))
335
+ )),
336
+ h('div', { ref: sentinelRef, style: { height: 1 } }),
337
+ visible.length > shown.length ? h('div', { style: { padding: 10 } },
338
+ h('button', { className: 'sk-btn', onClick: () => setVisibleCount(c => c + 100) },
339
+ '加载更多(' + shown.length + ' / ' + visible.length + ')')) : null
256
340
  )
257
341
  );
258
342
  } else if (view === 'board') {
@@ -298,7 +382,6 @@ window.__ModuleLoader__.load({
298
382
  h('div', { className: 'sk-panel' },
299
383
  recent.length === 0 ? h('div', { className: 'sk-empty' }, '还没有条目。') :
300
384
  recent.map(item => h('div', { key: item.id, className: 'sk-row' },
301
- h('span', { className: 'sk-id' }, item.id),
302
385
  h('span', { style: { flex: 1, fontWeight: 550 } }, item.title),
303
386
  h('span', { style: { color: 'var(--dsw-alias-label-secondary,#6b7280)', fontSize: 12 } },
304
387
  statusLabel(item.status) + ' · ' + kindLabel(item.kind) + (item.scope ? ' · ' + item.scope : '')),
@@ -311,7 +394,6 @@ window.__ModuleLoader__.load({
311
394
 
312
395
  const drawer = detail ? h('div', { className: 'sk-drawer' },
313
396
  h('div', { className: 'sk-drawer-head' },
314
- h('span', { className: 'sk-id' }, detail.item.id),
315
397
  h('span', { style: { fontWeight: 600, flex: 1 } }, '条目详情'),
316
398
  h('button', { className: 'sk-btn', onClick: () => setDetail(null) }, '关闭')
317
399
  ),
@@ -345,11 +427,16 @@ window.__ModuleLoader__.load({
345
427
  h('select', {
346
428
  className: 'sk-sel', value: detail.item.scope || '',
347
429
  onChange: e => update(detail.item.id, detail.item.rev, { scope: e.target.value })
348
- }, h('option', { value: '' }, '范围'), SCOPES.map(s => h('option', { key: s, value: s }, s))),
349
- h('button', {
350
- className: 'sk-btn danger',
351
- onClick: () => run(() => api('archive', { id: detail.item.id }), '已归档').then(() => setDetail(null))
352
- }, '归档')
430
+ }, h('option', { value: '' }, '未定'), scopeOptions.map(s => h('option', { key: s, value: s }, s))),
431
+ detail.item.archived
432
+ ? h('button', {
433
+ className: 'sk-btn',
434
+ onClick: () => run(() => api('restore', { id: detail.item.id }), '已恢复').then(() => setDetail(null))
435
+ }, '恢复')
436
+ : h('button', {
437
+ className: 'sk-btn danger',
438
+ onClick: () => run(() => api('archive', { id: detail.item.id }), '已归档').then(() => setDetail(null))
439
+ }, '归档')
353
440
  ),
354
441
  h('div', { className: 'sk-hist' },
355
442
  h('h4', null, '修订历史(点“回滚”回到那一版)'),
package/index.js CHANGED
@@ -58,7 +58,7 @@ export function apply(ctx, config) {
58
58
  function dispatch(store, method, args) {
59
59
  switch (method) {
60
60
  case 'list': {
61
- const result = store.list({ includeArchived: args.includeArchived === true, limit: 500 });
61
+ const result = store.list({ includeArchived: args.includeArchived === true, limit: 2000 });
62
62
  return { items: result.items.map(publicItem), total: result.total };
63
63
  }
64
64
  case 'get': {
@@ -147,7 +147,7 @@ function applyPlan(store, plan) {
147
147
  };
148
148
  for (const item of plan.main) write(item, '导入:任务主表');
149
149
  for (const item of plan.rolling) write(item, '导入:长期滚动项');
150
- if (plan.notes) write(plan.notes, '导入:节点说明');
150
+ if (plan.notes && args.includeNotes === true) write(plan.notes, '导入:节点说明');
151
151
  return { imported, skipped, summary: describeImport(plan) };
152
152
  }
153
153
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saibo-kanban",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "AI 与人共用的活看板:草稿进收件箱、人做分拣、字段级修订可回滚,零 token 纠错。",
5
5
  "keywords": [
6
6
  "dsh",
package/store.js CHANGED
@@ -263,7 +263,7 @@ export class Store {
263
263
  }
264
264
 
265
265
  list(options = {}) {
266
- const limit = Math.max(1, Math.min(options.limit ?? 50, 200));
266
+ const limit = Math.max(1, Math.min(options.limit ?? 50, 2000));
267
267
  const out = [];
268
268
  for (const item of this.items.values()) {
269
269
  if (!options.includeArchived && item.archived) continue;