@data_wise/hyper-markdown 1.1.1 → 1.1.2

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.
@@ -59529,43 +59529,39 @@ class $Ze {
59529
59529
  /**
59530
59530
  * 渲染所有数据集容器
59531
59531
  */
59532
- renderDatasets() {
59532
+ async renderDatasets() {
59533
59533
  const e = document.querySelectorAll(".dataset-container");
59534
59534
  if (e.length === 0) {
59535
59535
  this.triggerRenderComplete();
59536
59536
  return;
59537
59537
  }
59538
- let r = 0;
59539
- const n = e.length;
59540
- e.forEach(async (i, a) => {
59541
- if (i.dataset.rendered) {
59542
- r++, r === n && this.triggerRenderComplete();
59543
- return;
59544
- }
59545
- try {
59546
- const s = i.dataset.dataset || "", o = i.dataset.isDatasource === "true" || i.dataset.isDatasource === !0;
59547
- if (!s.trim())
59548
- throw new Error("数据集内容为空");
59549
- let l;
59550
- if (o)
59551
- l = await this.parseDataSourceQuery(s);
59552
- else
59553
- try {
59554
- const h = decodeURIComponent(s);
59555
- l = new Function(`return (${h})`)();
59556
- } catch {
59538
+ const r = Array.from(e).map(async (n, i) => {
59539
+ if (!n.dataset.rendered)
59540
+ try {
59541
+ const a = n.dataset.dataset || "", s = n.dataset.isDatasource === "true" || n.dataset.isDatasource === !0;
59542
+ if (!a.trim())
59543
+ throw new Error("数据集内容为空");
59544
+ let o;
59545
+ if (s)
59546
+ o = await this.parseDataSourceQuery(a);
59547
+ else
59557
59548
  try {
59558
- l = JSON.parse(s);
59549
+ const u = decodeURIComponent(a);
59550
+ o = new Function(`return (${u})`)();
59559
59551
  } catch {
59560
- throw new Error("无法解析数据集配置");
59552
+ try {
59553
+ o = JSON.parse(a);
59554
+ } catch {
59555
+ throw new Error("无法解析数据集配置");
59556
+ }
59561
59557
  }
59562
- }
59563
- const u = i.dataset.datasetId || `dataset-${a}`;
59564
- this.renderDataset(i, l, u), i.dataset.rendered = "true", r++, r === n && this.triggerRenderComplete();
59565
- } catch (s) {
59566
- console.error("Error rendering dataset:", s), console.error("Dataset content that caused error:", i.dataset.dataset), i.innerHTML = `<div class="dataset-error">数据集渲染错误: ${s.message}</div>`, r++, r === n && this.triggerRenderComplete();
59567
- }
59558
+ const l = n.dataset.datasetId || `dataset-${i}`;
59559
+ this.renderDataset(n, o, l), n.dataset.rendered = "true";
59560
+ } catch (a) {
59561
+ console.error("Error rendering dataset:", a), console.error("Dataset content that caused error:", n.dataset.dataset), n.innerHTML = `<div class="dataset-error">数据集渲染错误: ${a.message}</div>`;
59562
+ }
59568
59563
  });
59564
+ await Promise.all(r), this.triggerRenderComplete();
59569
59565
  }
59570
59566
  /**
59571
59567
  * 解析数据源查询格式
@@ -59635,7 +59631,7 @@ class $Ze {
59635
59631
  return;
59636
59632
  }
59637
59633
  const i = this.createDatasetHTML(r, n);
59638
- e.innerHTML = i, this.datasets.set(n, r), this.dataset[n] = r, this.bindFilterEvents(e, n);
59634
+ e.innerHTML = i, this.datasets.set(n, r), this.dataset[n] = r, this.bindToggleEvent(e, n), this.bindFilterEvents(e, n);
59639
59635
  }
59640
59636
  /**
59641
59637
  * 验证数据集格式 - 现在直接返回true,不进行验证
@@ -59650,54 +59646,60 @@ class $Ze {
59650
59646
  const n = this.getDatasetFields(e), i = this.getDataCount(e), a = e.metadata && e.metadata.sourceId;
59651
59647
  return `
59652
59648
  <div class="dataset-panel">
59653
- <div class="dataset-header">
59654
- <h4 class="dataset-title">数据集${a ? " (数据源)" : ""}</h4>
59655
- <span class="dataset-id">ID: ${r}</span>
59656
- <span class="dataset-info">${i} 条记录</span>
59657
- ${a ? `<span class="datasource-info">数据源: ${e.metadata.sourceId}</span>` : ""}
59649
+ <div class="dataset-header" data-dataset-id="${r}">
59650
+ <div class="dataset-header-content">
59651
+ <svg class="dataset-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
59652
+ <path d="M324.576 786.272l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM324.576 566.848l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM617.152 786.272l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM324.576 347.424l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM617.152 566.848l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM909.728 786.272l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM617.152 347.424l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM909.728 566.848l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM909.728 347.424l0-109.728q0-8-5.152-13.152t-13.152-5.152l-182.848 0q-8 0-13.152 5.152t-5.152 13.152l0 109.728q0 8 5.152 13.152t13.152 5.152l182.848 0q8 0 13.152-5.152t5.152-13.152zM982.848 164.576l0 621.728q0 37.728-26.848 64.576t-64.576 26.848l-768 0q-37.728 0-64.576-26.848t-26.848-64.576l0-621.728q0-37.728 26.848-64.576t64.576-26.848l768 0q37.728 0 64.576 26.848t26.848 64.576z" />
59653
+ </svg>
59654
+ <span class="dataset-id">${r}</span>
59655
+ <span class="dataset-info">${i} 条记录</span>
59656
+ ${a ? `<span class="datasource-info">数据源: ${e.metadata.sourceId}</span>` : ""}
59657
+ </div>
59658
59658
  </div>
59659
59659
 
59660
- <div class="dataset-filters">
59661
- <div class="filter-section">
59662
- <div class="data-filters">
59663
- <div class="condition-builder">
59664
- <select class="condition-field">
59665
- <option value="">选择字段</option>
59666
- ${n.map((s) => `<option value="${s}">${s}</option>`).join("")}
59667
- </select>
59668
- <select class="condition-operator">
59669
- <option value="contains">包含</option>
59670
- <option value="equals">等于</option>
59671
- <option value="not-equals">不等于</option>
59672
- <option value="starts-with">开头是</option>
59673
- <option value="ends-with">结尾是</option>
59674
- <option value="greater-than">大于</option>
59675
- <option value="greater-than-equals">大于等于</option>
59676
- <option value="less-than">小于</option>
59677
- <option value="less-than-equals">小于等于</option>
59678
- </select>
59679
- <input type="text" class="condition-value" placeholder="输入值">
59680
- <button class="condition-add-btn" data-action="add-condition">添加筛选</button>
59681
- <button class="action-btn" data-action="preview">预览</button>
59682
- <button class="action-btn" data-action="export">导出</button>
59660
+ <div class="dataset-content" style="display: none;">
59661
+ <div class="dataset-filters">
59662
+ <div class="filter-section">
59663
+ <div class="data-filters">
59664
+ <div class="condition-builder">
59665
+ <select class="condition-field">
59666
+ <option value="">选择字段</option>
59667
+ ${n.map((s) => `<option value="${s}">${s}</option>`).join("")}
59668
+ </select>
59669
+ <select class="condition-operator">
59670
+ <option value="contains">包含</option>
59671
+ <option value="equals">等于</option>
59672
+ <option value="not-equals">不等于</option>
59673
+ <option value="starts-with">开头是</option>
59674
+ <option value="ends-with">结尾是</option>
59675
+ <option value="greater-than">大于</option>
59676
+ <option value="greater-than-equals">大于等于</option>
59677
+ <option value="less-than">小于</option>
59678
+ <option value="less-than-equals">小于等于</option>
59679
+ </select>
59680
+ <input type="text" class="condition-value" placeholder="输入值">
59681
+ <button class="condition-add-btn" data-action="add-condition">添加筛选</button>
59682
+ <button class="action-btn" data-action="preview">预览</button>
59683
+ <button class="action-btn" data-action="export">导出</button>
59684
+ </div>
59685
+ <div class="condition-tags" style="display: none;"></div>
59683
59686
  </div>
59684
- <div class="condition-tags" style="display: none;"></div>
59685
59687
  </div>
59686
59688
  </div>
59687
- </div>
59688
-
59689
- <div class="dataset-preview" style="display: none;">
59690
- <div class="preview-table-container">
59691
- <table class="preview-table">
59692
- <thead>
59693
- <tr>
59694
- ${n.map((s) => `<th>${s}</th>`).join("")}
59695
- </tr>
59696
- </thead>
59697
- <tbody>
59698
- ${this.getPreviewRows(e, n, 5).join("")}
59699
- </tbody>
59700
- </table>
59689
+
59690
+ <div class="dataset-preview" style="display: none;">
59691
+ <div class="preview-table-container">
59692
+ <table class="preview-table">
59693
+ <thead>
59694
+ <tr>
59695
+ ${n.map((s) => `<th>${s}</th>`).join("")}
59696
+ </tr>
59697
+ </thead>
59698
+ <tbody>
59699
+ ${this.getPreviewRows(e, n, 5).join("")}
59700
+ </tbody>
59701
+ </table>
59702
+ </div>
59701
59703
  </div>
59702
59704
  </div>
59703
59705
  </div>
@@ -59737,6 +59739,15 @@ class $Ze {
59737
59739
  }
59738
59740
  return i;
59739
59741
  }
59742
+ /**
59743
+ * 绑定折叠/展开事件
59744
+ */
59745
+ bindToggleEvent(e, r) {
59746
+ const n = e.querySelector(".dataset-header"), i = e.querySelector(".dataset-content");
59747
+ n && i && (n.style.cursor = "pointer", n.addEventListener("click", () => {
59748
+ i.style.display === "block" ? (i.style.display = "none", n.classList.remove("expanded")) : (i.style.display = "block", n.classList.add("expanded"));
59749
+ }));
59750
+ }
59740
59751
  /**
59741
59752
  * 绑定筛选器事件
59742
59753
  */
@@ -60032,7 +60043,9 @@ class $Ze {
60032
60043
  var o, l;
60033
60044
  s.nodeType === Node.ELEMENT_NODE && ((o = s.classList) != null && o.contains("dataset-container") || (l = s.querySelector) != null && l.call(s, ".dataset-container")) && (i = !0);
60034
60045
  });
60035
- }), i && this.renderDatasets();
60046
+ }), i && this.renderDatasets().catch((a) => {
60047
+ console.error("Dataset 渲染失败:", a);
60048
+ });
60036
60049
  }), this.observer.observe(r, {
60037
60050
  childList: !0,
60038
60051
  subtree: !0
@@ -104073,21 +104086,24 @@ function Uvt() {
104073
104086
  border: none;
104074
104087
  background: transparent;
104075
104088
  min-height: 100px;
104089
+ /* 消除inline-block元素间的空白间隙 */
104090
+ margin-right: -4px;
104076
104091
  }
104077
104092
 
104078
104093
  /* Cell宽度类 - 基于12列栅格系统 */
104079
- .cell-1 { width: 8.333%; } /* 1/12 = 8.333% */
104080
- .cell-2 { width: 16.667%; } /* 2/12 = 16.667% */
104081
- .cell-3 { width: 25%; } /* 3/12 = 25% */
104082
- .cell-4 { width: 33.333%; } /* 4/12 = 33.333% */
104083
- .cell-5 { width: 41.667%; } /* 5/12 = 41.667% */
104084
- .cell-6 { width: 50%; } /* 6/12 = 50% */
104085
- .cell-7 { width: 58.333%; } /* 7/12 = 58.333% */
104086
- .cell-8 { width: 66.667%; } /* 8/12 = 66.667% */
104087
- .cell-9 { width: 75%; } /* 9/12 = 75% */
104088
- .cell-10 { width: 83.333%; } /* 10/12 = 83.333% */
104089
- .cell-11 { width: 91.667%; } /* 11/12 = 91.667% */
104090
- .cell-12 { width: 100%; } /* 12/12 = 100% */
104094
+ /* 使用精确的小数位数避免四舍五入导致的宽度超标 */
104095
+ .cell-1 { width: 8.3333333333%; } /* 1/12 */
104096
+ .cell-2 { width: 16.6666666667%; } /* 2/12 */
104097
+ .cell-3 { width: 25%; } /* 3/12 */
104098
+ .cell-4 { width: 33.3333333333%; } /* 4/12 */
104099
+ .cell-5 { width: 41.6666666667%; } /* 5/12 */
104100
+ .cell-6 { width: 50%; } /* 6/12 */
104101
+ .cell-7 { width: 58.3333333333%; } /* 7/12 */
104102
+ .cell-8 { width: 66.6666666667%; } /* 8/12 */
104103
+ .cell-9 { width: 75%; } /* 9/12 */
104104
+ .cell-10 { width: 83.3333333333%; } /* 10/12 */
104105
+ .cell-11 { width: 91.6666666667%; } /* 11/12 */
104106
+ .cell-12 { width: 100%; } /* 12/12 */
104091
104107
 
104092
104108
  /* 确保cell内的内容不会溢出 */
104093
104109
  .md-cell > * {
@@ -104098,7 +104114,14 @@ function Uvt() {
104098
104114
  .md-cell .echarts-container,
104099
104115
  .md-cell .mermaid {
104100
104116
  width: 100%;
104101
- margin: 0;
104117
+ }
104118
+
104119
+ /* 确保 cell 内的 Mermaid 图表正确显示 */
104120
+ .md-cell .mermaid {
104121
+ min-height: 200px;
104122
+ display: flex;
104123
+ justify-content: center;
104124
+ align-items: center;
104102
104125
  }
104103
104126
  `, document.head.appendChild(t);
104104
104127
  }
@@ -141112,26 +141135,15 @@ const Q7t = /* @__PURE__ */ s6e(I7t, [["render", V7t], ["__scopeId", "data-v-3f2
141112
141135
  this.renderWithQueue();
141113
141136
  });
141114
141137
  },
141115
- renderWithQueue() {
141138
+ async renderWithQueue() {
141116
141139
  this.renderTimeout && (clearTimeout(this.renderTimeout), this.renderTimeout = null);
141117
141140
  try {
141118
- this.datasetRenderer.renderDatasets();
141119
- const t = () => {
141120
- document.removeEventListener("datasetsRendered", t);
141121
- try {
141122
- this.chartRenderer.processEChartsElements(), this.mermaidRenderer.renderMermaidCharts();
141123
- } catch (e) {
141124
- console.warn("图表渲染失败,但编辑功能仍可用:", e);
141125
- }
141126
- };
141127
- document.addEventListener("datasetsRendered", t), this.renderTimeout = setTimeout(() => {
141128
- document.removeEventListener("datasetsRendered", t);
141129
- try {
141130
- this.chartRenderer.processEChartsElements(), this.mermaidRenderer.renderMermaidCharts();
141131
- } catch (e) {
141132
- console.warn("图表渲染超时失败,但编辑功能仍可用:", e);
141133
- }
141134
- }, 1e3);
141141
+ await this.datasetRenderer.renderDatasets();
141142
+ try {
141143
+ this.chartRenderer.processEChartsElements(), this.mermaidRenderer.renderMermaidCharts();
141144
+ } catch (t) {
141145
+ console.warn("图表渲染失败,但编辑功能仍可用:", t);
141146
+ }
141135
141147
  } catch (t) {
141136
141148
  console.warn("渲染过程中发生错误,但编辑功能仍可用:", t);
141137
141149
  }
@@ -141250,7 +141262,7 @@ function H7t(t, e, r, n, i, a) {
141250
141262
  }, null, 8, ["visible", "content", "component-type", "onSave", "onClose"])
141251
141263
  ]);
141252
141264
  }
141253
- const Mfr = /* @__PURE__ */ s6e(q7t, [["render", H7t], ["__scopeId", "data-v-afdbc7b3"]]);
141265
+ const Mfr = /* @__PURE__ */ s6e(q7t, [["render", H7t], ["__scopeId", "data-v-9969e5e7"]]);
141254
141266
  class Wo {
141255
141267
  // The + prefix indicates that these fields aren't writeable
141256
141268
  // Lexer holding the input string.