@veltra/sheet 2.1.1 → 2.3.0

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.
Files changed (212) hide show
  1. package/dist/components/report/binding-badge.js +100 -0
  2. package/dist/components/report/designer/cell-coords.js +46 -0
  3. package/dist/components/report/designer/col-widths.js +29 -0
  4. package/dist/components/report/designer/conditional-rules/helpers.js +139 -0
  5. package/dist/components/report/designer/drop-highlight-overlay.js +76 -0
  6. package/dist/components/report/designer/float-panel.js +422 -0
  7. package/dist/components/report/designer/role.js +17 -0
  8. package/dist/components/report/designer/rule-preview.js +33 -0
  9. package/dist/components/report/designer/rule-row.js +253 -0
  10. package/dist/components/report/designer/rules-dialog.js +118 -0
  11. package/dist/components/report/designer/topology-overlay.js +122 -0
  12. package/dist/components/report/designer/topology.js +64 -0
  13. package/dist/components/report/designer/use-grid-overlay.js +75 -0
  14. package/dist/components/report/designer-hub.js +177 -0
  15. package/dist/components/report/field-panel-helpers.js +33 -0
  16. package/dist/components/report/field-panel.js +132 -0
  17. package/dist/components/report/filter-bar.js +74 -0
  18. package/dist/components/report/hub-connection-form.js +145 -0
  19. package/dist/components/report/hub-dataset-editor.js +394 -0
  20. package/dist/components/report/preview-grid-size.js +32 -0
  21. package/dist/components/report/report-designer.js +393 -0
  22. package/dist/components/report/report-viewer.js +124 -0
  23. package/dist/components/report/style.d.ts +17 -0
  24. package/dist/components/report/style.js +18 -0
  25. package/dist/components/report/style2.css +874 -0
  26. package/dist/components/report/use-report-designer.js +382 -0
  27. package/dist/components/report/use-report-viewer.js +55 -0
  28. package/dist/{vue → components/sheet}/formula-bar.js +1 -1
  29. package/dist/{vue → components/sheet}/formula-suggest-list.js +1 -1
  30. package/dist/{vue → components/sheet}/import-file.js +1 -1
  31. package/dist/{vue → components/sheet}/insert-count-menu-item.js +1 -1
  32. package/dist/{vue → components/sheet}/insert-image.js +1 -1
  33. package/dist/{vue → components/sheet}/popup-helpers.js +1 -1
  34. package/dist/{vue → components/sheet}/popups/border-popup.js +31 -3
  35. package/dist/{vue → components/sheet}/popups/border-preset-glyph.js +1 -1
  36. package/dist/{vue → components/sheet}/popups/export-popup.js +2 -2
  37. package/dist/{vue → components/sheet}/popups/fill-color-popup.js +3 -3
  38. package/dist/{vue → components/sheet}/popups/find-popup.js +1 -1
  39. package/dist/{vue → components/sheet}/popups/font-color-popup.js +3 -3
  40. package/dist/{vue → components/sheet}/popups/font-size-popup.js +3 -3
  41. package/dist/{vue → components/sheet}/popups/import.worker.d.ts +1 -1
  42. package/dist/{vue → components/sheet}/popups/import.worker.js +1 -1
  43. package/dist/{vue → components/sheet}/popups/insert-image-popup.js +1 -1
  44. package/dist/{vue → components/sheet}/sheet-context-menu.js +7 -4
  45. package/dist/{vue → components/sheet}/sheet-tabs.js +1 -1
  46. package/dist/{vue → components/sheet}/sheet-toolbar.js +1 -1
  47. package/dist/{vue → components/sheet}/sheet.js +16 -1
  48. package/dist/{vue → components/sheet}/use-find-replace.js +1 -1
  49. package/dist/{vue → components/sheet}/use-formula-ref-select.js +1 -1
  50. package/dist/{vue → components/sheet}/use-sheet-grid.js +22 -4
  51. package/dist/{vue → components/sheet}/use-sheet-state.js +6 -5
  52. package/dist/{vue → components/sheet}/use-sheet-tabs-bar.js +1 -1
  53. package/dist/{vue → components/sheet}/use-tool-groups.js +2 -2
  54. package/dist/{vue → components/sheet}/use-tool-popup.js +2 -2
  55. package/dist/{vue → components/sheet}/use-toolbar-scroll.js +1 -1
  56. package/dist/index.d.ts +17 -3
  57. package/dist/index.js +13 -3
  58. package/dist/report/binding.d.ts +83 -0
  59. package/dist/report/binding.js +332 -0
  60. package/dist/report/connector.d.ts +66 -0
  61. package/dist/report/connector.js +159 -0
  62. package/dist/report/export-xlsx.d.ts +17 -0
  63. package/dist/report/export-xlsx.js +92 -0
  64. package/dist/report/filter-bar.d.ts +10 -0
  65. package/dist/report/filter-bar.js +31 -0
  66. package/dist/report/index.d.ts +12 -0
  67. package/dist/report/params.d.ts +13 -0
  68. package/dist/report/params.js +61 -0
  69. package/dist/report/render/aggregate.js +169 -0
  70. package/dist/report/render/builder.d.ts +12 -0
  71. package/dist/report/render/builder.js +139 -0
  72. package/dist/report/render/coordinate.d.ts +25 -0
  73. package/dist/report/render/coordinate.js +733 -0
  74. package/dist/report/render/index.d.ts +14 -0
  75. package/dist/report/render/index.js +21 -0
  76. package/dist/report/render/style-resolver.js +50 -0
  77. package/dist/report/render/template-index.d.ts +24 -0
  78. package/dist/report/render/template-index.js +137 -0
  79. package/dist/report/rules/evaluate.d.ts +25 -0
  80. package/dist/report/rules/evaluate.js +82 -0
  81. package/dist/report/rules/index.d.ts +2 -0
  82. package/dist/report/template.d.ts +63 -0
  83. package/dist/report/template.js +83 -0
  84. package/dist/report/types.d.ts +85 -0
  85. package/dist/tools/apply-style.js +29 -0
  86. package/dist/tools/builtin.js +17 -17
  87. package/dist/tools/context.d.ts +39 -6
  88. package/dist/tools/context.js +38 -1
  89. package/dist/types/index.d.ts +3 -2
  90. package/dist/types/report-designer.d.ts +38 -0
  91. package/dist/types/report-viewer.d.ts +38 -0
  92. package/dist/types/sheet.d.ts +21 -1
  93. package/package.json +6 -8
  94. package/src/components/report/__test__/conditional-rules-helpers.test.ts +88 -0
  95. package/src/components/report/__test__/field-panel-helpers.test.ts +65 -0
  96. package/src/components/report/__test__/float-panel-position.test.ts +45 -0
  97. package/src/components/report/__test__/preview-grid-size.test.ts +63 -0
  98. package/src/components/report/__test__/report-designer.test.ts +464 -0
  99. package/src/components/report/__test__/report-viewer.test.ts +357 -0
  100. package/src/components/report/__test__/topology.test.ts +143 -0
  101. package/src/components/report/__test__/use-report-designer.test.ts +697 -0
  102. package/src/components/report/binding-badge.ts +92 -0
  103. package/src/components/report/designer/cell-coords.ts +94 -0
  104. package/src/components/report/designer/col-widths.ts +56 -0
  105. package/src/components/report/designer/conditional-rules/helpers.ts +189 -0
  106. package/src/components/report/designer/drop-highlight-overlay.vue +74 -0
  107. package/src/components/report/designer/float-panel.vue +431 -0
  108. package/src/components/report/designer/role.ts +32 -0
  109. package/src/components/report/designer/rule-preview.vue +40 -0
  110. package/src/components/report/designer/rule-row.vue +252 -0
  111. package/src/components/report/designer/rules-dialog.vue +110 -0
  112. package/src/components/report/designer/topology-overlay.vue +127 -0
  113. package/src/components/report/designer/topology.ts +124 -0
  114. package/src/components/report/designer/use-grid-overlay.ts +113 -0
  115. package/src/components/report/designer-hub.vue +198 -0
  116. package/src/components/report/field-panel-helpers.ts +44 -0
  117. package/src/components/report/field-panel.vue +136 -0
  118. package/src/components/report/filter-bar.vue +77 -0
  119. package/src/components/report/hub-connection-form.vue +124 -0
  120. package/src/components/report/hub-dataset-editor.vue +369 -0
  121. package/src/components/report/index.ts +2 -0
  122. package/src/components/report/preview-grid-size.ts +33 -0
  123. package/src/components/report/report-designer.vue +420 -0
  124. package/src/components/report/report-viewer.vue +136 -0
  125. package/src/components/report/style-designer.scss +587 -0
  126. package/src/components/report/style-hub.scss +292 -0
  127. package/src/components/report/style-viewer.scss +104 -0
  128. package/src/components/report/style.scss +3 -0
  129. package/src/components/report/style.ts +20 -0
  130. package/src/components/report/use-report-designer.ts +596 -0
  131. package/src/components/report/use-report-viewer.ts +88 -0
  132. package/src/{vue → components/sheet}/__test__/formula-bar.test.ts +37 -18
  133. package/src/{vue → components/sheet}/__test__/insert-image-popup.test.ts +1 -1
  134. package/src/{vue → components/sheet}/__test__/insert-image.test.ts +1 -1
  135. package/src/{vue → components/sheet}/__test__/sheet-component.test.ts +77 -3
  136. package/src/{vue → components/sheet}/__test__/sheet-context-menu.test.ts +4 -3
  137. package/src/{vue → components/sheet}/formula-bar.vue +1 -1
  138. package/src/{vue → components/sheet}/insert-image.ts +1 -1
  139. package/src/{vue → components/sheet}/popup-helpers.ts +1 -1
  140. package/src/{vue → components/sheet}/popups/border-popup.vue +32 -4
  141. package/src/{vue → components/sheet}/popups/export-popup.vue +2 -2
  142. package/src/{vue → components/sheet}/popups/fill-color-popup.vue +3 -3
  143. package/src/{vue → components/sheet}/popups/find-popup.vue +1 -1
  144. package/src/{vue → components/sheet}/popups/font-color-popup.vue +3 -3
  145. package/src/{vue → components/sheet}/popups/font-size-popup.vue +3 -3
  146. package/src/{vue → components/sheet}/popups/insert-image-popup.vue +1 -1
  147. package/src/{vue → components/sheet}/sheet-context-menu.ts +10 -4
  148. package/src/{vue → components/sheet}/sheet-toolbar.vue +2 -2
  149. package/src/{vue → components/sheet}/sheet.vue +6 -3
  150. package/src/{vue → components/sheet}/use-find-replace.ts +1 -1
  151. package/src/{vue → components/sheet}/use-sheet-grid.ts +23 -5
  152. package/src/{vue → components/sheet}/use-sheet-state.ts +11 -6
  153. package/src/{vue → components/sheet}/use-tool-groups.ts +2 -2
  154. package/src/{vue → components/sheet}/use-tool-popup.ts +2 -2
  155. package/src/index.ts +24 -188
  156. package/src/report/__test__/binding.test.ts +320 -0
  157. package/src/report/__test__/connector.test.ts +239 -0
  158. package/src/report/__test__/export-xlsx.test.ts +118 -0
  159. package/src/report/__test__/filter-bar.test.ts +58 -0
  160. package/src/report/__test__/params.test.ts +156 -0
  161. package/src/report/__test__/render.test.ts +830 -0
  162. package/src/report/__test__/rules.test.ts +131 -0
  163. package/src/report/__test__/template.test.ts +366 -0
  164. package/src/report/binding.ts +474 -0
  165. package/src/report/connector.ts +206 -0
  166. package/src/report/export-xlsx.ts +113 -0
  167. package/src/report/filter-bar.ts +36 -0
  168. package/src/report/index.ts +13 -0
  169. package/src/report/params.ts +96 -0
  170. package/src/report/render/__test__/aggregate.test.ts +16 -0
  171. package/src/report/render/__test__/coordinate.test.ts +405 -0
  172. package/src/report/render/aggregate.ts +261 -0
  173. package/src/report/render/builder.ts +211 -0
  174. package/src/report/render/coordinate.ts +1239 -0
  175. package/src/report/render/index.ts +30 -0
  176. package/src/report/render/style-resolver.ts +68 -0
  177. package/src/report/render/template-index.ts +200 -0
  178. package/src/report/rules/evaluate.ts +113 -0
  179. package/src/report/rules/index.ts +7 -0
  180. package/src/report/template.ts +145 -0
  181. package/src/report/types.ts +96 -0
  182. package/src/tools/__test__/apply-style.test.ts +129 -0
  183. package/src/tools/apply-style.ts +41 -0
  184. package/src/tools/builtin.ts +20 -20
  185. package/src/tools/context.ts +67 -4
  186. package/src/tools/index.ts +1 -0
  187. package/src/types/index.ts +2 -6
  188. package/src/types/report-designer.ts +38 -0
  189. package/src/types/report-viewer.ts +37 -0
  190. package/src/types/sheet.ts +26 -1
  191. /package/dist/{vue → components/sheet}/style.d.ts +0 -0
  192. /package/dist/{vue → components/sheet}/style.js +0 -0
  193. /package/dist/{vue → components/sheet}/style2.css +0 -0
  194. /package/dist/{vue → components/sheet}/use-formula-suggest.js +0 -0
  195. /package/src/{vue → components/sheet}/__test__/import-file.test.ts +0 -0
  196. /package/src/{vue → components/sheet}/__test__/insert-count-menu-item.test.ts +0 -0
  197. /package/src/{vue → components/sheet}/__test__/use-formula-ref-select.test.ts +0 -0
  198. /package/src/{vue → components/sheet}/__test__/use-formula-suggest.test.ts +0 -0
  199. /package/src/{vue → components/sheet}/formula-suggest-list.vue +0 -0
  200. /package/src/{vue → components/sheet}/import-file.ts +0 -0
  201. /package/src/{vue → components/sheet}/index.ts +0 -0
  202. /package/src/{vue → components/sheet}/insert-count-menu-item.vue +0 -0
  203. /package/src/{vue → components/sheet}/parsing.ts +0 -0
  204. /package/src/{vue → components/sheet}/popups/border-preset-glyph.vue +0 -0
  205. /package/src/{vue → components/sheet}/popups/import.worker.ts +0 -0
  206. /package/src/{vue → components/sheet}/sheet-tabs.vue +0 -0
  207. /package/src/{vue → components/sheet}/style.scss +0 -0
  208. /package/src/{vue → components/sheet}/style.ts +0 -0
  209. /package/src/{vue → components/sheet}/use-formula-ref-select.ts +0 -0
  210. /package/src/{vue → components/sheet}/use-formula-suggest.ts +0 -0
  211. /package/src/{vue → components/sheet}/use-sheet-tabs-bar.ts +0 -0
  212. /package/src/{vue → components/sheet}/use-toolbar-scroll.ts +0 -0
