@nokecy/qc-ui-components 2.0.0-beta.0 → 2.0.0-beta.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.
Files changed (243) hide show
  1. package/dist/cjs/ConfirmPro/index.d.ts +12 -9
  2. package/dist/cjs/ConfirmPro/index.js +11 -34
  3. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +422 -156
  4. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +12 -1
  5. package/dist/cjs/ag-grid-plus/context/queryFormContext.d.ts +2 -0
  6. package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +8 -0
  7. package/dist/cjs/ag-grid-plus/density.d.ts +25 -0
  8. package/dist/cjs/ag-grid-plus/density.js +52 -0
  9. package/dist/cjs/ag-grid-plus/index.less +36 -0
  10. package/dist/cjs/ag-grid-plus/interface.d.ts +58 -1
  11. package/dist/cjs/ag-grid-plus/interface.js +1 -1
  12. package/dist/cjs/ag-grid-plus/queryForm/index.d.ts +11 -0
  13. package/dist/cjs/ag-grid-plus/queryForm/index.js +62 -10
  14. package/dist/cjs/ag-grid-plus/queryForm/queryForm.d.ts +10 -0
  15. package/dist/cjs/ag-grid-plus/queryForm/queryForm.js +63 -26
  16. package/dist/cjs/ag-grid-plus/queryForm/queryValues.d.ts +9 -0
  17. package/dist/cjs/ag-grid-plus/queryForm/queryValues.js +61 -0
  18. package/dist/cjs/ag-grid-plus/rowColors.d.ts +12 -0
  19. package/dist/cjs/ag-grid-plus/rowColors.js +58 -0
  20. package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.d.ts +5 -0
  21. package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +14 -5
  22. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +108 -76
  23. package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +10 -9
  24. package/dist/cjs/ag-grid-plus/setting/autoColumnMemory.d.ts +37 -0
  25. package/dist/cjs/ag-grid-plus/setting/autoColumnMemory.js +206 -0
  26. package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.d.ts +2 -0
  27. package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.js +19 -1
  28. package/dist/cjs/ag-grid-plus/setting/index.js +5 -14
  29. package/dist/cjs/ag-grid-plus/settingItem/index.d.ts +11 -1
  30. package/dist/cjs/ag-grid-plus/settingItem/index.js +34 -12
  31. package/dist/cjs/ag-grid-plus/shared/EmptyIllustration.d.ts +16 -0
  32. package/dist/cjs/ag-grid-plus/shared/EmptyIllustration.js +87 -0
  33. package/dist/cjs/ag-grid-plus/shared/NoRowsOverlay.js +9 -1
  34. package/dist/cjs/ag-grid-plus/shared/SkeletonOverlay.d.ts +11 -0
  35. package/dist/cjs/ag-grid-plus/shared/SkeletonOverlay.js +40 -0
  36. package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +1 -1
  37. package/dist/cjs/ag-grid-plus/theme.d.ts +7 -1
  38. package/dist/cjs/ag-grid-plus/theme.js +31 -6
  39. package/dist/cjs/ag-grid-plus/toolBar/OverflowActions.d.ts +16 -0
  40. package/dist/cjs/ag-grid-plus/toolBar/OverflowActions.js +128 -0
  41. package/dist/cjs/ag-grid-plus/toolBar/index.d.ts +3 -1
  42. package/dist/cjs/ag-grid-plus/toolBar/index.js +43 -35
  43. package/dist/cjs/ag-grid-plus/toolBar/leftContent.d.ts +2 -2
  44. package/dist/cjs/ag-grid-plus/toolBar/leftContent.js +2 -2
  45. package/dist/cjs/ag-grid-plus/toolBar/overflow.d.ts +20 -0
  46. package/dist/cjs/ag-grid-plus/toolBar/overflow.js +48 -0
  47. package/dist/cjs/ag-grid-plus/toolBar/style.js +71 -15
  48. package/dist/cjs/ag-grid-plus/types.d.ts +6 -0
  49. package/dist/cjs/ag-grid-plus/utils/agGridCompat.js +12 -3
  50. package/dist/cjs/ag-grid-plus/utils/columnProcessors.d.ts +3 -0
  51. package/dist/cjs/ag-grid-plus/utils/columnProcessors.js +13 -2
  52. package/dist/cjs/ag-grid-plus/utils/constants.d.ts +3 -2
  53. package/dist/cjs/ag-grid-plus/utils/constants.js +3 -2
  54. package/dist/cjs/ag-grid-plus/utils/crossPageSelection.d.ts +21 -0
  55. package/dist/cjs/ag-grid-plus/utils/crossPageSelection.js +58 -0
  56. package/dist/cjs/ag-grid-plus/utils/emptyState.d.ts +2 -0
  57. package/dist/cjs/ag-grid-plus/utils/emptyState.js +9 -5
  58. package/dist/cjs/ag-grid-plus/utils/listKeyboard.d.ts +24 -0
  59. package/dist/cjs/ag-grid-plus/utils/listKeyboard.js +83 -0
  60. package/dist/cjs/ag-grid-plus/utils/pagination.d.ts +26 -0
  61. package/dist/cjs/ag-grid-plus/utils/pagination.js +69 -0
  62. package/dist/cjs/ag-grid-plus/utils/queryDispatch.d.ts +7 -0
  63. package/dist/cjs/ag-grid-plus/utils/queryDispatch.js +17 -0
  64. package/dist/cjs/ag-grid-plus/utils/statusPill.d.ts +25 -0
  65. package/dist/cjs/ag-grid-plus/utils/statusPill.js +196 -0
  66. package/dist/cjs/ag-grid-plus/utils/valueEnumColor.d.ts +6 -1
  67. package/dist/cjs/ag-grid-plus/utils/valueEnumColor.js +13 -9
  68. package/dist/cjs/ag-grid-plus/utils/valueFormat.d.ts +19 -0
  69. package/dist/cjs/ag-grid-plus/utils/valueFormat.js +73 -0
  70. package/dist/cjs/ag-grid-plus/utils.js +3 -2
  71. package/dist/cjs/array-table/arrayAddBtn.d.ts +1 -0
  72. package/dist/cjs/array-table/arrayAddBtn.js +2 -2
  73. package/dist/cjs/array-table/autoHeight.d.ts +18 -0
  74. package/dist/cjs/array-table/autoHeight.js +30 -0
  75. package/dist/cjs/array-table/batchRemove.d.ts +2 -2
  76. package/dist/cjs/array-table/cellEditorMarker.d.ts +18 -0
  77. package/dist/cjs/array-table/cellEditorMarker.js +92 -0
  78. package/dist/cjs/array-table/errorLocator.d.ts +29 -0
  79. package/dist/cjs/array-table/errorLocator.js +101 -0
  80. package/dist/cjs/array-table/hooks.d.ts +52 -4
  81. package/dist/cjs/array-table/hooks.js +251 -18
  82. package/dist/cjs/array-table/index.d.ts +6 -0
  83. package/dist/cjs/array-table/index.js +167 -23
  84. package/dist/cjs/array-table/interface.d.ts +22 -0
  85. package/dist/cjs/array-table/preview.js +39 -5
  86. package/dist/cjs/array-table/rowFeedback.d.ts +2 -2
  87. package/dist/cjs/array-table/rowFeedback.js +8 -8
  88. package/dist/cjs/array-table/summary.d.ts +25 -0
  89. package/dist/cjs/array-table/summary.js +70 -0
  90. package/dist/cjs/array-table/theme.d.ts +35 -5
  91. package/dist/cjs/array-table/theme.js +49 -12
  92. package/dist/cjs/array-table/title.d.ts +3 -0
  93. package/dist/cjs/array-table/title.js +29 -0
  94. package/dist/cjs/array-table/utils.d.ts +2 -1
  95. package/dist/cjs/array-table/utils.js +94 -23
  96. package/dist/cjs/card/pro-card/Card/useLegacyItems.d.ts +1 -1
  97. package/dist/cjs/dateCellEditor/DateCellEditor.d.ts +5 -0
  98. package/dist/cjs/dateCellEditor/DateCellEditor.js +42 -17
  99. package/dist/cjs/deleteConfirm/index.d.ts +14 -0
  100. package/dist/cjs/deleteConfirm/index.js +73 -12
  101. package/dist/cjs/dialogSelect/index.d.ts +19 -0
  102. package/dist/cjs/dialogSelect/index.js +189 -15
  103. package/dist/cjs/dialogSelect/index.less +18 -0
  104. package/dist/cjs/documentPage/documentPage.d.ts +6 -3
  105. package/dist/cjs/documentPage/documentPage.js +23 -8
  106. package/dist/cjs/documentPage/index.d.ts +2 -0
  107. package/dist/cjs/documentPage/index.js +19 -0
  108. package/dist/cjs/documentPage/leaveGuard.d.ts +31 -0
  109. package/dist/cjs/documentPage/leaveGuard.js +91 -0
  110. package/dist/cjs/draggableModal/index.d.ts +24 -1
  111. package/dist/cjs/draggableModal/index.js +36 -6
  112. package/dist/cjs/fullScreenAlert/index.less +10 -10
  113. package/dist/cjs/index.d.ts +2 -0
  114. package/dist/cjs/index.js +15 -0
  115. package/dist/cjs/readPretty/arrayTable.js +5 -1
  116. package/dist/cjs/scanCollect/ScanFeedbackInput.d.ts +26 -0
  117. package/dist/cjs/scanCollect/ScanFeedbackInput.js +113 -0
  118. package/dist/cjs/scanCollect/index.d.ts +4 -0
  119. package/dist/cjs/scanCollect/index.js +14 -0
  120. package/dist/cjs/scanCollect/scanSound.d.ts +15 -0
  121. package/dist/cjs/scanCollect/scanSound.js +91 -0
  122. package/dist/esm/ConfirmPro/index.d.ts +12 -9
  123. package/dist/esm/ConfirmPro/index.js +11 -34
  124. package/dist/esm/ag-grid-plus/ag-gridPlus.js +423 -156
  125. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +12 -1
  126. package/dist/esm/ag-grid-plus/context/queryFormContext.d.ts +2 -0
  127. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +8 -0
  128. package/dist/esm/ag-grid-plus/density.d.ts +25 -0
  129. package/dist/esm/ag-grid-plus/density.js +45 -0
  130. package/dist/esm/ag-grid-plus/index.less +36 -0
  131. package/dist/esm/ag-grid-plus/interface.d.ts +58 -1
  132. package/dist/esm/ag-grid-plus/interface.js +2 -0
  133. package/dist/esm/ag-grid-plus/queryForm/index.d.ts +11 -0
  134. package/dist/esm/ag-grid-plus/queryForm/index.js +62 -10
  135. package/dist/esm/ag-grid-plus/queryForm/queryForm.d.ts +10 -0
  136. package/dist/esm/ag-grid-plus/queryForm/queryForm.js +64 -26
  137. package/dist/esm/ag-grid-plus/queryForm/queryValues.d.ts +9 -0
  138. package/dist/esm/ag-grid-plus/queryForm/queryValues.js +54 -0
  139. package/dist/esm/ag-grid-plus/rowColors.d.ts +12 -0
  140. package/dist/esm/ag-grid-plus/rowColors.js +50 -0
  141. package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.d.ts +5 -0
  142. package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +14 -5
  143. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +110 -78
  144. package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +10 -9
  145. package/dist/esm/ag-grid-plus/setting/autoColumnMemory.d.ts +37 -0
  146. package/dist/esm/ag-grid-plus/setting/autoColumnMemory.js +198 -0
  147. package/dist/esm/ag-grid-plus/setting/columnGroupUtils.d.ts +2 -0
  148. package/dist/esm/ag-grid-plus/setting/columnGroupUtils.js +18 -1
  149. package/dist/esm/ag-grid-plus/setting/index.js +6 -15
  150. package/dist/esm/ag-grid-plus/settingItem/index.d.ts +11 -1
  151. package/dist/esm/ag-grid-plus/settingItem/index.js +35 -13
  152. package/dist/esm/ag-grid-plus/shared/EmptyIllustration.d.ts +16 -0
  153. package/dist/esm/ag-grid-plus/shared/EmptyIllustration.js +82 -0
  154. package/dist/esm/ag-grid-plus/shared/NoRowsOverlay.js +9 -1
  155. package/dist/esm/ag-grid-plus/shared/SkeletonOverlay.d.ts +11 -0
  156. package/dist/esm/ag-grid-plus/shared/SkeletonOverlay.js +34 -0
  157. package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +1 -1
  158. package/dist/esm/ag-grid-plus/theme.d.ts +7 -1
  159. package/dist/esm/ag-grid-plus/theme.js +31 -6
  160. package/dist/esm/ag-grid-plus/toolBar/OverflowActions.d.ts +16 -0
  161. package/dist/esm/ag-grid-plus/toolBar/OverflowActions.js +120 -0
  162. package/dist/esm/ag-grid-plus/toolBar/index.d.ts +3 -1
  163. package/dist/esm/ag-grid-plus/toolBar/index.js +43 -35
  164. package/dist/esm/ag-grid-plus/toolBar/leftContent.d.ts +2 -2
  165. package/dist/esm/ag-grid-plus/toolBar/leftContent.js +2 -2
  166. package/dist/esm/ag-grid-plus/toolBar/overflow.d.ts +20 -0
  167. package/dist/esm/ag-grid-plus/toolBar/overflow.js +41 -0
  168. package/dist/esm/ag-grid-plus/toolBar/style.js +71 -15
  169. package/dist/esm/ag-grid-plus/types.d.ts +6 -0
  170. package/dist/esm/ag-grid-plus/utils/agGridCompat.js +12 -3
  171. package/dist/esm/ag-grid-plus/utils/columnProcessors.d.ts +3 -0
  172. package/dist/esm/ag-grid-plus/utils/columnProcessors.js +14 -3
  173. package/dist/esm/ag-grid-plus/utils/constants.d.ts +3 -2
  174. package/dist/esm/ag-grid-plus/utils/constants.js +3 -2
  175. package/dist/esm/ag-grid-plus/utils/crossPageSelection.d.ts +21 -0
  176. package/dist/esm/ag-grid-plus/utils/crossPageSelection.js +52 -0
  177. package/dist/esm/ag-grid-plus/utils/emptyState.d.ts +2 -0
  178. package/dist/esm/ag-grid-plus/utils/emptyState.js +9 -5
  179. package/dist/esm/ag-grid-plus/utils/listKeyboard.d.ts +24 -0
  180. package/dist/esm/ag-grid-plus/utils/listKeyboard.js +77 -0
  181. package/dist/esm/ag-grid-plus/utils/pagination.d.ts +26 -0
  182. package/dist/esm/ag-grid-plus/utils/pagination.js +60 -0
  183. package/dist/esm/ag-grid-plus/utils/queryDispatch.d.ts +7 -0
  184. package/dist/esm/ag-grid-plus/utils/queryDispatch.js +11 -0
  185. package/dist/esm/ag-grid-plus/utils/statusPill.d.ts +25 -0
  186. package/dist/esm/ag-grid-plus/utils/statusPill.js +192 -0
  187. package/dist/esm/ag-grid-plus/utils/valueEnumColor.d.ts +6 -1
  188. package/dist/esm/ag-grid-plus/utils/valueEnumColor.js +12 -8
  189. package/dist/esm/ag-grid-plus/utils/valueFormat.d.ts +19 -0
  190. package/dist/esm/ag-grid-plus/utils/valueFormat.js +63 -0
  191. package/dist/esm/ag-grid-plus/utils.js +3 -2
  192. package/dist/esm/array-table/arrayAddBtn.d.ts +1 -0
  193. package/dist/esm/array-table/arrayAddBtn.js +1 -1
  194. package/dist/esm/array-table/autoHeight.d.ts +18 -0
  195. package/dist/esm/array-table/autoHeight.js +25 -0
  196. package/dist/esm/array-table/batchRemove.d.ts +2 -2
  197. package/dist/esm/array-table/cellEditorMarker.d.ts +18 -0
  198. package/dist/esm/array-table/cellEditorMarker.js +84 -0
  199. package/dist/esm/array-table/errorLocator.d.ts +29 -0
  200. package/dist/esm/array-table/errorLocator.js +95 -0
  201. package/dist/esm/array-table/hooks.d.ts +52 -4
  202. package/dist/esm/array-table/hooks.js +251 -17
  203. package/dist/esm/array-table/index.d.ts +6 -0
  204. package/dist/esm/array-table/index.js +170 -25
  205. package/dist/esm/array-table/interface.d.ts +22 -0
  206. package/dist/esm/array-table/preview.js +43 -7
  207. package/dist/esm/array-table/rowFeedback.d.ts +2 -2
  208. package/dist/esm/array-table/rowFeedback.js +8 -8
  209. package/dist/esm/array-table/summary.d.ts +25 -0
  210. package/dist/esm/array-table/summary.js +66 -0
  211. package/dist/esm/array-table/theme.d.ts +35 -5
  212. package/dist/esm/array-table/theme.js +47 -12
  213. package/dist/esm/array-table/title.d.ts +3 -0
  214. package/dist/esm/array-table/title.js +24 -0
  215. package/dist/esm/array-table/utils.d.ts +2 -1
  216. package/dist/esm/array-table/utils.js +93 -22
  217. package/dist/esm/card/pro-card/Card/useLegacyItems.d.ts +1 -1
  218. package/dist/esm/dateCellEditor/DateCellEditor.d.ts +5 -0
  219. package/dist/esm/dateCellEditor/DateCellEditor.js +42 -17
  220. package/dist/esm/deleteConfirm/index.d.ts +14 -0
  221. package/dist/esm/deleteConfirm/index.js +72 -12
  222. package/dist/esm/dialogSelect/index.d.ts +19 -0
  223. package/dist/esm/dialogSelect/index.js +190 -16
  224. package/dist/esm/dialogSelect/index.less +18 -0
  225. package/dist/esm/documentPage/documentPage.d.ts +6 -3
  226. package/dist/esm/documentPage/documentPage.js +23 -8
  227. package/dist/esm/documentPage/index.d.ts +2 -0
  228. package/dist/esm/documentPage/index.js +1 -0
  229. package/dist/esm/documentPage/leaveGuard.d.ts +31 -0
  230. package/dist/esm/documentPage/leaveGuard.js +86 -0
  231. package/dist/esm/draggableModal/index.d.ts +24 -1
  232. package/dist/esm/draggableModal/index.js +35 -5
  233. package/dist/esm/fullScreenAlert/index.less +10 -10
  234. package/dist/esm/index.d.ts +2 -0
  235. package/dist/esm/index.js +1 -0
  236. package/dist/esm/readPretty/arrayTable.js +6 -2
  237. package/dist/esm/scanCollect/ScanFeedbackInput.d.ts +26 -0
  238. package/dist/esm/scanCollect/ScanFeedbackInput.js +107 -0
  239. package/dist/esm/scanCollect/index.d.ts +4 -0
  240. package/dist/esm/scanCollect/index.js +2 -0
  241. package/dist/esm/scanCollect/scanSound.d.ts +15 -0
  242. package/dist/esm/scanCollect/scanSound.js +84 -0
  243. package/package.json +2 -2
