soma-kit 0.1.13 → 0.1.15

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 (312) hide show
  1. package/package.json +3 -3
  2. package/packs/finance/reconcile-desk/compile.ts +1 -1
  3. package/packs/finance/reconcile-desk/shell.ts +1 -1
  4. package/spec/generated/kit-app.schema.json +18 -2
  5. package/spec/generated/kit-page.schema.json +95 -0
  6. package/spec/kit-grammar.json +332 -75
  7. package/spec/kit-grammar.schema.json +1 -27
  8. package/src/app/app-config.ts +11 -5
  9. package/src/app/component-gate.ts +2 -2
  10. package/src/app/compose-apps.ts +5 -2
  11. package/src/app/define-kit-actions.ts +82 -10
  12. package/src/app/define-kit-app.ts +6 -5
  13. package/src/app/define-kit-view.ts +1 -1
  14. package/src/app/index.ts +20 -8
  15. package/src/app/kit-view-context.ts +30 -4
  16. package/src/app/server-pages.ts +5 -1
  17. package/src/app/server.ts +15 -5
  18. package/src/app/theme-endpoint.ts +1 -1
  19. package/src/app/theme-runtime.ts +7 -2
  20. package/src/base/alert.ts +23 -20
  21. package/src/base/anchored-layer.ts +1 -1
  22. package/src/base/button.ts +34 -17
  23. package/src/base/cascader.ts +8 -4
  24. package/src/base/check-core.ts +9 -6
  25. package/src/base/color-picker.ts +10 -6
  26. package/src/base/command-palette.ts +10 -4
  27. package/src/base/context-menu.ts +5 -2
  28. package/src/base/date-range.ts +9 -6
  29. package/src/base/date.ts +10 -6
  30. package/src/base/delta.ts +4 -2
  31. package/src/base/divider.ts +15 -66
  32. package/src/base/end-edge.ts +14 -2
  33. package/src/base/fab.ts +11 -6
  34. package/src/base/gap-value.ts +25 -5
  35. package/src/base/hint-tips.ts +1 -1
  36. package/src/base/illustrations.ts +2 -1
  37. package/src/base/index.ts +20 -4
  38. package/src/base/inline-error.ts +84 -0
  39. package/src/base/input.ts +54 -18
  40. package/src/base/kbd.ts +4 -3
  41. package/src/base/link.ts +1 -1
  42. package/src/base/listbox-core.ts +70 -22
  43. package/src/base/mentions.ts +6 -3
  44. package/src/base/menu-button.ts +73 -50
  45. package/src/base/menu-core.ts +9 -2
  46. package/src/base/motion/hover-3d.ts +4 -1
  47. package/src/base/motion/hover-gallery.ts +4 -1
  48. package/src/base/otp.ts +7 -3
  49. package/src/base/overlay-runtime.ts +3 -2
  50. package/src/base/overlay-shell.ts +141 -0
  51. package/src/base/popover.ts +7 -6
  52. package/src/base/popup.ts +47 -41
  53. package/src/base/qty-stepper.ts +14 -9
  54. package/src/base/reason-tip.ts +2 -2
  55. package/src/{frames → base}/resize-handle.ts +1 -1
  56. package/src/base/segmented.ts +44 -35
  57. package/src/base/select.ts +1 -0
  58. package/src/base/shared.ts +52 -18
  59. package/src/base/state-panel.ts +34 -13
  60. package/src/base/status-tone.ts +1 -1
  61. package/src/base/tag-input.ts +13 -8
  62. package/src/base/tag.ts +56 -57
  63. package/src/base/text.ts +38 -14
  64. package/src/base/textarea.ts +1 -1
  65. package/src/base/time-picker.ts +9 -5
  66. package/src/base/tree-select.ts +12 -9
  67. package/src/base/upload.ts +26 -17
  68. package/src/biz/approval-desk/compile.ts +28 -1
  69. package/src/biz/approval-desk/shell.ts +10 -9
  70. package/src/biz/auth-panel/compile.ts +1 -1
  71. package/src/biz/auth-panel/shell.ts +7 -6
  72. package/src/biz/category-crud/compile.ts +20 -6
  73. package/src/biz/category-crud/shell.ts +10 -7
  74. package/src/biz/checkout-page/compile.ts +1 -1
  75. package/src/biz/checkout-page/shell.ts +15 -13
  76. package/src/biz/compose.ts +5 -5
  77. package/src/biz/data-components.ts +4 -0
  78. package/src/biz/define.ts +1 -1
  79. package/src/biz/import-wizard/compile.ts +1 -1
  80. package/src/biz/import-wizard/shell.ts +17 -13
  81. package/src/biz/index.ts +4 -3
  82. package/src/biz/landing-page/compile.ts +1 -1
  83. package/src/biz/landing-page/shell.ts +6 -5
  84. package/src/biz/link/shared.ts +8 -1
  85. package/src/biz/master-sub/compile.ts +269 -27
  86. package/src/biz/master-sub/detail-head.ts +62 -0
  87. package/src/biz/master-sub/index.ts +5 -4
  88. package/src/biz/master-sub/shell.ts +138 -69
  89. package/src/biz/multi-board/compile.ts +166 -11
  90. package/src/biz/multi-board/composition.ts +58 -0
  91. package/src/biz/multi-board/index.ts +25 -10
  92. package/src/biz/multi-board/prose-fold.ts +143 -0
  93. package/src/biz/multi-board/shell.ts +96 -24
  94. package/src/biz/names.ts +1 -0
  95. package/src/biz/notification-center/compile.ts +9 -2
  96. package/src/biz/notification-center/shell.ts +15 -7
  97. package/src/biz/page-templates/domain-templates.ts +7 -3
  98. package/src/biz/page-templates/result-page/compile.ts +1 -1
  99. package/src/biz/page-templates/result-page/shell.ts +5 -4
  100. package/src/biz/page-templates/shared.ts +1 -1
  101. package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
  102. package/src/biz/page-templates/sign-in-page/shell.ts +18 -18
  103. package/src/biz/record-detail/compile.ts +5 -2
  104. package/src/biz/record-detail/shell.ts +12 -11
  105. package/src/biz/settings-center/compile.ts +1 -1
  106. package/src/biz/settings-center/shell.ts +14 -10
  107. package/src/biz/shared/action-host.ts +12 -5
  108. package/src/biz/shared/compile-helpers.ts +83 -4
  109. package/src/biz/shared/coordinator.ts +104 -21
  110. package/src/biz/shared/overlay-compile.ts +76 -4
  111. package/src/biz/shared/overlay-shell.ts +65 -112
  112. package/src/biz/single-form/compile.ts +2 -2
  113. package/src/biz/single-form/shell.ts +13 -7
  114. package/src/biz/standard-crud/compile.ts +24 -4
  115. package/src/biz/standard-crud/shell.ts +38 -30
  116. package/src/biz/standard-crud/summary.ts +42 -0
  117. package/src/biz/step-form/compile.ts +1 -1
  118. package/src/biz/step-form/hub.ts +4 -0
  119. package/src/biz/step-form/shell.ts +16 -12
  120. package/src/biz/types.ts +15 -3
  121. package/src/cli/app-layer-check.ts +375 -0
  122. package/src/cli/kit-cli.ts +35 -8
  123. package/src/cli/kit-init.ts +149 -0
  124. package/src/cli/layout-cli.ts +7 -7
  125. package/src/compile/access-gate-attach.ts +27 -0
  126. package/src/compile/action-host-attach.ts +1 -1
  127. package/src/compile/compile-page.ts +36 -230
  128. package/src/compile/component-candidates.ts +4 -1
  129. package/src/compile/hints.ts +5 -58
  130. package/src/compile/index.ts +2 -2
  131. package/src/compile/layout-lint/index.ts +4 -1
  132. package/src/compile/layout-lint/rules-composition.ts +97 -18
  133. package/src/compile/layout-lint/rules-form.ts +6 -7
  134. package/src/compile/layout-lint/rules-table.ts +98 -14
  135. package/src/compile/page-composition.ts +191 -0
  136. package/src/compile/parse.ts +4 -0
  137. package/src/compile/producer-fingerprint.ts +56 -0
  138. package/src/compile/redirect.ts +1 -1
  139. package/src/compile/stages.ts +169 -0
  140. package/src/compile/styles.ts +80 -32
  141. package/src/compile/types.ts +5 -3
  142. package/src/data/access-gate.ts +112 -0
  143. package/src/data/amount-breakdown.ts +6 -2
  144. package/src/data/anchor-nav.ts +4 -1
  145. package/src/data/approval-flow.ts +13 -5
  146. package/src/data/assignment-picker.ts +35 -20
  147. package/src/data/async-result-panel.ts +7 -3
  148. package/src/data/breadcrumbs.ts +13 -9
  149. package/src/data/calendar.ts +10 -4
  150. package/src/data/carousel.ts +13 -5
  151. package/src/data/chart.ts +745 -48
  152. package/src/data/checklist.ts +9 -5
  153. package/src/data/code-view.ts +220 -26
  154. package/src/data/comment-thread.ts +9 -3
  155. package/src/data/confirm-dialog.ts +57 -20
  156. package/src/data/diff.ts +4 -1
  157. package/src/data/dock.ts +5 -1
  158. package/src/data/embed.ts +1 -1
  159. package/src/data/engine-ports.ts +126 -0
  160. package/src/data/field-mapper.ts +16 -7
  161. package/src/data/flow-editor.ts +106 -29
  162. package/src/data/footer.ts +8 -2
  163. package/src/data/gantt.ts +192 -27
  164. package/src/data/hero.ts +8 -2
  165. package/src/data/image-viewer.ts +7 -3
  166. package/src/data/index.ts +22 -8
  167. package/src/data/item-list.ts +11 -3
  168. package/src/data/json-view.ts +844 -0
  169. package/src/data/kanban.ts +13 -8
  170. package/src/data/markdown-view.ts +487 -0
  171. package/src/data/matrix.ts +400 -0
  172. package/src/data/media-grid.ts +5 -2
  173. package/src/data/mega-menu.ts +4 -3
  174. package/src/data/menu-dom.ts +9 -8
  175. package/src/data/menu.ts +35 -17
  176. package/src/data/mockup.ts +12 -8
  177. package/src/data/modal-dialog.ts +108 -57
  178. package/src/data/navbar.ts +13 -7
  179. package/src/data/notice-list.ts +53 -20
  180. package/src/data/notify-renderer.ts +21 -10
  181. package/src/data/object-form.ts +248 -151
  182. package/src/data/pager.ts +15 -10
  183. package/src/data/panel-head.ts +406 -0
  184. package/src/data/permission-matrix.ts +19 -9
  185. package/src/data/permission-tree.ts +30 -13
  186. package/src/data/pricing-table.ts +10 -4
  187. package/src/data/reaction-bar.ts +6 -3
  188. package/src/data/record-card.ts +30 -14
  189. package/src/data/record-picker.ts +8 -4
  190. package/src/data/redirect.ts +1 -1
  191. package/src/data/request-console.ts +20 -7
  192. package/src/data/resident.ts +6 -10
  193. package/src/data/result-panel.ts +2 -2
  194. package/src/data/rich-text.ts +58 -96
  195. package/src/data/row-editor.ts +12 -7
  196. package/src/data/rule-builder.ts +22 -11
  197. package/src/data/shape-util.ts +26 -14
  198. package/src/data/stat-group.ts +369 -84
  199. package/src/data/static-lazy.ts +7 -0
  200. package/src/data/static-registry.ts +14 -2
  201. package/src/data/steps.ts +6 -2
  202. package/src/data/survey.ts +13 -4
  203. package/src/data/system-switcher.ts +17 -7
  204. package/src/data/text-diff.ts +663 -0
  205. package/src/data/timeline.ts +1 -1
  206. package/src/data/tour-guide.ts +8 -4
  207. package/src/data/transfer.ts +24 -11
  208. package/src/data/tree-table.ts +84 -17
  209. package/src/data/tree.ts +6 -3
  210. package/src/data/virtual-rows.ts +22 -11
  211. package/src/data/wrap.ts +2 -2
  212. package/src/data/wrapped-candidates.ts +22 -1
  213. package/src/frames/index.ts +4 -2
  214. package/src/frames/inherited-shell.ts +178 -0
  215. package/src/frames/list-summary.ts +123 -0
  216. package/src/frames/page-bar.ts +10 -16
  217. package/src/frames/resident-components.ts +20 -0
  218. package/src/frames/shared.ts +37 -17
  219. package/src/frames/split-frame/shell.ts +17 -11
  220. package/src/frames/split-frame/wiring.ts +2 -2
  221. package/src/frames/tabs-frame/shell.ts +17 -9
  222. package/src/frames/top-main-frame.ts +1 -1
  223. package/src/frames/types.ts +6 -3
  224. package/src/frames/workspace-frame/extras.ts +19 -5
  225. package/src/frames/workspace-frame/shell.ts +4 -3
  226. package/src/frames/workspace-frame/state.ts +8 -2
  227. package/src/frames/workspace-frame/tab-scroll.ts +28 -0
  228. package/src/frames/workspace-frame/view.ts +156 -91
  229. package/src/generated/kit-grammar-runtime.ts +227 -58
  230. package/src/i18n/kit-text.ts +141 -2
  231. package/src/i18n/resolve-text-refs.ts +1 -1
  232. package/src/object-renderer/action-group.ts +169 -0
  233. package/src/object-renderer/action-more.ts +160 -0
  234. package/src/object-renderer/arrange.ts +86 -26
  235. package/src/object-renderer/candidates.ts +4 -0
  236. package/src/object-renderer/collection-parts.ts +72 -20
  237. package/src/object-renderer/collection-table.ts +178 -65
  238. package/src/object-renderer/collection.ts +129 -83
  239. package/src/object-renderer/compile-data.ts +1 -1
  240. package/src/object-renderer/defaults.ts +10 -5
  241. package/src/object-renderer/emit-events.ts +1 -1
  242. package/src/object-renderer/emit-object.ts +7 -0
  243. package/src/object-renderer/emit-static.ts +243 -87
  244. package/src/object-renderer/field-value.ts +12 -239
  245. package/src/object-renderer/filter-plan.ts +84 -0
  246. package/src/object-renderer/filter-toolbar.ts +103 -0
  247. package/src/{compile → object-renderer}/fragment.ts +13 -2
  248. package/src/object-renderer/index.ts +6 -1
  249. package/src/object-renderer/layout-facts.ts +46 -6
  250. package/src/object-renderer/layout-plan.ts +136 -43
  251. package/src/object-renderer/layout-plan.types.ts +42 -5
  252. package/src/object-renderer/overlay-decide.ts +82 -0
  253. package/src/object-renderer/parts.ts +7 -259
  254. package/src/object-renderer/render-object.ts +60 -47
  255. package/src/object-renderer/table-actions.ts +135 -56
  256. package/src/object-renderer/table-gap.ts +37 -0
  257. package/src/object-renderer/table-tools.ts +63 -25
  258. package/src/object-renderer/types.ts +16 -22
  259. package/src/recipes/app-blocks.ts +66 -0
  260. package/src/recipes/code-view.ts +56 -0
  261. package/src/recipes/compact-group.ts +31 -0
  262. package/src/recipes/container.ts +54 -13
  263. package/src/recipes/control.ts +77 -157
  264. package/src/recipes/desc-list.ts +14 -0
  265. package/src/recipes/divider.ts +53 -0
  266. package/src/recipes/emphasis.ts +60 -0
  267. package/src/recipes/frame-bleed.ts +33 -0
  268. package/src/recipes/index.ts +34 -1
  269. package/src/recipes/inherited-shell.ts +37 -0
  270. package/src/recipes/json-view.ts +49 -0
  271. package/src/recipes/markdown.ts +86 -0
  272. package/src/recipes/overlay.ts +149 -18
  273. package/src/recipes/page-width.ts +20 -0
  274. package/src/recipes/placeholder.ts +21 -5
  275. package/src/recipes/rail-grid.ts +3 -0
  276. package/src/recipes/stat-state.ts +65 -0
  277. package/src/recipes/state.ts +20 -28
  278. package/src/recipes/status.ts +17 -8
  279. package/src/recipes/strip.ts +72 -0
  280. package/src/recipes/surface-edge.ts +16 -0
  281. package/src/recipes/surface.ts +10 -6
  282. package/src/recipes/table-gap.ts +80 -0
  283. package/src/recipes/table-native-edit.ts +242 -0
  284. package/src/recipes/table-row.ts +120 -11
  285. package/src/recipes/tabs.ts +126 -0
  286. package/src/recipes/text-diff.ts +90 -0
  287. package/src/recipes/title-row.ts +7 -5
  288. package/src/recipes/typography.ts +24 -43
  289. package/src/shared/diagnostics.ts +16 -0
  290. package/src/shared/envelope.ts +1 -1
  291. package/src/shared/field-value-format.ts +246 -0
  292. package/src/shared/focus-ring.ts +8 -0
  293. package/src/shared/hints.ts +56 -0
  294. package/src/{base → shared}/icons.ts +12 -0
  295. package/src/shared/kit-error.ts +1 -1
  296. package/src/{object-renderer → shared}/merge-class.ts +3 -2
  297. package/src/shared/path-guard.ts +1 -1
  298. package/src/shared/primitives-types.ts +8 -0
  299. package/src/shared/theme-runtime-shared.ts +19 -0
  300. package/src/theme/kit-theme-text.ts +1 -1
  301. package/src/theme/kit-theme.css +49 -14
  302. package/src/theme/kit-theme.tpl +49 -14
  303. package/src/theme/nine-dim-structure.ts +129 -37
  304. package/src/theme/surface-layers.ts +17 -4
  305. package/src/theme/theme-tokens.ts +16 -5
  306. package/src/theme/typography.ts +21 -17
  307. package/src/app/envelope.ts +0 -1
  308. package/src/app/notify-renderer.ts +0 -1
  309. package/src/app/paged-list-adapter.ts +0 -1
  310. package/src/app/theme-runtime-shared.ts +0 -1
  311. package/src/compile/kit-error.ts +0 -1
  312. /package/src/{base → shared}/class-candidates.ts +0 -0
