soma-kit 0.1.15 → 0.1.17
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 +935 -93
- 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 +188 -62
- 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 +152 -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 +1016 -54
- 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 +423 -104
- 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
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
// 过渡对象的 ready / finished / updateCallbackDone 三个 promise 的 rejection 一律吞掉)。
|
|
9
9
|
// 时长与缓动在样式里(kit-theme.tpl 的「自适应与过渡」块,读动效令牌),本文件不写任何数字。
|
|
10
10
|
|
|
11
|
-
import { prefersReducedMotion } from './motion/limits';
|
|
11
|
+
import { isMotionStill, prefersReducedMotion } from './motion/limits';
|
|
12
|
+
import { KIT_ATTR_VT } from '../shared/dom-attrs';
|
|
12
13
|
|
|
13
14
|
interface KitViewTransition {
|
|
14
15
|
readonly ready?: Promise<unknown>;
|
|
@@ -25,13 +26,16 @@ function swallow(p: Promise<unknown> | undefined): void {
|
|
|
25
26
|
if (p !== undefined && typeof p.then === 'function') p.then(undefined, () => {});
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
/** 当前环境能否播页面过渡(支持 API
|
|
29
|
+
/** 当前环境能否播页面过渡(支持 API 且未偏好减弱动效 / 静止档) */
|
|
29
30
|
export function canKitViewTransition(): boolean {
|
|
30
31
|
if (typeof document === 'undefined') return false;
|
|
31
32
|
if (typeof (document as { startViewTransition?: unknown }).startViewTransition !== 'function') return false;
|
|
32
33
|
if (prefersReducedMotion()) return false;
|
|
33
34
|
// 页面上没有任何命名的内容区(data-kit-vt)就没有可过渡的东西,别白白冻一帧
|
|
34
|
-
|
|
35
|
+
const vtTarget = document.querySelector(`[${KIT_ATTR_VT}]`);
|
|
36
|
+
if (vtTarget === null) return false;
|
|
37
|
+
if (isMotionStill(vtTarget)) return false;
|
|
38
|
+
return true;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
/** 把 update 包进页面过渡;不可用时直接调用 update。update 的异常透传。 */
|
package/src/base/virtual-list.ts
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
// 间距元素(顶 / 底占位)的高度是运行期算出的像素值,没有对应的预置类,只能经 CSSOM 写 `el.style.height`
|
|
14
14
|
// (不是 HTML style 属性、不进模板,CSP 安全)。这是 kit 里唯一的运行期几何写入,集中在 `setSpacerHeight`。
|
|
15
15
|
|
|
16
|
-
import { KIT_COLLECTION_LIMITS } from 'soma-foundation/kit-limits';
|
|
16
|
+
import { KIT_COLLECTION_LIMITS, KIT_SIZE_SPEC } from 'soma-foundation/kit-limits';
|
|
17
17
|
import { KIT_NINE_DIM } from 'soma-foundation/kit-nine-dim';
|
|
18
|
+
import { arrangeThemeValues } from 'soma-foundation/arrange';
|
|
18
19
|
import { KIT_GRAMMAR_RUNTIME as grammarJson } from '../generated/kit-grammar-runtime';
|
|
19
20
|
|
|
20
21
|
type Json = Record<string, any>;
|
|
@@ -22,12 +23,18 @@ const V = ((grammarJson as unknown as Json).collectionKeys as Json).virtual as J
|
|
|
22
23
|
|
|
23
24
|
export type KitRowTier = 'sm' | 'md' | 'lg';
|
|
24
25
|
export const KIT_ROW_TIERS: readonly KitRowTier[] = V.tiers as KitRowTier[];
|
|
25
|
-
export const KIT_VIRTUAL_ROW_PX: Readonly<Record<KitRowTier, number>> = KIT_COLLECTION_LIMITS.virtual.rowHeightPx;
|
|
26
26
|
|
|
27
27
|
// ── 初始行高估算跟随密度 ─────────────────────────────────────
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
28
|
+
// 行高不存表(原 kit-limits#collection.virtual.rowHeightPx 已删,SCON-097):档位的行高类 h-N(kit-grammar#collectionKeys.virtual.rowClass)
|
|
29
|
+
// 就是长度刻度的第 N 步,高 = R2(N · u)(主题公式 §1,u = 当前密度的间距单位 --soma-space-1)。估算值取同一条公式的门面
|
|
30
|
+
// arrangeThemeValues(种子).scale,首帧估算与类解析出的高是同一个数(紧凑档 h-10 = 36,不是 35)。
|
|
31
|
+
// KIT_VIRTUAL_ROW_PX = 标准密度下的值(读不到宿主间距单位时的回退:jsdom、非九维主题);标准单位取九维真源,不写字面量。
|
|
32
|
+
const ROW_UNITS = Object.fromEntries(KIT_ROW_TIERS.map((t) => [t, Number(String((V.rowClass as Record<string, string>)[t]).replace(/^h-/, ''))])) as Record<KitRowTier, number>;
|
|
33
|
+
const FONT_FLOOR: number = KIT_NINE_DIM.dimensions.fontScale.floorPx;
|
|
34
|
+
/** 长度刻度第 N 步在间距单位 u 下的 px = R2(N · u);步数不在刻度表里(24 以上)按 N · u */
|
|
35
|
+
function lengthOfStep(units: number, unitPx: number): number {
|
|
36
|
+
return arrangeThemeValues({ u: unitPx, r0: 0, b: FONT_FLOOR, floor: FONT_FLOOR }).scale.find((s) => s.n === units)?.px ?? units * unitPx;
|
|
37
|
+
}
|
|
31
38
|
|
|
32
39
|
type StandardUnitSource = { default?: string; controlUnits?: number; levels?: ReadonlyArray<{ id?: string; spaceUnitPx?: number; controlHeightPx?: number }> };
|
|
33
40
|
|
|
@@ -59,20 +66,23 @@ export function readSpaceUnitPx(host: Element | null): number | null {
|
|
|
59
66
|
}
|
|
60
67
|
}
|
|
61
68
|
|
|
62
|
-
/**
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
return
|
|
66
|
-
}
|
|
69
|
+
/** 各档位在标准密度下的行高(px)= R2(行高类的步数 · 标准间距单位);标准单位读不到时取间距阶梯步长(同值真源) */
|
|
70
|
+
export const KIT_VIRTUAL_ROW_PX: Readonly<Record<KitRowTier, number>> = (() => {
|
|
71
|
+
const std = standardSpaceUnitPx() ?? KIT_SIZE_SPEC.ladders.spacingStepPx;
|
|
72
|
+
return Object.fromEntries(KIT_ROW_TIERS.map((t) => [t, lengthOfStep(ROW_UNITS[t], std)])) as Record<KitRowTier, number>;
|
|
73
|
+
})();
|
|
67
74
|
|
|
68
|
-
/** 某档位的初始行高估算(px
|
|
75
|
+
/** 某档位的初始行高估算(px)= R2(行高类的步数 · 宿主当前间距单位);间距单位或标准单位读不到时回退标准密度的值。reader / standard 可注入(测试用) */
|
|
69
76
|
export function virtualRowPx(
|
|
70
77
|
tier: KitRowTier,
|
|
71
78
|
host: Element | null,
|
|
72
79
|
reader: (host: Element | null) => number | null = readSpaceUnitPx,
|
|
73
80
|
standard: () => number | null = standardSpaceUnitPx,
|
|
74
81
|
): number {
|
|
75
|
-
|
|
82
|
+
const unit = reader(host);
|
|
83
|
+
const std = standard();
|
|
84
|
+
if (unit === null || std === null || !(unit > 0) || !(std > 0)) return KIT_VIRTUAL_ROW_PX[tier];
|
|
85
|
+
return lengthOfStep(ROW_UNITS[tier], unit);
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
export const KIT_VIRTUAL_ROW_CLASS: Readonly<Record<KitRowTier, string>> = V.rowClass;
|
|
@@ -103,9 +113,9 @@ export function rowTierOf(raw: unknown, dflt: KitRowTier = 'md'): KitRowTier {
|
|
|
103
113
|
return typeof raw === 'string' && (KIT_ROW_TIERS as readonly string[]).includes(raw) ? raw as KitRowTier : dflt;
|
|
104
114
|
}
|
|
105
115
|
|
|
106
|
-
/** 摘掉类串里的纵向内边距 py-* 与固定行高 h-N(虚拟行由档位行高类 + items-center 定高,内边距会让内容溢出,行高类并存会互相打架) */
|
|
116
|
+
/** 摘掉类串里的纵向内边距 py-* 与固定行高 h-N / h-menu-item(虚拟行由档位行高类 + items-center 定高,内边距会让内容溢出,行高类并存会互相打架) */
|
|
107
117
|
export function withoutPy(cls: string): string {
|
|
108
|
-
return split(cls).filter((t) => !/(^|:)(py-|h
|
|
118
|
+
return split(cls).filter((t) => !/(^|:)(py-|h-(?:\d|menu-item($|-)))/.test(t)).join(' ');
|
|
109
119
|
}
|
|
110
120
|
|
|
111
121
|
/** 顶 / 底占位元素的高度(运行期几何,唯一的 style 写入点) */
|
|
@@ -345,9 +355,21 @@ export function createVirtualWindow(o: VirtualWindowOptions): VirtualWindow {
|
|
|
345
355
|
},
|
|
346
356
|
calibrate(measured) {
|
|
347
357
|
if (calibrated || !(measured > 0) || Math.abs(measured - px) < 0.5) return false;
|
|
358
|
+
const prevPx = px;
|
|
348
359
|
calibrated = true;
|
|
349
360
|
px = measured;
|
|
350
361
|
if (virt !== null) {
|
|
362
|
+
if (pendingAnchorIndex <= 0) {
|
|
363
|
+
const sc = o.scroller();
|
|
364
|
+
const scrollTop = sc?.scrollTop ?? 0;
|
|
365
|
+
const items = virt.items();
|
|
366
|
+
if (items.length > 0) {
|
|
367
|
+
const hit = scrollTop > 0 ? items.find((it) => it.start + it.size > scrollTop) : items[0];
|
|
368
|
+
pendingAnchorIndex = (hit ?? items[0])!.index;
|
|
369
|
+
} else if (scrollTop > 0 && prevPx > 0) {
|
|
370
|
+
pendingAnchorIndex = Math.floor(scrollTop / prevPx);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
351
373
|
off?.();
|
|
352
374
|
off = null;
|
|
353
375
|
virt.dispose();
|
|
@@ -358,10 +380,22 @@ export function createVirtualWindow(o: VirtualWindowOptions): VirtualWindow {
|
|
|
358
380
|
},
|
|
359
381
|
setRowPx(next) {
|
|
360
382
|
if (!(next > 0) || next === px) return;
|
|
383
|
+
const prevPx = px;
|
|
361
384
|
px = next;
|
|
362
385
|
basePx = next;
|
|
363
386
|
calibrated = false;
|
|
364
387
|
if (virt !== null) {
|
|
388
|
+
if (pendingAnchorIndex <= 0) {
|
|
389
|
+
const sc = o.scroller();
|
|
390
|
+
const scrollTop = sc?.scrollTop ?? 0;
|
|
391
|
+
const items = virt.items();
|
|
392
|
+
if (items.length > 0) {
|
|
393
|
+
const hit = scrollTop > 0 ? items.find((it) => it.start + it.size > scrollTop) : items[0];
|
|
394
|
+
pendingAnchorIndex = (hit ?? items[0])!.index;
|
|
395
|
+
} else if (scrollTop > 0 && prevPx > 0) {
|
|
396
|
+
pendingAnchorIndex = Math.floor(scrollTop / prevPx);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
365
399
|
off?.();
|
|
366
400
|
off = null;
|
|
367
401
|
virt.dispose();
|
|
@@ -375,6 +409,7 @@ export function createVirtualWindow(o: VirtualWindowOptions): VirtualWindow {
|
|
|
375
409
|
try { virt.scrollToIndex(i, 'auto'); } catch { /* 容器已卸载:忽略 */ }
|
|
376
410
|
return;
|
|
377
411
|
}
|
|
412
|
+
pendingAnchorIndex = i;
|
|
378
413
|
const sc = o.scroller();
|
|
379
414
|
if (sc !== null) sc.scrollTop = i * px;
|
|
380
415
|
},
|
|
@@ -13,15 +13,17 @@
|
|
|
13
13
|
// 缺关联键不取数:审批单 / 历史的 from 编成 core `from[].require`(requireLink),尚未选中时对象落 idle,不发请求。
|
|
14
14
|
// 队列为空时审批单与历史取不到数据(走各自视图的空态)。
|
|
15
15
|
|
|
16
|
+
import { isNextPipeline } from '../shared/pipeline';
|
|
16
17
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
17
|
-
import
|
|
18
|
+
import { cellAnchor } from '../../object-renderer/emit-static';
|
|
19
|
+
import type { KitCell, KitLayoutIR, KitObject, KitObjectIR } from '../../object-renderer/types';
|
|
18
20
|
import type { KitFragment } from '../../object-renderer/fragment';
|
|
19
21
|
import type { KitBizContext, KitBizInput } from '../types';
|
|
20
22
|
import { KIT_LINK_MIRRORS, KIT_SEL_PATH } from '../link/hub';
|
|
21
23
|
import { bizObjectName, finishBizCompile, validateBizAreaClass } from '../shared/compile-helpers';
|
|
22
24
|
import {
|
|
23
25
|
bindFieldSlots, bindPickedReloads, classesIn, emitMember, grantPageReset, isRec, keyFieldOf, linkRemoveProps, mirrorPath, newParts,
|
|
24
|
-
normalizeMember, sortMirrors, type FieldSlots, type Rec,
|
|
26
|
+
normalizeMember, patchProps, sortMirrors, type FieldSlots, type Rec,
|
|
25
27
|
} from '../link/shared';
|
|
26
28
|
import { ApprovalDesk } from './index';
|
|
27
29
|
import { APPROVAL_DESK_AREAS, APPROVAL_DESK_CLASS, approvalDeskHtml, approvalDeskIds } from './shell';
|
|
@@ -61,6 +63,58 @@ function hideButtonFieldLabels(obj: KitObject): void {
|
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
/** 将审批单摘要中连续的按钮型字段格合并为横向动作条,避免「通过 / 驳回」竖排并在中间画出通栏分割线 */
|
|
67
|
+
const SUMMARY_BUTTON_CELL_RE = /<div(?:\s+[^>]*)?\s+class="[^"]*\bgrid-cols-subgrid\b[^"]*">\s*(<div\s+data-soma-component="Button"[^>]*><\/div>)\s*<\/div>/g;
|
|
68
|
+
const SUMMARY_BUTTON_RUN_RE = new RegExp(`(?:${SUMMARY_BUTTON_CELL_RE.source})+`, 'g');
|
|
69
|
+
|
|
70
|
+
function groupSummaryButtonCells(html: string): string {
|
|
71
|
+
if (!html.includes('data-soma-component="Button"')) return html;
|
|
72
|
+
return html.replace(SUMMARY_BUTTON_RUN_RE, (run) => {
|
|
73
|
+
const buttons: string[] = [];
|
|
74
|
+
for (const m of run.matchAll(SUMMARY_BUTTON_CELL_RE)) {
|
|
75
|
+
if (m[1] !== undefined) buttons.push(m[1]);
|
|
76
|
+
}
|
|
77
|
+
if (buttons.length === 0) return run;
|
|
78
|
+
return `<div class="${APPROVAL_DESK_CLASS.actionRow}">${buttons.join('')}</div>`;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** 单对象排布里的全部字段格(栅格 / 行 / 弹性排布,分组逐节展开);别的形态(写死形状件等)没有字段格 */
|
|
83
|
+
function layoutCells(layout: KitLayoutIR | undefined): KitCell[] {
|
|
84
|
+
if (layout === undefined) return [];
|
|
85
|
+
switch (layout.kind) {
|
|
86
|
+
case 'grid':
|
|
87
|
+
case 'flex':
|
|
88
|
+
return layout.cells;
|
|
89
|
+
case 'rows':
|
|
90
|
+
return layout.rows.flat();
|
|
91
|
+
case 'groups':
|
|
92
|
+
return layout.groups.flatMap((g) => layoutCells(g.layout));
|
|
93
|
+
default:
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 审批单摘要里的字段按钮(通过 / 驳回 …)是对同一张单的互斥决定:任一在途,其余一并置灰(F-12)。
|
|
100
|
+
* 取框架给各按钮注入的忙闲通道名(emit-static 按所接动作注入的 busy_action),并成一个名字列表(空格分隔:base/action-busy#isKitActionBusy 按空白 / 逗号切名,
|
|
101
|
+
* 任一在途即忙),写回每个按钮。页面手写了 busy / busy_action 的按钮不动;不到两个名字不改。
|
|
102
|
+
*/
|
|
103
|
+
function linkDecisionBusy(show: Rec, ir: KitObjectIR, object: string): void {
|
|
104
|
+
const targets: Array<{ id: string; names: string[] }> = [];
|
|
105
|
+
for (const c of layoutCells(ir.views.summary?.layout)) {
|
|
106
|
+
if (c.component !== 'Button' || c.action === undefined || c.props.busy_action !== undefined || c.props.busy !== undefined) continue;
|
|
107
|
+
const id = cellAnchor(object, 'summary', c.field);
|
|
108
|
+
const entry = show[id];
|
|
109
|
+
const props = isRec(entry) && isRec(entry.props) ? entry.props : undefined;
|
|
110
|
+
if (props === undefined || typeof props.busy_action !== 'string' || props.busy_action === '') continue;
|
|
111
|
+
targets.push({ id, names: props.busy_action.split(/[\s,]+/).filter((n) => n !== '') });
|
|
112
|
+
}
|
|
113
|
+
const names = [...new Set(targets.flatMap((t) => t.names))];
|
|
114
|
+
if (names.length < 2) return;
|
|
115
|
+
for (const t of targets) patchProps(show, t.id, { busy_action: names.join(' ') });
|
|
116
|
+
}
|
|
117
|
+
|
|
64
118
|
export function compileApprovalDesk(input: KitBizInput, ctx: KitBizContext): KitFragment {
|
|
65
119
|
const out = newParts(['KitLinkHub', 'KitCrudBridge']);
|
|
66
120
|
const fail = (code: string, message: string, path: string): void => { out.diagnostics.push({ code, message, path }); };
|
|
@@ -134,16 +188,22 @@ export function compileApprovalDesk(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
134
188
|
if (out.diagnostics.length > 0) return finishBizCompile(out, '');
|
|
135
189
|
|
|
136
190
|
const fieldSteps: FieldSlots = [];
|
|
191
|
+
const selRow = mirrorPath(link, KIT_LINK_MIRRORS.selRow);
|
|
137
192
|
const q = emitMember(out, {
|
|
138
193
|
object: queueName, scope: `${queueName}_scope`, obj: queue, ctx, link, hubId: ids.hub, pick: true, fieldSteps,
|
|
194
|
+
emitInput: { pickedPath: selRow },
|
|
139
195
|
});
|
|
140
196
|
const pageScopes: string[] = [];
|
|
141
197
|
const blocks: Record<string, { title: string; html: string }> = {};
|
|
142
198
|
for (const m of members) {
|
|
143
|
-
|
|
199
|
+
// 审批单 / 历史的三态面板:监听链接作用域的选中切换,选中签名按待办主键(queueKey,与枢纽 keyField 同一个)取(契约 C3)
|
|
200
|
+
const em = emitMember(out, { object: m.object, scope: m.scope, obj: m.obj, ctx, link, hubId: ids.hub, fieldSteps, selectionScope: link, selectionKeyField: queueKey });
|
|
201
|
+
// 通过 / 驳回互斥置灰:对同一张审批单的两个相反决定,任一在途另一个也不可点(F-12)
|
|
202
|
+
if (m.role === 'request') linkDecisionBusy(out.show, em.r.ir, m.object);
|
|
203
|
+
const summaryHtml = m.role === 'request' && em.r.parts.summary !== undefined ? groupSummaryButtonCells(em.r.parts.summary) : (em.r.parts.summary ?? '');
|
|
144
204
|
blocks[m.role] = {
|
|
145
205
|
title: m.title,
|
|
146
|
-
html: [em.r.parts.toolbar ?? '', em.r.parts.filter ?? '', em.listHtml,
|
|
206
|
+
html: [em.r.parts.toolbar ?? '', em.r.parts.filter ?? '', em.listHtml, summaryHtml].filter((x) => x !== '').join('\n'),
|
|
147
207
|
};
|
|
148
208
|
if (grantPageReset(out, m.scope, ids.hub)) pageScopes.push(m.scope);
|
|
149
209
|
}
|
|
@@ -165,7 +225,10 @@ export function compileApprovalDesk(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
165
225
|
props: { scope: link, keyField: queueKey, linkKey: '', autoSelect: true, afterRemove: 'next', rows: rowsPath, pageScopes },
|
|
166
226
|
};
|
|
167
227
|
out.show[ids.coord] = {
|
|
168
|
-
props: {
|
|
228
|
+
props: {
|
|
229
|
+
scope: link, objectScope: `${queueName}_scope`, object: queueName, keyField: queueKey,
|
|
230
|
+
reloads: members.map((m) => m.object), overlays: {}, rowsPath: q.r.compiled.listShape.rows, ...linkRemoveProps(out),
|
|
231
|
+
},
|
|
169
232
|
};
|
|
170
233
|
bindPickedReloads(out, ids.hub, members.map((m) => m.scope));
|
|
171
234
|
// 字段按钮的 confirm / permission 尾段带在 ACTION 管道上,由 core 在该管道上执行;动作做完的重取由 defineKitActions 固定执行
|
|
@@ -178,6 +241,8 @@ export function compileApprovalDesk(input: KitBizInput, ctx: KitBizContext): Kit
|
|
|
178
241
|
queue: { title: typeof (rawQueue as unknown as Rec).title === 'string' ? ((rawQueue as unknown as Rec).title as string) : '', html: queueHtml },
|
|
179
242
|
request: blocks.request ?? { title: '', html: '' },
|
|
180
243
|
history: blocks.history ?? null,
|
|
244
|
+
layout: input.listLayout ?? 'side',
|
|
245
|
+
...(isNextPipeline(ctx) ? { next: { queue: queueName, request: approvalDeskObjectName(ctx.pageId, 'request'), history: approvalDeskObjectName(ctx.pageId, 'history') } } : {}),
|
|
181
246
|
},
|
|
182
247
|
areaClass,
|
|
183
248
|
input.class,
|
|
@@ -1,25 +1,58 @@
|
|
|
1
1
|
// ApprovalDesk 的 HTML 代码壳:左待办队列 + 中审批单 + 右历史 / 比对三栏。只有结构与 Tailwind 类(语义色名 + utilityScales 里有的尺度),不写原生 CSS。
|
|
2
|
-
// 三栏靠容器查询变体
|
|
2
|
+
// 三栏靠容器查询变体 `@<并排线>:`(与主从同一条线,窄容器下上下堆叠)。三栏份数只有一处出处:版式契约 ApprovalDesk.grid
|
|
3
|
+
// (biz/layout-contracts.ts,经 kitFixedGridSpan 取;页面线在 next 下写 data-kit-span 读的是同一张表)——并排时左 3 / 中 5 / 右 4
|
|
4
|
+
// (共 12 份,队列栏 = 列表栏份数 KIT_LIST_PANE_SPAN = 侧栏宽上限 1/4),list_layout: top 时队列整宽在上、审批单 / 历史在下 7 / 5,
|
|
5
|
+
// 没有历史栏时审批单吃掉历史栏的份数(以上数字只是说明,取值以契约表为准)。本文件的代码不写份数数字。
|
|
3
6
|
|
|
7
|
+
import { KIT_BIZ_LAYOUT_CONTRACTS, kitFixedGridSpan } from '../layout-contracts';
|
|
8
|
+
import { kitNeutralSpanClass, kitObjectAnchor } from '../shared/pipeline';
|
|
9
|
+
import { kitSelfAttrs } from '../../shared/page-attrs-runtime';
|
|
10
|
+
import { KIT_ATTR_CONTAINER } from '../../shared/dom-attrs';
|
|
4
11
|
import { KIT_TIPS_SCOPE_ATTR } from '../../base/hint-tips';
|
|
5
12
|
import { mergeClass } from '../../shared/merge-class';
|
|
6
13
|
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
14
|
+
import { kitDividerRecipe } from '../../recipes/divider';
|
|
7
15
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
16
|
+
import { kitDefaultListPane, type KitListLayout } from '../../recipes/page-width';
|
|
8
17
|
import { cls, esc, host } from '../link/shared';
|
|
9
18
|
|
|
10
19
|
/** 壳的内部区域名(`areaClass` 的合法键) */
|
|
11
20
|
export const APPROVAL_DESK_AREAS = ['root', 'queue', 'request', 'history'] as const;
|
|
12
21
|
export type ApprovalDeskArea = (typeof APPROVAL_DESK_AREAS)[number];
|
|
13
22
|
|
|
23
|
+
/** 待办队列是列表窗格:并排线与主从同一条(SCON-122);窄于它三栏上下堆叠 */
|
|
24
|
+
const T = kitDefaultListPane().tier;
|
|
25
|
+
|
|
26
|
+
/** 版式契约登记的写死份数(ApprovalDesk.grid,by: fixed):模板画份数类与页面线写 data-kit-span 同读这一张表 */
|
|
27
|
+
const GRID = KIT_BIZ_LAYOUT_CONTRACTS.ApprovalDesk?.grid;
|
|
28
|
+
const ALL_PRESENT = (): boolean => true;
|
|
29
|
+
const NO_HISTORY = (role: string): boolean => role !== 'history';
|
|
30
|
+
/** 一栏在某形态下的份数(契约表的取值;表里没有按整行) */
|
|
31
|
+
function deskSpan(area: 'queue' | 'request' | 'history', layout: 'side' | 'top', present: (role: string) => boolean = ALL_PRESENT): number {
|
|
32
|
+
return (GRID !== undefined && GRID.by === 'fixed' ? kitFixedGridSpan(GRID, area, layout, present) : undefined) ?? 12;
|
|
33
|
+
}
|
|
34
|
+
/** 一栏的类:窄容器下整行,并排线以上取份数;份数为整行的栏只写 col-span-12 */
|
|
35
|
+
function deskColumn(span: number): string {
|
|
36
|
+
const spanClass = span >= 12 ? 'col-span-12' : `col-span-12 @${T}:col-span-${span}`;
|
|
37
|
+
return mergeClass(`${spanClass} flex min-w-0 flex-col gap-region p-card`, kitShellRecipe());
|
|
38
|
+
}
|
|
39
|
+
|
|
14
40
|
export const APPROVAL_DESK_CLASS = {
|
|
15
|
-
root: '@container flex flex-col gap-section',
|
|
41
|
+
root: '@container flex w-full min-w-0 flex-col gap-section',
|
|
16
42
|
grid: 'grid grid-cols-12 gap-section',
|
|
17
|
-
queue:
|
|
18
|
-
request:
|
|
19
|
-
history:
|
|
20
|
-
/**
|
|
21
|
-
requestWide:
|
|
22
|
-
|
|
43
|
+
queue: deskColumn(deskSpan('queue', 'side')),
|
|
44
|
+
request: deskColumn(deskSpan('request', 'side')),
|
|
45
|
+
history: deskColumn(deskSpan('history', 'side')),
|
|
46
|
+
/** 没有历史栏时审批单栏吃掉右侧历史栏的份数(契约 whenAbsent.history) */
|
|
47
|
+
requestWide: deskColumn(deskSpan('request', 'side', NO_HISTORY)),
|
|
48
|
+
// top 形态(product.list_layout: top):待办队列整宽在上,审批单 / 历史在下并排,没有历史栏时审批单整宽
|
|
49
|
+
queueTop: deskColumn(deskSpan('queue', 'top')),
|
|
50
|
+
requestTop: deskColumn(deskSpan('request', 'top')),
|
|
51
|
+
historyTop: deskColumn(deskSpan('history', 'top')),
|
|
52
|
+
requestWideTop: deskColumn(deskSpan('request', 'top', NO_HISTORY)),
|
|
53
|
+
title: mergeClass(mergeClass(kitTypographyRecipe('sectionTitle'), 'min-w-0 truncate tracking-tight pb-2'), kitDividerRecipe('bottom')),
|
|
54
|
+
/** 审批裁决动作按钮组(如「通过」「驳回」):通栏横排,不落入纵向列表分割线规则 */
|
|
55
|
+
actionRow: 'col-span-full flex flex-row flex-wrap items-center gap-cluster pt-2',
|
|
23
56
|
} as const;
|
|
24
57
|
|
|
25
58
|
export function approvalDeskIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -34,18 +67,25 @@ export interface DeskColumn {
|
|
|
34
67
|
/** 整个壳:协作组件宿主 + 三栏。区域类按 7.3 同族规则覆写 */
|
|
35
68
|
export function approvalDeskHtml(
|
|
36
69
|
ids: ReturnType<typeof approvalDeskIds>,
|
|
37
|
-
parts: { queue: DeskColumn; request: DeskColumn; history: DeskColumn | null
|
|
70
|
+
parts: { queue: DeskColumn; request: DeskColumn; history: DeskColumn | null; /** 列表窗格形态(product.list_layout,缺省 side) */ layout?: KitListLayout;
|
|
71
|
+
/** 新模式(主题流水线 next):三栏各自对象的运行期名(容器锚点据它拼);旧版不给 */ next?: Readonly<Record<'queue' | 'request' | 'history', string>> },
|
|
38
72
|
areaClass: Record<string, string>,
|
|
39
73
|
extra: string | undefined,
|
|
40
74
|
): string {
|
|
75
|
+
const top = parts.layout === 'top';
|
|
41
76
|
const col = (area: 'queue' | 'request' | 'history', c: DeskColumn, wide?: string): string => {
|
|
42
77
|
// 截断的标题悬停 / 聚焦时由 hint-tips 按需挂全文气泡(作用范围标记就在标题元素自身)
|
|
43
78
|
const title = c.title === '' ? '' : `<h3${cls(APPROVAL_DESK_CLASS.title)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(c.title)}</h3>`;
|
|
44
|
-
const base = wide === undefined ? APPROVAL_DESK_CLASS[area] : wide;
|
|
45
|
-
|
|
79
|
+
const base = wide === undefined ? APPROVAL_DESK_CLASS[top ? (`${area}Top` as 'queueTop' | 'requestTop' | 'historyTop') : area] : wide;
|
|
80
|
+
// 新模式:栏是对象的容器,补对象锚点;不写容器形态,外观类与写死的份数(col-span)都不写——份数由布局写成 data-kit-span,取值表按它取
|
|
81
|
+
if (parts.next !== undefined) {
|
|
82
|
+
const t = c.title === '' ? '' : `<h3${kitSelfAttrs({ part: 'block-title' })}${cls(APPROVAL_DESK_CLASS.title)} ${KIT_TIPS_SCOPE_ATTR}="">${esc(c.title)}</h3>`;
|
|
83
|
+
return `<section data-soma-id="${esc(kitObjectAnchor(parts.next[area]))}"${cls(kitNeutralSpanClass(mergeClass(base, areaClass[area])))}>${t}${c.html}</section>`;
|
|
84
|
+
}
|
|
85
|
+
return `<section ${KIT_ATTR_CONTAINER}="card"${cls(mergeClass(base, areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${c.html}</section>`;
|
|
46
86
|
};
|
|
47
87
|
// 没有历史栏时,审批单栏吃掉右侧 4 份
|
|
48
|
-
const requestBase = parts.history === null ? APPROVAL_DESK_CLASS.requestWide : undefined;
|
|
88
|
+
const requestBase = parts.history === null ? (top ? APPROVAL_DESK_CLASS.requestWideTop : APPROVAL_DESK_CLASS.requestWide) : undefined;
|
|
49
89
|
const cols = [col('queue', parts.queue), col('request', parts.request, requestBase)];
|
|
50
90
|
if (parts.history !== null) cols.push(col('history', parts.history));
|
|
51
91
|
const root = mergeClass(mergeClass(APPROVAL_DESK_CLASS.root, areaClass.root), extra);
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// 约定:矩阵的 from 在页面刚加载、尚未选中角色时会不带关联键取一次——约定后端「缺关联键返回空」。
|
|
11
11
|
// user 是独立的当前用户摘要,不随角色选中变化。
|
|
12
12
|
|
|
13
|
+
import { isNextPipeline } from '../shared/pipeline';
|
|
13
14
|
import type { SomaScopeMirrorDecl } from 'soma-core';
|
|
14
15
|
import { viewAnchor } from '../../object-renderer/emit-static';
|
|
15
16
|
import type { KitObject } from '../../object-renderer/types';
|
|
@@ -109,7 +110,9 @@ export function compileAuthPanel(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
109
110
|
const matrix: KitObject = matrixNorm.obj;
|
|
110
111
|
if (matrix.view?.summary !== undefined) {
|
|
111
112
|
const props = isRec(matrix.view.summary.props) ? matrix.view.summary.props : {};
|
|
112
|
-
|
|
113
|
+
// 保存在途的忙态:矩阵订阅所接保存动作的忙闲通道(busy_action = 动作名,执行器按名登记),保存钮置灰、转圈(D-12 / F-11)。
|
|
114
|
+
// 保存不经 view.on(上面取走了 save 动作、saved 手接到枢纽字段槽),emit-static 按 view.on 自动注入的那条走不到,在这里注入;页面手写的 props 优先
|
|
115
|
+
matrix.view.summary = { ...matrix.view.summary, props: { save_label: String(saveAct.name ?? ''), busy_action: saveAct.submit as string, ...props } };
|
|
113
116
|
}
|
|
114
117
|
let user: KitObject | undefined;
|
|
115
118
|
if (rawUser !== undefined) {
|
|
@@ -129,7 +132,8 @@ export function compileAuthPanel(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
129
132
|
const r = emitMember(out, {
|
|
130
133
|
object: rolesName, scope: `${rolesName}_scope`, obj: roles, ctx, link, hubId: ids.hub, pick: true, fieldSteps,
|
|
131
134
|
});
|
|
132
|
-
|
|
135
|
+
// 矩阵:监听链接作用域的选中切换,选中签名按角色主键(roleKey,与枢纽 keyField 同一个)取(契约 C3)
|
|
136
|
+
const mm = emitMember(out, { object: matrixName, scope: `${matrixName}_scope`, obj: matrix, ctx, link, hubId: ids.hub, fieldSteps, selectionScope: link, selectionKeyField: roleKey });
|
|
133
137
|
const pageScopes: string[] = [];
|
|
134
138
|
if (grantPageReset(out, `${matrixName}_scope`, ids.hub)) pageScopes.push(`${matrixName}_scope`);
|
|
135
139
|
let userHtml: { title: string; html: string } | null = null;
|
|
@@ -159,7 +163,12 @@ export function compileAuthPanel(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
159
163
|
props: { scope: link, keyField: roleKey, linkKey: '', autoSelect: true, rows: `page.data.${rolesName}.${r.r.compiled.listShape.rows}`, pageScopes },
|
|
160
164
|
};
|
|
161
165
|
out.show[ids.coord] = {
|
|
162
|
-
props: {
|
|
166
|
+
props: {
|
|
167
|
+
scope: link, objectScope: `${rolesName}_scope`, object: rolesName, keyField: roleKey,
|
|
168
|
+
reloads: [matrixName, ...(user !== undefined ? [userName] : [])],
|
|
169
|
+
...(user !== undefined ? { alwaysReloads: [userName] } : {}),
|
|
170
|
+
overlays: {}, rowsPath: r.r.compiled.listShape.rows, ...linkRemoveProps(out),
|
|
171
|
+
},
|
|
163
172
|
};
|
|
164
173
|
out.events[`${ids.hub}.picked`] = `SCOPE | window-reload | ${matrixName}_scope`;
|
|
165
174
|
bindFieldSlots(out.events, ids.hub, fieldSteps, out.diagnostics);
|
|
@@ -171,6 +180,7 @@ export function compileAuthPanel(input: KitBizInput, ctx: KitBizContext): KitFra
|
|
|
171
180
|
user: userHtml,
|
|
172
181
|
roles: { title: title(rawRoles), html: [r.r.parts.toolbar ?? '', r.r.parts.filter ?? '', r.listHtml].filter((x) => x !== '').join('\n') },
|
|
173
182
|
matrix: { title: title(rawMatrix), html: [mm.r.parts.toolbar ?? '', mm.r.parts.summary ?? ''].filter((x) => x !== '').join('\n') },
|
|
183
|
+
...(isNextPipeline(ctx) ? { next: { user: userName, roles: rolesName, matrix: matrixName } } : {}),
|
|
174
184
|
},
|
|
175
185
|
areaClass,
|
|
176
186
|
input.class,
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// AuthPanel 的 HTML 代码壳:顶部当前用户摘要,下方左角色列表 + 右权限矩阵。只有结构与 Tailwind 类,不写原生 CSS。
|
|
2
|
-
// 分栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档角色 4 / 矩阵 8(共 12
|
|
2
|
+
// 分栏靠容器查询变体 `@md:`:窄容器下上下堆叠;达到 md 档角色 4 / 矩阵 8(共 12 份)。两栏份数只有一处出处:版式契约 AuthPanel.grid
|
|
3
|
+
// (biz/layout-contracts.ts,经 kitFixedGridSpan 取;页面线在 next 下写 data-kit-span 读的是同一张表)。当前用户摘要在栅格之上整行,不在份数表里。
|
|
4
|
+
// 以上数字只是说明,取值以契约表为准;本文件的代码不写份数数字。
|
|
3
5
|
|
|
6
|
+
import { KIT_BIZ_LAYOUT_CONTRACTS, kitFixedGridSpan } from '../layout-contracts';
|
|
7
|
+
import { kitNeutralSpanClass, kitObjectAnchor } from '../shared/pipeline';
|
|
8
|
+
import { kitSelfAttrs } from '../../shared/page-attrs-runtime';
|
|
9
|
+
import { KIT_ATTR_CONTAINER } from '../../shared/dom-attrs';
|
|
4
10
|
import { mergeClass } from '../../shared/merge-class';
|
|
5
11
|
import { KIT_SHELL_FLAT_MARK, kitShellRecipe } from '../../recipes/container';
|
|
6
12
|
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
@@ -12,13 +18,21 @@ export type AuthPanelArea = (typeof AUTH_PANEL_AREAS)[number];
|
|
|
12
18
|
|
|
13
19
|
const CARD = mergeClass('flex min-w-0 flex-col gap-region p-card', kitShellRecipe());
|
|
14
20
|
|
|
21
|
+
/** 版式契约登记的写死份数(AuthPanel.grid,by: fixed):模板画份数类与页面线写 data-kit-span 同读这一张表 */
|
|
22
|
+
const GRID = KIT_BIZ_LAYOUT_CONTRACTS.AuthPanel?.grid;
|
|
23
|
+
/** 一栏的份数类:窄容器下整行,md 档以上取契约表的份数(表里没有按整行,只写 col-span-12) */
|
|
24
|
+
function panelSpanClass(area: 'roles' | 'matrix'): string {
|
|
25
|
+
const span = (GRID !== undefined && GRID.by === 'fixed' ? kitFixedGridSpan(GRID, area, 'side', () => true) : undefined) ?? 12;
|
|
26
|
+
return span >= 12 ? 'col-span-12' : `col-span-12 @md:col-span-${span}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
export const AUTH_PANEL_CLASS = {
|
|
16
|
-
root: '@container flex flex-col gap-section',
|
|
30
|
+
root: '@container flex w-full min-w-0 flex-col gap-section',
|
|
17
31
|
user: CARD,
|
|
18
32
|
grid: 'grid grid-cols-12 gap-section',
|
|
19
|
-
roles: mergeClass('
|
|
20
|
-
matrix: mergeClass('
|
|
21
|
-
title: kitTypographyRecipe('sectionTitle'),
|
|
33
|
+
roles: mergeClass(panelSpanClass('roles'), CARD),
|
|
34
|
+
matrix: mergeClass(panelSpanClass('matrix'), CARD),
|
|
35
|
+
title: mergeClass(kitTypographyRecipe('sectionTitle'), 'min-w-0 tracking-tight'),
|
|
22
36
|
} as const;
|
|
23
37
|
|
|
24
38
|
export function authPanelIds(pageId: string): { root: string; hub: string; coord: string; link: string } {
|
|
@@ -33,13 +47,19 @@ export interface AuthBlock {
|
|
|
33
47
|
/** 整个壳:协作组件宿主 + 用户摘要 + 角色 / 矩阵两栏。区域类按 7.3 同族规则覆写 */
|
|
34
48
|
export function authPanelHtml(
|
|
35
49
|
ids: ReturnType<typeof authPanelIds>,
|
|
36
|
-
parts: { user: AuthBlock | null; roles: AuthBlock; matrix: AuthBlock
|
|
50
|
+
parts: { user: AuthBlock | null; roles: AuthBlock; matrix: AuthBlock;
|
|
51
|
+
/** 新模式(主题流水线 next):三块各自对象的运行期名(容器锚点据它拼);旧版不给 */ next?: Readonly<Record<'user' | 'roles' | 'matrix', string>> },
|
|
37
52
|
areaClass: Record<string, string>,
|
|
38
53
|
extra: string | undefined,
|
|
39
54
|
): string {
|
|
40
55
|
const block = (area: 'user' | 'roles' | 'matrix', b: AuthBlock): string => {
|
|
41
56
|
const title = b.title === '' ? '' : `<h3${cls(AUTH_PANEL_CLASS.title)}>${esc(b.title)}</h3>`;
|
|
42
|
-
|
|
57
|
+
// 新模式:块是对象的容器,补对象锚点;不写容器形态、外观类与写死份数(份数由布局写成 data-kit-span)
|
|
58
|
+
if (parts.next !== undefined) {
|
|
59
|
+
const t = b.title === '' ? '' : `<h3${kitSelfAttrs({ part: 'block-title' })}${cls(AUTH_PANEL_CLASS.title)}>${esc(b.title)}</h3>`;
|
|
60
|
+
return `<section data-soma-id="${esc(kitObjectAnchor(parts.next[area]))}"${cls(kitNeutralSpanClass(mergeClass(AUTH_PANEL_CLASS[area], areaClass[area])))}>${t}${b.html}</section>`;
|
|
61
|
+
}
|
|
62
|
+
return `<section ${KIT_ATTR_CONTAINER}="card"${cls(mergeClass(AUTH_PANEL_CLASS[area], areaClass[area]))}${KIT_SHELL_FLAT_MARK}>${title}${b.html}</section>`;
|
|
43
63
|
};
|
|
44
64
|
const user = parts.user === null ? '' : `${block('user', parts.user)}\n`;
|
|
45
65
|
const root = mergeClass(mergeClass(AUTH_PANEL_CLASS.root, areaClass.root), extra);
|