@@ -1,10 +1,40 @@
1
+ import type { GridDensity, GridDensityOverrides, GridDensityValues } from '../ag-grid-plus/density';
1
2
  /**
2
- * 行高 38:放得下 32px 高的输入框。网格选项 rowHeight 与主题参数 rowHeight 必须同值——
3
- * AG-Grid 单元格文字的行高(--ag-internal-content-line-height)是从主题的 --ag-row-height 算的,
4
- * 只设网格选项会让文字的行盒仍是主题默认行高(29.6-3=26.6px),顶在 37px 的格子上方(偏上约 4.5px)。
3
+ * Provider 没注入密度时的档位:DESIGN.md §2 把紧凑档定为 ERP 标准页默认。
4
+ * 原先写死 38,没有对应任何一档;回退到规范默认档,数值全部来自 density.ts。
5
5
  */
6
- export declare const ARRAY_TABLE_ROW_HEIGHT = 38;
6
+ export declare const ARRAY_TABLE_FALLBACK_DENSITY: GridDensity;
7
+ /** 回退档的行高,兼容旧的具名导出;实际行高请用 useArrayTableMetrics。 */
8
+ export declare const ARRAY_TABLE_ROW_HEIGHT: number;
9
+ /**
10
+ * 解析 ArrayTable 当前密度数值(纯函数,便于测试)。
11
+ * 网格选项 rowHeight/headerHeight 与主题参数必须同值——AG-Grid 单元格文字的行高
12
+ * (--ag-internal-content-line-height)是从主题的 --ag-row-height 算的,只设网格选项会让文字的行盒
13
+ * 仍是主题默认行高,顶在格子上方偏上。所以两处都从这一份数值取。
14
+ */
15
+ export declare function resolveArrayTableMetrics(density?: GridDensity, overrides?: GridDensityOverrides): GridDensityValues;
16
+ /** 读取 Provider 注入的密度,随 Provider 变化重算(密度运行时切换后行高即时更新)。 */
17
+ export declare function useArrayTableMetrics(): GridDensityValues;
18
+ /**
19
+ * 格内错误文字的总高度(含 terse 样式的 1px 边框,上下内边距与外边距归零,box-sizing: border-box)。
20
+ * 文字紧贴输入框下沿(top:100%),输入框高 = 行高 - 3px,所以格底到输入框底的距离是 ROW_FEEDBACK_EXTRA_HEIGHT + 3,
21
+ * 本值必须不超过它,否则会被行底边线穿过。
22
+ */
23
+ export declare const ARRAY_TABLE_HELP_LINE_HEIGHT = 20;
7
24
  /** 表格里有出错行时挂在网格外层的类名(由 index.tsx 设置) */
8
25
  export declare const ARRAY_TABLE_FEEDBACK_CLASS = "ag-array-table-has-feedback";