@@ -1,3 +1,5 @@
1
+ import { kitRowActionsNarrowCap } from 'soma-foundation/kit-layout';
2
+ import { KIT_EMPHASIS } from 'soma-foundation/kit-limits';
1
3
  import { esc } from '../shared/escape';
2
4
  import { getCompileEnvelope } from '../shared/envelope';
3
5
  // emitStatic:IR -> 静态 HTML + `_ui.yaml` 的 `show:` 片段(设计稿 §1.2 做法 B、§6)。
@@ -20,10 +22,14 @@ import type {
20
22
  import { KIT_CLASS_DEFAULTS, KIT_GRAMMAR, KIT_GROUP_MARKERS, KIT_REQUIRED_STAR_CLASS, KIT_WIDTH } from './defaults';
21
23
  import type { KitSkeletonCol, KitSkeletonConfig } from './skeleton';
22
24
  import { isNumericColumnType } from './collection-table';
23
- import { mergeClass } from './merge-class';
24
- import { KIT_FILTER_INLINE_CLASS } from './parts';
25
+ import { mergeClass } from '../shared/merge-class';
26
+ import { projectActionGroup, projectTabOverflow, type KitActionImportance } from './action-group';
27
+ import { KIT_TAB_TEXT_ATTR, kitTabRecipe } from '../recipes/tabs';
28
+ import { KIT_TABLE_GAP_HEAD_ATTR, tableGapReasonField } from '../recipes/table-gap';
25
29
  import { kitTextActionRecipe } from '../recipes/control';
30
+ import { kitStatusPillProps } from '../recipes/emphasis';
26
31
  import { KIT_OVERLAY_FORM_HOST_CLASS } from '../recipes/overlay';
32
+ import { KIT_STRIP_HEAD_MIN_CLASS } from '../recipes/strip';
27
33
  import { KIT_PANEL_TITLE_CLASS, kitPanelTitleHtml } from '../recipes/title-row';
28
34
  import { headAnchor } from './compile-data';
29
35
  import { KIT_STATE_DEFAULT_TEXT } from './collection';
@@ -35,6 +41,7 @@ import type { KitObjectFormClasses, KitObjectFormProps } from '../data/object-fo
35
41
  import { KIT_PART_CARD, KIT_PART_SECTION, KIT_PART_TITLE_SECTION, kitContainerPartOf, type KitFormDetail } from './form-detail';
36
42
  import { KIT_PART_TABLE, KIT_PART_TABLE_CELL, KIT_PART_TABLE_HEAD, KIT_PART_TABLE_ROW } from './collection-table';
37
43
  import { readStatePathsOf } from './crud-bridge';
44
+ import { KIT_FILTER_TOOLBAR_ACTIONS, KIT_FILTER_TOOLBAR_MARK, KIT_FILTER_TOOLBAR_WRAP, filterToolbarCells } from './filter-toolbar';
38
45
  import { primaryKeyFieldOf } from './key-field';
39
46
 
40
47
  /** 行变量按对象取(`kit_row_<对象>`):core 的 varMap 按变量名建,同页两个列表共用一个名字会撞 */
@@ -43,7 +50,14 @@ export function rowVarOf(object: string): string { return `kit_row_${object}`; }
43
50
  // ---------------------------------------------------------------- 锚点命名
44
51
 
45
52
  export function viewAnchor(object: string, slot: KitViewSlot): string { return `${object}__${slot}`; }
46
- export function cellAnchor(object: string, slot: KitViewSlot, field: string): string { return `${object}__${slot}__${field}`; }
53
+ /**
54
+ * 同槽(`<对象>__list__`)里集合自己的实例后缀:字段名撞上它们会让页面锚点重复(CORE-ANCHOR-DUPLICATE,整页 500)。
55
+ * `state` / `title` / `meta` 都是常见的业务字段名,所以字段单元锚点遇到这些后缀时追加 `_cell`,字段名不受限。
56
+ */
57
+ export const KIT_RESERVED_LIST_ANCHORS: ReadonlySet<string> = new Set(['ctx', 'exp', 'head', 'meta', 'ops', 'rows', 'sel', 'state', 'sum', 'title', 'tools', 'tree', 'virtual']);
58
+ export function cellAnchor(object: string, slot: KitViewSlot, field: string): string {
59
+ return `${object}__${slot}__${slot === 'list' && KIT_RESERVED_LIST_ANCHORS.has(field) ? `${field}_cell` : field}`;
60
+ }
47
61
  export function rowsAnchor(object: string): string { return `${object}__list__rows`; }
48
62
  export function opsAnchor(object: string): string { return `${object}__list__ops`; }
49
63
  /** 右键菜单实例(Q 波 G6):行模板里每行一个,虚拟滚动表 / 树表是页面里一个 */
@@ -97,12 +111,21 @@ export interface KitStaticOptions {
97
111
  schema?: KitSchema;
98
112
  /** 是否有列表视图(决定 from 是否带 into);缺省由 IR 判断 */
99
113
  wrapped?: boolean;
114
+ /**
115
+ * 没有列表视图(from 不带 into,数据对象存的是原样响应)时,`accept: list` 的写死形状件(Chart 等)的行数组在响应体里的相对路径
116
+ * (来自 behavior.list.rowsPath);缺省时行数组就是数据对象本身
117
+ */
118
+ staticRowsPath?: string;
100
119
  /** 摘要 / 只读 form / single 写死形状件读的“当前行”路径(如 `page.region_mirror.<scope>.focus_row`);缺省同 singlePath */
101
120
  summaryPath?: string;
102
121
  /** 可编辑 form 的 mode 绑定路径(镜像路径);给了就不写死 formMode 字面量 */
103
122
  formModePath?: string;
104
123
  /** 可编辑 form 的 initial 绑定路径(镜像路径);缺省 `{}` */
105
124
  formInitialPath?: string;
125
+ /** 分页条的附加类(业务壳给:列表页贴工作面底 sticky + 轴内边距) */
126
+ pagerClass?: string;
127
+ /** 列表默认紧凑档(见 emit-object):原生表格外壳标 data-kit-dense */
128
+ defaultDense?: boolean;
106
129
  /** 表格行可点选:行容器标 data-kit-row,KitTableActions 开 pickOnRow,行点击抛 row_action(builtin select) */
107
130
  pickOnRow?: boolean;
108
131
  /**
@@ -141,7 +164,7 @@ function attr(name: string, value: string): string {
141
164
  }
142
165
 
143
166
  const OVERLAY_FOOTER_HOSTS: ReadonlySet<string> = new Set(['KitObjectForm', 'Transfer', 'PermissionTree', 'AssignmentPicker']);
144
- const COLLAPSING_HOSTS: ReadonlySet<string> = new Set(['KitTableTools', 'KitCollectionState', 'Pager']);
167
+ const COLLAPSING_HOSTS: ReadonlySet<string> = new Set(['KitTableTools', 'KitTableGap', 'KitCollectionState', 'Pager']);
145
168
 
146
169
  function host(component: string, id: string): string {
147
170
  // 自带底栏的表单 / 穿梭框 / 授权树,其宿主在浮层滚动体里是体的 flex 子项并撑满体高(底栏才能落在浮层底部);变体只在 group-data-kit-overlay-scroll 祖先下生效
@@ -251,6 +274,12 @@ function cellProps(ctx: Ctx, cell: KitCell, valuePath: string, _at: string): Rec
251
274
  props.aria_label = cell.label;
252
275
  }
253
276
  if (cell.valueClass !== '') props.class = cell.valueClass;
277
+ // 状态类字段(单选枚举且选项带 tone)默认呈现为状态(emphasis.status = dot:圆点 + 语义色文字,没有容器;常态用中性灰),全应用统一,与紧凑列表、表格一致
278
+ if (cell.component === 'Tag' && (props.variant === undefined || props.variant === 'dot')) {
279
+ const field = ctx.options.schema?.[cell.field] as { type?: string; options?: unknown } | undefined;
280
+ const opts = Array.isArray(field?.options) ? (field!.options as unknown[]) : [];
281
+ if (field?.type === 'enum' && opts.some((o) => o !== null && typeof o === 'object' && 'tone' in (o as Record<string, unknown>))) Object.assign(props, kitStatusPillProps());
282
+ }
254
283
  return props;
255
284
  }
256
285
 
@@ -332,8 +361,11 @@ function renderArrangement(ctx: Ctx, slot: KitViewSlot, layout: KitLayoutIR, val
332
361
  }
333
362
  const grpPart = g.surface !== undefined ? kitContainerPartOf(g.surface) : KIT_PART_SECTION;
334
363
  const grpAttrs = `${g.surface !== undefined ? ` data-kit-surface="${esc(g.surface)}"` : ''}${g.emphasis !== undefined ? ` data-kit-emphasis="${esc(g.emphasis)}"` : ''} data-kit-part="${esc(grpPart)}"`;
364
+ // summary 分组 section 吃容器边框/圆角规则,在抽屉等非 flat 容器内需有卡片内边距,避免文字紧贴圆角边框
365
+ const sectionCls = slot === 'summary' ? joinClasses(layout.sectionClass, 'p-card') : layout.sectionClass;
335
366
  if (!g.collapsible) {
336
- return `${divider}<section${grpAttrs}${attr('class', layout.sectionClass)}><h4${attr('class', layout.titleClass)} data-kit-part="${KIT_PART_TITLE_SECTION}">${esc(g.title)}</h4>${inner}</section>`;
367
+ // 外观声明(D-08):分组 section 声明 card(与删标签名规则前渲染一致)
368
+ return `${divider}<section data-kit-container="card"${grpAttrs}${attr('class', sectionCls)}><h4${attr('class', layout.titleClass)} data-kit-part="${KIT_PART_TITLE_SECTION}">${esc(g.title)}</h4>${inner}</section>`;
337
369
  }
338
370
  // 可折叠:标题是 h4 里的 button(aria-expanded + aria-controls),折叠体是块级 div(hidden 不和 flex / grid 同元素),初态按 open 写好
339
371
  const btn = `<button type="button" id="${esc(g.id)}__btn"${attr('class', KIT_CLASS_DEFAULTS.groupToggle)} data-kit-collapse-toggle="" aria-expanded="${g.open ? 'true' : 'false'}" aria-controls="${esc(g.id)}">`
@@ -341,7 +373,7 @@ function renderArrangement(ctx: Ctx, slot: KitViewSlot, layout: KitLayoutIR, val
341
373
  + `<span${attr('class', KIT_CLASS_DEFAULTS.groupMark)} aria-hidden="true" data-kit-collapse-mark="" data-kit-mark-open="${markers[1]}" data-kit-mark-closed="${markers[0]}">${g.open ? markers[1] : markers[0]}</span>`
342
374
  + '</button>';
343
375
  const body = `<div id="${esc(g.id)}" role="region" aria-labelledby="${esc(g.id)}__btn"${attr('class', g.open ? '' : 'hidden')}>${inner}</div>`;
344
- return `${divider}<section${grpAttrs}${attr('class', layout.sectionClass)}><h4${attr('class', layout.titleClass)} data-kit-part="${KIT_PART_TITLE_SECTION}">${btn}</h4>${body}</section>`;
376
+ return `${divider}<section data-kit-container="card"${grpAttrs}${attr('class', sectionCls)}><h4${attr('class', layout.titleClass)} data-kit-part="${KIT_PART_TITLE_SECTION}">${btn}</h4>${body}</section>`;
345
377
  }).join('');
346
378
  const wrap = `<div${attr('class', layout.wrapClass)}${layout.collapsible ? ' data-kit-collapse-root=""' : ''}>${sections}</div>`;
347
379
  if (!layout.collapsible) return wrap;
@@ -364,7 +396,8 @@ export function groupTabAnchor(object: string, slot: KitViewSlot, index: number
364
396
  export function groupPanelAnchor(object: string, slot: KitViewSlot, index: number | string): string { return `${object}__${slot}__gpanel__${index}`; }
365
397
  export function groupTabWireAnchor(object: string, slot: KitViewSlot): string { return `${object}__${slot}__gwire`; }
366
398
 
367
- const GROUPS_AS = KIT_GRAMMAR.formLinkage.groupsAs as { barClass: string; tabClass: string };
399
+ // 分组页签的类:页签呈现唯一出口 recipes/tabs(与页内页签 / 外壳页签条同一套)
400
+ const GROUPS_AS = { barClass: `mb-4 ${kitTabRecipe().bar}` };
368
401
 
369
402
  /**
370
403
  * groups 呈现为页签:tablist + 若干 tab 按钮 + 各组面板(首签显示,其余外层 hidden)。
@@ -408,8 +441,15 @@ export function groupTabsFrame(
408
441
  showInto: Record<string, unknown>,
409
442
  components: Set<string>,
410
443
  ): string {
411
- const buttons = titles.map((title, i) => `<button type="button" data-soma-id="${esc(groupTabAnchor(object, slot, i))}" data-key="${i}" data-kit-face="tab" role="tab" aria-selected="${i === 0 ? 'true' : 'false'}"${attr('class', GROUPS_AS.tabClass)}>${esc(title)}</button>`).join('');
412
- const panelEls = panels.map((inner, i) => `<div data-soma-id="${esc(groupPanelAnchor(object, slot, i))}"${i === 0 ? '' : ' hidden'}>${inner}</div>`).join('');
444
+ // data-kit-tab-text:结构 CSS 按选中字重预留宽度,切换选中不位移(KT-K-tabs-2)
445
+ // KT-K-tabs-3(§6.1 G-16):放不下的尾部页签编译期估宽、按容器档隐藏并收进「更多」,选中页签恒可见
446
+ const overflow = projectTabOverflow(titles, kitTabRecipe().tab);
447
+ const buttons = titles.map((title, i) => `<button type="button" data-soma-id="${esc(groupTabAnchor(object, slot, i))}" data-key="${i}" role="tab" aria-selected="${i === 0 ? 'true' : 'false'}" ${KIT_TAB_TEXT_ATTR}="${esc(title)}"${attr('class', overflow.tabClasses[i])}>${esc(title)}</button>`).join('');
448
+ const moreShell = overflow.hasMore
449
+ ? `<div${attr('class', `${overflow.moreClass} -mb-px`)}><div data-soma-component="KitActionMore" data-soma-id="${esc(`${object}__${slot}__gmore`)}"></div></div>`
450
+ : '';
451
+ if (overflow.hasMore) components.add('KitActionMore');
452
+ const panelEls = panels.map((inner, i) => `<div data-soma-id="${esc(groupPanelAnchor(object, slot, i))}" data-kit-tab-panel=""${i === 0 ? '' : ' hidden'}>${inner}</div>`).join('');
413
453
  const wireId = groupTabWireAnchor(object, slot);
414
454
  components.add('KitTabsWiring');
415
455
  showInto[wireId] = {
@@ -420,7 +460,7 @@ export function groupTabsFrame(
420
460
  ids: titles.map((_t, i) => String(i)),
421
461
  },
422
462
  };
423
- const bar = `<div data-soma-id="${esc(groupTabBarAnchor(object, slot))}" role="tablist"${attr('class', GROUPS_AS.barClass)}>${buttons}</div>`;
463
+ const bar = `<div data-soma-id="${esc(groupTabBarAnchor(object, slot))}" role="tablist"${attr('class', GROUPS_AS.barClass)}>${buttons}${moreShell}</div>`;
424
464
  const wiring = `<div data-soma-component="KitTabsWiring" data-soma-id="${esc(wireId)}" hidden></div>`;
425
465
  return `<div data-kit-tabs-frame=""${attr('class', wrapClass)}>${bar}${wiring}${panelEls}</div>`;
426
466
  }
@@ -453,6 +493,15 @@ function literalReason(a: KitAction): { disabledReason?: string } {
453
493
  * { 动作id: { hidden?, disabled? } },叶子是 core 行路径(行变量.<字段>),由 core 在行模板里逐行求值。
454
494
  * 返回要并进 prop 的 { actionState };没有绑定返回空对象。非法写法已在 emitStatic 入口记过诊断,这里只收合法的。
455
495
  */
496
+ /**
497
+ * 主从页详情头动作区(KitTableActions look: button)的 props:与行内操作同一套动作项与行级状态绑定(disabled / hidden / disabledReason),
498
+ * 只是「行」换成选中行镜像(rowPath = 链接作用域上的 link_sel_row 路径):`row.<字段>` 编成 `<rowPath>.<字段>`,点击抛的 row 载荷也取它,与行内点击发出的同形。
499
+ */
500
+ export function headActionProps(actions: readonly KitAction[], rowPath: string): Record<string, unknown> {
501
+ const stub = { rowVar: rowPath } as Ctx;
502
+ return { actions: actionItems(actions, stub), ...actionStateProp(actions, stub), row: rowPath };
503
+ }
504
+
456
505
  function actionStateProp(actions: readonly KitAction[], ctx: Ctx): { actionState?: Record<string, Record<string, string>> } {
457
506
  const state: Record<string, Record<string, string>> = {};
458
507
  for (const a of actions) {
@@ -493,14 +542,32 @@ function rejectRowState(actions: readonly KitAction[], ctx: Ctx, where: string):
493
542
  }
494
543
  }
495
544
 
545
+ /**
546
+ * 表格的缺失值列:schema 里同时声明了 `<字段>` 与 `<字段>_reason`(缺失原因字段,后缀读真源)的只读文字类列,
547
+ * 单元格改用 GapValue 的 plain 形态(缺失 = 次级色短横 + 悬停原因;有值 = 与 Text 同一套格式化)。
548
+ * 带选项(徽标)的列不动。返回 字段名 -> 改写后的格。
549
+ */
550
+ function gapColumnsOf(ctx: Ctx, cells: readonly KitCell[]): Map<string, KitCell> {
551
+ const out = new Map<string, KitCell>();
552
+ const schema = ctx.options.schema;
553
+ for (const c of cells) {
554
+ if (c.component !== 'Text' || c.mode !== 'show' || c.placeholder === true || c.props.options !== undefined) continue;
555
+ const reasonField = tableGapReasonField(c.field);
556
+ if (schema === undefined || schema[reasonField] === undefined || c.rowProps?.reason !== undefined) continue;
557
+ out.set(c.field, { ...c, component: 'GapValue', props: { ...c.props, plain: true }, rowProps: { ...(c.rowProps ?? {}), reason: reasonField } });
558
+ }
559
+ return out;
560
+ }
561
+
496
562
  function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>): string {
497
563
  const object = ctx.object;
498
564
  const at = 'views.list.layout';
499
565
  const rowShow: Record<string, unknown> = {};
566
+ const gapCols = layout.tree === null && layout.virtual === undefined ? gapColumnsOf(ctx, layout.cells) : new Map<string, KitCell>();
500
567
 
501
568
  const tools = layout.tools === true && layout.tree === null;
502
569
  const selHead = layout.selectHeadClass ?? layout.selectClass;
503
- const actHead = layout.actionsHeadClass ?? layout.actionsClass;
570
+ const actHead = joinClasses(layout.actionsHeadClass ?? layout.actionsClass, 'whitespace-nowrap text-end justify-end');
504
571
  // 表格语义(W3C table 模式:table > row > columnheader / cell,aria-sort 在 columnheader 上):
505
572
  // 树表(外壳由 KitTreeTable 自带 treegrid,表头在它之外)与展开详情行(行下挂非 row 的开关与详情体)不满足 table 的结构要求,这两种不写表格角色
506
573
  const semTable = layout.tree === null && layout.expand === null;
@@ -520,6 +587,7 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
520
587
  ...(h.group !== undefined ? { group: h.group } : {}),
521
588
  ...(tools && h.resizable === true ? { resizable: true } : {}),
522
589
  ...(h.help !== undefined ? { help: h.help } : {}),
590
+ ...(h.col !== undefined && gapCols.has(h.col) ? { gapField: h.col } : {}),
523
591
  });
