dsh-life-pack 0.3.14 → 0.3.16

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/dist/client.js CHANGED
@@ -1698,16 +1698,8 @@ window.__ModuleLoader__.load({
1698
1698
  };
1699
1699
  });
1700
1700
  }
1701
- /** 一家的一句话读数:「红 1 黄 2」,全绿就是「绿」。面板侧要**上色**的那几处不用它(见 `countSegments`)。 */
1702
- function countsText(counts) {
1703
- const parts = [];
1704
- if (counts.red > 0) parts.push("红 " + String(counts.red));
1705
- if (counts.yellow > 0) parts.push("黄 " + String(counts.yellow));
1706
- if (parts.length === 0) return "绿";
1707
- return parts.join(" · ");
1708
- }
1709
1701
  /** 把一份计数拆成**按档分色**的几截。红黄各自一截、各自上色,互不串色;
1710
- * 「黄 3」这一截为什么不能被染成红——见 `countSegments` 的注释(出图复评逮到的真缺陷)。 */
1702
+ * 数字本身不带档位字(#951):颜色即档位,胶囊形状由调用方配 `COUNT_CAPSULE`/`TAB_NOTE_STYLE`。 */
1711
1703
  function countSegsOf(light) {
1712
1704
  if (light.status === null) return [{
1713
1705
  status: null,
@@ -1718,16 +1710,26 @@ window.__ModuleLoader__.load({
1718
1710
  const count = light.counts[status];
1719
1711
  if (count > 0) segs.push({
1720
1712
  status,
1721
- text: STATUS_LABEL[status] + " " + String(count)
1713
+ text: String(count)
1722
1714
  });
1723
1715
  }
1724
1716
  return segs.length > 0 ? segs : [{
1725
1717
  status: "green",
1726
- text: "绿"
1718
+ text: String(light.counts.green)
1727
1719
  }];
1728
1720
  }
1729
1721
  /** 几截读数之间那个分隔符:不许染档位色(它不属于任何一档)。 */
1730
1722
  const SEG_SEP = " · ";
1723
+ /** 数字胶囊的形状(#951):页签那枚 `TAB_NOTE_STYLE` 的同形,汇总与表头共用。
1724
+ * 颜色不进这一格,调用方按档配 `STATUS_TEXT[status]`——颜色即档位,字上不再写档位名。 */
1725
+ const COUNT_CAPSULE_STYLE = {
1726
+ border: "1px solid " + BORDER,
1727
+ borderRadius: 999,
1728
+ padding: "0 6px",
1729
+ margin: "0 2px",
1730
+ fontSize: 11,
1731
+ fontWeight: 700
1732
+ };
1731
1733
  /** 汇总行那一句:绿要显眼(它是「正常」这件事本身),没通道的那几家不冒充绿。
1732
1734
  *
1733
1735
  * 「没有体检出口」与「还没跑过体检」是**两件事**(票 #735):前者那颗「体检一次」按下去不会有任何反应,
@@ -1760,10 +1762,10 @@ window.__ModuleLoader__.load({
1760
1762
  parts.push(react.createElement("span", {
1761
1763
  key: status,
1762
1764
  style: {
1763
- color: STATUS_TEXT[status],
1764
- fontWeight: 700
1765
+ ...COUNT_CAPSULE_STYLE,
1766
+ color: STATUS_TEXT[status]
1765
1767
  }
1766
- }, STATUS_LABEL[status] + " " + String(count)));
1768
+ }, String(count)));
1767
1769
  }
1768
1770
  if (parts.length === 0) return react.createElement("span", { style: { color: INK_DIM } }, (allGreen ? "有出口的都正常" : "还没体检") + tail);
1769
1771
  parts.push(react.createElement("span", {
@@ -1828,6 +1830,32 @@ window.__ModuleLoader__.load({
1828
1830
  function isAttentionItem(item) {
1829
1831
  return isAttention(item.status);
1830
1832
  }
1833
+ /** 表头那组数字(#951):与页签/汇总同口径——只印数字胶囊,颜色即档位,不印档位字。 */
1834
+ function headerCounts(report) {
1835
+ const counts = countByStatus(report.items);
1836
+ const segs = countSegsOf({
1837
+ id: "header",
1838
+ title: "",
1839
+ status: worstStatus(report.items),
1840
+ counts,
1841
+ hasChannel: true
1842
+ });
1843
+ return react.createElement("div", { style: {
1844
+ display: "flex",
1845
+ alignItems: "center",
1846
+ gap: 4,
1847
+ fontSize: 12
1848
+ } }, segs.map((seg, index) => seg.status === null ? react.createElement("span", {
1849
+ key: index,
1850
+ style: { color: INK_DIM }
1851
+ }, seg.text) : react.createElement("span", {
1852
+ key: index,
1853
+ style: {
1854
+ ...COUNT_CAPSULE_STYLE,
1855
+ color: STATUS_TEXT[seg.status]
1856
+ }
1857
+ }, seg.text)));
1858
+ }
1831
1859
  /** 一家那张表:**要处理的**(红黄)一条一块、整行上底带一句话与「去哪修」;
1832
1860
  * **正常的**(绿)收成一行并列的小字,点得到、扫得完(票面验收第一条:正常的收成一行,有问题的才展开)。 */
1833
1861
  function HealthTable(props) {
@@ -1836,10 +1864,7 @@ window.__ModuleLoader__.load({
1836
1864
  return react.createElement("div", {
1837
1865
  style: HEALTH_STYLE.box,
1838
1866
  "data-ilife-health": "table"
1839
- }, react.createElement("div", { style: HEALTH_STYLE.headRow }, react.createElement("div", { style: HEALTH_STYLE.head }, props.title + " · 体检"), report ? react.createElement("div", { style: {
1840
- color: INK_DIM,
1841
- fontSize: 12
1842
- } }, countsText(countByStatus(report.items))) : null), props.phase === "idle" ? react.createElement("div", { style: HEALTH_STYLE.meta }, "还没体检:点上面那个「体检一次」。") : null, props.phase === "running" ? react.createElement("div", { style: HEALTH_STYLE.meta }, "正在体检…") : null, props.error !== null ? react.createElement("div", { style: HEALTH_STYLE.error }, props.error) : null, report ? react.createElement("div", null, report.dataDir !== "" ? react.createElement("div", { style: {
1867
+ }, react.createElement("div", { style: HEALTH_STYLE.headRow }, react.createElement("div", { style: HEALTH_STYLE.head }, props.title + " · 体检"), report ? headerCounts(report) : null), props.phase === "idle" ? react.createElement("div", { style: HEALTH_STYLE.meta }, "还没体检:点上面那个「体检一次」。") : null, props.phase === "running" ? react.createElement("div", { style: HEALTH_STYLE.meta }, "正在体检…") : null, props.error !== null ? react.createElement("div", { style: HEALTH_STYLE.error }, props.error) : null, report ? react.createElement("div", null, report.dataDir !== "" ? react.createElement("div", { style: {
1843
1868
  color: INK_DIM,
1844
1869
  fontSize: 11.5,
1845
1870
  marginTop: 2