9
- /** 根据当前 antd 主题生成编辑态或阅读态明细表格主题。@author nokecy */
26
+ /**
27
+ * 单元格里的表单项与内容区垂直居中(只对使用本主题的网格生效,共用主题不受影响):
28
+ * - .ag-cell-wrapper 撑满格子,align-items:center 才起作用(默认只有内容高,贴在格子顶部);
29
+ * 表格里有出错行时(外层带 ARRAY_TABLE_FEEDBACK_CLASS)内容高度不超过标准行高对应的高度:出错行会被撑高(见 rowFeedback.ts),
30
+ * 内容仍居中在上面那一段,多出来的高度留给输入框下方的错误文字,出错时输入框不会被挤得上下跳;
31
+ * - FormItem 默认 margin-bottom:24px(loose 反馈布局给错误文字预留的位置),会把 Editable 外壳撑到 56px、
32
+ * 输入框偏上、还超出 37px 的格子,归零;
33
+ * - AG-Grid 的 .ag-cell-value 默认 overflow:hidden,会把输入框下方的错误文字剪掉,只在格里正显示错误文字时放开;
34
+ * - 错误文字单行显示、超出列宽省略,出错行只多留一行的高度(ROW_FEEDBACK_EXTRA_HEIGHT);
35
+ * - 错误提示文字移出文档流(位置仍在输入框下方),出错时输入框不会被挤得上下跳。
36
+ */
37
+ export declare const ARRAY_TABLE_CELL_FIT_CSS = "\n .ag-cell .ag-cell-wrapper { height: 100%; max-height: 100%; min-height: 0; }\n .ag-cell .ag-cell-value { max-height: 100%; min-height: 0; }\n /* \u672C part \u7684 CSS \u4F1A\u88AB AG-Grid \u5305\u8FDB :where(.ag-theme-xxx) { ... }\uFF08\u5D4C\u5957\uFF09\uFF0C\u88F8\u5199 .has-feedback .ag-cell \u4F1A\u7F16\u8BD1\u6210\n \u300C\u4E3B\u9898\u5143\u7D20\u7684\u540E\u4EE3 has-feedback\u300D\uFF0C\u800C\u8BE5\u7C7B\u6302\u5728\u4E3B\u9898\u5143\u7D20\u7684\u7956\u5148\u4E0A\uFF0C\u89C4\u5219\u6C38\u8FDC\u4E0D\u547D\u4E2D\u3002\n \u6240\u4EE5\u7528 & \u663E\u5F0F\u653E\u5728 has-feedback \u4E4B\u540E\uFF08\u7956\u5148\u5199\u6CD5\uFF09\uFF0C\u540C\u65F6\u517C\u5BB9\u7C7B\u540D\u6302\u5728\u4E3B\u9898\u5143\u7D20\u81EA\u8EAB\u7684\u5199\u6CD5\u3002 */\n .ag-array-table-has-feedback & .ag-cell .ag-cell-wrapper,\n &.ag-array-table-has-feedback .ag-cell .ag-cell-wrapper { height: min(100%, calc(var(--ag-row-height) - 3px)); }\n /* \u5BBF\u4E3B\u53EF\u80FD\u5199 .xxx .ant-formily-item { margin-bottom: 12px }\uFF08\u7279\u5F02\u6027 0,3,0\uFF09\uFF1B\u8FD9\u91CC\u53E0\u7C7B\u540D\u5E76 !important\uFF0C\u4EFB\u4F55\u5BBF\u4E3B\u89C4\u5219\u90FD\u538B\u4E0D\u8FC7\uFF0C\n \u5426\u5219\u683C\u5185\u63A7\u4EF6\u4F1A\u88AB margin \u9876\u5F97\u504F\u4E0A 3-5px\u3002@author nokecy */\n .ag-cell .ag-cell-wrapper .ant-formily-item.ant-formily-item { margin-bottom: 0 !important; }\n /* \u6807\u9898\u548C\u8BF4\u660E\u7531\u5217\u5934\u627F\u8F7D\uFF0ClabelWidth:0 \u672C\u8EAB\u4E0D\u4F1A\u9690\u85CF\u5B57\u6BB5\u6807\u9898\u3002@author nokecy */\n .ag-cell .ant-formily-item-label { display: none; }\n .ag-cell .ant-formily-item-control { flex: 1; min-width: 0; width: 100%; }\n /* \u5E26\u5916\u58F3\u7684\u8F93\u5165\u6846\uFF08affix/wrapper\uFF09\u662F inline-flex\uFF0Cantd \u7ED9\u8868\u5355\u9879\u5185\u5BB9\u533A controlHeight \u7684\u6700\u5C0F\u9AD8\u5EA6\u548C\u5BF9\u5E94\u884C\u9AD8\uFF0C\n \u5916\u58F3\u6309\u57FA\u7EBF\u5BF9\u9F50\u88AB\u9876\u504F\u3002\u5185\u5BB9\u533A\u6539\u6210\u5C45\u4E2D\u7684 flex\uFF08\u5B50\u9879\u88AB\u5757\u5316\uFF0C\u4E0D\u518D\u6709\u57FA\u7EBF\u5BF9\u9F50\uFF09\uFF0C\u6700\u5C0F\u9AD8\u5EA6\u5F52\u96F6\uFF0C\n \u8868\u5355\u9879\u9AD8\u5EA6\u7531\u63A7\u4EF6\u81EA\u5DF1\u7684\u9AD8\u5EA6\uFF08\u884C\u9AD8-3px\uFF09\u51B3\u5B9A\uFF0C\u4E0D\u8D85\u51FA\u884C\u9AD8\u3002 */\n .ag-cell .ant-formily-item,\n .ag-cell .ant-formily-item-control,\n .ag-cell .ant-formily-item-control-content,\n .ag-cell .ant-formily-item-control-content-component { min-height: 0 !important; }\n .ag-cell .ant-formily-item-control-content,\n .ag-cell .ant-formily-item-control-content-component { display: flex; align-items: center; }\n .ag-cell .ant-formily-item-control-content-component { flex: 1 1 auto; min-width: 0; }\n .ag-cell .ant-formily-item-control-content-component > * { flex: 1 1 auto; min-width: 0; }\n /* \u9519\u8BEF\u6587\u5B57\u9489\u5728\u8F93\u5165\u6846\u6B63\u4E0B\u65B9\uFF08top:100% \u76F8\u5BF9 .ant-formily-item\uFF09\uFF0C\u9AD8\u5EA6\u56FA\u5B9A\u4E3A ARRAY_TABLE_HELP_LINE_HEIGHT\uFF0C\n \u4E0D\u518D\u4F9D\u8D56\u6587\u6863\u6D41\u91CC\u7684\u9759\u6001\u4F4D\u7F6E\uFF08\u4F1A\u968F margin/\u5C45\u4E2D\u504F\u79FB\uFF0C\u5BFC\u81F4\u88AB\u884C\u5E95\u8FB9\u7EBF\u7A7F\u8FC7\uFF09\u3002 */\n .ag-cell .ant-formily-item-help { position: absolute; top: 100%; inset-inline-start: 0; margin: 0 !important; padding-block: 0 !important; box-sizing: border-box !important; min-height: 0 !important; height: 20px !important; line-height: 18px !important; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .ag-cell .ag-cell-value:has(.ant-formily-item-help) { overflow: visible; }\n /* \u5217\u5BF9\u9F50\uFF08align \u5199\u6CD5\uFF09\uFF1B\u6B63\u5728\u7F16\u8F91\u7684\u8F93\u5165\u6846\u8DDF\u968F\u6240\u5728\u5217\u7684\u5BF9\u9F50\uFF0C\u6570\u5B57\u5217\u70B9\u5F00\u7F16\u8F91\u65F6\u4E0D\u4F1A\u8DF3\u5230\u5DE6\u8FB9\u3002@author nokecy */\n .ag-cell.qc-array-table-align-left { text-align: left; }\n .ag-cell.qc-array-table-align-center { text-align: center; }\n .ag-cell.qc-array-table-align-right { text-align: right; }\n .ag-cell .ant-input-number .ant-input-number-input,\n .ag-cell .ant-input-affix-wrapper .ant-input,\n .ag-cell .ant-input.ant-input { text-align: inherit; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n /* \u5355\u5C42\u6846\uFF1A\u683C\u5185\u63A7\u4EF6\u4E0D\u753B\u81EA\u5DF1\u7684\u8FB9\u6846/\u9634\u5F71/\u5E95\u8272\uFF0C\u6491\u6EE1\u5355\u5143\u683C\uFF1B\n \u805A\u7126/\u9519\u8BEF/\u9501\u5B9A\u53EA\u7531\u5355\u5143\u683C\u7684 inset \u6846\uFF08\u6216\u5E95\u8272\uFF09\u8868\u8FBE\uFF0C\u4E0D\u5360\u5C3A\u5BF8\uFF0C\u884C\u9AD8\u4E0E\u5355\u5143\u683C\u5C3A\u5BF8\u4E0D\u53D8\u3002\n \u9009\u62E9\u5668\u5168\u90E8\u9650\u5B9A\u5728 .ag-cell \u5185\uFF0C\u800C\u672C part \u53EA\u6302\u5728 ArrayTable \u7684\u4E3B\u9898\u4E0A\uFF0C\u4E0D\u5F71\u54CD\u8868\u683C\u5916\u7684\u8868\u5355\u3002@author nokecy */\n .ag-cell .ant-input.ant-input,\n .ag-cell .ant-input-affix-wrapper.ant-input-affix-wrapper,\n .ag-cell .ant-input-number.ant-input-number,\n .ag-cell .ant-input-number-affix-wrapper.ant-input-number-affix-wrapper,\n .ag-cell .ant-select.ant-select,\n .ag-cell .ant-select.ant-select .ant-select-selector,\n .ag-cell .ant-picker.ant-picker,\n .ag-cell .ant-input-outlined.ant-input-outlined {\n border: 0 !important;\n box-shadow: none !important;\n background: transparent !important;\n outline: none;\n }\n .ag-cell .ant-input-number, .ag-cell .ant-picker, .ag-cell .ant-select, .ag-cell .ant-input-affix-wrapper { width: 100%; }\n /* \u63A7\u4EF6\u300C\u50CF\u6587\u672C\u300D\uFF1A\u5B57\u53F7\u3001\u6C34\u5E73\u5185\u8FB9\u8DDD\u8DDF\u968F\u5BC6\u5EA6\uFF08\u5355\u5143\u683C\u81EA\u5DF1\u5DF2\u6709 --ag-cell-horizontal-padding\uFF0C\u63A7\u4EF6\u4E0D\u518D\u53E0\u4E00\u5C42\uFF09\uFF0C\n \u9AD8\u5EA6\u968F\u884C\u9AD8\u3001\u7559 3px \u7ED9\u4E0B\u8FB9\u6846\u4E0E\u5C45\u4E2D\u4F59\u91CF\uFF0C\u4E0D\u6491\u9AD8\u884C\uFF1B\u5BC6\u5EA6\u7531\u4E3B\u9898\u53C2\u6570 rowHeight \u51B3\u5B9A\uFF0C\u4E0D\u5199\u6B7B\u50CF\u7D20\u3002@author nokecy */\n .ag-cell .ant-input.ant-input,\n .ag-cell .ant-input-affix-wrapper.ant-input-affix-wrapper,\n .ag-cell .ant-input-number.ant-input-number,\n .ag-cell .ant-input-number-affix-wrapper.ant-input-number-affix-wrapper,\n .ag-cell .ant-select.ant-select,\n .ag-cell .ant-select.ant-select .ant-select-selector,\n .ag-cell .ant-picker.ant-picker { font-size: inherit !important; padding-inline: 0 !important; }\n /* antd 6 \u7684 Select \u6839\u8282\u70B9\u81EA\u5DF1\u5E26\u8FB9\u6846\u4E0E\u5185\u8FB9\u8DDD\uFF08\u6CA1\u6709 .ant-select-selector\uFF09\uFF0C\u4E0A\u4E0B\u5185\u8FB9\u8DDD\u4E5F\u5F52\u96F6\uFF0C\u9AD8\u5EA6\u7531\u4E0B\u9762\u7684 height \u51B3\u5B9A\uFF0C\u5782\u76F4\u5C45\u4E2D\u3002*/\n .ag-cell .ant-select.ant-select { padding-block: 0 !important; align-items: center; }\n .ag-cell .ant-input-number .ant-input-number-input,\n .ag-cell .ant-picker .ant-picker-input > input,\n .ag-cell .ant-select .ant-select-selection-item,\n .ag-cell .ant-select .ant-select-selection-search-input,\n .ag-cell .ant-select .ant-select-content,\n .ag-cell .ant-select .ant-select-content-item,\n .ag-cell .ant-select .ant-select-placeholder,\n .ag-cell .ant-select .ant-select-input { font-size: inherit !important; padding-inline: 0 !important; }\n .ag-cell .ant-input.ant-input,\n .ag-cell .ant-input-affix-wrapper.ant-input-affix-wrapper,\n .ag-cell .ant-input-number.ant-input-number,\n .ag-cell .ant-input-number-affix-wrapper.ant-input-number-affix-wrapper,\n .ag-cell .ant-select.ant-select,\n .ag-cell .ant-select.ant-select .ant-select-selector,\n .ag-cell .ant-picker.ant-picker { height: calc(var(--ag-row-height) - 3px) !important; min-height: 0 !important; }\n /* \u5957\u5728\u5916\u58F3\u91CC\u7684\u5185\u5C42\u63A7\u4EF6\u6491\u6EE1\u5916\u58F3\u5373\u53EF\uFF0C\u518D\u8BBE\u540C\u4E00\u9AD8\u5EA6\u4F1A\u52A0\u4E0A\u5916\u58F3 padding \u6EA2\u51FA\uFF1B\u591A\u884C\u6587\u672C\u57DF\u4E0D\u53D7\u9650\u3002*/\n .ag-cell .ant-input-affix-wrapper .ant-input.ant-input,\n .ag-cell .ant-input-number-affix-wrapper .ant-input-number-input { height: 100% !important; }\n /* \u591A\u884C\u6587\u672C\u5728\u56FA\u5B9A\u884C\u9AD8\u7684\u683C\u91CC\u4E0D\u6491\u9AD8\u884C\uFF1A\u9AD8\u5EA6\u53D6\u5355\u884C\u9AD8\uFF0C\u8D85\u51FA\u5185\u5BB9\u5728\u6846\u5185\u6EDA\u52A8 */\n .ag-cell textarea.ant-input.ant-input { height: calc(var(--ag-row-height) - 3px) !important; min-height: 0 !important; resize: none; overflow-y: auto; line-height: calc(var(--ag-row-height) - 5px) !important; padding-block: 0 !important; }\n /* Editable \u88C5\u9970\u5668\u5916\u58F3\u9ED8\u8BA4 inline-block\uFF0C\u4F1A\u5728 .ag-cell-value \u7684\u884C\u76D2\u91CC\u6309\u57FA\u7EBF\u5BF9\u9F50\u3001\u88AB\u9876\u504F\uFF1B\u6539\u4E3A\u5757\u7EA7 flex \u4E0E\u5176\u4ED6\u63A7\u4EF6\u4E00\u81F4\u5C45\u4E2D */\n .ag-cell .ant-formily-editable { display: flex; align-items: center; width: 100%; }\n /* Select \u6587\u5B57\u884C\u9AD8\u4E0E\u641C\u7D22\u6846\u4F4D\u7F6E\uFF1Aselector \u5F52\u96F6\u5185\u8FB9\u8DDD\u540E\uFF0C\u6587\u5B57\u884C\u9AD8\u53D6\u683C\u5185\u53EF\u7528\u9AD8\u5EA6\uFF0C\u641C\u7D22\u8F93\u5165\u6846\u8D34\u5DE6\uFF0C\u5149\u6807\u4E0D\u9519\u4F4D\u3002*/\n .ag-cell .ant-select .ant-select-selection-item,\n .ag-cell .ant-select .ant-select-selection-placeholder,\n .ag-cell .ant-select .ant-select-selection-search-input,\n .ag-cell .ant-select .ant-select-content,\n .ag-cell .ant-select .ant-select-content-item,\n .ag-cell .ant-select .ant-select-placeholder,\n .ag-cell .ant-select .ant-select-input { line-height: calc(var(--ag-row-height) - 3px) !important; }\n .ag-cell .ant-select .ant-select-selection-search { inset-inline: 0 !important; }\n /* \u6B65\u8FDB\u5668\u4E0E\u65E5\u5386\u56FE\u6807\u5728\u4EFB\u4F55\u72B6\u6001\u90FD\u4E0D\u663E\u793A\uFF08\u4E0E\u6F14\u793A\u4E00\u81F4\uFF1A\u952E\u76D8\u7528\u65B9\u5411\u952E/\u952E\u5165\uFF0C\u9762\u677F\u7531\u70B9\u51FB\u5C55\u5F00\uFF09\uFF1B\n Input \u53EA\u4FDD\u7559\u6E05\u9664\u56FE\u6807\u3002\u4E0B\u62C9\u7BAD\u5934\u53EA\u5728\u805A\u7126\u6216\u9762\u677F\u5C55\u5F00\u65F6\u51FA\u73B0\u3002@author nokecy */\n .ag-cell .ant-input-number-handler-wrap { display: none !important; }\n .ag-cell .ant-picker .ant-picker-suffix { display: none !important; }\n .ag-cell .ant-input-suffix > :not(.ant-input-clear-icon):not(.ant-input-show-count-suffix) { display: none !important; }\n .ag-cell .ant-select:not(.ant-select-focused):not(.ant-select-open) .ant-select-arrow,\n .ag-cell .ant-select:not(.ant-select-focused):not(.ant-select-open) .ant-select-suffix { display: none !important; }\n /* \u672A\u805A\u7126\u4E14\u4E3A\u7A7A\uFF1A\u5F31\u5360\u4F4D\u4E0E\u666E\u901A\u7A7A\u683C\u4E00\u81F4\uFF0C\u53EA\u7528 placeholder \u8272\uFF0C\u4E0D\u753B\u8F93\u5165\u6846\u5916\u89C2\u3002@author nokecy */\n .ag-cell .ant-select-selection-placeholder,\n .ag-cell .ant-select-placeholder,\n .ag-cell .ant-input::placeholder,\n .ag-cell .ant-input-number-input::placeholder,\n .ag-cell .ant-picker input::placeholder { color: var(--ant-color-text-placeholder, rgb(0 0 0 / 25%)) !important; }\n /* \u5408\u8BA1\u884C\uFF1A\u56FA\u5B9A\u5728\u8868\u5C3E\uFF0C\u5B57\u91CD\u5F3A\u8C03\u3001\u4E0E\u660E\u7EC6\u884C\u4EE5\u4E0A\u8FB9\u7EBF\u5206\u5F00\u3002@author nokecy */\n .ag-floating-bottom .ag-row { font-weight: 600; background: var(--ant-color-fill-quaternary, rgb(0 0 0 / 4%)); }\n .ag-cell:focus-within { box-shadow: inset 0 0 0 1px var(--ant-color-primary, #1f5fbf); }\n .ag-cell:has(.ant-formily-item-error), .ag-cell:has(.ant-formily-item-error):focus-within {\n box-shadow: inset 0 0 0 1px var(--ant-color-error, #d93025);\n }\n .ag-cell:has(.ant-input[disabled], .ant-input-disabled, .ant-input-number-disabled, .ant-select-disabled, .ant-picker-disabled) {\n background: var(--ant-color-fill-quaternary, rgb(0 0 0 / 4%));\n }\n ";
38
+ export declare const arrayTableCellFit: import("ag-grid-community").Part<{}>;
39
+ /** 根据当前 antd 主题与 Provider 密度生成编辑态或阅读态明细表格主题。@author nokecy */
10
40
  export declare function useArrayTableTheme(editable?: boolean): import("ag-grid-community").Theme<import("ag-grid-community").CoreParams & import("ag-grid-community").ButtonStyleParams & import("ag-grid-community").CheckboxStyleParams & import("ag-grid-community").TabStyleParams & import("ag-grid-community").InputStyleParams & {}>;