524
592
  }
525
593
  if (layout.rowActions.length > 0) cells.push({ label: opsHeadLabel(ctx), class: actHead });
@@ -527,6 +595,7 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
527
595
  ctx.show[headAnchor(object)] = {
528
596
  props: {
529
597
  cells, scope: ctx.scope(), class: layout.headClass, ...(semTable ? { semantics: 'table' } : {}),
598
+ ...(gapCols.size > 0 ? { rows: ctx.rowsPath } : {}),
530
599
  // 读状态:点表头排序后重取失败,表头据此把 sort / order / page 回滚到最近一次读成功的值
531
600
  readState: `${readStatePathsOf(ctx.object, ctx.basePath).dataPath}.readState`,
532
601
  ...(layout.headGroups !== undefined ? { groups: layout.headGroups } : {}),
@@ -551,7 +620,7 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
551
620
  };
552
621
  for (const h of layout.head) {
553
622
  if (h.group !== openGroup) flushGroup();
554
- const leaf = `<div${headRole}${tools && h.col !== undefined ? ` data-kit-col="${esc(h.col)}"` : ''}${tools && h.resizable === true ? ' data-kit-resizable=""' : ''}${attr('class', h.class)}>${esc(h.label)}${kitHelpButtonHtml(h.help ?? '', h.label, ctx.options.locale ?? '')}</div>`;
623
+ const leaf = `<div${headRole}${tools && h.col !== undefined ? ` data-kit-col="${esc(h.col)}"` : ''}${h.col !== undefined && gapCols.has(h.col) ? ` ${KIT_TABLE_GAP_HEAD_ATTR}="${esc(h.col)}"` : ''}${tools && h.resizable === true ? ' data-kit-resizable=""' : ''}${attr('class', h.class)}>${esc(h.label)}${kitHelpButtonHtml(h.help ?? '', h.label, ctx.options.locale ?? '')}</div>`;
555
624
  if (h.group === undefined) headParts.push(leaf);
556
625
  else {
557
626
  openGroup = h.group;
@@ -617,20 +686,20 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
617
686
  ...removeBusyProps(ctx),
618
687
  },
619
688
  };
620
- rowParts.push(`<div${cellRoleAttr(cellRole)}${attr('class', layout.selectClass)}>${host('KitTableActions', selAnchor(object))}</div>`);
689
+ rowParts.push(`<div${cellRoleAttr(cellRole)} data-kit-part="${KIT_PART_TABLE_CELL}"${attr('class', layout.selectClass)}>${host('KitTableActions', selAnchor(object))}</div>`);
621
690
  } else {
622
691
  ctx.components.add('Checkbox');
623
692
  rowShow[selAnchor(object)] = { props: {} };
624
- rowParts.push(`<div${cellRoleAttr(cellRole)}${attr('class', layout.selectClass)}>${host('Checkbox', selAnchor(object))}</div>`);
693
+ rowParts.push(`<div${cellRoleAttr(cellRole)} data-kit-part="${KIT_PART_TABLE_CELL}"${attr('class', layout.selectClass)}>${host('Checkbox', selAnchor(object))}</div>`);
625
694
  }
