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
package/src/biz/link/hub.ts
CHANGED
|
@@ -10,9 +10,14 @@
|
|
|
10
10
|
// 页面给每个槽位各绑一条管道。
|
|
11
11
|
// 为什么走 SCOPE | semantic:行内组件写切片会被拒收(切片写者必须是页面直接声明的实例),这是唯一没有写者核对的通路。
|
|
12
12
|
|
|
13
|
-
import type { SomaComponentDefinition, SomaRegionPort } from 'soma-core';
|
|
13
|
+
import type { SomaComponentDefinition, SomaDataPort, SomaRegionPort } from 'soma-core';
|
|
14
14
|
import { createKitController } from '../../base/shared';
|
|
15
|
+
import { KIT_ATTR_PANE, KIT_ATTR_ROW, KIT_ATTR_SELECTED, kitAttrSel } from '../../shared/dom-attrs';
|
|
15
16
|
import { withKitViewTransition } from '../../base/view-transition';
|
|
17
|
+
import { askKitConfirm } from '../../data/confirm-dialog';
|
|
18
|
+
import { kitDiscardDraftsWithin, kitHasDirtyDraftWithin } from '../../data/form-draft-registry';
|
|
19
|
+
import { kitText } from '../../i18n/kit-text';
|
|
20
|
+
import { KIT_MS_BACK_ATTR, KIT_MS_ROOT_ATTR, KIT_MS_VIEW_DETAIL_ATTR, KIT_MS_VIEW_LIST_ATTR } from '../../recipes/container';
|
|
16
21
|
import { KIT_ACTION_SLOT_BASE, KIT_PICK_SLOT_MAX, actionSlotEmits, actionSlotEvent, emitActionSlot } from '../../base/action-slots';
|
|
17
22
|
|
|
18
23
|
export const KIT_LINK_EVENTS = {
|
|
@@ -113,17 +118,20 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
113
118
|
rows: { type: 'array', default: [], desc: '主列表的行数据(autoSelect 用)' },
|
|
114
119
|
afterRemove: { type: 'string', default: '', desc: "选中项从行里消失后的去向:'next' = 原位置的下一条(没有就上一条);空 = 首行" },
|
|
115
120
|
pageScopes: { type: 'array', default: [], desc: '选中项变化时要回第 1 页的作用域 id(它们 view 切片的 page 路径写者是本组件)' },
|
|
121
|
+
createScopes: { type: 'array', default: [], desc: '新建保存成功时(协调组件 focus.created 增加)除 pageScopes 外还要回第 1 页的作用域 id(主列表等,选中项变化时不回页;它们 view 切片的 page 路径写者也是本组件)' },
|
|
122
|
+
createObjects: { type: 'object', default: {}, desc: '新建保存成功回第 1 页后要发起第 1 页重取的映射(scopeId -> objectName);仅对原 view.page > 1 的作用域回页并重取' },
|
|
116
123
|
pickSlots: { type: 'number', default: 0, desc: '选中项变化时依次抛 picked_0 … picked_<n-1> 的个数(每个依赖对象的重取各绑一个槽位;0 = 只抛 picked)' },
|
|
117
124
|
watchFilters: { type: 'array', default: [], desc: '筛选条的作用域 id:它们的 filter 切片一变(每次提交 / 重置都算,值没变也算)就回第 1 页并上抛 picked,页面据此重取(MultiObjectBoard 的全局筛选)' },
|
|
118
125
|
},
|
|
119
126
|
emits: {
|
|
120
127
|
picked: { payload: { id: { type: 'string' }, item: { type: 'object' }, prefill: { type: 'object' } }, desc: '选中项变化(页面据此重取依赖对象)' },
|
|
121
128
|
...actionSlotEmits('picked', { id: { type: 'string' }, item: { type: 'object' }, prefill: { type: 'object' } }, '选中项变化的分发槽位(pickSlots 个):依赖多个对象要各自重取时,每个对象的重取各绑一个槽位', KIT_PICK_SLOT_MAX),
|
|
122
|
-
...actionSlotEmits(KIT_ACTION_SLOT_BASE.field, { value: { type: 'string' }, row: { type: 'object' } }, '摘要字段动作 / 工具栏具名动作:载荷带当前选中行(字段事件自己只有 { value }
|
|
129
|
+
...actionSlotEmits(KIT_ACTION_SLOT_BASE.field, { value: { type: 'string' }, row: { type: 'object' }, kit_key_field: { type: 'string' }, kit_slot: { type: 'number' } }, '摘要字段动作 / 工具栏具名动作:载荷带当前选中行(字段事件自己只有 { value })、本枢纽的主键字段名与槽位序号'),
|
|
123
130
|
},
|
|
124
|
-
|
|
131
|
+
// focus 只读:协调组件的 created 计数(新建保存成功)一变,依赖对象回第 1 页(与 StandardCrud 的分页器同一口径)
|
|
132
|
+
scope: { slices: ['selection', 'view', 'focus'] },
|
|
125
133
|
},
|
|
126
|
-
services: ['region'],
|
|
134
|
+
services: ['region', 'data'],
|
|
127
135
|
templateHtml: '<div data-soma-id="root" class="hidden"></div>',
|
|
128
136
|
controllerFactory: createKitController((api) => {
|
|
129
137
|
const props = (): Rec => api.props() as Rec;
|
|
@@ -143,6 +151,10 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
143
151
|
const svc = (api.services as { region?: (scopeId: string) => SomaRegionPort | null } | undefined)?.region;
|
|
144
152
|
return id !== '' && typeof svc === 'function' ? svc(id) : null;
|
|
145
153
|
};
|
|
154
|
+
const dataPort = (): SomaDataPort | undefined => {
|
|
155
|
+
const port = (api.services as { data?: SomaDataPort } | undefined)?.data;
|
|
156
|
+
return port && typeof port === 'object' ? port : undefined;
|
|
157
|
+
};
|
|
146
158
|
const port = (): SomaRegionPort | null => regionOf(strOf(props().scope));
|
|
147
159
|
const keyField = (): string => strOf(props().keyField);
|
|
148
160
|
|
|
@@ -159,8 +171,9 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
159
171
|
}
|
|
160
172
|
};
|
|
161
173
|
|
|
162
|
-
|
|
163
|
-
|
|
174
|
+
/** 选中项变化时回第 1 页的作用域(依赖对象) */
|
|
175
|
+
const resetPages = (extra: readonly string[] = []): void => {
|
|
176
|
+
for (const id of [...listOf(props().pageScopes), ...extra]) {
|
|
164
177
|
try {
|
|
165
178
|
regionOf(id)?.slice('view')?.set(1, 'page');
|
|
166
179
|
} catch {
|
|
@@ -178,7 +191,7 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
178
191
|
return `${strOf(rec.sort)}|${strOf(rec.order)}`;
|
|
179
192
|
};
|
|
180
193
|
const watchSort = (): void => {
|
|
181
|
-
for (const id of listOf(props().pageScopes)) {
|
|
194
|
+
for (const id of [...listOf(props().pageScopes), ...listOf(props().createScopes)]) {
|
|
182
195
|
if (sortWatching.has(id)) continue;
|
|
183
196
|
const slice = regionOf(id)?.slice('view');
|
|
184
197
|
if (!slice) continue;
|
|
@@ -233,6 +246,52 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
233
246
|
}
|
|
234
247
|
};
|
|
235
248
|
|
|
249
|
+
// 新建保存成功(协调组件 focus.created +1):仅对当前 view.page > 1 的目标作用域回第 1 页并在镜像写盘后发起第 1 页重取,
|
|
250
|
+
// 已在第 1 页的不动(避免第 1 页无谓双次拉取);翻页、编辑保存不动 created,列表留在原页。
|
|
251
|
+
// StandardCrud 的分页器与协调组件同作用域、自己订阅 created;链接作用域上的 MasterSub / CategoryCrud / 审批台等分页器在对象作用域里订阅不到,由本组件代写(page 路径写者)
|
|
252
|
+
let createdSeen = 0;
|
|
253
|
+
const watchCreated = (): void => {
|
|
254
|
+
const slice = port()?.slice('focus');
|
|
255
|
+
if (!slice) return;
|
|
256
|
+
const countOf = (raw: unknown): number => (isRec(raw) && typeof raw.created === 'number' ? raw.created : 0);
|
|
257
|
+
createdSeen = countOf(slice.get());
|
|
258
|
+
offs.push(slice.subscribe(() => {
|
|
259
|
+
if (!alive) return;
|
|
260
|
+
const n = countOf(slice.get());
|
|
261
|
+
if (n === createdSeen) return;
|
|
262
|
+
const grew = n > createdSeen;
|
|
263
|
+
createdSeen = n;
|
|
264
|
+
if (!grew) return;
|
|
265
|
+
const targets = [...new Set([...listOf(props().pageScopes), ...listOf(props().createScopes)])];
|
|
266
|
+
const objMap = isRec(props().createObjects) ? (props().createObjects as Rec) : {};
|
|
267
|
+
const needReload: string[] = [];
|
|
268
|
+
for (const id of targets) {
|
|
269
|
+
const view = regionOf(id)?.slice('view');
|
|
270
|
+
const cur = view?.get();
|
|
271
|
+
const page = isRec(cur) ? cur.page : undefined;
|
|
272
|
+
if (typeof page !== 'number' || page <= 1) continue;
|
|
273
|
+
try {
|
|
274
|
+
view?.set(1, 'page');
|
|
275
|
+
} catch {
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
const obj = objMap[id];
|
|
279
|
+
if (typeof obj === 'string' && obj !== '' && !needReload.includes(obj)) needReload.push(obj);
|
|
280
|
+
}
|
|
281
|
+
if (needReload.length > 0) {
|
|
282
|
+
void tick().then(() => {
|
|
283
|
+
if (!alive) return;
|
|
284
|
+
const dp = dataPort();
|
|
285
|
+
if (dp && typeof dp.reload === 'function') {
|
|
286
|
+
void Promise.resolve(dp.reload(needReload)).catch((err: unknown) => {
|
|
287
|
+
console.error('[soma-kit] KitLinkHub 新建回第 1 页重取失败:', err instanceof Error ? err.message : String(err));
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}));
|
|
293
|
+
};
|
|
294
|
+
|
|
236
295
|
const syncDefault = (): void => {
|
|
237
296
|
const p = props();
|
|
238
297
|
if (p.autoSelect !== true && p.autoSelect !== 'true') return;
|
|
@@ -245,12 +304,132 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
245
304
|
if (next !== undefined) setSelection(next);
|
|
246
305
|
};
|
|
247
306
|
|
|
307
|
+
// 主从单窗格(B1-6):根上的视图标记二选一;只有主从壳有这个根(CategoryCrud 等没有,全部是空操作)
|
|
308
|
+
const msRoot = (): HTMLElement | null => api.host?.closest<HTMLElement>(`[${KIT_MS_ROOT_ATTR}]`) ?? null;
|
|
309
|
+
const showMsView = (view: 'list' | 'detail'): void => {
|
|
310
|
+
const root = msRoot();
|
|
311
|
+
if (root === null) return;
|
|
312
|
+
root.toggleAttribute(KIT_MS_VIEW_DETAIL_ATTR, view === 'detail');
|
|
313
|
+
root.toggleAttribute(KIT_MS_VIEW_LIST_ATTR, view === 'list');
|
|
314
|
+
};
|
|
315
|
+
// 可见 = 有布局盒(单窗格时「返回」可见;并排时它被容器查询隐藏)。只读结构,不量尺寸
|
|
316
|
+
const shown = (el: Element | null | undefined): el is HTMLElement =>
|
|
317
|
+
typeof HTMLElement !== 'undefined' && el instanceof HTMLElement && el.getClientRects().length > 0;
|
|
318
|
+
const pendingTimers = new Set<ReturnType<typeof setTimeout>>();
|
|
319
|
+
const schedule = (fn: () => void, ms: number): void => {
|
|
320
|
+
if (!alive) return;
|
|
321
|
+
const id = setTimeout(() => {
|
|
322
|
+
pendingTimers.delete(id);
|
|
323
|
+
if (!alive) return;
|
|
324
|
+
fn();
|
|
325
|
+
}, ms);
|
|
326
|
+
pendingTimers.add(id);
|
|
327
|
+
};
|
|
328
|
+
const clearTimers = (): void => {
|
|
329
|
+
for (const id of pendingTimers) clearTimeout(id);
|
|
330
|
+
pendingTimers.clear();
|
|
331
|
+
};
|
|
332
|
+
/** 单窗格进详情后焦点落到「返回」(被点的条目已隐藏,焦点不能留在不可见处);并排时不动焦点 */
|
|
333
|
+
const focusBackAfterPaint = (): void => {
|
|
334
|
+
schedule(() => {
|
|
335
|
+
const root = msRoot();
|
|
336
|
+
if (root === null || !root.isConnected) return;
|
|
337
|
+
const back = [...root.querySelectorAll(`[${KIT_MS_BACK_ATTR}]`)].find(shown);
|
|
338
|
+
if (back !== undefined) back.focus({ preventScroll: true });
|
|
339
|
+
}, 0);
|
|
340
|
+
};
|
|
341
|
+
let offBack: (() => void) | null = null;
|
|
342
|
+
const wireBack = (): void => {
|
|
343
|
+
const root = msRoot();
|
|
344
|
+
if (root === null || offBack !== null) return;
|
|
345
|
+
const onClick = (e: MouseEvent): void => {
|
|
346
|
+
const btn = (e.target as Element | null)?.closest?.(`[${KIT_MS_BACK_ATTR}]`);
|
|
347
|
+
if (!btn || !root.contains(btn)) return;
|
|
348
|
+
showMsView('list');
|
|
349
|
+
// 回到列表:焦点还给选中条目(选中高亮保持),没有就给列表窗格里第一个可聚焦条目。
|
|
350
|
+
// 选中后列表可能随页面过渡重画(条目节点被换掉):第一拍没落上(焦点还在 body / 已脱离文档的节点)就在下一帧再找一次
|
|
351
|
+
const restore = (): boolean => {
|
|
352
|
+
if (!alive || !root.isConnected) return false;
|
|
353
|
+
const pane = root.querySelector(kitAttrSel(KIT_ATTR_PANE, 'list'));
|
|
354
|
+
const picked = pane?.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_SELECTED));
|
|
355
|
+
const target = picked !== null && picked !== undefined && picked.tabIndex >= 0 ? picked : pane?.querySelector<HTMLElement>(`${kitAttrSel(KIT_ATTR_ROW)}[tabindex="0"], ${kitAttrSel(KIT_ATTR_SELECTED)} button, ${kitAttrSel(KIT_ATTR_ROW)} button`);
|
|
356
|
+
if (!shown(target)) return false;
|
|
357
|
+
target.focus({ preventScroll: false });
|
|
358
|
+
return target.ownerDocument.activeElement === target;
|
|
359
|
+
};
|
|
360
|
+
// 列表在隐藏期间换了选中项:选中标记与行节点可能在「返回」之后才随页面过渡重画(1024 屏实测:返回后首拍选中标记仍在旧条目、
|
|
361
|
+
// 重画把刚落上的焦点连节点一起换掉,焦点掉到 body)。所以落焦后继续看几拍:焦点掉了 / 落的不是当前选中条目就再落一次,至多约 1 秒
|
|
362
|
+
let tries = 0;
|
|
363
|
+
const settle = (): void => {
|
|
364
|
+
if (!alive || !root.isConnected) return;
|
|
365
|
+
tries += 1;
|
|
366
|
+
// 用户已把焦点挪到列表以外(点了别处 / Tab 走了):不再抢
|
|
367
|
+
const now = root.ownerDocument.activeElement;
|
|
368
|
+
const pane = root.querySelector(kitAttrSel(KIT_ATTR_PANE, 'list'));
|
|
369
|
+
if (tries > 1 && now !== null && now !== root.ownerDocument.body && !(pane?.contains(now) ?? false)) return;
|
|
370
|
+
const ok = restore();
|
|
371
|
+
const active = root.ownerDocument.activeElement;
|
|
372
|
+
const onPicked = ok && typeof HTMLElement !== 'undefined' && active instanceof HTMLElement && active.hasAttribute(KIT_ATTR_SELECTED);
|
|
373
|
+
if (tries >= 20 || (onPicked && tries >= 4)) return;
|
|
374
|
+
schedule(settle, 50);
|
|
375
|
+
};
|
|
376
|
+
schedule(settle, 0);
|
|
377
|
+
};
|
|
378
|
+
root.addEventListener('click', onClick);
|
|
379
|
+
offBack = () => {
|
|
380
|
+
root.removeEventListener('click', onClick);
|
|
381
|
+
clearTimers();
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
let pickConfirmAbort: AbortController | null = null;
|
|
386
|
+
let pickConfirmSeq = 0;
|
|
387
|
+
|
|
248
388
|
const onSemantic = (name: string, payload: Readonly<Rec>): void => {
|
|
249
389
|
if (name === KIT_LINK_EVENTS.pick) {
|
|
250
390
|
// 用户点行换选中项:右侧内容区走页面过渡(不支持 / 减弱动效时直接写,与原行为一致);默认选中等程序写入不走过渡
|
|
251
391
|
if (isRec(payload.row)) {
|
|
252
392
|
const row = payload.row;
|
|
253
|
-
|
|
393
|
+
pickConfirmSeq += 1;
|
|
394
|
+
const mySeq = pickConfirmSeq;
|
|
395
|
+
pickConfirmAbort?.abort();
|
|
396
|
+
pickConfirmAbort = null;
|
|
397
|
+
const commit = (): void => {
|
|
398
|
+
withKitViewTransition(() => setSelection(row));
|
|
399
|
+
// 单窗格时进详情(并排时标记不起作用);默认选中(autoSelect)不经这里,窄档首次进入停在列表
|
|
400
|
+
showMsView('detail');
|
|
401
|
+
focusBackAfterPaint();
|
|
402
|
+
};
|
|
403
|
+
// 切换到另一条之前:业务组件根里有未保存的草稿(授权勾选、详情表单等)先问,确认才切,取消则选中不变。
|
|
404
|
+
// 确认 = 放弃:先让根内的脏草稿各自还原(表单回到当前初值、授权矩阵回到基线;契约 C1 kitDiscardDraftsWithin),再切选中。
|
|
405
|
+
// 只换选中不还原时,被放弃的修改留在界面上,重取回来的内容又相同就会被当成新基线、之后一点保存就写进新的那一条(D-01)。
|
|
406
|
+
// 只拦用户点选(本分支);默认选中 / 删除后选下一条走 syncDefault,不问。没有未保存修改时仍同步切换
|
|
407
|
+
const root = api.host?.parentElement ?? null;
|
|
408
|
+
const switching = linkKeyOf(row, keyField()) !== lastKey;
|
|
409
|
+
if (switching && root !== null && kitHasDirtyDraftWithin(root)) {
|
|
410
|
+
const ac = new AbortController();
|
|
411
|
+
pickConfirmAbort = ac;
|
|
412
|
+
void askKitConfirm({
|
|
413
|
+
message: kitText('soma.kit.confirm_switch_dirty', undefined, api.host ?? null),
|
|
414
|
+
tone: 'danger',
|
|
415
|
+
at: api.host ?? null,
|
|
416
|
+
whenNoDom: true,
|
|
417
|
+
signal: ac.signal,
|
|
418
|
+
})
|
|
419
|
+
.then((ok) => {
|
|
420
|
+
if (pickConfirmAbort === ac) pickConfirmAbort = null;
|
|
421
|
+
if (!ok || !alive || ac.signal.aborted || mySeq !== pickConfirmSeq) return;
|
|
422
|
+
// 先还原、后切换:草稿上报净之后再写 selection,从属对象按新选中重取时界面上已没有被放弃的修改
|
|
423
|
+
kitDiscardDraftsWithin(root);
|
|
424
|
+
commit();
|
|
425
|
+
})
|
|
426
|
+
.catch((err: unknown) => {
|
|
427
|
+
if (pickConfirmAbort === ac) pickConfirmAbort = null;
|
|
428
|
+
console.error('[soma-kit] 切换选中的确认失败:', err instanceof Error ? err.message : String(err));
|
|
429
|
+
});
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
commit();
|
|
254
433
|
}
|
|
255
434
|
return;
|
|
256
435
|
}
|
|
@@ -258,9 +437,12 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
258
437
|
// 字段动作的载荷只有 { value }:补上当前选中行,不依赖 core 补 row
|
|
259
438
|
const row = selectedOf(port()?.slice('selection')?.get());
|
|
260
439
|
const slot = Number(name.slice(KIT_LINK_EVENTS.fieldPrefix.length));
|
|
440
|
+
// kit_key_field(本枢纽的主键字段名)与 kit_slot(槽位序号):动作执行器据此给在途键定行键、区分同一动作的不同槽位
|
|
261
441
|
if (Number.isInteger(slot)) emitActionSlot((n, p) => api.emit(n, p), KIT_ACTION_SLOT_BASE.field, slot, {
|
|
262
442
|
value: payload.value,
|
|
263
443
|
row: isRec(row) ? row : {},
|
|
444
|
+
kit_key_field: keyField(),
|
|
445
|
+
kit_slot: slot,
|
|
264
446
|
});
|
|
265
447
|
}
|
|
266
448
|
};
|
|
@@ -276,13 +458,20 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
276
458
|
try { p.slice('selection')?.set(true, KIT_NONE_PATH); } catch { /* 非 selection 写者(分类树自己写):忽略 */ }
|
|
277
459
|
}
|
|
278
460
|
offs.push(p.onSemantic(onSemantic));
|
|
461
|
+
wireBack();
|
|
462
|
+
offs.push(() => { offBack?.(); offBack = null; });
|
|
279
463
|
const sel = p.slice('selection');
|
|
280
464
|
if (sel) offs.push(sel.subscribe(() => { void onSelection(); }));
|
|
281
465
|
watchSort();
|
|
282
466
|
watchFilters();
|
|
467
|
+
watchCreated();
|
|
283
468
|
syncDefault();
|
|
284
469
|
return () => {
|
|
285
470
|
alive = false;
|
|
471
|
+
pickConfirmSeq += 1;
|
|
472
|
+
pickConfirmAbort?.abort();
|
|
473
|
+
pickConfirmAbort = null;
|
|
474
|
+
clearTimers();
|
|
286
475
|
for (const off of offs) off();
|
|
287
476
|
offs = [];
|
|
288
477
|
sortWatching.clear();
|
|
@@ -292,6 +481,8 @@ export function createKitLinkHub(): SomaComponentDefinition {
|
|
|
292
481
|
render() {
|
|
293
482
|
watchSort();
|
|
294
483
|
syncDefault();
|
|
484
|
+
// 挂载时宿主可能还没进主从根(模板克隆后再挂):渲染时补接「返回」(幂等)
|
|
485
|
+
if (alive) wireBack();
|
|
295
486
|
},
|
|
296
487
|
};
|
|
297
488
|
}),
|
package/src/biz/link/shared.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { kitText } from '../../i18n/kit-text';
|
|
|
11
11
|
import type { SomaScopeDecl, SomaScopeMirrorDecl, SomaScopeSliceDecl } from 'soma-core';
|
|
12
12
|
import { KIT_VIEW_FORM_KEYS, KIT_VIEW_SLOTS } from '../../object-renderer/defaults';
|
|
13
13
|
import { actionPipeline, rowActionSlotsOf } from '../../object-renderer/emit-events';
|
|
14
|
-
import { KIT_ACTION_SLOT_BASE, actionSlotEvent, actionSlotOverflow, pickSlotOverflow } from '../../base/action-slots';
|
|
14
|
+
import { KIT_ACTION_SLOT_BASE, KIT_ACTION_SLOT_MAX, actionSlotEvent, actionSlotOverflow, pickSlotOverflow } from '../../base/action-slots';
|
|
15
15
|
import { emitObject, type KitEmitInput, type KitEmitResult } from '../../object-renderer/emit-object';
|
|
16
16
|
import { primaryKeyFieldOf } from '../../object-renderer/key-field';
|
|
17
17
|
import { ctxMenuAnchor, opsAnchor, rowsAnchor, selAnchor, staticCtxAnchor, toolbarAnchor, treeAnchor, virtualAnchor } from '../../object-renderer/emit-static';
|
|
@@ -163,7 +163,7 @@ export function normalizeMember(raw: unknown, opts: NormalizeOptions): { obj: Ki
|
|
|
163
163
|
if (!hasWrite && view.form !== undefined) fail('声明了 form 视图但没有 behavior.write', `${opts.path}.view.form`);
|
|
164
164
|
if (hasWrite && view.form !== undefined) {
|
|
165
165
|
if (!actions.some((a) => a.builtin === LINK_BUILTIN.create)) {
|
|
166
|
-
actions.unshift({ id: 'create', name: kitText('soma.kit.create', undefined, opts.locale), on: 'toolbar', builtin: LINK_BUILTIN.create,
|
|
166
|
+
actions.unshift({ id: 'create', name: kitText('soma.kit.create', undefined, opts.locale), on: 'toolbar', builtin: LINK_BUILTIN.create, function: 'create' });
|
|
167
167
|
}
|
|
168
168
|
if (!actions.some((a) => a.builtin === LINK_BUILTIN.edit)) {
|
|
169
169
|
actions.push({ id: 'edit', name: kitText('soma.kit.edit', undefined, opts.locale), on: 'row', builtin: LINK_BUILTIN.edit });
|
|
@@ -209,7 +209,10 @@ export function normalizeMember(raw: unknown, opts: NormalizeOptions): { obj: Ki
|
|
|
209
209
|
|
|
210
210
|
// ---------------------------------------------------------------- 动作路由
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
/** 可经枢纽补上当前选中行的动作管道:具名动作(ACTION | <name>,非 kit.* / data.*)与声明式请求 / 下载动作(SCOPE | semantic | kit_act | rq_*) */
|
|
213
|
+
const LIFTED_ACTION_PIPE = /^(?:ACTION \| (?!kit\.)(?!data\.)|SCOPE \| semantic \| kit_act \| rq_)/;
|
|
214
|
+
/** 只含具名动作(看板用:看板没有选中行,声明式请求 / 下载动作不改走枢纽) */
|
|
215
|
+
const NAMED_ACTION_PIPE = /^ACTION \| (?!kit\.)(?!data\.)/;
|
|
213
216
|
|
|
214
217
|
/** 字段动作的语义事件回传 id:由字段与动作名拼出,小写 snake_case */
|
|
215
218
|
export function fieldActionId(field: string, action: string): string {
|
|
@@ -230,11 +233,17 @@ export function addFieldSlot(slots: FieldSlots, link: string, pipe: string): str
|
|
|
230
233
|
return semanticPipe(link, `${KIT_LINK_EVENTS.fieldPrefix}${index}`);
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* 把字段动作槽位表绑到枢纽的 field_action_<序号> 事件上。超过槽位上限:编译失败(KIT-EVT-001,进诊断、挡编译),
|
|
238
|
+
* 且不再写超出上限的事件键(枢纽不会抛序号 ≥ 上限的槽位,写了只会留下引擎报「既不是 DOM 事件也未匹配契约 emit」的死接线)。
|
|
239
|
+
*/
|
|
234
240
|
export function bindFieldSlots(events: Rec, hubId: string, slots: readonly string[], diagnostics: KitDiagnostic[]): void {
|
|
235
241
|
const overflow = actionSlotOverflow(slots.length, '联动枢纽的字段动作');
|
|
236
242
|
if (overflow !== null) diagnostics.push({ code: 'KIT-EVT-001', path: 'product', message: overflow });
|
|
237
|
-
slots.forEach((pipe, i) => {
|
|
243
|
+
slots.forEach((pipe, i) => {
|
|
244
|
+
if (overflow !== null && i >= KIT_ACTION_SLOT_MAX) return;
|
|
245
|
+
events[`${hubId}.${actionSlotEvent(KIT_ACTION_SLOT_BASE.field, i)}`] = pipe;
|
|
246
|
+
});
|
|
238
247
|
}
|
|
239
248
|
|
|
240
249
|
/**
|
|
@@ -243,21 +252,24 @@ export function bindFieldSlots(events: Rec, hubId: string, slots: readonly strin
|
|
|
243
252
|
*/
|
|
244
253
|
export function bindPickedReloads(parts: Parts, hubId: string, scopes: readonly string[]): void {
|
|
245
254
|
const overflow = pickSlotOverflow(scopes.length);
|
|
246
|
-
if (overflow !== null)
|
|
255
|
+
if (overflow !== null) {
|
|
256
|
+
parts.diagnostics.push({ code: 'KIT-EVT-001', path: 'product', message: overflow });
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
247
259
|
const shown = parts.show[hubId];
|
|
248
260
|
if (isRec(shown) && isRec(shown.props)) shown.props.pickSlots = scopes.length;
|
|
249
261
|
scopes.forEach((s, i) => { parts.events[`${hubId}.${actionSlotEvent('picked', i)}`] = reloadPipe(s); });
|
|
250
262
|
}
|
|
251
263
|
|
|
252
264
|
/**
|
|
253
|
-
* 摘要里的字段动作(Switch 等 change
|
|
254
|
-
*
|
|
265
|
+
* 摘要里的字段动作(Switch 等 change 事件、字段 Button 点击)载荷只有 `{ value }` 或空对象,不知道是哪一行(core 不替字段事件补 row):
|
|
266
|
+
* 把事件里的具名动作 / 声明式请求与下载管道换成枢纽语义事件,原管道登记进字段动作槽位表。
|
|
255
267
|
*/
|
|
256
|
-
export function liftFieldActions(object: string, link: string, events: Rec, slots: FieldSlots): void {
|
|
268
|
+
export function liftFieldActions(object: string, link: string, events: Rec, slots: FieldSlots, pipes: RegExp = LIFTED_ACTION_PIPE): void {
|
|
257
269
|
const prefix = `${object}__summary__`;
|
|
258
270
|
const ctxPrefix = `${staticCtxAnchor(object, 'summary')}.`;
|
|
259
271
|
for (const [k, v] of Object.entries(events)) {
|
|
260
|
-
if (!k.startsWith(prefix) || k.startsWith(ctxPrefix) || typeof v !== 'string' || !
|
|
272
|
+
if (!k.startsWith(prefix) || k.startsWith(ctxPrefix) || typeof v !== 'string' || !pipes.test(v)) continue;
|
|
261
273
|
events[k] = addFieldSlot(slots, link, v);
|
|
262
274
|
}
|
|
263
275
|
}
|
|
@@ -272,9 +284,27 @@ export interface MemberArgs {
|
|
|
272
284
|
hubId: string;
|
|
273
285
|
/** 列表行可点选(行点击抛 row_action,kit_action: select) */
|
|
274
286
|
pick?: boolean;
|
|
287
|
+
/** 从属集合监听选中项变化的链接作用域(透传给 emitObject -> KitCollectionState config.selectionScope) */
|
|
288
|
+
selectionScope?: string;
|
|
289
|
+
/**
|
|
290
|
+
* 选中签名取用的主键字段名 = 联动枢纽的主键字段(契约 C3:与 selectionScope 一起下发到 KitCollectionState config.selectionKeyField)。
|
|
291
|
+
* 三态面板按它取选中行的键(与 focus.id 同一字符串口径),主键不叫 id 时同一行内容变化不再被当成换选中(D-03 / F-02);只在给了 selectionScope 时下发
|
|
292
|
+
*/
|
|
293
|
+
selectionKeyField?: string;
|
|
275
294
|
emitInput?: KitEmitInput;
|
|
276
295
|
/** 累积枢纽字段动作槽位(绑到枢纽的 field_action_<序号> 事件上,见 bindFieldSlots) */
|
|
277
296
|
fieldSteps?: FieldSlots;
|
|
297
|
+
/**
|
|
298
|
+
* 摘要字段动作改走枢纽的范围(给了 fieldSteps 才生效):'all'(缺省)= 具名动作 + 声明式请求 / 下载动作;
|
|
299
|
+
* 'named' = 只具名动作(看板:没有选中行,请求 / 下载动作不拦截;具名字段动作仍落进 fieldSteps,由看板报 KIT-BIZ-003)。
|
|
300
|
+
*/
|
|
301
|
+
fieldLift?: 'all' | 'named';
|
|
302
|
+
/**
|
|
303
|
+
* 工具栏具名动作与声明式请求 / 下载动作是否改走枢纽(拿当前选中行):显式参数,不看 `out.components` 里此刻有没有 KitLinkHub。
|
|
304
|
+
* 缺省 = 给了 fieldSteps 就开(MasterSub / ApprovalDesk / AuthPanel 都有联动枢纽);看板没有选中行,传 false;
|
|
305
|
+
* NotificationCenter / CategoryCrud 不传 fieldSteps,所以不拦。
|
|
306
|
+
*/
|
|
307
|
+
toolbarLift?: boolean;
|
|
278
308
|
/**
|
|
279
309
|
* 本组件声明的附加浮层名(overlays.*)。给了才解释行动作 `builtin: openOverlay`:目标在表内的接协调组件的 crud_open_overlay
|
|
280
310
|
* (载荷带当前行;浮层目标由协调组件按动作 id 反查);不给(没有浮层的 link 系组件)保持原样。
|
|
@@ -315,6 +345,13 @@ export function emitMember(out: Parts, a: MemberArgs): MemberResult {
|
|
|
315
345
|
removeScope: link,
|
|
316
346
|
formMode: 'create',
|
|
317
347
|
...(a.pick === true ? { pickOnRow: true } : {}),
|
|
348
|
+
// 选中切换加载态:监听的链接作用域与选中签名的主键字段一起下发(契约 C3)
|
|
349
|
+
...(a.selectionScope !== undefined && a.selectionScope !== ''
|
|
350
|
+
? {
|
|
351
|
+
selectionScope: a.selectionScope,
|
|
352
|
+
...(a.selectionKeyField !== undefined && a.selectionKeyField !== '' ? { selectionKeyField: a.selectionKeyField } : {}),
|
|
353
|
+
}
|
|
354
|
+
: {}),
|
|
318
355
|
...(a.emitInput ?? {}),
|
|
319
356
|
},
|
|
320
357
|
), object);
|
|
@@ -326,15 +363,17 @@ export function emitMember(out: Parts, a: MemberArgs): MemberResult {
|
|
|
326
363
|
const rowsEv = events[rowsAnchor(object)];
|
|
327
364
|
const selKey = `${selAnchor(object)}.row_select`;
|
|
328
365
|
if (isRec(rowsEv) && selKey in rowsEv) rowsEv[selKey] = semanticPipe(link, KIT_COORD_EVENTS.select);
|
|
329
|
-
if (a.fieldSteps !== undefined) liftFieldActions(object, link, events, a.fieldSteps);
|
|
330
|
-
//
|
|
331
|
-
// ->
|
|
332
|
-
|
|
366
|
+
if (a.fieldSteps !== undefined) liftFieldActions(object, link, events, a.fieldSteps, a.fieldLift === 'named' ? NAMED_ACTION_PIPE : LIFTED_ACTION_PIPE);
|
|
367
|
+
// ③:有联动枢纽(KitLinkHub)的业务组件(MasterSub / ApprovalDesk / AuthPanel)里,工具栏具名动作与声明式请求 / 下载动作
|
|
368
|
+
// 点击没有载荷、拿不到选中的主单。改成「点击 -> 枢纽语义事件 -> 枢纽抛 field_action_<序号> { row: 当前选中行 } -> 原动作管道」,
|
|
369
|
+
// 动作回调 / KitActionHost 拿到的 row 就是当前选中主单。是否拦截由调用方显式声明(toolbarLift,缺省随 fieldSteps):
|
|
370
|
+
// 看板(MultiObjectBoard)没有选中行传 false;NotificationCenter / CategoryCrud 没有传 fieldSteps,StandardCrud 不走本函数
|
|
371
|
+
if (a.fieldSteps !== undefined && a.toolbarLift !== false) {
|
|
333
372
|
for (const act of actions) {
|
|
334
373
|
if (act.on !== 'toolbar') continue;
|
|
335
374
|
const click = `${toolbarAnchor(object, act.id)}.click`;
|
|
336
375
|
const cur = events[click];
|
|
337
|
-
if (typeof cur === 'string' &&
|
|
376
|
+
if (typeof cur === 'string' && LIFTED_ACTION_PIPE.test(cur)) events[click] = addFieldSlot(a.fieldSteps, link, cur);
|
|
338
377
|
}
|
|
339
378
|
}
|
|
340
379
|
|