@@ -3,10 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ARRAY_TABLE_ROW_HEIGHT = exports.ARRAY_TABLE_FEEDBACK_CLASS = void 0;
6
+ exports.arrayTableCellFit = exports.ARRAY_TABLE_ROW_HEIGHT = exports.ARRAY_TABLE_HELP_LINE_HEIGHT = exports.ARRAY_TABLE_FEEDBACK_CLASS = exports.ARRAY_TABLE_FALLBACK_DENSITY = exports.ARRAY_TABLE_CELL_FIT_CSS = void 0;
7
+ exports.resolveArrayTableMetrics = resolveArrayTableMetrics;
8
+ exports.useArrayTableMetrics = useArrayTableMetrics;
7
9
  exports.useArrayTableTheme = useArrayTableTheme;
8
10
  var _agGridCommunity = require("ag-grid-community");
9
11
  var _react = require("react");
12
+ var _gridContext = require("../ag-grid-plus/context/gridContext");
13
+ var _density = require("../ag-grid-plus/density");
10
14
  var _theme = require("../ag-grid-plus/theme");
11
15
  /**
12
16
  * ArrayTable(明细表格)的 AG-Grid 主题:编辑态(index.tsx)与阅读态(preview.tsx)共用。
@@ -15,11 +19,41 @@ var _theme = require("../ag-grid-plus/theme");
15
19
  */
16
20
 
17
21
  /**
18
- * 行高 38:放得下 32px 高的输入框。网格选项 rowHeight 与主题参数 rowHeight 必须同值——
19
- * AG-Grid 单元格文字的行高(--ag-internal-content-line-height)是从主题的 --ag-row-height 算的,
20
- * 只设网格选项会让文字的行盒仍是主题默认行高(29.6-3=26.6px),顶在 37px 的格子上方(偏上约 4.5px)。
22
+ * Provider 没注入密度时的档位:DESIGN.md §2 把紧凑档定为 ERP 标准页默认。
23
+ * 原先写死 38,没有对应任何一档;回退到规范默认档,数值全部来自 density.ts。
21
24
  */
22
- var ARRAY_TABLE_ROW_HEIGHT = exports.ARRAY_TABLE_ROW_HEIGHT = 38;
25
+ var ARRAY_TABLE_FALLBACK_DENSITY = exports.ARRAY_TABLE_FALLBACK_DENSITY = 'compact';
26
+
27
+ /** 回退档的行高,兼容旧的具名导出;实际行高请用 useArrayTableMetrics。 */
28
+ var ARRAY_TABLE_ROW_HEIGHT = exports.ARRAY_TABLE_ROW_HEIGHT = _density.GRID_DENSITY_PRESETS[ARRAY_TABLE_FALLBACK_DENSITY].rowHeight;
29
+
30
+ /**
31
+ * 解析 ArrayTable 当前密度数值(纯函数,便于测试)。
32
+ * 网格选项 rowHeight/headerHeight 与主题参数必须同值——AG-Grid 单元格文字的行高
33
+ * (--ag-internal-content-line-height)是从主题的 --ag-row-height 算的,只设网格选项会让文字的行盒
34
+ * 仍是主题默认行高,顶在格子上方偏上。所以两处都从这一份数值取。
35
+ */
36
+ function resolveArrayTableMetrics(density, overrides) {
37
+ var _resolveGridDensity;
38
+ return (_resolveGridDensity = (0, _density.resolveGridDensity)(density, overrides)) !== null && _resolveGridDensity !== void 0 ? _resolveGridDensity : _density.GRID_DENSITY_PRESETS[ARRAY_TABLE_FALLBACK_DENSITY];
39
+ }
40
+
41
+ /** 读取 Provider 注入的密度,随 Provider 变化重算(密度运行时切换后行高即时更新)。 */
42
+ function useArrayTableMetrics() {
43
+ var _useContext = (0, _react.useContext)(_gridContext.GridPlusContext),
44
+ density = _useContext.density,
45
+ densityValues = _useContext.densityValues;
46
+ return (0, _react.useMemo)(function () {
47
+ return resolveArrayTableMetrics(density, densityValues);
48
+ }, [density, densityValues]);
49
+ }
50
+
51
+ /**
52
+ * 格内错误文字的总高度(含 terse 样式的 1px 边框,上下内边距与外边距归零,box-sizing: border-box)。
53
+ * 文字紧贴输入框下沿(top:100%),输入框高 = 行高 - 3px,所以格底到输入框底的距离是 ROW_FEEDBACK_EXTRA_HEIGHT + 3,
54
+ * 本值必须不超过它,否则会被行底边线穿过。
55
+ */
56
+ var ARRAY_TABLE_HELP_LINE_HEIGHT = exports.ARRAY_TABLE_HELP_LINE_HEIGHT = 20;
23
57
 
24
58
  /** 表格里有出错行时挂在网格外层的类名(由 index.tsx 设置) */
25
59
  var ARRAY_TABLE_FEEDBACK_CLASS = exports.ARRAY_TABLE_FEEDBACK_CLASS = 'ag-array-table-has-feedback';
@@ -35,19 +69,22 @@ var ARRAY_TABLE_FEEDBACK_CLASS = exports.ARRAY_TABLE_FEEDBACK_CLASS = 'ag-array-
35
69
  * - 错误文字单行显示、超出列宽省略,出错行只多留一行的高度(ROW_FEEDBACK_EXTRA_HEIGHT);
36
70
  * - 错误提示文字移出文档流(位置仍在输入框下方),出错时输入框不会被挤得上下跳。
37
71
  */
