@skillre/dsh-plugin-work-dashboard 0.15.0 → 0.15.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.
@@ -597,6 +597,11 @@ function reportPage() {
597
597
  completion: '',
598
598
  });
599
599
  }
600
+ // One blank plan-external row is present from the start, so "计划之外还做了
601
+ // 什么" opens with a field to type in instead of a button. It carries no
602
+ // content, so validation ignores it and `buildRound` drops it.
603
+ ws.lines.push(makeExtraLine(ws));
604
+ ws.openLines[at(ws.lines, ws.lines.length - 1).key] = false;
600
605
  return ws;
601
606
  }
602
607
  function makeWorkspaces() {
@@ -1334,8 +1339,13 @@ function reportPage() {
1334
1339
  registerRef(path, wrap);
1335
1340
  return wrap;
1336
1341
  }
1337
- /** A section head: numbered badge, title, one-line lead, right-hand note. */
1338
- function sectionShell(num, title, sub, note) {
1342
+ /**
1343
+ * A section head: numbered badge, title, one-line lead, right-hand note.
1344
+ *
1345
+ * `noteKind` picks the note's treatment. `pill` is for a count the reader
1346
+ * scans ("3 项 · 已完成 1"); `note` is for an instruction ("三项都必填").
1347
+ */
1348
+ function sectionShell(num, title, sub, note, noteKind = 'note') {
1339
1349
  var head = el('div', 'rp-sechead');
1340
1350
  var left = el('div', 'rp-secl');
1341
1351
  // An empty `num` means this block is a continuation of the section above it,
@@ -1357,12 +1367,19 @@ function reportPage() {
1357
1367
  left.appendChild(titles);
1358
1368
  head.appendChild(left);
1359
1369
  if (note !== '') {
1360
- var n = el('span', 'rp-secnote');
1370
+ var n = el('span', noteKind === 'pill' ? 'rp-pill' : 'rp-secnote');
1361
1371
  setText(n, note);
1372
+ if (noteKind === 'pill')
1373
+ n.setAttribute('role', 'status');
1362
1374
  head.appendChild(n);
1363
1375
  }
1364
1376
  return head;
1365
1377
  }
1378
+ /** A worksheet section; everything after the first sits under a hairline. */
1379
+ function worksheetSection(rule) {
1380
+ var sec = el('section', rule ? 'rp-section-rule' : '');
1381
+ return sec;
1382
+ }
1366
1383
  function sectionNote(sec, text) {
1367
1384
  var p = el('p', 'rp-secsub');
1368
1385
  p.style.padding = '0 0 10px 35px';
@@ -1708,7 +1725,7 @@ function reportPage() {
1708
1725
  if (text.indexOf('legacy-') === 0)
1709
1726
  return text;
1710
1727
  var cut = text.indexOf('-');
1711
- return 'plan-' + (cut > 0 ? text.slice(0, cut) : text);
1728
+ return 'plan-' + (cut > 0 ? text.slice(0, cut) : text).slice(0, 4);
1712
1729
  }
1713
1730
  /** One work item.
1714
1731
  *
@@ -1719,6 +1736,19 @@ function reportPage() {
1719
1736
  */
1720
1737
  function renderLineCard(ws, line, position, extra) {
1721
1738
  var open = ws.openLines[line.key] === true;
1739
+ // An untouched plan-external row is not a work item yet: it is the empty field
1740
+ // waiting for one. It gets a label and an input, and nothing that looks like
1741
+ // a filled row (no "(未命名)" title, no status control, no chips).
1742
+ if (extra && !open && !lineHasContent(line)) {
1743
+ var blank = el('div', 'rp-plan');
1744
+ blank.setAttribute('data-line', line.key);
1745
+ blank.className += ' rp-item';
1746
+ var titleField = mkInput(line.title, '例:受邀参加客户年度安全峰会,做了 20 分钟专题分享', 500);
1747
+ titleField.setAttribute('data-role', 'line-title');
1748
+ titleField.setAttribute('data-line', line.key);
1749
+ blank.appendChild(fieldWrap('line:' + line.key + ':title', '做了什么(自拟标题)', false, titleField, '', 'is-quiet'));
1750
+ return blank;
1751
+ }
1722
1752
  var wrap = el('div', 'rp-plan' + (open ? ' is-open' : ''));
1723
1753
  wrap.setAttribute('data-line', line.key);
1724
1754
  wrap.className += ' rp-item';
@@ -1738,19 +1768,30 @@ function reportPage() {
1738
1768
  head.appendChild(renderStatusField(ws, line));
1739
1769
  wrap.appendChild(head);
1740
1770
  if (!open) {
1741
- var row = el('div', 'rp-collapsed');
1742
- var actual = mkInput(line.actual, '填写实际结果…', 5000);
1743
- actual.setAttribute('data-role', 'line-actual');
1744
- actual.setAttribute('data-line', line.key);
1771
+ var row = el('div', 'rp-collapsed' + (extra && !lineHasContent(line) ? ' is-blank' : ''));
1772
+ // A previous plan already has its title from the ledger, so the row asks for
1773
+ // the outcome. A plan-external item has no title yet, so the row asks for
1774
+ // that first — the design's "做了什么(自拟标题)".
1775
+ var first = null;
1776
+ if (extra) {
1777
+ first = mkInput(line.title, '例:受邀参加客户年度安全峰会,做了 20 分钟专题分享', 500);
1778
+ first.setAttribute('data-role', 'line-title');
1779
+ }
1780
+ else {
1781
+ first = mkInput(line.actual, '填写实际结果…', 5000);
1782
+ first.setAttribute('data-role', 'line-actual');
1783
+ }
1784
+ first.setAttribute('data-line', line.key);
1745
1785
  var box = el('div', 'rp-box is-quiet');
1746
- box.appendChild(actual);
1786
+ box.appendChild(first);
1747
1787
  row.appendChild(box);
1748
1788
  var counts = [
1749
1789
  ['evidence', 'file', '证据', line.evidence.length, line.evidence.length > 0],
1750
1790
  ['customer', 'chat', '反馈', 0, trim(line.customerSynced) !== '' || trim(line.customerFeedback) !== ''],
1751
1791
  ['ids', 'list', '场景', 0, line.scenarioIds.length + line.criteriaIds.length > 0],
1752
1792
  ];
1753
- for (var i = 0; i < counts.length; i += 1) {
1793
+ var showChips = !extra || lineHasContent(line);
1794
+ for (var i = 0; i < counts.length && showChips; i += 1) {
1754
1795
  var spec = at(counts, i);
1755
1796
  var button = el('button', 'rp-mini');
1756
1797
  button.type = 'button';
@@ -1799,9 +1840,14 @@ function reportPage() {
1799
1840
  }
1800
1841
  function renderProgressSection(ws) {
1801
1842
  var input = ws.input;
1802
- var sec = el('section', '');
1843
+ var sec = worksheetSection(false);
1803
1844
  var planned = input.previousPlans.length;
1804
- sec.appendChild(sectionShell('1', '上次定的计划,做到什么程度了', '逐项反馈。没做完就写没做完,比写成「推进中」有用。', planned ? planned + ' 项' : '无计划'));
1845
+ var done = 0;
1846
+ for (var i = 0; i < ws.lines.length; i += 1) {
1847
+ if (at(ws.lines, i).status === '已完成')
1848
+ done += 1;
1849
+ }
1850
+ sec.appendChild(sectionShell('1', '上次定的计划,做到什么程度了', '逐项反馈。没做完就写没做完,比写成「推进中」有用。', planned ? planned + ' 项 · 已完成 ' + done : '无计划', 'pill'));
1805
1851
  var general = el('p', 'rp-err rp-err-general');
1806
1852
  general.id = 'rp-round-error';
1807
1853
  sec.appendChild(general);
@@ -1829,7 +1875,11 @@ function reportPage() {
1829
1875
  var list = el('div', '');
1830
1876
  for (var i = 0; i < ws.lines.length; i += 1) {
1831
1877
  var line = at(ws.lines, i);
1832
- list.appendChild(renderLineCard(ws, line, i + 1, line.editableTitle));
1878
+ // Plan-external rows belong to section 3; rendering them here would show
1879
+ // every extra twice.
1880
+ if (line.editableTitle)
1881
+ continue;
1882
+ list.appendChild(renderLineCard(ws, line, i + 1, false));
1833
1883
  }
1834
1884
  sec.appendChild(list);
1835
1885
  var add = el('button', 'rp-addline');
@@ -1842,9 +1892,11 @@ function reportPage() {
1842
1892
  return sec;
1843
1893
  }
1844
1894
  function renderPlansSection(ws, num = '4') {
1845
- var sec = el('section', '');
1895
+ var sec = worksheetSection(true);
1846
1896
  sec.appendChild(sectionShell(num, '下一轮打算做什么', '这里写的,下次就是对照项。', '必选其一'));
1847
- var choice = el('div', 'rp-choice' + (ws.plansChoice === '' ? ' is-error' : ''));
1897
+ // No error styling on first paint: an unanswered radio group is the normal
1898
+ // starting state, not a mistake. `applyIssues` marks it after a save attempt.
1899
+ var choice = el('div', 'rp-choice');
1848
1900
  choice.setAttribute('role', 'group');
1849
1901
  choice.setAttribute('aria-label', '下轮计划');
1850
1902
  var options = [
@@ -1925,7 +1977,7 @@ function reportPage() {
1925
1977
  }
1926
1978
  /** The round's own metadata: date, type, what changed. */
1927
1979
  function renderRoundStrip(ws, num = '2') {
1928
- var sec = el('section', '');
1980
+ var sec = worksheetSection(true);
1929
1981
  sec.appendChild(sectionShell(num, '这一轮本身', '日期、类型、以及和上一轮相比什么变了', '三项都必填'));
1930
1982
  var grid = el('div', 'rp-three');
1931
1983
  var date = mkDate(ws.roundDate);
@@ -1946,7 +1998,7 @@ function reportPage() {
1946
1998
  return sec;
1947
1999
  }
1948
2000
  function renderExtraSection(ws) {
1949
- var sec = el('section', '');
2001
+ var sec = worksheetSection(true);
1950
2002
  sec.appendChild(sectionShell('3', '计划之外还做了什么', '临时插入的事也算进展,别让它只活在聊天记录里。', '没有就留空'));
1951
2003
  var list = el('div', '');
1952
2004
  list.id = 'rp-extras';
@@ -2095,7 +2147,7 @@ function reportPage() {
2095
2147
  /** The new-project worksheet: identity + Gate 0, no round required. */
2096
2148
  function renderNewProject(ws) {
2097
2149
  var wrap = el('div', '');
2098
- var identity = el('section', '');
2150
+ var identity = worksheetSection(false);
2099
2151
  identity.appendChild(sectionShell('1', '项目身份', '谁、哪家、谁负责。阶段和状态由台账维护。', '带 * 必填'));
2100
2152
  var grid = el('div', 'rp-two');
2101
2153
  var col1 = el('div', 'rp-f');
@@ -2162,7 +2214,7 @@ function reportPage() {
2162
2214
  optional.appendChild(grid2);
2163
2215
  identity.appendChild(optional);
2164
2216
  wrap.appendChild(identity);
2165
- var gate = el('section', '');
2217
+ var gate = worksheetSection(true);
2166
2218
  gate.appendChild(sectionShell('2', 'Gate 0 · 值不值得做', '这五项齐了,G0 评审才有意义。评审结论不在这里填。', '五项必填'));
2167
2219
  var areas = [
2168
2220
  ['whyCustomer', '客户为什么要测', ws.gate0.whyCustomer, '客户自己的痛点与压力,不是我们的卖点'],
@@ -2184,7 +2236,7 @@ function reportPage() {
2184
2236
  wrap.appendChild(gate);
2185
2237
  // Section 3 owns the whole optional first round, in the order the facts are
2186
2238
  // asked for: the round's own metadata, then what was done, then next steps.
2187
- var extra = el('section', '');
2239
+ var extra = worksheetSection(true);
2188
2240
  extra.appendChild(sectionShell('3', '第一轮进展与下一步计划', '不填也能保存。填了就是第一轮记录。', '选填'));
2189
2241
  extra.appendChild(renderRoundStrip(ws, ''));
2190
2242
  var list = el('div', '');
@@ -2767,8 +2819,15 @@ function reportPage() {
2767
2819
  }
2768
2820
  return Math.max(n, 1);
2769
2821
  }
2770
- // One line per previous plan, plus date / type / change, plus the choice.
2771
- var total = ws.lines.length + 3 + 1;
2822
+ // One line per previous plan, plus date / type / change, plus the choice. The
2823
+ // blank plan-external row is only counted once it has content.
2824
+ var counted = 0;
2825
+ for (var i = 0; i < ws.lines.length; i += 1) {
2826
+ var line = at(ws.lines, i);
2827
+ if (!line.editableTitle || lineHasContent(line))
2828
+ counted += 1;
2829
+ }
2830
+ var total = counted + 3 + 1;
2772
2831
  if (ws.plansChoice === 'has')
2773
2832
  total += ws.plans.length * 3;
2774
2833
  return Math.max(total, 1);
@@ -2930,6 +2989,10 @@ function reportPage() {
2930
2989
  function validateLines(ws, issues) {
2931
2990
  for (var i = 0; i < ws.lines.length; i += 1) {
2932
2991
  var line = at(ws.lines, i);
2992
+ // The blank plan-external row starts empty on purpose; only a row the
2993
+ // colleague has touched becomes a fact that needs answering.
2994
+ if (line.editableTitle && !lineHasContent(line))
2995
+ continue;
2933
2996
  // Name the item by its own goal rather than by an array position: the
2934
2997
  // screen shows a plan's title, not "第 2 项", so an index would send the
2935
2998
  // reader counting rows to find the field the message is about.
@@ -3062,6 +3125,8 @@ function reportPage() {
3062
3125
  var lines = [];
3063
3126
  for (var i = 0; i < ws.lines.length; i += 1) {
3064
3127
  var line = at(ws.lines, i);
3128
+ if (line.editableTitle && !lineHasContent(line))
3129
+ continue;
3065
3130
  var item = {};
3066
3131
  if (line.planId !== '')
3067
3132
  item.plan_id = line.planId;
@@ -27,7 +27,11 @@
27
27
  * network. The stacks below degrade to the platform's own Chinese faces.
28
28
  */
29
29
  export const REPORT_STYLE = `
30
- .rp-app{
30
+ /* The palette lives on :root, not on .rp-app, because the body element needs the canvas
31
+ colour too. Scoping the variables to the app shell left an 8px browser-default
32
+ margin and a white strip around the whole page — the one thing a document
33
+ opened from file:// must not have. */
34
+ :root{
31
35
  --canvas:#EEF0EE; --paper:#FFFFFF;
32
36
  --ink:#121A16; --ink2:#4C5651; --ink3:#7E8983; --ink4:#AEB7B2;
33
37
  --line:#D9DFDB; --line2:#E9EDEA;
@@ -39,9 +43,15 @@ export const REPORT_STYLE = `
39
43
  --sans:"Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft YaHei",system-ui,sans-serif;
40
44
  --serif:"Noto Serif SC","Songti SC","Source Han Serif SC",Georgia,serif;
41
45
  --mono:"IBM Plex Mono",ui-monospace,"SF Mono",Menlo,monospace;
46
+ }
47
+ html,body{
48
+ margin:0; padding:0;
42
49
  background:var(--canvas); color:var(--ink);
43
50
  font-family:var(--sans); font-size:13px; line-height:1.5;
44
51
  -webkit-font-smoothing:antialiased;
52
+ }
53
+ .rp-app{
54
+ background:var(--canvas);
45
55
  padding-bottom:100px; margin:0;
46
56
  }
47
57
  .rp-app *{box-sizing:border-box;margin:0;padding:0}
@@ -110,6 +120,9 @@ export const REPORT_STYLE = `
110
120
  .rp-sectitle{font-size:17px;font-weight:600;color:var(--ink);letter-spacing:-.1px}
111
121
  .rp-secsub{font-size:11.5px;color:var(--ink3);padding-top:2px}
112
122
  .rp-secnote{font-size:11px;color:var(--ink4);flex:none}
123
+ /* Every section after the first opens with a hairline, the way a printed form
124
+ separates its numbered blocks. Without it the page reads as one long scroll. */
125
+ .rp-section-rule{border-top:1px solid var(--line2)}
113
126
  .rp-pill{padding:5px 10px;background:var(--quiet);border-radius:2px;font-family:var(--mono);font-size:10.5px;color:var(--ink2);flex:none}
114
127
 
115
128
  /* ---------- plan card ---------- */
@@ -159,6 +172,7 @@ export const REPORT_STYLE = `
159
172
  .rp-chip svg{flex:none}
160
173
 
161
174
  .rp-collapsed{display:flex;align-items:center;gap:14px;padding:12px 16px;border-bottom:1px solid var(--line2);flex-wrap:wrap}
175
+ .rp-collapsed.is-blank{border-bottom:0;padding-bottom:2px}
162
176
  .rp-collapsed .rp-box{flex:1 1 200px}
163
177
  .rp-collapsed .rp-box input{font-size:12px;color:var(--ink4);font-style:italic}
164
178
  .rp-mini{display:inline-flex;align-items:center;gap:5px;padding:6px 10px;flex:none;border:1px solid var(--line);border-radius:2px;background:var(--paper);font-size:10.5px;color:var(--ink2);transition:all .15s}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillre/dsh-plugin-work-dashboard",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "工作看板:多模块运营看板,POC 运营为首个模块(四维结果、阶段轨道、缺口清单、风险看板、时间线、导出表单)",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",