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.
- package/package.json +3 -3
- package/packs/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- package/spec/generated/kit-app.schema.json +18 -2
- package/spec/generated/kit-page.schema.json +95 -0
- package/spec/kit-grammar.json +332 -75
- package/spec/kit-grammar.schema.json +1 -27
- package/src/app/app-config.ts +11 -5
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +82 -10
- package/src/app/define-kit-app.ts +6 -5
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +20 -8
- package/src/app/kit-view-context.ts +30 -4
- package/src/app/server-pages.ts +5 -1
- package/src/app/server.ts +15 -5
- package/src/app/theme-endpoint.ts +1 -1
- package/src/app/theme-runtime.ts +7 -2
- package/src/base/alert.ts +23 -20
- package/src/base/anchored-layer.ts +1 -1
- package/src/base/button.ts +34 -17
- package/src/base/cascader.ts +8 -4
- package/src/base/check-core.ts +9 -6
- package/src/base/color-picker.ts +10 -6
- package/src/base/command-palette.ts +10 -4
- package/src/base/context-menu.ts +5 -2
- package/src/base/date-range.ts +9 -6
- package/src/base/date.ts +10 -6
- package/src/base/delta.ts +4 -2
- package/src/base/divider.ts +15 -66
- package/src/base/end-edge.ts +14 -2
- package/src/base/fab.ts +11 -6
- package/src/base/gap-value.ts +25 -5
- package/src/base/hint-tips.ts +1 -1
- package/src/base/illustrations.ts +2 -1
- package/src/base/index.ts +20 -4
- package/src/base/inline-error.ts +84 -0
- package/src/base/input.ts +54 -18
- package/src/base/kbd.ts +4 -3
- package/src/base/link.ts +1 -1
- package/src/base/listbox-core.ts +70 -22
- package/src/base/mentions.ts +6 -3
- package/src/base/menu-button.ts +73 -50
- package/src/base/menu-core.ts +9 -2
- package/src/base/motion/hover-3d.ts +4 -1
- package/src/base/motion/hover-gallery.ts +4 -1
- package/src/base/otp.ts +7 -3
- package/src/base/overlay-runtime.ts +3 -2
- package/src/base/overlay-shell.ts +141 -0
- package/src/base/popover.ts +7 -6
- package/src/base/popup.ts +47 -41
- package/src/base/qty-stepper.ts +14 -9
- package/src/base/reason-tip.ts +2 -2
- package/src/{frames → base}/resize-handle.ts +1 -1
- package/src/base/segmented.ts +44 -35
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +52 -18
- package/src/base/state-panel.ts +34 -13
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +56 -57
- package/src/base/text.ts +38 -14
- package/src/base/textarea.ts +1 -1
- package/src/base/time-picker.ts +9 -5
- package/src/base/tree-select.ts +12 -9
- package/src/base/upload.ts +26 -17
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +10 -9
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +7 -6
- package/src/biz/category-crud/compile.ts +20 -6
- package/src/biz/category-crud/shell.ts +10 -7
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +15 -13
- package/src/biz/compose.ts +5 -5
- package/src/biz/data-components.ts +4 -0
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +17 -13
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +6 -5
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +269 -27
- package/src/biz/master-sub/detail-head.ts +62 -0
- package/src/biz/master-sub/index.ts +5 -4
- package/src/biz/master-sub/shell.ts +138 -69
- package/src/biz/multi-board/compile.ts +166 -11
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +25 -10
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +96 -24
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +15 -7
- package/src/biz/page-templates/domain-templates.ts +7 -3
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +5 -4
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
- package/src/biz/page-templates/sign-in-page/shell.ts +18 -18
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +12 -11
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +14 -10
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +83 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +76 -4
- package/src/biz/shared/overlay-shell.ts +65 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +13 -7
- package/src/biz/standard-crud/compile.ts +24 -4
- package/src/biz/standard-crud/shell.ts +38 -30
- package/src/biz/standard-crud/summary.ts +42 -0
- package/src/biz/step-form/compile.ts +1 -1
- package/src/biz/step-form/hub.ts +4 -0
- package/src/biz/step-form/shell.ts +16 -12
- package/src/biz/types.ts +15 -3
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +35 -8
- package/src/cli/kit-init.ts +149 -0
- package/src/cli/layout-cli.ts +7 -7
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +36 -230
- package/src/compile/component-candidates.ts +4 -1
- package/src/compile/hints.ts +5 -58
- package/src/compile/index.ts +2 -2
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +97 -18
- package/src/compile/layout-lint/rules-form.ts +6 -7
- package/src/compile/layout-lint/rules-table.ts +98 -14
- package/src/compile/page-composition.ts +191 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +80 -32
- package/src/compile/types.ts +5 -3
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +6 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +13 -5
- package/src/data/assignment-picker.ts +35 -20
- package/src/data/async-result-panel.ts +7 -3
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +10 -4
- package/src/data/carousel.ts +13 -5
- package/src/data/chart.ts +745 -48
- package/src/data/checklist.ts +9 -5
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +9 -3
- package/src/data/confirm-dialog.ts +57 -20
- package/src/data/diff.ts +4 -1
- package/src/data/dock.ts +5 -1
- package/src/data/embed.ts +1 -1
- package/src/data/engine-ports.ts +126 -0
- package/src/data/field-mapper.ts +16 -7
- package/src/data/flow-editor.ts +106 -29
- package/src/data/footer.ts +8 -2
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +8 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +22 -8
- package/src/data/item-list.ts +11 -3
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +13 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +400 -0
- package/src/data/media-grid.ts +5 -2
- package/src/data/mega-menu.ts +4 -3
- package/src/data/menu-dom.ts +9 -8
- package/src/data/menu.ts +35 -17
- package/src/data/mockup.ts +12 -8
- package/src/data/modal-dialog.ts +108 -57
- package/src/data/navbar.ts +13 -7
- package/src/data/notice-list.ts +53 -20
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +248 -151
- package/src/data/pager.ts +15 -10
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +19 -9
- package/src/data/permission-tree.ts +30 -13
- package/src/data/pricing-table.ts +10 -4
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +30 -14
- package/src/data/record-picker.ts +8 -4
- package/src/data/redirect.ts +1 -1
- package/src/data/request-console.ts +20 -7
- package/src/data/resident.ts +6 -10
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +12 -7
- package/src/data/rule-builder.ts +22 -11
- package/src/data/shape-util.ts +26 -14
- package/src/data/stat-group.ts +369 -84
- package/src/data/static-lazy.ts +7 -0
- package/src/data/static-registry.ts +14 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +13 -4
- package/src/data/system-switcher.ts +17 -7
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +8 -4
- package/src/data/transfer.ts +24 -11
- package/src/data/tree-table.ts +84 -17
- package/src/data/tree.ts +6 -3
- package/src/data/virtual-rows.ts +22 -11
- package/src/data/wrap.ts +2 -2
- package/src/data/wrapped-candidates.ts +22 -1
- package/src/frames/index.ts +4 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +123 -0
- package/src/frames/page-bar.ts +10 -16
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +37 -17
- package/src/frames/split-frame/shell.ts +17 -11
- package/src/frames/split-frame/wiring.ts +2 -2
- package/src/frames/tabs-frame/shell.ts +17 -9
- package/src/frames/top-main-frame.ts +1 -1
- package/src/frames/types.ts +6 -3
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +4 -3
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +156 -91
- package/src/generated/kit-grammar-runtime.ts +227 -58
- package/src/i18n/kit-text.ts +141 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +169 -0
- package/src/object-renderer/action-more.ts +160 -0
- package/src/object-renderer/arrange.ts +86 -26
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +72 -20
- package/src/object-renderer/collection-table.ts +178 -65
- package/src/object-renderer/collection.ts +129 -83
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +10 -5
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +7 -0
- package/src/object-renderer/emit-static.ts +243 -87
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +13 -2
- package/src/object-renderer/index.ts +6 -1
- package/src/object-renderer/layout-facts.ts +46 -6
- package/src/object-renderer/layout-plan.ts +136 -43
- package/src/object-renderer/layout-plan.types.ts +42 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/parts.ts +7 -259
- package/src/object-renderer/render-object.ts +60 -47
- package/src/object-renderer/table-actions.ts +135 -56
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +63 -25
- package/src/object-renderer/types.ts +16 -22
- package/src/recipes/app-blocks.ts +66 -0
- package/src/recipes/code-view.ts +56 -0
- package/src/recipes/compact-group.ts +31 -0
- package/src/recipes/container.ts +54 -13
- package/src/recipes/control.ts +77 -157
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +60 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +34 -1
- package/src/recipes/inherited-shell.ts +37 -0
- package/src/recipes/json-view.ts +49 -0
- package/src/recipes/markdown.ts +86 -0
- package/src/recipes/overlay.ts +149 -18
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +21 -5
- package/src/recipes/rail-grid.ts +3 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +20 -28
- package/src/recipes/status.ts +17 -8
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +120 -11
- package/src/recipes/tabs.ts +126 -0
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +7 -5
- package/src/recipes/typography.ts +24 -43
- package/src/shared/diagnostics.ts +16 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-value-format.ts +246 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +12 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- package/src/shared/path-guard.ts +1 -1
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/theme-runtime-shared.ts +19 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +49 -14
- package/src/theme/kit-theme.tpl +49 -14
- package/src/theme/nine-dim-structure.ts +129 -37
- package/src/theme/surface-layers.ts +17 -4
- package/src/theme/theme-tokens.ts +16 -5
- package/src/theme/typography.ts +21 -17
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- /package/src/{base → shared}/class-candidates.ts +0 -0
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
// MasterSubWorkstation 的 HTML 代码壳:只有结构和 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// 左栏主列表(控件列,无卡)与右栏详情(唯一容器)并排的容器档与栏份数由排布引擎 arrangeSplit 给出(主列表各列最小宽之和放得下才并排,
|
|
3
|
+
// 窄于它的容器档上下堆叠:主列表在上、限高可滚);分栏靠容器查询变体 `@<档>:`。弹窗壳复用 StandardCrud 的(同一套浮层基准)。
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { KIT_ARRANGE, arrangePaneWidth, type ArrangePaneWidthInput } from 'soma-foundation/arrange';
|
|
6
6
|
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
7
|
-
import {
|
|
7
|
+
import { kitFixedPaneClass } from '../../recipes/page-width';
|
|
8
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
8
9
|
import { KIT_MS_ASIDE_IDLE_ATTR, KIT_MS_ROOT_ATTR, KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
9
10
|
import { KIT_STATE_DESC_CLASS, KIT_STATE_EMPTY_BOX } from '../../recipes/placeholder';
|
|
11
|
+
import { KIT_STRIP_HEAD_CLASS, KIT_STRIP_HEAD_MIN_CLASS } from '../../recipes/strip';
|
|
12
|
+
import { KIT_DIVIDER_HEAD_CLASS, kitDividerVariantRecipe } from '../../recipes/divider';
|
|
13
|
+
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
14
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
15
|
+
import { tablesOnCanvas } from '../shared/compile-helpers';
|
|
10
16
|
import { cls, esc, host } from '../link/shared';
|
|
11
17
|
|
|
12
18
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -16,118 +22,181 @@ export type MasterSubArea = (typeof MASTER_SUB_AREAS)[number];
|
|
|
16
22
|
/** 卡片外观(圆角 + 容器边界色 + 凸起底 + 浅阴影):一份配方,三栏与区块同源,随九维边界维度变化 */
|
|
17
23
|
const CARD = kitShellRecipe();
|
|
18
24
|
|
|
19
|
-
/**
|
|
20
|
-
export
|
|
21
|
-
export type MasterWidth = (typeof MASTER_WIDTHS)[number];
|
|
25
|
+
/** 左窗格定档的输入(编译期由主列表的条目样本 / 表格列轨推出,见 compile.ts 的 paneSampleOf) */
|
|
26
|
+
export type MasterPaneSample = Omit<ArrangePaneWidthInput, 'withAside'>;
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
/** 主从分栏的编译期求解结果(引擎 arrangePaneWidth 的类投影) */
|
|
29
|
+
export interface MasterSplitClasses {
|
|
30
|
+
/** 分栏行:窄容器上下堆叠,并排线起左右排 */
|
|
31
|
+
row: string;
|
|
32
|
+
/** 左栏(主列表)类:并排时定宽(窗格档)不被挤压;堆叠时整行、限高可滚 */
|
|
25
33
|
left: string;
|
|
34
|
+
/** 右栏(详情;有辅助栏时为中栏)类:吃余宽 */
|
|
26
35
|
right: string;
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
/** 辅助栏类:并排时定宽(侧轨) */
|
|
37
|
+
aside: string;
|
|
38
|
+
/** 并排线(容器档名)与窗格宽(px);fits = 条目样本放得进最宽档 */
|
|
39
|
+
tier: string;
|
|
40
|
+
px: number;
|
|
41
|
+
fits: boolean;
|
|
30
42
|
}
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
left:
|
|
47
|
-
right: '
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
/**
|
|
45
|
+
* 主从分栏类:左窗格宽取 240 / 320 / 400 里「条目样本放得下的最小一档」(引擎 arrangePaneWidth,尺寸规格 §4),
|
|
46
|
+
* 并排线 = 窗格档 + 详情最小宽(+ 侧轨 320)放得下的最窄容器档;窄于它的容器上下堆叠(主列表在上、限高可滚)。
|
|
47
|
+
* 辅助栏收起(空闲态 hidden)时详情栏 flex-1 自然占满,不需要另一套份数。
|
|
48
|
+
*/
|
|
49
|
+
export function masterSubSplit(sample: MasterPaneSample, withAside: boolean): MasterSplitClasses {
|
|
50
|
+
const M = KIT_ARRANGE.masterSplit;
|
|
51
|
+
const plan = arrangePaneWidth({ ...sample, withAside });
|
|
52
|
+
const T = plan.tier;
|
|
53
|
+
const stackUnits = Math.round(M.stackedListMaxHeightRem / KIT_ARRANGE.columns.track.stepRem);
|
|
54
|
+
return {
|
|
55
|
+
// 窗格之间的分隔由父出(KT-B5):只在第一个窗格(主列表)之后画一条——堆叠时是横线、并排时是竖线(中缝)。
|
|
56
|
+
// 不用 divide-*:辅助栏空闲时 hidden 但仍是末子项,divide 会给详情窗格画上贴外框的结束边(KT-B6 贴边重线,边框普查 B01)
|
|
57
|
+
row: [`flex-col @${T}:flex-row`, kitDividerVariantRecipe('bottom', '*:first'), `@${T}:*:first:border-b-0`, kitDividerVariantRecipe('end', `@${T}:*:first`)].join(' '),
|
|
58
|
+
left: `${kitFixedPaneClass(plan.px, T)} @max-${T}:max-h-${stackUnits} @max-${T}:overflow-y-auto`,
|
|
59
|
+
right: 'flex-1',
|
|
60
|
+
aside: kitFixedPaneClass(M.pane.sideRailPx, T),
|
|
61
|
+
tier: T,
|
|
62
|
+
px: plan.px,
|
|
63
|
+
fits: plan.fits,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
52
66
|
|
|
53
|
-
/**
|
|
54
|
-
|
|
67
|
+
/**
|
|
68
|
+
* 左窗格底面(真源 masterSplit.listPaneSurface):凹面,亮色浅灰、暗色比右窗格的面板更深,两种模式下都分得开。
|
|
69
|
+
* 画在伪元素上(不是窗格自己的 bg-surface-* 类):窗格不成为表面容器,窗格里的 bg-surface(选中条目的白面)仍取外框的面板层,
|
|
70
|
+
* 与右窗格同一个面——选中条目才能与详情连成一体;窗格自己带凹面类会被表面层标注当成更深一层,里面的 bg-surface 也跟着变凹。
|
|
71
|
+
*/
|
|
72
|
+
const LIST_PANE_SURFACE = `relative isolate before:absolute before:inset-0 before:-z-10 before:bg-surface-${KIT_ARRANGE.masterSplit.listPaneSurface}`;
|
|
55
73
|
|
|
56
74
|
export const MASTER_SUB_CLASS = {
|
|
57
75
|
// 根不设 gap:根的子节点里有两个零高度的中枢 / 桥接宿主 div,flex gap 会给每个宿主各多出一份间距(原 32px);
|
|
58
76
|
// 栅格与浮层壳之间本就不需要间距(对话框是 fixed 浮层)
|
|
59
77
|
root: '@container group/ms flex flex-col',
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
// items-start:两栏各按内容定高、顶对齐(主列表不被拉成与详情等高的一整列空白)
|
|
79
|
+
// 分栏视图:一个 1px 发丝线外框把左右窗格框成一体(窗格之间无间隙,区域靠「面差 + 线」,不靠浮起的小卡);两窗格顶 / 底对齐(items-stretch)
|
|
80
|
+
// 外缘只由面板配方画(KT-B2:读容器令牌,随边界档、嵌套去框、容器阴影一处真源);两窗格之间的中缝由父出(KT-B5:divide,窄档上下堆叠时是横线、并排时是竖线)
|
|
81
|
+
grid: mergeClass('flex items-stretch overflow-hidden', kitSurfaceRecipe('panel')),
|
|
62
82
|
// 摘要与左栏、区块同为一张卡(section 标签,随容器边界规则);中栏本身只是纯结构 div,不画框
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
// 从属区是同一张面板:摘要与各从属块是面板里的分段(段间只靠 gap-section 间距 + 小节标题分组,无通栏线),分段本身不再是卡、不再内缩
|
|
84
|
+
// 右窗格(详情)是白面,外框由分栏 grid 画,自己不再是卡
|
|
85
|
+
subPanel: 'flex h-full min-w-0 flex-col',
|
|
86
|
+
/** 详情正文(头下面):概况 / 页内页签 / 子区,分段靠间距;与窗格头同一条左右轴(p-card) */
|
|
87
|
+
subBody: 'flex min-w-0 flex-1 flex-col gap-section p-card',
|
|
88
|
+
masterSummary: 'flex min-w-0 flex-col gap-region',
|
|
89
|
+
/** 窗格头(两个窗格同高:通用头部条 sizeSpec.strip.headPx):左 = 筛选,右 = 详情头;下缘一条发丝线,两条线在同一高度 */
|
|
90
|
+
paneHead: `flex ${KIT_STRIP_HEAD_CLASS} shrink-0 items-center gap-region ${KIT_DIVIDER_HEAD_CLASS} px-card`,
|
|
91
|
+
/** 左窗格头里的筛选(下拉与搜索并排一行)/ 无筛选时的列表名 */
|
|
92
|
+
paneFilter: 'block min-w-0 flex-1',
|
|
93
|
+
paneCaption: mergeClass('min-w-0 truncate', kitTypographyRecipe('sectionTitle')),
|
|
94
|
+
/** 左窗格的列表滚动区:右缘外延 1px 盖过窗格间分隔线,选中条目(白面)与右窗格连成一体 */
|
|
95
|
+
paneScroll: 'min-h-0 flex-1 overflow-y-auto -me-px', // 同时打 data-kit-axis="pane"(列表标题 / 筛选提示行直接子节点吃轴内缩)
|
|
96
|
+
/** 详情头:对象名 + 编码 + 状态在左、对选中对象的动作在右(最小高 = 窗格头,多行长标题自适应撑开不削顶);下面是关键数 / 事实 */
|
|
97
|
+
// flex-wrap:同一行放不下「对象名 + 编码 + 状态」与动作时,动作整组换到下一行,而不是把对象名挤成一字一行(@320 mcp 接口配置;渲染判定 W04)
|
|
98
|
+
// @container:详情头按钮组(KitTableActions look: button)按详情头宽度收起次要动作进「更多」(AR45)
|
|
99
|
+
detailHead: `@container flex ${KIT_STRIP_HEAD_MIN_CLASS} shrink-0 flex-wrap items-center justify-between gap-region ${KIT_DIVIDER_HEAD_CLASS} px-card py-2`,
|
|
100
|
+
detailHeadMain: 'min-w-0 flex-1',
|
|
101
|
+
detailHeadActions: 'shrink-0',
|
|
102
|
+
detailHeadBand: 'flex min-w-0 flex-col gap-region',
|
|
103
|
+
subBlock: 'flex min-w-0 flex-col gap-region',
|
|
104
|
+
subTitle: mergeClass('min-w-0 truncate', kitTypographyRecipe('sectionTitle')),
|
|
70
105
|
/** 未选中任何主行:整个从属区一处空态(面板 + 居中说明文字) */
|
|
71
|
-
emptyBox: KIT_STATE_EMPTY_BOX
|
|
106
|
+
emptyBox: `${KIT_STATE_EMPTY_BOX} px-card`,
|
|
72
107
|
emptyText: KIT_STATE_DESC_CLASS,
|
|
73
|
-
/** 有辅助栏(aside)时的三栏:4 / 5 / 3 */
|
|
74
|
-
masterListWithAside: mergeClass(`col-span-12 ${MASTER_SUB_WIDTH_CLASS.default.leftAside} flex min-w-0 flex-col gap-4 p-4`, CARD),
|
|
75
|
-
// 辅助栏是尚无结果的结果面板时(根上 data-kit-aside-idle):辅助栏收起、中栏占满(缺省档 8 份;变体类写死在 MASTER_SUB_WIDTH_CLASS,状态标记由 AsyncResultPanel 切)
|
|
76
|
-
subWorkspaceWithAside: `col-span-12 ${MASTER_SUB_WIDTH_CLASS.default.midAside} flex min-w-0 flex-col gap-4`,
|
|
77
108
|
// self-start:辅助栏(结果 / 说明)按内容定高,不拉成与最高一栏等高的一整列空白卡
|
|
78
|
-
|
|
109
|
+
asideBase: mergeClass('self-start flex min-w-0 flex-col gap-section p-card group-data-kit-aside-idle/ms:hidden', CARD),
|
|
79
110
|
} as const;
|
|
80
111
|
|
|
81
112
|
/** 压平标记(卡里子对象自己的容器壳不再画第二层),见 recipes/container 与 theme/nine-dim-structure */
|
|
82
113
|
const FLAT = KIT_SHELL_FLAT_MARK;
|
|
83
114
|
|
|
84
|
-
export function masterSubIds(pageId: string): { root: string; hub: string; coord: string; link: string; subs: string; empty: string } {
|
|
115
|
+
export function masterSubIds(pageId: string): { root: string; hub: string; coord: string; link: string; subs: string; empty: string; head: string; actions: string } {
|
|
85
116
|
return {
|
|
117
|
+
/** 详情头动作区的组件实例(KitTableActions look: button,row = 选中行镜像) */
|
|
118
|
+
actions: `${pageId}__ms_actions`,
|
|
86
119
|
root: `${pageId}__ms_root`, hub: `${pageId}__hub`, coord: `${pageId}__coord`, link: `${pageId}_link`,
|
|
87
120
|
/** 从属区面板外层(选中了主行才显示)与未选中空态外层(没有选中项才显示):外层只放 core 写的 hidden,布局类在内层 */
|
|
88
121
|
subs: `${pageId}__ms_subs`, empty: `${pageId}__ms_empty`,
|
|
122
|
+
/** 详情头(对象名 + 编码 + 状态徽标)的组件实例 */
|
|
123
|
+
head: `${pageId}__ms_head`,
|
|
89
124
|
};
|
|
90
125
|
}
|
|
91
126
|
|
|
92
127
|
export interface SubBlock {
|
|
93
128
|
title: string;
|
|
94
129
|
html: string;
|
|
130
|
+
/** 分组名(subs.<名>.group):同组从属收进详情里的页内页签的同一签;缺省 = 详情顶部常显区 */
|
|
131
|
+
group?: string;
|
|
132
|
+
/** 页面构成的强调级(首个主体 primary,其余 secondary);缺省 secondary */
|
|
133
|
+
emphasis?: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 一个从属块(标题 + 内容;强调级写在宿主节点上,标题 / 指标 / 图表尺度随级别走,块本身无容器) */
|
|
137
|
+
export function subBlockHtml(s: SubBlock, areaClass: Record<string, string>): string {
|
|
138
|
+
const title = s.title === '' ? '' : `<h3${cls(MASTER_SUB_CLASS.subTitle)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(s.title)}</h3>`;
|
|
139
|
+
return `<div data-kit-emphasis="${s.emphasis ?? 'secondary'}" data-kit-container="plain" data-kit-contained=""${cls(mergeClass(MASTER_SUB_CLASS.subBlock, areaClass.subBlock))}>${title}${s.html}</div>`;
|
|
95
140
|
}
|
|
96
141
|
|
|
97
142
|
/** 整个壳:中枢 + 左右分栏 + 弹窗。区域类按 7.3 同族规则覆写 */
|
|
98
143
|
export function masterSubHtml(
|
|
99
144
|
ids: ReturnType<typeof masterSubIds>,
|
|
100
|
-
parts: {
|
|
145
|
+
parts: {
|
|
146
|
+
master: string; summary: string; subs: SubBlock[]; /** 分组页签块(已渲染,在常显区之后) */ tabs?: string; dialog: string; aside?: string;
|
|
147
|
+
/** 详情头(KitDetailHead 实例,已渲染):在详情最上面,替代摘要里的对象名 / 编码 */ head?: string;
|
|
148
|
+
/** 详情头右侧的动作区(KitTableActions look: button 实例,已渲染):对选中对象的动作(主动作实心、其余次级或进「更多」、危险在末) */ headActions?: string;
|
|
149
|
+
/** 头带(详情头成员:关键数 / 事实,已渲染):在详情正文最上面 */ headBand?: string;
|
|
150
|
+
/** 左窗格头:筛选(已渲染;下拉与搜索并排一行),没有筛选时为空串 */ paneHead?: string;
|
|
151
|
+
/** 窗格头里筛选右侧的「清除筛选」(集合 meta 实例的并入形态,已渲染;没有为空串) */ paneMeta?: string;
|
|
152
|
+
/** 没有筛选时窗格头里的列表名(取主对象主字段的名字);也没有则窗格头留空 */ paneCaption?: string;
|
|
153
|
+
/** 主列表形态(引擎 arrangeMasterListForm):item = 条目(落窗格面上);table = 表格行(落画布层) */ listForm?: 'item' | 'table';
|
|
154
|
+
/** 辅助栏是结果面板(AsyncResultPanel):初始按「尚无结果」收起,面板有内容时由它去掉根上的标记 */ asideIdleInit?: boolean;
|
|
155
|
+
/** 左窗格定档的条目样本 / 表格列轨(缺省 = 不知道,取默认档) */ pane?: MasterPaneSample;
|
|
156
|
+
/** 未选中空态文案(已按语言取好 / 页面声明覆盖) */ unselectedText: string;
|
|
157
|
+
},
|
|
101
158
|
areaClass: Record<string, string>,
|
|
102
159
|
extra: string | undefined,
|
|
103
160
|
): string {
|
|
104
161
|
const withAside = parts.aside !== undefined && parts.aside !== '';
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
162
|
+
const S = masterSubSplit(parts.pane ?? { form: 'table' }, withAside);
|
|
163
|
+
// 主列表是详情的控件(页面构成 C1:master 先于顺序):无卡的定宽列,强调级 tertiary(列内行动作等有色强调降到三级,不压过详情);
|
|
164
|
+
// 列高随内容(grid items-start),与详情卡顶对齐
|
|
165
|
+
// 左窗格:浅一档的面(bg-surface-band)+ 与右窗格之间一条 1px 分隔线(并排时在右缘,堆叠时在下缘)
|
|
166
|
+
const leftBase = `${S.left} flex min-w-0 flex-col ${LIST_PANE_SURFACE}`;
|
|
167
|
+
const rightBase = `${S.right} flex min-w-0 flex-col`;
|
|
168
|
+
// data-kit-layer="0":无卡列直接落在画布上,列内的表面令牌(粘性操作列的底色伪元素等)取画布层,不取白色面板层
|
|
169
|
+
// aside 地标:控件列是详情的辅助导航(选择对象的那一列)
|
|
170
|
+
// 窗格对齐轴(data-kit-axis="pane",值非空:页面编译只给「空值」的轴打页头标记):筛选带内容 / 「已筛选」提示 / 表头与条目文字同落在 p-card 内缩的左轴,带与行底仍通栏
|
|
171
|
+
// 窗格头(筛选 / 列表名,高 = 详情头)+ 列表滚动区;表格形态(列表条目放不下以外的少数页)仍落画布层
|
|
172
|
+
const filter = parts.paneHead ?? '';
|
|
173
|
+
const caption = parts.paneCaption ?? '';
|
|
174
|
+
const paneHeadInner = filter !== '' ? `<div${cls(MASTER_SUB_CLASS.paneFilter)}>${filter}</div>${parts.paneMeta ?? ''}` : caption !== '' ? `<span${cls(MASTER_SUB_CLASS.paneCaption)}>${esc(caption)}</span>` : '';
|
|
175
|
+
const paneHeadHtml = `<div data-kit-pane-head=""${cls(MASTER_SUB_CLASS.paneHead)}>${paneHeadInner}</div>`;
|
|
176
|
+
const asTable = parts.listForm === 'table';
|
|
177
|
+
const left = `<aside${asTable ? ' data-kit-layer="0"' : ''} data-kit-emphasis="secondary" data-kit-role="control" data-kit-container="plain" data-kit-axis="pane" data-kit-pane="list"${cls(mergeClass(leftBase, areaClass.masterList))}>${paneHeadHtml}<div data-kit-axis="pane"${cls(MASTER_SUB_CLASS.paneScroll)}>${asTable ? tablesOnCanvas(parts.master) : parts.master}</div></aside>`;
|
|
111
178
|
// 分段是面板里的 div(不是 section,不参与容器边界规则,不再自己画卡)
|
|
112
179
|
const summary = parts.summary === ''
|
|
113
180
|
? ''
|
|
114
181
|
: `<div${cls(mergeClass(MASTER_SUB_CLASS.masterSummary, areaClass.masterSummary))}>${parts.summary}</div>`;
|
|
115
|
-
//
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const segments = [summary, ...blocks].filter((x) => x !== '').join('\n');
|
|
122
|
-
// 中栏是纯结构 div
|
|
123
|
-
const panel = `<div data-soma-id="${esc(ids.subs)}"><section${cls(MASTER_SUB_CLASS.subPanel)}${FLAT}>${segments}</section></div>`;
|
|
124
|
-
|
|
182
|
+
// 详情头一行:对象名 + 编码 + 状态在左,对选中对象的动作在右(没有头成员时不画);头下的关键数 / 事实(头带)进正文最上面
|
|
183
|
+
const headActions = parts.headActions === undefined || parts.headActions === '' ? '' : `<div data-kit-detail-actions=""${cls(MASTER_SUB_CLASS.detailHeadActions)}>${parts.headActions}</div>`;
|
|
184
|
+
const head = parts.head === undefined || parts.head === '' ? '' : `<header data-kit-detail-head="" data-kit-emphasis="primary" data-kit-container="plain"${cls(MASTER_SUB_CLASS.detailHead)}><div${cls(MASTER_SUB_CLASS.detailHeadMain)}>${parts.head}</div>${headActions}</header>`;
|
|
185
|
+
const headBand = parts.headBand === undefined || parts.headBand === '' ? '' : `<div${cls(MASTER_SUB_CLASS.detailHeadBand)}>${parts.headBand}</div>`;
|
|
186
|
+
// 分段靠间距(面板 gap-section)与小节标题分组,不画通栏分隔线(评审 D1–D8:空白是第一分组手段)
|
|
187
|
+
const blocks = parts.subs.filter((s) => s.group === undefined).map((s) => subBlockHtml(s, areaClass));
|
|
188
|
+
const segments = [headBand, summary, ...blocks, parts.tabs ?? ''].filter((x) => x !== '').join('\n');
|
|
189
|
+
// 中栏是纯结构 div(不画框):选中了主行显示一张从属面板(唯一容器,强调 primary),没有选中项显示一处整区空态;两者互斥,外层只放 hidden
|
|
190
|
+
const panel = `<div class="flex-1" data-soma-id="${esc(ids.subs)}"><section data-kit-emphasis="primary" data-kit-container="plain"${cls(MASTER_SUB_CLASS.subPanel)}${FLAT}>${head}<div${cls(MASTER_SUB_CLASS.subBody)}>${segments}</div></section></div>`;
|
|
191
|
+
// 未选中时的整区空态与详情面板同一个位置、同一种无外观容器(plain:边由主从外框给,不再自画一圈)
|
|
192
|
+
const empty = `<div class="flex-1" data-soma-id="${esc(ids.empty)}"><section data-kit-container="plain"${cls(MASTER_SUB_CLASS.subPanel)}${FLAT}>`
|
|
193
|
+
+ `<div data-kit-pane-head=""${cls(MASTER_SUB_CLASS.paneHead)}></div>`
|
|
125
194
|
+ `<div role="status" data-kit-state="empty"${cls(MASTER_SUB_CLASS.emptyBox)}><span${cls(MASTER_SUB_CLASS.emptyText)}>${esc(parts.unselectedText)}</span></div></section></div>`;
|
|
126
195
|
// data-kit-vt:页面过渡的内容区命名点(选中项切换时右侧内容淡入淡出,见 hub 的 withKitViewTransition)
|
|
127
196
|
const right = `<div data-kit-vt=""${cls(mergeClass(rightBase, areaClass.subWorkspace))}>${empty}\n${panel}</div>`;
|
|
128
|
-
const aside = withAside ? `<aside${cls(mergeClass(
|
|
197
|
+
const aside = withAside ? `<aside data-kit-container="card"${cls(mergeClass(`${S.aside} ${MASTER_SUB_CLASS.asideBase}`, areaClass.aside))}${FLAT}>${parts.aside}</aside>` : '';
|
|
129
198
|
const root = mergeClass(mergeClass(MASTER_SUB_CLASS.root, areaClass.root), extra);
|
|
130
199
|
const msAttrs = ` ${KIT_MS_ROOT_ATTR}=""${withAside && parts.asideIdleInit === true ? ` ${KIT_MS_ASIDE_IDLE_ATTR}=""` : ''}`;
|
|
131
200
|
return `<div data-soma-id="${esc(ids.root)}"${msAttrs}${cls(root)}>\n${host('KitLinkHub', ids.hub)}${host('KitCrudBridge', ids.coord)}\n`
|
|
132
|
-
+ `<div${cls(MASTER_SUB_CLASS.grid)}>\n${[left, right, aside].filter((x) => x !== '').join('\n')}\n</div>\n${parts.dialog}\n</div>`;
|
|
201
|
+
+ `<div${cls(`${MASTER_SUB_CLASS.grid} ${S.row}`)}>\n${[left, right, aside].filter((x) => x !== '').join('\n')}\n</div>\n${parts.dialog}\n</div>`;
|
|
133
202
|
}
|
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
// 接口必须直接返回对象(StatGroup,accept: single)或数组(Chart,accept: list);只有 list 视图的面板才走 { rows, total } 信封。
|
|
16
16
|
// · 筛选对象没有 from,其 data 对象只有 fields(core 注册已确认可收)。
|
|
17
17
|
|
|
18
|
+
import { KIT_ARRANGE } from 'soma-foundation/arrange';
|
|
18
19
|
import { filterAnchor } from '../../object-renderer/compile-data';
|
|
19
20
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
21
|
+
import { groupTabsFrame } from '../../object-renderer/emit-static';
|
|
22
|
+
import { KIT_CLASS_DEFAULTS } from '../../object-renderer/defaults';
|
|
20
23
|
import { dropSliceReload, registerSliceReload } from '../../object-renderer/filter-reload';
|
|
21
|
-
import { checkClasses } from '../../
|
|
24
|
+
import { checkClasses } from '../../shared/merge-class';
|
|
22
25
|
import type { KitObject } from '../../object-renderer/types';
|
|
23
|
-
import type { KitFragment } from '../../
|
|
26
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
24
27
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
25
28
|
import {
|
|
26
29
|
bizObjectName, finishBizCompile, validateBizAreaClass,
|
|
@@ -30,14 +33,36 @@ import {
|
|
|
30
33
|
type FieldSlots, type Rec,
|
|
31
34
|
} from '../link/shared';
|
|
32
35
|
import { MultiObjectBoard } from './index';
|
|
36
|
+
import { KIT_BOARD_PROSE_CLASS_CANDIDATES } from './prose-fold';
|
|
33
37
|
import {
|
|
34
|
-
MULTI_BOARD_AREAS, MULTI_BOARD_CLASS, MULTI_BOARD_GRID_SPANS, MULTI_BOARD_SPANS,
|
|
38
|
+
appendPanelFooter, boardGridHtml, MULTI_BOARD_AREAS, MULTI_BOARD_CLASS, MULTI_BOARD_GRID_SPANS, MULTI_BOARD_SPANS, multiBoardHtml, multiBoardIds,
|
|
35
39
|
type BoardPanelBlock,
|
|
36
40
|
} from './shell';
|
|
41
|
+
import { appRolesOf, boardCompositionNodes, boardPanelKind, composeBoard } from './composition';
|
|
37
42
|
|
|
38
43
|
/** 面板里 builtin 动作的闭集:看板没有表单 / 浮层,只许刷新 */
|
|
39
44
|
const PANEL_BUILTINS: ReadonlySet<string> = new Set(['reload']);
|
|
40
45
|
|
|
46
|
+
/** 面板是不是「collapse 的 NoticeList、无标题、不改跨度 / 类」:是则返回 props 所在位置(view 散键或 view.list) */
|
|
47
|
+
function noticeFooterHolder(raw: Rec): 'view' | 'list' | null {
|
|
48
|
+
if (typeof raw.title === 'string' && raw.title !== '') return null;
|
|
49
|
+
if (raw.span !== undefined || raw.class !== undefined || !isRec(raw.view)) return null;
|
|
50
|
+
const v = raw.view as Rec;
|
|
51
|
+
const at = v.staticComponent === 'NoticeList' ? 'view' : isRec(v.list) && (v.list as Rec).staticComponent === 'NoticeList' ? 'list' : null;
|
|
52
|
+
if (at === null) return null;
|
|
53
|
+
const holder = at === 'view' ? v : (v.list as Rec);
|
|
54
|
+
return isRec(holder.props) && (holder.props as Rec).collapse === true ? at : null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** 复制面板声明并给 NoticeList 写 footer: true(不改原声明) */
|
|
58
|
+
function withNoticeFooter(raw: Rec): Rec {
|
|
59
|
+
const at = noticeFooterHolder(raw);
|
|
60
|
+
const v = raw.view as Rec;
|
|
61
|
+
if (at === 'view') return { ...raw, view: { ...v, props: { ...(v.props as Rec), footer: true } } };
|
|
62
|
+
const list = v.list as Rec;
|
|
63
|
+
return { ...raw, view: { ...v, list: { ...list, props: { ...(list.props as Rec), footer: true } } } };
|
|
64
|
+
}
|
|
65
|
+
|
|
41
66
|
export function boardFilterName(pageId: string): string {
|
|
42
67
|
return bizObjectName(pageId, 'filter');
|
|
43
68
|
}
|
|
@@ -80,6 +105,23 @@ export function compileMultiBoard(input: KitBizInput, ctx: KitBizContext): KitFr
|
|
|
80
105
|
else out.diagnostics.push(...checkClasses(s.class, `${at}.class`));
|
|
81
106
|
}
|
|
82
107
|
if (s.title !== undefined && typeof s.title !== 'string') fail('KIT-PAGE-001', `panels.${n}.title 必须是字符串`, `${at}.title`);
|
|
108
|
+
if (s.group !== undefined && (typeof s.group !== 'string' || s.group.trim() === '')) {
|
|
109
|
+
fail('KIT-PAGE-001', `panels.${n}.group 必须是非空字符串(面板组名,同名面板收进页内页签的同一签)`, `${at}.group`);
|
|
110
|
+
}
|
|
111
|
+
if (s.head !== undefined) {
|
|
112
|
+
const host = typeof s.head === 'string' ? s.head.trim() : '';
|
|
113
|
+
const hostRaw = host === '' ? undefined : rawPanels[host];
|
|
114
|
+
if (host === '' || !isRec(hostRaw)) {
|
|
115
|
+
fail('KIT-PAGE-001', `panels.${n}.head 必须是另一个面板的名字(面板头控件槽位:本面板的控件画在宿主面板标题行右侧)`, `${at}.head`);
|
|
116
|
+
} else if (host === n || hostRaw.head !== undefined) {
|
|
117
|
+
fail('KIT-PAGE-001', `panels.${n}.head 不能指向自己或另一个面板头控件("${host}")`, `${at}.head`);
|
|
118
|
+
} else if (!isStatic) {
|
|
119
|
+
fail('KIT-PAGE-001', `panels.${n} 是面板头控件,必须是写死形状组件(staticComponent:SegmentedSwitch / MetaAction / ScopeSwitch 等)`, `${at}.view`);
|
|
120
|
+
}
|
|
121
|
+
for (const k of ['title', 'span', 'class', 'group'] as const) {
|
|
122
|
+
if (s[k] !== undefined) fail('KIT-PAGE-001', `panels.${n} 是面板头控件,不写 ${k}(位置与分组随宿主面板 "${host}")`, `${at}.${k}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
83
125
|
}
|
|
84
126
|
if (out.diagnostics.length > 0) return finishBizCompile(out, '');
|
|
85
127
|
|
|
@@ -123,9 +165,14 @@ export function compileMultiBoard(input: KitBizInput, ctx: KitBizContext): KitFr
|
|
|
123
165
|
}
|
|
124
166
|
|
|
125
167
|
// ---- 展示对象
|
|
126
|
-
const panels: Array<{ name: string; object: string; scope: string; obj: KitObject; title: string; span: number; class: string; hasFrom: boolean }> = [];
|
|
168
|
+
const panels: Array<{ name: string; object: string; scope: string; obj: KitObject; title: string; span: number | undefined; class: string; group: string; footer: boolean; hasFrom: boolean; headOf: string }> = [];
|
|
127
169
|
for (const n of panelNames) {
|
|
128
|
-
|
|
170
|
+
let raw = rawPanels[n] as unknown as Rec;
|
|
171
|
+
const headOf = typeof raw.head === 'string' ? raw.head.trim() : '';
|
|
172
|
+
// 数据说明归属它所说明的面板:紧跟在某面板之后(同组)、无标题、collapse 的 NoticeList 面板并为前一面板的页脚(面板头控件不是面板,不打断「紧跟」)
|
|
173
|
+
const prev = [...panels].reverse().find((x) => x.headOf === '');
|
|
174
|
+
const asFooter = headOf === '' && prev !== undefined && prev.group === (typeof raw.group === 'string' ? raw.group.trim() : '') && noticeFooterHolder(raw) !== null;
|
|
175
|
+
if (asFooter) raw = withNoticeFooter(raw);
|
|
129
176
|
const own = isRec(raw.behavior) && isRec((raw.behavior as Rec).params) ? ((raw.behavior as Rec).params as Rec) : {};
|
|
130
177
|
const params: Record<string, string> = {};
|
|
131
178
|
for (const [k, v] of Object.entries(filterParams)) if (!(k in own)) params[k] = v;
|
|
@@ -150,27 +197,120 @@ export function compileMultiBoard(input: KitBizInput, ctx: KitBizContext): KitFr
|
|
|
150
197
|
scope: `${object}_scope`,
|
|
151
198
|
obj: norm.obj,
|
|
152
199
|
title: typeof raw.title === 'string' ? raw.title : '',
|
|
153
|
-
span: typeof raw.span === 'number' ? raw.span :
|
|
200
|
+
span: typeof raw.span === 'number' ? raw.span : undefined,
|
|
154
201
|
class: typeof raw.class === 'string' ? raw.class : '',
|
|
202
|
+
group: typeof raw.group === 'string' ? raw.group.trim() : '',
|
|
203
|
+
footer: asFooter,
|
|
155
204
|
hasFrom: norm.obj.behavior.from !== undefined,
|
|
205
|
+
headOf,
|
|
156
206
|
});
|
|
157
207
|
}
|
|
158
208
|
if (out.diagnostics.length > 0) return finishBizCompile(out, '');
|
|
159
209
|
|
|
210
|
+
// ---- 页面构成(C1–C7):面板声明 → 构成节点 → solveComposition(角色 / 附着 / 强调级 / 容器 / 栅格份数 / hero),编译期定,运行时不测量
|
|
211
|
+
const plan = composeBoard(boardCompositionNodes(
|
|
212
|
+
panels.filter((p) => !p.footer).map((p) => ({ name: p.name, kind: boardPanelKind(rawPanels[p.name] as unknown as Rec), group: p.group, head: p.headOf, span: p.span })),
|
|
213
|
+
appRolesOf(ctx.staticComponents),
|
|
214
|
+
));
|
|
215
|
+
|
|
160
216
|
const fieldSteps: FieldSlots = [];
|
|
161
217
|
const blocks: BoardPanelBlock[] = [];
|
|
218
|
+
const heroItems: Array<{ title: string; html: string; name: string; kind: string }> = [];
|
|
219
|
+
/** 概况条成员的范围切换类控件(head-slot):上移到页头一行(标题右侧),不留在概况条里 */
|
|
220
|
+
const heroHeads: string[] = [];
|
|
221
|
+
/** 宿主面板名 -> 面板块(面板头控件的落点;并为页脚的面板不是宿主) */
|
|
222
|
+
const blockOf = new Map<string, BoardPanelBlock>();
|
|
223
|
+
const heads = new Map<string, string[]>();
|
|
224
|
+
const bands = new Map<string, string[]>();
|
|
225
|
+
const noteFooters = new Map<string, string[]>();
|
|
226
|
+
/** 构成分析附着(未显式写 head):宿主若不是独立面板(hero / 已并为页脚)则退回独立成块,不报错 */
|
|
227
|
+
const derivedAttach = new Map<string, { to: string; as: string; html: string; block: BoardPanelBlock }>();
|
|
162
228
|
for (const p of panels) {
|
|
163
229
|
const m = emitMember(out, { object: p.object, scope: p.scope, obj: p.obj, ctx, link, hubId: ids.coord, fieldSteps });
|
|
230
|
+
const pl = p.footer ? undefined : plan.placements[p.name];
|
|
231
|
+
// 面板头控件:不成面板,整块 HTML 放进宿主面板标题行右侧(宿主在后面声明也行,下面统一挂);概况类的头带挂在标题行下,说明类并为宿主页脚
|
|
232
|
+
if (p.headOf !== '') {
|
|
233
|
+
const headHtml = [m.r.parts.toolbar ?? '', m.r.parts.filter ?? '', m.listHtml, m.r.parts.summary ?? ''].filter((x) => x !== '').join('');
|
|
234
|
+
const as = pl?.attach?.as ?? 'head-slot';
|
|
235
|
+
const target = as === 'head-band' ? bands : as === 'footer' ? noteFooters : heads;
|
|
236
|
+
target.set(p.headOf, [...(target.get(p.headOf) ?? []), headHtml]);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
164
239
|
// 有标题:工具栏并入标题行右侧;无标题:工具栏仍在面板内容最前
|
|
165
240
|
const toolbarInTitle = p.title !== '' && (m.r.parts.toolbar ?? '') !== '';
|
|
166
|
-
|
|
241
|
+
const html = [toolbarInTitle ? '' : m.r.parts.toolbar ?? '', m.r.parts.filter ?? '', m.listHtml, m.r.parts.summary ?? ''].filter((x) => x !== '').join('\n');
|
|
242
|
+
if (p.footer && blocks.length > 0) {
|
|
243
|
+
appendPanelFooter(blocks[blocks.length - 1]!, html);
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
// 概况类(hero 槽):合成页面唯一的一条概况条,不成面板
|
|
247
|
+
if (pl?.slot === 'hero') {
|
|
248
|
+
heroItems.push({ title: p.title, html, name: p.name, kind: boardPanelKind(rawPanels[p.name] as unknown as Rec) });
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const block: BoardPanelBlock = {
|
|
167
252
|
title: p.title,
|
|
168
253
|
...(toolbarInTitle ? { toolbar: m.r.parts.toolbar! } : {}),
|
|
169
|
-
html
|
|
170
|
-
span:
|
|
254
|
+
html,
|
|
255
|
+
span: pl?.span ?? KIT_ARRANGE.composition.span.total,
|
|
256
|
+
emphasis: (pl?.emphasis ?? 'secondary') as NonNullable<BoardPanelBlock['emphasis']>,
|
|
257
|
+
container: pl?.container === 'plain' ? 'plain' : 'card',
|
|
171
258
|
...(p.class !== '' ? { class: p.class } : {}),
|
|
172
|
-
|
|
259
|
+
...(p.group !== '' ? { group: p.group } : {}),
|
|
260
|
+
};
|
|
261
|
+
// 构成分析附着(作者没写 head):控件进宿主标题行、说明并为宿主页脚;宿主不是独立面板时在下面退回独立成块
|
|
262
|
+
const att = pl?.attach;
|
|
263
|
+
if (att !== undefined && att !== null && (att.as === 'head-slot' || att.as === 'footer')) {
|
|
264
|
+
derivedAttach.set(p.name, { to: att.to, as: att.as, html: [m.r.parts.toolbar ?? '', m.r.parts.filter ?? '', m.listHtml, m.r.parts.summary ?? ''].filter((x) => x !== '').join(''), block });
|
|
265
|
+
blocks.push(block);
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
blocks.push(block);
|
|
269
|
+
blockOf.set(p.name, block);
|
|
270
|
+
}
|
|
271
|
+
// 推导的附着落位:宿主是独立面板才并入,否则保留为独立块
|
|
272
|
+
for (const [name, a] of derivedAttach) {
|
|
273
|
+
const host = blockOf.get(a.to);
|
|
274
|
+
if (host === undefined) { blockOf.set(name, a.block); continue; }
|
|
275
|
+
blocks.splice(blocks.indexOf(a.block), 1);
|
|
276
|
+
if (a.as === 'footer') appendPanelFooter(host, a.html);
|
|
277
|
+
else host.head = `${host.head ?? ''}${a.html}`;
|
|
278
|
+
}
|
|
279
|
+
// 概况条成员也可以是宿主:控件(head-slot)画成成员内容上方靠右的一行、头带 / 页脚说明接在内容前 / 后
|
|
280
|
+
const heroHost = (host: string): { html: string } | undefined => heroItems.find((h) => h.name === host);
|
|
281
|
+
// 概况条成员的头控件(范围切换):整块上移页头(hoist 标记,页面编译搬进 <header> 标题右侧;没有页头时留在原位靠右一行)
|
|
282
|
+
for (const [host, list] of heads) { if (heroHost(host) !== undefined) { heroHeads.push(list.join('')); heads.delete(host); } }
|
|
283
|
+
for (const [host, list] of bands) { const h = heroHost(host); if (h !== undefined) { h.html = `${h.html}${list.join('')}`; bands.delete(host); } }
|
|
284
|
+
for (const [host, list] of noteFooters) { const h = heroHost(host); if (h !== undefined) { h.html = `${h.html}${list.map((x) => `<div data-kit-panel-footer="">${x}</div>`).join('')}`; noteFooters.delete(host); } }
|
|
285
|
+
let headFailed = false;
|
|
286
|
+
for (const [host, list] of heads) {
|
|
287
|
+
const block = blockOf.get(host);
|
|
288
|
+
if (block === undefined) {
|
|
289
|
+
fail('KIT-PAGE-001', `面板头控件指向的宿主面板 "${host}" 不是独立面板(并为页脚的说明面板不能作宿主)`, `product.objects.panels.${host}`);
|
|
290
|
+
headFailed = true;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
block.head = `${block.head ?? ''}${list.join('')}`;
|
|
173
294
|
}
|
|
295
|
+
for (const [host, list] of bands) {
|
|
296
|
+
const block = blockOf.get(host);
|
|
297
|
+
if (block === undefined) {
|
|
298
|
+
fail('KIT-PAGE-001', `头带指向的宿主面板 "${host}" 不是独立面板`, `product.objects.panels.${host}`);
|
|
299
|
+
headFailed = true;
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
block.band = list.join('');
|
|
303
|
+
}
|
|
304
|
+
for (const [host, list] of noteFooters) {
|
|
305
|
+
const block = blockOf.get(host);
|
|
306
|
+
if (block === undefined) {
|
|
307
|
+
fail('KIT-PAGE-001', `页脚说明指向的宿主面板 "${host}" 不是独立面板`, `product.objects.panels.${host}`);
|
|
308
|
+
headFailed = true;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
for (const h of list) appendPanelFooter(block, h);
|
|
312
|
+
}
|
|
313
|
+
if (headFailed) return finishBizCompile(out, '');
|
|
174
314
|
if (fieldSteps.length > 0) {
|
|
175
315
|
fail('KIT-BIZ-003', '看板面板的 summary 不支持字段动作(请改用工具栏动作或列表行动作)', 'product.objects.panels');
|
|
176
316
|
return finishBizCompile(out, '');
|
|
@@ -204,6 +344,9 @@ export function compileMultiBoard(input: KitBizInput, ctx: KitBizContext): KitFr
|
|
|
204
344
|
};
|
|
205
345
|
|
|
206
346
|
// ---- 协作组件
|
|
347
|
+
out.components.add('KitBoardProse');
|
|
348
|
+
out.show[ids.prose] = { props: {} };
|
|
349
|
+
for (const c of KIT_BOARD_PROSE_CLASS_CANDIDATES) out.candidates.add(c);
|
|
207
350
|
out.show[ids.coord] = {
|
|
208
351
|
props: { scope: link, object: '', keyField: '', reloads: reloadable.map((p) => p.object), overlays: {}, ...linkRemoveProps(out) },
|
|
209
352
|
};
|
|
@@ -214,7 +357,19 @@ export function compileMultiBoard(input: KitBizInput, ctx: KitBizContext): KitFr
|
|
|
214
357
|
}
|
|
215
358
|
|
|
216
359
|
// ---- 壳
|
|
217
|
-
|
|
360
|
+
// ---- 面板组页签:未分组面板常显在页签之上(首屏区);同组面板收进同一签(组名按首次出现排序)。
|
|
361
|
+
// 所有面板对象与筛选 / 协调组件都已在上面一次编好,页签只改显隐(KitTabsWiring,不重新取数、不丢页面级状态)
|
|
362
|
+
const groupNames: string[] = [];
|
|
363
|
+
for (const b of blocks) if (b.group !== undefined && !groupNames.includes(b.group)) groupNames.push(b.group);
|
|
364
|
+
const topBlocks = blocks.filter((b) => b.group === undefined);
|
|
365
|
+
const tabsHtml = groupNames.length === 0
|
|
366
|
+
? ''
|
|
367
|
+
: groupTabsFrame(
|
|
368
|
+
`${ctx.pageId}__mb_tabs`, 'list', groupNames,
|
|
369
|
+
groupNames.map((g) => boardGridHtml(blocks.filter((b) => b.group === g), areaClass)),
|
|
370
|
+
KIT_CLASS_DEFAULTS.groupsWrap, out.show, out.components,
|
|
371
|
+
);
|
|
372
|
+
const html = multiBoardHtml(ids, { filter: filterHtml, panels: topBlocks, hub: useHub, tabs: tabsHtml, hero: heroItems, heroHead: heroHeads.join('') }, areaClass, input.class);
|
|
218
373
|
for (const c of classesIn(html)) out.candidates.add(c);
|
|
219
374
|
for (const c of Object.values(MULTI_BOARD_CLASS)) for (const t of c.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
220
375
|
for (const c of Object.values(MULTI_BOARD_SPANS)) for (const t of c.split(/\s+/)) if (t !== '' && html.includes(t)) out.candidates.add(t);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// MultiObjectBoard 的页面构成输入:把面板声明翻成构成分析的节点(角色按构件名查真源表,应用组件读注册元数据),再调 foundation 的 solveComposition。
|
|
2
|
+
// 编译(compile.ts)与布局体检(KIT-LAYOUT-041)共用这一份节点构造,不各写一份角色判定。
|
|
3
|
+
|
|
4
|
+
import { KIT_ARRANGE, arrangeComposition, arrangeTiers, compositionRoleOfKind } from 'soma-foundation/arrange';
|
|
5
|
+
import type { CompositionInput, CompositionNodeInput, CompositionPlan, CompositionRole } from 'soma-foundation/arrange';
|
|
6
|
+
|
|
7
|
+
/** 一个面板的构成输入事实(声明里读得出的,不看数据) */
|
|
8
|
+
export interface BoardPanelFact {
|
|
9
|
+
name: string;
|
|
10
|
+
/** 构件名:写死形状组件名(StatGroup / Chart / AppXxx …),否则 collection(列表 / 表格)或 KitObjectForm(表单) */
|
|
11
|
+
kind: string;
|
|
12
|
+
group: string;
|
|
13
|
+
head: string;
|
|
14
|
+
/** 作者写的栅格份数;没写 = undefined(由构成分析推导) */
|
|
15
|
+
span: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 面板声明(raw)→ 构件名:优先 view.staticComponent / view.summary.staticComponent / view.list.staticComponent,其次有 form 的面板是表单,其余是集合 */
|
|
19
|
+
export function boardPanelKind(raw: Record<string, unknown>): string {
|
|
20
|
+
const v = raw.view !== null && typeof raw.view === 'object' ? raw.view as Record<string, unknown> : {};
|
|
21
|
+
const pick = (o: unknown): string | undefined => (o !== null && typeof o === 'object' && typeof (o as Record<string, unknown>).staticComponent === 'string' ? (o as Record<string, string>).staticComponent : undefined);
|
|
22
|
+
const s = pick(v) ?? pick(v.summary) ?? pick(v.list);
|
|
23
|
+
if (s !== undefined) return s;
|
|
24
|
+
if (v.form !== undefined && v.list === undefined) return 'KitObjectForm';
|
|
25
|
+
return 'collection';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** 面板事实 → 构成节点(应用组件的角色取 appRoles,缺省 subject) */
|
|
29
|
+
export function boardCompositionNodes(panels: readonly BoardPanelFact[], appRoles: Readonly<Record<string, CompositionRole | undefined>> = {}): CompositionNodeInput[] {
|
|
30
|
+
return panels.map((p, order) => {
|
|
31
|
+
const override = appRoles[p.name] ?? appRoles[p.kind];
|
|
32
|
+
return {
|
|
33
|
+
id: p.name,
|
|
34
|
+
kind: p.kind,
|
|
35
|
+
...(override !== undefined ? { role: override } : {}),
|
|
36
|
+
...(p.group !== '' ? { group: p.group } : {}),
|
|
37
|
+
...(p.head !== '' ? { head: p.head } : {}),
|
|
38
|
+
...(p.span !== undefined ? { span: p.span } : {}),
|
|
39
|
+
order,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** 构成分析:容器档取「并排档」(栅格的窄容器退化由 `@md:` 容器查询在运行期完成,编译期按能并排的宽度推导份数) */
|
|
45
|
+
export function composeBoard(nodes: readonly CompositionNodeInput[], frame: CompositionInput['frame'] = 'single'): CompositionPlan {
|
|
46
|
+
const wide = arrangeTiers().find((t) => t.name === KIT_ARRANGE.composition.span.wideTier) ?? arrangeTiers()[arrangeTiers().length - 1]!;
|
|
47
|
+
const input: CompositionInput = { nodes, frame, tier: wide };
|
|
48
|
+
return arrangeComposition(input);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** 应用组件名 → 声明的构成角色(来自应用组件注册元数据 declareKitComposition,经 staticComponents 契约表传来) */
|
|
52
|
+
export function appRolesOf(staticComponents: Readonly<Record<string, { composition?: CompositionRole }>>): Record<string, CompositionRole> {
|
|
53
|
+
const out: Record<string, CompositionRole> = {};
|
|
54
|
+
for (const [name, c] of Object.entries(staticComponents)) if (c.composition !== undefined) out[name] = c.composition;
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { compositionRoleOfKind };
|