626
695
  }
627
- layout.cells.forEach((c, i) => rowParts.push(columnCell(ctx, c, `${at}.cells[${i}]`, rowShow, tools, cellRole)));
696
+ layout.cells.forEach((c, i) => rowParts.push(columnCell(ctx, gapCols.get(c.field) ?? c, `${at}.cells[${i}]`, rowShow, tools, cellRole)));
628
697
  if (layout.rowActions.length > 0) {
629
698
  ctx.components.add('KitTableActions');
630
699
  rowShow[opsAnchor(object)] = {
631
- props: { actions: actionItems(layout.rowActions, ctx), ...actionStateProp(layout.rowActions, ctx), row: ctx.rowVar, ...rowToneProp(layout, ctx), ...(ctx.options.pickOnRow === true ? { pickOnRow: true } : {}), ...removeBusyProps(ctx), ...selectedProps(ctx) },
700
+ props: { actions: actionItems(layout.rowActions, ctx), ...actionStateProp(layout.rowActions, ctx), row: ctx.rowVar, ...rowToneProp(layout, ctx), ...(ctx.options.pickOnRow === true ? { pickOnRow: true } : {}), ...removeBusyProps(ctx), ...selectedProps(ctx), ...(layout.tools === true && (layout.batch?.length ?? 0) > 0 && ctx.options.selectedPath !== undefined ? { bulkLock: true } : {}) },
632
701
  };
633
- rowParts.push(`<div${cellRoleAttr(cellRole)}${attr('class', layout.actionsClass)}>${host('KitTableActions', opsAnchor(object))}</div>`);
702
+ rowParts.push(`<div${cellRoleAttr(cellRole)} data-kit-part="${KIT_PART_TABLE_CELL}"${attr('class', layout.actionsClass)}>${host('KitTableActions', opsAnchor(object))}</div>`);
634
703
  }
