soma-kit 0.1.14 → 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 +4 -2
- package/spec/generated/kit-page.schema.json +72 -2
- package/spec/kit-grammar.json +163 -57
- package/spec/kit-grammar.schema.json +0 -24
- package/src/app/app-config.ts +1 -1
- 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 +7 -7
- package/src/app/kit-view-context.ts +11 -2
- 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 +30 -15
- 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/fab.ts +11 -6
- package/src/base/gap-value.ts +1 -1
- package/src/base/hint-tips.ts +1 -1
- package/src/base/index.ts +15 -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 +63 -27
- 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 +2 -2
- 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 +35 -36
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +43 -7
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +53 -59
- package/src/base/text.ts +37 -13
- 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 +21 -13
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +2 -2
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +2 -2
- package/src/biz/category-crud/compile.ts +17 -4
- package/src/biz/category-crud/shell.ts +7 -5
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +7 -6
- package/src/biz/compose.ts +3 -3
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +6 -4
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +5 -4
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +162 -19
- package/src/biz/master-sub/detail-head.ts +7 -6
- package/src/biz/master-sub/index.ts +3 -3
- package/src/biz/master-sub/shell.ts +90 -53
- package/src/biz/multi-board/compile.ts +3 -3
- package/src/biz/multi-board/index.ts +24 -9
- package/src/biz/multi-board/prose-fold.ts +2 -2
- package/src/biz/multi-board/shell.ts +17 -13
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +9 -2
- package/src/biz/page-templates/domain-templates.ts +6 -2
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +4 -3
- 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 +4 -4
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +4 -4
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +8 -5
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +4 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +48 -18
- package/src/biz/shared/overlay-shell.ts +63 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +8 -4
- package/src/biz/standard-crud/compile.ts +11 -4
- package/src/biz/standard-crud/shell.ts +26 -9
- package/src/biz/standard-crud/summary.ts +3 -1
- 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 +6 -4
- package/src/biz/types.ts +11 -4
- 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/compile/access-gate-attach.ts +1 -1
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +29 -234
- package/src/compile/component-candidates.ts +2 -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 +43 -13
- package/src/compile/page-composition.ts +33 -31
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +70 -32
- package/src/compile/types.ts +2 -2
- package/src/data/amount-breakdown.ts +4 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +9 -4
- package/src/data/assignment-picker.ts +28 -18
- package/src/data/async-result-panel.ts +6 -2
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +4 -3
- package/src/data/carousel.ts +11 -5
- package/src/data/chart.ts +153 -23
- package/src/data/checklist.ts +5 -4
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +7 -2
- package/src/data/confirm-dialog.ts +56 -13
- 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 +12 -6
- package/src/data/flow-editor.ts +105 -29
- package/src/data/footer.ts +6 -2
- package/src/data/gantt.ts +11 -8
- package/src/data/hero.ts +6 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +12 -5
- package/src/data/item-list.ts +6 -5
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +11 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +23 -14
- 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 +15 -9
- package/src/data/mockup.ts +9 -5
- package/src/data/modal-dialog.ts +39 -88
- package/src/data/navbar.ts +11 -7
- package/src/data/notice-list.ts +1 -1
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +129 -48
- package/src/data/pager.ts +12 -8
- package/src/data/panel-head.ts +1 -1
- package/src/data/permission-matrix.ts +15 -8
- package/src/data/permission-tree.ts +24 -11
- package/src/data/pricing-table.ts +8 -3
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +13 -9
- 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 +0 -12
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +10 -5
- package/src/data/rule-builder.ts +14 -8
- package/src/data/shape-util.ts +14 -3
- package/src/data/stat-group.ts +63 -22
- package/src/data/static-lazy.ts +3 -0
- package/src/data/static-registry.ts +8 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +9 -3
- package/src/data/system-switcher.ts +15 -6
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +6 -3
- package/src/data/transfer.ts +19 -10
- package/src/data/tree-table.ts +77 -12
- package/src/data/tree.ts +5 -2
- package/src/data/virtual-rows.ts +17 -7
- package/src/data/wrap.ts +2 -2
- package/src/frames/index.ts +3 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +59 -36
- package/src/frames/page-bar.ts +4 -2
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +18 -14
- 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 +12 -6
- package/src/frames/types.ts +3 -2
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +2 -1
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/view.ts +125 -76
- package/src/generated/kit-grammar-runtime.ts +61 -39
- package/src/i18n/kit-text.ts +114 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +31 -1
- package/src/object-renderer/action-more.ts +28 -12
- package/src/object-renderer/arrange.ts +37 -7
- package/src/object-renderer/collection-parts.ts +38 -7
- package/src/object-renderer/collection-table.ts +68 -23
- package/src/object-renderer/collection.ts +63 -30
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +8 -0
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +3 -0
- package/src/object-renderer/emit-static.ts +140 -37
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +2 -2
- package/src/object-renderer/index.ts +1 -1
- package/src/object-renderer/layout-facts.ts +37 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/render-object.ts +1 -1
- package/src/object-renderer/table-actions.ts +70 -23
- package/src/object-renderer/table-tools.ts +12 -5
- package/src/object-renderer/types.ts +9 -15
- 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 +25 -15
- package/src/recipes/control.ts +21 -3
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +12 -8
- package/src/recipes/frame-bleed.ts +3 -3
- package/src/recipes/index.ts +11 -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 +112 -26
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +1 -1
- package/src/recipes/stat-state.ts +1 -1
- package/src/recipes/state.ts +10 -8
- package/src/recipes/status.ts +13 -12
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +1 -1
- package/src/recipes/table-native-edit.ts +4 -4
- package/src/recipes/table-row.ts +11 -8
- package/src/recipes/tabs.ts +108 -31
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +4 -2
- package/src/recipes/typography.ts +2 -2
- 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 +38 -14
- package/src/theme/kit-theme.tpl +38 -14
- package/src/theme/nine-dim-structure.ts +66 -41
- package/src/theme/surface-layers.ts +11 -3
- package/src/theme/theme-tokens.ts +5 -1
- 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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { KIT_GRAMMAR_RUNTIME } from '../../generated/kit-grammar-runtime';
|
|
5
5
|
import { defineKitBizComponent } from '../define';
|
|
6
|
+
import type { KitBizDefinition } from '../types';
|
|
6
7
|
import { compileMultiBoard } from './compile';
|
|
7
8
|
import { MULTI_BOARD_AREAS } from './shell';
|
|
8
9
|
|
|
@@ -17,18 +18,32 @@ interface GrammarRuntimeNarrow {
|
|
|
17
18
|
const MULTI_BOARD_PANEL_KEYS: readonly string[] =
|
|
18
19
|
(KIT_GRAMMAR_RUNTIME as unknown as GrammarRuntimeNarrow).bizComponents?.MultiObjectBoard?.panelKeys ?? [];
|
|
19
20
|
|
|
21
|
+
const BOARD_ROLES: KitBizDefinition['roles'] = {
|
|
22
|
+
filter: { required: false, views: ['filter'] },
|
|
23
|
+
panels: {
|
|
24
|
+
required: true,
|
|
25
|
+
views: ['list', 'summary'],
|
|
26
|
+
many: true,
|
|
27
|
+
extraKeys: MULTI_BOARD_PANEL_KEYS,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
20
31
|
export const MultiObjectBoard = defineKitBizComponent({
|
|
21
32
|
kind: 'MultiObjectBoard',
|
|
22
|
-
roles:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
roles: BOARD_ROLES,
|
|
34
|
+
areas: [...MULTI_BOARD_AREAS],
|
|
35
|
+
compile: compileMultiBoard,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* ReportBoard:报告阅读页(尺寸规格 §3 阅读型)。区块构成与 MultiObjectBoard 相同(同一编译、同一套角色槽),
|
|
40
|
+
* 区别只在页面模式推导的版心:阅读版心 800(pageHeader.maxWidths.medium,取自 sizeSpec.page.readMaxPx),页面不写 max_width。
|
|
41
|
+
*/
|
|
42
|
+
export const ReportBoard = defineKitBizComponent({
|
|
43
|
+
kind: 'ReportBoard',
|
|
44
|
+
roles: BOARD_ROLES,
|
|
31
45
|
areas: [...MULTI_BOARD_AREAS],
|
|
46
|
+
pageMaxWidth: 'medium',
|
|
32
47
|
compile: compileMultiBoard,
|
|
33
48
|
});
|
|
34
49
|
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
9
9
|
import { KIT_PANEL_PROSE } from 'soma-foundation/kit-limits';
|
|
10
10
|
import { createKitController } from '../../base/shared';
|
|
11
|
-
import { classCandidates } from '../../
|
|
11
|
+
import { classCandidates } from '../../shared/class-candidates';
|
|
12
12
|
import { KIT_NOTICE_BOX_FOOTER, KIT_NOTICE_LIST, KIT_NOTICE_TOGGLE_FOOTER } from '../../recipes/status';
|
|
13
13
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
14
|
-
import { mergeClass } from '../../
|
|
14
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
15
15
|
import { kitText } from '../../i18n/kit-text';
|
|
16
16
|
|
|
17
17
|
const FOLD_LIST = mergeClass(`${KIT_NOTICE_LIST} text-fg-muted`, kitTypographyRecipe('caption'));
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import { KIT_ARRANGE, arrangeSplit } from 'soma-foundation/arrange';
|
|
5
5
|
import { KIT_CLASS_DEFAULTS, KIT_GRAMMAR, KIT_WIDTH } from '../../object-renderer/defaults';
|
|
6
|
-
import { mergeClass } from '../../
|
|
6
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
7
7
|
import { KIT_LIST_BAR_FLAT_CLASS, KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
8
8
|
import { kitPanelTitleRowHtml } from '../../recipes/title-row';
|
|
9
|
+
import { KIT_DIVIDER_HEAD_CLASS, kitDividerRecipe } from '../../recipes/divider';
|
|
9
10
|
import { KIT_HOIST_ATTR, KIT_HOIST_HEADER_ACTIONS, tablesOnCanvas } from '../shared/compile-helpers';
|
|
10
11
|
import { cls, esc, host } from '../link/shared';
|
|
11
12
|
|
|
@@ -14,9 +15,11 @@ export const MULTI_BOARD_AREAS = ['root', 'filter', 'panels', 'panel'] as const;
|
|
|
14
15
|
export type MultiBoardArea = (typeof MULTI_BOARD_AREAS)[number];
|
|
15
16
|
|
|
16
17
|
const HERO_CFG = KIT_ARRANGE.composition.hero;
|
|
17
|
-
/** 概况条并排的容器档与份数(排布引擎求解:结论块 /
|
|
18
|
+
/** 概况条并排的容器档与份数(排布引擎求解:结论块 / 统计块各自的最小宽都放得下的最窄容器档;结论块最小宽与份数只读真源 composition.hero,TF-4) */
|
|
18
19
|
const HERO_SPLIT = arrangeSplit({ aMinRem: HERO_CFG.conclusionMinRem, bMinRem: HERO_CFG.statsMinRem, aSpans: [HERO_CFG.conclusionSpan] });
|
|
19
20
|
const HERO_STAT_KINDS: ReadonlySet<string> = new Set(HERO_CFG.statKinds);
|
|
21
|
+
/** 结论与统计之间的竖线:分隔线出口朝起始侧的一条(发丝宽一个灰) */
|
|
22
|
+
const HERO_DIVIDER_LINE = kitDividerRecipe('start');
|
|
20
23
|
|
|
21
24
|
export const MULTI_BOARD_CLASS = {
|
|
22
25
|
root: '@container flex flex-col gap-section',
|
|
@@ -27,17 +30,19 @@ export const MULTI_BOARD_CLASS = {
|
|
|
27
30
|
panel: mergeClass('flex min-w-0 flex-col gap-region p-card', kitShellRecipe({ shadow: false })),
|
|
28
31
|
panelPlain: 'flex min-w-0 flex-col gap-region',
|
|
29
32
|
/** 概况条(hero):无容器,成员并排、成员之间一条细线,下缘一条通栏细线与主体分开 */
|
|
30
|
-
hero:
|
|
33
|
+
hero: `flex flex-wrap items-stretch gap-x-section gap-y-region ${KIT_DIVIDER_HEAD_CLASS} pb-4 mb-title-block`,
|
|
31
34
|
heroItem: 'min-w-0 flex-1 basis-80',
|
|
32
35
|
heroLabel: 'mb-1 text-xs text-fg-muted',
|
|
33
36
|
/** 概况条有结论块也有统计块:容器够宽时结论在左、统计一排在右、中间一条细线;窄容器结论在上、统计在下(并排档由引擎 arrangeSplit 给出) */
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// 统计一侧整体为空(统计块自报没有可显示的概况,运行期给概况条标 data-kit-hero-solo,见 base/shared 的 kitSyncHeroSolo):统计块与细线收起,结论占满整行
|
|
38
|
+
heroSplit: `group/hero flex flex-col gap-region @${HERO_SPLIT.tier}:flex-row @${HERO_SPLIT.tier}:gap-section ${KIT_DIVIDER_HEAD_CLASS} pb-4 mb-title-block`,
|
|
39
|
+
heroConclusion: `flex min-w-0 flex-col gap-region @${HERO_SPLIT.tier}:w-${HERO_SPLIT.aSpan}/${HERO_SPLIT.aSpan + HERO_SPLIT.bSpan} @${HERO_SPLIT.tier}:shrink-0 group-data-kit-hero-solo/hero:@${HERO_SPLIT.tier}:w-full`,
|
|
40
|
+
// 结论与统计之间的竖线:分隔线出口的竖向一侧(发丝宽一个灰),不再用 1px 底色条
|
|
41
|
+
heroDivider: `${HERO_DIVIDER_LINE} hidden self-stretch @${HERO_SPLIT.tier}:block group-data-kit-hero-solo/hero:@${HERO_SPLIT.tier}:hidden`,
|
|
42
|
+
/** 统计块:并排与堆叠时均撑满可用宽度,不再用 max-w-156 截断导致报告页右侧出现 35% 空白空洞 */
|
|
43
|
+
heroStats: 'flex min-w-0 flex-1 flex-col gap-region group-data-kit-hero-solo/hero:hidden',
|
|
39
44
|
/** 头带:被 head 指向的概况挂在宿主标题行下,无容器 */
|
|
40
|
-
band: '
|
|
45
|
+
band: mergeClass(mergeClass('py-3', kitDividerRecipe('top')), KIT_DIVIDER_HEAD_CLASS),
|
|
41
46
|
} as const;
|
|
42
47
|
|
|
43
48
|
const WIDTH_GRAMMAR = KIT_GRAMMAR.width as {
|
|
@@ -120,7 +125,7 @@ export function boardGridHtml(blocks: readonly BoardPanelBlock[], areaClass: Rec
|
|
|
120
125
|
/** 整个壳:协作组件宿主 + 筛选卡 + 面板栅格。区域类按 7.3 同族规则覆写 */
|
|
121
126
|
export function multiBoardHtml(
|
|
122
127
|
ids: ReturnType<typeof multiBoardIds>,
|
|
123
|
-
parts: { filter: string; panels: BoardPanelBlock[]; hub: boolean; /** 分组页签块(已渲染,在首屏区之后) */ tabs?: string; /** 概况条成员(hero 槽,合成一条无容器的带;kind = 构件名,统计块与结论块分左右并排) */ hero?: Array<{ title: string; html: string; kind?: string }>; /** 概况条成员的范围切换类控件:搬运标记块,页面编译搬进页头标题右侧 */ heroHead?: string;
|
|
128
|
+
parts: { filter: string; panels: BoardPanelBlock[]; hub: boolean; /** 分组页签块(已渲染,在首屏区之后) */ tabs?: string; /** 概况条成员(hero 槽,合成一条无容器的带;kind = 构件名,统计块与结论块分左右并排) */ hero?: Array<{ title: string; html: string; kind?: string }>; /** 概况条成员的范围切换类控件:搬运标记块,页面编译搬进页头标题右侧 */ heroHead?: string; },
|
|
124
129
|
areaClass: Record<string, string>,
|
|
125
130
|
extra: string | undefined,
|
|
126
131
|
): string {
|
|
@@ -138,13 +143,12 @@ export function multiBoardHtml(
|
|
|
138
143
|
const hero = heroItems.length === 0
|
|
139
144
|
? ''
|
|
140
145
|
: stats.length > 0 && conclusions.length > 0
|
|
141
|
-
? `<div ${heroAttrs}${cls(MULTI_BOARD_CLASS.heroSplit)}><div${cls(MULTI_BOARD_CLASS.heroConclusion)}>${conclusions.map((h) => heroMember(h, 'min-w-0')).join('')}</div><div aria-hidden="true"${cls(MULTI_BOARD_CLASS.heroDivider)}></div><div${cls(MULTI_BOARD_CLASS.heroStats)}>${stats.map((h) => heroMember(h, 'min-w-0')).join('')}</div></div>`
|
|
146
|
+
? `<div ${heroAttrs}${cls(MULTI_BOARD_CLASS.heroSplit)}><div${cls(MULTI_BOARD_CLASS.heroConclusion)}>${conclusions.map((h) => heroMember(h, 'min-w-0')).join('')}</div><div aria-hidden="true"${cls(MULTI_BOARD_CLASS.heroDivider)}></div><div data-kit-hero-stats=""${cls(MULTI_BOARD_CLASS.heroStats)}>${stats.map((h) => heroMember(h, 'min-w-0')).join('')}</div></div>`
|
|
142
147
|
: `<div ${heroAttrs}${cls(MULTI_BOARD_CLASS.hero)}>${heroItems.map((h) => heroMember(h, MULTI_BOARD_CLASS.heroItem)).join('')}</div>`;
|
|
143
148
|
const heroHead = parts.heroHead === undefined || parts.heroHead === ''
|
|
144
149
|
? ''
|
|
145
150
|
: `<div ${KIT_HOIST_ATTR}="${KIT_HOIST_HEADER_ACTIONS}" class="${MULTI_BOARD_HEAD_CLASS}" data-kit-panel-head="">${parts.heroHead}</div>`;
|
|
146
151
|
const grid = parts.panels.length === 0 ? '' : boardGridHtml(parts.panels, areaClass);
|
|
147
152
|
const root = mergeClass(mergeClass(MULTI_BOARD_CLASS.root, areaClass.root), extra);
|
|
148
|
-
|
|
149
|
-
return `<div data-soma-id="${esc(ids.root)}" data-kit-board=""${canvas}${cls(root)}>\n${hosts}\n${[heroHead, filter, hero, grid, parts.tabs ?? ''].filter((x) => x !== '').join('\n')}\n</div>`;
|
|
153
|
+
return `<div data-soma-id="${esc(ids.root)}" data-kit-board=""${cls(root)}>\n${hosts}\n${[heroHead, filter, hero, grid, parts.tabs ?? ''].filter((x) => x !== '').join('\n')}\n</div>`;
|
|
150
154
|
}
|
package/src/biz/names.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
11
11
|
import type { KitObject } from '../../object-renderer/types';
|
|
12
|
-
import type { KitFragment } from '../../
|
|
12
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
13
13
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
14
14
|
import { KIT_COORD_MIRRORS } from '../shared/coordinator';
|
|
15
15
|
import {
|
|
@@ -111,10 +111,17 @@ export function compileNotificationCenter(input: KitBizInput, ctx: KitBizContext
|
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
const title = typeof raw.title === 'string' ? raw.title : '';
|
|
114
|
+
const toolbarHtml = m.r.parts.toolbar ?? '';
|
|
115
|
+
const filterHtml = m.r.parts.filter ?? '';
|
|
116
|
+
// 有标题时:批量操作与标题同行左右对齐;无标题且有筛选时:批量操作与筛选分段同行左右对齐,消除三行锯齿
|
|
117
|
+
const listHeadToolbar = title !== '' ? toolbarHtml : '';
|
|
118
|
+
const listControls = title === '' && toolbarHtml !== '' && filterHtml !== ''
|
|
119
|
+
? `<div class="${NOTIFICATION_CENTER_CLASS.headRow}"><div class="min-w-0 flex-1">${filterHtml}</div><div class="shrink-0">${toolbarHtml}</div></div>`
|
|
120
|
+
: [title === '' ? toolbarHtml : '', filterHtml].filter((x) => x !== '').join('\n');
|
|
114
121
|
const html = notificationCenterHtml(
|
|
115
122
|
ids,
|
|
116
123
|
{
|
|
117
|
-
list: { title,
|
|
124
|
+
list: { title, toolbar: listHeadToolbar, html: [listControls, m.listHtml].filter((x) => x !== '').join('\n') },
|
|
118
125
|
detail: { title: '', html: m.r.parts.summary ?? '' },
|
|
119
126
|
},
|
|
120
127
|
areaClass,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// 分栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档左 5 / 右 7(共 12 份)。
|
|
3
3
|
|
|
4
4
|
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
5
|
-
import { mergeClass } from '../../
|
|
5
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
6
6
|
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
7
7
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
8
8
|
import { cls, esc, host } from '../link/shared';
|
|
@@ -16,6 +16,7 @@ export const NOTIFICATION_CENTER_CLASS = {
|
|
|
16
16
|
grid: 'grid grid-cols-12 gap-section',
|
|
17
17
|
list: mergeClass('col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-region p-card', kitShellRecipe()),
|
|
18
18
|
detail: mergeClass('col-span-12 @md:col-span-7 flex min-w-0 flex-col gap-region p-card', kitShellRecipe()),
|
|
19
|
+
headRow: 'flex flex-wrap items-center justify-between gap-region',
|
|
19
20
|
title: mergeClass('min-w-0 truncate', kitTypographyRecipe('sectionTitle')),
|
|
20
21
|
} as const;
|
|
21
22
|
|
|
@@ -25,6 +26,8 @@ export function notificationCenterIds(pageId: string): { root: string; hub: stri
|
|
|
25
26
|
|
|
26
27
|
export interface NoticeColumn {
|
|
27
28
|
title: string;
|
|
29
|
+
/** 与标题(或筛选分段)同行右对齐的批量工具栏 HTML */
|
|
30
|
+
toolbar?: string;
|
|
28
31
|
html: string;
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -37,7 +40,11 @@ export function notificationCenterHtml(
|
|
|
37
40
|
): string {
|
|
38
41
|
const col = (area: 'list' | 'detail', c: NoticeColumn): string => {
|
|
39
42
|
const title = c.title === '' ? '' : `<h3${cls(NOTIFICATION_CENTER_CLASS.title)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(c.title)}</h3>`;
|
|
40
|
-
|
|
43
|
+
const toolbar = c.toolbar ?? '';
|
|
44
|
+
const head = title !== '' && toolbar !== ''
|
|
45
|
+
? `<div${cls(NOTIFICATION_CENTER_CLASS.headRow)}>${title}<div class="shrink-0">${toolbar}</div></div>`
|
|
46
|
+
: `${title}${toolbar}`;
|
|
47
|
+
return `<section data-kit-container="card"${cls(mergeClass(NOTIFICATION_CENTER_CLASS[area], areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${head}${c.html}</section>`;
|
|
41
48
|
};
|
|
42
49
|
const root = mergeClass(mergeClass(NOTIFICATION_CENTER_CLASS.root, areaClass.root), extra);
|
|
43
50
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitLinkHub', ids.hub)}${host('KitCrudBridge', ids.coord)}\n`
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { defineKitBizComponent } from "../define";
|
|
13
13
|
import type { KitBizContext, KitBizDefinition, KitBizInput, KitBizRole } from "../types";
|
|
14
|
-
import type { KitFragment } from "../../
|
|
14
|
+
import type { KitFragment } from "../../object-renderer/fragment";
|
|
15
15
|
import type { KitObject } from "../../object-renderer/types";
|
|
16
16
|
import { filterAnchor } from "../../object-renderer/compile-data";
|
|
17
17
|
import { emitObject } from "../../object-renderer/emit-object";
|
|
@@ -19,6 +19,10 @@ import { dropSliceReload, registerSliceReload } from "../../object-renderer/filt
|
|
|
19
19
|
import { checkRoleAllowedViews } from "../shared/compile-helpers";
|
|
20
20
|
import { addEmit, classesIn, isRec, newParts, type Rec } from "../link/shared";
|
|
21
21
|
import { checkAreas, finishTemplate, templateObjectName } from "./shared";
|
|
22
|
+
import { kitShellRecipe } from "../../recipes/container";
|
|
23
|
+
|
|
24
|
+
/** 领域模板区块的外缘 = 壳配方(容器边,KT-B2) */
|
|
25
|
+
const SECTION_EDGE = kitShellRecipe({ tone: "base", shadow: false });
|
|
22
26
|
|
|
23
27
|
function cloneRec(raw: Rec): Rec {
|
|
24
28
|
return JSON.parse(JSON.stringify(raw)) as Rec;
|
|
@@ -129,7 +133,7 @@ function compileDomainTemplate(
|
|
|
129
133
|
const customClass = areaClass[rName] ?? "";
|
|
130
134
|
const sectionClass = customClass ? ` ${customClass}` : "";
|
|
131
135
|
sectionHtmls.push(
|
|
132
|
-
`<section class="p-card
|
|
136
|
+
`<section data-kit-container="card" class="p-card ${SECTION_EDGE}${sectionClass}" data-soma-id="${objectName}__root">\n${emitRes.html}\n</section>`,
|
|
133
137
|
);
|
|
134
138
|
}
|
|
135
139
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// detail 可选,只读展示对象,卡片下半的明细(错误详情 / 回执摘要,常用 summary)
|
|
6
6
|
// 状态码不由本模板判定:页面是 403 还是 404 由路由与服务端决定,模板只负责把它摆好看。
|
|
7
7
|
|
|
8
|
-
import type { KitFragment } from '../../../
|
|
8
|
+
import type { KitFragment } from '../../../object-renderer/fragment';
|
|
9
9
|
import type { KitBizContext, KitBizInput } from '../../types';
|
|
10
10
|
import { classesIn, isRec, newParts } from '../../link/shared';
|
|
11
11
|
import {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// ResultPage 的 HTML 代码壳:整页居中承载一个结果面板(成功 / 失败 / 403 / 404 / 500 / 空),可选附一块明细。
|
|
2
2
|
// 只有结构与 Tailwind 类。放进 blank-frame 时垂直水平居中;放进 single-frame 时只是顶部居中的一张卡。
|
|
3
3
|
|
|
4
|
-
import { mergeClass } from '../../../
|
|
4
|
+
import { mergeClass } from '../../../shared/merge-class';
|
|
5
5
|
import { kitShellRecipe } from '../../../recipes/container';
|
|
6
|
+
import { KIT_DIVIDER_FOOT_CLASS } from '../../../recipes/divider';
|
|
6
7
|
import { cls, esc } from '../../link/shared';
|
|
7
8
|
|
|
8
9
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -12,7 +13,7 @@ export type ResultPageArea = (typeof RESULT_PAGE_AREAS)[number];
|
|
|
12
13
|
export const RESULT_PAGE_CLASS = {
|
|
13
14
|
root: '@container flex w-full min-h-screen items-center justify-center p-inset-roomy',
|
|
14
15
|
card: mergeClass('flex w-full max-w-xl flex-col', kitShellRecipe()),
|
|
15
|
-
detail:
|
|
16
|
+
detail: `${KIT_DIVIDER_FOOT_CLASS} p-inset-roomy`,
|
|
16
17
|
} as const;
|
|
17
18
|
|
|
18
19
|
export function resultPageIds(pageId: string): { root: string } {
|
|
@@ -26,7 +27,7 @@ export function resultPageHtml(
|
|
|
26
27
|
extra: string | undefined,
|
|
27
28
|
): string {
|
|
28
29
|
const detail = parts.detail === '' ? '' : `\n<div${cls(mergeClass(RESULT_PAGE_CLASS.detail, areaClass.detail))}>${parts.detail}</div>`;
|
|
29
|
-
const card = `<section${cls(mergeClass(RESULT_PAGE_CLASS.card, areaClass.card))}>\n${parts.result}${detail}\n</section>`;
|
|
30
|
+
const card = `<section data-kit-container="card"${cls(mergeClass(RESULT_PAGE_CLASS.card, areaClass.card))}>\n${parts.result}${detail}\n</section>`;
|
|
30
31
|
const root = mergeClass(mergeClass(RESULT_PAGE_CLASS.root, areaClass.root), extra);
|
|
31
32
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${card}\n</div>`;
|
|
32
33
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { KIT_VIEW_FORM_KEYS, KIT_VIEW_SLOTS } from '../../object-renderer/defaults';
|
|
5
5
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
6
6
|
import type { KitDiagnostic, KitObject } from '../../object-renderer/types';
|
|
7
|
-
import type { KitFragment } from '../../
|
|
7
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
8
8
|
import type { KitBizContext, KitBizInput, KitBizRole } from '../types';
|
|
9
9
|
import {
|
|
10
10
|
bizObjectName, checkRoleAllowedViews, finishBizCompile, validateBizAreaClass,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { KIT_BIZ_COMPONENT_LIMITS } from 'soma-foundation/kit-limits';
|
|
16
16
|
import type { KitDiagnostic } from '../../../object-renderer/types';
|
|
17
|
-
import type { KitFragment } from '../../../
|
|
17
|
+
import type { KitFragment } from '../../../object-renderer/fragment';
|
|
18
18
|
import { safeHref } from '../../../base/link';
|
|
19
19
|
import { classesIn, isRec, IDENT, type Rec } from '../../link/shared';
|
|
20
20
|
import { wrapKitBizComponent } from '../../compose';
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
// split 左品牌右表单:窄容器上下堆叠,够宽时左右各半;左栏是品牌区(名称 / 标语 / 要点),右栏同 center 的表单列
|
|
6
6
|
// 表单卡就是内层 SingleObjectForm 的产物;本壳只负责它周围的内容。链接与第三方按钮是 Link / Button 实例,只抛 click 事件。
|
|
7
7
|
|
|
8
|
-
import { mergeClass } from '../../../
|
|
8
|
+
import { mergeClass } from '../../../shared/merge-class';
|
|
9
9
|
import { cls, esc, host } from '../../link/shared';
|
|
10
|
-
import { kitIconHtml } from '../../../
|
|
10
|
+
import { kitIconHtml } from '../../../shared/icons';
|
|
11
11
|
|
|
12
12
|
export const SIGN_IN_LAYOUTS = ['center', 'split'] as const;
|
|
13
13
|
export type SignInLayout = (typeof SIGN_IN_LAYOUTS)[number];
|
|
@@ -18,7 +18,7 @@ export const SIGN_IN_EXTRA_AREAS = ['page', 'aside', 'brand', 'column', 'links',
|
|
|
18
18
|
export const SIGN_IN_CLASS = {
|
|
19
19
|
pageCenter: 'flex min-h-screen w-full items-center justify-center bg-surface-sunken p-inset-roomy',
|
|
20
20
|
pageSplitHost: '@container w-full',
|
|
21
|
-
pageSplit: 'grid min-h-screen w-full grid-cols-1 bg-surface @2xl:grid-cols-2',
|
|
21
|
+
pageSplit: 'grid min-h-screen w-full grid-cols-1 bg-surface-sunken @2xl:grid-cols-2',
|
|
22
22
|
column: 'flex w-full max-w-md flex-col gap-stack',
|
|
23
23
|
columnSplit: 'flex w-full items-center justify-center p-inset-roomy @2xl:p-12',
|
|
24
24
|
columnInner: 'flex w-full max-w-md flex-col gap-stack',
|
|
@@ -78,7 +78,7 @@ function asideHtml(brand: SignInBrand, areaClass: Record<string, string>): strin
|
|
|
78
78
|
const points = brand.points.length === 0
|
|
79
79
|
? ''
|
|
80
80
|
: `<ul${cls(SIGN_IN_CLASS.asidePoints)}>${brand.points.map((p) => `<li${cls(SIGN_IN_CLASS.asidePoint)}><span aria-hidden="true">${kitIconHtml('check', 'sm')}</span><span>${esc(p)}</span></li>`).join('')}</ul>`;
|
|
81
|
-
return `<aside${cls(mergeClass(SIGN_IN_CLASS.aside, areaClass.aside))}>${name}${tagline}${points}</aside>`;
|
|
81
|
+
return `<aside data-kit-container="card"${cls(mergeClass(SIGN_IN_CLASS.aside, areaClass.aside))}>${name}${tagline}${points}</aside>`;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function linksHtml(items: readonly SignInLinkItem[], areaClass: Record<string, string>): string {
|
|
@@ -22,14 +22,16 @@ import { KIT_CLASS_DEFAULTS, KIT_VIEW_FORM_KEYS } from '../../object-renderer/de
|
|
|
22
22
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
23
23
|
import { groupTabsFrame, toolbarAnchor, viewAnchor } from '../../object-renderer/emit-static';
|
|
24
24
|
import type { KitAction, KitObject } from '../../object-renderer/types';
|
|
25
|
-
import type { KitFragment } from '../../
|
|
25
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
26
26
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
27
27
|
import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS } from '../shared/coordinator';
|
|
28
28
|
import {
|
|
29
29
|
bizObjectName, checkRoleAllowedViews, finishBizCompile, validateBizAreaClass,
|
|
30
30
|
} from '../shared/compile-helpers';
|
|
31
31
|
import { pipeTails, wireDialogForm } from '../shared/pipes';
|
|
32
|
-
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles
|
|
32
|
+
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles } from '../shared/overlay-shell';
|
|
33
|
+
import { adviseDialogFooter } from '../shared/overlay-compile';
|
|
34
|
+
import { dialogWidthOf } from '../../object-renderer/overlay-decide';
|
|
33
35
|
import {
|
|
34
36
|
IDENT, classesIn, emitMember, isRec, keyFieldOf, linkRemoveProps, mirrorPath, newParts, normalizeMember,
|
|
35
37
|
patchProps, semanticPipe, sortMirrors, type Rec,
|
|
@@ -283,6 +285,7 @@ export function compileRecordDetail(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
283
285
|
out.events[`${d.dialogClose}.click`] = semanticPipe(link, KIT_COORD_EVENTS.close);
|
|
284
286
|
const editName = actions.find((a) => a.builtin === 'openEdit')?.name ?? EDIT_LABEL;
|
|
285
287
|
dialog = dialogHtml(d, dialogTitles(record.view.form.title, { create: editName, edit: editName }), m.r.parts.form ?? '', { dialog: areaClass.dialog ?? '' }, CLOSE_LABEL, '', dialogWidthOf({ form: record.view.form, schema: record.schema }));
|
|
288
|
+
adviseDialogFooter(ctx, record.view.form, 'product.objects.record.view.form.footerActions');
|
|
286
289
|
for (const c of Object.values(OVERLAY_SHELL_CLASS)) for (const t of c.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
287
290
|
}
|
|
288
291
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// 弹窗壳复用 StandardCrud 的(同一套浮层基准)。
|
|
4
4
|
|
|
5
5
|
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
6
|
-
import { mergeClass } from '../../
|
|
6
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
7
7
|
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
8
8
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
9
9
|
import { cls, esc, host } from '../link/shared';
|
|
@@ -48,18 +48,18 @@ export function recordDetailHtml(
|
|
|
48
48
|
const actions = parts.actions === ''
|
|
49
49
|
? ''
|
|
50
50
|
: `<div${cls(mergeClass(RECORD_DETAIL_CLASS.actions, areaClass.actions))}>${parts.actions}</div>`;
|
|
51
|
-
const header = `<section${cls(mergeClass(RECORD_DETAIL_CLASS.header, areaClass.header))}>`
|
|
51
|
+
const header = `<section data-kit-container="card"${cls(mergeClass(RECORD_DETAIL_CLASS.header, areaClass.header))}>`
|
|
52
52
|
+ `<div${cls(RECORD_DETAIL_CLASS.summary)}>${parts.summary}</div>${actions}</section>`;
|
|
53
53
|
const block = (b: DetailBlock, base: string, area: string | undefined): string => {
|
|
54
54
|
const title = b.title === '' ? '' : `<h3${cls(RECORD_DETAIL_CLASS.blockTitle)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(b.title)}</h3>`;
|
|
55
|
-
return `<section${cls(mergeClass(base, area))}${KIT_SHELL_FLAT_MARK}>${title}${b.html}</section>`;
|
|
55
|
+
return `<section data-kit-container="card"${cls(mergeClass(base, area))}${KIT_SHELL_FLAT_MARK}>${title}${b.html}</section>`;
|
|
56
56
|
};
|
|
57
57
|
const groups = parts.groups.length === 0
|
|
58
58
|
? ''
|
|
59
59
|
: `<div${cls(mergeClass(RECORD_DETAIL_CLASS.groups, areaClass.groups))}>\n${parts.groups.map((g) => block(g, RECORD_DETAIL_CLASS.group, areaClass.group)).join('\n')}\n</div>`;
|
|
60
60
|
const subs = parts.subs.map((s) => block(s, RECORD_DETAIL_CLASS.sub, areaClass.sub));
|
|
61
61
|
if (parts.subsTabs !== undefined) {
|
|
62
|
-
subs.push(`<section${cls(mergeClass(RECORD_DETAIL_CLASS.sub, areaClass.sub))}${KIT_SHELL_FLAT_MARK}>${parts.subsTabs.html}</section>`);
|
|
62
|
+
subs.push(`<section data-kit-container="card"${cls(mergeClass(RECORD_DETAIL_CLASS.sub, areaClass.sub))}${KIT_SHELL_FLAT_MARK}>${parts.subsTabs.html}</section>`);
|
|
63
63
|
}
|
|
64
64
|
const root = mergeClass(mergeClass(RECORD_DETAIL_CLASS.root, areaClass.root), extra);
|
|
65
65
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitCrudBridge', ids.coord)}\n`
|
|
@@ -10,7 +10,7 @@ import { emitObject } from '../../object-renderer/emit-object';
|
|
|
10
10
|
import { savedNoticePipe } from '../../object-renderer/form-notify';
|
|
11
11
|
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
12
12
|
import type { KitObject, KitViewForm } from '../../object-renderer/types';
|
|
13
|
-
import type { KitFragment } from '../../
|
|
13
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
14
14
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
15
15
|
import { IDENT, addEmit, classesIn, isRec, newParts, patchProps, type Rec } from '../link/shared';
|
|
16
16
|
import {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// 导航是页内锚点(`<a href="#锚点">`),不写脚本;每个分区卡自带一条保存栏(表单的 actions 区经 classes.actions 传入)。
|
|
3
3
|
|
|
4
4
|
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
5
|
-
import { mergeClass } from '../../
|
|
5
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
6
6
|
import { kitShellRecipe } from '../../recipes/container';
|
|
7
|
+
import { KIT_DIVIDER_FOOT_CLASS } from '../../recipes/divider';
|
|
7
8
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
8
9
|
import { cls, esc } from '../link/shared';
|
|
9
10
|
import { kitText } from '../../i18n/kit-text';
|
|
@@ -13,14 +14,16 @@ export const SETTINGS_CENTER_AREAS = ['root', 'nav', 'content', 'section'] as co
|
|
|
13
14
|
export type SettingsCenterArea = (typeof SETTINGS_CENTER_AREAS)[number];
|
|
14
15
|
|
|
15
16
|
export const SETTINGS_CENTER_CLASS = {
|
|
16
|
-
|
|
17
|
+
// 外层只做容器查询宿主(@container 不能自查询,@md:flex-row 放在内层布局容器上)
|
|
18
|
+
root: '@container w-full',
|
|
19
|
+
layout: 'flex flex-col gap-stack @md:flex-row @md:items-start',
|
|
17
20
|
nav: mergeClass('flex w-full shrink-0 flex-col gap-1 p-inset-tight @md:sticky @md:top-4 @md:w-56', kitShellRecipe()),
|
|
18
21
|
navLink: 'flex h-9 min-w-0 items-center truncate rounded-md px-3 text-sm text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring',
|
|
19
22
|
content: 'flex min-w-0 flex-1 flex-col gap-stack',
|
|
20
23
|
section: mergeClass('flex flex-col gap-section p-inset-roomy', kitShellRecipe()),
|
|
21
24
|
title: mergeClass('min-w-0 truncate', kitTypographyRecipe('sectionTitle')),
|
|
22
25
|
/** 分区保存栏:贴卡内底部,上方分隔线;动作组恒单行不折行(排布引擎动作组规则) */
|
|
23
|
-
footer:
|
|
26
|
+
footer: `mt-2 flex flex-nowrap items-end gap-cluster ${KIT_DIVIDER_FOOT_CLASS} pt-4`,
|
|
24
27
|
} as const;
|
|
25
28
|
|
|
26
29
|
export function settingsCenterIds(pageId: string): { root: string; nav: string; section(name: string): string } {
|
|
@@ -45,10 +48,10 @@ export function settingsCenterHtml(
|
|
|
45
48
|
.join('\n');
|
|
46
49
|
const nav = `<nav aria-label="${esc(kitText('soma.kit.nav_sections', undefined, locale ?? ''))}" data-soma-id="${esc(ids.nav)}"${cls(mergeClass(SETTINGS_CENTER_CLASS.nav, areaClass.nav))}>\n${links}\n</nav>`;
|
|
47
50
|
const sections = blocks
|
|
48
|
-
.map((b) => `<section id="${esc(ids.section(b.name))}" data-soma-id="${esc(ids.section(b.name))}"${cls(mergeClass(SETTINGS_CENTER_CLASS.section, areaClass.section))}>`
|
|
51
|
+
.map((b) => `<section data-kit-container="card" id="${esc(ids.section(b.name))}" data-soma-id="${esc(ids.section(b.name))}"${cls(mergeClass(SETTINGS_CENTER_CLASS.section, areaClass.section))}>`
|
|
49
52
|
+ `<h2${cls(SETTINGS_CENTER_CLASS.title)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(b.title)}</h2>${b.form}</section>`)
|
|
50
53
|
.join('\n');
|
|
51
54
|
const content = `<div${cls(mergeClass(SETTINGS_CENTER_CLASS.content, areaClass.content))}>\n${sections}\n</div>`;
|
|
52
55
|
const root = mergeClass(mergeClass(SETTINGS_CENTER_CLASS.root, areaClass.root), extra);
|
|
53
|
-
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${nav}\n${content}\n</div>`;
|
|
56
|
+
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n<div${cls(SETTINGS_CENTER_CLASS.layout)}>\n${nav}\n${content}\n</div>\n</div>`;
|
|
54
57
|
}
|
|
@@ -21,6 +21,7 @@ import { createKitController } from '../../base/shared';
|
|
|
21
21
|
import { beginKitAction, registerKitCancel } from '../../base/action-busy';
|
|
22
22
|
import { publishKitActionStatus, type KitActionStatusPhase } from '../../base/action-status';
|
|
23
23
|
import { OUTCOME_KEY_SEP, outcomeScopeOf } from '../../base/action-gate';
|
|
24
|
+
import { clearKitInlineError, reportKitInlineError } from '../../base/inline-error';
|
|
24
25
|
import { safeHref } from '../../base/link';
|
|
25
26
|
import { closeKitHub, hasKitHub, kitActionExtras } from './runtime-hub';
|
|
26
27
|
import { kitOutcomeVerdict, noteKitOutcomeSource } from '../../data/outcome-watch';
|
|
@@ -150,6 +151,10 @@ export function createKitActionHost(): SomaComponentDefinition {
|
|
|
150
151
|
const toast = (level: 'success' | 'danger' | 'info', message: string): void => {
|
|
151
152
|
if (message !== '') svc?.notify?.toast?.({ level, message });
|
|
152
153
|
};
|
|
154
|
+
/** 失败不用轻提示(KT-K-feedback-3,§6.1 G-17):就地提示条(窗口底栏动作进窗口槽,页面级进页头下,key = 动作 id),无槽回退轻提示 */
|
|
155
|
+
const fail = (spec: KitRequestSpec, message: string): void => {
|
|
156
|
+
if (message !== '') reportKitInlineError(api.host ?? null, message, `request:${spec.actionId}`, () => toast('danger', message));
|
|
157
|
+
};
|
|
153
158
|
|
|
154
159
|
const contextOf = (spec: KitRequestSpec, payload: Readonly<Record<string, unknown>>): ResolveContext => {
|
|
155
160
|
const extras = kitActionExtras(spec.object);
|
|
@@ -170,7 +175,7 @@ export function createKitActionHost(): SomaComponentDefinition {
|
|
|
170
175
|
): Promise<void> => {
|
|
171
176
|
const data = svc?.data;
|
|
172
177
|
if (!data || spec.writeObject === undefined || spec.outcome === undefined) {
|
|
173
|
-
|
|
178
|
+
fail(spec, kitText('soma.kit.request_failed', undefined, api.host));
|
|
174
179
|
report('failed', kitText('soma.kit.request_failed', undefined, api.host));
|
|
175
180
|
return;
|
|
176
181
|
}
|
|
@@ -181,7 +186,7 @@ export function createKitActionHost(): SomaComponentDefinition {
|
|
|
181
186
|
if (spec.outcomeKey !== undefined) {
|
|
182
187
|
const rowKey = rowKeyOf(spec.outcomeKey, resolved);
|
|
183
188
|
if (rowKey === undefined || rowKey === null || rowKey === '') {
|
|
184
|
-
|
|
189
|
+
fail(spec, kitText('soma.kit.request_failed', undefined, api.host));
|
|
185
190
|
report('failed', kitText('soma.kit.request_failed', undefined, api.host), params);
|
|
186
191
|
return;
|
|
187
192
|
}
|
|
@@ -232,12 +237,13 @@ export function createKitActionHost(): SomaComponentDefinition {
|
|
|
232
237
|
// 版本冲突(409 / 412 / VERSION_CONFLICT):如实报「已被他人修改」,不当成普通失败,也不自动重取覆盖
|
|
233
238
|
if (view.status === 'conflict') message = kitText('soma.kit.form_conflict', undefined, api.host);
|
|
234
239
|
if (!ok) {
|
|
235
|
-
|
|
240
|
+
fail(spec, message !== '' ? message : kitText('soma.kit.request_failed', undefined, api.host));
|
|
236
241
|
report('failed', message, params);
|
|
237
242
|
return;
|
|
238
243
|
}
|
|
239
244
|
// 请求已真实成功(信封也判过)才写成功状态,不乐观
|
|
240
245
|
report('ok', '', params);
|
|
246
|
+
clearKitInlineError(api.host ?? null, `request:${spec.actionId}`);
|
|
241
247
|
if (spec.notify !== undefined) toast('success', spec.notify);
|
|
242
248
|
if (spec.closeOnSuccess === true) closeKitHub(spec.object);
|
|
243
249
|
// 固定协作:写操作成功后重取(只读请求不重取);别的后续事归展示对象(ctx.onRequestDone)
|
|
@@ -281,7 +287,8 @@ export function createKitActionHost(): SomaComponentDefinition {
|
|
|
281
287
|
}
|
|
282
288
|
};
|
|
283
289
|
if (spec.kind === 'download') {
|
|
284
|
-
if (!startDownload(spec))
|
|
290
|
+
if (!startDownload(spec)) fail(spec, kitText('soma.kit.download_failed', undefined, api.host));
|
|
291
|
+
else clearKitInlineError(api.host ?? null, `request:${spec.actionId}`);
|
|
285
292
|
done();
|
|
286
293
|
return;
|
|
287
294
|
}
|
|
@@ -300,7 +307,7 @@ export function createKitActionHost(): SomaComponentDefinition {
|
|
|
300
307
|
if (queued.has(flight)) return;
|
|
301
308
|
const text = error instanceof Error && error.message !== '' ? error.message : kitText('soma.kit.request_failed', undefined, api.host);
|
|
302
309
|
if (!reported) report('failed', text);
|
|
303
|
-
|
|
310
|
+
fail(spec, text);
|
|
304
311
|
}).finally(done);
|
|
305
312
|
};
|
|
306
313
|
start();
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { KIT_VIEW_SLOTS } from '../../object-renderer/defaults';
|
|
4
4
|
import { KIT_LIST_BAR_CLASS, KIT_LIST_BAR_FLAT_CLASS } from '../../recipes/container';
|
|
5
|
-
import { mergeClass } from '../../
|
|
5
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
6
6
|
import { flowToolbarHtml } from '../../object-renderer/action-group';
|
|
7
7
|
import type { KitDiagnostic } from '../../object-renderer/types';
|
|
8
|
-
import type { KitFragment } from '../../
|
|
8
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
9
9
|
import type { KitBizInput, KitBizRole } from '../types';
|
|
10
10
|
import { dedupeDiagnostics, isRec, type Parts } from '../link/shared';
|
|
11
11
|
|
|
@@ -158,12 +158,12 @@ export function hoistedToolbarHtml(toolbar: string): string {
|
|
|
158
158
|
* 无容器的列表工作面(唯一主体 = 页面本身,`container: plain`):区域主动作(工具栏)打搬运标记(页头承载),筛选带是自带圆角的下沉带,
|
|
159
159
|
* 表头 / 数据行 / 计数分页直接铺在页面上。主操作一律由页头承载(有无列表标题都一样)。
|
|
160
160
|
*/
|
|
161
|
-
export function flatListPanelHtml(parts: { filter: string; toolbar: string; list: string }, barClass = ''): string {
|
|
161
|
+
export function flatListPanelHtml(parts: { filter: string; toolbar: string; list: string }, barClass = '', barBase: string = KIT_LIST_BAR_FLAT_CLASS): string {
|
|
162
162
|
const hoist = parts.toolbar !== '';
|
|
163
163
|
const hoisted = hoistedToolbarHtml(parts.toolbar);
|
|
164
164
|
const rest = hoist ? { filter: parts.filter, toolbar: '', list: parts.list } : parts;
|
|
165
165
|
const { filterInner, listInner } = listPanelParts(rest);
|
|
166
|
-
const bar = filterInner === '' ? '' : `<div class="${mergeClass(
|
|
166
|
+
const bar = filterInner === '' ? '' : `<div class="${mergeClass(barBase, barClass)}">${filterInner}</div>`;
|
|
167
167
|
return [hoisted, bar, listInner].filter((p) => p !== '').join('\n');
|
|
168
168
|
}
|
|
169
169
|
|