@@ -1,4 +1,4 @@
1
- //#region src/vue/popups/import.worker.ts
1
+ //#region src/components/sheet/popups/import.worker.ts
2
2
  self.onmessage = (e) => {
3
3
  const { buffer } = e.data;
4
4
  (async () => {
@@ -2,7 +2,7 @@ import { INSERT_IMAGE_ACCEPT, insertImageFromFile } from "../insert-image.js";
2
2
  import { createBlock, createElementVNode, createTextVNode, defineComponent, normalizeClass, openBlock, unref, withCtx } from "vue";
3
3
  import { UFilePicker } from "@veltra/desktop";
4
4
  import { bem } from "@veltra/utils";
5
- //#region src/vue/popups/insert-image-popup.vue
5
+ //#region src/components/sheet/popups/insert-image-popup.vue
6
6
  const _sfc_main = /*@__PURE__*/ defineComponent({
7
7
  name: "USheetInsertImagePopup",
8
8
  __name: "insert-image-popup",
@@ -1,4 +1,4 @@
1
- import { defaultToolRegistry } from "../tools/registry.js";
1
+ import { defaultToolRegistry } from "../../tools/registry.js";
2
2
  import { pickAndInsertImage } from "./insert-image.js";
3
3
  import _sfc_main from "./insert-count-menu-item.js";
4
4
  import { createRange } from "@veltra/sheet-core/core/address";
@@ -38,11 +38,14 @@ function wholeColRange(col, rowCount) {
38
38
  col
39
39
  });
40
40
  }
41
- /** 渲染尺寸 = max(props, sheet.rows/cols),与 SheetGrid 一致 */
41
+ /**
42
+ * 渲染尺寸:模型已声明时以模型为准(删行可低于 props);未声明时回落 props。
43
+ * 与 SheetGrid / useSheetGrid 一致——避免 ensureTableSize(props) 把删行结果撑回。
44
+ */
42
45
  function resolveRenderSize(propsRows, propsCols, sheetRows, sheetCols) {
43
46
  return {
44
- rows: Math.max(propsRows ?? 100, sheetRows),
45
- cols: Math.max(propsCols ?? 26, sheetCols)
47
+ rows: sheetRows > 0 ? sheetRows : propsRows ?? 100,
48
+ cols: sheetCols > 0 ? sheetCols : propsCols ?? 26
46
49
  };
47
50
  }
48
51
  function insertCountRender(options) {
@@ -3,7 +3,7 @@ import { ArrowLeft, ArrowRight } from "@veltra/icons/normal";
3
3
  import { Fragment, createElementBlock, createElementVNode, createVNode, defineComponent, nextTick, normalizeClass, openBlock, ref, renderList, toDisplayString, toRef, unref, useTemplateRef, vModelText, vShow, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
4
  import { UIcon, contextmenu, message, messageConfirm } from "@veltra/desktop";
5
5
  import { bem } from "@veltra/utils";
6
- //#region src/vue/sheet-tabs.vue
6
+ //#region src/components/sheet/sheet-tabs.vue
7
7
  const _hoisted_1 = ["disabled"];
8
8
  const _hoisted_2 = ["onClick", "onContextmenu"];
9
9
  const _hoisted_3 = ["onKeydown"];
@@ -3,7 +3,7 @@ import { ArrowLeft, ArrowRight } from "@veltra/icons/normal";
3
3
  import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, resolveComponent, resolveDynamicComponent, toDisplayString, toRef, unref, useTemplateRef, withCtx } from "vue";
4
4
  import { UIcon } from "@veltra/desktop";
5
5
  import { bem } from "@veltra/utils";
6
- //#region src/vue/sheet-toolbar.vue
6
+ //#region src/components/sheet/sheet-toolbar.vue
7
7
  const _hoisted_1 = ["disabled"];
8
8
  const _hoisted_2 = [
9
9
  "data-tool-id",
@@ -16,7 +16,7 @@ import { useToolPopup } from "./use-tool-popup.js";
16
16
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, toDisplayString, unref, useTemplateRef, watch, withCtx, withModifiers } from "vue";
17
17
  import { UDropdown } from "@veltra/desktop";
18
18
  import { bem } from "@veltra/utils";
19
- //#region src/vue/sheet.vue
19
+ //#region src/components/sheet/sheet.vue
20
20
  const _sfc_main = /*@__PURE__*/ defineComponent({
21
21
  name: "USheet",
22
22
  __name: "sheet",
@@ -24,6 +24,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
24
24
  workbook: {},
25
25
  rows: { default: 100 },
26
26
  cols: { default: 26 },
27
+ resolveDisplayValue: {},
28
+ resolveCellStyle: {},
29
+ resolveCellRenderer: {},
27
30
  showToolbar: {
28
31
  type: Boolean,
29
32
  default: true
@@ -35,6 +38,18 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
35
38
  showTabs: {
36
39
  type: Boolean,
37
40
  default: true
41
+ },
42
+ showRowHeader: {
43
+ type: Boolean,
44
+ default: true
45
+ },
46
+ showColHeader: {
47
+ type: Boolean,
48
+ default: true
49
+ },
50
+ readonly: {
51
+ type: Boolean,
52
+ default: false
38
53
  }
39
54
  },
40
55
  emits: ["active-sheet-change"],
@@ -2,7 +2,7 @@ import { computed, ref, shallowRef, watch } from "vue";
2
2
  import { debounce } from "@cat-kit/core";
3
3
  import { inferCellType, normalizeInputValue } from "@veltra/sheet-core/core/cell-store";
4
4
  import { findAll, findNextFrom, findPrevFrom } from "@veltra/sheet-core/core/find";
5
- //#region src/vue/use-find-replace.ts
5
+ //#region src/components/sheet/use-find-replace.ts
6
6
  /**
7
7
  * 查找条逻辑(关键词 / 上一个 / 下一个 / 命中计数 / 替换):
8
8
  * - 关键词 / 选项变化 → 重新查找并定位第一个命中
@@ -1,4 +1,4 @@
1
- //#region src/vue/use-formula-ref-select.ts
1
+ //#region src/components/sheet/use-formula-ref-select.ts
2
2
  /** 引用选择上下文:光标前一个非空字符属于此集合时可插入单元格引用 */
3
3
  const REF_TRIGGER_CHARS = /* @__PURE__ */ new Set([
4
4
  "=",
@@ -2,7 +2,7 @@ import { buildBodyMenus, buildColHeaderMenus, buildRowHeaderMenus, ensureContext
2
2
  import { onBeforeUnmount, onMounted, watch } from "vue";
3
3
  import { contextmenu } from "@veltra/desktop";
4
4
  import { SheetGrid } from "@veltra/sheet-core/grid/sheet-grid";
5
- //#region src/vue/use-sheet-grid.ts
5
+ //#region src/components/sheet/use-sheet-grid.ts
6
6
  /**
7
7
  * 缓存容量:最近 N 个 sheet 的 SheetGrid 实例常驻(tab 来回切换零重建)。
8
8
  * 大文件多 sheet 场景下切换卡顿的主因是每次重建 VTable(实例创建 + scenegraph
@@ -57,11 +57,18 @@ function useSheetGrid(options) {
57
57
  const el = document.createElement("div");
58
58
  el.className = "u-sheet__grid-instance";
59
59
  host.appendChild(el);
60
+ const { rows, cols } = resolveRenderSize(props.rows, props.cols, sheet.rows, sheet.cols);
60
61
  const grid = new SheetGrid({
61
62
  container: el,
62
63
  sheet,
63
- rows: props.rows,
64
- cols: props.cols,
64
+ rows,
65
+ cols,
66
+ readonly: props.readonly,
67
+ showRowHeader: props.showRowHeader,
68
+ showColHeader: props.showColHeader,
69
+ resolveDisplayValue: props.resolveDisplayValue,
70
+ resolveCellStyle: props.resolveCellStyle,
71
+ resolveCellRenderer: props.resolveCellRenderer,
65
72
  onContextMenu: handleContextMenu,
66
73
  onEditStart: (addr) => formulaBarRef.value?.mirrorGridEdit(addr),
67
74
  onEditEnd: (addr) => formulaBarRef.value?.exitMirror(addr),
@@ -165,7 +172,18 @@ function useSheetGrid(options) {
165
172
  activateGrid();
166
173
  }
167
174
  onMounted(activateGrid);
168
- watch(() => [props.rows, props.cols], rebuildGrid);
175
+ watch(() => [
176
+ props.rows,
177
+ props.cols,
178
+ props.readonly,
179
+ props.showRowHeader,
180
+ props.showColHeader
181
+ ], ([nextRows, nextCols]) => {
182
+ const sheet = getActiveSheet();
183
+ if (nextRows != null) sheet.ensureTableSize(nextRows, 0);
184
+ if (nextCols != null) sheet.ensureTableSize(0, nextCols);
185
+ rebuildGrid();
186
+ });
169
187
  onBeforeUnmount(() => {
170
188
  invalidateAll();
171
189
  });
@@ -1,8 +1,9 @@
1
- import { defaultToolRegistry } from "../tools/registry.js";
2
- import { createSheetContext } from "../tools/context.js";
1
+ import { defaultToolRegistry } from "../../tools/registry.js";
2
+ import { createSheetContext } from "../../tools/context.js";
3
+ import { resolveRenderSize } from "./sheet-context-menu.js";
3
4
  import { computed, onBeforeUnmount, onMounted, ref, shallowRef, watch } from "vue";
4
5
  import { Workbook } from "@veltra/sheet-core/core/workbook";
5
- //#region src/vue/use-sheet-state.ts
6
+ //#region src/components/sheet/use-sheet-state.ts
6
7
  /**
7
8
  * USheet 的状态源(单一数据源,其余状态由此推导):
8
9
  * - workbook(外部传入或内部自建单 sheet 工作簿)、sheetList、activeIndex、activeSheet
@@ -19,8 +20,8 @@ function useSheetState(props, emit, hooks) {
19
20
  /** sheet 列表(tabs 渲染;由 sheets-change 同步) */
20
21
  const sheetList = shallowRef(workbook.value.getSheets());
21
22
  const activeSheet = computed(() => sheetList.value[activeIndex.value] ?? workbook.value.activeSheet);
22
- /** 工具上下文:动态解析活动 sheet 与当前工作簿,tab 切换 / workbook prop 切换后自动指向最新值 */
23
- const context = createSheetContext(() => activeSheet.value, () => workbook.value);
23
+ /** 工具上下文:动态解析活动 sheet / 工作簿 / 渲染尺寸,tab 切换后自动指向最新值 */
24
+ const context = createSheetContext(() => activeSheet.value, () => workbook.value, { resolveGridSize: () => resolveRenderSize(props.rows, props.cols, activeSheet.value.rows, activeSheet.value.cols) });
24
25
  /** 工具栏状态版本号:visible/disabled/active 是 (ctx) => boolean 纯函数,状态源变化时 bump 触发重算 */
25
26
  const stateTick = ref(0);
26
27
  const bump = () => {
@@ -1,6 +1,6 @@
1
1
  import { nextTick, onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
2
2
  import { applyWheelHorizontalScroll, computeOverflowNavState, scrollElementIntoView, scrollViewportByStep } from "@veltra/utils";
3
- //#region src/vue/use-sheet-tabs-bar.ts
3
+ //#region src/components/sheet/use-sheet-tabs-bar.ts
4
4
  /**
5
5
  * Sheet 底部标签栏溢出滚动(滚动几何/滚轮转横滚/元素滚入视野共享
6
6
  * @veltra/utils overflow-nav,见 #17;此处保留事件绑定与 watch 差异):
@@ -1,6 +1,6 @@
1
- import { defaultToolRegistry } from "../tools/registry.js";
1
+ import { defaultToolRegistry } from "../../tools/registry.js";
2
2
  import { computed } from "vue";
3
- //#region src/vue/use-tool-groups.ts
3
+ //#region src/components/sheet/use-tool-groups.ts
4
4
  /**
5
5
  * 内置组稳定顺序:history | cell | text | edit | insert | file。
6
6
  * 未列出的自定义组按注册先后排在已知组之后。
@@ -1,6 +1,6 @@
1
- import { defaultToolRegistry } from "../tools/registry.js";
1
+ import { defaultToolRegistry } from "../../tools/registry.js";
2
2
  import { onBeforeUnmount, onMounted, shallowRef } from "vue";
3
- //#region src/vue/use-tool-popup.ts
3
+ //#region src/components/sheet/use-tool-popup.ts
4
4
  /**
5
5
  * 面板打开期间的写入是否合并为一个 undo 单元(关闭时提交):
6
6
  * 填充颜色 / 边框 / 字体颜色 / 字号参与事务;查找(每次替换独立 undo)、
@@ -1,6 +1,6 @@
1
1
  import { onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
2
2
  import { applyWheelHorizontalScroll, computeOverflowNavState, scrollViewportByStep } from "@veltra/utils";
3
- //#region src/vue/use-toolbar-scroll.ts
3
+ //#region src/components/sheet/use-toolbar-scroll.ts
4
4
  /**
5
5
  * 工具栏溢出滚动(滚动几何/滚轮转横滚共享 @veltra/utils overflow-nav,见 #17;
6
6
  * 无活动项跟随):
package/dist/index.d.ts CHANGED
@@ -1,7 +1,21 @@
1
- import _sfc_main from "./vue/sheet.js";
1
+ import _sfc_main$2 from "./components/sheet/sheet.js";
2
+ import _sfc_main$1 from "./components/report/report-viewer.js";
3
+ import _sfc_main from "./components/report/report-designer.js";
2
4
  import { SheetContext, createSheetContext } from "./tools/context.js";
3
5
  import { SheetTool, SheetToolGroup, SheetToolPopupType, defaultToolRegistry, registerTool, unregisterTool } from "./tools/registry.js";
4
6
  import { SheetEmits, SheetExposed, SheetProps, _SheetExposed } from "./types/sheet.js";
7
+ import { ConditionalOperator, ConditionalRule, DatasetCatalogItem, DatasetField, DatasetRecords, ParamValues, QueryParamDef, QueryParamOption, QueryParamType, ReportAggregate, ReportBinding, ReportExpand, ReportPreset, ReportSort } from "./report/types.js";
8
+ import { InferParentOptions, ListParentCandidateOptions, REPORT_META_NAMESPACE, applyReportPreset, createReportBinding, formatBindingPlaceholder, formatBindingPlaceholderParts, formatCellAddress, formatParentCandidateLabel, inferColParentCandidate, inferDropPreset, inferParentsForPreset, inferReportPreset, inferRowParentCandidate, isColGroupBinding, isExpansionBandCol, isExpansionBandRow, isHorizontalExpandBinding, isReductionAggregate, isRowGroupBinding, isVerticalExpandBinding, listColParentCandidates, listRowParentCandidates, parseCellAddress, prefersGroupParent, presetBindingPatch, presetStillApplies, setBindingCatalog } from "./report/binding.js";
9
+ import { ConditionalEvalContext, evaluateCondition, evaluateConditionalStyle, resolveRuleCompareValue, toComparableNumber } from "./report/rules/evaluate.js";
10
+ import { buildParamDefs, extractParamIds, resolveBoundDatasetParams } from "./report/params.js";
11
+ import { ReportColWidthEntry, buildColumnDefs, exportFilledReportXlsx, pxToExcelColWidth } from "./report/export-xlsx.js";
12
+ import { mapFilledColWidths } from "./report/render/builder.js";
13
+ import { renderReport, resolveFilledColWidths } from "./report/render/index.js";
14
+ import { ConnectionType, ConnectorError, CreateHttpConnectorOptions, DEFAULT_CONNECTION_PORTS, DataConnection, DataConnector, QueryResult, Result, createHttpConnector, resolvePortOnTypeChange } from "./report/connector.js";
15
+ import { IncompatibleTemplateVersionError, REPORT_TEMPLATE_VERSION, ReportDatasetDef, ReportTemplate, assertCompatibleTemplateVersion, createReportTemplate, fetchTemplateRecords, getBoundDatasetIds, getTemplateDatasets, resolveParamDefaults, resolveTemplateParams } from "./report/template.js";
16
+ import { parseDateRangeValue, patchParamValues, resolveNumberParamValue } from "./report/filter-bar.js";
17
+ import "./report/index.js";
18
+ import { ReportViewerExposed, ReportViewerProps, _ReportViewerExposed } from "./types/report-viewer.js";
19
+ import { ReportDesignerEmits, ReportDesignerExposed, ReportDesignerProps, _ReportDesignerExposed } from "./types/report-designer.js";
5
20
  import "./types/index.js";
6
- import { ALIGN_STYLE_KEYS, AstNode, AstReference, BORDER_EDGE_DEFAULTS, BORDER_SIDES, BORDER_STYLE_WIDTH, BinaryOperator, BorderEdge, BorderLineStyle, BorderPreset, BorderPresetItem, BorderSide, CellAddress, CellAlign, CellData, CellFont, CellInfo, CellPatch, CellRange, CellSnapshotItem, CellStore, CellStyle, CellStylePatch, CellType, CellValue, Command, CommandContext, CommandResult, DependencyGraph, EvalValue, FONT_STYLE_KEYS, FORMULA_ERROR_CODES, FillDirection, FindMatch, FindOptions, FormulaDependency, FormulaError, FormulaErrorCode, FormulaEvalContext, FormulaFunction, FormulaFunctionMeta, FormulaNode, FormulaOperator, FormulaParseError, FormulaToken, FrozenState, GenerateFillOptions, HistoryManager, HistoryState, HorizontalAlign, ImageInput, ImagePatch, ImageUpdateFields, InsertCellsCommand, InsertCellsParams, InsertImageCommand, InsertImageParams, MergeCellsCommand, MergeCellsParams, MergeManager, MergePatch, MergeResult, MergedCellKind, Mutation, NUMERIC_TEXT_RE, Patch, PatchDirection, RemoveImageCommand, RemoveImageParams, ScalarValue, SelectionModel, SelectionState, SetCellFormulaCommand, SetCellFormulaParams, SetCellStyleCommand, SetCellStyleItem, SetCellStyleParams, SetCellValueCommand, SetCellValueItem, SetCellValueParams, Sheet, SheetEvents, SheetGrid, SheetGridContextMenuInfo, SheetGridContextMenuKind, SheetGridOptions, SheetImage, SheetImageAnchor, SheetImageType, SheetSnapshot, SnapshotPatch, StructureChange, StructurePatch, StyleId, StylePool, UnmergeCellsCommand, UnmergeCellsParams, UpdateImageCommand, UpdateImageParams, VerticalAlign, Workbook, WorkbookEvents, boundingBox, buildBorderPresetItems, cellDataEqual, cellKey, cloneImageAnchor, cloneSheetImage, coerceToBoolean, coerceToNumber, coerceToText, colIndexToName, colNameToIndex, collectReferences, computeFillTargetRange, createImageId, createRange, defaultCommandRegistry, evaluateAst, exportSheetCsv, exportWorkbookXlsx, findAll, findNext, findNextFrom, findPrev, findPrevFrom, formatAddress, formatRange, formulaError, generateFill, importCsv, importXlsx, inferCellType, invokeFormulaFunction, isEmptyCellData, isFormulaError, isFormulaErrorCode, iterateRange, listFormulaFunctions, normalizeInputValue, parseAddress, parseFormula, parseRange, rangeContainsAddress, rangesEqual, rangesIntersect, registerFormulaFunction, replaceWorkbook, tokenizeFormula } from "@veltra/sheet-core";
7
- export { ALIGN_STYLE_KEYS, type AstNode, type AstReference, BORDER_EDGE_DEFAULTS, BORDER_SIDES, BORDER_STYLE_WIDTH, type BinaryOperator, type BorderEdge, type BorderLineStyle, type BorderPreset, type BorderPresetItem, type BorderSide, type CellAddress, type CellAlign, type CellData, type CellFont, type CellInfo, type CellPatch, type CellRange, type CellSnapshotItem, CellStore, type CellStyle, type CellStylePatch, type CellType, type CellValue, type Command, type CommandContext, type CommandResult, DependencyGraph, type EvalValue, FONT_STYLE_KEYS, FORMULA_ERROR_CODES, type FillDirection, type FindMatch, type FindOptions, type FormulaDependency, type FormulaError, type FormulaErrorCode, type FormulaEvalContext, type FormulaFunction, type FormulaFunctionMeta, type FormulaNode, type FormulaOperator, FormulaParseError, type FormulaToken, type FrozenState, type GenerateFillOptions, HistoryManager, type HistoryState, type HorizontalAlign, type ImageInput, type ImagePatch, type ImageUpdateFields, InsertCellsCommand, type InsertCellsParams, InsertImageCommand, type InsertImageParams, MergeCellsCommand, type MergeCellsParams, MergeManager, type MergePatch, type MergeResult, type MergedCellKind, type Mutation, NUMERIC_TEXT_RE, type Patch, type PatchDirection, RemoveImageCommand, type RemoveImageParams, type ScalarValue, SelectionModel, type SelectionState, SetCellFormulaCommand, type SetCellFormulaParams, SetCellStyleCommand, type SetCellStyleItem, type SetCellStyleParams, SetCellValueCommand, type SetCellValueItem, type SetCellValueParams, Sheet, type SheetContext, type SheetEmits, type SheetEvents, type SheetExposed, SheetGrid, type SheetGridContextMenuInfo, type SheetGridContextMenuKind, type SheetGridOptions, type SheetImage, type SheetImageAnchor, type SheetImageType, type SheetProps, type SheetSnapshot, type SheetTool, type SheetToolGroup, type SheetToolPopupType, type SnapshotPatch, type StructureChange, type StructurePatch, type StyleId, StylePool, _sfc_main as USheet, UnmergeCellsCommand, type UnmergeCellsParams, UpdateImageCommand, type UpdateImageParams, type VerticalAlign, Workbook, type WorkbookEvents, type _SheetExposed, boundingBox, buildBorderPresetItems, cellDataEqual, cellKey, cloneImageAnchor, cloneSheetImage, coerceToBoolean, coerceToNumber, coerceToText, colIndexToName, colNameToIndex, collectReferences, computeFillTargetRange, createImageId, createRange, createSheetContext, defaultCommandRegistry, defaultToolRegistry, evaluateAst, exportSheetCsv, exportWorkbookXlsx, findAll, findNext, findNextFrom, findPrev, findPrevFrom, formatAddress, formatRange, formulaError, generateFill, importCsv, importXlsx, inferCellType, invokeFormulaFunction, isEmptyCellData, isFormulaError, isFormulaErrorCode, iterateRange, listFormulaFunctions, normalizeInputValue, parseAddress, parseFormula, parseRange, rangeContainsAddress, rangesEqual, rangesIntersect, registerFormulaFunction, registerTool, replaceWorkbook, tokenizeFormula, unregisterTool };
21
+ export { type ConditionalEvalContext, ConditionalOperator, ConditionalRule, ConnectionType, ConnectorError, CreateHttpConnectorOptions, DEFAULT_CONNECTION_PORTS, DataConnection, DataConnector, DatasetCatalogItem, DatasetField, DatasetRecords, IncompatibleTemplateVersionError, InferParentOptions, ListParentCandidateOptions, ParamValues, QueryParamDef, QueryParamOption, QueryParamType, QueryResult, REPORT_META_NAMESPACE, REPORT_TEMPLATE_VERSION, ReportAggregate, ReportBinding, ReportColWidthEntry, ReportDatasetDef, type ReportDesignerEmits, type ReportDesignerExposed, type ReportDesignerProps, ReportExpand, ReportPreset, ReportSort, ReportTemplate, type ReportViewerExposed, type ReportViewerProps, Result, type SheetContext, type SheetEmits, type SheetExposed, type SheetProps, type SheetTool, type SheetToolGroup, type SheetToolPopupType, _sfc_main as UReportDesigner, _sfc_main$1 as UReportViewer, _sfc_main$2 as USheet, type _ReportDesignerExposed, type _ReportViewerExposed, type _SheetExposed, applyReportPreset, assertCompatibleTemplateVersion, buildColumnDefs, buildParamDefs, createHttpConnector, createReportBinding, createReportTemplate, createSheetContext, defaultToolRegistry, evaluateCondition, evaluateConditionalStyle, exportFilledReportXlsx, extractParamIds, fetchTemplateRecords, formatBindingPlaceholder, formatBindingPlaceholderParts, formatCellAddress, formatParentCandidateLabel, getBoundDatasetIds, getTemplateDatasets, inferColParentCandidate, inferDropPreset, inferParentsForPreset, inferReportPreset, inferRowParentCandidate, isColGroupBinding, isExpansionBandCol, isExpansionBandRow, isHorizontalExpandBinding, isReductionAggregate, isRowGroupBinding, isVerticalExpandBinding, listColParentCandidates, listRowParentCandidates, mapFilledColWidths, parseCellAddress, parseDateRangeValue, patchParamValues, prefersGroupParent, presetBindingPatch, presetStillApplies, pxToExcelColWidth, registerTool, renderReport, resolveBoundDatasetParams, resolveFilledColWidths, resolveNumberParamValue, resolveParamDefaults, resolvePortOnTypeChange, resolveRuleCompareValue, resolveTemplateParams, setBindingCatalog, toComparableNumber, unregisterTool };
package/dist/index.js CHANGED
@@ -1,6 +1,16 @@
1
1
  import { defaultToolRegistry, registerTool, unregisterTool } from "./tools/registry.js";
2
2
  import "./tools/builtin.js";
3
3
  import { createSheetContext } from "./tools/context.js";
4
- import _sfc_main from "./vue/sheet.js";
5
- import { ALIGN_STYLE_KEYS, BORDER_EDGE_DEFAULTS, BORDER_SIDES, BORDER_STYLE_WIDTH, CellStore, DependencyGraph, FONT_STYLE_KEYS, FORMULA_ERROR_CODES, FormulaParseError, HistoryManager, InsertCellsCommand, InsertImageCommand, MergeCellsCommand, MergeManager, NUMERIC_TEXT_RE, RemoveImageCommand, SelectionModel, SetCellFormulaCommand, SetCellStyleCommand, SetCellValueCommand, Sheet, SheetGrid, StylePool, UnmergeCellsCommand, UpdateImageCommand, Workbook, boundingBox, buildBorderPresetItems, cellDataEqual, cellKey, cloneImageAnchor, cloneSheetImage, coerceToBoolean, coerceToNumber, coerceToText, colIndexToName, colNameToIndex, collectReferences, computeFillTargetRange, createImageId, createRange, defaultCommandRegistry, evaluateAst, exportSheetCsv, exportWorkbookXlsx, findAll, findNext, findNextFrom, findPrev, findPrevFrom, formatAddress, formatRange, formulaError, generateFill, importCsv, importXlsx, inferCellType, invokeFormulaFunction, isEmptyCellData, isFormulaError, isFormulaErrorCode, iterateRange, listFormulaFunctions, normalizeInputValue, parseAddress, parseFormula, parseRange, rangeContainsAddress, rangesEqual, rangesIntersect, registerFormulaFunction, replaceWorkbook, tokenizeFormula } from "@veltra/sheet-core";
6
- export { ALIGN_STYLE_KEYS, BORDER_EDGE_DEFAULTS, BORDER_SIDES, BORDER_STYLE_WIDTH, CellStore, DependencyGraph, FONT_STYLE_KEYS, FORMULA_ERROR_CODES, FormulaParseError, HistoryManager, InsertCellsCommand, InsertImageCommand, MergeCellsCommand, MergeManager, NUMERIC_TEXT_RE, RemoveImageCommand, SelectionModel, SetCellFormulaCommand, SetCellStyleCommand, SetCellValueCommand, Sheet, SheetGrid, StylePool, _sfc_main as USheet, UnmergeCellsCommand, UpdateImageCommand, Workbook, boundingBox, buildBorderPresetItems, cellDataEqual, cellKey, cloneImageAnchor, cloneSheetImage, coerceToBoolean, coerceToNumber, coerceToText, colIndexToName, colNameToIndex, collectReferences, computeFillTargetRange, createImageId, createRange, createSheetContext, defaultCommandRegistry, defaultToolRegistry, evaluateAst, exportSheetCsv, exportWorkbookXlsx, findAll, findNext, findNextFrom, findPrev, findPrevFrom, formatAddress, formatRange, formulaError, generateFill, importCsv, importXlsx, inferCellType, invokeFormulaFunction, isEmptyCellData, isFormulaError, isFormulaErrorCode, iterateRange, listFormulaFunctions, normalizeInputValue, parseAddress, parseFormula, parseRange, rangeContainsAddress, rangesEqual, rangesIntersect, registerFormulaFunction, registerTool, replaceWorkbook, tokenizeFormula, unregisterTool };
4
+ import _sfc_main$2 from "./components/sheet/sheet.js";
5
+ import { buildColumnDefs, exportFilledReportXlsx, pxToExcelColWidth } from "./report/export-xlsx.js";
6
+ import { parseDateRangeValue, patchParamValues, resolveNumberParamValue } from "./report/filter-bar.js";
7
+ import { REPORT_META_NAMESPACE, applyReportPreset, createReportBinding, formatBindingPlaceholder, formatBindingPlaceholderParts, formatCellAddress, formatParentCandidateLabel, inferColParentCandidate, inferDropPreset, inferParentsForPreset, inferReportPreset, inferRowParentCandidate, isColGroupBinding, isExpansionBandCol, isExpansionBandRow, isHorizontalExpandBinding, isReductionAggregate, isRowGroupBinding, isVerticalExpandBinding, listColParentCandidates, listRowParentCandidates, parseCellAddress, prefersGroupParent, presetBindingPatch, presetStillApplies, setBindingCatalog } from "./report/binding.js";
8
+ import { evaluateCondition, evaluateConditionalStyle, resolveRuleCompareValue, toComparableNumber } from "./report/rules/evaluate.js";
9
+ import { mapFilledColWidths } from "./report/render/builder.js";
10
+ import { renderReport, resolveFilledColWidths } from "./report/render/index.js";
11
+ import { buildParamDefs, extractParamIds, resolveBoundDatasetParams } from "./report/params.js";
12
+ import { IncompatibleTemplateVersionError, REPORT_TEMPLATE_VERSION, assertCompatibleTemplateVersion, createReportTemplate, fetchTemplateRecords, getBoundDatasetIds, getTemplateDatasets, resolveParamDefaults, resolveTemplateParams } from "./report/template.js";
13
+ import _sfc_main$1 from "./components/report/report-viewer.js";
14
+ import { DEFAULT_CONNECTION_PORTS, createHttpConnector, resolvePortOnTypeChange } from "./report/connector.js";
15
+ import _sfc_main from "./components/report/report-designer.js";
16
+ export { DEFAULT_CONNECTION_PORTS, IncompatibleTemplateVersionError, REPORT_META_NAMESPACE, REPORT_TEMPLATE_VERSION, _sfc_main as UReportDesigner, _sfc_main$1 as UReportViewer, _sfc_main$2 as USheet, applyReportPreset, assertCompatibleTemplateVersion, buildColumnDefs, buildParamDefs, createHttpConnector, createReportBinding, createReportTemplate, createSheetContext, defaultToolRegistry, evaluateCondition, evaluateConditionalStyle, exportFilledReportXlsx, extractParamIds, fetchTemplateRecords, formatBindingPlaceholder, formatBindingPlaceholderParts, formatCellAddress, formatParentCandidateLabel, getBoundDatasetIds, getTemplateDatasets, inferColParentCandidate, inferDropPreset, inferParentsForPreset, inferReportPreset, inferRowParentCandidate, isColGroupBinding, isExpansionBandCol, isExpansionBandRow, isHorizontalExpandBinding, isReductionAggregate, isRowGroupBinding, isVerticalExpandBinding, listColParentCandidates, listRowParentCandidates, mapFilledColWidths, parseCellAddress, parseDateRangeValue, patchParamValues, prefersGroupParent, presetBindingPatch, presetStillApplies, pxToExcelColWidth, registerTool, renderReport, resolveBoundDatasetParams, resolveFilledColWidths, resolveNumberParamValue, resolveParamDefaults, resolvePortOnTypeChange, resolveRuleCompareValue, resolveTemplateParams, setBindingCatalog, toComparableNumber, unregisterTool };
@@ -0,0 +1,83 @@
1
+ import { DatasetCatalogItem, ReportAggregate, ReportBinding, ReportPreset } from "./types.js";
2
+ import { CellAddress } from "@veltra/sheet-core";
3
+ //#region src/report/binding.d.ts
4
+ declare function setBindingCatalog(catalog: DatasetCatalogItem[]): void;
5
+ declare const REPORT_META_NAMESPACE = "report";
6
+ /** 预设 → 绑定字段补丁(父格除 grandTotal 外均保留推断值) */
7
+ declare function presetBindingPatch(preset: ReportPreset, options?: {
8
+ transpose?: boolean;
9
+ }): Partial<ReportBinding>;
10
+ /** 将预设写入绑定(grandTotal 清空双父格;其余保留既有父格) */
11
+ declare function applyReportPreset(binding: ReportBinding, preset: ReportPreset, options?: {
12
+ transpose?: boolean;
13
+ }): ReportBinding;
14
+ declare function isVerticalExpandBinding(binding: ReportBinding): boolean;
15
+ declare function isHorizontalExpandBinding(binding: ReportBinding): boolean;
16
+ declare function isRowGroupBinding(binding: ReportBinding): boolean;
17
+ declare function isColGroupBinding(binding: ReportBinding): boolean;
18
+ declare function isReductionAggregate(aggregate: ReportAggregate): boolean;
19
+ /** 小计 / 汇总 / 交叉格的父格候选只列分组头 */
20
+ declare function prefersGroupParent(binding: ReportBinding): boolean;
21
+ /** 当前 expand / aggregate 是否仍属于已写入的预设族(同族内改聚合不掉到「自定义」) */
22
+ declare function presetStillApplies(binding: ReportBinding): boolean;
23
+ type GetBindingAt = (addr: CellAddress) => ReportBinding | undefined;
24
+ interface InferParentOptions {
25
+ /** 小计落格:必须优先分组头,禁止把同列/同行明细当成父格 */
26
+ preferGroup?: boolean;
27
+ }
28
+ /** 指定模板行是否含纵向扩展绑定(展开带行) */
29
+ declare function isExpansionBandRow(row: number, getBindingAt: GetBindingAt, scanCols?: number): boolean;
30
+ /** 指定模板列是否含横向扩展绑定(展开带列) */
31
+ declare function isExpansionBandCol(col: number, getBindingAt: GetBindingAt, scanRows?: number): boolean;
32
+ /** 落格时推断预设:默认明细;数值字段且位于展开带正下方或正右相邻 → 小计 */
33
+ declare function inferDropPreset(addr: CellAddress, fieldType: DatasetCatalogItem['fields'][number]['type'], getBindingAt: GetBindingAt): ReportPreset;
34
+ interface ListParentCandidateOptions {
35
+ preferGroup?: boolean;
36
+ }
37
+ /** 同数据集纵向扩展绑定格(行方向父格下拉候选) */
38
+ declare function listRowParentCandidates(binding: ReportBinding, entries: ReadonlyArray<{
39
+ addr: CellAddress;
40
+ binding: ReportBinding;
41
+ }>, options?: ListParentCandidateOptions): CellAddress[];
42
+ /** 同数据集横向扩展绑定格(列方向父格下拉候选) */
43
+ declare function listColParentCandidates(binding: ReportBinding, entries: ReadonlyArray<{
44
+ addr: CellAddress;
45
+ binding: ReportBinding;
46
+ }>, options?: ListParentCandidateOptions): CellAddress[];
47
+ /**
48
+ * 行方向父格推断:
49
+ * 1. 同行向左:先找分组头,否则最近纵向扩展格
50
+ * 2. 上方各行整行扫描:每行先找分组头,再退回任意纵向扩展格
51
+ * 小计(preferGroup)禁止把明细当成父格
52
+ */
53
+ declare function inferRowParentCandidate(addr: CellAddress, getBindingAt: GetBindingAt, options?: InferParentOptions): CellAddress | null;
54
+ /**
55
+ * 列方向父格推断(与行方向对称):
56
+ * 1. 同列向上:先找列分组头,否则最近横向扩展格
57
+ * 2. 左侧各列整列扫描:每列先找列分组头
58
+ * 列小计(preferGroup)禁止把交叉格/明细当成列父格
59
+ */
60
+ declare function inferColParentCandidate(addr: CellAddress, getBindingAt: GetBindingAt, options?: InferParentOptions): CellAddress | null;
61
+ /**
62
+ * 按预设写入落格父格:明细/分组/交叉双方向推断;小计按「下方行小计 / 右侧列小计」只挂对应轴。
63
+ */
64
+ declare function inferParentsForPreset(addr: CellAddress, preset: ReportPreset, getBindingAt: GetBindingAt): Pick<ReportBinding, 'rowParent' | 'colParent'>;
65
+ /** 从绑定字段推断预设;不匹配任何预设时返回 null(自定义) */
66
+ declare function inferReportPreset(binding: ReportBinding): ReportPreset | null;
67
+ /** 默认明细 + 纵向扩展 */
68
+ declare function createReportBinding(dataset: DatasetCatalogItem, fieldName: string): ReportBinding;
69
+ /** 设计地址 → A1 标签(支持多字母列) */
70
+ declare function formatCellAddress(addr: CellAddress): string;
71
+ /** A1 标签 → 设计地址;非法输入返回 null */
72
+ declare function parseCellAddress(label: string): CellAddress | null;
73
+ /** Binding Placeholder 分段文案(聚合标签 + 字段标签),供徽章分色渲染等场景使用 */
74
+ declare function formatBindingPlaceholderParts(binding: ReportBinding, resolveLabel?: (datasetId: string, fieldName: string) => string): {
75
+ tag: string;
76
+ label: string;
77
+ };
78
+ /** Binding Placeholder 中文可读文案(如「分组 · 客户」) */
79
+ declare function formatBindingPlaceholder(binding: ReportBinding, resolveLabel?: (datasetId: string, fieldName: string) => string): string;
80
+ /** 父格下拉候选文案(如「分组 · 客户 (A2)」) */
81
+ declare function formatParentCandidateLabel(addr: CellAddress, binding: ReportBinding, resolveLabel?: (datasetId: string, fieldName: string) => string): string;
82
+ //#endregion
83
+ export { InferParentOptions, ListParentCandidateOptions, REPORT_META_NAMESPACE, applyReportPreset, createReportBinding, formatBindingPlaceholder, formatBindingPlaceholderParts, formatCellAddress, formatParentCandidateLabel, inferColParentCandidate, inferDropPreset, inferParentsForPreset, inferReportPreset, inferRowParentCandidate, isColGroupBinding, isExpansionBandCol, isExpansionBandRow, isHorizontalExpandBinding, isReductionAggregate, isRowGroupBinding, isVerticalExpandBinding, listColParentCandidates, listRowParentCandidates, parseCellAddress, prefersGroupParent, presetBindingPatch, presetStillApplies, setBindingCatalog };