635
704
  // pickOnRow 或行样式档位(rowTone)且没有行操作列:补一个无按钮的 KitTableActions 实例,专管行点击 / 行样式
636
705
  if ((ctx.options.pickOnRow === true || layout.rowTone !== undefined) && layout.rowActions.length === 0) {
@@ -682,7 +751,15 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
682
751
  const wrapA11y = scrollable ? ` tabindex="0" role="region"${attr('aria-label', ctx.object)}` : '';
683
752
  const summary = renderSummary(ctx, layout, selHead, actHead, semTable);
684
753
  const tableA11y = semTable ? ` role="table"${attr('aria-label', ctx.object)}` : '';
685
- const body = `<div${attr('class', layout.wrapClass)}${wrapA11y}${tools ? ` data-kit-table="" data-kit-table-of="${esc(toolsAnchor(object))}"` : ''} data-kit-part="${KIT_PART_TABLE}"${gridMark(layout)} ${KIT_TIPS_SCOPE_ATTR}=""><div${tableA11y}${attr('class', layout.innerClass)}>${head}${rows}${summary}</div></div>`;
754
+ // 静态表头(不可排序)的整列缺失原因标注由 KitTableGap 接线件画;可排序表头由 KitTableHead 自己画(上面已给 rows)
755
+ let gapHost = '';
756
+ if (gapCols.size > 0 && !layout.sort) {
757
+ const gapId = `${object}__table_gap`;
758
+ ctx.components.add('KitTableGap');
759
+ ctx.show[gapId] = { props: { rows: ctx.rowsPath, fields: [...gapCols.keys()] } };
760
+ gapHost = host('KitTableGap', gapId);
761
+ }
762
+ const body = `<div${attr('class', layout.wrapClass)}${wrapA11y}${tools ? ` data-kit-table="" data-kit-table-of="${esc(toolsAnchor(object))}"` : ''}${ctx.options.defaultDense === true ? ' data-kit-dense=""' : ''} data-kit-part="${KIT_PART_TABLE}"${gridMark(layout)} ${KIT_TIPS_SCOPE_ATTR}=""><div${tableA11y}${attr('class', layout.innerClass)}>${gapHost}${head}${rows}${summary}</div></div>`;
686
763
  return `${renderTools(ctx, layout)}${body}${renderState(ctx, layout.state, skeletonShapeOf(layout, ctx.options.schema))}${renderPager(ctx, layout.pager)}`;
687
764
  }
688
765
 
