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
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// SingleObjectForm 的 HTML 代码壳:居中定宽的表单卡 + 卡内标题。只有结构与 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
2
2
|
// 底部固定的保存 / 重置栏是 KitObjectForm 的按钮行(actions 区),这里只给它一组 sticky 底栏类(经 classes.actions 传入)。
|
|
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, KIT_DIVIDER_HEAD_CLASS } from '../../recipes/divider';
|
|
7
|
+
import { KIT_PAGE_FORM_WIDTH_CLASS } from '../../recipes/page-width';
|
|
8
|
+
import { KIT_INSET_SURFACE_X_CLASS, KIT_STRIP_FOOT_MIN_CLASS, KIT_STRIP_HEAD_CLASS } from '../../recipes/strip';
|
|
6
9
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
7
10
|
import { cls, esc } from '../link/shared';
|
|
8
11
|
|
|
@@ -12,12 +15,13 @@ export type SingleFormArea = (typeof SINGLE_FORM_AREAS)[number];
|
|
|
12
15
|
|
|
13
16
|
export const SINGLE_FORM_CLASS = {
|
|
14
17
|
root: '@container flex justify-center',
|
|
15
|
-
card: mergeClass(
|
|
16
|
-
|
|
18
|
+
card: mergeClass(`flex w-full ${KIT_PAGE_FORM_WIDTH_CLASS} flex-col`, kitShellRecipe({ shadow: false })),
|
|
19
|
+
// 头 = 通用头部条(strip.headPx 56,左右 inset.surfacePx 24),与窗口头 / 窗格头同一出口
|
|
20
|
+
header: `flex ${KIT_STRIP_HEAD_CLASS} items-center ${KIT_DIVIDER_HEAD_CLASS} ${KIT_INSET_SURFACE_X_CLASS}`,
|
|
17
21
|
title: kitTypographyRecipe('sectionTitle'),
|
|
18
22
|
body: 'p-inset-roomy',
|
|
19
23
|
/** 底栏:贴着可滚动祖先的底边,带分隔线与卡面底色(页面里的卡面 = bg-surface;写 raised 在暗色里比卡面亮一档,底栏成了一条亮带;浮层里的底栏另有 group 变体取浮层面) */
|
|
20
|
-
footer:
|
|
24
|
+
footer: `sticky bottom-0 mt-4 flex ${KIT_STRIP_FOOT_MIN_CLASS} flex-wrap items-center gap-cluster ${KIT_DIVIDER_FOOT_CLASS} bg-surface py-3`,
|
|
21
25
|
} as const;
|
|
22
26
|
|
|
23
27
|
export function singleFormIds(pageId: string): { root: string } {
|
|
@@ -19,10 +19,10 @@ import { actionPipeline, rowActionSlotsOf } from '../../object-renderer/emit-eve
|
|
|
19
19
|
import { checkExpandChild, expandHolderHtml, expandHostId } from '../../object-renderer/collection-expand';
|
|
20
20
|
import { ctxMenuAnchor, opsAnchor, rowsAnchor, staticCtxAnchor, toolbarAnchor, treeAnchor, viewAnchor, virtualAnchor } from '../../object-renderer/emit-static';
|
|
21
21
|
import type { KitAction, KitDiagnostic, KitObject, KitViewForm } from '../../object-renderer/types';
|
|
22
|
-
import type { KitFragment } from '../../
|
|
22
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
23
23
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
24
24
|
import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS, rewriteRowActions, type KitRowActionRoute } from '../shared/coordinator';
|
|
25
|
-
import { KIT_CRUD_LINK_KEY, compileOverlay, normalizeOverlayView, validateOverlayNames } from '../shared/overlay-compile';
|
|
25
|
+
import { KIT_CRUD_LINK_KEY, adviseDialogFooter, compileOverlay, normalizeOverlayView, validateOverlayNames } from '../shared/overlay-compile';
|
|
26
26
|
import {
|
|
27
27
|
bizObjectName, checkRoleAllowedViews, finishBizCompile, validateBizAreaClass,
|
|
28
28
|
} from '../shared/compile-helpers';
|
|
@@ -34,8 +34,9 @@ import { StandardCrud } from './index';
|
|
|
34
34
|
import { esc } from '../../shared/escape';
|
|
35
35
|
import { facetsPathOf, listSummaryFields, listSummaryHoist } from './summary';
|
|
36
36
|
import {
|
|
37
|
-
CRUD_CLASS, STANDARD_CRUD_AREAS, classesIn, coordinatorHtml, coordinatorId, dialogHtml, dialogIds, dialogTitles,
|
|
37
|
+
CRUD_CLASS, STANDARD_CRUD_AREAS, classesIn, coordinatorHtml, coordinatorId, dialogHtml, dialogIds, dialogTitles, mainHtml, overlayHtml, overlayIds, rootHtml,
|
|
38
38
|
} from './shell';
|
|
39
|
+
import { dialogWidthOf } from '../../object-renderer/overlay-decide';
|
|
39
40
|
|
|
40
41
|
type Rec = Record<string, unknown>;
|
|
41
42
|
|
|
@@ -189,6 +190,8 @@ export function compileStandardCrud(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
189
190
|
expandPath: expandMirrorPath,
|
|
190
191
|
formMode: 'create',
|
|
191
192
|
pagerClass: CRUD_CLASS.pager,
|
|
193
|
+
// 页面类型默认密度:列表页默认紧凑档
|
|
194
|
+
defaultDense: true,
|
|
192
195
|
...(rowClickName !== undefined ? { pickOnRow: true } : {}),
|
|
193
196
|
// 弹窗表单的 mode / initial 绑 focus 镜像
|
|
194
197
|
formModePath: mirrorPath(scope, KIT_COORD_MIRRORS.mode.key),
|
|
@@ -362,14 +365,18 @@ export function compileStandardCrud(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
362
365
|
// K-7:form 视图的 title(字符串两态通用,或 { create, edit })覆写弹窗标题;缺省取动作名
|
|
363
366
|
const titles = dialogTitles((entity.view?.form as KitViewForm | undefined)?.title, { create: createCopy, edit: editCopy });
|
|
364
367
|
dialog = dialogHtml(ids, titles, entityEmit.parts.form ?? '', areaClass, CLOSE_LABEL, '', dialogWidthOf({ form: entity.view?.form, schema: entity.schema }));
|
|
368
|
+
adviseDialogFooter(ctx, entity.view?.form, 'product.objects.entity.view.form.footerActions');
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
// 页头概况行:筛选区有枚举字段才给;总数 / facets 取列表响应(facets 是总数的同级兄弟字段,接口不给就整行不渲染)
|
|
368
372
|
const summaryFields = hasList ? listSummaryFields(entity) : [];
|
|
369
373
|
let summary = '';
|
|
374
|
+
const totalPath = `page.data.${object}.${entityEmit.compiled.listShape.total}`;
|
|
375
|
+
// 筛选工具条的分段计数:同一份列表响应 facets(没给就不显示计数)
|
|
376
|
+
const filterShow = out.show[`${object}__filter`] as { props?: Record<string, unknown> } | undefined;
|
|
377
|
+
if (hasList && filterShow?.props !== undefined) filterShow.props.facets = facetsPathOf(totalPath);
|
|
370
378
|
if (summaryFields.length > 0) {
|
|
371
379
|
const sid = `${object}__list_summary`;
|
|
372
|
-
const totalPath = `page.data.${object}.${entityEmit.compiled.listShape.total}`;
|
|
373
380
|
out.components.add('KitListSummary');
|
|
374
381
|
out.show[sid] = { props: { total: totalPath, facets: facetsPathOf(totalPath), fields: summaryFields } };
|
|
375
382
|
summary = listSummaryHoist(`<div data-soma-component="KitListSummary" data-soma-id="${esc(sid)}"></div>`);
|
|
@@ -3,13 +3,17 @@ import { esc } from '../../shared/escape';
|
|
|
3
3
|
// 层次基准取规格 7.2:第 2 层分区容器 `bg-surface-raised rounded-lg border border-border-subtle`。
|
|
4
4
|
// 显隐层统一用 `fixed inset-0` 的遮罩 + 内层 flex 容器:显隐只靠 core 写 `hidden` 属性,不在遮罩自身叠 display 类。
|
|
5
5
|
|
|
6
|
-
import { mergeClass } from '../../
|
|
6
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
7
7
|
import { KIT_LIST_BAR_FLAT_CLASS } from '../../recipes/container';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
9
|
+
import { KIT_FILTER_TOOLBAR_MARK } from '../../object-renderer/filter-toolbar';
|
|
10
|
+
import { KIT_STRIP_FOOT_CLASS } from '../../recipes/strip';
|
|
11
|
+
import { KIT_DIVIDER_FOOT_CLASS } from '../../recipes/divider';
|
|
12
|
+
import { KIT_LIST_PANEL_CLASS, hoistedToolbarHtml, listPanelParts } from '../shared/compile-helpers';
|
|
13
|
+
import { OVERLAY_SHELL_CLASS, classAttr, closeButtonHtml, dialogHtml, dialogIds, dialogTitles, overlayHtml, overlayIds } from '../shared/overlay-shell';
|
|
10
14
|
|
|
11
15
|
// 弹窗外壳与附加浮层壳的公共部分已下沉到 biz/shared/overlay-shell(主从工作台同用);这里原样 re-export,保持原导出名可用
|
|
12
|
-
export { closeButtonHtml, dialogHtml, dialogIds,
|
|
16
|
+
export { closeButtonHtml, dialogHtml, dialogIds, dialogTitles, overlayHtml, overlayIds };
|
|
13
17
|
|
|
14
18
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
15
19
|
export const STANDARD_CRUD_AREAS = ['root', 'filter', 'list', 'dialog', 'drawer'] as const;
|
|
@@ -19,11 +23,18 @@ export const CRUD_CLASS = {
|
|
|
19
23
|
root: 'flex flex-col gap-region',
|
|
20
24
|
/** 筛选带(列表为空 / 无集合时单独出现):自带圆角的下沉带,与列表工作面里的筛选带同一份类(不再是独立卡) */
|
|
21
25
|
filter: KIT_LIST_BAR_FLAT_CLASS,
|
|
22
|
-
/**
|
|
23
|
-
|
|
26
|
+
/** 筛选工具条(搜索 + 分段 / 下拉):画布上的一行,不进工作面;块级(表单宿主是容器查询根,在 flex 行里会塌成 0 宽,所以这里不是 flex) */
|
|
27
|
+
toolbar: 'min-w-0',
|
|
28
|
+
/** 复杂筛选:一张白色分组面(面 + 内边距),在画布上、工作面之前 */
|
|
29
|
+
filterFace: mergeClass('flex flex-col', mergeClass(kitSurfaceRecipe('panel'), 'p-card')),
|
|
30
|
+
/** 列表工作面:唯一主体 = 页面上唯一一张工作面(白色面落在统一画布上,与别的页型的卡同一种边缘处理);面本身不带内边距,文字落在对齐轴上,筛选带贴顶通栏 */
|
|
31
|
+
// overflow-clip:表头带 / 底栏带的四角随面的圆角裁切(clip 不建滚动容器,底栏的 sticky 仍相对页面滚动);面内段与段贴合(表头带 / 数据行 / 底栏),不留 gap
|
|
32
|
+
list: mergeClass('flex flex-col overflow-clip', kitSurfaceRecipe('panel')),
|
|
24
33
|
listHeadRow: KIT_LIST_PANEL_CLASS.listHeadRow,
|
|
25
34
|
/** 分页条:贴工作面底(内容不足一屏时在表后自然位置,超出一屏时粘在底)、底色同工作面、文字落在对齐轴上(轴内边距同 p-card 角色) */
|
|
26
|
-
|
|
35
|
+
// 底栏 = 面内一条底栏(高 sizeSpec.strip.footPx,与表体之间一条分隔线),底色同工作面(粘底时盖住滚上来的行);
|
|
36
|
+
// 一处分隔只用一种手段(边框普查 B05 / 公开规范摘要 M19):已有分隔线就不再另铺浅带(此前浅带 + 线 = 面差与线叠加)
|
|
37
|
+
pager: `sticky bottom-0 z-10 ${KIT_STRIP_FOOT_CLASS} ${KIT_DIVIDER_FOOT_CLASS} bg-surface px-card`,
|
|
27
38
|
...OVERLAY_SHELL_CLASS,
|
|
28
39
|
} as const;
|
|
29
40
|
|
|
@@ -54,12 +65,18 @@ export function coordinatorId(object: string): string {
|
|
|
54
65
|
|
|
55
66
|
/** 主区:筛选卡 + 列表卡(工具栏在列表卡里,排在列表之前)。区域类按 7.3 同族规则覆写。拆分规则与主从 / 分类壳共用 shared/compile-helpers#listPanelParts */
|
|
56
67
|
export function mainHtml(parts: { filter: string; toolbar: string; list: string; summary?: string }, areaClass: Record<string, string>): string {
|
|
57
|
-
const
|
|
68
|
+
const hoist = parts.toolbar !== '';
|
|
69
|
+
const { filterInner, listInner } = listPanelParts(hoist ? { filter: parts.filter, toolbar: '', list: parts.list } : parts);
|
|
58
70
|
if (listInner === '') return parts.filter === '' ? '' : `<div${cls(mergeClass(CRUD_CLASS.filter, areaClass.filter))}>${filterInner}</div>`;
|
|
59
71
|
// 页面构成(C2 唯一主体 = 页面本身):列表就是页面——不再包一张卡(container: plain、强调 primary),页面底取面板面(data-kit-canvas-hint,页面编译写 data-kit-canvas);
|
|
60
72
|
// 筛选带是自带圆角的下沉带,区域主动作打搬运标记由页面编译搬进页头尾端(页头一行 = 标题 + 主动作)
|
|
61
73
|
// 用 div 而不是 section:section 会被主题当容器画外框(描边 / 圆角 / 阴影),而本工作面是无容器的页面本体
|
|
62
|
-
|
|
74
|
+
// 风格档案 SPACE_MATERIAL:筛选工具条在画布上(不进白色工作面),工作面 = 表头浅带 + 数据行 + 底栏分页;
|
|
75
|
+
// 复杂筛选(不是搜索 + 分段 / 下拉工具条)仍收在一张白色分组面里,免得表单字段直接散在画布上
|
|
76
|
+
const hoisted = hoistedToolbarHtml(parts.toolbar);
|
|
77
|
+
const toolbar = filterInner.includes(KIT_FILTER_TOOLBAR_MARK);
|
|
78
|
+
const bar = filterInner === '' ? '' : `<div${cls(toolbar ? mergeClass(CRUD_CLASS.toolbar, areaClass.filter) : mergeClass(CRUD_CLASS.filterFace, areaClass.filter))}>${filterInner}</div>`;
|
|
79
|
+
return `${bar}<div data-kit-emphasis="primary" data-kit-role="subject" data-kit-axis=""${cls(mergeClass(CRUD_CLASS.list, areaClass.list))}>${parts.summary ?? ''}${hoisted}${listInner}</div>`;
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
export function rootHtml(object: string, children: string[], areaClass: Record<string, string>, extra: string | undefined): string {
|
|
@@ -23,7 +23,9 @@ export function listSummaryFields(entity: { schema: unknown; view?: unknown }):
|
|
|
23
23
|
for (const field of names) {
|
|
24
24
|
const decl = schema[field];
|
|
25
25
|
if (!isRec(decl) || decl.type !== 'enum' || !Array.isArray(decl.options)) continue;
|
|
26
|
-
const options = (decl.options as unknown[]).flatMap((o) => (isRec(o) && typeof o.value === 'string'
|
|
26
|
+
const options = (decl.options as unknown[]).flatMap((o) => (isRec(o) && typeof o.value === 'string'
|
|
27
|
+
? [{ value: o.value, label: typeof o.label === 'string' ? o.label : o.value, ...(typeof o.tone === 'string' ? { tone: o.tone } : {}) }]
|
|
28
|
+
: []));
|
|
27
29
|
if (options.length > 0) out.push({ field, options });
|
|
28
30
|
}
|
|
29
31
|
return out;
|
|
@@ -17,7 +17,7 @@ import { KIT_VIEW_FORM_KEYS, KIT_VIEW_SLOTS } from '../../object-renderer/defaul
|
|
|
17
17
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
18
18
|
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
19
19
|
import type { KitDiagnostic, KitFieldSchema, KitObject, KitViewForm } from '../../object-renderer/types';
|
|
20
|
-
import type { KitFragment } from '../../
|
|
20
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
21
21
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
22
22
|
import { kitText } from '../../i18n/kit-text';
|
|
23
23
|
import {
|
package/src/biz/step-form/hub.ts
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
import type { SomaComponentDefinition, SomaDataPort, SomaRegionPort } from 'soma-core';
|
|
29
29
|
import { createKitController } from '../../base/shared';
|
|
30
30
|
import { kitText } from '../../i18n/kit-text';
|
|
31
|
+
import { clearKitInlineError, showKitInlineError } from '../../base/inline-error';
|
|
31
32
|
import { askKitConfirm } from '../../data/confirm-dialog';
|
|
32
33
|
|
|
33
34
|
/** 语义事件名(SCOPE | semantic 要求小写 snake_case) */
|
|
@@ -217,6 +218,8 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
217
218
|
};
|
|
218
219
|
const toast = (level: string, message: string): void => {
|
|
219
220
|
const svc = (api.services as { notify?: { toast?: (o: { level: string; message: string }) => void } } | undefined)?.notify;
|
|
221
|
+
// 错误不用轻提示(KT-K-feedback-3,§6.1 G-17):danger 进就地提示条(窗口内进窗口槽,页面级进页头下),无槽才回退轻提示
|
|
222
|
+
if (level === 'danger' && message !== '' && showKitInlineError(api.host ?? null, message, 'step-form')) return;
|
|
220
223
|
if (svc && typeof svc.toast === 'function') svc.toast({ level, message });
|
|
221
224
|
};
|
|
222
225
|
|
|
@@ -232,6 +235,7 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
232
235
|
// 提交期间用户点了「重新开始」(seq 已变):过期的结果不再写回,免得把新一轮表单置成完成态
|
|
233
236
|
if (cur.seq !== focus.seq) return;
|
|
234
237
|
if (result.ok) {
|
|
238
|
+
clearKitInlineError(api.host ?? null, 'step-form');
|
|
235
239
|
slice.set({ ...stepFocus(cur.step, cur.total, true, cur.values, cur.seq + 1) });
|
|
236
240
|
api.emit('saved', { result: result.data ?? {} });
|
|
237
241
|
return;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// 只有结构与 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
3
3
|
// 显隐规则:面板 / 步骤条变体都是「外层只放 core 写的 hidden、内层放布局类」两层;各步表单一直挂着,只靠外层显隐切换。
|
|
4
4
|
|
|
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';
|
|
8
|
+
import { KIT_PAGE_FORM_WIDTH_CLASS } from '../../recipes/page-width';
|
|
7
9
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
8
10
|
import { cls, esc, host } from '../link/shared';
|
|
9
|
-
import { kitIconHtml } from '../../
|
|
11
|
+
import { kitIconHtml } from '../../shared/icons';
|
|
10
12
|
|
|
11
13
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
12
14
|
export const STEP_FORM_AREAS = ['root', 'card', 'steps', 'panel', 'done'] as const;
|
|
@@ -14,7 +16,7 @@ export type StepFormArea = (typeof STEP_FORM_AREAS)[number];
|
|
|
14
16
|
|
|
15
17
|
export const STEP_FORM_CLASS = {
|
|
16
18
|
root: '@container flex justify-center',
|
|
17
|
-
card: mergeClass(
|
|
19
|
+
card: mergeClass(`flex w-full ${KIT_PAGE_FORM_WIDTH_CLASS} flex-col gap-stack p-inset-roomy`, kitShellRecipe()),
|
|
18
20
|
title: kitTypographyRecipe('sectionTitle'),
|
|
19
21
|
steps: 'flex flex-wrap items-center gap-cluster',
|
|
20
22
|
stepItem: 'flex items-center gap-cluster',
|
|
@@ -25,7 +27,7 @@ export const STEP_FORM_CLASS = {
|
|
|
25
27
|
labelAt: 'text-sm font-semibold text-fg',
|
|
26
28
|
labelPast: 'text-sm text-fg',
|
|
27
29
|
labelFut: 'text-sm text-fg-muted',
|
|
28
|
-
joint:
|
|
30
|
+
joint: `w-6 ${KIT_DIVIDER_FOOT_CLASS}`,
|
|
29
31
|
panel: 'flex flex-col gap-region',
|
|
30
32
|
panelTitle: kitTypographyRecipe('sectionTitle'),
|
|
31
33
|
done: 'flex flex-col items-start gap-region',
|
package/src/biz/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 得到一个 KitFragment(HTML + `_ui.yaml` 片段 + `_event.yaml` 片段 + 候选类 + 诊断),再交页面框装入。
|
|
6
6
|
|
|
7
7
|
import type { KitObject } from '../object-renderer/types';
|
|
8
|
-
import type { KitFragment } from '../
|
|
8
|
+
import type { KitFragment } from '../object-renderer/fragment';
|
|
9
9
|
|
|
10
10
|
/** 附加浮层声明(StandardCrud 的 `overlays.*`):一个附加关联对象 + 浮层壳的种类与标题。 */
|
|
11
11
|
export interface KitOverlayDecl {
|
|
@@ -16,8 +16,8 @@ export interface KitOverlayDecl {
|
|
|
16
16
|
kind: 'dialog' | 'drawer' | 'expand';
|
|
17
17
|
title?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* 已退出的手写口:窗口宽度由内容推导(单列 480、两列或宽组件 640、三列或画布 800;只读抽屉 480 / 640),写了报 KIT-OVL-003。
|
|
20
|
+
* 抽屉只用于只读详情,带提交动作的浮层必须是 dialog(KIT-OVL-001),只读内容用 dialog 报 KIT-OVL-002
|
|
21
21
|
*/
|
|
22
22
|
width?: 'narrow' | 'default' | 'wide' | 'xwide';
|
|
23
23
|
/**
|
|
@@ -25,7 +25,7 @@ export interface KitOverlayDecl {
|
|
|
25
25
|
* 约定名 saved / cancel / close / reload 不用写,编译器自动接线;这里只补自定义事件名。
|
|
26
26
|
*/
|
|
27
27
|
events?: Record<string, string | KitOverlayEventAction>;
|
|
28
|
-
/**
|
|
28
|
+
/** 已退出的手写口:窗口外观由框架决定,写了报 KIT-OVL-003 */
|
|
29
29
|
class?: string;
|
|
30
30
|
/**
|
|
31
31
|
* 只读浮层(view 是 summary)的「编辑」去向:另一个浮层名(view 是 form,kind 可与本浮层不同,如只读抽屉切到编辑弹窗)。
|
|
@@ -73,6 +73,8 @@ export interface KitBizContext {
|
|
|
73
73
|
staticComponents: Record<string, { accept: 'single' | 'list'; emits?: readonly string[]; props?: readonly string[]; propTypes?: Readonly<Record<string, string>>; composition?: 'summary' | 'subject' | 'control' | 'note' }>;
|
|
74
74
|
/** 页面语言(`page.locale`,缺省应用 defaultLocale;未声明为空串):业务组件写进产物的内置文案按它取(`kitText(key, params, ctx.locale)`) */
|
|
75
75
|
locale?: string;
|
|
76
|
+
/** 告警通道(不挡编译、随编译结果的 deprecations 带出):过渡期的新规则先以告警落地,应用改完再升为错误 */
|
|
77
|
+
advise?: (a: { code: string; path: string; message: string; hint: string }) => void;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
export interface KitBizRole {
|
|
@@ -98,5 +100,10 @@ export interface KitBizDefinition {
|
|
|
98
100
|
* 与 acceptConfig 不同,它不让 AI 目标把该组件排除在映射外——这些键在 aiWriter 里仍是 human-only。
|
|
99
101
|
*/
|
|
100
102
|
configKeys?: readonly string[];
|
|
103
|
+
/**
|
|
104
|
+
* 页面模式推导的版心(尺寸规格 §3:阅读型 800、单对象表单 720;值是 pageHeader.maxWidths 的档名):页面没写 page.max_width 时由编译期的尺寸决定(stages.planSize)采用,
|
|
105
|
+
* 先于应用级 app.layout 默认;列表 / 看板 / 主从等不限宽的模式不写。
|
|
106
|
+
*/
|
|
107
|
+
pageMaxWidth?: string;
|
|
101
108
|
compile(input: KitBizInput, ctx: KitBizContext): KitFragment;
|
|
102
109
|
}
|