soma-kit 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +8 -5
- package/packs/ai/model-card.ts +3 -3
- package/packs/ops/error-budget-card.ts +3 -3
- package/packs/ops/release-readiness-card.ts +3 -3
- package/packs/security/control-evidence-card.ts +3 -3
- package/packs/security/finding-card.ts +3 -2
- package/packs/shared/card-util.ts +17 -0
- package/spec/generated/kit-app.schema.json +2148 -340
- package/spec/generated/kit-page.schema.json +1134 -139
- package/spec/kit-grammar.json +934 -92
- package/spec/kit-grammar.schema.json +167 -2
- package/src/app/app-config.ts +219 -186
- package/src/app/define-kit-actions.ts +126 -20
- package/src/app/define-kit-app.ts +49 -4
- package/src/app/index.ts +5 -0
- package/src/app/kit-view-context.ts +39 -1
- package/src/app/list-page-defaults.ts +14 -0
- package/src/app/server-pages.ts +239 -7
- package/src/app/server.ts +466 -25
- package/src/app/theme-endpoint.ts +67 -23
- package/src/app/theme-runtime.ts +414 -85
- package/src/app/theme-shards.ts +69 -0
- package/src/app/tier-compat.ts +107 -0
- package/src/base/action-busy.ts +215 -38
- package/src/base/affix.ts +137 -0
- package/src/base/alert.ts +104 -59
- package/src/base/anchored-layer.ts +7 -6
- package/src/base/avatar.ts +147 -61
- package/src/base/badge.ts +186 -0
- package/src/base/button-group.ts +227 -0
- package/src/base/button.ts +347 -50
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +143 -32
- package/src/base/check-core.ts +193 -33
- package/src/base/checkbox.ts +67 -2
- package/src/base/choice.ts +132 -31
- package/src/base/collapse.ts +249 -0
- package/src/base/color-picker.ts +399 -27
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +148 -36
- package/src/base/context-menu.ts +23 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +114 -96
- package/src/base/date.ts +481 -74
- package/src/base/delta.ts +16 -9
- package/src/base/divider.ts +51 -33
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +57 -21
- package/src/base/gap-value.ts +34 -15
- package/src/base/hint-tips.ts +99 -29
- package/src/base/identity-cells.ts +839 -0
- package/src/base/illustrations.ts +6 -4
- package/src/base/image.ts +40 -19
- package/src/base/index.ts +79 -22
- package/src/base/inline-error.ts +13 -7
- package/src/base/input.ts +135 -35
- package/src/base/kbd.ts +30 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +282 -101
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +55 -22
- package/src/base/menu-button.ts +73 -22
- package/src/base/menu-core.ts +201 -24
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +7 -5
- package/src/base/motion/hover-gallery.ts +16 -12
- package/src/base/motion/limits.ts +10 -0
- package/src/base/motion/marquee.ts +18 -11
- package/src/base/motion/text-rotate.ts +34 -16
- package/src/base/notification.ts +292 -0
- package/src/base/number.ts +93 -12
- package/src/base/otp.ts +139 -27
- package/src/base/overlay-runtime.ts +30 -23
- package/src/base/overlay-shell.ts +59 -14
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +624 -73
- package/src/base/popup.ts +187 -52
- package/src/base/portal-core.ts +99 -2
- package/src/base/price-text.ts +51 -17
- package/src/base/progress.ts +100 -18
- package/src/base/qr-code.ts +64 -17
- package/src/base/qty-stepper.ts +141 -22
- package/src/base/radio.ts +43 -2
- package/src/base/range.ts +194 -39
- package/src/base/rating.ts +117 -31
- package/src/base/reason-tip.ts +58 -16
- package/src/base/relation-cells.ts +541 -0
- package/src/base/resize-handle.ts +5 -3
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +70 -26
- package/src/base/select.ts +8 -3
- package/src/base/shared.ts +482 -71
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- package/src/base/sticky-edge.ts +96 -29
- package/src/base/swap.ts +39 -21
- package/src/base/switch.ts +158 -38
- package/src/base/tabs.ts +292 -0
- package/src/base/tag-input.ts +123 -54
- package/src/base/tag.ts +184 -66
- package/src/base/text.ts +461 -71
- package/src/base/textarea.ts +88 -39
- package/src/base/time-picker.ts +335 -55
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +342 -88
- package/src/base/upload.ts +604 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +70 -5
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +52 -12
- package/src/biz/auth-panel/compile.ts +13 -3
- package/src/biz/auth-panel/shell.ts +27 -7
- package/src/biz/category-crud/compile.ts +51 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +29 -9
- package/src/biz/checkout-page/compile.ts +37 -3
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +26 -9
- package/src/biz/compose.ts +6 -1
- package/src/biz/data-components.ts +2 -0
- package/src/biz/import-wizard/compile.ts +4 -1
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +32 -18
- package/src/biz/index.ts +1 -1
- package/src/biz/landing-page/compile.ts +3 -2
- package/src/biz/landing-page/shell.ts +22 -3
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +54 -15
- package/src/biz/master-sub/compile.ts +194 -57
- package/src/biz/master-sub/detail-head.ts +141 -18
- package/src/biz/master-sub/index.ts +3 -0
- package/src/biz/master-sub/shell.ts +186 -57
- package/src/biz/multi-board/compile.ts +87 -36
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +3 -2
- package/src/biz/multi-board/prose-fold.ts +15 -11
- package/src/biz/multi-board/shell.ts +148 -37
- package/src/biz/notification-center/compile.ts +20 -6
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +43 -10
- package/src/biz/page-templates/domain-templates.ts +145 -22
- package/src/biz/page-templates/result-page/compile.ts +4 -1
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +17 -4
- package/src/biz/page-templates/sign-in-page/compile.ts +19 -8
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +28 -12
- package/src/biz/record-detail/compile.ts +39 -11
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +41 -10
- package/src/biz/settings-center/compile.ts +4 -1
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +30 -9
- package/src/biz/shared/action-host.ts +137 -46
- package/src/biz/shared/compile-helpers.ts +130 -28
- package/src/biz/shared/coordinator.ts +628 -147
- package/src/biz/shared/focus-return.ts +180 -0
- package/src/biz/shared/object-aliases.ts +7 -1
- package/src/biz/shared/overlay-compile.ts +58 -10
- package/src/biz/shared/overlay-shell.ts +40 -10
- package/src/biz/shared/page-form-actions.ts +151 -0
- package/src/biz/shared/page-form.ts +255 -0
- package/src/biz/shared/pipeline.ts +74 -0
- package/src/biz/shared/runtime-hub.ts +101 -8
- package/src/biz/shared/verbs.ts +129 -0
- package/src/biz/single-form/compile.ts +4 -2
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +21 -11
- package/src/biz/standard-crud/compile.ts +206 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +82 -22
- package/src/biz/standard-crud/summary.ts +2 -37
- package/src/biz/step-form/compile.ts +12 -3
- package/src/biz/step-form/hub.ts +165 -50
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +31 -15
- package/src/biz/types.ts +40 -4
- package/src/cli/kit-cli.ts +145 -26
- package/src/cli/kit-init.ts +3 -3
- package/src/cli/migrate/theme-map.ts +35 -28
- package/src/cli/migrate/ts-rules.ts +2 -2
- package/src/cli/migrate/types.ts +3 -3
- package/src/cli/migrate/yaml-rules.ts +11 -9
- package/src/cli/view-writes.ts +13 -0
- package/src/compile/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +446 -53
- package/src/compile/component-candidates.ts +56 -4
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +1 -1
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/rules-composition.ts +2 -1
- package/src/compile/layout-lint/rules-table.ts +4 -19
- package/src/compile/look-page.ts +551 -0
- package/src/compile/look.ts +376 -0
- package/src/compile/page-composition.ts +382 -46
- package/src/compile/page-hierarchy.ts +131 -0
- package/src/compile/page-pipeline-look.ts +156 -0
- package/src/compile/page-pipeline.ts +200 -0
- package/src/compile/parse.ts +12 -11
- package/src/compile/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +645 -28
- package/src/compile/styles.ts +226 -26
- package/src/compile/types.ts +62 -5
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +49 -22
- package/src/data/anchor-nav.ts +73 -15
- package/src/data/approval-flow.ts +210 -124
- package/src/data/assignment-picker.ts +163 -85
- package/src/data/async-result-panel.ts +110 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +141 -19
- package/src/data/calendar.ts +434 -96
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +72 -38
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +904 -77
- package/src/data/checklist.ts +78 -35
- package/src/data/code-view.ts +106 -48
- package/src/data/comment-thread.ts +607 -87
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +198 -30
- package/src/data/context-menu.ts +95 -21
- package/src/data/d9-limits.ts +2 -0
- package/src/data/d9-util.ts +13 -5
- package/src/data/diff.ts +107 -50
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +33 -17
- package/src/data/embed.ts +142 -7
- package/src/data/engine-ports.ts +13 -4
- package/src/data/field-mapper.ts +104 -48
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +603 -142
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +85 -27
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +637 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +38 -15
- package/src/data/image-viewer.ts +261 -62
- package/src/data/index.ts +63 -1
- package/src/data/item-list.ts +217 -57
- package/src/data/json-view.ts +165 -100
- package/src/data/kanban.ts +339 -87
- package/src/data/kit-contract.ts +230 -0
- package/src/data/leaderboard.ts +343 -0
- package/src/data/level-class.ts +21 -0
- package/src/data/log-stream.ts +347 -0
- package/src/data/markdown-view.ts +155 -45
- package/src/data/matrix.ts +217 -112
- package/src/data/media-grid.ts +162 -38
- package/src/data/mega-menu.ts +39 -23
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +50 -15
- package/src/data/menu.ts +131 -47
- package/src/data/mockup.ts +30 -22
- package/src/data/modal-dialog.ts +90 -13
- package/src/data/navbar.ts +143 -61
- package/src/data/notice-list.ts +100 -48
- package/src/data/notify-renderer.ts +61 -7
- package/src/data/object-form.ts +1389 -130
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +122 -42
- package/src/data/panel-head.ts +237 -75
- package/src/data/permission-matrix.ts +371 -119
- package/src/data/permission-tree.ts +135 -80
- package/src/data/pricing-table.ts +106 -42
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +63 -31
- package/src/data/record-card.ts +239 -70
- package/src/data/record-picker.ts +56 -27
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +131 -41
- package/src/data/resident.ts +11 -1
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +206 -35
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +376 -102
- package/src/data/rule-builder.ts +129 -80
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +86 -43
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +438 -86
- package/src/data/static-lazy.ts +18 -0
- package/src/data/static-registry.ts +38 -2
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +63 -34
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +128 -47
- package/src/data/system-switcher.ts +40 -20
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +99 -31
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +110 -47
- package/src/data/transfer.ts +195 -47
- package/src/data/tree-table.ts +194 -112
- package/src/data/tree.ts +191 -70
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +242 -102
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +26 -4
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +1 -2
- package/src/frames/inherited-shell.ts +54 -13
- package/src/frames/page-bar.ts +205 -27
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +0 -2
- package/src/frames/shared.ts +64 -21
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +11 -7
- package/src/frames/split-frame/wiring.ts +14 -10
- package/src/frames/tabs-frame/shell.ts +3 -2
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +2 -0
- package/src/frames/workspace-frame/extras.ts +5 -3
- package/src/frames/workspace-frame/index.ts +1 -1
- package/src/frames/workspace-frame/pipeline-key.ts +6 -0
- package/src/frames/workspace-frame/shell.ts +22 -2
- package/src/frames/workspace-frame/state.ts +42 -14
- package/src/frames/workspace-frame/view.ts +697 -167
- package/src/generated/kit-grammar-runtime.ts +1015 -53
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +96 -3
- package/src/object-renderer/action-group.ts +175 -23
- package/src/object-renderer/action-more.ts +48 -17
- package/src/object-renderer/arrange.ts +241 -29
- package/src/object-renderer/category-tone.ts +96 -0
- package/src/object-renderer/collapse-wiring.ts +19 -9
- package/src/object-renderer/collection-expand.ts +3 -3
- package/src/object-renderer/collection-parts.ts +432 -107
- package/src/object-renderer/collection-table.ts +347 -45
- package/src/object-renderer/collection.ts +291 -62
- package/src/object-renderer/compile-data.ts +12 -2
- package/src/object-renderer/defaults.ts +6 -5
- package/src/object-renderer/emit-events.ts +45 -19
- package/src/object-renderer/emit-object.ts +35 -9
- package/src/object-renderer/emit-static.ts +734 -159
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +105 -18
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +18 -2
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +44 -2
- package/src/object-renderer/pick-component.ts +8 -2
- package/src/object-renderer/pipeline-mode.ts +6 -0
- package/src/object-renderer/relation-field.ts +79 -0
- package/src/object-renderer/render-object.ts +71 -26
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +424 -103
- package/src/object-renderer/table-gap.ts +2 -1
- package/src/object-renderer/table-reorder.ts +237 -0
- package/src/object-renderer/table-summary.ts +26 -12
- package/src/object-renderer/table-tools.ts +428 -128
- package/src/object-renderer/types.ts +91 -2
- package/src/object-renderer/value-present.ts +49 -0
- package/src/page-target/ai-surface.ts +15 -22
- package/src/page-target/compile.ts +5 -6
- package/src/page-target/drift.ts +0 -7
- package/src/page-target/intent-schema.ts +46 -43
- package/src/page-target/target.ts +4 -5
- package/src/page-target/writer-policy.ts +4 -5
- package/src/recipes/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +15 -14
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +3 -2
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +76 -19
- package/src/recipes/control.ts +64 -5
- package/src/recipes/desc-list.ts +101 -7
- package/src/recipes/divider.ts +30 -9
- package/src/recipes/emphasis.ts +90 -5
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +3 -2
- package/src/recipes/index.ts +28 -4
- package/src/recipes/inherited-shell.ts +21 -15
- package/src/recipes/json-view.ts +6 -5
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +16 -6
- package/src/recipes/overlay.ts +47 -19
- package/src/recipes/page-width.ts +31 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +37 -19
- package/src/recipes/rail-grid.ts +6 -3
- package/src/recipes/self-owned.ts +59 -0
- package/src/recipes/slot-align.ts +5 -3
- package/src/recipes/stat-state.ts +5 -5
- package/src/recipes/state.ts +54 -3
- package/src/recipes/status.ts +14 -14
- package/src/recipes/strip.ts +47 -5
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +33 -4
- package/src/recipes/table-gap.ts +3 -2
- package/src/recipes/table-native-edit.ts +22 -9
- package/src/recipes/table-row.ts +45 -12
- package/src/recipes/tabs.ts +54 -22
- package/src/recipes/text-diff.ts +15 -8
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +68 -3
- package/src/shared/action-func.ts +106 -0
- package/src/shared/color-scheme.ts +127 -0
- package/src/shared/confirm-decl.ts +5 -2
- package/src/shared/danger-facts.ts +55 -0
- package/src/shared/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +58 -12
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/icons.ts +28 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- package/src/shared/order-value.ts +15 -0
- package/src/shared/page-attrs-runtime.ts +327 -0
- package/src/shared/page-attrs.ts +262 -0
- package/src/shared/pipeline-mode.ts +64 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +165 -24
- package/src/shared/theme-usage.ts +16 -0
- package/src/shared/value-table-contract.ts +68 -0
- package/src/spatial/action-func.ts +4 -0
- package/src/spatial/declared-actions.ts +116 -0
- package/src/spatial/emit.ts +660 -0
- package/src/spatial/expand.ts +1482 -0
- package/src/spatial/field-types.ts +48 -0
- package/src/spatial/index.ts +82 -0
- package/src/spatial/layout.ts +697 -0
- package/src/spatial/look-apply.ts +206 -0
- package/src/spatial/page-decl.ts +44 -0
- package/src/spatial/page-object.ts +349 -0
- package/src/spatial/recognize.ts +491 -0
- package/src/spatial/self-report.ts +571 -0
- package/src/spatial/shape.ts +205 -0
- package/src/spatial/spatial-map.ts +136 -0
- package/src/spatial/tone.ts +145 -0
- package/src/theme/index.ts +11 -2
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +527 -16
- package/src/theme/kit-theme.tpl +491 -16
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +522 -185
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +3 -2
- package/src/theme/theme-tokens.ts +1601 -93
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/frames/list-summary.ts +0 -123
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { esc } from '../../shared/escape';
|
|
2
2
|
// StandardCrud 的 HTML 代码壳:只有结构和 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
3
|
-
// 层次基准取规格 7.2:第 2 层分区容器 `bg-surface-raised rounded-
|
|
3
|
+
// 层次基准取规格 7.2:第 2 层分区容器 `bg-surface-raised rounded-card border border-border-subtle`。
|
|
4
4
|
// 显隐层统一用 `fixed inset-0` 的遮罩 + 内层 flex 容器:显隐只靠 core 写 `hidden` 属性,不在遮罩自身叠 display 类。
|
|
5
5
|
|
|
6
6
|
import { mergeClass } from '../../shared/merge-class';
|
|
7
|
-
import { KIT_LIST_BAR_FLAT_CLASS } from '../../recipes/container';
|
|
7
|
+
import { KIT_FACE_HEAD_CLASS, KIT_LIST_BAR_FLAT_CLASS } from '../../recipes/container';
|
|
8
|
+
import { KIT_PAGE_WIDE_WIDTH_CLASS } from '../../recipes/page-width';
|
|
8
9
|
import { kitSurfaceRecipe } from '../../recipes/surface';
|
|
9
10
|
import { KIT_FILTER_TOOLBAR_MARK } from '../../object-renderer/filter-toolbar';
|
|
10
11
|
import { KIT_STRIP_FOOT_CLASS } from '../../recipes/strip';
|
|
11
|
-
import { KIT_DIVIDER_FOOT_CLASS } from '../../recipes/divider';
|
|
12
|
-
import { KIT_LIST_PANEL_CLASS,
|
|
12
|
+
import { KIT_DIVIDER_FOOT_CLASS, KIT_DIVIDER_HEAD_CLASS } from '../../recipes/divider';
|
|
13
|
+
import { KIT_LIST_PANEL_CLASS, listPanelParts, splitTitleRow, stripEmptyHeadLevel } from '../shared/compile-helpers';
|
|
14
|
+
import { kitFilterStripAnchor, kitNeutralClass, kitObjectAnchor } from '../shared/pipeline';
|
|
15
|
+
import { kitSelfAttrs } from '../../shared/page-attrs-runtime';
|
|
16
|
+
import { KIT_ATTR_AXIS, KIT_ATTR_EMPHASIS, KIT_ATTR_ROLE } from '../../shared/dom-attrs';
|
|
13
17
|
import { OVERLAY_SHELL_CLASS, classAttr, closeButtonHtml, dialogHtml, dialogIds, dialogTitles, overlayHtml, overlayIds } from '../shared/overlay-shell';
|
|
14
18
|
|
|
15
19
|
// 弹窗外壳与附加浮层壳的公共部分已下沉到 biz/shared/overlay-shell(主从工作台同用);这里原样 re-export,保持原导出名可用
|
|
@@ -19,22 +23,37 @@ export { closeButtonHtml, dialogHtml, dialogIds, dialogTitles, overlayHtml, over
|
|
|
19
23
|
export const STANDARD_CRUD_AREAS = ['root', 'filter', 'list', 'dialog', 'drawer'] as const;
|
|
20
24
|
export type StandardCrudArea = (typeof STANDARD_CRUD_AREAS)[number];
|
|
21
25
|
|
|
26
|
+
/** 整页表单视图打开时让位的列表区(显隐外层的内层,与根同一条纵向节奏,沿视口舞台撑满) */
|
|
27
|
+
export const CRUD_BROWSE_CLASS = 'flex flex-1 flex-col gap-region';
|
|
28
|
+
|
|
29
|
+
/** 窄列(≤4 列、无长文本)StandardCrud 在非限宽框(如 tabs-frame)中的内容收束(与 wide 版心 960px 同源,工具条与表宽同步收束并水平居中) */
|
|
30
|
+
export const CRUD_NARROW_ROOT_CLASS = `mx-auto w-full ${KIT_PAGE_WIDE_WIDTH_CLASS}`;
|
|
31
|
+
|
|
22
32
|
export const CRUD_CLASS = {
|
|
23
|
-
root: 'flex flex-col gap-region',
|
|
33
|
+
root: 'flex flex-1 flex-col gap-region',
|
|
24
34
|
/** 筛选带(列表为空 / 无集合时单独出现):自带圆角的下沉带,与列表工作面里的筛选带同一份类(不再是独立卡) */
|
|
25
35
|
filter: KIT_LIST_BAR_FLAT_CLASS,
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
/**
|
|
37
|
+
* 筛选条(搜索 + 分段 / 下拉工具条,或复杂筛选字段):对象面里的头部节——贴面顶、内边距同对齐轴(p-card),与表头带之间一条贯通淡线
|
|
38
|
+
* (节 = 贯通淡线,推荐方案 §1 L3 / §3 表格页)。2026-11-25 找回丢失:一个对象的标题、工具条、内容、底栏都在自己的面里(总纲硬规则 1),
|
|
39
|
+
* 此前「筛选工具条在画布上、不进白色工作面」作废。块级(表单宿主是容器查询根,在 flex 行里会塌成 0 宽,所以这里不是 flex)
|
|
40
|
+
*/
|
|
41
|
+
// 面头 = 淡带 + 下线(§11.17 成套对齐):底色取面头配方 KIT_FACE_HEAD_CLASS(表头带同一表面)
|
|
42
|
+
// filterFace 与 toolbar 同为块级(min-w-0,不写 flex flex-col):新流水线下带 data-kit-flow="filter" 时由取值表主导水平弹性流与子项伸展,
|
|
43
|
+
// 避免 flex-col 把 [data-kit-flow="filter"] 的 align-items:flex-end 翻成水平右挤并压塌内层 @container 子条带;主题关闭时自然块级占满全宽
|
|
44
|
+
toolbar: `min-w-0 p-card ${KIT_FACE_HEAD_CLASS} ${KIT_DIVIDER_HEAD_CLASS}`,
|
|
45
|
+
filterFace: `min-w-0 p-card ${KIT_FACE_HEAD_CLASS} ${KIT_DIVIDER_HEAD_CLASS}`,
|
|
46
|
+
/**
|
|
47
|
+
* 列表工作面:唯一主体 = 页面上唯一一张工作面(白色面落在统一画布上,与别的页型的卡同一种边缘处理);面本身不带内边距,文字落在对齐轴上,筛选带贴顶通栏。
|
|
48
|
+
* 不加 flex-1:工作面自然贴合筛选条 + 数据行 + 分页底栏的固有高度,避免 6 行短表(如 /ai/assistant)被强行撑满视口而在末行与「共 N 条」之间拉出 ~320px 空白洞;
|
|
49
|
+
* 0 行空态由 KitCollectionState 自带 min-h-60 py-12 保持舒适留白与居中,长表按文档流自然展开无嵌套双滚动条。
|
|
50
|
+
*/
|
|
31
51
|
// overflow-clip:表头带 / 底栏带的四角随面的圆角裁切(clip 不建滚动容器,底栏的 sticky 仍相对页面滚动);面内段与段贴合(表头带 / 数据行 / 底栏),不留 gap
|
|
52
|
+
// 外壳里外一个样:外壳内容区是画布,列表工作面是画布上的白面(KT-B10 计层口径 2026-11-25;「套面板与装卡二选一」作废)
|
|
32
53
|
list: mergeClass('flex flex-col overflow-clip', kitSurfaceRecipe('panel')),
|
|
33
54
|
listHeadRow: KIT_LIST_PANEL_CLASS.listHeadRow,
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
// 一处分隔只用一种手段(边框普查 B05 / 公开规范摘要 M19):已有分隔线就不再另铺浅带(此前浅带 + 线 = 面差与线叠加)
|
|
37
|
-
pager: `sticky bottom-0 z-10 ${KIT_STRIP_FOOT_CLASS} ${KIT_DIVIDER_FOOT_CLASS} bg-surface px-card`,
|
|
55
|
+
/** 分页条:自然紧贴表体底缘(list 按内容定高时 mt-auto 归零,若外层经 areaClass.list 显式设定最小高度则仍自动锚定底缘);底色同工作面、轴内边距取 px-card */
|
|
56
|
+
pager: `mt-auto ${KIT_STRIP_FOOT_CLASS} ${KIT_DIVIDER_FOOT_CLASS} bg-surface px-card`,
|
|
38
57
|
...OVERLAY_SHELL_CLASS,
|
|
39
58
|
} as const;
|
|
40
59
|
|
|
@@ -64,19 +83,60 @@ export function coordinatorId(object: string): string {
|
|
|
64
83
|
}
|
|
65
84
|
|
|
66
85
|
/** 主区:筛选卡 + 列表卡(工具栏在列表卡里,排在列表之前)。区域类按 7.3 同族规则覆写。拆分规则与主从 / 分类壳共用 shared/compile-helpers#listPanelParts */
|
|
67
|
-
export function mainHtml(parts: { filter: string; toolbar: string; list: string; summary?: string }, areaClass: Record<string, string
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
export function mainHtml(parts: { filter: string; toolbar: string; list: string; summary?: string }, areaClass: Record<string, string>, next?: { readonly object: string }): string {
|
|
87
|
+
if (next !== undefined) return mainHtmlNext(parts, areaClass, next.object);
|
|
88
|
+
// 区域主动作留在对象面里(2026-11-25 页面构成:画布上不放控件,页级动作并进它作用的对象的工具行):
|
|
89
|
+
// 没有列表标题时并入筛选条同一行靠右,有列表标题时在标题行右端(listPanelParts 的既有拆分规则),不再搬进页头
|
|
90
|
+
const { filterInner, listInner } = listPanelParts(parts);
|
|
70
91
|
if (listInner === '') return parts.filter === '' ? '' : `<div${cls(mergeClass(CRUD_CLASS.filter, areaClass.filter))}>${filterInner}</div>`;
|
|
71
92
|
// 页面构成(C2 唯一主体 = 页面本身):列表就是页面——不再包一张卡(container: plain、强调 primary),页面底取面板面(data-kit-canvas-hint,页面编译写 data-kit-canvas);
|
|
72
93
|
// 筛选带是自带圆角的下沉带,区域主动作打搬运标记由页面编译搬进页头尾端(页头一行 = 标题 + 主动作)
|
|
73
94
|
// 用 div 而不是 section:section 会被主题当容器画外框(描边 / 圆角 / 阴影),而本工作面是无容器的页面本体
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
const hoisted = hoistedToolbarHtml(parts.toolbar);
|
|
95
|
+
// 对象面(2026-11-25 找回丢失):筛选条 / 复杂筛选、表头浅带、数据行、底栏分页都在同一张面里,筛选条是面顶的一节(下缘贯通淡线);
|
|
96
|
+
const hoisted = '';
|
|
77
97
|
const toolbar = filterInner.includes(KIT_FILTER_TOOLBAR_MARK);
|
|
78
|
-
const
|
|
79
|
-
|
|
98
|
+
const standaloneToolbar = filterInner === '' && parts.toolbar !== '' && listInner.startsWith(parts.toolbar);
|
|
99
|
+
const effectiveListInner = standaloneToolbar ? listInner.slice(parts.toolbar.length).replace(/^\n/, '') : listInner;
|
|
100
|
+
// 有列表标题行(data-kit-title-row,标题 + 工具)时,标题行是面的门牌、排在最前,筛选条紧随其后;
|
|
101
|
+
// 无标题、仅有「清除筛选」meta 宿主时,已由 listPanelParts 并入筛选列同行(位于工具栏之前,不把右侧「+ 新增」向左推);
|
|
102
|
+
// 无筛选、无标题、仅有工具栏动作时,工具栏单独落面头带(p-card + 淡底 + 贯通淡线),避免按钮贴顶贴表头 0px 紧挨
|
|
103
|
+
const [titleRow, body] = splitTitleRow(effectiveListInner);
|
|
104
|
+
const bar = filterInner !== ''
|
|
105
|
+
? `<div${cls(toolbar ? mergeClass(CRUD_CLASS.toolbar, areaClass.filter) : mergeClass(CRUD_CLASS.filterFace, areaClass.filter))}>${filterInner}</div>`
|
|
106
|
+
: standaloneToolbar
|
|
107
|
+
? `<div${cls(mergeClass(CRUD_CLASS.toolbar, areaClass.filter))}>${parts.toolbar}</div>`
|
|
108
|
+
: '';
|
|
109
|
+
return `<div ${KIT_ATTR_EMPHASIS}="primary" ${KIT_ATTR_ROLE}="subject" ${KIT_ATTR_AXIS}=""${cls(mergeClass(CRUD_CLASS.list, areaClass.list))}>${parts.summary ?? ''}${hoisted}${titleRow}${bar}${body}</div>`;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 新模式(主题流水线 next)的主区:结构与旧版相同(筛选条在面顶、标题行最前),但
|
|
114
|
+
* - 列表工作面是对象 entity 的容器:补对象锚点,不写强调级 / 构成角色,类只留结构类(面的框、底、阴影由取值表按层级角色给);
|
|
115
|
+
* - 筛选与工具条同一行时是组件树上的筛选工具条带:补条带锚点,层级角色由布局写;
|
|
116
|
+
* - 只有筛选(没有工具条动作)时这一行不在组件树上,自报层级角色「淡底带」。
|
|
117
|
+
*/
|
|
118
|
+
function mainHtmlNext(parts: { filter: string; toolbar: string; list: string; summary?: string }, areaClass: Record<string, string>, object: string): string {
|
|
119
|
+
const { filterInner, listInner, toolbarInFilter } = listPanelParts(parts);
|
|
120
|
+
if (listInner === '') {
|
|
121
|
+
if (filterInner === '') return '';
|
|
122
|
+
// 只有筛选无工具栏时由外层声明 band,内层 KitObjectForm 经 hostedInBand 自动跳过重复 band(消除双层 band 断尾线,同时守住静态 HTML band 语义)
|
|
123
|
+
const mark = toolbarInFilter ? ` data-soma-id="${esc(kitFilterStripAnchor(object))}"` : kitSelfAttrs({ level: 'band' });
|
|
124
|
+
return `<div${mark}${cls(kitNeutralClass(mergeClass(CRUD_CLASS.filter, areaClass.filter)))}>${filterInner}</div>`;
|
|
125
|
+
}
|
|
126
|
+
const compactFilter = filterInner.includes(KIT_FILTER_TOOLBAR_MARK);
|
|
127
|
+
const baseCls = compactFilter ? CRUD_CLASS.toolbar : CRUD_CLASS.filterFace;
|
|
128
|
+
const standaloneToolbar = filterInner === '' && parts.toolbar !== '' && listInner.startsWith(parts.toolbar);
|
|
129
|
+
const effectiveListInner = standaloneToolbar ? listInner.slice(parts.toolbar.length).replace(/^\n/, '') : listInner;
|
|
130
|
+
const [rawTitleRow, body] = splitTitleRow(effectiveListInner);
|
|
131
|
+
const titleRow = stripEmptyHeadLevel(rawTitleRow);
|
|
132
|
+
const bar = filterInner !== ''
|
|
133
|
+
? toolbarInFilter
|
|
134
|
+
? `<div data-soma-id="${esc(kitFilterStripAnchor(object))}"${cls(kitNeutralClass(mergeClass(baseCls, areaClass.filter)))}>${filterInner}</div>`
|
|
135
|
+
: `<div${kitSelfAttrs({ level: 'band' })}${cls(kitNeutralClass(mergeClass(baseCls, areaClass.filter)))}>${filterInner}</div>`
|
|
136
|
+
: standaloneToolbar
|
|
137
|
+
? `<div${kitSelfAttrs({ level: 'head' })}${cls(kitNeutralClass(mergeClass(CRUD_CLASS.toolbar, areaClass.filter)))}>${parts.toolbar}</div>`
|
|
138
|
+
: '';
|
|
139
|
+
return `<div data-soma-id="${esc(kitObjectAnchor(object))}" ${KIT_ATTR_AXIS}=""${cls(kitNeutralClass(mergeClass(CRUD_CLASS.list, areaClass.list)))}>${parts.summary ?? ''}${titleRow}${bar}${body}</div>`;
|
|
80
140
|
}
|
|
81
141
|
|
|
82
142
|
export function rootHtml(object: string, children: string[], areaClass: Record<string, string>, extra: string | undefined): string {
|
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
// StandardCrud
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
import { esc } from '../../shared/escape';
|
|
5
|
-
import type { KitListSummaryField } from '../../frames/list-summary';
|
|
6
|
-
import { KIT_HOIST_ATTR, KIT_HOIST_HEADER_SUMMARY } from '../shared/compile-helpers';
|
|
7
|
-
|
|
8
|
-
type Rec = Record<string, unknown>;
|
|
9
|
-
|
|
10
|
-
function isRec(v: unknown): v is Rec {
|
|
11
|
-
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** 筛选区里的枚举字段(按筛选字段序):字段声明了 options({ value, label })才算;没有枚举字段 → 空数组(页头不给概况)。 */
|
|
15
|
-
export function listSummaryFields(entity: { schema: unknown; view?: unknown }): KitListSummaryField[] {
|
|
16
|
-
const view = isRec(entity.view) ? entity.view : undefined;
|
|
17
|
-
const filter = view !== undefined && isRec(view.filter) ? view.filter : undefined;
|
|
18
|
-
const names = Array.isArray(filter?.fields)
|
|
19
|
-
? (filter.fields as unknown[]).map((f) => (typeof f === 'string' ? f : isRec(f) ? Object.keys(f)[0] : undefined)).filter((n): n is string => n !== undefined)
|
|
20
|
-
: [];
|
|
21
|
-
const schema = isRec(entity.schema) ? entity.schema : {};
|
|
22
|
-
const out: KitListSummaryField[] = [];
|
|
23
|
-
for (const field of names) {
|
|
24
|
-
const decl = schema[field];
|
|
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'
|
|
27
|
-
? [{ value: o.value, label: typeof o.label === 'string' ? o.label : o.value, ...(typeof o.tone === 'string' ? { tone: o.tone } : {}) }]
|
|
28
|
-
: []));
|
|
29
|
-
if (options.length > 0) out.push({ field, options });
|
|
30
|
-
}
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
1
|
+
// StandardCrud 筛选工具条分段计数的取值路径:facets 与列表响应的总数同级(接口不给就不显示计数)。
|
|
2
|
+
// 页头概况行(KitListSummary)已删除(IA29 第一批,一事实一处 X1):总数只在表尾 / 标题旁,分面计数只在分段标签上。
|
|
33
3
|
|
|
34
4
|
/** 列表响应总数路径的同级 facets 路径(`a.b.total` → `a.b.facets`)。 */
|
|
35
5
|
export function facetsPathOf(totalPath: string): string {
|
|
36
6
|
return totalPath.includes('.') ? totalPath.replace(/\.[^.]+$/, '.facets') : 'facets';
|
|
37
7
|
}
|
|
38
|
-
|
|
39
|
-
/** 概况行的搬运块(标记 + 宿主);调用方保证宿主 id 与 show 条目已登记。 */
|
|
40
|
-
export function listSummaryHoist(hostHtml: string): string {
|
|
41
|
-
return `<div ${KIT_HOIST_ATTR}="${esc(KIT_HOIST_HEADER_SUMMARY)}" class="contents">${hostHtml}</div>`;
|
|
42
|
-
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// 已知边界:跨步的条件规则(rules 引用别步字段)校验不到——每步字典只含本步字段,末步合并提交时 core 按并集字典再校验,条件规则上下文仍只含本次 model。
|
|
13
13
|
// 规则写死:steps 至少 1 步;字段名在各步之间不得重名;每步至少有一个可编辑字段(permission w / create)。
|
|
14
14
|
|
|
15
|
+
import { isNextPipeline } from '../shared/pipeline';
|
|
15
16
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
16
17
|
import { KIT_VIEW_FORM_KEYS, KIT_VIEW_SLOTS } from '../../object-renderer/defaults';
|
|
17
18
|
import { emitObject } from '../../object-renderer/emit-object';
|
|
@@ -20,6 +21,7 @@ import type { KitDiagnostic, KitFieldSchema, KitObject, KitViewForm } from '../.
|
|
|
20
21
|
import type { KitFragment } from '../../object-renderer/fragment';
|
|
21
22
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
22
23
|
import { kitText } from '../../i18n/kit-text';
|
|
24
|
+
import { kitActionButtonVariant } from '../../base/button';
|
|
23
25
|
import {
|
|
24
26
|
bizObjectName, checkRoleAllowedViews, finishBizCompile, validateBizAreaClass,
|
|
25
27
|
} from '../shared/compile-helpers';
|
|
@@ -243,13 +245,16 @@ export function compileStepForm(input: KitBizInput, ctx: KitBizContext): KitFrag
|
|
|
243
245
|
scope: `${s.object}__form`,
|
|
244
246
|
submitLabel: typeof given === 'string' && given !== '' ? given : kitText(last ? 'soma.kit.submit' : 'soma.kit.next_step', undefined, ctx.locale),
|
|
245
247
|
resetLabel: '',
|
|
248
|
+
// 提交 / 保存在途:提交钮转圈置灰;服务端字段错误回显到本步对应字段(hub 写 focus.busy / focus.errors,镜像进来)
|
|
249
|
+
busy: mirrorPath(link, KIT_STEP_MIRRORS.busy.key),
|
|
250
|
+
fieldErrors: mirrorPath(link, KIT_STEP_MIRRORS.errs(i).key),
|
|
246
251
|
...(i > 0 ? { cancelLabel: kitText('soma.kit.prev_step', undefined, ctx.locale) } : {}),
|
|
247
252
|
});
|
|
248
253
|
out.events[`${formId}.submit`] = semanticPipe(link, KIT_STEP_EVENTS.next);
|
|
249
254
|
if (i > 0) out.events[`${formId}.cancel`] = semanticPipe(link, KIT_STEP_EVENTS.prev);
|
|
250
255
|
// abandon: delete:每步多一个「取消」,放弃并(已保存过时)二次确认后删掉半成品
|
|
251
256
|
if (abandonDelete) {
|
|
252
|
-
out.show[ids.abort(i)] = { props: { label: kitText('soma.kit.cancel', undefined, ctx.locale), variant: '
|
|
257
|
+
out.show[ids.abort(i)] = { props: { label: kitText('soma.kit.cancel', undefined, ctx.locale), variant: kitActionButtonVariant('cancel', { region: 'step' }) } };
|
|
253
258
|
out.events[`${ids.abort(i)}.click`] = semanticPipe(link, KIT_STEP_EVENTS.abort);
|
|
254
259
|
}
|
|
255
260
|
});
|
|
@@ -280,7 +285,10 @@ export function compileStepForm(input: KitBizInput, ctx: KitBizContext): KitFrag
|
|
|
280
285
|
}
|
|
281
286
|
const v = KIT_STEP_MIRRORS.values(i);
|
|
282
287
|
mirrors.push({ key: v.key, slice: 'focus', path: v.path, as: v.as });
|
|
288
|
+
const e = KIT_STEP_MIRRORS.errs(i);
|
|
289
|
+
mirrors.push({ key: e.key, slice: 'focus', path: e.path, as: e.as });
|
|
283
290
|
}
|
|
291
|
+
mirrors.push({ key: KIT_STEP_MIRRORS.busy.key, slice: 'focus', path: KIT_STEP_MIRRORS.busy.path, as: KIT_STEP_MIRRORS.busy.as });
|
|
284
292
|
out.scopes[link] = {
|
|
285
293
|
id: link,
|
|
286
294
|
object: steps[0]!.object,
|
|
@@ -296,7 +304,7 @@ export function compileStepForm(input: KitBizInput, ctx: KitBizContext): KitFrag
|
|
|
296
304
|
out.show[ids.step(i, 'fut')] = { when: mirrorPath(link, KIT_STEP_MIRRORS.fut(i).key) };
|
|
297
305
|
});
|
|
298
306
|
out.show[ids.done] = { when: mirrorPath(link, KIT_STEP_MIRRORS.done.key) };
|
|
299
|
-
out.show[ids.restart] = { props: { label: kitText('soma.kit.sf_restart', undefined, ctx.locale), variant: '
|
|
307
|
+
out.show[ids.restart] = { props: { label: kitText('soma.kit.sf_restart', undefined, ctx.locale), variant: kitActionButtonVariant('reset', { region: 'step' }) } };
|
|
300
308
|
out.events[`${ids.restart}.click`] = semanticPipe(link, KIT_STEP_EVENTS.restart);
|
|
301
309
|
out.show[ids.hub] = {
|
|
302
310
|
props: {
|
|
@@ -315,9 +323,10 @@ export function compileStepForm(input: KitBizInput, ctx: KitBizContext): KitFrag
|
|
|
315
323
|
ids,
|
|
316
324
|
{
|
|
317
325
|
title: '',
|
|
318
|
-
steps: steps.map((s) => ({ title: s.title, form: formHtml[s.object] ?? '' })),
|
|
326
|
+
steps: steps.map((s) => ({ title: s.title, form: formHtml[s.object] ?? '', ...(isNextPipeline(ctx) ? { object: s.object } : {}) })),
|
|
319
327
|
doneTitle,
|
|
320
328
|
withAbort: abandonDelete,
|
|
329
|
+
...(isNextPipeline(ctx) ? { next: { target: targetName } } : {}),
|
|
321
330
|
},
|
|
322
331
|
areaClass,
|
|
323
332
|
input.class,
|
package/src/biz/step-form/hub.ts
CHANGED
|
@@ -52,6 +52,8 @@ export interface KitStepFocus {
|
|
|
52
52
|
seq: number;
|
|
53
53
|
/** perStep:首步保存后取回的主键(final 模式恒无) */
|
|
54
54
|
rid?: string | number;
|
|
55
|
+
/** 服务端字段错误按步骤归位(s<i> -> { 字段: 消息 });只在提交 / 保存失败时有,任何前进、后退、重新开始都清掉 */
|
|
56
|
+
errors?: Record<string, Record<string, string>>;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/** 镜像键(compile 与测试共用) */
|
|
@@ -60,6 +62,10 @@ export const KIT_STEP_MIRRORS = {
|
|
|
60
62
|
past: (i: number): { key: string; path: string; as: 'truthy' } => ({ key: `step_past_${i}`, path: `past.s${i}`, as: 'truthy' }),
|
|
61
63
|
fut: (i: number): { key: string; path: string; as: 'truthy' } => ({ key: `step_fut_${i}`, path: `fut.s${i}`, as: 'truthy' }),
|
|
62
64
|
values: (i: number): { key: string; path: string; as: 'value' } => ({ key: `step_vals_${i}`, path: `values.s${i}`, as: 'value' }),
|
|
65
|
+
/** 第 i 步表单的服务端字段错误(表单的 fieldErrors 入参绑它) */
|
|
66
|
+
errs: (i: number): { key: string; path: string; as: 'value' } => ({ key: `step_errs_${i}`, path: `errors.s${i}`, as: 'value' }),
|
|
67
|
+
/** 提交 / 保存在途(各步表单的 busy 入参绑它:提交钮转圈置灰、aria-busy) */
|
|
68
|
+
busy: { key: 'step_busy', path: 'busy', as: 'truthy' } as const,
|
|
63
69
|
done: { key: 'step_done', path: 'done', as: 'truthy' } as const,
|
|
64
70
|
} as const;
|
|
65
71
|
|
|
@@ -78,6 +84,7 @@ export function stepFocus(
|
|
|
78
84
|
seq: number,
|
|
79
85
|
busy = false,
|
|
80
86
|
rid?: string | number,
|
|
87
|
+
errors?: Record<string, Record<string, string>>,
|
|
81
88
|
): KitStepFocus {
|
|
82
89
|
const at: Record<string, boolean> = {};
|
|
83
90
|
const past: Record<string, boolean> = {};
|
|
@@ -87,7 +94,24 @@ export function stepFocus(
|
|
|
87
94
|
past[`s${i}`] = done || i < step;
|
|
88
95
|
fut[`s${i}`] = !done && i > step;
|
|
89
96
|
}
|
|
90
|
-
return { step, total, done, busy, at, past, fut, values, seq, ...(rid !== undefined ? { rid } : {}) };
|
|
97
|
+
return { step, total, done, busy, at, past, fut, values, seq, ...(rid !== undefined ? { rid } : {}), ...(errors !== undefined ? { errors } : {}) };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** 服务端字段错误按所在步骤归位(fields[i] = 第 i 步的字段名);不属于任何步骤的字段不进(它们只进提示条) */
|
|
101
|
+
export function stepErrorsByStep(
|
|
102
|
+
fieldErrors: Readonly<Record<string, string>>,
|
|
103
|
+
fields: ReadonlyArray<readonly string[]>,
|
|
104
|
+
): Record<string, Record<string, string>> {
|
|
105
|
+
const out: Record<string, Record<string, string>> = {};
|
|
106
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
107
|
+
const own: Record<string, string> = {};
|
|
108
|
+
for (const f of fields[i] ?? []) {
|
|
109
|
+
const m = fieldErrors[f];
|
|
110
|
+
if (typeof m === 'string' && m !== '') own[f] = m;
|
|
111
|
+
}
|
|
112
|
+
if (Object.keys(own).length > 0) out[`s${i}`] = own;
|
|
113
|
+
}
|
|
114
|
+
return out;
|
|
91
115
|
}
|
|
92
116
|
|
|
93
117
|
/** 取主键:data[stepKey],包裹一层 data.data[stepKey] 也认(口径同读侧 fromWrap);只收非空字符串 / 有限数 */
|
|
@@ -210,6 +234,8 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
210
234
|
controllerFactory: createKitController((api) => {
|
|
211
235
|
let off: (() => void) | undefined;
|
|
212
236
|
let alive = false;
|
|
237
|
+
let asking = false;
|
|
238
|
+
let unmountAbort = new AbortController();
|
|
213
239
|
const props = (): Rec => api.props() as Rec;
|
|
214
240
|
const steps = (): string[] => strings(props().steps);
|
|
215
241
|
const dataPort = (): SomaDataPort | undefined => {
|
|
@@ -223,33 +249,63 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
223
249
|
if (svc && typeof svc.toast === 'function') svc.toast({ level, message });
|
|
224
250
|
};
|
|
225
251
|
|
|
252
|
+
const firstErrorForStep = (
|
|
253
|
+
errors: Readonly<Record<string, string>>,
|
|
254
|
+
byStep: Readonly<Record<string, Record<string, string>>>,
|
|
255
|
+
at: number,
|
|
256
|
+
): string | undefined => {
|
|
257
|
+
const own = at >= 0 ? byStep[`s${at}`] : undefined;
|
|
258
|
+
const fromStep = own !== undefined ? Object.values(own).find((m) => typeof m === 'string' && m !== '') : undefined;
|
|
259
|
+
return fromStep ?? Object.values(errors).find((m) => typeof m === 'string' && m !== '');
|
|
260
|
+
};
|
|
261
|
+
|
|
226
262
|
const submit = async (focus: KitStepFocus, port: SomaRegionPort, model: Record<string, unknown>): Promise<void> => {
|
|
227
263
|
const data = dataPort();
|
|
228
264
|
const slice = port.slice('focus');
|
|
229
265
|
if (!data || !slice) return;
|
|
230
266
|
slice.set({ ...focus, busy: true });
|
|
231
267
|
const object = typeof props().object === 'string' ? (props().object as string) : '';
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
268
|
+
let settled = false;
|
|
269
|
+
try {
|
|
270
|
+
const result = await data.submit(object, model, 'create');
|
|
271
|
+
if (!alive) return;
|
|
272
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
273
|
+
// 提交期间用户点了「重新开始」(seq 已变):过期的结果不再写回,免得把新一轮表单置成完成态
|
|
274
|
+
if (cur.seq !== focus.seq) { settled = true; return; }
|
|
275
|
+
if (result.ok) {
|
|
276
|
+
clearKitInlineError(api.host ?? null, 'step-form');
|
|
277
|
+
slice.set({ ...stepFocus(cur.step, cur.total, true, cur.values, cur.seq + 1) });
|
|
278
|
+
settled = true;
|
|
279
|
+
api.emit('saved', { result: result.data ?? {} });
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const errors = result.fieldErrors ?? {};
|
|
283
|
+
const rawFields = Array.isArray(props().fields) ? (props().fields as unknown[]) : [];
|
|
284
|
+
const fields = rawFields.map((f) => strings(f));
|
|
285
|
+
const byStep = stepErrorsByStep(errors, fields);
|
|
286
|
+
const at = stepOfFirstError(errors, fields);
|
|
287
|
+
const first = firstErrorForStep(errors, byStep, at);
|
|
288
|
+
const message = first ?? (result.message !== '' ? result.message : kitText('soma.kit.step_failed', undefined, api.host));
|
|
289
|
+
const back = at >= 0 ? at : cur.step;
|
|
290
|
+
// 字段错误回显到出错步的表单(经 step_errs_i 镜像进表单的 fieldErrors 入参);提示条照旧
|
|
291
|
+
slice.set(stepFocus(back, cur.total, false, cur.values, cur.seq + 1, false, undefined, byStep));
|
|
292
|
+
settled = true;
|
|
293
|
+
toast('danger', at >= 0 ? kitText('soma.kit.step_n_message', { n: at + 1, message }, api.host) : message);
|
|
294
|
+
if (back !== cur.step) api.emit('step_change', { step: back, total: cur.total });
|
|
295
|
+
} catch (err: unknown) {
|
|
296
|
+
if (!alive) return;
|
|
297
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
298
|
+
if (cur.seq !== focus.seq) { settled = true; return; }
|
|
299
|
+
const message = err instanceof Error && err.message !== '' ? err.message : kitText('soma.kit.step_failed', undefined, api.host);
|
|
300
|
+
slice.set(stepFocus(cur.step, cur.total, false, cur.values, cur.seq + 1, false, cur.rid));
|
|
301
|
+
settled = true;
|
|
302
|
+
toast('danger', message);
|
|
303
|
+
} finally {
|
|
304
|
+
if (alive && !settled) {
|
|
305
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
306
|
+
if (cur.seq === focus.seq && cur.busy) slice.set({ ...cur, busy: false });
|
|
307
|
+
}
|
|
242
308
|
}
|
|
243
|
-
const errors = result.fieldErrors ?? {};
|
|
244
|
-
const rawFields = Array.isArray(props().fields) ? (props().fields as unknown[]) : [];
|
|
245
|
-
const fields = rawFields.map((f) => strings(f));
|
|
246
|
-
const at = stepOfFirstError(errors, fields);
|
|
247
|
-
const first = Object.values(errors).find((m) => typeof m === 'string' && m !== '');
|
|
248
|
-
const message = first ?? (result.message !== '' ? result.message : kitText('soma.kit.step_failed', undefined, api.host));
|
|
249
|
-
const back = at >= 0 ? at : cur.step;
|
|
250
|
-
slice.set(stepFocus(back, cur.total, false, cur.values, cur.seq + 1));
|
|
251
|
-
toast('danger', at >= 0 ? kitText('soma.kit.step_n_message', { n: at + 1, message }, api.host) : message);
|
|
252
|
-
if (back !== cur.step) api.emit('step_change', { step: back, total: cur.total });
|
|
253
309
|
};
|
|
254
310
|
|
|
255
311
|
/** perStep:保存一步;成功才前进(末步即完成态),失败停在本步(fieldErrors 指向更早的步则退回那一步),rid 不清 */
|
|
@@ -265,36 +321,56 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
265
321
|
const object = steps()[job.idx] ?? '';
|
|
266
322
|
const rid = focus.rid;
|
|
267
323
|
slice.set({ ...focus, busy: true });
|
|
324
|
+
let settled = false;
|
|
268
325
|
const fail = (message: string, fieldErrors: Readonly<Record<string, string>> = {}): void => {
|
|
269
326
|
const cur = focusOf(slice.get(), steps().length);
|
|
270
327
|
const rawFields = Array.isArray(props().fields) ? (props().fields as unknown[]) : [];
|
|
271
|
-
const
|
|
272
|
-
const
|
|
328
|
+
const fields = rawFields.map((f) => strings(f));
|
|
329
|
+
const byStep = stepErrorsByStep(fieldErrors, fields);
|
|
330
|
+
const at = stepOfFirstError(fieldErrors, fields);
|
|
331
|
+
const first = firstErrorForStep(fieldErrors, byStep, at);
|
|
273
332
|
const text = first ?? (message !== '' ? message : kitText('soma.kit.step_failed', undefined, api.host));
|
|
274
333
|
const back = at >= 0 ? at : cur.step;
|
|
275
|
-
slice.set(stepFocus(back, cur.total, false, cur.values, cur.seq + 1, false, cur.rid));
|
|
334
|
+
slice.set(stepFocus(back, cur.total, false, cur.values, cur.seq + 1, false, cur.rid, byStep));
|
|
335
|
+
settled = true;
|
|
276
336
|
toast('danger', at >= 0 ? kitText('soma.kit.step_n_message', { n: at + 1, message: text }, api.host) : text);
|
|
277
337
|
if (back !== cur.step) api.emit('step_change', { step: back, total: cur.total });
|
|
278
338
|
};
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
339
|
+
try {
|
|
340
|
+
// 首步没有 rid 用 create,其余(含回到首步改后再下一步)用 update;update 必须带 rid
|
|
341
|
+
const creating = rid === undefined;
|
|
342
|
+
if (creating && job.idx !== 0) { fail(kitText('soma.kit.step_no_id', undefined, api.host)); return; }
|
|
343
|
+
const result = creating
|
|
344
|
+
? await data.submit(object, job.model, 'create')
|
|
345
|
+
: await data.submit(object, { ...job.model, [stepKey]: rid }, 'update', { identityField: stepKey });
|
|
346
|
+
if (!alive) return;
|
|
347
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
348
|
+
if (cur.seq !== focus.seq) { settled = true; return; } // 保存期间点了「重新开始」:过期回执不写回
|
|
349
|
+
if (!result.ok) { fail(result.message, result.fieldErrors ?? {}); return; }
|
|
350
|
+
const got = creating ? pickStepRid(result.data, stepKey) : rid;
|
|
351
|
+
if (got === undefined) { fail(kitText('soma.kit.step_no_id', undefined, api.host)); return; }
|
|
352
|
+
clearKitInlineError(api.host ?? null, 'step-form');
|
|
353
|
+
if (job.last) {
|
|
354
|
+
slice.set(stepFocus(cur.step, cur.total, true, cur.values, cur.seq + 1, false, got));
|
|
355
|
+
settled = true;
|
|
356
|
+
api.emit('saved', { result: result.data ?? {}, id: String(got) });
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
slice.set(stepFocus(job.idx + 1, cur.total, false, cur.values, cur.seq + 1, false, got));
|
|
360
|
+
settled = true;
|
|
361
|
+
api.emit('step_change', { step: job.idx + 1, total: cur.total });
|
|
362
|
+
} catch (err: unknown) {
|
|
363
|
+
if (!alive) return;
|
|
364
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
365
|
+
if (cur.seq !== focus.seq) { settled = true; return; }
|
|
366
|
+
const message = err instanceof Error && err.message !== '' ? err.message : kitText('soma.kit.step_failed', undefined, api.host);
|
|
367
|
+
fail(message);
|
|
368
|
+
} finally {
|
|
369
|
+
if (alive && !settled) {
|
|
370
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
371
|
+
if (cur.seq === focus.seq && cur.busy) slice.set({ ...cur, busy: false });
|
|
372
|
+
}
|
|
295
373
|
}
|
|
296
|
-
slice.set(stepFocus(job.idx + 1, cur.total, false, cur.values, cur.seq + 1, false, got));
|
|
297
|
-
api.emit('step_change', { step: job.idx + 1, total: cur.total });
|
|
298
374
|
};
|
|
299
375
|
|
|
300
376
|
/** abandon: delete:调首步对象已声明的 write.delete,主键取 focus.rid;失败照实 toast,返回是否删成 */
|
|
@@ -307,18 +383,48 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
307
383
|
return false;
|
|
308
384
|
}
|
|
309
385
|
slice.set({ ...focus, busy: true });
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
386
|
+
let ok = false;
|
|
387
|
+
try {
|
|
388
|
+
const result = await data.remove(first, { [stepKey]: focus.rid });
|
|
389
|
+
if (result.ok) {
|
|
390
|
+
ok = true;
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
if (alive) {
|
|
394
|
+
toast('danger', kitText('soma.kit.step_abandon_failed', { message: result.message !== '' ? result.message : kitText('soma.kit.step_failed', undefined, api.host) }, api.host));
|
|
395
|
+
}
|
|
396
|
+
return false;
|
|
397
|
+
} catch (err: unknown) {
|
|
398
|
+
if (alive) {
|
|
399
|
+
const message = err instanceof Error && err.message !== '' ? err.message : kitText('soma.kit.step_failed', undefined, api.host);
|
|
400
|
+
toast('danger', kitText('soma.kit.step_abandon_failed', { message }, api.host));
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
} finally {
|
|
404
|
+
if (!ok && alive) {
|
|
405
|
+
const cur = focusOf(slice.get(), steps().length);
|
|
406
|
+
if (cur.seq === focus.seq && cur.busy) slice.set({ ...cur, busy: false });
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
// 放弃半成品的确认:自绘对话框(异步,danger 色调);无 DOM 时视为同意;带重入锁与卸载中止信号
|
|
411
|
+
const askAbandon = (): Promise<boolean> => {
|
|
412
|
+
if (asking) return Promise.resolve(false);
|
|
413
|
+
asking = true;
|
|
414
|
+
return askKitConfirm({
|
|
415
|
+
message: kitText('soma.kit.step_abandon_confirm', undefined, api.host),
|
|
416
|
+
tone: 'danger',
|
|
417
|
+
at: api.host ?? null,
|
|
418
|
+
whenNoDom: true,
|
|
419
|
+
signal: unmountAbort.signal,
|
|
420
|
+
})
|
|
421
|
+
.catch(() => false)
|
|
422
|
+
.finally(() => { asking = false; });
|
|
314
423
|
};
|
|
315
|
-
// 放弃半成品的确认:自绘对话框(异步,danger 色调);无 DOM 时视为同意
|
|
316
|
-
const askAbandon = (): Promise<boolean> => askKitConfirm({
|
|
317
|
-
message: kitText('soma.kit.step_abandon_confirm', undefined, api.host), tone: 'danger', at: api.host ?? null, whenNoDom: true,
|
|
318
|
-
});
|
|
319
424
|
|
|
320
425
|
/** 中途点「取消」且已保存过:二次确认 -> 删半成品 -> 成功回到初始;失败停在原地(保留状态,可重试或继续填) */
|
|
321
426
|
const abandon = async (slice: NonNullable<ReturnType<SomaRegionPort['slice']>>, focus: KitStepFocus): Promise<void> => {
|
|
427
|
+
if (asking) return;
|
|
322
428
|
if (!(await askAbandon())) return;
|
|
323
429
|
if (!alive) return;
|
|
324
430
|
const ok = await deleteDraft(slice, focus);
|
|
@@ -326,6 +432,7 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
326
432
|
const cur = focusOf(slice.get(), steps().length);
|
|
327
433
|
if (cur.seq !== focus.seq) return; // 期间点了「重新开始」:过期回执不写回
|
|
328
434
|
if (!ok) { slice.set({ ...cur, busy: false }); return; }
|
|
435
|
+
clearKitInlineError(api.host ?? null, 'step-form');
|
|
329
436
|
slice.set(initialStepFocus(cur.total, cur.seq + 1));
|
|
330
437
|
toast('success', kitText('soma.kit.step_abandoned', undefined, api.host));
|
|
331
438
|
if (cur.step !== 0) api.emit('step_change', { step: 0, total: cur.total });
|
|
@@ -353,6 +460,7 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
353
460
|
// 先拦下,确认后删完再用地址跳转(与表单自己的离开提醒不叠:这里 stopImmediatePropagation)
|
|
354
461
|
event.preventDefault();
|
|
355
462
|
event.stopImmediatePropagation();
|
|
463
|
+
if (asking) return;
|
|
356
464
|
const href = a.href;
|
|
357
465
|
void askAbandon().then((agreed) => {
|
|
358
466
|
if (!agreed || !alive) return;
|
|
@@ -370,6 +478,8 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
370
478
|
return {
|
|
371
479
|
attach() {
|
|
372
480
|
alive = true;
|
|
481
|
+
asking = false;
|
|
482
|
+
unmountAbort = new AbortController();
|
|
373
483
|
const scope = typeof props().scope === 'string' ? (props().scope as string) : '';
|
|
374
484
|
const svc = (api.services as { region?: (id: string) => SomaRegionPort | null } | undefined)?.region;
|
|
375
485
|
const port = scope !== '' && typeof svc === 'function' ? svc(scope) : null;
|
|
@@ -383,6 +493,9 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
383
493
|
const now = focusOf(focus.get(), steps().length);
|
|
384
494
|
const perStep = props().saveMode === 'perStep';
|
|
385
495
|
const r = reduceStepHub(now, name, payload, steps(), perStep);
|
|
496
|
+
if (name === KIT_STEP_EVENTS.restart || (name === KIT_STEP_EVENTS.abort && r.abort !== 'delete' && r.focus !== now)) {
|
|
497
|
+
clearKitInlineError(api.host ?? null, 'step-form');
|
|
498
|
+
}
|
|
386
499
|
if (r.focus !== now) {
|
|
387
500
|
focus.set(r.focus);
|
|
388
501
|
if (r.focus.step !== now.step) api.emit('step_change', { step: r.focus.step, total: r.focus.total });
|
|
@@ -393,6 +506,8 @@ export function createKitStepHub(): SomaComponentDefinition {
|
|
|
393
506
|
});
|
|
394
507
|
return () => {
|
|
395
508
|
alive = false;
|
|
509
|
+
asking = false;
|
|
510
|
+
unmountAbort.abort();
|
|
396
511
|
offGuard?.();
|
|
397
512
|
offGuard = undefined;
|
|
398
513
|
if (off) off();
|