@@ -785,13 +862,18 @@ function renderSummary(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>
785
862
  if (layout.summary === undefined || layout.summary === null || layout.tree !== null) return '';
786
863
  const id = summaryAnchor(ctx.object);
787
864
  ctx.components.add('KitTableSummary');
865
+ // 合计行固定选择/操作角格用与合计行一致的实底 bg-surface-sunken 与 z-20,防止横向滚动数字穿透固定列
866
+ const summaryCorner = (cls: string): string => cls
867
+ .replace(/\bbefore:bg-surface-band\b/g, 'before:bg-surface-sunken')
868
+ .replace(/\bbg-surface-band\b/g, 'bg-surface-sunken')
869
+ .replace(/\bz-10\b/g, 'z-20');
788
870
  ctx.show[id] = {
789
871
  props: {
790
872
  rows: ctx.rowsPath,
791
873
  class: layout.summaryRowClass ?? '',
792
874
  ...(semTable ? { semantics: 'table' } : {}),
793
- selectClass: layout.select !== 'none' ? selHead : '',
794
- actionsClass: layout.rowActions.length > 0 ? actHead : '',
875
+ selectClass: layout.select !== 'none' ? summaryCorner(selHead) : '',
876
+ actionsClass: layout.rowActions.length > 0 ? summaryCorner(actHead) : '',
795
877
  label: layout.summary.label,
796
878
  labelField: layout.summary.labelField,
797
879
  columns: layout.cells.map((c, i) => ({
@@ -832,7 +914,8 @@ function skeletonShapeOf(layout: Extract<KitLayoutIR, { kind: 'table' | 'cards'
832
914
 
833
915
  /** 展开行的开关条与详情体(语义色名 + 内置尺度) */
834
916
  const EXPAND_TOGGLE_CLASS = 'px-4 py-1';
835
- const EXPAND_BODY_CLASS = 'border-b border-border-subtle bg-surface-sunken px-4 py-3';
917
+ // 展开行的内容是凹槽面:与上下行之间已有面差,不再加线(一处分隔一种手段,KT-B5 / D-30)
918
+ const EXPAND_BODY_CLASS = 'bg-surface-sunken px-4 py-3';
836
919
 
837
920
  /** 标题与它旁边的集合辅助文字(共 N 条 / 已筛选提示)同一组:基线对齐、窄时换行 */
838
921
  const TITLE_GROUP_CLASS = 'flex min-w-0 flex-wrap items-baseline gap-x-3 gap-y-1';
@@ -919,6 +1002,7 @@ function renderPager(ctx: Ctx, pager: { size: number; sizes: number[]; jump: boo
919
1002
  scope: ctx.scope(), total: ctx.totalPath, size: pager.size, sizes: pager.sizes, jump: pager.jump,
920
1003
  // 读状态:翻页后重取失败,分页器据此把页码 / 页长回滚到最近一次读成功的值
921
1004
  readState: `${readStatePathsOf(ctx.object, ctx.basePath).dataPath}.readState`,
1005
+ ...(ctx.options.pagerClass !== undefined ? { class: ctx.options.pagerClass } : {}),
922
1006
  ...(pager.mode !== undefined ? { mode: pager.mode } : {}),
923
1007
  ...(pager.layout !== undefined ? { layout: pager.layout } : {}),
924
1008
  ...(pager.showTotal === false ? { show_total: false } : {}),
@@ -941,24 +1025,81 @@ function renderCompactBody(ctx: Ctx, compact: NonNullable<Extract<KitLayoutIR, {
941
1025
  };
942
1026
  const titleId = cellAnchor(ctx.object, 'list', compact.title.field);
943
1027
  ctx.components.add(compact.title.component);
944
- rowShow[titleId] = { props: sized(compact.title) };
945
- const title = `<div${attr('class', D.compactTitle)} ${KIT_TIPS_SCOPE_ATTR}="">${host(compact.title.component, titleId)}</div>`;
1028
+ const titleProps = sized(compact.title);
1029
+ // 紧凑列表标题文本自带 block min-w-0 truncate,避免长客户名 / 长接口名硬切或压盖右侧状态点与金额
1030
+ if (compact.title.component === 'Text' || compact.title.component === 'Link') {
1031
+ titleProps.class = joinClasses(typeof titleProps.class === 'string' ? titleProps.class : '', 'block min-w-0 truncate');
1032
+ }
1033
+ rowShow[titleId] = { props: titleProps };
1034
+ // 左窗格条目(主从页):第一行 = 名称 + 右侧状态(第一个 Tag 字段),第二行 = 等宽编码(其余文本字段,「·」分隔)+ 右侧类型标签(其余 Tag 字段)
1035
+ if (compact.pane === true) {
1036
+ // 标签类字段:Tag 组件,或枚举 / 布尔类型的字段(枚举的只读展示组件是 Text,按类型判)
1037
+ const isTag = (c: KitCell): boolean => {
1038
+ const type = ctx.options.schema?.[c.field]?.type;
1039
+ return c.component === 'Tag' || type === 'enum' || type === 'enums' || type === 'bool';
1040
+ };
1041
+ const tags = compact.meta.filter(isTag);
1042
+ const texts = compact.meta.filter((c) => !isTag(c));
1043
+ const tagHtml = (cell: KitCell): string => {
1044
+ const id = cellAnchor(ctx.object, 'list', cell.field);
1045
+ // 状态 / 类型标签一律是圆点 + 语义色文字(没有容器):枚举的只读展示组件是 Text(徽标呈现),在条目里换成 Tag 的 dot 变体(同一份 options / value)
1046
+ const comp = cell.component === 'Text' ? 'Tag' : cell.component;
1047
+ ctx.components.add(comp);
1048
+ const props = sized(cell);
1049
+ // 值带语气(单选枚举、选项带 tone)= 状态 → 圆点 + 文字;不带语气的分类 / 多值 / 布尔 = 标签(浅底小圆角)——状态与标签永不同形(KT-K-status-3)
1050
+ const field = ctx.options.schema?.[cell.field] as { type?: string; options?: unknown } | undefined;
1051
+ const opts = Array.isArray(field?.options) ? (field!.options as unknown[]) : [];
1052
+ const toned = field?.type === 'enum' && opts.some((o) => o !== null && typeof o === 'object' && 'tone' in (o as Record<string, unknown>));
1053
+ if (toned && (props.variant === undefined || props.variant === 'dot')) Object.assign(props, kitStatusPillProps());
1054
+ rowShow[id] = { props };
1055
+ return `<span${attr('class', D.paneTag)}>${host(comp, id)}</span>`;
1056
+ };
1057
+ const textHtml = texts.map((cell, i) => {
1058
+ const id = cellAnchor(ctx.object, 'list', cell.field);
1059
+ ctx.components.add(cell.component);
1060
+ const props = sized(cell);
1061
+ const type = ctx.options.schema?.[cell.field]?.type;
1062
+ const numeric = isNumericColumnType(type);
1063
+ if (cell.component === 'Text') {
1064
+ props.class = joinClasses(typeof props.class === 'string' ? props.class : '', numeric ? D.paneCode : `${D.paneCode} block min-w-0 truncate`);
1065
+ }
1066
+ rowShow[id] = { props };
1067
+ const hideable = !numeric && type !== 'enum' && type !== 'enums' && type !== 'bool';
1068
+ const itemCls = numeric ? joinClasses(D.compactMetaItem, 'shrink-0') : D.compactMetaItem;
1069
+ const sep = i > 0 ? `<span${attr('class', D.compactSep)} aria-hidden="true">·</span>` : '';
1070
+ if (!hideable) return `<span${attr('class', itemCls)}>${sep}${host(cell.component, id)}</span>`;
1071
+ const wid = `${id}__item`;
1072
+ rowShow[wid] = { when: `${ctx.rowVar}.${cell.field}` };
1073
+ return `<span data-soma-id="${esc(wid)}"${attr('class', itemCls)}>${sep}${host(cell.component, id)}</span>`;
1074
+ });
1075
+ const [status, ...kinds] = tags;
1076
+ const row1 = `<div${attr('class', D.paneRow)}><div${attr('class', `${D.compactTitle} flex-1 overflow-hidden`)} ${KIT_TIPS_SCOPE_ATTR}="">${host(compact.title.component, titleId)}</div>${status !== undefined ? tagHtml(status) : ''}</div>`;
1077
+ const row2 = textHtml.length > 0 || kinds.length > 0
1078
+ ? `<div${attr('class', `${D.paneRow} text-fg-muted`)}><div${attr('class', `${D.compactMeta} flex-1`)}>${textHtml.join('')}</div>${kinds.map(tagHtml).join('')}</div>`
1079
+ : '';
1080
+ return `<div${attr('class', D.compactBody)}>${row1}${row2}</div>`;
1081
+ }
1082
+ const title = `<div${attr('class', `${D.compactTitle} overflow-hidden`)} ${KIT_TIPS_SCOPE_ATTR}="">${host(compact.title.component, titleId)}</div>`;
946
1083
  const items = compact.meta.map((cell, i) => {
947
1084
  const id = cellAnchor(ctx.object, 'list', cell.field);
948
1085
  ctx.components.add(cell.component);
949
1086
  const props = sized(cell);
950
- // 状态字段:圆点 + 文字(无底无描边);其余文本沿用组件默认外观
951
- if (cell.component === 'Tag') props.variant ??= 'dot';
952
- // 次要信息是辅助文字:纯文本值走次要字色(Text 根自带正文色,色类由值类补上)
953
- if (cell.component === 'Text') props.class = joinClasses(typeof props.class === 'string' ? props.class : '', 'text-fg-muted');
954
- rowShow[id] = { props };
955
1087
  const type = ctx.options.schema?.[cell.field]?.type;
956
- const hideable = cell.component !== 'Tag' && !isNumericColumnType(type) && type !== 'enum' && type !== 'enums' && type !== 'bool';
1088
+ const numeric = isNumericColumnType(type);
1089
+ // 状态字段:圆点 + 文字、没有容器(emphasis.status = dot);其余文本沿用组件默认外观
1090
+ if (cell.component === 'Tag' && (props.variant === undefined || props.variant === 'dot')) Object.assign(props, kitStatusPillProps());
1091
+ // 次要信息是辅助文字:纯文本值走次要字色(Text 根自带正文色,色类由值类补上),非数值文本带省略防压盖金额 / 状态点
1092
+ if (cell.component === 'Text') {
1093
+ props.class = joinClasses(typeof props.class === 'string' ? props.class : '', numeric ? 'text-fg-muted' : 'text-fg-muted block min-w-0 truncate');
1094
+ }
1095
+ rowShow[id] = { props };
1096
+ const hideable = cell.component !== 'Tag' && !numeric && type !== 'enum' && type !== 'enums' && type !== 'bool';
1097
+ const itemCls = cell.component === 'Tag' || numeric ? joinClasses(D.compactMetaItem, 'shrink-0') : D.compactMetaItem;
957
1098
  const sep = i > 0 ? `<span${attr('class', D.compactSep)} aria-hidden="true">·</span>` : '';
958
- if (!hideable) return `<span${attr('class', D.compactMetaItem)}>${sep}${host(cell.component, id)}</span>`;
1099
+ if (!hideable) return `<span${attr('class', itemCls)}>${sep}${host(cell.component, id)}</span>`;
959
1100
  const wid = `${id}__item`;
960
1101
  rowShow[wid] = { when: `${ctx.rowVar}.${cell.field}` };
961
- return `<span data-soma-id="${esc(wid)}"${attr('class', D.compactMetaItem)}>${sep}${host(cell.component, id)}</span>`;
1102
+ return `<span data-soma-id="${esc(wid)}"${attr('class', itemCls)}>${sep}${host(cell.component, id)}</span>`;
962
1103
  });
963
1104
  const meta = items.length > 0 ? `<div${attr('class', D.compactMeta)}>${items.join('')}</div>` : '';
964
1105
  return `<div${attr('class', D.compactBody)}>${title}${meta}</div>`;
@@ -978,7 +1119,9 @@ function renderCollection(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'cards'
978
1119
  const toneProps = layout.rowTone !== undefined ? { ...rowToneProp(layout, ctx), rowToneSet: 'item' } : {};
979
1120
  if (layout.rowActions.length > 0) {
980
1121
  ctx.components.add('KitTableActions');
981
- rowShow[opsAnchor(object)] = { props: { actions: actionItems(layout.rowActions, ctx), ...actionStateProp(layout.rowActions, ctx), row: ctx.rowVar, ...toneProps, ...pickProps, ...removeBusyProps(ctx) } };
1122
+ // 紧凑列表(主从的控件列)是窄栏:行内只留主动作(行内上限取窄档上限),其余进「更多」(危险动作在菜单末位,与前面分隔)——一行不堆四个文字动作
1123
+ const compactCap = compact !== undefined ? { maxInline: kitRowActionsNarrowCap() } : {};
1124
+ rowShow[opsAnchor(object)] = { props: { actions: actionItems(layout.rowActions, ctx), ...compactCap, ...actionStateProp(layout.rowActions, ctx), row: ctx.rowVar, ...toneProps, ...pickProps, ...removeBusyProps(ctx) } };
982
1125
  actions = host('KitTableActions', opsAnchor(object));
983
1126
  } else if (layout.rowTone !== undefined || pickOnly) {
984
1127
  ctx.components.add('KitTableActions');
@@ -998,7 +1141,8 @@ function renderCollection(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'cards'
998
1141
  const itemClass = pickOnly ? joinClasses(layout.itemClass, 'cursor-pointer') : layout.itemClass;
999
1142
  const rowMark = layout.rowTone !== undefined || pickOnly ? ' data-kit-row=""' : '';
1000
1143
  const actionsPart = compact !== undefined && actions !== '' ? `<div${attr('class', KIT_CLASS_DEFAULTS.compactActions)}>${actions}</div>` : actions;
1001
- const template = `<template data-soma-role="item"><div${attr('class', itemClass)}${rowMark}${ctxItems.length > 0 ? ' data-kit-ctx=""' : ''}${itemPart}>${inner}${actionsPart}${ctxHost}</div></template>`;
1144
+ const compactMark = compact !== undefined ? ' data-kit-compact=""' : '';
1145
+ const template = `<template data-soma-role="item"><div${attr('class', itemClass)}${rowMark}${compactMark}${ctxItems.length > 0 ? ' data-kit-ctx=""' : ''}${itemPart}>${inner}${actionsPart}${ctxHost}</div></template>`;
1002
1146
  ctx.show[rowsAnchor(object)] = { bind: { obj: ctx.rowsPath, var: ctx.rowVar }, show: rowShow };
1003
1147
  const list = `<div${attr('class', layout.listClass)} data-soma-id="${esc(rowsAnchor(object))}">${template}</div>`;
1004
1148
  return `<div${attr('class', layout.wrapClass)}>${list}</div>${renderState(ctx, layout.state, skeletonShapeOf(layout, ctx.options.schema))}${renderPager(ctx, layout.pager)}`;
@@ -1121,6 +1265,11 @@ function renderObjectForm(ctx: Ctx, slot: 'filter' | 'form', layout: KitLayoutIR
1121
1265
  }
1122
1266
  const id = viewAnchor(ctx.object, slot);
1123
1267
  ctx.components.add('KitObjectForm');
1268
+ // 底栏动作组的「更多」入口(可编辑表单;筛选表单没有)
1269
+ if (slot === 'form') ctx.components.add('KitActionMore');
1270
+ // 筛选工具条(风格档案 SPACE_MATERIAL):简单筛选改成「搜索框 + 分段 / 下拉」一条工具条(见 filter-toolbar.ts),不合格返回 null 照旧排布
1271
+ const toolbarCells = slot === 'filter' && layout.kind === 'grid' ? filterToolbarCells(packed.fields, ctx.options.locale ?? '') : null;
1272
+ if (toolbarCells !== null) packed.fields = toolbarCells;
1124
1273
  for (const c of packed.fields) if (c.component !== '') ctx.components.add(c.component);
1125
1274
  // 可编辑 form 的 mode / initial 可绑镜像路径(字符串路径由 core 解析成绑定);filter 恒为字面量
1126
1275
  const bindMode = slot === 'form' ? ctx.options.formModePath : undefined;
@@ -1141,45 +1290,28 @@ function renderObjectForm(ctx: Ctx, slot: 'filter' | 'form', layout: KitLayoutIR
1141
1290
  if (envelope !== undefined) props.envelope = envelope;
1142
1291
  // M 波 G3:布局 / 筛选折叠 / 即时校验 / 离开守卫(只在写了的时候带,缺省保持存量行为)
1143
1292
  const fo = ir.views[slot]?.formOpts;
1144
- // 筛选栏动作区并入字段栅格(字段占满一行才另起一行,否则与字段同行靠右):根即栅格、字段容器 display: contents、动作区带跨度类;
1145
- // 折叠搜索区(collapsible / filterOverflow)同走流式版式:折起的行数由表单按宿主宽度现算,「查询 / 重置 / 展开」紧跟最后一个可见字段
1146
- if (slot === 'filter' && layout.kind === 'grid' && layout.actionsClass !== undefined) {
1147
- props.classes = { wrap: mergeClass(layout.wrapClass, layout.gridClass), grid: KIT_FILTER_INLINE_CLASS.grid, actions: mergeClass(layout.actionsClass, KIT_FILTER_INLINE_CLASS.actionsExtra), notice: KIT_FILTER_INLINE_CLASS.notice };
1148
- // 不折叠的筛选栏默认走定宽流式版式:字段按类型定宽(文本 / 日期 240、下拉按 design 阶梯)、「查询 / 重置」紧跟最后一个字段并对齐到控件那一行,
1149
- // 容器放不下一个字段 + 动作区时字段占满一行、动作区另起一行靠右;折叠搜索区(上面的条件不成立)仍按 12 份栅格折行
1150
- const flow = layout.filterFlow;
1151
- const pack = layout.filterPack;
1152
- // 不折叠的筛选栏:按字段数装行(列等分行宽、动作区当一格参与装行,放不进首行时与末行字段同排靠右,绝不孤行靠左);
1153
- // 折叠搜索区的折起行数由表单按宿主宽度现算(依赖定宽类 @档:w-N),仍走上面的流式版式
1154
- if (pack !== undefined && fo?.collapsible !== true && fo?.filterOverflow !== true) {
1155
- props.fields = packed.fields.map((c, i) => (c.placeholder === true ? c : { ...c, cellClass: swapSpanForWidth(c.cellClass, pack.cellClasses[i] ?? '') }));
1156
- const keep = layout.gridClass.split(/\s+/).filter((t) => t !== '' && !/^(?:@[a-z0-9]+:)?(?:grid|grid-cols-\d+|gap-[a-z0-9.]+)$/.test(t));
1157
- props.classes = {
1158
- wrap: joinClasses(joinClasses(layout.wrapClass, pack.wrapClass), keep.join(' ')),
1159
- grid: KIT_FILTER_INLINE_CLASS.grid,
1160
- actions: mergeClass('', pack.actionsClass),
1161
- pad: pack.padClass,
1162
- notice: pack.noticeClass,
1163
- };
1164
- } else if (flow !== undefined) {
1165
- props.fields = packed.fields.map((c, i) => (c.placeholder === true ? c : { ...c, cellClass: swapSpanForWidth(c.cellClass, flow.widthClasses[i] ?? '') }));
1166
- const keep = layout.gridClass.split(/\s+/).filter((t) => t !== '' && !/^(?:@[a-z0-9]+:)?(?:grid|grid-cols-\d+|gap-[a-z0-9.]+)$/.test(t));
1167
- props.classes = {
1168
- wrap: joinClasses(joinClasses(layout.wrapClass, flow.wrapClass), keep.join(' ')),
1169
- grid: KIT_FILTER_INLINE_CLASS.grid,
1170
- actions: mergeClass('', flow.actionsClass),
1171
- pad: flow.padClass,
1172
- notice: flow.noticeClass,
1173
- };
1174
- // 折叠搜索区也走流式版式:折起哪些字段要按容器宽度现算(定宽字段每行放几个),由表单量宿主宽度判,不再按 12 份栅格的份数折行
1175
- props.flow = true;
1176
- }
1293
+ // 筛选栏(cols 排布):排布引擎的投影(filter-plan.ts)——根容器左起流式换行、字段按类型取 [最小, 理想, 最大] 定宽(不拉伸)、
1294
+ // 动作区(查询 / 重置,或即时档的「清除」)紧跟最后一个字段并对齐到控件那一行;档位(即时 / 提交 / 更多)与钉住个数作为 props,运行时不量宽
1295
+ const proj = slot === 'filter' && layout.kind === 'grid' && toolbarCells === null ? layout.filterProjection : undefined;
1296
+ if (toolbarCells !== null) {
1297
+ props.classes = { wrap: KIT_FILTER_TOOLBAR_WRAP, grid: 'contents', actions: KIT_FILTER_TOOLBAR_ACTIONS, pad: 'hidden', notice: 'w-full' };
1298
+ } else if (proj !== undefined && layout.kind === 'grid') {
1299
+ props.fields = packed.fields.map((c, i) => (c.placeholder === true ? c : { ...c, cellClass: swapSpanForWidth(c.cellClass, proj.widthClasses[i] ?? '') }));
1300
+ const keep = layout.gridClass.split(/\s+/).filter((t) => t !== '' && !/^(?:@[a-z0-9]+:)?(?:grid|grid-cols-\d+|gap-[a-z0-9.]+)$/.test(t));
1301
+ props.classes = {
1302
+ wrap: joinClasses(joinClasses(layout.wrapClass, proj.wrapClass), keep.join(' ')),
1303
+ grid: 'contents',
1304
+ actions: proj.actionsClass,
1305
+ pad: proj.padClass,
1306
+ notice: proj.noticeClass,
1307
+ };
1177
1308
  }
1178
1309
  if (fo?.labelPosition !== undefined) { props.labelPosition = fo.labelPosition; props.labelWidth = fo.labelWidth ?? 3; }
1179
1310
  if (typeof fo?.scrollToError === 'boolean') props.scrollToError = fo.scrollToError;
1180
1311
  if (fo?.requiredMark === 'start') props.requiredMark = 'start';
1181
- if (fo?.collapsible === true) { props.collapsible = true; props.collapsedRows = fo.collapsedRows ?? 1; }
1182
1312
  if (fo?.trigger === 'change') props.trigger = 'change';
1313
+ if (fo?.filterMode !== undefined) props.filterMode = fo.filterMode;
1314
+ if (fo?.pinned !== undefined) props.pinned = fo.pinned;
1183
1315
  if (fo?.groupTabs === true) props.groupTabs = true;
1184
1316
  if (slot === 'form') {
1185
1317
  if (ctx.options.validateOn !== undefined) props.validateOn = ctx.options.validateOn;
@@ -1218,16 +1350,26 @@ function renderObjectForm(ctx: Ctx, slot: 'filter' | 'form', layout: KitLayoutIR
1218
1350
  ctx.show[id] = { props };
1219
1351
  // 页面真有按需字段控件(画布)时在宿主上点名,core 才补载其分片
1220
1352
  const needs = [...new Set(packed.fields.map((c) => c.component).filter((n) => n === 'FlowEditor'))];
1221
- const isOverflowFilter = slot === 'filter' && (fo?.filterOverflow === true || (fo?.collapsible === true && packed.fields.filter((c) => c.placeholder !== true && c.divider !== true && c.component !== '').length > (fo?.defaultCollapsedCount ?? 4)));
1222
1353
  let html = host('KitObjectForm', id);
1223
- if (isOverflowFilter) html = html.replace('></div>', ' data-kit-filter-overflow="true"></div>');
1354
+ if (toolbarCells !== null) html = html.replace('></div>', ` ${KIT_FILTER_TOOLBAR_MARK}=""></div>`);
1355
+ // 容器查询只对后代生效:表单根上的字段宽度 / 动作区变体类(@<档>:w-N)要查到宿主这一层,所以宿主做查询容器
1356
+ if (proj !== undefined) {
1357
+ html = html.includes(' class="') ? html.replace(' class="', ` class="${KIT_WIDTH.containerClass} `) : html.replace('></div>', ` class="${KIT_WIDTH.containerClass}"></div>`);
1358
+ }
1224
1359
  return needs.length === 0 ? html : html.replace('></div>', ` data-soma-needs="${needs.join(' ')}"></div>`);
1225
1360
  }
1226
1361
 
1227
1362
  // ---------------------------------------------------------------- 工具栏
1228
1363
 
1229
- const AUXILIARY_BUILTINS = new Set(['reload', 'reset', 'export', 'back']);
1230
- const AUXILIARY_IDS = new Set(['reload', 'refresh', 'reset', 'export', 'back']);
1364
+ /** 内置动作 / 常见动作 id → 语义角色(真源 KIT_EMPHASIS.semanticRoles 的键):编译器按语义角色定强调档,页面不写样式 */
1365
+ const SEMANTIC_OF_NAME: Readonly<Record<string, keyof typeof KIT_EMPHASIS.semanticRoles>> = {
1366
+ reload: 'refresh', refresh: 'refresh', reset: 'reset', back: 'back', cancel: 'cancel', close: 'close',
1367
+ export: 'alternative', more: 'more', remove: 'delete', delete: 'delete',
1368
+ };
1369
+ /** 强调档 → 按钮语气(主 = 实心;次 = 白底描边中性钮(neutral 语气);三级 = 文字钮(ghost 语气);安静 = 灰字(ghost 语气);危险 = 灰字悬停变红)。色调钮(tonal)只由页面显式写 tone: tonal 得到 */
1370
+ const TONE_OF_LEVEL: Readonly<Record<string, 'primary' | 'neutral' | 'danger' | 'ghost' | 'tonal'>> = {
1371
+ primary: 'primary', secondary: 'neutral', tertiary: 'ghost', quiet: 'ghost', danger: 'danger',
1372
+ };
1231
1373
 
1232
1374
  function actionTone(a: KitAction): 'primary' | 'neutral' | 'danger' | 'ghost' | 'tonal' {
1233
1375
  if (a.tone === 'danger' || a.tone === 'neutral' || a.tone === 'primary' || a.tone === 'ghost' || a.tone === 'tonal') {
@@ -1235,9 +1377,10 @@ function actionTone(a: KitAction): 'primary' | 'neutral' | 'danger' | 'ghost' |
1235
1377
  }
1236
1378
  if (a.tone === 'info' || a.tone === 'success') return 'primary';
1237
1379
  if (a.tone === 'warning') return 'tonal';
1238
- if ((a.builtin !== undefined && AUXILIARY_BUILTINS.has(a.builtin)) || AUXILIARY_IDS.has(a.id)) {
1239
- return 'neutral';
1240
- }
1380
+ const semantic = (a.builtin !== undefined ? SEMANTIC_OF_NAME[a.builtin] : undefined)
1381
+ ?? SEMANTIC_OF_NAME[a.id]
1382
+ ?? (/^export(?:[A-Z_-]|$)/.test(a.id) ? 'alternative' : undefined);
1383
+ if (semantic !== undefined) return TONE_OF_LEVEL[KIT_EMPHASIS.semanticRoles[semantic]] ?? 'primary';
1241
1384
  return 'primary';
1242
1385
  }
1243
1386
 
@@ -1249,20 +1392,23 @@ function toolbarReasonProp(a: KitAction): { disabled_reason?: string } {
1249
1392
  return source.kind === 'literal' && source.text.trim() !== '' ? { disabled_reason: source.text } : {};
1250
1393
  }
1251
1394
 
1252
- /** 主操作语气(新增 / 危险):工具栏里排在最右,次级工具(刷新 / 导出 / 重置等中性或幽灵语气)在其左 */
1253
- function isPrimaryToolbarAction(a: KitAction): boolean {
1395
+ /** 动作在动作组里的重要度:primary 语气 = 主操作(恒在行尾、恒可见);danger 语气最后保留;其余为次要 */
1396
+ function toolbarImportance(a: KitAction): KitActionImportance {
1254
1397
  const t = actionTone(a);
1255
- return t !== 'neutral' && t !== 'ghost';
1398
+ return t === 'primary' ? 'primary' : t === 'danger' ? 'danger' : 'secondary';
1256
1399
  }
1257
1400
 
1258
1401
  /**
1259
- * 工具栏(主操作与次级工具)一律不独占一整行:有列表标题时并入标题行右侧,没有标题时紧贴列表上方靠右;
1260
- * 次级工具在左、主操作在最右(同档保持声明顺序)。
1402
+ * 工具栏(主操作与次级工具)一律不独占一整行:有列表标题时并入标题行右侧,没有标题时紧贴列表上方靠右。
1403
+ * 成组排布经排布引擎(action-group.ts):恒单行、文字不折行;空间不足时次要动作按优先级逐个收进「更多」(KitActionMore,菜单里危险项置末),
1404
+ * 主操作恒在行尾可见;视觉序取引擎 order(非主操作按声明序在前,主操作在行尾)。
1261
1405
  */
1262
1406
  function renderToolbar(ctx: Ctx, actions: readonly KitAction[]): string {
1263
1407
  const declared = actions.filter((a) => a.on === 'toolbar');
1264
1408
  if (declared.length === 0) return '';
1265
- const list = [...declared.filter((a) => !isPrimaryToolbarAction(a)), ...declared.filter(isPrimaryToolbarAction)];
1409
+ const projection = projectActionGroup(declared.map((a) => ({ id: a.id, label: a.name, importance: toolbarImportance(a) })));
1410
+ const byId = new Map(declared.map((a) => [a.id, a] as const));
1411
+ const list = projection.order.flatMap((id) => { const a = byId.get(id); return a === undefined ? [] : [a]; });
1266
1412
  const parts = list.map((a) => {
1267
1413
  const id = toolbarAnchor(ctx.object, a.id);
1268
1414
  ctx.components.add('Button');
@@ -1270,6 +1416,8 @@ function renderToolbar(ctx: Ctx, actions: readonly KitAction[]): string {
1270
1416
  props: {
1271
1417
  label: a.name,
1272
1418
  variant: actionTone(a),
1419
+ // 动作语义是「新建」(内置 openCreate)时由框架给前置加号图标,页面不写
1420
+ ...(a.builtin === 'openCreate' ? { icon: 'plus' } : {}),
1273
1421
  // 展示对象路径:路径取值为真时按钮置灰(Button 的 disabled prop)
1274
1422
  ...(a.disabled !== undefined && isViewPath(a.disabled) ? { disabled: viewPathToCore(a.disabled) } : {}),
1275
1423
  // 置灰原因(disabled 为真时 Button 才显示):字面量原样带,view.<成员> 编成页面变量路径;row. 路径在入口已报 KIT-VIEW-001
@@ -1278,9 +1426,15 @@ function renderToolbar(ctx: Ctx, actions: readonly KitAction[]): string {
1278
1426
  ...(typeof a.permission === 'string' && a.permission !== '' ? { permission: a.permission } : {}),
1279
1427
  },
1280
1428
  };
1281
- return host('Button', id);
1429
+ // 外壳承载「按档隐藏」类与「更多」菜单要读的标记(标签 / 语气);壳里是真按钮,菜单选中即对它 click() 回放
1430
+ return `<div${attr('class', projection.itemClass[a.id] ?? 'shrink-0')} data-kit-ag-item="${esc(a.id)}" data-kit-ag-label="${esc(a.name)}" data-kit-ag-tone="${esc(actionTone(a))}">${host('Button', id)}</div>`;
1282
1431
  });
1283
- return `<div${attr('class', KIT_CLASS_DEFAULTS.toolbarSecondary)}>${parts.join('')}</div>`;
1432
+ let more = '';
1433
+ if (projection.plan.hasMore) {
1434
+ ctx.components.add('KitActionMore');
1435
+ more = `<div${attr('class', projection.moreClass)}>${host('KitActionMore', `${ctx.object}__tb_more`)}</div>`;
1436
+ }
1437
+ return `<div${attr('class', projection.hostClass)} data-kit-action-group="" data-kit-ag-flow="${esc(projection.flowHostClass)}"><div${attr('class', projection.rowClass)}>${parts.join('')}${more}</div></div>`;
1284
1438
  }
1285
1439
 
1286
1440
  // ---------------------------------------------------------------- 主函数
@@ -1304,7 +1458,7 @@ export function emitStatic(ir: KitObjectIR, options: KitStaticOptions): KitStati
1304
1458
  diagnostics: [],
1305
1459
  singlePath: summaryBase,
1306
1460
  rowVar: rowVarOf(object),
1307
- rowsPath: wrapped ? `${base}.${options.listShape.rows}` : base,
1461
+ rowsPath: wrapped ? `${base}.${options.listShape.rows}` : options.staticRowsPath !== undefined && options.staticRowsPath !== '' ? `${base}.${options.staticRowsPath}` : base,
1308
1462
  totalPath: `${base}.${options.listShape.total}`,
1309
1463
  basePath: base,
1310
1464
  scope: () => ir.scope,
@@ -1402,18 +1556,20 @@ export function emitStatic(ir: KitObjectIR, options: KitStaticOptions): KitStati
1402
1556
  ? `<div${attr('class', KIT_CLASS_DEFAULTS.toolbarSecondary)}>${treeCtl}${mergeToolbar ? parts.toolbar! : ''}</div>`
1403
1557
  : parts.toolbar!;
1404
1558
  // 集合辅助文字紧随标题作标题行的直接子项(宿主 display: contents,其根自带 me-auto 把工具区推到最右)
1405
- html = `<div class="${KIT_CLASS_DEFAULTS.toolbarTitleRow}">${titleEl}${metaHtml}${right}</div>${html}`;
1559
+ // 带工具的列表标题行是面内的头部条(strip.headPx 下限,内容垂直居中):不设下限时工具钮贴着面板顶边,
1560
+ // 钮的上描边与面板上边相距 0 成双线(边框普查 B01,外壳用户授权「导出」)
1561
+ html = `<div data-kit-title-row="" class="${KIT_CLASS_DEFAULTS.toolbarTitleRow} ${KIT_STRIP_HEAD_MIN_CLASS}">${titleEl}${metaHtml}${right}</div>${html}`;
1406
1562
  if (mergeToolbar) delete parts.toolbar;
1407
1563
  } else {
1408
- html = `${metaHtml === '' ? titleEl : `<div class="${TITLE_GROUP_CLASS}">${titleEl}${metaHtml}</div>`}${html}`;
1564
+ html = `${metaHtml === '' ? titleEl : `<div data-kit-title-row="" class="${TITLE_GROUP_CLASS}">${titleEl}${metaHtml}</div>`}${html}`;
1409
1565
  }
1410
1566
  } else {
1411
1567
  if (treeCtl !== '') {
1412
1568
  if (secondaryToolbar && parts.toolbar !== undefined) parts.toolbar = `<div${attr('class', KIT_CLASS_DEFAULTS.toolbarSecondary)}>${treeCtl}${parts.toolbar}</div>`;
1413
1569
  else html = `<div${attr('class', KIT_CLASS_DEFAULTS.toolbarSecondary)}>${treeCtl}</div>${html}`;
1414
1570
  }
1415
- // 没有标题行:只有「已筛选」提示(共 N 条需要标题行),放在列表上方
1416
- if (metaHtml !== '') html = `${metaHtml}${html}`;
1571
+ // 没有标题行:只有「已筛选」提示(共 N 条需要标题行),放在列表上方;包一层标题行壳,与有标题时同走对齐轴的内缩规则(文字落在轴上)
1572
+ if (metaHtml !== '') html = `<div data-kit-title-row="" class="${TITLE_GROUP_CLASS}">${metaHtml}</div>${html}`;
1417
1573
  }
1418
1574
  parts[slot] = html;
1419
1575
  }