soma-kit 0.1.12 → 0.1.14
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/README.md +5 -4
- package/bin/soma-kit.mjs +31 -1
- package/bin/soma.mjs +0 -0
- package/package.json +5 -4
- package/spec/generated/kit-app.schema.json +172 -4
- package/spec/generated/kit-page.schema.json +164 -5
- package/spec/kit-grammar.json +598 -96
- package/spec/kit-grammar.schema.json +12 -6
- package/src/app/app-config.ts +92 -8
- package/src/app/component-gate.ts +271 -13
- package/src/app/define-kit-app.ts +2 -2
- package/src/app/define-kit-view.ts +9 -5
- package/src/app/dev-diagnostic.ts +5 -0
- package/src/app/index.ts +29 -5
- package/src/app/kit-view-context.ts +181 -15
- package/src/app/render-ports.ts +18 -0
- package/src/app/server-pages.ts +8 -2
- package/src/app/server.ts +55 -8
- package/src/app/theme-runtime.ts +4 -0
- package/src/base/action-busy.ts +101 -4
- package/src/base/action-slots.ts +13 -2
- package/src/base/anchored-layer.ts +50 -0
- package/src/base/button.ts +62 -15
- package/src/base/check-core.ts +8 -0
- package/src/base/checkbox.ts +2 -1
- package/src/base/choice.ts +21 -2
- package/src/base/color-picker.ts +10 -5
- package/src/base/command-palette.ts +1 -1
- package/src/base/context-menu.ts +10 -7
- package/src/base/date-range.ts +7 -7
- package/src/base/date.ts +55 -16
- package/src/base/delta.ts +72 -0
- package/src/base/end-edge.ts +61 -0
- package/src/base/fab.ts +1 -1
- package/src/base/gap-value.ts +168 -0
- package/src/base/hint-tips.ts +170 -0
- package/src/base/icons.ts +8 -0
- package/src/base/illustrations.ts +95 -0
- package/src/base/index.ts +32 -9
- package/src/base/listbox-core.ts +6 -5
- package/src/base/loading-gate.ts +140 -87
- package/src/base/mentions.ts +2 -1
- package/src/base/menu-button.ts +16 -18
- package/src/base/menu-core.ts +37 -8
- package/src/base/motion/hover-3d.ts +1 -1
- package/src/base/motion/marquee.ts +1 -1
- package/src/base/otp.ts +5 -4
- package/src/base/overlay-runtime.ts +235 -0
- package/src/base/popover.ts +10 -9
- package/src/base/popup.ts +67 -8
- package/src/base/portal-core.ts +4 -0
- package/src/base/qty-stepper.ts +5 -5
- package/src/base/radio.ts +2 -1
- package/src/base/range.ts +19 -2
- package/src/base/rating.ts +11 -6
- package/src/base/reason-tip.ts +150 -0
- package/src/base/segmented.ts +36 -24
- package/src/base/shared.ts +180 -36
- package/src/base/state-panel.ts +367 -0
- package/src/base/status-tone.ts +27 -0
- package/src/base/sticky-edge.ts +116 -0
- package/src/base/swap.ts +6 -6
- package/src/base/switch.ts +10 -5
- package/src/base/tag-input.ts +6 -6
- package/src/base/tag.ts +76 -41
- package/src/base/text.ts +43 -14
- package/src/base/time-picker.ts +7 -5
- package/src/base/tree-select.ts +6 -4
- package/src/base/trend-tone.ts +9 -0
- package/src/base/upload.ts +15 -9
- package/src/base/view-transition.ts +77 -0
- package/src/biz/approval-desk/shell.ts +15 -11
- package/src/biz/auth-panel/shell.ts +9 -7
- package/src/biz/category-crud/compile.ts +5 -4
- package/src/biz/category-crud/shell.ts +5 -3
- package/src/biz/checkout-page/compile.ts +2 -1
- package/src/biz/checkout-page/shell.ts +10 -8
- package/src/biz/compose.ts +2 -2
- package/src/biz/data-components.ts +4 -0
- package/src/biz/import-wizard/shell.ts +13 -10
- package/src/biz/landing-page/shell.ts +2 -2
- package/src/biz/link/hub.ts +23 -5
- package/src/biz/link/shared.ts +23 -12
- package/src/biz/master-sub/compile.ts +207 -16
- package/src/biz/master-sub/detail-head.ts +61 -0
- package/src/biz/master-sub/index.ts +7 -3
- package/src/biz/master-sub/shell.ts +133 -24
- package/src/biz/multi-board/compile.ts +167 -9
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +1 -1
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +94 -23
- package/src/biz/notification-center/shell.ts +10 -7
- package/src/biz/page-templates/domain-templates.ts +2 -2
- package/src/biz/page-templates/result-page/shell.ts +4 -3
- package/src/biz/page-templates/sign-in-page/shell.ts +16 -16
- package/src/biz/record-detail/compile.ts +2 -2
- package/src/biz/record-detail/shell.ts +13 -10
- package/src/biz/settings-center/compile.ts +2 -1
- package/src/biz/settings-center/shell.ts +12 -9
- package/src/biz/shared/action-host.ts +6 -0
- package/src/biz/shared/compile-helpers.ts +97 -0
- package/src/biz/shared/coordinator.ts +7 -30
- package/src/biz/shared/index.ts +5 -0
- package/src/biz/shared/object-aliases.ts +154 -0
- package/src/biz/shared/overlay-compile.ts +281 -0
- package/src/biz/shared/overlay-shell.ts +142 -11
- package/src/biz/shared/pipes.ts +11 -5
- package/src/biz/shared/remove-wire.ts +4 -19
- package/src/biz/shared/runtime-hub.ts +10 -0
- package/src/biz/single-form/compile.ts +3 -2
- package/src/biz/single-form/shell.ts +9 -6
- package/src/biz/standard-crud/compile.ts +36 -161
- package/src/biz/standard-crud/shell.ts +23 -60
- package/src/biz/standard-crud/summary.ts +40 -0
- package/src/biz/step-form/shell.ts +15 -13
- package/src/biz/types.ts +6 -1
- package/src/cli/kit-cli.ts +138 -13
- package/src/cli/kit-init.ts +6 -1
- package/src/cli/layout-cli.ts +167 -0
- package/src/cli/migrate/index.ts +10 -0
- package/src/cli/migrate/migrate.ts +248 -0
- package/src/cli/migrate/text-utils.ts +306 -0
- package/src/cli/migrate/theme-map.ts +104 -0
- package/src/cli/migrate/ts-rules.ts +235 -0
- package/src/cli/migrate/types.ts +95 -0
- package/src/cli/migrate/view-skeleton.ts +159 -0
- package/src/cli/migrate/yaml-report.ts +376 -0
- package/src/cli/migrate/yaml-rules.ts +465 -0
- package/src/cli/view-writes.ts +69 -60
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/closed-set.ts +65 -4
- package/src/compile/compile-page.ts +66 -11
- package/src/compile/component-candidates.ts +14 -1
- package/src/compile/fragment.ts +11 -0
- package/src/compile/layout-lint/engine.ts +82 -0
- package/src/compile/layout-lint/index.ts +55 -0
- package/src/compile/layout-lint/rules-composition.ts +267 -0
- package/src/compile/layout-lint/rules-form.ts +191 -0
- package/src/compile/layout-lint/rules-table.ts +278 -0
- package/src/compile/layout-lint/score.ts +52 -0
- package/src/compile/layout-lint/types.ts +51 -0
- package/src/compile/page-composition.ts +189 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/remove-guard.ts +10 -7
- package/src/compile/styles.ts +46 -8
- package/src/compile/types.ts +16 -2
- package/src/compile/view-check.ts +149 -16
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +9 -2
- package/src/data/approval-flow.ts +5 -2
- package/src/data/assignment-picker.ts +59 -28
- package/src/data/async-result-panel.ts +49 -3
- package/src/data/breadcrumbs.ts +3 -2
- package/src/data/calendar.ts +8 -3
- package/src/data/carousel.ts +10 -6
- package/src/data/chart.ts +744 -46
- package/src/data/checklist.ts +22 -6
- package/src/data/code-view.ts +8 -4
- package/src/data/comment-thread.ts +3 -2
- package/src/data/confirm-dialog.ts +72 -25
- package/src/data/context-menu.ts +3 -3
- package/src/data/dock.ts +1 -1
- package/src/data/embed.ts +231 -29
- package/src/data/field-mapper.ts +7 -4
- package/src/data/flow-editor-contract.ts +7 -0
- package/src/data/flow-editor.ts +26 -9
- package/src/data/flow-node-options.ts +33 -3
- package/src/data/footer.ts +2 -0
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +4 -1
- package/src/data/image-viewer.ts +7 -4
- package/src/data/index.ts +16 -4
- package/src/data/item-list.ts +27 -12
- package/src/data/kanban.ts +41 -10
- package/src/data/matrix.ts +391 -0
- package/src/data/media-grid.ts +6 -1
- package/src/data/mega-menu.ts +6 -4
- package/src/data/menu-dom.ts +4 -2
- package/src/data/menu.ts +60 -16
- package/src/data/mockup.ts +5 -1
- package/src/data/modal-dialog.ts +146 -26
- package/src/data/navbar.ts +8 -6
- package/src/data/notice-list.ts +301 -0
- package/src/data/notify-renderer.ts +21 -6
- package/src/data/object-form.ts +409 -87
- package/src/data/outcome-watch.ts +61 -2
- package/src/data/pager.ts +19 -8
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +36 -11
- package/src/data/permission-tree.ts +52 -23
- package/src/data/pricing-table.ts +22 -11
- package/src/data/prompt-dialog.ts +165 -0
- package/src/data/reaction-bar.ts +6 -4
- package/src/data/record-card.ts +40 -7
- package/src/data/record-picker.ts +13 -7
- package/src/data/resident.ts +8 -0
- package/src/data/result-panel.ts +4 -2
- package/src/data/rich-text.ts +17 -1
- package/src/data/row-editor.ts +77 -24
- package/src/data/rule-builder.ts +14 -9
- package/src/data/shape-util.ts +27 -12
- package/src/data/stat-group.ts +459 -74
- package/src/data/static-lazy.ts +5 -0
- package/src/data/static-registry.ts +8 -0
- package/src/data/steps.ts +8 -3
- package/src/data/survey.ts +7 -4
- package/src/data/system-switcher.ts +3 -2
- package/src/data/text-action-button.ts +17 -0
- package/src/data/timeline.ts +17 -6
- package/src/data/tour-guide.ts +3 -2
- package/src/data/transfer.ts +40 -16
- package/src/data/tree-table.ts +65 -37
- package/src/data/tree.ts +22 -2
- package/src/data/virtual-rows.ts +21 -11
- package/src/data/wrapped-candidates.ts +32 -1
- package/src/frames/index.ts +1 -0
- package/src/frames/list-summary.ts +100 -0
- package/src/frames/page-bar.ts +7 -14
- package/src/frames/page-status.ts +7 -5
- package/src/frames/shared.ts +34 -13
- package/src/frames/split-frame/shell.ts +1 -1
- package/src/frames/tabs-frame/shell.ts +9 -6
- package/src/frames/tabs-frame/wiring.ts +1 -0
- package/src/frames/top-main-frame.ts +3 -3
- package/src/frames/types.ts +3 -1
- package/src/frames/workspace-frame/extras.ts +1 -1
- package/src/frames/workspace-frame/shell.ts +4 -4
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +168 -44
- package/src/generated/kit-grammar-runtime.ts +390 -59
- package/src/i18n/kit-text.ts +90 -4
- package/src/i18n/resolve-text-refs.ts +22 -6
- package/src/object-renderer/action-group.ts +139 -0
- package/src/object-renderer/action-more.ts +144 -0
- package/src/object-renderer/arrange.ts +71 -7
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +264 -62
- package/src/object-renderer/collection-table.ts +177 -5
- package/src/object-renderer/collection.ts +188 -37
- package/src/object-renderer/compile-data.ts +28 -3
- package/src/object-renderer/defaults.ts +27 -2
- package/src/object-renderer/display-checks.ts +1 -1
- package/src/object-renderer/emit-events.ts +43 -9
- package/src/object-renderer/emit-object.ts +4 -0
- package/src/object-renderer/emit-static.ts +434 -41
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/form-detail.ts +1 -2
- package/src/object-renderer/form-notify.ts +45 -0
- package/src/object-renderer/index.ts +5 -0
- package/src/object-renderer/layout-facts.ts +394 -0
- package/src/object-renderer/layout-plan.ts +225 -0
- package/src/object-renderer/layout-plan.types.ts +59 -0
- package/src/object-renderer/parts.ts +6 -7
- package/src/object-renderer/render-object.ts +107 -46
- package/src/object-renderer/request-actions.ts +4 -2
- package/src/object-renderer/skeleton.ts +58 -19
- package/src/object-renderer/table-actions.ts +172 -32
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +62 -30
- package/src/object-renderer/types.ts +84 -13
- package/src/object-renderer/view-binding.ts +205 -8
- package/src/page-target/intent-schema.ts +11 -0
- package/src/page-target/target.ts +5 -1
- package/src/recipes/container.ts +77 -1
- package/src/recipes/control.ts +76 -116
- package/src/recipes/emphasis.ts +56 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +72 -0
- package/src/recipes/nowrap.ts +16 -0
- package/src/recipes/overlay.ts +120 -17
- package/src/recipes/placeholder.ts +95 -0
- package/src/recipes/rail-grid.ts +48 -0
- package/src/recipes/slot-align.ts +56 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +40 -21
- package/src/recipes/status.ts +147 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +40 -0
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +146 -3
- package/src/recipes/tabs.ts +49 -0
- package/src/recipes/title-row.ts +37 -0
- package/src/recipes/typography.ts +30 -37
- package/src/shared/confirm-decl.ts +118 -0
- package/src/shared/envelope.ts +2 -2
- package/src/shared/paged-list-adapter.ts +15 -240
- package/src/shared/theme-runtime-shared.ts +6 -1
- package/src/theme/index.ts +1 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +384 -13
- package/src/theme/kit-theme.tpl +384 -13
- package/src/theme/nine-dim-structure.ts +244 -7
- package/src/theme/surface-layers.ts +10 -1
- package/src/theme/theme-tokens.ts +63 -16
- package/src/theme/theme-types.ts +32 -0
- package/src/theme/typography.ts +21 -17
- package/src/biz/shared/remove-key.ts +0 -6
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// ApprovalDesk 的 HTML 代码壳:左待办队列 + 中审批单 + 右历史 / 比对三栏。只有结构与 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
2
2
|
// 三栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档左 3 / 中 5 / 右 4(共 12 份)。
|
|
3
3
|
|
|
4
|
+
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
4
5
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
6
|
+
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
7
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
5
8
|
import { cls, esc, host } from '../link/shared';
|
|
6
9
|
|
|
7
10
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -9,12 +12,14 @@ export const APPROVAL_DESK_AREAS = ['root', 'queue', 'request', 'history'] as co
|
|
|
9
12
|
export type ApprovalDeskArea = (typeof APPROVAL_DESK_AREAS)[number];
|
|
10
13
|
|
|
11
14
|
export const APPROVAL_DESK_CLASS = {
|
|
12
|
-
root: '@container flex flex-col gap-
|
|
13
|
-
grid: 'grid grid-cols-12 gap-
|
|
14
|
-
queue: 'col-span-12 @md:col-span-3 flex min-w-0 flex-col gap-
|
|
15
|
-
request: 'col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-
|
|
16
|
-
history: 'col-span-12 @md:col-span-4 flex min-w-0 flex-col gap-
|
|
17
|
-
|
|
15
|
+
root: '@container flex flex-col gap-section',
|
|
16
|
+
grid: 'grid grid-cols-12 gap-section',
|
|
17
|
+
queue: mergeClass('col-span-12 @md:col-span-3 flex min-w-0 flex-col gap-region p-card', kitShellRecipe()),
|
|
18
|
+
request: mergeClass('col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-region p-card', kitShellRecipe()),
|
|
19
|
+
history: mergeClass('col-span-12 @md:col-span-4 flex min-w-0 flex-col gap-region p-card', kitShellRecipe()),
|
|
20
|
+
/** 没有历史栏时审批单栏吃掉右侧 4 份(9/12) */
|
|
21
|
+
requestWide: mergeClass('col-span-12 @md:col-span-9 flex min-w-0 flex-col gap-region p-card', kitShellRecipe()),
|
|
22
|
+
title: mergeClass('min-w-0 truncate', kitTypographyRecipe('sectionTitle')),
|
|
18
23
|
} as const;
|
|
19
24
|
|
|
20
25
|
export function approvalDeskIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -34,14 +39,13 @@ export function approvalDeskHtml(
|
|
|
34
39
|
extra: string | undefined,
|
|
35
40
|
): string {
|
|
36
41
|
const col = (area: 'queue' | 'request' | 'history', c: DeskColumn, wide?: string): string => {
|
|
37
|
-
|
|
42
|
+
// 截断的标题悬停 / 聚焦时由 hint-tips 按需挂全文气泡(作用范围标记就在标题元素自身)
|
|
43
|
+
const title = c.title === '' ? '' : `<h3${cls(APPROVAL_DESK_CLASS.title)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(c.title)}</h3>`;
|
|
38
44
|
const base = wide === undefined ? APPROVAL_DESK_CLASS[area] : wide;
|
|
39
|
-
return `<section${cls(mergeClass(base, areaClass[area]))}>${title}${c.html}</section>`;
|
|
45
|
+
return `<section${cls(mergeClass(base, areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${c.html}</section>`;
|
|
40
46
|
};
|
|
41
47
|
// 没有历史栏时,审批单栏吃掉右侧 4 份
|
|
42
|
-
const requestBase = parts.history === null
|
|
43
|
-
? 'col-span-12 @md:col-span-9 flex min-w-0 flex-col gap-3 rounded-lg border border-border-strong bg-surface-raised p-4 shadow-xs'
|
|
44
|
-
: undefined;
|
|
48
|
+
const requestBase = parts.history === null ? APPROVAL_DESK_CLASS.requestWide : undefined;
|
|
45
49
|
const cols = [col('queue', parts.queue), col('request', parts.request, requestBase)];
|
|
46
50
|
if (parts.history !== null) cols.push(col('history', parts.history));
|
|
47
51
|
const root = mergeClass(mergeClass(APPROVAL_DESK_CLASS.root, areaClass.root), extra);
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
// 分栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档角色 4 / 矩阵 8(共 12 份)。
|
|
3
3
|
|
|
4
4
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
5
|
+
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
6
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
5
7
|
import { cls, esc, host } from '../link/shared';
|
|
6
8
|
|
|
7
9
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
8
10
|
export const AUTH_PANEL_AREAS = ['root', 'user', 'roles', 'matrix'] as const;
|
|
9
11
|
export type AuthPanelArea = (typeof AUTH_PANEL_AREAS)[number];
|
|
10
12
|
|
|
11
|
-
const CARD = 'flex min-w-0 flex-col gap-
|
|
13
|
+
const CARD = mergeClass('flex min-w-0 flex-col gap-region p-card', kitShellRecipe());
|
|
12
14
|
|
|
13
15
|
export const AUTH_PANEL_CLASS = {
|
|
14
|
-
root: '@container flex flex-col gap-
|
|
16
|
+
root: '@container flex flex-col gap-section',
|
|
15
17
|
user: CARD,
|
|
16
|
-
grid: 'grid grid-cols-12 gap-
|
|
17
|
-
roles:
|
|
18
|
-
matrix:
|
|
19
|
-
title: '
|
|
18
|
+
grid: 'grid grid-cols-12 gap-section',
|
|
19
|
+
roles: mergeClass('col-span-12 @md:col-span-4', CARD),
|
|
20
|
+
matrix: mergeClass('col-span-12 @md:col-span-8', CARD),
|
|
21
|
+
title: kitTypographyRecipe('sectionTitle'),
|
|
20
22
|
} as const;
|
|
21
23
|
|
|
22
24
|
export function authPanelIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -37,7 +39,7 @@ export function authPanelHtml(
|
|
|
37
39
|
): string {
|
|
38
40
|
const block = (area: 'user' | 'roles' | 'matrix', b: AuthBlock): string => {
|
|
39
41
|
const title = b.title === '' ? '' : `<h3${cls(AUTH_PANEL_CLASS.title)}>${esc(b.title)}</h3>`;
|
|
40
|
-
return `<section${cls(mergeClass(AUTH_PANEL_CLASS[area], areaClass[area]))}>${title}${b.html}</section>`;
|
|
42
|
+
return `<section${cls(mergeClass(AUTH_PANEL_CLASS[area], areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${b.html}</section>`;
|
|
41
43
|
};
|
|
42
44
|
const user = parts.user === null ? '' : `${block('user', parts.user)}\n`;
|
|
43
45
|
const root = mergeClass(mergeClass(AUTH_PANEL_CLASS.root, areaClass.root), extra);
|
|
@@ -14,9 +14,9 @@ import type { KitObject, KitType } from '../../object-renderer/types';
|
|
|
14
14
|
import type { KitFragment } from '../../compile/fragment';
|
|
15
15
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
16
16
|
import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS } from '../shared/coordinator';
|
|
17
|
-
import { bizObjectName, finishBizCompile, validateBizAreaClass } from '../shared/compile-helpers';
|
|
17
|
+
import { bizObjectName, finishBizCompile, listPanelBody, validateBizAreaClass } from '../shared/compile-helpers';
|
|
18
18
|
import { wireDialogForm } from '../shared/pipes';
|
|
19
|
-
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles } from '../shared/overlay-shell';
|
|
19
|
+
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles, dialogWidthOf } from '../shared/overlay-shell';
|
|
20
20
|
import { KIT_LINK_MIRRORS, KIT_SEL_PATH } from '../link/hub';
|
|
21
21
|
import {
|
|
22
22
|
IDENT, classesIn, emitMember, grantPageReset, isRec, keyFieldOf, linkRemoveProps, mirrorPath, newParts,
|
|
@@ -138,7 +138,7 @@ export function compileCategoryCrud(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
138
138
|
out.events[`${d.dialogClose}.click`] = semanticPipe(link, KIT_COORD_EVENTS.close);
|
|
139
139
|
const createName = item.behavior.actions?.find((a) => a.builtin === 'openCreate')?.name ?? kitText('soma.kit.create', undefined, ctx.locale);
|
|
140
140
|
const editName = item.behavior.actions?.find((a) => a.builtin === 'openEdit')?.name ?? kitText('soma.kit.edit', undefined, ctx.locale);
|
|
141
|
-
dialog = dialogHtml(d, dialogTitles(item.view?.form?.title, { create: createName, edit: editName }), it.r.parts.form ?? '', { dialog: areaClass.dialog ?? '' }, CLOSE_LABEL);
|
|
141
|
+
dialog = dialogHtml(d, dialogTitles(item.view?.form?.title, { create: createName, edit: editName }), it.r.parts.form ?? '', { dialog: areaClass.dialog ?? '' }, CLOSE_LABEL, '', dialogWidthOf({ form: item.view?.form, schema: item.schema }));
|
|
142
142
|
for (const cl of Object.values(OVERLAY_SHELL_CLASS)) for (const t of cl.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -154,7 +154,8 @@ export function compileCategoryCrud(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
154
154
|
|
|
155
155
|
// ---- 壳
|
|
156
156
|
const catHtml = [c.r.parts.toolbar ?? '', c.r.parts.filter ?? '', c.listHtml, c.r.parts.summary ?? ''].filter((x) => x !== '').join('\n');
|
|
157
|
-
|
|
157
|
+
// 条目面板:工具条区(筛选 + 主操作)+ hairline + 集合 + 摘要(单一面板,见 shared/compile-helpers#listPanelBody)
|
|
158
|
+
const itemHtml = [listPanelBody({ filter: it.r.parts.filter ?? '', toolbar: it.r.parts.toolbar ?? '', list: it.listHtml }), it.r.parts.summary ?? ''].filter((x) => x !== '').join('\n');
|
|
158
159
|
const html = categoryCrudHtml(ids, { category: catHtml, item: itemHtml, dialog }, areaClass, input.class);
|
|
159
160
|
for (const cl of classesIn(html)) out.candidates.add(cl);
|
|
160
161
|
for (const cl of Object.values(CATEGORY_CRUD_CLASS)) for (const t of cl.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// CategoryCrud 的 HTML 代码壳:左侧固定紧凑分类栏(默认 w-56)+ 右侧条目管理区。只有结构与 Tailwind 类,分栏靠容器查询变体。
|
|
2
2
|
|
|
3
3
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
4
|
+
import { kitShellRecipe } from '../../recipes/container';
|
|
4
5
|
import { cls, esc, host } from '../link/shared';
|
|
5
6
|
|
|
6
7
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
7
8
|
export const CATEGORY_CRUD_AREAS = ['root', 'categorySidebar', 'itemWorkspace', 'dialog'] as const;
|
|
8
9
|
|
|
9
10
|
export const CATEGORY_CRUD_CLASS = {
|
|
10
|
-
root: '@container flex flex-col gap-
|
|
11
|
-
categorySidebar: 'w-full shrink-0 @md:w-56
|
|
12
|
-
|
|
11
|
+
root: '@container flex flex-col gap-section @md:flex-row',
|
|
12
|
+
categorySidebar: mergeClass('w-full shrink-0 @md:w-56 p-inset-compact flex flex-col gap-cluster', kitShellRecipe()),
|
|
13
|
+
// 条目工作区是一张面板(单一面板:工具条区 + hairline + 集合共用一个面,面板持有内边距 p-card),与 StandardCrud 的列表卡同一结构
|
|
14
|
+
itemWorkspace: mergeClass('flex min-w-0 flex-1 flex-col gap-region p-card', kitShellRecipe({ tone: 'base', shadow: false })),
|
|
13
15
|
} as const;
|
|
14
16
|
|
|
15
17
|
export function categoryCrudIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// 与 StepForm 的区别:单页结算,表单与摘要并排,没有分步;与 MultiObjectBoard 的区别:表单是提交主体,摘要栏是写死的附属。
|
|
8
8
|
|
|
9
9
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
10
|
+
import { savedNoticePipe } from '../../object-renderer/form-notify';
|
|
10
11
|
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
11
12
|
import type { KitObject, KitViewForm } from '../../object-renderer/types';
|
|
12
13
|
import type { KitFragment } from '../../compile/fragment';
|
|
@@ -83,7 +84,7 @@ export function compileCheckoutPage(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
83
84
|
resetLabel: RESET_LABEL,
|
|
84
85
|
classes: { ...classes, actions: CHECKOUT_PAGE_CLASS.footer },
|
|
85
86
|
});
|
|
86
|
-
out.events[`${formId}.saved`] =
|
|
87
|
+
out.events[`${formId}.saved`] = savedNoticePipe(formView, SAVED_NOTICE);
|
|
87
88
|
const ft = formView.title;
|
|
88
89
|
const formTitle = typeof ft === 'string' ? ft : isRec(ft) ? String((hasFrom ? ft.edit : ft.create) ?? '') : '';
|
|
89
90
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// 窄容器下摘要在表单之后上下堆叠;达到 md 档左 7 / 右 5(共 12 份)。
|
|
3
3
|
|
|
4
4
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
5
|
+
import { kitShellRecipe } from '../../recipes/container';
|
|
6
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
5
7
|
import { cls, esc } from '../link/shared';
|
|
6
8
|
|
|
7
9
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -9,14 +11,14 @@ export const CHECKOUT_PAGE_AREAS = ['root', 'form', 'summary', 'items', 'amounts
|
|
|
9
11
|
export type CheckoutPageArea = (typeof CHECKOUT_PAGE_AREAS)[number];
|
|
10
12
|
|
|
11
13
|
export const CHECKOUT_PAGE_CLASS = {
|
|
12
|
-
root: '@container grid grid-cols-12 gap-
|
|
13
|
-
form: 'col-span-12 @md:col-span-7 flex min-w-0 flex-col gap-
|
|
14
|
-
summary: 'col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-
|
|
15
|
-
items: 'flex flex-col gap-
|
|
16
|
-
amounts: 'flex flex-col gap-
|
|
17
|
-
title: '
|
|
18
|
-
/** 表单底部提交栏(表单 actions
|
|
19
|
-
footer: 'mt-2 flex flex-
|
|
14
|
+
root: '@container grid grid-cols-12 gap-section',
|
|
15
|
+
form: mergeClass('col-span-12 @md:col-span-7 flex min-w-0 flex-col gap-section p-inset-roomy', kitShellRecipe()),
|
|
16
|
+
summary: 'col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-section',
|
|
17
|
+
items: mergeClass('flex flex-col gap-region p-card', kitShellRecipe()),
|
|
18
|
+
amounts: mergeClass('flex flex-col gap-region p-card', kitShellRecipe({ tone: 'sunken', shadow: false })),
|
|
19
|
+
title: kitTypographyRecipe('sectionTitle'),
|
|
20
|
+
/** 表单底部提交栏(表单 actions 区);动作组恒单行不折行(排布引擎动作组规则) */
|
|
21
|
+
footer: 'mt-2 flex flex-nowrap items-end gap-cluster border-t border-border-subtle pt-4',
|
|
20
22
|
} as const;
|
|
21
23
|
|
|
22
24
|
export function checkoutPageIds(pageId: string): { root: string } {
|
package/src/biz/compose.ts
CHANGED
|
@@ -158,7 +158,7 @@ export interface ComposeBizOptions {
|
|
|
158
158
|
parts: Record<string, ComposeBizPart>;
|
|
159
159
|
/** 复合外壳自己的可覆写区域名(自动确保含 'root') */
|
|
160
160
|
areas?: readonly string[];
|
|
161
|
-
/** 根容器默认 Tailwind 类(缺省 '@container flex flex-col gap-
|
|
161
|
+
/** 根容器默认 Tailwind 类(缺省 '@container flex flex-col gap-stack') */
|
|
162
162
|
rootClass?: string;
|
|
163
163
|
/** 是否允许页面传入 product.config(缺省 true) */
|
|
164
164
|
acceptConfig?: boolean;
|
|
@@ -204,7 +204,7 @@ export function composeKitBizComponents(options: ComposeBizOptions): KitBizDefin
|
|
|
204
204
|
kitFail('KIT-COMP-002', `${options.kind}.parts`, `${options.kind} 至多只能有 1 个子部件开启 forwardOverlays`, '只保留一个子部件的 forwardOverlays: true');
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
const baseRootClass = options.rootClass ?? '@container flex flex-col gap-
|
|
207
|
+
const baseRootClass = options.rootClass ?? '@container flex flex-col gap-stack';
|
|
208
208
|
const badRoot = checkClasses(baseRootClass, `${options.kind}.rootClass`);
|
|
209
209
|
if (badRoot.length > 0) kitFail('KIT-COMP-003', `${options.kind}.rootClass`, `${options.kind} 的 rootClass 非法:${badRoot[0]!.message}`, 'rootClass 只能用刻度内的 Tailwind 类');
|
|
210
210
|
|
|
@@ -6,6 +6,8 @@ import type { SomaComponentDefinition } from 'soma-core';
|
|
|
6
6
|
import { createKitLinkHub } from './link/hub';
|
|
7
7
|
import { createKitCoordinator } from './shared/coordinator';
|
|
8
8
|
import { createKitActionHost } from './shared/action-host';
|
|
9
|
+
import { createKitBoardProse } from './multi-board/prose-fold';
|
|
10
|
+
import { createKitDetailHead } from './master-sub/detail-head';
|
|
9
11
|
import { createKitStepHub } from './step-form/hub';
|
|
10
12
|
import { createKitImportHub } from './import-wizard/hub';
|
|
11
13
|
|
|
@@ -16,6 +18,8 @@ export const KIT_BIZ_DATA_COMPONENTS: Record<string, () => SomaComponentDefiniti
|
|
|
16
18
|
KitLinkHub: createKitLinkHub,
|
|
17
19
|
KitStepHub: createKitStepHub,
|
|
18
20
|
KitImportHub: createKitImportHub,
|
|
21
|
+
KitBoardProse: createKitBoardProse,
|
|
22
|
+
KitDetailHead: createKitDetailHead,
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
/** 装配期并入组件表的协作数据组件:名字 -> 定义 */
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// 显隐规则同 StepForm:面板 / 步骤条变体 / 按钮都是「外层只放 core 写的 hidden、内层放布局类」两层;各步组件一直挂着,只靠外层显隐切换。
|
|
4
4
|
|
|
5
5
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
6
|
+
import { kitShellRecipe } from '../../recipes/container';
|
|
7
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
6
8
|
import { cls, esc, host } from '../link/shared';
|
|
7
9
|
import { kitText } from '../../i18n/kit-text';
|
|
8
10
|
import { kitIconHtml } from '../../base/icons';
|
|
@@ -18,10 +20,10 @@ export const IMPORT_WIZARD_STEP_TITLES = [
|
|
|
18
20
|
|
|
19
21
|
export const IMPORT_WIZARD_CLASS = {
|
|
20
22
|
root: '@container flex justify-center',
|
|
21
|
-
card: 'flex w-full max-w-3xl flex-col gap-
|
|
22
|
-
title: '
|
|
23
|
-
steps: 'flex flex-wrap items-center gap-
|
|
24
|
-
stepItem: 'flex items-center gap-
|
|
23
|
+
card: mergeClass('flex w-full max-w-3xl flex-col gap-stack p-inset-roomy', kitShellRecipe()),
|
|
24
|
+
title: kitTypographyRecipe('sectionTitle'),
|
|
25
|
+
steps: 'flex flex-wrap items-center gap-cluster',
|
|
26
|
+
stepItem: 'flex items-center gap-cluster',
|
|
25
27
|
circle: 'flex h-6 w-6 items-center justify-center rounded-full text-sm font-medium',
|
|
26
28
|
circleAt: 'bg-primary text-primary-fg',
|
|
27
29
|
circlePast: 'bg-success text-success-fg',
|
|
@@ -30,13 +32,13 @@ export const IMPORT_WIZARD_CLASS = {
|
|
|
30
32
|
labelPast: 'text-sm text-fg',
|
|
31
33
|
labelFut: 'text-sm text-fg-muted',
|
|
32
34
|
joint: 'w-6 border-t border-border-subtle',
|
|
33
|
-
panel: 'flex flex-col gap-
|
|
34
|
-
panelTitle: '
|
|
35
|
+
panel: 'flex flex-col gap-section',
|
|
36
|
+
panelTitle: kitTypographyRecipe('sectionTitle'),
|
|
35
37
|
hint: 'text-sm text-fg-muted',
|
|
36
38
|
error: 'text-sm text-danger-on-soft',
|
|
37
|
-
buttons: 'flex flex-wrap items-center justify-end gap-
|
|
38
|
-
preview: 'flex flex-col gap-
|
|
39
|
-
done: 'flex flex-col gap-
|
|
39
|
+
buttons: 'flex flex-wrap items-center justify-end gap-cluster',
|
|
40
|
+
preview: 'flex flex-col gap-region',
|
|
41
|
+
done: 'flex flex-col gap-section',
|
|
40
42
|
} as const;
|
|
41
43
|
|
|
42
44
|
export interface ImportWizardIds {
|
|
@@ -155,7 +157,8 @@ export function importWizardHtml(
|
|
|
155
157
|
+ '</div>');
|
|
156
158
|
|
|
157
159
|
const title = parts.title === '' ? '' : `<h2${cls(C.title)}>${esc(parts.title)}</h2>`;
|
|
158
|
-
|
|
160
|
+
// 唯一主体 = 页面(C2):向导卡是 E1 主体
|
|
161
|
+
const card = `<section data-kit-emphasis="primary" data-kit-role="subject" data-kit-container="card"${cls(mergeClass(C.card, areaClass.card))}>${title}${bar}${p0}${p1}${p2}${p3}</section>`;
|
|
159
162
|
const root = mergeClass(mergeClass(C.root, areaClass.root), extra);
|
|
160
163
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitImportHub', ids.hub)}\n${card}\n</div>`;
|
|
161
164
|
}
|
|
@@ -12,9 +12,9 @@ export const LANDING_PAGE_CLASS = {
|
|
|
12
12
|
root: '@container flex flex-col gap-10',
|
|
13
13
|
hero: 'flex flex-col',
|
|
14
14
|
sections: 'flex flex-col gap-12',
|
|
15
|
-
section: 'flex min-w-0 flex-col gap-
|
|
15
|
+
section: 'flex min-w-0 flex-col gap-stack',
|
|
16
16
|
sectionTitle: 'text-center text-2xl font-semibold text-fg',
|
|
17
|
-
footer: 'flex flex-col gap-
|
|
17
|
+
footer: 'flex flex-col gap-cluster border-t border-border-subtle pt-6 text-sm text-fg-muted',
|
|
18
18
|
} as const;
|
|
19
19
|
|
|
20
20
|
export function landingPageIds(pageId: string): { root: string } {
|
package/src/biz/link/hub.ts
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
import type { SomaComponentDefinition, SomaRegionPort } from 'soma-core';
|
|
14
14
|
import { createKitController } from '../../base/shared';
|
|
15
|
-
import {
|
|
15
|
+
import { withKitViewTransition } from '../../base/view-transition';
|
|
16
|
+
import { KIT_ACTION_SLOT_BASE, KIT_PICK_SLOT_MAX, actionSlotEmits, actionSlotEvent, emitActionSlot } from '../../base/action-slots';
|
|
16
17
|
|
|
17
18
|
export const KIT_LINK_EVENTS = {
|
|
18
19
|
pick: 'link_pick',
|
|
@@ -24,10 +25,16 @@ export const KIT_LINK_EVENTS = {
|
|
|
24
25
|
export const KIT_LINK_MIRRORS = {
|
|
25
26
|
selKey: 'link_sel_key',
|
|
26
27
|
selRow: 'link_sel_row',
|
|
28
|
+
/** 有选中项时为真(MasterSub 从属区面板的显隐) */
|
|
29
|
+
selHas: 'link_sel_has',
|
|
30
|
+
/** 互补真值:没有选中项时为真(MasterSub 未选中空态的显隐) */
|
|
31
|
+
selNone: 'link_sel_none',
|
|
27
32
|
} as const;
|
|
28
33
|
|
|
29
34
|
/** selection 切片里存选中项的路径:值形如 { row: <选中项> }(镜像路径 `row` / `row.<主键>`) */
|
|
30
35
|
export const KIT_SEL_PATH = 'row';
|
|
36
|
+
/** selection 切片里「当前没有选中项」的互补布尔路径(枢纽写,MasterSub 的未选中空态读它) */
|
|
37
|
+
export const KIT_NONE_PATH = 'none';
|
|
31
38
|
|
|
32
39
|
type Rec = Record<string, unknown>;
|
|
33
40
|
|
|
@@ -111,7 +118,7 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
111
118
|
},
|
|
112
119
|
emits: {
|
|
113
120
|
picked: { payload: { id: { type: 'string' }, item: { type: 'object' }, prefill: { type: 'object' } }, desc: '选中项变化(页面据此重取依赖对象)' },
|
|
114
|
-
...actionSlotEmits('picked', { id: { type: 'string' }, item: { type: 'object' }, prefill: { type: 'object' } }, '选中项变化的分发槽位(pickSlots 个):依赖多个对象要各自重取时,每个对象的重取各绑一个槽位'),
|
|
121
|
+
...actionSlotEmits('picked', { id: { type: 'string' }, item: { type: 'object' }, prefill: { type: 'object' } }, '选中项变化的分发槽位(pickSlots 个):依赖多个对象要各自重取时,每个对象的重取各绑一个槽位', KIT_PICK_SLOT_MAX),
|
|
115
122
|
...actionSlotEmits(KIT_ACTION_SLOT_BASE.field, { value: { type: 'string' }, row: { type: 'object' } }, '摘要字段动作 / 工具栏具名动作:载荷带当前选中行(字段事件自己只有 { value })'),
|
|
116
123
|
},
|
|
117
124
|
scope: { slices: ['selection', 'view'] },
|
|
@@ -128,7 +135,7 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
128
135
|
/** 选中项变化:抛 picked,并按 pickSlots 依次抛 picked_0 … picked_<n-1>(页面给每个依赖对象的重取各绑一条管道,不共用一个事件) */
|
|
129
136
|
const emitPicked = (payload: Rec): void => {
|
|
130
137
|
api.emit('picked', payload);
|
|
131
|
-
const n = Math.min(Math.max(0, Math.floor(Number(props().pickSlots) || 0)),
|
|
138
|
+
const n = Math.min(Math.max(0, Math.floor(Number(props().pickSlots) || 0)), KIT_PICK_SLOT_MAX);
|
|
132
139
|
for (let i = 0; i < n; i += 1) api.emit(actionSlotEvent('picked', i), payload);
|
|
133
140
|
};
|
|
134
141
|
|
|
@@ -142,7 +149,10 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
142
149
|
const setSelection = (row: unknown): void => {
|
|
143
150
|
try {
|
|
144
151
|
// 写在 row 路径下:core 对 selection 整槽写有形状判据(对象带 scope 字段且不在 page / all-matching 内即拒收),业务行有 scope 字段时整槽写会静默失败
|
|
145
|
-
port()?.slice('selection')
|
|
152
|
+
const sel = port()?.slice('selection');
|
|
153
|
+
sel?.set(row, KIT_SEL_PATH);
|
|
154
|
+
// 「当前没有选中项」的互补真值:页面语法没有取反,未选中态的显隐只能读它
|
|
155
|
+
sel?.set(!isRec(row), KIT_NONE_PATH);
|
|
146
156
|
} catch (err) {
|
|
147
157
|
// 不是 selection 的写者(CategoryCrud 由分类树自己写):忽略
|
|
148
158
|
console.debug('[soma-kit] KitLinkHub 无权写 selection', err);
|
|
@@ -237,7 +247,11 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
237
247
|
|
|
238
248
|
const onSemantic = (name: string, payload: Readonly<Rec>): void => {
|
|
239
249
|
if (name === KIT_LINK_EVENTS.pick) {
|
|
240
|
-
|
|
250
|
+
// 用户点行换选中项:右侧内容区走页面过渡(不支持 / 减弱动效时直接写,与原行为一致);默认选中等程序写入不走过渡
|
|
251
|
+
if (isRec(payload.row)) {
|
|
252
|
+
const row = payload.row;
|
|
253
|
+
withKitViewTransition(() => setSelection(row));
|
|
254
|
+
}
|
|
241
255
|
return;
|
|
242
256
|
}
|
|
243
257
|
if (name.startsWith(KIT_LINK_EVENTS.fieldPrefix)) {
|
|
@@ -257,6 +271,10 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
257
271
|
const p = port();
|
|
258
272
|
if (!p) return;
|
|
259
273
|
lastKey = linkKeyOf(selectedOf(p.slice('selection')?.get()), keyField());
|
|
274
|
+
// 初始没有选中项:先把互补真值置真(行数据到达后默认选中会置回假)
|
|
275
|
+
if (lastKey === null) {
|
|
276
|
+
try { p.slice('selection')?.set(true, KIT_NONE_PATH); } catch { /* 非 selection 写者(分类树自己写):忽略 */ }
|
|
277
|
+
}
|
|
260
278
|
offs.push(p.onSemantic(onSemantic));
|
|
261
279
|
const sel = p.slice('selection');
|
|
262
280
|
if (sel) offs.push(sel.subscribe(() => { void onSelection(); }));
|
package/src/biz/link/shared.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { kitText } from '../../i18n/kit-text';
|
|
|
11
11
|
import type { SomaScopeDecl, SomaScopeMirrorDecl, SomaScopeSliceDecl } from 'soma-core';
|
|
12
12
|
import { KIT_VIEW_FORM_KEYS, KIT_VIEW_SLOTS } from '../../object-renderer/defaults';
|
|
13
13
|
import { actionPipeline, rowActionSlotsOf } from '../../object-renderer/emit-events';
|
|
14
|
-
import { KIT_ACTION_SLOT_BASE, actionSlotEvent, actionSlotOverflow } from '../../base/action-slots';
|
|
14
|
+
import { KIT_ACTION_SLOT_BASE, actionSlotEvent, actionSlotOverflow, pickSlotOverflow } from '../../base/action-slots';
|
|
15
15
|
import { emitObject, type KitEmitInput, type KitEmitResult } from '../../object-renderer/emit-object';
|
|
16
16
|
import { primaryKeyFieldOf } from '../../object-renderer/key-field';
|
|
17
17
|
import { ctxMenuAnchor, opsAnchor, rowsAnchor, selAnchor, staticCtxAnchor, toolbarAnchor, treeAnchor, virtualAnchor } from '../../object-renderer/emit-static';
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
import { KIT_COORD_EVENTS, rewriteRowActions, type KitRowActionRoute } from '../shared/coordinator';
|
|
22
22
|
import { checkRoleAllowedViews } from '../shared/compile-helpers';
|
|
23
23
|
import { pipeTails, reloadPipe, semanticPipe } from '../shared/pipes';
|
|
24
|
-
import {
|
|
24
|
+
import { removePipe } from '../shared/remove-wire';
|
|
25
25
|
import type { KitBizContext, KitBizRole } from '../types';
|
|
26
26
|
import { KIT_LINK_EVENTS } from './hub';
|
|
27
27
|
|
|
@@ -87,6 +87,7 @@ function toCollection(raw: unknown): KitCollection {
|
|
|
87
87
|
if (isRec(raw)) return { ...(raw as unknown as KitCollection) };
|
|
88
88
|
if (raw === 'cards') return { type: 'cards', cols: 1 };
|
|
89
89
|
if (raw === 'stack') return { type: 'stack' };
|
|
90
|
+
if (raw === 'compact-list') return { type: 'compact-list' };
|
|
90
91
|
return { type: 'table' };
|
|
91
92
|
}
|
|
92
93
|
|
|
@@ -241,7 +242,7 @@ export function bindFieldSlots(events: Rec, hubId: string, slots: readonly strin
|
|
|
241
242
|
* `SCOPE | window-reload` 管道(不共用一个事件)。枢纽的 show 必须已登记(本函数补 pickSlots)。
|
|
242
243
|
*/
|
|
243
244
|
export function bindPickedReloads(parts: Parts, hubId: string, scopes: readonly string[]): void {
|
|
244
|
-
const overflow =
|
|
245
|
+
const overflow = pickSlotOverflow(scopes.length);
|
|
245
246
|
if (overflow !== null) parts.diagnostics.push({ code: 'KIT-EVT-001', path: 'product', message: overflow });
|
|
246
247
|
const shown = parts.show[hubId];
|
|
247
248
|
if (isRec(shown) && isRec(shown.props)) shown.props.pickSlots = scopes.length;
|
|
@@ -274,6 +275,11 @@ export interface MemberArgs {
|
|
|
274
275
|
emitInput?: KitEmitInput;
|
|
275
276
|
/** 累积枢纽字段动作槽位(绑到枢纽的 field_action_<序号> 事件上,见 bindFieldSlots) */
|
|
276
277
|
fieldSteps?: FieldSlots;
|
|
278
|
+
/**
|
|
279
|
+
* 本组件声明的附加浮层名(overlays.*)。给了才解释行动作 `builtin: openOverlay`:目标在表内的接协调组件的 crud_open_overlay
|
|
280
|
+
* (载荷带当前行;浮层目标由协调组件按动作 id 反查);不给(没有浮层的 link 系组件)保持原样。
|
|
281
|
+
*/
|
|
282
|
+
overlayTargets?: ReadonlySet<string>;
|
|
277
283
|
}
|
|
278
284
|
|
|
279
285
|
export interface MemberResult {
|
|
@@ -354,16 +360,20 @@ export function emitMember(out: Parts, a: MemberArgs): MemberResult {
|
|
|
354
360
|
for (const k of Object.keys(nested)) if (k.startsWith(`${ops}.${KIT_ACTION_SLOT_BASE.row}_`)) delete nested[k];
|
|
355
361
|
const slots = rowActionSlotsOf(r.ir);
|
|
356
362
|
const routes: KitRowActionRoute[] = [];
|
|
357
|
-
// 本成员有内置删除:登记「对象 ->
|
|
363
|
+
// 本成员有内置删除:登记「对象 -> 主键字段名」,由模板经 linkRemoveProps 展开进协调组件 props(确认文案走 core 的 confirm 尾段,不再登记模板)
|
|
358
364
|
if (rowActs.some((x) => x.builtin === 'remove')) {
|
|
359
365
|
out.removeKeys[object] = keyFieldOf(obj) ?? '';
|
|
360
|
-
Object.assign(out.removeConfirms, removeConfirmTemplates(rowActs, object, true));
|
|
361
366
|
}
|
|
362
367
|
if (pick) routes.push({ id: 'select', pipe: semanticPipe(link, KIT_LINK_EVENTS.pick) });
|
|
363
368
|
for (const act of rowActs) {
|
|
364
369
|
const at = `behavior.actions.${act.id}`;
|
|
365
370
|
if (act.builtin === LINK_BUILTIN.edit) { routes.push({ id: act.id, pipe: semanticPipe(link, KIT_COORD_EVENTS.openEdit, pipeTails(act, at, out.diagnostics)) }); continue; }
|
|
366
371
|
if (act.builtin === 'reload') { routes.push({ id: act.id, pipe: semanticPipe(link, KIT_COORD_EVENTS.reload, pipeTails(act, at, out.diagnostics)) }); continue; }
|
|
372
|
+
// 附加浮层(与 StandardCrud 同一条协调组件管道;目标存在性由业务组件编译前置校验)
|
|
373
|
+
if (act.builtin === 'openOverlay' && a.overlayTargets !== undefined && act.targetOverlay !== undefined && a.overlayTargets.has(act.targetOverlay)) {
|
|
374
|
+
routes.push({ id: act.id, pipe: semanticPipe(link, KIT_COORD_EVENTS.openOverlay, pipeTails(act, at, out.diagnostics)) });
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
367
377
|
// 内置删除:经协调组件 kit_remove(尾段规则与 StandardCrud 同一份,见 shared/remove-wire.ts)
|
|
368
378
|
if (act.builtin === 'remove') { routes.push({ id: act.id, pipe: removePipe(link, act, at, out.diagnostics) }); continue; }
|
|
369
379
|
const pipe = actionPipeline(act, at, { hasWrite: true, object, registeredActions: ctx.registeredActions }, []);
|
|
@@ -400,23 +410,20 @@ export interface Parts {
|
|
|
400
410
|
diagnostics: KitDiagnostic[];
|
|
401
411
|
/** 有内置删除行动作的成员对象 -> 主键字段名(emitMember 累积;协调组件 removeKeys) */
|
|
402
412
|
removeKeys: Record<string, string>;
|
|
403
|
-
/** 带行占位的删除确认模板,键 `${对象}:${动作id}`(emitMember 累积;协调组件 removeConfirms) */
|
|
404
|
-
removeConfirms: Record<string, string>;
|
|
405
413
|
}
|
|
406
414
|
|
|
407
415
|
export function newParts(components: readonly string[]): Parts {
|
|
408
416
|
return {
|
|
409
417
|
show: {}, data: {}, scopes: {}, events: {},
|
|
410
418
|
components: new Set(components), candidates: new Set<string>(), diagnostics: [],
|
|
411
|
-
removeKeys: {},
|
|
419
|
+
removeKeys: {},
|
|
412
420
|
};
|
|
413
421
|
}
|
|
414
422
|
|
|
415
|
-
/** 协调组件 props
|
|
416
|
-
export function linkRemoveProps(parts: Pick<Parts, 'removeKeys'
|
|
423
|
+
/** 协调组件 props 里与成员删除有关的一项(removeKeys,空的不写):各 link 系模板只管展开,计算只此一份 */
|
|
424
|
+
export function linkRemoveProps(parts: Pick<Parts, 'removeKeys'>): Rec {
|
|
417
425
|
return {
|
|
418
426
|
...(Object.keys(parts.removeKeys).length > 0 ? { removeKeys: { ...parts.removeKeys } } : {}),
|
|
419
|
-
...(Object.keys(parts.removeConfirms).length > 0 ? { removeConfirms: { ...parts.removeConfirms } } : {}),
|
|
420
427
|
};
|
|
421
428
|
}
|
|
422
429
|
|
|
@@ -483,8 +490,12 @@ export function cls(value: string): string {
|
|
|
483
490
|
return value === '' ? '' : ` class="${esc(value)}"`;
|
|
484
491
|
}
|
|
485
492
|
|
|
493
|
+
/** 无界面协作宿主(只持有切片 / 事件的数据组件):不占版面,不然业务壳根的 flex gap 会给每个零高度宿主各多量出一份间距(页面标题到首块多出 16~32px) */
|
|
494
|
+
const HEADLESS_HOSTS: ReadonlySet<string> = new Set(['KitLinkHub', 'KitCrudBridge']);
|
|
495
|
+
|
|
486
496
|
export function host(component: string, id: string): string {
|
|
487
|
-
|
|
497
|
+
const cls = HEADLESS_HOSTS.has(component) ? ' class="hidden"' : '';
|
|
498
|
+
return `<div data-soma-component="${component}" data-soma-id="${esc(id)}"${cls}></div>`;
|
|
488
499
|
}
|
|
489
500
|
|
|
490
501
|
export { reloadPipe, semanticPipe };
|