38
- var arrayTableCellFit = (0, _agGridCommunity.createPart)({
72
+ var ARRAY_TABLE_CELL_FIT_CSS = exports.ARRAY_TABLE_CELL_FIT_CSS = "\n .ag-cell .ag-cell-wrapper { height: 100%; max-height: 100%; min-height: 0; }\n .ag-cell .ag-cell-value { max-height: 100%; min-height: 0; }\n /* \u672C part \u7684 CSS \u4F1A\u88AB AG-Grid \u5305\u8FDB :where(.ag-theme-xxx) { ... }\uFF08\u5D4C\u5957\uFF09\uFF0C\u88F8\u5199 .has-feedback .ag-cell \u4F1A\u7F16\u8BD1\u6210\n \u300C\u4E3B\u9898\u5143\u7D20\u7684\u540E\u4EE3 has-feedback\u300D\uFF0C\u800C\u8BE5\u7C7B\u6302\u5728\u4E3B\u9898\u5143\u7D20\u7684\u7956\u5148\u4E0A\uFF0C\u89C4\u5219\u6C38\u8FDC\u4E0D\u547D\u4E2D\u3002\n \u6240\u4EE5\u7528 & \u663E\u5F0F\u653E\u5728 has-feedback \u4E4B\u540E\uFF08\u7956\u5148\u5199\u6CD5\uFF09\uFF0C\u540C\u65F6\u517C\u5BB9\u7C7B\u540D\u6302\u5728\u4E3B\u9898\u5143\u7D20\u81EA\u8EAB\u7684\u5199\u6CD5\u3002 */\n .".concat(ARRAY_TABLE_FEEDBACK_CLASS, " & .ag-cell .ag-cell-wrapper,\n &.").concat(ARRAY_TABLE_FEEDBACK_CLASS, " .ag-cell .ag-cell-wrapper { height: min(100%, calc(var(--ag-row-height) - 3px)); }\n /* \u5BBF\u4E3B\u53EF\u80FD\u5199 .xxx .ant-formily-item { margin-bottom: 12px }\uFF08\u7279\u5F02\u6027 0,3,0\uFF09\uFF1B\u8FD9\u91CC\u53E0\u7C7B\u540D\u5E76 !important\uFF0C\u4EFB\u4F55\u5BBF\u4E3B\u89C4\u5219\u90FD\u538B\u4E0D\u8FC7\uFF0C\n \u5426\u5219\u683C\u5185\u63A7\u4EF6\u4F1A\u88AB margin \u9876\u5F97\u504F\u4E0A 3-5px\u3002@author nokecy */\n .ag-cell .ag-cell-wrapper .ant-formily-item.ant-formily-item { margin-bottom: 0 !important; }\n /* \u6807\u9898\u548C\u8BF4\u660E\u7531\u5217\u5934\u627F\u8F7D\uFF0ClabelWidth:0 \u672C\u8EAB\u4E0D\u4F1A\u9690\u85CF\u5B57\u6BB5\u6807\u9898\u3002@author nokecy */\n .ag-cell .ant-formily-item-label { display: none; }\n .ag-cell .ant-formily-item-control { flex: 1; min-width: 0; width: 100%; }\n /* \u5E26\u5916\u58F3\u7684\u8F93\u5165\u6846\uFF08affix/wrapper\uFF09\u662F inline-flex\uFF0Cantd \u7ED9\u8868\u5355\u9879\u5185\u5BB9\u533A controlHeight \u7684\u6700\u5C0F\u9AD8\u5EA6\u548C\u5BF9\u5E94\u884C\u9AD8\uFF0C\n \u5916\u58F3\u6309\u57FA\u7EBF\u5BF9\u9F50\u88AB\u9876\u504F\u3002\u5185\u5BB9\u533A\u6539\u6210\u5C45\u4E2D\u7684 flex\uFF08\u5B50\u9879\u88AB\u5757\u5316\uFF0C\u4E0D\u518D\u6709\u57FA\u7EBF\u5BF9\u9F50\uFF09\uFF0C\u6700\u5C0F\u9AD8\u5EA6\u5F52\u96F6\uFF0C\n \u8868\u5355\u9879\u9AD8\u5EA6\u7531\u63A7\u4EF6\u81EA\u5DF1\u7684\u9AD8\u5EA6\uFF08\u884C\u9AD8-3px\uFF09\u51B3\u5B9A\uFF0C\u4E0D\u8D85\u51FA\u884C\u9AD8\u3002 */\n .ag-cell .ant-formily-item,\n .ag-cell .ant-formily-item-control,\n .ag-cell .ant-formily-item-control-content,\n .ag-cell .ant-formily-item-control-content-component { min-height: 0 !important; }\n .ag-cell .ant-formily-item-control-content,\n .ag-cell .ant-formily-item-control-content-component { display: flex; align-items: center; }\n .ag-cell .ant-formily-item-control-content-component { flex: 1 1 auto; min-width: 0; }\n .ag-cell .ant-formily-item-control-content-component > * { flex: 1 1 auto; min-width: 0; }\n /* \u9519\u8BEF\u6587\u5B57\u9489\u5728\u8F93\u5165\u6846\u6B63\u4E0B\u65B9\uFF08top:100% \u76F8\u5BF9 .ant-formily-item\uFF09\uFF0C\u9AD8\u5EA6\u56FA\u5B9A\u4E3A ARRAY_TABLE_HELP_LINE_HEIGHT\uFF0C\n \u4E0D\u518D\u4F9D\u8D56\u6587\u6863\u6D41\u91CC\u7684\u9759\u6001\u4F4D\u7F6E\uFF08\u4F1A\u968F margin/\u5C45\u4E2D\u504F\u79FB\uFF0C\u5BFC\u81F4\u88AB\u884C\u5E95\u8FB9\u7EBF\u7A7F\u8FC7\uFF09\u3002 */\n .ag-cell .ant-formily-item-help { position: absolute; top: 100%; inset-inline-start: 0; margin: 0 !important; padding-block: 0 !important; box-sizing: border-box !important; min-height: 0 !important; height: ").concat(ARRAY_TABLE_HELP_LINE_HEIGHT, "px !important; line-height: ").concat(ARRAY_TABLE_HELP_LINE_HEIGHT - 2, "px !important; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .ag-cell .ag-cell-value:has(.ant-formily-item-help) { overflow: visible; }\n /* \u5217\u5BF9\u9F50\uFF08align \u5199\u6CD5\uFF09\uFF1B\u6B63\u5728\u7F16\u8F91\u7684\u8F93\u5165\u6846\u8DDF\u968F\u6240\u5728\u5217\u7684\u5BF9\u9F50\uFF0C\u6570\u5B57\u5217\u70B9\u5F00\u7F16\u8F91\u65F6\u4E0D\u4F1A\u8DF3\u5230\u5DE6\u8FB9\u3002@author nokecy */\n .ag-cell.qc-array-table-align-left { text-align: left; }\n .ag-cell.qc-array-table-align-center { text-align: center; }\n .ag-cell.qc-array-table-align-right { text-align: right; }\n .ag-cell .ant-input-number .ant-input-number-input,\n .ag-cell .ant-input-affix-wrapper .ant-input,\n .ag-cell .ant-input.ant-input { text-align: inherit; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n /* \u5355\u5C42\u6846\uFF1A\u683C\u5185\u63A7\u4EF6\u4E0D\u753B\u81EA\u5DF1\u7684\u8FB9\u6846/\u9634\u5F71/\u5E95\u8272\uFF0C\u6491\u6EE1\u5355\u5143\u683C\uFF1B\n \u805A\u7126/\u9519\u8BEF/\u9501\u5B9A\u53EA\u7531\u5355\u5143\u683C\u7684 inset \u6846\uFF08\u6216\u5E95\u8272\uFF09\u8868\u8FBE\uFF0C\u4E0D\u5360\u5C3A\u5BF8\uFF0C\u884C\u9AD8\u4E0E\u5355\u5143\u683C\u5C3A\u5BF8\u4E0D\u53D8\u3002\n \u9009\u62E9\u5668\u5168\u90E8\u9650\u5B9A\u5728 .ag-cell \u5185\uFF0C\u800C\u672C part \u53EA\u6302\u5728 ArrayTable \u7684\u4E3B\u9898\u4E0A\uFF0C\u4E0D\u5F71\u54CD\u8868\u683C\u5916\u7684\u8868\u5355\u3002@author nokecy */\n .ag-cell .ant-input.ant-input,\n .ag-cell .ant-input-affix-wrapper.ant-input-affix-wrapper,\n .ag-cell .ant-input-number.ant-input-number,\n .ag-cell .ant-input-number-affix-wrapper.ant-input-number-affix-wrapper,\n .ag-cell .ant-select.ant-select,\n .ag-cell .ant-select.ant-select .ant-select-selector,\n .ag-cell .ant-picker.ant-picker,\n .ag-cell .ant-input-outlined.ant-input-outlined {\n border: 0 !important;\n box-shadow: none !important;\n background: transparent !important;\n outline: none;\n }\n .ag-cell .ant-input-number, .ag-cell .ant-picker, .ag-cell .ant-select, .ag-cell .ant-input-affix-wrapper { width: 100%; }\n /* \u63A7\u4EF6\u300C\u50CF\u6587\u672C\u300D\uFF1A\u5B57\u53F7\u3001\u6C34\u5E73\u5185\u8FB9\u8DDD\u8DDF\u968F\u5BC6\u5EA6\uFF08\u5355\u5143\u683C\u81EA\u5DF1\u5DF2\u6709 --ag-cell-horizontal-padding\uFF0C\u63A7\u4EF6\u4E0D\u518D\u53E0\u4E00\u5C42\uFF09\uFF0C\n \u9AD8\u5EA6\u968F\u884C\u9AD8\u3001\u7559 3px \u7ED9\u4E0B\u8FB9\u6846\u4E0E\u5C45\u4E2D\u4F59\u91CF\uFF0C\u4E0D\u6491\u9AD8\u884C\uFF1B\u5BC6\u5EA6\u7531\u4E3B\u9898\u53C2\u6570 rowHeight \u51B3\u5B9A\uFF0C\u4E0D\u5199\u6B7B\u50CF\u7D20\u3002@author nokecy */\n .ag-cell .ant-input.ant-input,\n .ag-cell .ant-input-affix-wrapper.ant-input-affix-wrapper,\n .ag-cell .ant-input-number.ant-input-number,\n .ag-cell .ant-input-number-affix-wrapper.ant-input-number-affix-wrapper,\n .ag-cell .ant-select.ant-select,\n .ag-cell .ant-select.ant-select .ant-select-selector,\n .ag-cell .ant-picker.ant-picker { font-size: inherit !important; padding-inline: 0 !important; }\n /* antd 6 \u7684 Select \u6839\u8282\u70B9\u81EA\u5DF1\u5E26\u8FB9\u6846\u4E0E\u5185\u8FB9\u8DDD\uFF08\u6CA1\u6709 .ant-select-selector\uFF09\uFF0C\u4E0A\u4E0B\u5185\u8FB9\u8DDD\u4E5F\u5F52\u96F6\uFF0C\u9AD8\u5EA6\u7531\u4E0B\u9762\u7684 height \u51B3\u5B9A\uFF0C\u5782\u76F4\u5C45\u4E2D\u3002*/\n .ag-cell .ant-select.ant-select { padding-block: 0 !important; align-items: center; }\n .ag-cell .ant-input-number .ant-input-number-input,\n .ag-cell .ant-picker .ant-picker-input > input,\n .ag-cell .ant-select .ant-select-selection-item,\n .ag-cell .ant-select .ant-select-selection-search-input,\n .ag-cell .ant-select .ant-select-content,\n .ag-cell .ant-select .ant-select-content-item,\n .ag-cell .ant-select .ant-select-placeholder,\n .ag-cell .ant-select .ant-select-input { font-size: inherit !important; padding-inline: 0 !important; }\n .ag-cell .ant-input.ant-input,\n .ag-cell .ant-input-affix-wrapper.ant-input-affix-wrapper,\n .ag-cell .ant-input-number.ant-input-number,\n .ag-cell .ant-input-number-affix-wrapper.ant-input-number-affix-wrapper,\n .ag-cell .ant-select.ant-select,\n .ag-cell .ant-select.ant-select .ant-select-selector,\n .ag-cell .ant-picker.ant-picker { height: calc(var(--ag-row-height) - 3px) !important; min-height: 0 !important; }\n /* \u5957\u5728\u5916\u58F3\u91CC\u7684\u5185\u5C42\u63A7\u4EF6\u6491\u6EE1\u5916\u58F3\u5373\u53EF\uFF0C\u518D\u8BBE\u540C\u4E00\u9AD8\u5EA6\u4F1A\u52A0\u4E0A\u5916\u58F3 padding \u6EA2\u51FA\uFF1B\u591A\u884C\u6587\u672C\u57DF\u4E0D\u53D7\u9650\u3002*/\n .ag-cell .ant-input-affix-wrapper .ant-input.ant-input,\n .ag-cell .ant-input-number-affix-wrapper .ant-input-number-input { height: 100% !important; }\n /* \u591A\u884C\u6587\u672C\u5728\u56FA\u5B9A\u884C\u9AD8\u7684\u683C\u91CC\u4E0D\u6491\u9AD8\u884C\uFF1A\u9AD8\u5EA6\u53D6\u5355\u884C\u9AD8\uFF0C\u8D85\u51FA\u5185\u5BB9\u5728\u6846\u5185\u6EDA\u52A8 */\n .ag-cell textarea.ant-input.ant-input { height: calc(var(--ag-row-height) - 3px) !important; min-height: 0 !important; resize: none; overflow-y: auto; line-height: calc(var(--ag-row-height) - 5px) !important; padding-block: 0 !important; }\n /* Editable \u88C5\u9970\u5668\u5916\u58F3\u9ED8\u8BA4 inline-block\uFF0C\u4F1A\u5728 .ag-cell-value \u7684\u884C\u76D2\u91CC\u6309\u57FA\u7EBF\u5BF9\u9F50\u3001\u88AB\u9876\u504F\uFF1B\u6539\u4E3A\u5757\u7EA7 flex \u4E0E\u5176\u4ED6\u63A7\u4EF6\u4E00\u81F4\u5C45\u4E2D */\n .ag-cell .ant-formily-editable { display: flex; align-items: center; width: 100%; }\n /* Select \u6587\u5B57\u884C\u9AD8\u4E0E\u641C\u7D22\u6846\u4F4D\u7F6E\uFF1Aselector \u5F52\u96F6\u5185\u8FB9\u8DDD\u540E\uFF0C\u6587\u5B57\u884C\u9AD8\u53D6\u683C\u5185\u53EF\u7528\u9AD8\u5EA6\uFF0C\u641C\u7D22\u8F93\u5165\u6846\u8D34\u5DE6\uFF0C\u5149\u6807\u4E0D\u9519\u4F4D\u3002*/\n .ag-cell .ant-select .ant-select-selection-item,\n .ag-cell .ant-select .ant-select-selection-placeholder,\n .ag-cell .ant-select .ant-select-selection-search-input,\n .ag-cell .ant-select .ant-select-content,\n .ag-cell .ant-select .ant-select-content-item,\n .ag-cell .ant-select .ant-select-placeholder,\n .ag-cell .ant-select .ant-select-input { line-height: calc(var(--ag-row-height) - 3px) !important; }\n .ag-cell .ant-select .ant-select-selection-search { inset-inline: 0 !important; }\n /* \u6B65\u8FDB\u5668\u4E0E\u65E5\u5386\u56FE\u6807\u5728\u4EFB\u4F55\u72B6\u6001\u90FD\u4E0D\u663E\u793A\uFF08\u4E0E\u6F14\u793A\u4E00\u81F4\uFF1A\u952E\u76D8\u7528\u65B9\u5411\u952E/\u952E\u5165\uFF0C\u9762\u677F\u7531\u70B9\u51FB\u5C55\u5F00\uFF09\uFF1B\n Input \u53EA\u4FDD\u7559\u6E05\u9664\u56FE\u6807\u3002\u4E0B\u62C9\u7BAD\u5934\u53EA\u5728\u805A\u7126\u6216\u9762\u677F\u5C55\u5F00\u65F6\u51FA\u73B0\u3002@author nokecy */\n .ag-cell .ant-input-number-handler-wrap { display: none !important; }\n .ag-cell .ant-picker .ant-picker-suffix { display: none !important; }\n .ag-cell .ant-input-suffix > :not(.ant-input-clear-icon):not(.ant-input-show-count-suffix) { display: none !important; }\n .ag-cell .ant-select:not(.ant-select-focused):not(.ant-select-open) .ant-select-arrow,\n .ag-cell .ant-select:not(.ant-select-focused):not(.ant-select-open) .ant-select-suffix { display: none !important; }\n /* \u672A\u805A\u7126\u4E14\u4E3A\u7A7A\uFF1A\u5F31\u5360\u4F4D\u4E0E\u666E\u901A\u7A7A\u683C\u4E00\u81F4\uFF0C\u53EA\u7528 placeholder \u8272\uFF0C\u4E0D\u753B\u8F93\u5165\u6846\u5916\u89C2\u3002@author nokecy */\n .ag-cell .ant-select-selection-placeholder,\n .ag-cell .ant-select-placeholder,\n .ag-cell .ant-input::placeholder,\n .ag-cell .ant-input-number-input::placeholder,\n .ag-cell .ant-picker input::placeholder { color: var(--ant-color-text-placeholder, rgb(0 0 0 / 25%)) !important; }\n /* \u5408\u8BA1\u884C\uFF1A\u56FA\u5B9A\u5728\u8868\u5C3E\uFF0C\u5B57\u91CD\u5F3A\u8C03\u3001\u4E0E\u660E\u7EC6\u884C\u4EE5\u4E0A\u8FB9\u7EBF\u5206\u5F00\u3002@author nokecy */\n .ag-floating-bottom .ag-row { font-weight: 600; background: var(--ant-color-fill-quaternary, rgb(0 0 0 / 4%)); }\n .ag-cell:focus-within { box-shadow: inset 0 0 0 1px var(--ant-color-primary, #1f5fbf); }\n .ag-cell:has(.ant-formily-item-error), .ag-cell:has(.ant-formily-item-error):focus-within {\n box-shadow: inset 0 0 0 1px var(--ant-color-error, #d93025);\n }\n .ag-cell:has(.ant-input[disabled], .ant-input-disabled, .ant-input-number-disabled, .ant-select-disabled, .ant-picker-disabled) {\n background: var(--ant-color-fill-quaternary, rgb(0 0 0 / 4%));\n }\n ");
73
+ var arrayTableCellFit = exports.arrayTableCellFit = (0, _agGridCommunity.createPart)({
39
74
  feature: 'arrayTableCellFit',
40
- css: "\n .ag-cell .ag-cell-wrapper { height: 100%; }\n .".concat(ARRAY_TABLE_FEEDBACK_CLASS, " .ag-cell .ag-cell-wrapper { height: min(100%, ").concat(ARRAY_TABLE_ROW_HEIGHT - 3, "px); }\n .ag-cell .ant-formily-item { margin-bottom: 0; }\n /* \u6807\u9898\u548C\u8BF4\u660E\u7531\u5217\u5934\u627F\u8F7D\uFF0ClabelWidth:0 \u672C\u8EAB\u4E0D\u4F1A\u9690\u85CF\u5B57\u6BB5\u6807\u9898\u3002@author nokecy */\n .ag-cell .ant-formily-item-label { display: none; }\n .ag-cell .ant-formily-item-control { flex: 1; min-width: 0; width: 100%; }\n .ag-cell .ant-formily-item-help { position: absolute; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n .ag-cell .ag-cell-value:has(.ant-formily-item-help) { overflow: visible; }\n /* \u5217\u5BF9\u9F50\uFF08align \u5199\u6CD5\uFF09\uFF1B\u6B63\u5728\u7F16\u8F91\u7684\u8F93\u5165\u6846\u8DDF\u968F\u6240\u5728\u5217\u7684\u5BF9\u9F50\uFF0C\u6570\u5B57\u5217\u70B9\u5F00\u7F16\u8F91\u65F6\u4E0D\u4F1A\u8DF3\u5230\u5DE6\u8FB9\u3002@author nokecy */\n .ag-cell.qc-array-table-align-left { text-align: left; }\n .ag-cell.qc-array-table-align-center { text-align: center; }\n .ag-cell.qc-array-table-align-right { text-align: right; }\n .ag-cell .ant-input-number .ant-input-number-input,\n .ag-cell .ant-input-affix-wrapper .ant-input,\n .ag-cell .ant-input.ant-input { text-align: inherit; }\n .ag-header-cell.qc-array-table-required .ag-header-cell-text::before {\n content: '*';\n color: var(--ag-invalid-color);\n margin-inline-end: 4px;\n }\n ")
75
+ css: ARRAY_TABLE_CELL_FIT_CSS
41
76
  });
42
77
 
43
- /** 根据当前 antd 主题生成编辑态或阅读态明细表格主题。@author nokecy */
78
+ /** 根据当前 antd 主题与 Provider 密度生成编辑态或阅读态明细表格主题。@author nokecy */
44
79
  function useArrayTableTheme() {
45
80
  var editable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
46
- var agGridTheme = (0, _theme.useAgGridTheme)();
81
+ var metrics = useArrayTableMetrics();
82
+ // 叠加而非替换:useAgGridTheme 把密度的字号/行高/表头高/水平内边距写进主题,随后只追加本表格的部件。
83
+ var agGridTheme = (0, _theme.useAgGridTheme)({
84
+ density: metrics
85
+ });
47
86
  return (0, _react.useMemo)(function () {
48
- var previewTheme = agGridTheme.withParams({
49
- rowHeight: ARRAY_TABLE_ROW_HEIGHT
50
- }).withPart(arrayTableCellFit);
87
+ var previewTheme = agGridTheme.withPart(arrayTableCellFit);
51
88
  return editable ? previewTheme.withParams({
52
89
  focusShadow: 'none',
53
90
  rangeSelectionBorderColor: 'transparent',
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ /** 明细表格的区域标题:左侧 3px 主色竖条 + 加粗文字(DESIGN.md §5.2 次级工具栏) */
3
+ export declare const ArrayTableTitle: React.FC<React.PropsWithChildren>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ArrayTableTitle = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ /** 明细表格的区域标题:左侧 3px 主色竖条 + 加粗文字(DESIGN.md §5.2 次级工具栏) */
11
+ var ArrayTableTitle = exports.ArrayTableTitle = function ArrayTableTitle(_ref) {
12
+ var children = _ref.children;
13
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
14
+ style: {
15
+ display: 'inline-flex',
16
+ alignItems: 'center',
17
+ gap: 8,
18
+ fontWeight: 600
19
+ },
20
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
21
+ style: {
22
+ width: 3,
23
+ height: 14,
24
+ background: 'var(--ind-primary, var(--ant-color-primary))',
25
+ borderRadius: 1
26
+ }
27
+ }), children]
28
+ });
29
+ };
@@ -38,6 +38,7 @@ declare const LazyAgField: (params: any) => React.JSX.Element;
38
38
  * 加载,行引用整体替换→AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
39
39
  */
40
40
  declare const LazyReadOnlyText: (params: any) => React.JSX.Element;
41
+ declare const findDataFieldSchema: (columnSchema: Schema, name: string) => any;
41
42
  declare const buildArrayTableColumns: (dataSource: any[], field: ArrayField, sources: ObservableColumnSource[]) => AgGridReactProps['columnDefs'];
42
43
  /**
43
44
  * 找到 schema 里的 ArrayTable.Addition 占位节点,返回它的 x-component-props(新增按钮的 title / defaultValue / onAdd 等)。
@@ -51,7 +52,7 @@ declare const useAddition: () => {
51
52
  schema: Schema;
52
53
  props: Record<string, any>;
53
54
  } | null;
54
- export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField, LazyReadOnlyText };
55
+ export { findDataFieldSchema, isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField, LazyReadOnlyText };
55
56
  export type LazyColumnDefault = {
56
57
  key: string;
57
58
  value: any;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useArrayTableSources = exports.useArrayTableActions = exports.useAddition = exports.isColumnComponent = exports.collectLazyDefaults = exports.buildArrayTableColumns = exports.applyLazyDefaults = exports.LazyReadOnlyText = exports.LazyAgField = void 0;
6
+ exports.useArrayTableSources = exports.useArrayTableActions = exports.useAddition = exports.isColumnComponent = exports.findDataFieldSchema = exports.collectLazyDefaults = exports.buildArrayTableColumns = exports.applyLazyDefaults = exports.LazyReadOnlyText = exports.LazyAgField = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _antd = require("antd");
9
9
  var _formilyReact = require("@nokecy/formily-react");
@@ -15,6 +15,7 @@ var _readOnlyFormatters = require("./readOnlyFormatters");
15
15
  var _columnGroup = require("./columnGroup");
16
16
  var _fixedGuard = require("./fixedGuard");
17
17
  var _cellFocusScope = require("./cellFocusScope");
18
+ var _cellEditorMarker = require("./cellEditorMarker");
18
19
  var _sorting = require("./sorting");
19
20
  var _indexColumn = require("./indexColumn");
20
21
  var _gridSequence = require("../shared/gridSequence");
@@ -178,7 +179,8 @@ var AgField = function AgField(_ref3) {
178
179
  dataSource = _ref3.dataSource,
179
180
  schema = _ref3.schema,
180
181
  field = _ref3.field,
181
- node = _ref3.node;
182
+ node = _ref3.node,
183
+ editorComponent = _ref3.editorComponent;
182
184
  var _resolveCellRow = resolveCellRow(field, record, node, dataSource),
183
185
  index = _resolveCellRow.index;
184
186
  if (index < 0) return null;
@@ -199,7 +201,10 @@ var AgField = function AgField(_ref3) {
199
201
  onlyRenderProperties: true
200
202
  })
201
203
  });
202
- return children;
204
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_cellEditorMarker.CellEditorMarker, {
205
+ kind: (0, _cellEditorMarker.resolveCellEditorKind)(editorComponent),
206
+ children: children
207
+ });
203
208
  };
204
209
 
205
210
  /**
@@ -580,7 +585,8 @@ var LazyAgField = exports.LazyAgField = function LazyAgField(params) {
580
585
  dataSource: dataSource,
581
586
  schema: schema,
582
587
  field: field,
583
- node: node
588
+ node: node,
589
+ editorComponent: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component']
584
590
  });
585
591
  }
586
592
  // Editable 装饰器会把非新增行的格转成只读态、不参与校验(见 editable/index.tsx),
@@ -603,7 +609,8 @@ var LazyAgField = exports.LazyAgField = function LazyAgField(params) {
603
609
  dataSource: dataSource,
604
610
  schema: schema,
605
611
  field: field,
606
- node: node
612
+ node: node,
613
+ editorComponent: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component']
607
614
  })
608
615
  });
609
616
  }
@@ -618,7 +625,8 @@ var LazyAgField = exports.LazyAgField = function LazyAgField(params) {
618
625
  dataSource: dataSource,
619
626
  schema: schema,
620
627
  field: field,
621
- node: node
628
+ node: node,
629
+ editorComponent: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component']
622
630
  });
623
631
  }
624
632
  var ctx = {
@@ -705,7 +713,7 @@ var LazyReadOnlyText = exports.LazyReadOnlyText = function LazyReadOnlyText(para
705
713
  };
706
714
 
707
715
  // 在 Column 的子 schema 里递归找到内层数据字段(可读 x-component / x-pattern / x-reactions / enum) @author nokecy
708
- var findDataFieldSchema = function findDataFieldSchema(columnSchema, name) {
716
+ var findDataFieldSchema = exports.findDataFieldSchema = function findDataFieldSchema(columnSchema, name) {
709
717
  if (!columnSchema || !columnSchema.properties) return null;
710
718
  var matched = null;
711
719
  var firstField = null;
@@ -749,6 +757,45 @@ var isColumnReadOnlyEligible = function isColumnReadOnlyEligible(arrayPattern, d
749
757
  return false;
750
758
  };
751
759
 
760
+ /**
761
+ * 静态解析 x-reactions 依赖里指向「同表其他列」的列名。
762
+ *
763
+ * 懒挂载/只读快路径的格子不创建 Formily 字段,而 reaction 的依赖是按字段节点取值的:
764
+ * 被依赖列没有字段,依赖读到 undefined,金额=数量×单价这类联动初始显示 0。
765
+ * 所以被依赖列必须创建字段(走 eager)。选「标记 eager」而不是「预建字段/改读 form values」的理由:
766
+ * 前者沿用 Formily 自己的求值与订阅路径(字段创建后依赖自动重算),不引入第二套取值逻辑;
767
+ * 代价只是依赖列失去懒挂载优化,而依赖列通常是少数几列。
768
+ *
769
+ * 只认能确定指向本表某一列的写法:相对路径 `.qty`(可带 `#value` 之类的属性后缀)、
770
+ * 带通配的绝对路径 `items.*.price`(前缀必须是本数组字段)。`..xx`、不带通配的绝对路径、
771
+ * 表达式串等解析不了的一律忽略,保持原有行为。@author nokecy
772
+ */
773
+ var collectReactionDependencyColumns = function collectReactionDependencyColumns(arrayField, reactions) {
774
+ var _arrayField$path, _arrayField$path$toSt, _arrayField$address, _arrayField$address$t;
775
+ var names = [];
776
+ var arrayPaths = [arrayField === null || arrayField === void 0 || (_arrayField$path = arrayField.path) === null || _arrayField$path === void 0 || (_arrayField$path$toSt = _arrayField$path.toString) === null || _arrayField$path$toSt === void 0 ? void 0 : _arrayField$path$toSt.call(_arrayField$path), arrayField === null || arrayField === void 0 || (_arrayField$address = arrayField.address) === null || _arrayField$address === void 0 || (_arrayField$address$t = _arrayField$address.toString) === null || _arrayField$address$t === void 0 ? void 0 : _arrayField$address$t.call(_arrayField$address)].filter(Boolean);
777
+ var take = function take(dep) {
778
+ var source = typeof dep === 'string' ? dep : dep && _typeof(dep) === 'object' && typeof dep.source === 'string' ? dep.source : null;
779
+ if (!source || source.includes('{{')) return;
780
+ var path = source.split('#')[0].trim();
781
+ if (path.startsWith('..')) return;
782
+ if (path.startsWith('.')) {
783
+ var name = path.slice(1);
784
+ if (name && !name.includes('*') && isFastPathFieldName(name)) names.push(name);
785
+ return;
786
+ }
787
+ var matched = /^(.+)\.\*\.([^.*]+)$/.exec(path);
788
+ if (matched && arrayPaths.includes(matched[1])) names.push(matched[2]);
789
+ };
790
+ var visit = function visit(reaction) {
791
+ if (!reaction || _typeof(reaction) !== 'object') return;
792
+ var deps = reaction.dependencies;
793
+ if (Array.isArray(deps)) deps.forEach(take);else if (deps && _typeof(deps) === 'object') Object.values(deps).forEach(take);
794
+ };
795
+ (Array.isArray(reactions) ? reactions : [reactions]).forEach(visit);
796
+ return names;
797
+ };
798
+
752
799
  /** 明细单元格里的数字输入组件(antd InputNumber 及其 Formily 封装) */
753
800
  var NUMBER_INPUT_COMPONENTS = new Set(['NumberPicker', 'InputNumber']);
754
801
 
@@ -773,13 +820,27 @@ var applyNumberInputDefaults = function applyNumberInputDefaults(dataField) {
773
820
  // 重命名自 useArrayTableColumns:内部无任何 Hook 调用,use 前缀违反 Hook 命名约定且曾在 useMemo 内被调用 @author nokecy
774
821
  var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArrayTableColumns(dataSource, field, sources) {
775
822
  var arrayPattern = field === null || field === void 0 ? void 0 : field.pattern;
776
- return sources.reduce(function (buf, _ref7, key) {
777
- var _dataField$xDecorato, _ref8, _getReadOnlyFormatter, _dataField$xComponen, _parseObjectDestructu, _dataField$xComponen2, _dataField$xComponen3, _dataField$xComponen4, _dataField$xComponen5;
823
+ // 被其他列 x-reactions 依赖的列:必须创建字段,见 collectReactionDependencyColumns。
824
+ var reactionDependencyColumns = new Set();
825
+ sources.forEach(function (_ref7) {
826
+ var _findDataFieldSchema;
778
827
  var name = _ref7.name,
779
- columnProps = _ref7.columnProps,
780
828
  schema = _ref7.schema,
781
- display = _ref7.display,
782
- components = _ref7.components;
829
+ display = _ref7.display;
830
+ if (display && display !== 'visible') return;
831
+ if (!isColumnComponent(schema)) return;
832
+ var reactions = (_findDataFieldSchema = findDataFieldSchema(schema, name)) === null || _findDataFieldSchema === void 0 ? void 0 : _findDataFieldSchema['x-reactions'];
833
+ if (reactions) collectReactionDependencyColumns(field, reactions).forEach(function (dep) {
834
+ return reactionDependencyColumns.add(dep);
835
+ });
836
+ });
837
+ return sources.reduce(function (buf, _ref8, key) {
838
+ var _dataField$xDecorato, _ref9, _getReadOnlyFormatter, _dataField$xComponen, _parseObjectDestructu, _dataField$xComponen2, _dataField$xComponen3, _dataField$xComponen4, _dataField$xComponen5;
839
+ var name = _ref8.name,
840
+ columnProps = _ref8.columnProps,
841
+ schema = _ref8.schema,
842
+ display = _ref8.display,
843
+ components = _ref8.components;
783
844
  if (display && display !== 'visible') return buf;
784
845
  if (!isColumnComponent(schema)) return buf;
785
846
 
@@ -851,9 +912,9 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
851
912
  // 仅把标量码交给 fallback 会跳过这些逻辑。解构值自带名称、显式编码展示及已登记格式化器仍走快路径。
852
913
  // 登记渲染器的组件只读列也可用兜底格式化器判空。@author nokecy
853
914
  var renderer = (0, _readOnlyFormatters.getReadOnlyRenderer)(component);
854
- var formatter = (_ref8 = (_getReadOnlyFormatter = (0, _readOnlyFormatters.getReadOnlyFormatter)(component, components)) !== null && _getReadOnlyFormatter !== void 0 ? _getReadOnlyFormatter : (dataField === null || dataField === void 0 || (_dataField$xComponen = dataField['x-component-props']) === null || _dataField$xComponen === void 0 ? void 0 : _dataField$xComponen.displayField) === 'value' ? _readOnlyFormatters.fallbackFormatter : null) !== null && _ref8 !== void 0 ? _ref8 : (!readOnly || renderer) && (renderer || (_parseObjectDestructu = parseObjectDestructure(dataField === null || dataField === void 0 ? void 0 : dataField.name)) !== null && _parseObjectDestructu !== void 0 && _parseObjectDestructu.some(function (_ref9) {
855
- var _ref10 = _slicedToArray(_ref9, 1),
856
- key = _ref10[0];
915
+ var formatter = (_ref9 = (_getReadOnlyFormatter = (0, _readOnlyFormatters.getReadOnlyFormatter)(component, components)) !== null && _getReadOnlyFormatter !== void 0 ? _getReadOnlyFormatter : (dataField === null || dataField === void 0 || (_dataField$xComponen = dataField['x-component-props']) === null || _dataField$xComponen === void 0 ? void 0 : _dataField$xComponen.displayField) === 'value' ? _readOnlyFormatters.fallbackFormatter : null) !== null && _ref9 !== void 0 ? _ref9 : (!readOnly || renderer) && (renderer || (_parseObjectDestructu = parseObjectDestructure(dataField === null || dataField === void 0 ? void 0 : dataField.name)) !== null && _parseObjectDestructu !== void 0 && _parseObjectDestructu.some(function (_ref10) {
916
+ var _ref11 = _slicedToArray(_ref10, 1),
917
+ key = _ref11[0];
857
918
  return key === 'label';
858
919
  })) && component && (dataField === null || dataField === void 0 ? void 0 : dataField.type) !== 'void' ? _readOnlyFormatters.fallbackFormatter : null;
859
920
  var displayColumnProps = formatter && ((0, _readOnlyFormatters.getReadOnlyFormatter)(component, components) !== (0, _readOnlyFormatters.getReadOnlyFormatter)(component) || (dataField === null || dataField === void 0 || (_dataField$xComponen2 = dataField['x-component-props']) === null || _dataField$xComponen2 === void 0 ? void 0 : _dataField$xComponen2.displayField) === 'value') ? {
@@ -873,7 +934,16 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
873
934
  // 可编辑格由 LazyAgField 按当前 scope 编译格式化表达式;静态只读路径仍交给真实字段。@author nokecy
874
935
  var schemaFormatter = dataField === null || dataField === void 0 || (_dataField$xComponen5 = dataField['x-component-props']) === null || _dataField$xComponen5 === void 0 ? void 0 : _dataField$xComponen5.formatter;
875
936
  var hasFormatterExpression = typeof schemaFormatter === 'string' && schemaFormatter.includes('{{');
876
- var forceEager = (columnProps === null || columnProps === void 0 ? void 0 : columnProps.forceAgField) === true || formatter === (0, _readOnlyFormatters.getReadOnlyFormatter)('Select') && hasOptionExpression || readOnly && hasFormatterExpression;
937
+ var isReactionDependency = reactionDependencyColumns.has(name) || !!(dataField !== null && dataField !== void 0 && dataField.name) && reactionDependencyColumns.has(dataField.name);
938
+ var forceEager = (columnProps === null || columnProps === void 0 ? void 0 : columnProps.forceAgField) === true || isReactionDependency || formatter === (0, _readOnlyFormatters.getReadOnlyFormatter)('Select') && hasOptionExpression || readOnly && hasFormatterExpression;
939
+ // 平时就是真控件的格(必填/带校验规则、带联动、强制 eager)缺省不带 placeholder 时整格空白,与懒挂载格的「请输入/请选择」不一致;
940
+ // 补上同一句。只补单值的 antd 输入类组件(范围选择的 placeholder 是数组,不碰)。@author nokecy
941
+ var editorProps = dataField === null || dataField === void 0 ? void 0 : dataField['x-component-props'];
942
+ if (!readOnly && dataField && (isRequiredSchema(dataField) || hasValidatorRule(dataField) || hasReactions || forceEager) && (0, _cellEditorMarker.resolveCellEditorKind)(dataField['x-component']) && !String(dataField['x-component']).includes('RangePicker') && (editorProps == null || _typeof(editorProps) === 'object' && editorProps.placeholder == null)) {
943
+ dataField['x-component-props'] = _objectSpread(_objectSpread({}, editorProps !== null && editorProps !== void 0 ? editorProps : {}), {}, {
944
+ placeholder: resolveEmptyPlaceholder(dataField)
945
+ });
946
+ }
877
947
  // Switch/Checkbox 是「单击直控」组件:可编辑态本就该常驻渲染真控件(优化前即如此)。
878
948
  // 懒挂载会把它降成「是/否」纯文本(点击才挂出开关),用户会以为开关消失。故可编辑态强制 eager。
879
949
  // 只读态(下方 ① 路径)仍走「是/否」文本快路径不受影响。@author nokecy
@@ -978,7 +1048,8 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
978
1048
  cellRendererParams: {
979
1049
  dataSource: dataSource,
980
1050
  schema: schema,
981
- field: field
1051
+ field: field,
1052
+ editorComponent: component
982
1053
  },
983
1054
  cellRenderer: AgField
984
1055
  }));
@@ -1027,9 +1098,9 @@ var collectLazyDefaults = exports.collectLazyDefaults = function collectLazyDefa
1027
1098
  key: String((_fieldSchema$name3 = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name) !== null && _fieldSchema$name3 !== void 0 ? _fieldSchema$name3 : col.field),
1028
1099
  value: fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.default
1029
1100
  };
1030
- }).filter(function (_ref11) {
1031
- var key = _ref11.key,
1032
- value = _ref11.value;
1101
+ }).filter(function (_ref12) {
1102
+ var key = _ref12.key,
1103
+ value = _ref12.value;
1033
1104
  return SIMPLE_FIELD_NAME.test(key) && value !== undefined && value !== null && !(typeof value === 'string' && value.includes('{{'));
1034
1105
  });
1035
1106
  };
@@ -1048,9 +1119,9 @@ var applyLazyDefaults = exports.applyLazyDefaults = function applyLazyDefaults(a
1048
1119
  // 已落库的行(带 id)保持库里的样子:补默认值会让受控字段凭空出现「变更」,
1049
1120
  // 已审批的数据保存时还会被要求填变更原因。只补新增行(按钮之外的途径推进来的行)。
1050
1121
  if (row.id != null || row._id != null) return;
1051
- defaults.forEach(function (_ref12) {
1052
- var key = _ref12.key,
1053
- value = _ref12.value;
1122
+ defaults.forEach(function (_ref13) {
1123
+ var key = _ref13.key,
1124
+ value = _ref13.value;
1054
1125
  if (row[key] == null) {
1055
1126
  form.setValuesIn(arrayField.path.concat(index).concat(key), _typeof(value) === 'object' ? JSON.parse(JSON.stringify(value)) : value);
1056
1127
  }
@@ -18,8 +18,8 @@ export declare function useLegacyItems(items?: TabsProps['items'], children?: Re
18
18
  className?: string | undefined;
19
19
  id?: string | undefined;
20
20
  disabled?: boolean | undefined;
21
- prefixCls?: string | undefined;
22
21
  icon?: React.ReactNode;
22
+ prefixCls?: string | undefined;
23
23
  active?: boolean | undefined;
24
24
  closable?: boolean | undefined;
25
25
  closeIcon?: React.ReactNode;
@@ -14,6 +14,11 @@ export interface DateCellEditorParams {
14
14
  disabledDate?: (current: Dayjs) => boolean;
15
15
  /** 是否允许清空;为 `true` 时清空并提交 `null`,默认 `false`。 */
16
16
  allowClear?: boolean;
17
+ /**
18
+ * 进入编辑时是否自动展开日期面板,默认 `true`:键盘到达即展开,保持原有行为。
19
+ * 只想聚焦输入、直接键入覆盖时传 `false`。
20
+ */
21
+ defaultOpen?: boolean;
17
22
  }
18
23
  /**
19
24
  * 日期单元格编辑器的完整属性:AG Grid 编辑器属性与 {@link DateCellEditorParams} 的合并。
@@ -78,13 +78,35 @@ var DateCellEditor = exports.DateCellEditor = function DateCellEditor(_ref) {
78
78
  format = _ref$format === void 0 ? DEFAULT_DATE_CELL_FORMAT : _ref$format,
79
79
  disabledDate = _ref.disabledDate,
80
80
  _ref$allowClear = _ref.allowClear,
81
- allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear;
81
+ allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
82
+ _ref$defaultOpen = _ref.defaultOpen,
83
+ defaultOpen = _ref$defaultOpen === void 0 ? true : _ref$defaultOpen;
84
+ var pickerRef = _react.default.useRef(null);
85
+ // 打开时全选:光标留在末尾的话,键入会追加成 `2026-11-012026-11-25`。
86
+ _react.default.useEffect(function () {
87
+ var _pickerRef$current, _pickerRef$current$qu;
88
+ var input = (_pickerRef$current = pickerRef.current) === null || _pickerRef$current === void 0 || (_pickerRef$current = _pickerRef$current.nativeElement) === null || _pickerRef$current === void 0 || (_pickerRef$current$qu = _pickerRef$current.querySelector) === null || _pickerRef$current$qu === void 0 ? void 0 : _pickerRef$current$qu.call(_pickerRef$current, 'input');
89
+ input === null || input === void 0 || input.select();
90
+ }, []);
82
91
  var current = parseDateCellValue(value, format);
83
92
  // 不同 antd 版本点击清空图标时 onChange 可能连续触发,提交只认第一次。
84
93
  var committed = _react.default.useRef(false);
94
+ /** 提交:写入值后下一拍 stopEditing,保证表格取到新值;只认第一次。 */
95
+ var commit = function commit(next) {
96
+ if (committed.current) return;
97
+ committed.current = true;
98
+ onValueChange(next);
99
+ setTimeout(function () {
100
+ return stopEditing();
101
+ }, 0);
102
+ };
85
103
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.DatePicker, {
86
- autoFocus: true,
87
- defaultOpen: true,
104
+ ref: pickerRef,
105
+ autoFocus: true
106
+ // 单元格编辑态已有一层框,选择器自己不再画第二层。
107
+ ,
108
+ variant: "borderless",
109
+ defaultOpen: defaultOpen,
88
110
  allowClear: allowClear,
89
111
  value: current,
90
112
  format: format,
@@ -97,22 +119,25 @@ var DateCellEditor = exports.DateCellEditor = function DateCellEditor(_ref) {
97
119
  return (_trigger$parentElemen = trigger.parentElement) !== null && _trigger$parentElemen !== void 0 ? _trigger$parentElemen : document.body;
98
120
  },
99
121
  onChange: function onChange(date) {
100
- if (committed.current) return;
101
- if (!date) {
102
- // antd 仅在点击清空图标时回调 null;未允许清空时忽略。
103
- if (!allowClear) return;
104
- onValueChange(null);
105
- } else {
106
- onValueChange(date.format(format));
107
- }
108
- committed.current = true;
109
- // 先让值写入编辑器,再提交,保证表格取到新日期。
110
- setTimeout(function () {
111
- return stopEditing();
112
- }, 0);
122
+ // antd 仅在点击清空图标时回调 null;未允许清空时忽略。
123
+ if (!date && !allowClear) return;
124
+ commit(date ? date.format(format) : null);
113
125
  },
114
126
  onKeyDown: function onKeyDown(event) {
115
- if (event.key === 'Escape') stopEditing(true);
127
+ var _value;
128
+ if (event.key === 'Escape') {
129
+ stopEditing(true);
130
+ return;
131
+ }
132
+ if (event.key !== 'Enter' && event.key !== 'Tab') return;
133
+ // 键入完整日期后 Enter/Tab 以键入值提交:antd 的 onChange 只在面板选中/失焦校验时触发,这里直接读输入框。
134
+ var text = (_value = event.target.value) === null || _value === void 0 ? void 0 : _value.trim();
135
+ if (!text) return;
136
+ var typed = (0, _dayjs.default)(text, format, true);
137
+ if (!typed.isValid() || disabledDate !== null && disabledDate !== void 0 && disabledDate(typed)) return;
138
+ // 与当前值相同时没有新键入,交给面板/表格原有流程。
139
+ if (current && current.format(format) === text) return;
140
+ commit(typed.format(format));
116
141
  }
117
142
  });
118
143
  };
@@ -23,9 +23,23 @@ export interface DeleteConfirmProps {
23
23
  * @author nokecy
24
24
  */
25
25
  danger?: boolean;
26
+ /**
27
+ * 三级「输入确认」(DESIGN.md §9.2):传入对象名称或数量,用户原样键入后确认按钮才可点。
28
+ * 用于影响面大且不可恢复的操作(清空草稿箱、删除主数据、批量作废超过 50 张)。不传则为二级确认。
29
+ */
30
+ confirmText?: string;
31
+ /**
32
+ * 确认框默认焦点,默认 `'cancel'`:Enter 不会直接触发危险操作(§9.2)。
33
+ * 传 `'ok'` 或 `null` 可恢复 antd 的旧行为。
34
+ */
35
+ autoFocusButton?: 'ok' | 'cancel' | null;
36
+ /** 确认框宽度,默认 560(弹层宽度三档之一,§9.0)。 */
37
+ width?: number | string;
26
38
  /** 子组件(触发按钮) */
27
39
  children: React.ReactNode;
28
40
  }
41
+ /** 确认框默认宽度,对应规范「确认、单字段编辑 Modal 560」。 */
42
+ export declare const CONFIRM_DIALOG_WIDTH = 560;
29
43
  /**
30
44
  * DeleteConfirm 删除确认组件
31
45
  *