soma-kit 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/packs/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- package/spec/generated/kit-app.schema.json +18 -2
- package/spec/generated/kit-page.schema.json +95 -0
- package/spec/kit-grammar.json +332 -75
- package/spec/kit-grammar.schema.json +1 -27
- package/src/app/app-config.ts +11 -5
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +82 -10
- package/src/app/define-kit-app.ts +6 -5
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +20 -8
- package/src/app/kit-view-context.ts +30 -4
- package/src/app/server-pages.ts +5 -1
- package/src/app/server.ts +15 -5
- package/src/app/theme-endpoint.ts +1 -1
- package/src/app/theme-runtime.ts +7 -2
- package/src/base/alert.ts +23 -20
- package/src/base/anchored-layer.ts +1 -1
- package/src/base/button.ts +34 -17
- package/src/base/cascader.ts +8 -4
- package/src/base/check-core.ts +9 -6
- package/src/base/color-picker.ts +10 -6
- package/src/base/command-palette.ts +10 -4
- package/src/base/context-menu.ts +5 -2
- package/src/base/date-range.ts +9 -6
- package/src/base/date.ts +10 -6
- package/src/base/delta.ts +4 -2
- package/src/base/divider.ts +15 -66
- package/src/base/end-edge.ts +14 -2
- package/src/base/fab.ts +11 -6
- package/src/base/gap-value.ts +25 -5
- package/src/base/hint-tips.ts +1 -1
- package/src/base/illustrations.ts +2 -1
- package/src/base/index.ts +20 -4
- package/src/base/inline-error.ts +84 -0
- package/src/base/input.ts +54 -18
- package/src/base/kbd.ts +4 -3
- package/src/base/link.ts +1 -1
- package/src/base/listbox-core.ts +70 -22
- package/src/base/mentions.ts +6 -3
- package/src/base/menu-button.ts +73 -50
- package/src/base/menu-core.ts +9 -2
- package/src/base/motion/hover-3d.ts +4 -1
- package/src/base/motion/hover-gallery.ts +4 -1
- package/src/base/otp.ts +7 -3
- package/src/base/overlay-runtime.ts +3 -2
- package/src/base/overlay-shell.ts +141 -0
- package/src/base/popover.ts +7 -6
- package/src/base/popup.ts +47 -41
- package/src/base/qty-stepper.ts +14 -9
- package/src/base/reason-tip.ts +2 -2
- package/src/{frames → base}/resize-handle.ts +1 -1
- package/src/base/segmented.ts +44 -35
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +52 -18
- package/src/base/state-panel.ts +34 -13
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +56 -57
- package/src/base/text.ts +38 -14
- package/src/base/textarea.ts +1 -1
- package/src/base/time-picker.ts +9 -5
- package/src/base/tree-select.ts +12 -9
- package/src/base/upload.ts +26 -17
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +10 -9
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +7 -6
- package/src/biz/category-crud/compile.ts +20 -6
- package/src/biz/category-crud/shell.ts +10 -7
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +15 -13
- package/src/biz/compose.ts +5 -5
- package/src/biz/data-components.ts +4 -0
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +17 -13
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +6 -5
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +269 -27
- package/src/biz/master-sub/detail-head.ts +62 -0
- package/src/biz/master-sub/index.ts +5 -4
- package/src/biz/master-sub/shell.ts +138 -69
- package/src/biz/multi-board/compile.ts +166 -11
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +25 -10
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +96 -24
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +15 -7
- package/src/biz/page-templates/domain-templates.ts +7 -3
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +5 -4
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
- package/src/biz/page-templates/sign-in-page/shell.ts +18 -18
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +12 -11
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +14 -10
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +83 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +76 -4
- package/src/biz/shared/overlay-shell.ts +65 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +13 -7
- package/src/biz/standard-crud/compile.ts +24 -4
- package/src/biz/standard-crud/shell.ts +38 -30
- package/src/biz/standard-crud/summary.ts +42 -0
- package/src/biz/step-form/compile.ts +1 -1
- package/src/biz/step-form/hub.ts +4 -0
- package/src/biz/step-form/shell.ts +16 -12
- package/src/biz/types.ts +15 -3
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +35 -8
- package/src/cli/kit-init.ts +149 -0
- package/src/cli/layout-cli.ts +7 -7
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +36 -230
- package/src/compile/component-candidates.ts +4 -1
- package/src/compile/hints.ts +5 -58
- package/src/compile/index.ts +2 -2
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +97 -18
- package/src/compile/layout-lint/rules-form.ts +6 -7
- package/src/compile/layout-lint/rules-table.ts +98 -14
- package/src/compile/page-composition.ts +191 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +80 -32
- package/src/compile/types.ts +5 -3
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +6 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +13 -5
- package/src/data/assignment-picker.ts +35 -20
- package/src/data/async-result-panel.ts +7 -3
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +10 -4
- package/src/data/carousel.ts +13 -5
- package/src/data/chart.ts +745 -48
- package/src/data/checklist.ts +9 -5
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +9 -3
- package/src/data/confirm-dialog.ts +57 -20
- package/src/data/diff.ts +4 -1
- package/src/data/dock.ts +5 -1
- package/src/data/embed.ts +1 -1
- package/src/data/engine-ports.ts +126 -0
- package/src/data/field-mapper.ts +16 -7
- package/src/data/flow-editor.ts +106 -29
- package/src/data/footer.ts +8 -2
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +8 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +22 -8
- package/src/data/item-list.ts +11 -3
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +13 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +400 -0
- package/src/data/media-grid.ts +5 -2
- package/src/data/mega-menu.ts +4 -3
- package/src/data/menu-dom.ts +9 -8
- package/src/data/menu.ts +35 -17
- package/src/data/mockup.ts +12 -8
- package/src/data/modal-dialog.ts +108 -57
- package/src/data/navbar.ts +13 -7
- package/src/data/notice-list.ts +53 -20
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +248 -151
- package/src/data/pager.ts +15 -10
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +19 -9
- package/src/data/permission-tree.ts +30 -13
- package/src/data/pricing-table.ts +10 -4
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +30 -14
- package/src/data/record-picker.ts +8 -4
- package/src/data/redirect.ts +1 -1
- package/src/data/request-console.ts +20 -7
- package/src/data/resident.ts +6 -10
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +12 -7
- package/src/data/rule-builder.ts +22 -11
- package/src/data/shape-util.ts +26 -14
- package/src/data/stat-group.ts +369 -84
- package/src/data/static-lazy.ts +7 -0
- package/src/data/static-registry.ts +14 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +13 -4
- package/src/data/system-switcher.ts +17 -7
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +8 -4
- package/src/data/transfer.ts +24 -11
- package/src/data/tree-table.ts +84 -17
- package/src/data/tree.ts +6 -3
- package/src/data/virtual-rows.ts +22 -11
- package/src/data/wrap.ts +2 -2
- package/src/data/wrapped-candidates.ts +22 -1
- package/src/frames/index.ts +4 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +123 -0
- package/src/frames/page-bar.ts +10 -16
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +37 -17
- package/src/frames/split-frame/shell.ts +17 -11
- package/src/frames/split-frame/wiring.ts +2 -2
- package/src/frames/tabs-frame/shell.ts +17 -9
- package/src/frames/top-main-frame.ts +1 -1
- package/src/frames/types.ts +6 -3
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +4 -3
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +156 -91
- package/src/generated/kit-grammar-runtime.ts +227 -58
- package/src/i18n/kit-text.ts +141 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +169 -0
- package/src/object-renderer/action-more.ts +160 -0
- package/src/object-renderer/arrange.ts +86 -26
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +72 -20
- package/src/object-renderer/collection-table.ts +178 -65
- package/src/object-renderer/collection.ts +129 -83
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +10 -5
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +7 -0
- package/src/object-renderer/emit-static.ts +243 -87
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +13 -2
- package/src/object-renderer/index.ts +6 -1
- package/src/object-renderer/layout-facts.ts +46 -6
- package/src/object-renderer/layout-plan.ts +136 -43
- package/src/object-renderer/layout-plan.types.ts +42 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/parts.ts +7 -259
- package/src/object-renderer/render-object.ts +60 -47
- package/src/object-renderer/table-actions.ts +135 -56
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +63 -25
- package/src/object-renderer/types.ts +16 -22
- package/src/recipes/app-blocks.ts +66 -0
- package/src/recipes/code-view.ts +56 -0
- package/src/recipes/compact-group.ts +31 -0
- package/src/recipes/container.ts +54 -13
- package/src/recipes/control.ts +77 -157
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +60 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +34 -1
- package/src/recipes/inherited-shell.ts +37 -0
- package/src/recipes/json-view.ts +49 -0
- package/src/recipes/markdown.ts +86 -0
- package/src/recipes/overlay.ts +149 -18
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +21 -5
- package/src/recipes/rail-grid.ts +3 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +20 -28
- package/src/recipes/status.ts +17 -8
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +120 -11
- package/src/recipes/tabs.ts +126 -0
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +7 -5
- package/src/recipes/typography.ts +24 -43
- package/src/shared/diagnostics.ts +16 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-value-format.ts +246 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +12 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- package/src/shared/path-guard.ts +1 -1
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/theme-runtime-shared.ts +19 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +49 -14
- package/src/theme/kit-theme.tpl +49 -14
- package/src/theme/nine-dim-structure.ts +129 -37
- package/src/theme/surface-layers.ts +17 -4
- package/src/theme/theme-tokens.ts +16 -5
- package/src/theme/typography.ts +21 -17
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- /package/src/{base → shared}/class-candidates.ts +0 -0
package/src/base/tree-select.ts
CHANGED
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
13
13
|
import { kitText } from '../i18n/kit-text';
|
|
14
|
-
import { kitIcon } from '
|
|
14
|
+
import { kitIcon } from '../shared/icons';
|
|
15
15
|
import { setKitFace } from '../recipes';
|
|
16
|
-
import {
|
|
16
|
+
import { kitControlEdgeRecipe, kitControlRecipe } from '../recipes/control';
|
|
17
|
+
import { mergeClass } from '../shared/merge-class';
|
|
17
18
|
import { kitSurfaceRecipe } from '../recipes/surface';
|
|
18
19
|
import type { CollectionItem } from 'soma-core/keyboard';
|
|
19
20
|
import { createCheck, markInput } from './check-core';
|
|
@@ -23,26 +24,28 @@ import {
|
|
|
23
24
|
type KitApi, type KitProps, type KitSize,
|
|
24
25
|
} from './shared';
|
|
25
26
|
import {
|
|
26
|
-
EMPTY_ROW_CLASS, KIT_DROPDOWN_CLASS_CANDIDATES,
|
|
27
|
+
EMPTY_ROW_CLASS, KIT_DROPDOWN_CLASS_CANDIDATES, KIT_DROPDOWN_PANEL_MAX_CLASS,
|
|
27
28
|
syncDropdown, releaseDropdown, cssEscape, createListNav, onOutsidePress, scrollIntoViewIfAny, type ListNav,
|
|
28
29
|
} from './popup';
|
|
29
30
|
|
|
30
31
|
// ---- Tailwind 类常量与候选类清单 ----
|
|
31
32
|
|
|
32
33
|
const ROOT_CLASS = 'relative block w-full';
|
|
34
|
+
// 触发框 / 搜索框的边 = 控件轮廓出口(KT-B1 / §4 C6);已选芯片浅底无描边
|
|
35
|
+
const EDGE = kitControlEdgeRecipe();
|
|
33
36
|
const TRIGGER_CLASS: Record<KitSize, string> = {
|
|
34
|
-
sm:
|
|
35
|
-
md:
|
|
36
|
-
lg:
|
|
37
|
+
sm: `flex min-h-6 w-full cursor-pointer items-center justify-between gap-2 rounded-md ${EDGE} bg-surface px-2.5 text-sm text-fg transition-colors focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-surface-sunken disabled:text-fg-subtle disabled:opacity-60`,
|
|
38
|
+
md: `flex min-h-8 w-full cursor-pointer items-center justify-between gap-2 rounded-md ${EDGE} bg-surface px-3 text-sm text-fg transition-colors focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-surface-sunken disabled:text-fg-subtle disabled:opacity-60`,
|
|
39
|
+
lg: `flex min-h-10 w-full cursor-pointer items-center justify-between gap-2 rounded-md ${EDGE} bg-surface px-4 text-base text-fg transition-colors focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-surface-sunken disabled:text-fg-subtle disabled:opacity-60`,
|
|
37
40
|
};
|
|
38
41
|
const PLACEHOLDER_CLASS = 'truncate text-fg-subtle';
|
|
39
42
|
const VALUE_CLASS = 'flex min-w-0 flex-1 flex-wrap items-center gap-1 text-start';
|
|
40
|
-
const CHIP_CLASS = 'inline-flex items-center rounded-md
|
|
43
|
+
const CHIP_CLASS = 'inline-flex items-center rounded-md bg-surface-sunken px-1.5 py-0.5 text-xs font-medium text-fg-muted';
|
|
41
44
|
const CLEAR_CLASS = 'absolute end-8 top-0 flex h-full cursor-pointer items-center px-1 text-fg-subtle hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
42
45
|
const HIDDEN_CLASS = 'hidden';
|
|
43
46
|
const STATUS_CLASS = 'sr-only';
|
|
44
|
-
const PANEL_BASE = mergeClass(
|
|
45
|
-
const SEARCH_CLASS =
|
|
47
|
+
const PANEL_BASE = mergeClass(`absolute z-10 flex ${KIT_DROPDOWN_PANEL_MAX_CLASS} w-full flex-col gap-1 overflow-auto p-1`, kitSurfaceRecipe('raised'));
|
|
48
|
+
const SEARCH_CLASS = kitControlRecipe();
|
|
46
49
|
const TREE_CLASS = 'flex flex-col';
|
|
47
50
|
const TOGGLE_CLASS = 'w-4 shrink-0 text-fg-subtle';
|
|
48
51
|
const CHECK_CLASS = 'pointer-events-none';
|
package/src/base/upload.ts
CHANGED
|
@@ -15,9 +15,13 @@ import {
|
|
|
15
15
|
} from './shared';
|
|
16
16
|
import { safeSrc } from './avatar';
|
|
17
17
|
import { kitLocaleAt, kitText } from '../i18n/kit-text';
|
|
18
|
-
import { kitIcon } from '
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { kitIcon } from '../shared/icons';
|
|
19
|
+
import { setKitFace } from '../recipes';
|
|
20
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
21
|
+
import { kitDivideRecipe } from '../recipes/divider';
|
|
22
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
23
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
24
|
+
import { mergeClass } from '../shared/merge-class';
|
|
21
25
|
|
|
22
26
|
type FileStatus = 'pending' | 'uploading' | 'done' | 'error';
|
|
23
27
|
type RejectReason = 'type' | 'size' | 'count';
|
|
@@ -34,29 +38,34 @@ interface FileItem {
|
|
|
34
38
|
const ROOT_CLASS = 'flex w-full flex-col gap-2';
|
|
35
39
|
const PICK_CLASS: Record<KitSize, string> = {
|
|
36
40
|
// 选择文件钮 = 带文字的中性按钮:直接取按钮配方(描边走按钮描边令牌,随边界维度求解),只补「按内容收窄 + 手形光标」
|
|
37
|
-
sm: mergeClass(
|
|
38
|
-
md: mergeClass(
|
|
39
|
-
lg: mergeClass(
|
|
41
|
+
sm: mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'sm' }), 'w-fit cursor-pointer'),
|
|
42
|
+
md: mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'md' }), 'w-fit cursor-pointer'),
|
|
43
|
+
lg: mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'lg' }), 'w-fit cursor-pointer'),
|
|
40
44
|
};
|
|
41
45
|
// 投放区:静止 / 拖入高亮 / 禁用,各一整串
|
|
46
|
+
// 投放区与「+」添加格是控件(投放目标):边 = 控件轮廓出口(KT-B1 / §4 C6)+ 虚线;拖入 / 悬停变主色(强调指示)
|
|
47
|
+
const DROP_LINE = kitControlEdgeRecipe({ wrapper: true, hover: false });
|
|
48
|
+
const DROP_EDGE = `${DROP_LINE} border-dashed`;
|
|
42
49
|
const DROP_CLASS = {
|
|
43
|
-
idle:
|
|
44
|
-
over: 'flex w-full cursor-pointer flex-col items-center justify-center gap-1 rounded-lg border
|
|
45
|
-
disabled:
|
|
50
|
+
idle: `flex w-full cursor-pointer flex-col items-center justify-center gap-1 rounded-lg ${DROP_EDGE} bg-surface px-4 py-6 text-sm text-fg-muted transition-colors hover:border-primary state-layer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,
|
|
51
|
+
over: 'flex w-full cursor-pointer flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-primary bg-primary-soft px-4 py-6 text-sm text-primary-on-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
52
|
+
disabled: `flex w-full cursor-not-allowed flex-col items-center justify-center gap-1 rounded-lg ${DROP_EDGE} bg-surface-sunken px-4 py-6 text-sm text-fg-subtle opacity-60`,
|
|
46
53
|
} as const;
|
|
47
54
|
const HINT_CLASS = 'text-xs text-fg-subtle';
|
|
48
55
|
const REJECT_NOTE_CLASS = 'text-danger-on-soft';
|
|
49
56
|
// 无 preflight:ul 默认的圆点与缩进要自己清掉
|
|
50
|
-
|
|
51
|
-
const
|
|
57
|
+
// 文件列表 = 一个列表框(壳配方的容器边,KT-B2),文件行之间的线由父出(kitDivideRecipe,KT-B5),行自己不描边
|
|
58
|
+
const LIST_CLASS = mergeClass('m-0 flex list-none flex-col p-0 overflow-hidden', `${kitShellRecipe({ tone: 'base', shadow: false })} ${kitDivideRecipe('y')}`);
|
|
59
|
+
const ITEM_CLASS = 'flex items-center gap-2 bg-surface px-3 py-2 text-sm text-fg';
|
|
52
60
|
const THUMB_CLASS = 'h-8 w-8 shrink-0 rounded-md object-cover';
|
|
53
61
|
const NAME_CLASS = 'min-w-0 flex-1 truncate';
|
|
54
62
|
const SIZE_TEXT_CLASS = 'shrink-0 text-xs text-fg-subtle';
|
|
55
63
|
const STATUS_CLASS: Record<FileStatus, string> = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
// 状态芯片:浅底、无描边(芯片一种形体)
|
|
65
|
+
pending: 'shrink-0 rounded-md bg-surface-sunken px-1.5 py-0.5 text-xs font-medium text-fg-muted',
|
|
66
|
+
uploading: 'shrink-0 rounded-md bg-info-soft px-1.5 py-0.5 text-xs font-medium text-info-on-soft',
|
|
67
|
+
done: 'shrink-0 rounded-md bg-success-soft px-1.5 py-0.5 text-xs font-medium text-success-on-soft',
|
|
68
|
+
error: 'shrink-0 rounded-md bg-danger-soft px-1.5 py-0.5 text-xs font-medium text-danger-on-soft',
|
|
60
69
|
};
|
|
61
70
|
const statusText = (status: FileStatus, at: Element): string => kitText(
|
|
62
71
|
status === 'pending' ? 'soma.kit.upload_pending' : status === 'uploading' ? 'soma.kit.upload_uploading' : status === 'done' ? 'soma.kit.upload_done' : 'soma.kit.upload_error',
|
|
@@ -66,12 +75,12 @@ const REMOVE_CLASS = 'shrink-0 cursor-pointer rounded-md px-1 text-fg-subtle hov
|
|
|
66
75
|
const HIDDEN_CLASS = 'hidden';
|
|
67
76
|
// 照片墙(list: picture):方形缩略图格 + 末尾的「+」添加格
|
|
68
77
|
const WALL_CLASS = 'm-0 grid list-none grid-cols-4 gap-2 p-0';
|
|
69
|
-
const TILE_CLASS = 'relative flex aspect-square items-center justify-center overflow-hidden
|
|
78
|
+
const TILE_CLASS = mergeClass('relative flex aspect-square items-center justify-center overflow-hidden', kitShellRecipe({ tone: 'sunken', shadow: false }));
|
|
70
79
|
const TILE_IMG_CLASS = 'h-full w-full object-cover';
|
|
71
80
|
const TILE_NAME_CLASS = 'break-all px-2 text-center text-xs text-fg-muted';
|
|
72
81
|
const TILE_STATUS_CLASS = 'absolute bottom-1 start-1';
|
|
73
82
|
const TILE_REMOVE_CLASS = 'absolute end-1 top-1 cursor-pointer rounded-md bg-surface/80 px-1.5 text-sm text-fg transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
74
|
-
const ADD_TILE_CLASS =
|
|
83
|
+
const ADD_TILE_CLASS = `flex aspect-square w-full cursor-pointer flex-col items-center justify-center gap-1 rounded-lg ${DROP_EDGE} bg-surface text-sm text-fg-muted transition-colors hover:border-primary state-layer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;
|
|
75
84
|
const ADD_TILE_PLUS_CLASS = 'text-xl text-fg-subtle';
|
|
76
85
|
// 手动上传按钮:主色实心,文字 -fg
|
|
77
86
|
const START_CLASS: Record<KitSize, string> = {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
17
17
|
import type { KitObject } from '../../object-renderer/types';
|
|
18
|
-
import type { KitFragment } from '../../
|
|
18
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
19
19
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
20
20
|
import { KIT_LINK_MIRRORS, KIT_SEL_PATH } from '../link/hub';
|
|
21
21
|
import { bizObjectName, finishBizCompile, validateBizAreaClass } from '../shared/compile-helpers';
|
|
@@ -35,6 +35,32 @@ function isStaticView(s: unknown): boolean {
|
|
|
35
35
|
return !!v && (v.staticComponent !== undefined || (isRec(v.summary) && v.summary.staticComponent !== undefined) || (isRec(v.list) && v.list.staticComponent !== undefined));
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/** 审批单摘要里的按钮型虚拟字段(component: Button)隐藏冗余上方字段名标签,避免按钮上方重复显示按钮文字 */
|
|
39
|
+
function hideButtonFieldLabels(obj: KitObject): void {
|
|
40
|
+
const summary = obj.view?.summary;
|
|
41
|
+
if (summary === undefined) return;
|
|
42
|
+
const patchList = (list: unknown): void => {
|
|
43
|
+
if (!Array.isArray(list)) return;
|
|
44
|
+
for (const item of list) {
|
|
45
|
+
if (!isRec(item)) continue;
|
|
46
|
+
if (item.component === 'Button') {
|
|
47
|
+
if (item.label === undefined) item.label = '';
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// YAML 短写:{ ok: { component: 'Button', ... } }
|
|
51
|
+
const keys = Object.keys(item);
|
|
52
|
+
if (keys.length === 1 && isRec(item[keys[0]!])) {
|
|
53
|
+
const inner = item[keys[0]!] as Rec;
|
|
54
|
+
if (inner.component === 'Button' && inner.label === undefined) inner.label = '';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
patchList(summary.fields);
|
|
59
|
+
if (Array.isArray(summary.groups)) {
|
|
60
|
+
for (const g of summary.groups) if (isRec(g)) patchList(g.fields);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
38
64
|
export function compileApprovalDesk(input: KitBizInput, ctx: KitBizContext): KitFragment {
|
|
39
65
|
const out = newParts(['KitLinkHub', 'KitCrudBridge']);
|
|
40
66
|
const fail = (code: string, message: string, path: string): void => { out.diagnostics.push({ code, message, path }); };
|
|
@@ -101,6 +127,7 @@ export function compileApprovalDesk(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
101
127
|
requireLink: true,
|
|
102
128
|
});
|
|
103
129
|
out.diagnostics.push(...norm.diagnostics);
|
|
130
|
+
if (role === 'request') hideButtonFieldLabels(norm.obj);
|
|
104
131
|
const object = approvalDeskObjectName(ctx.pageId, role);
|
|
105
132
|
members.push({ role, object, scope: `${object}_scope`, obj: norm.obj, title: typeof raw.title === 'string' ? raw.title : '' });
|
|
106
133
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// 三栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档左 3 / 中 5 / 右 4(共 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
|
+
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 } {
|
|
@@ -41,7 +42,7 @@ export function approvalDeskHtml(
|
|
|
41
42
|
// 截断的标题悬停 / 聚焦时由 hint-tips 按需挂全文气泡(作用范围标记就在标题元素自身)
|
|
42
43
|
const title = c.title === '' ? '' : `<h3${cls(APPROVAL_DESK_CLASS.title)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(c.title)}</h3>`;
|
|
43
44
|
const base = wide === undefined ? APPROVAL_DESK_CLASS[area] : wide;
|
|
44
|
-
return `<section${cls(mergeClass(base, areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${c.html}</section>`;
|
|
45
|
+
return `<section data-kit-container="card"${cls(mergeClass(base, areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${c.html}</section>`;
|
|
45
46
|
};
|
|
46
47
|
// 没有历史栏时,审批单栏吃掉右侧 4 份
|
|
47
48
|
const requestBase = parts.history === null ? APPROVAL_DESK_CLASS.requestWide : undefined;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
14
14
|
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
15
15
|
import type { KitObject } from '../../object-renderer/types';
|
|
16
|
-
import type { KitFragment } from '../../
|
|
16
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
17
17
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
18
18
|
import {
|
|
19
19
|
bizObjectName, finishBizCompile, validateBizAreaClass,
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
// AuthPanel 的 HTML 代码壳:顶部当前用户摘要,下方左角色列表 + 右权限矩阵。只有结构与 Tailwind 类,不写原生 CSS。
|
|
2
2
|
// 分栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档角色 4 / 矩阵 8(共 12 份)。
|
|
3
3
|
|
|
4
|
-
import { mergeClass } from '../../
|
|
4
|
+
import { mergeClass } from '../../shared/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 } {
|
|
@@ -38,7 +39,7 @@ export function authPanelHtml(
|
|
|
38
39
|
): string {
|
|
39
40
|
const block = (area: 'user' | 'roles' | 'matrix', b: AuthBlock): string => {
|
|
40
41
|
const title = b.title === '' ? '' : `<h3${cls(AUTH_PANEL_CLASS.title)}>${esc(b.title)}</h3>`;
|
|
41
|
-
return `<section${cls(mergeClass(AUTH_PANEL_CLASS[area], areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${b.html}</section>`;
|
|
42
|
+
return `<section data-kit-container="card"${cls(mergeClass(AUTH_PANEL_CLASS[area], areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${b.html}</section>`;
|
|
42
43
|
};
|
|
43
44
|
const user = parts.user === null ? '' : `${block('user', parts.user)}\n`;
|
|
44
45
|
const root = mergeClass(mergeClass(AUTH_PANEL_CLASS.root, areaClass.root), extra);
|
|
@@ -9,14 +9,16 @@
|
|
|
9
9
|
// 缺分类键不取数:条目的 from 编成 core `from[].require`(requireLink),尚未选分类时对象落 idle,不发请求。
|
|
10
10
|
|
|
11
11
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
12
|
-
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
12
|
+
import { stateAnchor, viewAnchor } from '../../object-renderer/emit-static';
|
|
13
13
|
import type { KitObject, KitType } from '../../object-renderer/types';
|
|
14
|
-
import type { KitFragment } from '../../
|
|
14
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
15
15
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
16
16
|
import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS } from '../shared/coordinator';
|
|
17
|
-
import { bizObjectName, finishBizCompile, validateBizAreaClass } from '../shared/compile-helpers';
|
|
17
|
+
import { bizObjectName, finishBizCompile, listPanelBody, validateBizAreaClass } from '../shared/compile-helpers';
|
|
18
18
|
import { wireDialogForm } from '../shared/pipes';
|
|
19
|
-
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles
|
|
19
|
+
import { OVERLAY_SHELL_CLASS, dialogHtml, dialogIds, dialogTitles } from '../shared/overlay-shell';
|
|
20
|
+
import { adviseDialogFooter } from '../shared/overlay-compile';
|
|
21
|
+
import { dialogWidthOf } from '../../object-renderer/overlay-decide';
|
|
20
22
|
import { KIT_LINK_MIRRORS, KIT_SEL_PATH } from '../link/hub';
|
|
21
23
|
import {
|
|
22
24
|
IDENT, classesIn, emitMember, grantPageReset, isRec, keyFieldOf, linkRemoveProps, mirrorPath, newParts,
|
|
@@ -139,11 +141,22 @@ export function compileCategoryCrud(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
139
141
|
const createName = item.behavior.actions?.find((a) => a.builtin === 'openCreate')?.name ?? kitText('soma.kit.create', undefined, ctx.locale);
|
|
140
142
|
const editName = item.behavior.actions?.find((a) => a.builtin === 'openEdit')?.name ?? kitText('soma.kit.edit', undefined, ctx.locale);
|
|
141
143
|
dialog = dialogHtml(d, dialogTitles(item.view?.form?.title, { create: createName, edit: editName }), it.r.parts.form ?? '', { dialog: areaClass.dialog ?? '' }, CLOSE_LABEL, '', dialogWidthOf({ form: item.view?.form, schema: item.schema }));
|
|
144
|
+
adviseDialogFooter(ctx, item.view?.form, 'product.objects.item.view.form.footerActions');
|
|
142
145
|
for (const cl of Object.values(OVERLAY_SHELL_CLASS)) for (const t of cl.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
// ---- 枢纽与协调组件
|
|
146
|
-
|
|
149
|
+
// 分类为普通列表时 selection 归枢纽所有,启用 autoSelect 自动选中首项;分类为树(selection 归树)时在未选分类的 idle 态展示明确引导文案,不卡在加载骨架
|
|
150
|
+
const catRowsPath = `page.data.${catName}.${c.r.compiled.listShape.rows}`;
|
|
151
|
+
const hubAutoSelect = staticView === undefined;
|
|
152
|
+
out.show[ids.hub] = {
|
|
153
|
+
props: { scope: link, keyField: catKey, linkKey, autoSelect: hubAutoSelect, rows: hubAutoSelect ? catRowsPath : [], pageScopes },
|
|
154
|
+
};
|
|
155
|
+
const itemStateShow = out.show[stateAnchor(itemName)] as { props?: { config?: Record<string, unknown> } } | undefined;
|
|
156
|
+
if (itemStateShow?.props?.config !== undefined && itemStateShow.props.config.idle === undefined) {
|
|
157
|
+
// 文案只走 i18n 唯一出口(接入核对 C4:不在编译器里写中英两句)
|
|
158
|
+
itemStateShow.props.config = { ...itemStateShow.props.config, idle: kitText('soma.kit.pick_category_first', undefined, ctx.locale) };
|
|
159
|
+
}
|
|
147
160
|
out.show[ids.coord] = {
|
|
148
161
|
props: {
|
|
149
162
|
scope: link, object: itemName, keyField: keyFieldOf(item) ?? '', reloads: [], overlays: {}, rowsPath: it.r.compiled.listShape.rows,
|
|
@@ -154,7 +167,8 @@ export function compileCategoryCrud(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
154
167
|
|
|
155
168
|
// ---- 壳
|
|
156
169
|
const catHtml = [c.r.parts.toolbar ?? '', c.r.parts.filter ?? '', c.listHtml, c.r.parts.summary ?? ''].filter((x) => x !== '').join('\n');
|
|
157
|
-
|
|
170
|
+
// 条目面板:工具条区(筛选 + 主操作)+ hairline + 集合 + 摘要(单一面板,见 shared/compile-helpers#listPanelBody)
|
|
171
|
+
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
172
|
const html = categoryCrudHtml(ids, { category: catHtml, item: itemHtml, dialog }, areaClass, input.class);
|
|
159
173
|
for (const cl of classesIn(html)) out.candidates.add(cl);
|
|
160
174
|
for (const cl of Object.values(CATEGORY_CRUD_CLASS)) for (const t of cl.split(/\s+/)) if (t !== '') out.candidates.add(t);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// CategoryCrud 的 HTML 代码壳:左侧固定紧凑分类栏(默认 w-56)+ 右侧条目管理区。只有结构与 Tailwind 类,分栏靠容器查询变体。
|
|
2
2
|
|
|
3
|
-
import { mergeClass } from '../../
|
|
3
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
4
4
|
import { kitShellRecipe } from '../../recipes/container';
|
|
5
5
|
import { cls, esc, host } from '../link/shared';
|
|
6
6
|
|
|
@@ -8,9 +8,12 @@ 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// 外层只做容器查询宿主(@container 不能自查询,@md:flex-row 放在内层容器上)
|
|
12
|
+
root: '@container w-full',
|
|
13
|
+
layout: 'flex flex-col gap-section @md:flex-row',
|
|
14
|
+
categorySidebar: mergeClass('w-full shrink-0 @md:w-56 p-inset-compact flex flex-col gap-cluster', kitShellRecipe()),
|
|
15
|
+
// 条目工作区是一张面板(单一面板:工具条区 + hairline + 集合共用一个面,面板持有内边距 p-card),与 StandardCrud 的列表卡同一结构
|
|
16
|
+
itemWorkspace: mergeClass('flex min-w-0 flex-1 flex-col gap-region p-card', kitShellRecipe({ tone: 'base', shadow: false })),
|
|
14
17
|
} as const;
|
|
15
18
|
|
|
16
19
|
export function categoryCrudIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -23,8 +26,8 @@ export function categoryCrudHtml(
|
|
|
23
26
|
areaClass: Record<string, string>,
|
|
24
27
|
extra: string | undefined,
|
|
25
28
|
): string {
|
|
26
|
-
const side = `<aside${cls(mergeClass(CATEGORY_CRUD_CLASS.categorySidebar, areaClass.categorySidebar))}>${parts.category}</aside>`;
|
|
27
|
-
const main = `<section${cls(mergeClass(CATEGORY_CRUD_CLASS.itemWorkspace, areaClass.itemWorkspace))}>${parts.item}</section>`;
|
|
29
|
+
const side = `<aside data-kit-container="card"${cls(mergeClass(CATEGORY_CRUD_CLASS.categorySidebar, areaClass.categorySidebar))}>${parts.category}</aside>`;
|
|
30
|
+
const main = `<section data-kit-container="card"${cls(mergeClass(CATEGORY_CRUD_CLASS.itemWorkspace, areaClass.itemWorkspace))}>${parts.item}</section>`;
|
|
28
31
|
const root = mergeClass(mergeClass(CATEGORY_CRUD_CLASS.root, areaClass.root), extra);
|
|
29
|
-
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitLinkHub', ids.hub)}${host('KitCrudBridge', ids.coord)}\n${side}\n${main}\n${parts.dialog}\n</div>`;
|
|
32
|
+
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitLinkHub', ids.hub)}${host('KitCrudBridge', ids.coord)}\n<div${cls(CATEGORY_CRUD_CLASS.layout)}>\n${side}\n${main}\n</div>\n${parts.dialog}\n</div>`;
|
|
30
33
|
}
|
|
@@ -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 { addEmit, classesIn, isRec, newParts, patchProps, type Rec } from '../link/shared';
|
|
16
16
|
import {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// CheckoutPage 的 HTML 代码壳:左信息表单卡 + 右订单摘要栏(明细 + 金额汇总)。只有结构与 Tailwind 类,分栏靠容器查询变体 `@md:`:
|
|
2
2
|
// 窄容器下摘要在表单之后上下堆叠;达到 md 档左 7 / 右 5(共 12 份)。
|
|
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';
|
|
7
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
6
8
|
import { cls, esc } from '../link/shared';
|
|
7
9
|
|
|
8
10
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
@@ -10,14 +12,14 @@ export const CHECKOUT_PAGE_AREAS = ['root', 'form', 'summary', 'items', 'amounts
|
|
|
10
12
|
export type CheckoutPageArea = (typeof CHECKOUT_PAGE_AREAS)[number];
|
|
11
13
|
|
|
12
14
|
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:
|
|
15
|
+
root: '@container grid grid-cols-12 gap-section',
|
|
16
|
+
form: mergeClass('col-span-12 @md:col-span-7 flex min-w-0 flex-col gap-section p-inset-roomy', kitShellRecipe()),
|
|
17
|
+
summary: 'col-span-12 @md:col-span-5 flex min-w-0 flex-col gap-section',
|
|
18
|
+
items: mergeClass('flex flex-col gap-region p-card', kitShellRecipe()),
|
|
19
|
+
amounts: mergeClass('flex flex-col gap-region p-card', kitShellRecipe({ tone: 'sunken', shadow: false })),
|
|
20
|
+
title: kitTypographyRecipe('sectionTitle'),
|
|
21
|
+
/** 表单底部提交栏(表单 actions 区);动作组恒单行不折行(排布引擎动作组规则) */
|
|
22
|
+
footer: `mt-2 flex flex-nowrap items-end gap-cluster ${KIT_DIVIDER_FOOT_CLASS} pt-4`,
|
|
21
23
|
} as const;
|
|
22
24
|
|
|
23
25
|
export function checkoutPageIds(pageId: string): { root: string } {
|
|
@@ -40,12 +42,12 @@ export function checkoutPageHtml(
|
|
|
40
42
|
extra: string | undefined,
|
|
41
43
|
): string {
|
|
42
44
|
const head = (t: string): string => (t === '' ? '' : `<h2${cls(CHECKOUT_PAGE_CLASS.title)}>${esc(t)}</h2>`);
|
|
43
|
-
const form = `<section${cls(mergeClass(CHECKOUT_PAGE_CLASS.form, areaClass.form))}>${head(parts.formTitle)}${parts.form}</section>`;
|
|
44
|
-
const items = `<section${cls(mergeClass(CHECKOUT_PAGE_CLASS.items, areaClass.items))}>${head(parts.itemsTitle)}${parts.items}</section>`;
|
|
45
|
+
const form = `<section data-kit-container="card"${cls(mergeClass(CHECKOUT_PAGE_CLASS.form, areaClass.form))}>${head(parts.formTitle)}${parts.form}</section>`;
|
|
46
|
+
const items = `<section data-kit-container="card"${cls(mergeClass(CHECKOUT_PAGE_CLASS.items, areaClass.items))}>${head(parts.itemsTitle)}${parts.items}</section>`;
|
|
45
47
|
const amounts = parts.amounts === ''
|
|
46
48
|
? ''
|
|
47
|
-
: `\n<section${cls(mergeClass(CHECKOUT_PAGE_CLASS.amounts, areaClass.amounts))}>${head(parts.amountsTitle)}${parts.amounts}</section>`;
|
|
48
|
-
const summary = `<aside${cls(mergeClass(CHECKOUT_PAGE_CLASS.summary, areaClass.summary))}>\n${items}${amounts}\n</aside>`;
|
|
49
|
+
: `\n<section data-kit-container="card"${cls(mergeClass(CHECKOUT_PAGE_CLASS.amounts, areaClass.amounts))}>${head(parts.amountsTitle)}${parts.amounts}</section>`;
|
|
50
|
+
const summary = `<aside data-kit-container="card"${cls(mergeClass(CHECKOUT_PAGE_CLASS.summary, areaClass.summary))}>\n${items}${amounts}\n</aside>`;
|
|
49
51
|
const root = mergeClass(mergeClass(CHECKOUT_PAGE_CLASS.root, areaClass.root), extra);
|
|
50
52
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${form}\n${summary}\n</div>`;
|
|
51
53
|
}
|
package/src/biz/compose.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
// 2. composeKitBizComponents:将多个业务组件按角色映射与独立子前缀(`${ctx.pageId}_${part}`)无冲突组合,
|
|
6
6
|
// 经 mergeFragments 合并数据、区域切片与事件,并嵌入应用写死的异形网格或装饰外壳 HTML。
|
|
7
7
|
|
|
8
|
-
import { emptyFragment, mergeFragments, type KitFragment } from '../
|
|
9
|
-
import { checkClasses, mergeClass } from '../
|
|
8
|
+
import { emptyFragment, mergeFragments, type KitFragment } from '../object-renderer/fragment';
|
|
9
|
+
import { checkClasses, mergeClass } from '../shared/merge-class';
|
|
10
10
|
import type { KitDiagnostic, KitObject } from '../object-renderer/types';
|
|
11
11
|
import { defineKitBizComponent } from './define';
|
|
12
12
|
import { validateBizAreaClass } from './shared/compile-helpers';
|
|
13
13
|
import type { KitBizContext, KitBizDefinition, KitBizInput, KitBizRole } from './types';
|
|
14
|
-
import { kitFail } from '../
|
|
14
|
+
import { kitFail } from '../shared/kit-error';
|
|
15
15
|
|
|
16
16
|
export interface WrapBizShellContext {
|
|
17
17
|
input: KitBizInput;
|
|
@@ -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
|
/** 装配期并入组件表的协作数据组件:名字 -> 定义 */
|
package/src/biz/define.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
13
13
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
14
14
|
import type { KitFieldSchema, KitObject } from '../../object-renderer/types';
|
|
15
|
-
import type { KitFragment } from '../../
|
|
15
|
+
import type { KitFragment } from '../../object-renderer/fragment';
|
|
16
16
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
17
17
|
import { kitText, type KitTextKey } from '../../i18n/kit-text';
|
|
18
18
|
import { finishBizCompile, validateBizAreaClass } from '../shared/compile-helpers';
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
// 只有结构与 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
3
3
|
// 显隐规则同 StepForm:面板 / 步骤条变体 / 按钮都是「外层只放 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_READ_WIDTH_CLASS } from '../../recipes/page-width';
|
|
9
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
7
10
|
import { cls, esc, host } from '../link/shared';
|
|
8
11
|
import { kitText } from '../../i18n/kit-text';
|
|
9
|
-
import { kitIconHtml } from '../../
|
|
12
|
+
import { kitIconHtml } from '../../shared/icons';
|
|
10
13
|
|
|
11
14
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
12
15
|
export const IMPORT_WIZARD_AREAS = ['root', 'card', 'steps', 'panel', 'preview', 'done'] as const;
|
|
@@ -19,10 +22,10 @@ export const IMPORT_WIZARD_STEP_TITLES = [
|
|
|
19
22
|
|
|
20
23
|
export const IMPORT_WIZARD_CLASS = {
|
|
21
24
|
root: '@container flex justify-center',
|
|
22
|
-
card: mergeClass(
|
|
23
|
-
title: '
|
|
24
|
-
steps: 'flex flex-wrap items-center gap-
|
|
25
|
-
stepItem: 'flex items-center gap-
|
|
25
|
+
card: mergeClass(`flex w-full ${KIT_PAGE_READ_WIDTH_CLASS} flex-col gap-stack p-inset-roomy`, kitShellRecipe()),
|
|
26
|
+
title: kitTypographyRecipe('sectionTitle'),
|
|
27
|
+
steps: 'flex flex-wrap items-center gap-cluster',
|
|
28
|
+
stepItem: 'flex items-center gap-cluster',
|
|
26
29
|
circle: 'flex h-6 w-6 items-center justify-center rounded-full text-sm font-medium',
|
|
27
30
|
circleAt: 'bg-primary text-primary-fg',
|
|
28
31
|
circlePast: 'bg-success text-success-fg',
|
|
@@ -30,14 +33,14 @@ export const IMPORT_WIZARD_CLASS = {
|
|
|
30
33
|
labelAt: 'text-sm font-semibold text-fg',
|
|
31
34
|
labelPast: 'text-sm text-fg',
|
|
32
35
|
labelFut: 'text-sm text-fg-muted',
|
|
33
|
-
joint:
|
|
34
|
-
panel: 'flex flex-col gap-
|
|
35
|
-
panelTitle: '
|
|
36
|
+
joint: `w-6 ${KIT_DIVIDER_FOOT_CLASS}`,
|
|
37
|
+
panel: 'flex flex-col gap-section',
|
|
38
|
+
panelTitle: kitTypographyRecipe('sectionTitle'),
|
|
36
39
|
hint: 'text-sm text-fg-muted',
|
|
37
40
|
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-
|
|
41
|
+
buttons: 'flex flex-wrap items-center justify-end gap-cluster',
|
|
42
|
+
preview: 'flex flex-col gap-region',
|
|
43
|
+
done: 'flex flex-col gap-section',
|
|
41
44
|
} as const;
|
|
42
45
|
|
|
43
46
|
export interface ImportWizardIds {
|
|
@@ -156,7 +159,8 @@ export function importWizardHtml(
|
|
|
156
159
|
+ '</div>');
|
|
157
160
|
|
|
158
161
|
const title = parts.title === '' ? '' : `<h2${cls(C.title)}>${esc(parts.title)}</h2>`;
|
|
159
|
-
|
|
162
|
+
// 唯一主体 = 页面(C2):向导卡是 E1 主体
|
|
163
|
+
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
164
|
const root = mergeClass(mergeClass(C.root, areaClass.root), extra);
|
|
161
165
|
return `<div data-soma-id="${esc(ids.root)}"${cls(root)}>\n${host('KitImportHub', ids.hub)}\n${card}\n</div>`;
|
|
162
166
|
}
|
package/src/biz/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// 业务组件登记表:内置闭集。编译器按 `product.kind` 查 KIT_BIZ_COMPONENTS。
|
|
2
|
-
//
|
|
2
|
+
// 16 个内置业务组件闭集(StandardCrud / MasterSubWorkstation / CategoryCrud / MultiObjectBoard / ReportBoard(报告阅读页:同看板构成、阅读版心)/ SingleObjectForm / ApprovalDesk / RecordDetail / StepForm / NotificationCenter / AuthPanel / SettingsCenter / CheckoutPage / LandingPage / ResultPage / ImportWizard)+ KIT_PAGE_TEMPLATES 10 个可选页面模板。
|
|
3
3
|
// 业务组件壳依赖两个无界面协作数据组件:KitCrudBridge(focus 切片 owner:浮层开合、预填、保存后重取、删除)
|
|
4
4
|
// 与 KitLinkHub(selection 切片 owner:主子 / 分类联动选中、默认首条、字段动作带当前行),登记在 KIT_BIZ_DATA_COMPONENTS,
|
|
5
5
|
// 由应用装配并入数据组件表(与 createKitDataComponents 的产物合并,重名要显式 overrides)。
|
|
6
6
|
|
|
7
7
|
import { CategoryCrud } from './category-crud';
|
|
8
8
|
import { MasterSubWorkstation } from './master-sub';
|
|
9
|
-
import { MultiObjectBoard } from './multi-board';
|
|
9
|
+
import { MultiObjectBoard, ReportBoard } from './multi-board';
|
|
10
10
|
import { SingleObjectForm } from './single-form';
|
|
11
11
|
import { StandardCrud } from './standard-crud';
|
|
12
12
|
import { ApprovalDesk } from './approval-desk';
|
|
@@ -43,7 +43,7 @@ export * from './shared';
|
|
|
43
43
|
export { StandardCrud, compileStandardCrud, CRUD_CLASS } from './standard-crud';
|
|
44
44
|
export { MasterSubWorkstation, compileMasterSub, masterSubObjectName } from './master-sub';
|
|
45
45
|
export { CategoryCrud, compileCategoryCrud, categoryObjectName } from './category-crud';
|
|
46
|
-
export { MultiObjectBoard, compileMultiBoard, boardFilterName, boardPanelName } from './multi-board';
|
|
46
|
+
export { MultiObjectBoard, ReportBoard, compileMultiBoard, boardFilterName, boardPanelName } from './multi-board';
|
|
47
47
|
export { SingleObjectForm, compileSingleForm, singleFormObjectName } from './single-form';
|
|
48
48
|
export { createKitLinkHub, KIT_LINK_EVENTS, KIT_LINK_MIRRORS } from './link/hub';
|
|
49
49
|
export { ApprovalDesk, compileApprovalDesk, approvalDeskObjectName } from './approval-desk';
|
|
@@ -93,6 +93,7 @@ export const KIT_BIZ_COMPONENTS: Record<string, KitBizDefinition> = {
|
|
|
93
93
|
MasterSubWorkstation,
|
|
94
94
|
CategoryCrud,
|
|
95
95
|
MultiObjectBoard,
|
|
96
|
+
ReportBoard,
|
|
96
97
|
SingleObjectForm,
|
|
97
98
|
ApprovalDesk,
|
|
98
99
|
RecordDetail,
|