soma-kit 0.1.13 → 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/package.json +3 -3
- package/spec/generated/kit-app.schema.json +14 -0
- package/spec/generated/kit-page.schema.json +25 -0
- package/spec/kit-grammar.json +178 -27
- package/spec/kit-grammar.schema.json +1 -3
- package/src/app/app-config.ts +10 -4
- package/src/app/index.ts +13 -1
- package/src/app/kit-view-context.ts +19 -2
- package/src/app/server-pages.ts +5 -1
- package/src/app/server.ts +15 -5
- package/src/base/button.ts +5 -3
- package/src/base/end-edge.ts +14 -2
- package/src/base/gap-value.ts +24 -4
- package/src/base/illustrations.ts +2 -1
- package/src/base/index.ts +5 -0
- package/src/base/menu-button.ts +10 -23
- package/src/base/popover.ts +5 -4
- package/src/base/segmented.ts +14 -4
- package/src/base/shared.ts +11 -13
- package/src/base/state-panel.ts +34 -13
- package/src/base/tag.ts +18 -13
- package/src/base/text.ts +1 -1
- package/src/base/upload.ts +5 -4
- package/src/biz/approval-desk/shell.ts +8 -7
- package/src/biz/auth-panel/shell.ts +5 -4
- package/src/biz/category-crud/compile.ts +3 -2
- package/src/biz/category-crud/shell.ts +4 -3
- package/src/biz/checkout-page/shell.ts +9 -8
- package/src/biz/compose.ts +2 -2
- package/src/biz/data-components.ts +4 -0
- package/src/biz/import-wizard/shell.ts +12 -10
- package/src/biz/landing-page/shell.ts +2 -2
- package/src/biz/master-sub/compile.ts +114 -15
- package/src/biz/master-sub/detail-head.ts +61 -0
- package/src/biz/master-sub/index.ts +3 -2
- package/src/biz/master-sub/shell.ts +95 -63
- package/src/biz/multi-board/compile.ts +164 -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 +91 -23
- package/src/biz/notification-center/shell.ts +6 -5
- package/src/biz/page-templates/domain-templates.ts +2 -2
- package/src/biz/page-templates/result-page/shell.ts +2 -2
- package/src/biz/page-templates/sign-in-page/shell.ts +14 -14
- package/src/biz/record-detail/shell.ts +8 -7
- package/src/biz/settings-center/shell.ts +8 -7
- package/src/biz/shared/compile-helpers.ts +82 -3
- package/src/biz/shared/overlay-compile.ts +46 -4
- package/src/biz/shared/overlay-shell.ts +8 -6
- package/src/biz/single-form/shell.ts +6 -4
- package/src/biz/standard-crud/compile.ts +14 -1
- package/src/biz/standard-crud/shell.ts +18 -27
- package/src/biz/standard-crud/summary.ts +40 -0
- package/src/biz/step-form/shell.ts +11 -9
- package/src/biz/types.ts +6 -1
- package/src/cli/layout-cli.ts +7 -7
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/compile-page.ts +15 -4
- package/src/compile/component-candidates.ts +2 -0
- package/src/compile/fragment.ts +11 -0
- package/src/compile/layout-lint/rules-composition.ts +55 -6
- 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 +189 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/styles.ts +11 -1
- package/src/compile/types.ts +3 -1
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +3 -1
- package/src/data/approval-flow.ts +4 -1
- package/src/data/assignment-picker.ts +9 -4
- package/src/data/async-result-panel.ts +1 -1
- package/src/data/calendar.ts +7 -2
- package/src/data/carousel.ts +2 -0
- package/src/data/chart.ts +609 -42
- package/src/data/checklist.ts +4 -1
- package/src/data/comment-thread.ts +2 -1
- package/src/data/confirm-dialog.ts +4 -10
- package/src/data/field-mapper.ts +4 -1
- package/src/data/flow-editor.ts +2 -1
- package/src/data/footer.ts +2 -0
- package/src/data/gantt.ts +187 -25
- package/src/data/hero.ts +2 -0
- package/src/data/index.ts +10 -3
- package/src/data/item-list.ts +10 -3
- package/src/data/kanban.ts +3 -1
- package/src/data/matrix.ts +391 -0
- package/src/data/menu.ts +23 -11
- package/src/data/mockup.ts +3 -3
- package/src/data/modal-dialog.ts +118 -18
- package/src/data/navbar.ts +3 -1
- package/src/data/notice-list.ts +52 -19
- package/src/data/object-form.ts +128 -112
- package/src/data/pager.ts +3 -2
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +4 -1
- package/src/data/permission-tree.ts +6 -2
- package/src/data/pricing-table.ts +2 -1
- package/src/data/record-card.ts +18 -6
- package/src/data/resident.ts +8 -0
- package/src/data/row-editor.ts +2 -2
- package/src/data/rule-builder.ts +9 -4
- package/src/data/shape-util.ts +15 -14
- package/src/data/stat-group.ts +313 -69
- package/src/data/static-lazy.ts +4 -0
- package/src/data/static-registry.ts +6 -0
- package/src/data/survey.ts +4 -1
- package/src/data/system-switcher.ts +2 -1
- package/src/data/tour-guide.ts +2 -1
- package/src/data/transfer.ts +6 -2
- package/src/data/tree-table.ts +7 -5
- package/src/data/tree.ts +1 -1
- package/src/data/virtual-rows.ts +5 -4
- package/src/data/wrapped-candidates.ts +22 -1
- package/src/frames/index.ts +1 -0
- package/src/frames/list-summary.ts +100 -0
- package/src/frames/page-bar.ts +6 -14
- package/src/frames/shared.ts +20 -4
- package/src/frames/tabs-frame/shell.ts +8 -6
- package/src/frames/top-main-frame.ts +1 -1
- package/src/frames/types.ts +3 -1
- package/src/frames/workspace-frame/shell.ts +2 -2
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +41 -25
- package/src/generated/kit-grammar-runtime.ts +175 -28
- package/src/i18n/kit-text.ts +27 -0
- package/src/object-renderer/action-group.ts +139 -0
- package/src/object-renderer/action-more.ts +144 -0
- package/src/object-renderer/arrange.ts +49 -19
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +34 -13
- package/src/object-renderer/collection-table.ts +133 -65
- package/src/object-renderer/collection.ts +72 -59
- package/src/object-renderer/defaults.ts +2 -5
- package/src/object-renderer/emit-object.ts +4 -0
- package/src/object-renderer/emit-static.ts +116 -63
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/index.ts +5 -0
- package/src/object-renderer/layout-facts.ts +9 -1
- package/src/object-renderer/layout-plan.ts +136 -43
- package/src/object-renderer/layout-plan.types.ts +42 -5
- package/src/object-renderer/parts.ts +7 -259
- package/src/object-renderer/render-object.ts +59 -46
- package/src/object-renderer/table-actions.ts +72 -40
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +51 -20
- package/src/object-renderer/types.ts +7 -7
- package/src/recipes/container.ts +31 -0
- package/src/recipes/control.ts +57 -155
- package/src/recipes/emphasis.ts +56 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +23 -0
- package/src/recipes/overlay.ts +46 -1
- package/src/recipes/placeholder.ts +20 -4
- package/src/recipes/rail-grid.ts +3 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +12 -22
- package/src/recipes/status.ts +8 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +112 -6
- package/src/recipes/tabs.ts +49 -0
- package/src/recipes/title-row.ts +3 -3
- package/src/recipes/typography.ts +23 -42
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +13 -2
- package/src/theme/kit-theme.tpl +13 -2
- package/src/theme/nine-dim-structure.ts +77 -10
- package/src/theme/surface-layers.ts +6 -1
- package/src/theme/theme-tokens.ts +12 -5
- package/src/theme/typography.ts +21 -17
package/src/base/tag.ts
CHANGED
|
@@ -26,12 +26,13 @@ export const TAG_CLASS: Record<KitSize, Record<KitTone, string>> = {
|
|
|
26
26
|
warning: 'inline-flex items-center rounded-full bg-warning-soft px-1.5 py-0.5 text-xs font-medium text-warning-on-soft',
|
|
27
27
|
danger: 'inline-flex items-center rounded-full bg-danger-soft px-1.5 py-0.5 text-xs font-medium text-danger-on-soft',
|
|
28
28
|
},
|
|
29
|
+
// md 档:状态徽标(emphasis.status = pill)12 / 中等字重,与 sm 同字号、横向内边距大一档
|
|
29
30
|
md: {
|
|
30
|
-
neutral: 'inline-flex items-center rounded-full bg-surface-sunken px-2 py-0.5 text-
|
|
31
|
-
info: 'inline-flex items-center rounded-full bg-info-soft px-2 py-0.5 text-
|
|
32
|
-
success: 'inline-flex items-center rounded-full bg-success-soft px-2 py-0.5 text-
|
|
33
|
-
warning: 'inline-flex items-center rounded-full bg-warning-soft px-2 py-0.5 text-
|
|
34
|
-
danger: 'inline-flex items-center rounded-full bg-danger-soft px-2 py-0.5 text-
|
|
31
|
+
neutral: 'inline-flex items-center rounded-full bg-surface-sunken px-2 py-0.5 text-xs font-medium text-fg-muted',
|
|
32
|
+
info: 'inline-flex items-center rounded-full bg-info-soft px-2 py-0.5 text-xs font-medium text-info-on-soft',
|
|
33
|
+
success: 'inline-flex items-center rounded-full bg-success-soft px-2 py-0.5 text-xs font-medium text-success-on-soft',
|
|
34
|
+
warning: 'inline-flex items-center rounded-full bg-warning-soft px-2 py-0.5 text-xs font-medium text-warning-on-soft',
|
|
35
|
+
danger: 'inline-flex items-center rounded-full bg-danger-soft px-2 py-0.5 text-xs font-medium text-danger-on-soft',
|
|
35
36
|
},
|
|
36
37
|
lg: {
|
|
37
38
|
neutral: 'inline-flex items-center rounded-full bg-surface-sunken px-2.5 py-1 text-base font-medium text-fg-muted',
|
|
@@ -43,12 +44,13 @@ export const TAG_CLASS: Record<KitSize, Record<KitTone, string>> = {
|
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
// 状态点:每个语气一整串字面量(实心语义色;neutral 用淡字色,闲置态不用 warning / danger 由调用方选 tone)
|
|
47
|
+
// 徽标内的圆点 6px(h-1.5 w-1.5):与 12px 徽标字同一比例,不抢文字
|
|
46
48
|
const DOT_CLASS: Record<KitTone, string> = {
|
|
47
|
-
neutral: 'me-1.5 inline-block h-
|
|
48
|
-
info: 'me-1.5 inline-block h-
|
|
49
|
-
success: 'me-1.5 inline-block h-
|
|
50
|
-
warning: 'me-1.5 inline-block h-
|
|
51
|
-
danger: 'me-1.5 inline-block h-
|
|
49
|
+
neutral: 'me-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-fg-subtle',
|
|
50
|
+
info: 'me-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-info',
|
|
51
|
+
success: 'me-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-success',
|
|
52
|
+
warning: 'me-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-warning',
|
|
53
|
+
danger: 'me-1.5 inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-danger',
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
// variant: dot(状态点 + 文字,无底色无边框);pulse 时点外扩一圈(motion-safe)
|
|
@@ -206,7 +208,10 @@ export function createTag(): SomaComponentDefinition {
|
|
|
206
208
|
root.textContent = shown.text;
|
|
207
209
|
return;
|
|
208
210
|
}
|
|
209
|
-
|
|
211
|
+
// 状态呈现全应用一种:`variant: dot` 带文字且不脉冲时就是状态徽标(浅底 + on-soft 字 + 圆点);
|
|
212
|
+
// 只有脉冲(实时指示)或无文字的纯点才保留圆点形态
|
|
213
|
+
const dotAsPill = p.variant === 'dot' && !bool(p.pulse) && text !== '';
|
|
214
|
+
if (p.variant === 'dot' && !dotAsPill) {
|
|
210
215
|
const size = sizeOf(p.size);
|
|
211
216
|
const wrap = document.createElement('span');
|
|
212
217
|
wrap.setAttribute('aria-hidden', 'true');
|
|
@@ -225,7 +230,7 @@ export function createTag(): SomaComponentDefinition {
|
|
|
225
230
|
root.className = joinClass(DOT_ROOT[size], p.class);
|
|
226
231
|
return;
|
|
227
232
|
}
|
|
228
|
-
const variant = variantOf(p.variant);
|
|
233
|
+
const variant = dotAsPill ? 'soft' : variantOf(p.variant);
|
|
229
234
|
const size = sizeOf(p.size);
|
|
230
235
|
const clickable = bool(p.clickable);
|
|
231
236
|
const removable = bool(p.removable);
|
|
@@ -240,7 +245,7 @@ export function createTag(): SomaComponentDefinition {
|
|
|
240
245
|
body.setAttribute('data-kit-tag-click', '');
|
|
241
246
|
root.appendChild(body);
|
|
242
247
|
}
|
|
243
|
-
if (bool(p.dot) && variant !== 'solid') {
|
|
248
|
+
if ((bool(p.dot) || dotAsPill) && variant !== 'solid') {
|
|
244
249
|
const dot = document.createElement('span');
|
|
245
250
|
dot.setAttribute('aria-hidden', 'true');
|
|
246
251
|
dot.className = unknownTone ? KIT_TAG_UNKNOWN_DOT : DOT_CLASS[tone];
|
package/src/base/text.ts
CHANGED
|
@@ -66,7 +66,7 @@ function stateOf(root: HTMLElement): CopyState {
|
|
|
66
66
|
return s;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function resolveTextDisplay(p: Record<string, unknown>, root: HTMLElement): { text: string; option: ReturnType<typeof displayOf>['option'] } {
|
|
69
|
+
export function resolveTextDisplay(p: Record<string, unknown>, root: HTMLElement): { text: string; option: ReturnType<typeof displayOf>['option'] } {
|
|
70
70
|
const opts = optionsOf(p.options);
|
|
71
71
|
const raw = p.value;
|
|
72
72
|
const placeholder = str(p.placeholder);
|
package/src/base/upload.ts
CHANGED
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
import { safeSrc } from './avatar';
|
|
17
17
|
import { kitLocaleAt, kitText } from '../i18n/kit-text';
|
|
18
18
|
import { kitIcon } from './icons';
|
|
19
|
-
import {
|
|
19
|
+
import { setKitFace } from '../recipes';
|
|
20
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
20
21
|
import { mergeClass } from '../object-renderer/merge-class';
|
|
21
22
|
|
|
22
23
|
type FileStatus = 'pending' | 'uploading' | 'done' | 'error';
|
|
@@ -34,9 +35,9 @@ interface FileItem {
|
|
|
34
35
|
const ROOT_CLASS = 'flex w-full flex-col gap-2';
|
|
35
36
|
const PICK_CLASS: Record<KitSize, string> = {
|
|
36
37
|
// 选择文件钮 = 带文字的中性按钮:直接取按钮配方(描边走按钮描边令牌,随边界维度求解),只补「按内容收窄 + 手形光标」
|
|
37
|
-
sm: mergeClass(
|
|
38
|
-
md: mergeClass(
|
|
39
|
-
lg: mergeClass(
|
|
38
|
+
sm: mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'sm' }), 'w-fit cursor-pointer'),
|
|
39
|
+
md: mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'md' }), 'w-fit cursor-pointer'),
|
|
40
|
+
lg: mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'lg' }), 'w-fit cursor-pointer'),
|
|
40
41
|
};
|
|
41
42
|
// 投放区:静止 / 拖入高亮 / 禁用,各一整串
|
|
42
43
|
const DROP_CLASS = {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
5
5
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
6
6
|
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
7
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
7
8
|
import { cls, esc, host } from '../link/shared';
|
|
8
9
|
|
|
9
10
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -11,14 +12,14 @@ export const APPROVAL_DESK_AREAS = ['root', 'queue', 'request', 'history'] as co
|
|
|
11
12
|
export type ApprovalDeskArea = (typeof APPROVAL_DESK_AREAS)[number];
|
|
12
13
|
|
|
13
14
|
export const APPROVAL_DESK_CLASS = {
|
|
14
|
-
root: '@container flex flex-col gap-
|
|
15
|
-
grid: 'grid grid-cols-12 gap-
|
|
16
|
-
queue: mergeClass('col-span-12 @md:col-span-3 flex min-w-0 flex-col gap-
|
|
17
|
-
request: mergeClass('col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-
|
|
18
|
-
history: mergeClass('col-span-12 @md:col-span-4 flex min-w-0 flex-col gap-
|
|
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()),
|
|
19
20
|
/** 没有历史栏时审批单栏吃掉右侧 4 份(9/12) */
|
|
20
|
-
requestWide: mergeClass('col-span-12 @md:col-span-9 flex min-w-0 flex-col gap-
|
|
21
|
-
title: 'min-w-0 truncate
|
|
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')),
|
|
22
23
|
} as const;
|
|
23
24
|
|
|
24
25
|
export function approvalDeskIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -3,21 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
5
5
|
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
6
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
6
7
|
import { cls, esc, host } from '../link/shared';
|
|
7
8
|
|
|
8
9
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
9
10
|
export const AUTH_PANEL_AREAS = ['root', 'user', 'roles', 'matrix'] as const;
|
|
10
11
|
export type AuthPanelArea = (typeof AUTH_PANEL_AREAS)[number];
|
|
11
12
|
|
|
12
|
-
const CARD = mergeClass('flex min-w-0 flex-col gap-
|
|
13
|
+
const CARD = mergeClass('flex min-w-0 flex-col gap-region p-card', kitShellRecipe());
|
|
13
14
|
|
|
14
15
|
export const AUTH_PANEL_CLASS = {
|
|
15
|
-
root: '@container flex flex-col gap-
|
|
16
|
+
root: '@container flex flex-col gap-section',
|
|
16
17
|
user: CARD,
|
|
17
|
-
grid: 'grid grid-cols-12 gap-
|
|
18
|
+
grid: 'grid grid-cols-12 gap-section',
|
|
18
19
|
roles: mergeClass('col-span-12 @md:col-span-4', CARD),
|
|
19
20
|
matrix: mergeClass('col-span-12 @md:col-span-8', CARD),
|
|
20
|
-
title: '
|
|
21
|
+
title: kitTypographyRecipe('sectionTitle'),
|
|
21
22
|
} as const;
|
|
22
23
|
|
|
23
24
|
export function authPanelIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -14,7 +14,7 @@ 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
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';
|
|
@@ -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);
|
|
@@ -8,9 +8,10 @@ import { cls, esc, host } from '../link/shared';
|
|
|
8
8
|
export const CATEGORY_CRUD_AREAS = ['root', 'categorySidebar', 'itemWorkspace', 'dialog'] as const;
|
|
9
9
|
|
|
10
10
|
export const CATEGORY_CRUD_CLASS = {
|
|
11
|
-
root: '@container flex flex-col gap-
|
|
12
|
-
categorySidebar: mergeClass('w-full shrink-0 @md:w-56 p-
|
|
13
|
-
|
|
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 })),
|
|
14
15
|
} as const;
|
|
15
16
|
|
|
16
17
|
export function categoryCrudIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
5
5
|
import { kitShellRecipe } from '../../recipes/container';
|
|
6
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
6
7
|
import { cls, esc } from '../link/shared';
|
|
7
8
|
|
|
8
9
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -10,14 +11,14 @@ export const CHECKOUT_PAGE_AREAS = ['root', 'form', 'summary', 'items', 'amounts
|
|
|
10
11
|
export type CheckoutPageArea = (typeof CHECKOUT_PAGE_AREAS)[number];
|
|
11
12
|
|
|
12
13
|
export const CHECKOUT_PAGE_CLASS = {
|
|
13
|
-
root: '@container grid grid-cols-12 gap-
|
|
14
|
-
form: mergeClass('col-span-12 @md:col-span-7 flex min-w-0 flex-col gap-
|
|
15
|
-
summary: 'col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-
|
|
16
|
-
items: mergeClass('flex flex-col gap-
|
|
17
|
-
amounts: mergeClass('flex flex-col gap-
|
|
18
|
-
title: '
|
|
19
|
-
/** 表单底部提交栏(表单 actions
|
|
20
|
-
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',
|
|
21
22
|
} as const;
|
|
22
23
|
|
|
23
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
|
/** 装配期并入组件表的协作数据组件:名字 -> 定义 */
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { mergeClass } from '../../object-renderer/merge-class';
|
|
6
6
|
import { kitShellRecipe } from '../../recipes/container';
|
|
7
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
7
8
|
import { cls, esc, host } from '../link/shared';
|
|
8
9
|
import { kitText } from '../../i18n/kit-text';
|
|
9
10
|
import { kitIconHtml } from '../../base/icons';
|
|
@@ -19,10 +20,10 @@ export const IMPORT_WIZARD_STEP_TITLES = [
|
|
|
19
20
|
|
|
20
21
|
export const IMPORT_WIZARD_CLASS = {
|
|
21
22
|
root: '@container flex justify-center',
|
|
22
|
-
card: mergeClass('flex w-full max-w-3xl flex-col gap-
|
|
23
|
-
title: '
|
|
24
|
-
steps: 'flex flex-wrap items-center gap-
|
|
25
|
-
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',
|
|
26
27
|
circle: 'flex h-6 w-6 items-center justify-center rounded-full text-sm font-medium',
|
|
27
28
|
circleAt: 'bg-primary text-primary-fg',
|
|
28
29
|
circlePast: 'bg-success text-success-fg',
|
|
@@ -31,13 +32,13 @@ export const IMPORT_WIZARD_CLASS = {
|
|
|
31
32
|
labelPast: 'text-sm text-fg',
|
|
32
33
|
labelFut: 'text-sm text-fg-muted',
|
|
33
34
|
joint: 'w-6 border-t border-border-subtle',
|
|
34
|
-
panel: 'flex flex-col gap-
|
|
35
|
-
panelTitle: '
|
|
35
|
+
panel: 'flex flex-col gap-section',
|
|
36
|
+
panelTitle: kitTypographyRecipe('sectionTitle'),
|
|
36
37
|
hint: 'text-sm text-fg-muted',
|
|
37
38
|
error: 'text-sm text-danger-on-soft',
|
|
38
|
-
buttons: 'flex flex-wrap items-center justify-end gap-
|
|
39
|
-
preview: 'flex flex-col gap-
|
|
40
|
-
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',
|
|
41
42
|
} as const;
|
|
42
43
|
|
|
43
44
|
export interface ImportWizardIds {
|
|
@@ -156,7 +157,8 @@ export function importWizardHtml(
|
|
|
156
157
|
+ '</div>');
|
|
157
158
|
|
|
158
159
|
const title = parts.title === '' ? '' : `<h2${cls(C.title)}>${esc(parts.title)}</h2>`;
|
|
159
|
-
|
|
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>`;
|
|
160
162
|
const root = mergeClass(mergeClass(C.root, areaClass.root), extra);
|
|
161
163
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitImportHub', ids.hub)}\n${card}\n</div>`;
|
|
162
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 } {
|
|
@@ -14,30 +14,65 @@
|
|
|
14
14
|
// 缺关联键不取数:从属对象的 from 编成 core `from[].require`(requireLink),尚未选中主行时对象落 idle,不发请求。
|
|
15
15
|
|
|
16
16
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
17
|
+
import { KIT_ARRANGE } from 'soma-foundation/arrange';
|
|
17
18
|
import { kitText } from '../../i18n/kit-text';
|
|
18
19
|
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
19
|
-
import type { KitObject } from '../../object-renderer/types';
|
|
20
|
+
import type { KitFieldItem, KitObject } from '../../object-renderer/types';
|
|
20
21
|
import type { KitFragment } from '../../compile/fragment';
|
|
21
22
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
22
23
|
import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS } from '../shared/coordinator';
|
|
23
|
-
import { bizObjectName, finishBizCompile, validateBizAreaClass } from '../shared/compile-helpers';
|
|
24
|
+
import { bizObjectName, finishBizCompile, hoistedToolbarHtml, listPanelBody, validateBizAreaClass } from '../shared/compile-helpers';
|
|
24
25
|
import { wireDialogForm } from '../shared/pipes';
|
|
25
|
-
import { filterToolbarRow } from '../shared/compile-helpers';
|
|
26
26
|
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles, dialogWidthOf } from '../shared/overlay-shell';
|
|
27
27
|
import { KIT_CRUD_LINK_KEY, compileOverlay, validateOverlayNames } from '../shared/overlay-compile';
|
|
28
28
|
import type { KitAction } from '../../object-renderer/types';
|
|
29
29
|
import { KIT_LINK_MIRRORS, KIT_NONE_PATH, KIT_SEL_PATH } from '../link/hub';
|
|
30
30
|
import {
|
|
31
|
-
IDENT, bindFieldSlots, bindPickedReloads, classesIn, emitMember, grantPageReset, isRec, keyFieldOf, linkRemoveProps, mirrorPath, newParts,
|
|
31
|
+
IDENT, bindFieldSlots, bindPickedReloads, classesIn, emitMember, grantPageReset, host, isRec, keyFieldOf, linkRemoveProps, mirrorPath, newParts,
|
|
32
32
|
normalizeMember, patchProps, semanticPipe, sortMirrors, type FieldSlots, type Rec,
|
|
33
33
|
} from '../link/shared';
|
|
34
34
|
import { MasterSubWorkstation } from './index';
|
|
35
|
-
import { MASTER_SUB_AREAS, MASTER_SUB_CLASS, MASTER_WIDTHS, masterSubHtml, masterSubIds, type MasterWidth, type SubBlock } from './shell';
|
|
35
|
+
import { MASTER_SUB_AREAS, MASTER_SUB_CLASS, MASTER_WIDTHS, masterSubHtml, masterSubIds, subBlockHtml, type MasterWidth, type SubBlock } from './shell';
|
|
36
|
+
import { groupTabsFrame } from '../../object-renderer/emit-static';
|
|
37
|
+
import { KIT_CLASS_DEFAULTS } from '../../object-renderer/defaults';
|
|
38
|
+
import { appRolesOf, boardCompositionNodes, boardPanelKind, composeBoard } from '../multi-board/composition';
|
|
36
39
|
|
|
37
40
|
export function masterSubObjectName(pageId: string, role: string): string {
|
|
38
41
|
return bizObjectName(pageId, role);
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
const ID_NAME = new RegExp(KIT_ARRANGE.columns.idNamePattern);
|
|
45
|
+
/** 详情头记录卡的 map 占位键:数据里没有它,卡就不画对应项(标题 / 状态让给详情头) */
|
|
46
|
+
const HEADLESS_KEY = '__ms_head__';
|
|
47
|
+
|
|
48
|
+
/** 主列表表格的各列最小宽之和(rem):取列轨求解写在表壳内层的 `min-w-<刻度>`(刻度 × 引擎步长);滚动模式 / 没有表格 / 表壳没有最小宽返回 undefined */
|
|
49
|
+
export function listMinRemOf(ir: { views: Partial<Record<string, { layout: { kind: string; innerClass?: string } }>> }): number | undefined {
|
|
50
|
+
const layout = ir.views.list?.layout;
|
|
51
|
+
if (layout === undefined || layout.kind !== 'table') return undefined;
|
|
52
|
+
const hit = /(?:^|\s)min-w-(\d+)(?:\s|$)/.exec(layout.innerClass ?? '');
|
|
53
|
+
return hit === null ? undefined : Number(hit[1]) * KIT_ARRANGE.columns.track.stepRem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 详情头的字段:取主对象摘要字段(没写 fields 取 schema 字段序)里第一个为标题,其余里的主键 / 编码类字段(名字命中引擎 idNamePattern)为副标题;
|
|
58
|
+
* 其余字段(rest)仍按摘要画在头下面。摘要没有可作标题的字段(只写了 groups、字段全是分隔线)返回 undefined:不画详情头标题。
|
|
59
|
+
*/
|
|
60
|
+
export function detailHeadFields(master: KitObject, key: string): { title: string; subtitle: string | undefined; rest: KitFieldItem[] } | undefined {
|
|
61
|
+
const sum = master.view?.summary;
|
|
62
|
+
if (sum === undefined || sum.groups !== undefined) return undefined;
|
|
63
|
+
const items: KitFieldItem[] = Array.isArray(sum.fields) ? [...sum.fields] : Object.keys(master.schema);
|
|
64
|
+
const nameOf = (f: KitFieldItem): string | undefined => (typeof f === 'string' ? f : isRec(f) && typeof f.name === 'string' ? f.name : undefined);
|
|
65
|
+
// 副标题只取朴素的编码字段:写了自定义组件 / 属性的字段(如带「复制」的接口标识)留在摘要里,不降成一行等宽文字
|
|
66
|
+
const plain = (f: KitFieldItem): boolean => typeof f === 'string' || (isRec(f) && f.component === undefined && f.props === undefined && f.action === undefined);
|
|
67
|
+
const named = items.map(nameOf);
|
|
68
|
+
const titleAt = named.findIndex((n) => n !== undefined);
|
|
69
|
+
if (titleAt < 0) return undefined;
|
|
70
|
+
const title = named[titleAt]!;
|
|
71
|
+
const subAt = named.findIndex((n, i) => i !== titleAt && n !== undefined && plain(items[i]!) && (n === key || ID_NAME.test(n)));
|
|
72
|
+
const subtitle = subAt < 0 ? undefined : named[subAt]!;
|
|
73
|
+
return { title, subtitle, rest: items.filter((_, i) => i !== titleAt && i !== subAt) };
|
|
74
|
+
}
|
|
75
|
+
|
|
41
76
|
export function compileMasterSub(input: KitBizInput, ctx: KitBizContext): KitFragment {
|
|
42
77
|
const CLOSE_LABEL = kitText('soma.kit.close', undefined, ctx.locale);
|
|
43
78
|
const CANCEL_LABEL = kitText('soma.kit.cancel', undefined, ctx.locale);
|
|
@@ -79,6 +114,12 @@ export function compileMasterSub(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
79
114
|
const isStatic = !!v && (v.staticComponent !== undefined || (isRec(v.summary) && v.summary.staticComponent !== undefined) || (isRec(v.list) && v.list.staticComponent !== undefined));
|
|
80
115
|
if (!isRec(s) || (!isStatic && !isRec(s.schema)) || !isRec(s.behavior)) {
|
|
81
116
|
fail('KIT-BIZ-001', `subs.${n} 必须是对象声明(schema / behavior;写死形状组件可省 schema)`, `product.objects.subs.${n}`);
|
|
117
|
+
} else if (s.group !== undefined && (typeof s.group !== 'string' || s.group.trim() === '')) {
|
|
118
|
+
fail('KIT-PAGE-001', `subs.${n}.group 必须是非空字符串(分组名:同名从属收进详情里页内页签的同一签;不写 group 的从属常显在页签之上)`, `product.objects.subs.${n}.group`);
|
|
119
|
+
} else if (s.head !== undefined) {
|
|
120
|
+
if (s.head !== true) fail('KIT-PAGE-001', `subs.${n}.head 只许写 true(把本从属收进详情头:记录卡的状态进头右侧、关键数 / 事实在标题下一行)`, `product.objects.subs.${n}.head`);
|
|
121
|
+
else if (s.group !== undefined || s.title !== undefined) fail('KIT-PAGE-001', `subs.${n} 是详情头成员,不写 group / title(位置随详情头、名字由头里的对象名承担)`, `product.objects.subs.${n}`);
|
|
122
|
+
else if (!isStatic) fail('KIT-PAGE-001', `subs.${n} 是详情头成员,必须是写死形状组件(StatGroup / RecordCard 等 staticComponent)`, `product.objects.subs.${n}.view`);
|
|
82
123
|
}
|
|
83
124
|
}
|
|
84
125
|
if (out.diagnostics.length > 0) return finishBizCompile(out, '');
|
|
@@ -109,11 +150,26 @@ export function compileMasterSub(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
109
150
|
const selKey = mirrorPath(link, KIT_LINK_MIRRORS.selKey);
|
|
110
151
|
const selRow = mirrorPath(link, KIT_LINK_MIRRORS.selRow);
|
|
111
152
|
const mk = KIT_COORD_MIRRORS;
|
|
153
|
+
// 详情头:摘要字段里第一个是标题、编码类字段是副标题,两者进头;剩下的字段仍按摘要画在头下面(没有剩余则不画摘要)
|
|
154
|
+
const headFields = detailHeadFields(master, masterKey);
|
|
155
|
+
if (headFields !== undefined) {
|
|
156
|
+
const sumView = master.view?.summary;
|
|
157
|
+
if (master.view !== undefined) {
|
|
158
|
+
if (headFields.rest.length > 0 && sumView !== undefined) master.view.summary = { ...sumView, fields: headFields.rest as KitFieldItem[] };
|
|
159
|
+
else delete master.view.summary;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
112
162
|
|
|
113
163
|
// ---- 从属对象(linkKey 缺省 = 主对象 key 字段名)
|
|
114
|
-
const subs: Array<{ object: string; scope: string; obj: KitObject; title: string }> = [];
|
|
164
|
+
const subs: Array<{ object: string; scope: string; obj: KitObject; title: string; name: string; group: string; raw: Rec; head: boolean; headStatus?: { status: string; tone: string } }> = [];
|
|
115
165
|
for (const n of subNames) {
|
|
116
|
-
const
|
|
166
|
+
const rawDecl = rawSubs[n] as unknown as Rec;
|
|
167
|
+
const isHead = rawDecl.head === true;
|
|
168
|
+
// 详情头里的记录卡:它的标题 / 状态让给详情头(状态进头右侧),卡里只留事实 / 标签;map 指向不存在的键 = 不画那一项
|
|
169
|
+
const cardMap = isHead && boardPanelKind(rawDecl) === 'RecordCard' && isRec(rawDecl.view) ? ((rawDecl.view as Rec).map as Rec | undefined) ?? {} : undefined;
|
|
170
|
+
const raw: Rec = cardMap === undefined
|
|
171
|
+
? rawDecl
|
|
172
|
+
: { ...rawDecl, view: { ...(rawDecl.view as Rec), map: { ...cardMap, title: HEADLESS_KEY, subtitle: HEADLESS_KEY, status: HEADLESS_KEY, tone: HEADLESS_KEY } } };
|
|
117
173
|
const behavior = raw.behavior as Rec;
|
|
118
174
|
const linkKey = typeof behavior.linkKey === 'string' && behavior.linkKey !== '' ? behavior.linkKey : masterKey;
|
|
119
175
|
const norm = normalizeMember(raw, {
|
|
@@ -127,7 +183,10 @@ export function compileMasterSub(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
127
183
|
});
|
|
128
184
|
out.diagnostics.push(...norm.diagnostics);
|
|
129
185
|
const object = masterSubObjectName(ctx.pageId, n);
|
|
130
|
-
subs.push({
|
|
186
|
+
subs.push({
|
|
187
|
+
object, scope: `${object}_scope`, obj: norm.obj, title: typeof raw.title === 'string' ? raw.title : '', name: n, group: typeof raw.group === 'string' ? raw.group.trim() : '', raw: rawDecl, head: isHead,
|
|
188
|
+
...(cardMap !== undefined ? { headStatus: { status: typeof cardMap.status === 'string' ? cardMap.status : 'status', tone: typeof cardMap.tone === 'string' ? cardMap.tone : 'tone' } } : {}),
|
|
189
|
+
});
|
|
131
190
|
}
|
|
132
191
|
// 辅助栏对象:带 behavior.from 时同从属对象(关联键 = 主对象 key,未选中不发请求);否则原样(静态组件 / 只读展示)
|
|
133
192
|
let aside: { object: string; scope: string; obj: KitObject; linked: boolean } | undefined;
|
|
@@ -199,11 +258,30 @@ export function compileMasterSub(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
199
258
|
|
|
200
259
|
const subBlocks: SubBlock[] = [];
|
|
201
260
|
const pageScopes: string[] = [];
|
|
261
|
+
// 页面构成:详情里每个分区(常显区、每个 group 页签)第一个主体 primary、其余 secondary(标题 / 指标 / 图表尺度随级别走)
|
|
262
|
+
const subPlan = composeBoard(boardCompositionNodes(
|
|
263
|
+
subs.filter((s) => !s.head).map((s) => ({ name: s.name, kind: boardPanelKind(s.raw), group: s.group, head: '', span: undefined })),
|
|
264
|
+
appRolesOf(ctx.staticComponents),
|
|
265
|
+
), 'workspace');
|
|
266
|
+
/** 详情头成员(head: true):内容放在详情头里(标题下一行),不是从属块 */
|
|
267
|
+
const headBands: string[] = [];
|
|
268
|
+
let headStatusPaths: { status: string; tone: string } | undefined;
|
|
202
269
|
for (const s of subs) {
|
|
203
270
|
const sm = emitMember(out, { object: s.object, scope: s.scope, obj: s.obj, ctx, link, hubId: ids.hub, fieldSteps, overlayTargets });
|
|
271
|
+
if (s.head) {
|
|
272
|
+
headBands.push([sm.r.parts.toolbar ?? '', sm.r.parts.filter ?? '', sm.listHtml, sm.r.parts.summary ?? ''].filter((x) => x !== '').join('\n'));
|
|
273
|
+
if (s.headStatus !== undefined && headStatusPaths === undefined) {
|
|
274
|
+
const base = `page.data.${s.object}`;
|
|
275
|
+
headStatusPaths = { status: `${base}.${s.headStatus.status}`, tone: `${base}.${s.headStatus.tone}` };
|
|
276
|
+
}
|
|
277
|
+
if (grantPageReset(out, s.scope, ids.hub)) pageScopes.push(s.scope);
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
204
280
|
subBlocks.push({
|
|
205
281
|
title: s.title,
|
|
206
282
|
html: [sm.r.parts.toolbar ?? '', sm.r.parts.filter ?? '', sm.listHtml, sm.r.parts.summary ?? ''].filter((x) => x !== '').join('\n'),
|
|
283
|
+
...(s.group !== '' ? { group: s.group } : {}),
|
|
284
|
+
emphasis: subPlan.placements[s.name]?.emphasis ?? 'secondary',
|
|
207
285
|
});
|
|
208
286
|
if (grantPageReset(out, s.scope, ids.hub)) pageScopes.push(s.scope);
|
|
209
287
|
}
|
|
@@ -297,17 +375,38 @@ export function compileMasterSub(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
297
375
|
? rawMaster.unselectedText
|
|
298
376
|
: kitText('soma.kit.ms_unselected', undefined, ctx.locale);
|
|
299
377
|
// 没有列表标题(标题自带工具栏位)、又有筛选区:主操作并入筛选区那一行靠右,不再独占一整行
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
378
|
+
// 主列表卡是单一面板:工具条区(筛选 + 主操作)+ 通栏 hairline + 集合共用一个面(面板持有内边距,见 shared/compile-helpers#listPanelBody)
|
|
379
|
+
// 页面级的创建动作(工具栏)是区域主动作:搬进页头一行右侧(与列表页同一个位置),控件列里只留筛选与列表
|
|
380
|
+
const masterHtml = [hoistedToolbarHtml(m.r.parts.toolbar ?? ''), listPanelBody({ filter: m.r.parts.filter ?? '', toolbar: '', list: m.listHtml }, '', true)].filter((p) => p !== '').join('\n');
|
|
381
|
+
// 分组页签(subs.<名>.group):未分组的从属常显在页签之上;同组从属收进详情里页内页签的同一签(组名按首次出现排序)
|
|
382
|
+
const groupNames: string[] = [];
|
|
383
|
+
for (const b of subBlocks) if (b.group !== undefined && !groupNames.includes(b.group)) groupNames.push(b.group);
|
|
384
|
+
const tabsHtml = groupNames.length === 0
|
|
385
|
+
? ''
|
|
386
|
+
: groupTabsFrame(
|
|
387
|
+
`${ctx.pageId}__ms_tabs`, 'list', groupNames,
|
|
388
|
+
groupNames.map((g) => `<div class="flex min-w-0 flex-col gap-section">${subBlocks.filter((b) => b.group === g).map((b) => subBlockHtml(b, areaClass)).join('\n')}</div>`),
|
|
389
|
+
KIT_CLASS_DEFAULTS.groupsWrap, out.show, out.components,
|
|
390
|
+
);
|
|
306
391
|
// 辅助栏只放异步结果面板(AsyncResultPanel):尚无结果时整栏收起、中栏占满,面板有内容再出现(标记由面板切,见 data/async-result-panel)
|
|
307
392
|
const asideViews = aside === undefined ? [] : [aside.obj.view?.list, aside.obj.view?.summary];
|
|
308
393
|
const asideIsResultPanel = aside !== undefined && asideViews.some((v) => (v as { staticComponent?: unknown } | undefined)?.staticComponent === 'AsyncResultPanel')
|
|
309
394
|
&& aside.obj.view?.form === undefined && aside.obj.view?.filter === undefined;
|
|
310
|
-
|
|
395
|
+
// 详情头:对象名 + 编码 + 状态徽标(KitDetailHead,标题 / 编码取选中行、状态取头记录卡)+ 头成员(关键数 / 事实)
|
|
396
|
+
const headParts: string[] = [];
|
|
397
|
+
if (headFields !== undefined) {
|
|
398
|
+
out.components.add('KitDetailHead');
|
|
399
|
+
out.show[ids.head] = {
|
|
400
|
+
props: {
|
|
401
|
+
title: `${selRow}.${headFields.title}`,
|
|
402
|
+
...(headFields.subtitle !== undefined ? { subtitle: `${selRow}.${headFields.subtitle}` } : {}),
|
|
403
|
+
...(headStatusPaths !== undefined ? { status: headStatusPaths.status, tone: headStatusPaths.tone } : {}),
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
headParts.push(host('KitDetailHead', ids.head));
|
|
407
|
+
}
|
|
408
|
+
headParts.push(...headBands);
|
|
409
|
+
const html = masterSubHtml(ids, { master: masterHtml, summary: m.r.parts.summary ?? '', subs: subBlocks, tabs: tabsHtml, head: headParts.join('\n'), dialog: [dialog, ...overlayHtmls].filter((x) => x !== '').join('\n'), aside: asideHtml, asideIdleInit: asideIsResultPanel, width: masterWidth, unselectedText, ...(listMinRemOf(m.r.ir) !== undefined ? { listMinRem: listMinRemOf(m.r.ir)! } : {}) }, areaClass, input.class);
|
|
311
410
|
for (const c of classesIn(html)) out.candidates.add(c);
|
|
312
411
|
for (const c of Object.values(MASTER_SUB_CLASS)) for (const t of c.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
313
412
|
return finishBizCompile(out, html);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// KitDetailHead:主从页详情头(页面构成:详情 = 唯一容器,头 = 对象名 + 编码 + 状态徽标,无自己的框)。
|
|
2
|
+
// 标题取主记录的主字段、副标题取编码类字段(等宽弱化)、右侧一枚状态徽标(取自详情里被 `head: true` 收进头的记录卡的状态)。
|
|
3
|
+
// 数据由编译期绑定(title / subtitle / status / tone 都是路径绑定的值):本组件只画,不取数、不改数。
|
|
4
|
+
// 标题下一行的关键数(`head: true` 的 StatGroup)与记录卡的事实 / 标签由壳放在本组件之后,同属一个头。
|
|
5
|
+
|
|
6
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
7
|
+
import { CLASS_PROP, classCandidates, createKitController, joinClass, str } from '../../base/shared';
|
|
8
|
+
import { mergeClass } from '../../object-renderer/merge-class';
|
|
9
|
+
import { KIT_STATUS_BADGE_CLASS, KIT_STATUS_DOT_CLASS } from '../../recipes/status';
|
|
10
|
+
import { kitTypographyPartOf, kitTypographyRecipe } from '../../recipes/typography';
|
|
11
|
+
import { TONE_DOT, TONE_SOFT, mk, shapeToneOf } from '../../data/shape-util';
|
|
12
|
+
|
|
13
|
+
const ROOT_CLASS = 'flex min-w-0 flex-wrap items-baseline gap-region';
|
|
14
|
+
const TITLE_CLASS = mergeClass('min-w-0 break-words', kitTypographyRecipe('sectionTitle'));
|
|
15
|
+
const SUBTITLE_CLASS = 'min-w-0 break-all font-mono text-sm text-fg-muted';
|
|
16
|
+
const BADGE_SLOT_CLASS = 'ms-auto flex shrink-0 items-center';
|
|
17
|
+
|
|
18
|
+
export const KIT_DETAIL_HEAD_CLASS_CANDIDATES: readonly string[] = classCandidates(
|
|
19
|
+
ROOT_CLASS, TITLE_CLASS, SUBTITLE_CLASS, BADGE_SLOT_CLASS, KIT_STATUS_BADGE_CLASS, KIT_STATUS_DOT_CLASS,
|
|
20
|
+
Object.values(TONE_SOFT), Object.values(TONE_DOT),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export function createKitDetailHead(): SomaComponentDefinition {
|
|
24
|
+
return {
|
|
25
|
+
contract: {
|
|
26
|
+
name: 'KitDetailHead',
|
|
27
|
+
layer: 'data',
|
|
28
|
+
props: {
|
|
29
|
+
title: { type: 'string', default: '', desc: '标题:主记录的主字段值(编译期绑定到选中行)' },
|
|
30
|
+
subtitle: { type: 'string', default: '', desc: '副标题:主记录的编码类字段值(等宽弱化)' },
|
|
31
|
+
status: { type: 'string', default: '', desc: '状态徽标文字;空则不画徽标' },
|
|
32
|
+
tone: { type: 'string', default: 'neutral', desc: '状态徽标语气:neutral / primary / info / success / warning / danger' },
|
|
33
|
+
class: CLASS_PROP,
|
|
34
|
+
},
|
|
35
|
+
emits: {},
|
|
36
|
+
},
|
|
37
|
+
templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS}"></div>`,
|
|
38
|
+
controllerFactory: createKitController(() => ({
|
|
39
|
+
render(root, p) {
|
|
40
|
+
root.className = joinClass(ROOT_CLASS, p.class);
|
|
41
|
+
root.textContent = '';
|
|
42
|
+
const title = mk('h2', TITLE_CLASS, str(p.title));
|
|
43
|
+
const part = kitTypographyPartOf('sectionTitle');
|
|
44
|
+
if (part !== undefined) title.setAttribute('data-kit-part', part);
|
|
45
|
+
root.appendChild(title);
|
|
46
|
+
const subtitle = str(p.subtitle);
|
|
47
|
+
if (subtitle !== '') root.appendChild(mk('span', SUBTITLE_CLASS, subtitle));
|
|
48
|
+
const status = str(p.status);
|
|
49
|
+
if (status !== '') {
|
|
50
|
+
const tone = shapeToneOf(p.tone);
|
|
51
|
+
const slot = mk('div', BADGE_SLOT_CLASS);
|
|
52
|
+
const badge = mk('span', `${KIT_STATUS_BADGE_CLASS} ${TONE_SOFT[tone]}`);
|
|
53
|
+
badge.appendChild(mk('span', `${KIT_STATUS_DOT_CLASS} ${TONE_DOT[tone]}`));
|
|
54
|
+
badge.appendChild(mk('span', '', status));
|
|
55
|
+
slot.appendChild(badge);
|
|
56
|
+
root.appendChild(slot);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
})),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -10,7 +10,8 @@ export const MasterSubWorkstation = defineKitBizComponent({
|
|
|
10
10
|
roles: {
|
|
11
11
|
// unselectedText:没有选中主行时从属区整区空态的文案(缺省取内置「请选择左侧记录」)
|
|
12
12
|
master: { required: true, views: ['filter', 'list', 'summary', 'form'], extraKeys: ['unselectedText'] },
|
|
13
|
-
|
|
13
|
+
// group:详情里的分组名(同名从属收进页内页签的同一签;不写 group 的常显在页签之上)
|
|
14
|
+
subs: { required: true, views: ['list', 'summary'], many: true, extraKeys: ['group'] },
|
|
14
15
|
aside: { required: false, views: ['list', 'summary'] },
|
|
15
16
|
},
|
|
16
17
|
areas: [...MASTER_SUB_AREAS],
|
|
@@ -20,4 +21,4 @@ export const MasterSubWorkstation = defineKitBizComponent({
|
|
|
20
21
|
});
|
|
21
22
|
|
|
22
23
|
export { compileMasterSub, masterSubObjectName } from './compile';
|
|
23
|
-
export { MASTER_SUB_AREAS, MASTER_SUB_CLASS,
|
|
24
|
+
export { MASTER_SUB_AREAS, MASTER_SUB_CLASS, MASTER_WIDTHS, masterSubIds, masterSubSplit } from './shell';
|