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
package/src/data/kanban.ts
CHANGED
|
@@ -24,50 +24,115 @@
|
|
|
24
24
|
// 与 `change { value }`(value 为移动后的全部行,供 view.value 写回)。
|
|
25
25
|
// 点卡片抛 `select { id, item }`。data 内容变化(内容签名变)才重置本地顺序。
|
|
26
26
|
|
|
27
|
+
import { kitApplyLevelClass } from './level-class';
|
|
28
|
+
import { kitLevelClass } from '../recipes/pipeline-runtime';
|
|
27
29
|
import type { SomaComponentDefinition, SomaDataPort } from 'soma-core';
|
|
28
30
|
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
31
|
+
import { KIT_TIP_ATTR, KIT_TIPS_SCOPE_ATTR } from '../base/hint-tips';
|
|
32
|
+
import { releaseReasonTipsIn } from '../base/reason-tip';
|
|
29
33
|
import { kitKey, kitText } from '../i18n/kit-text';
|
|
30
34
|
import { createKeyboardWiring } from 'soma-core/keyboard';
|
|
31
35
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
32
36
|
import { setKitFace } from '../recipes';
|
|
37
|
+
import { KIT_DIMMED_CLASS, KIT_FOCUS_RING, kitSelectedRecipe } from '../recipes/state';
|
|
33
38
|
import { kitShellRecipe } from '../recipes/container';
|
|
39
|
+
import { kitDashedEdgeRecipe } from '../recipes/divider';
|
|
34
40
|
import { kitSurfaceRecipe } from '../recipes/surface';
|
|
35
|
-
import {
|
|
41
|
+
import { kitTypographyRecipe } from '../recipes/typography';
|
|
42
|
+
import { kitActionRecipe, kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
43
|
+
import { kitClosedValueRecipe, kitDecorFillRecipe, kitDecorToneOf } from '../recipes/field-text';
|
|
44
|
+
import { KIT_COLOR_ROLE_CLASS_CANDIDATES, kitReadHostAutoSequence, kitResolveStatusOrCategoryTone, kitToneDotClass, kitToneSoftBadgeClass } from '../recipes/color-role';
|
|
45
|
+
import { KIT_LOOK_TONE_ATTR } from '../recipes/look';
|
|
46
|
+
import { KIT_SKELETON_BAR_TITLE_MAIN, KIT_SKELETON_BAR_TITLE_SUB } from '../recipes/placeholder';
|
|
47
|
+
import { initialsOf, ROOT_CLASS as AVATAR_ROOT_CLASS } from '../base/avatar';
|
|
48
|
+
import { kitIcon } from '../shared/icons';
|
|
36
49
|
import { mergeClass } from '../shared/merge-class';
|
|
50
|
+
import { orderValueAt } from '../shared/order-value';
|
|
37
51
|
import { provideCtxRows } from './context-menu';
|
|
52
|
+
import { kitMarkDataFacts, kitMarkDragging, kitMarkLevel, kitMarkPart, kitMarkPicked } from './kit-contract';
|
|
53
|
+
import {
|
|
54
|
+
KIT_ATTR_ADD,
|
|
55
|
+
KIT_ATTR_CONTAINER,
|
|
56
|
+
KIT_ATTR_DROP_LINE,
|
|
57
|
+
KIT_ATTR_FOLD,
|
|
58
|
+
KIT_ATTR_KEY,
|
|
59
|
+
KIT_ATTR_LANE,
|
|
60
|
+
KIT_ATTR_LANE_BODY,
|
|
61
|
+
KIT_ATTR_LANE_BOX,
|
|
62
|
+
KIT_ATTR_LANE_DOT,
|
|
63
|
+
KIT_ATTR_META,
|
|
64
|
+
KIT_ATTR_MOVE,
|
|
65
|
+
KIT_ATTR_TEXT,
|
|
66
|
+
KIT_ATTR_TO,
|
|
67
|
+
KIT_ATTR_WIP_NOTICE,
|
|
68
|
+
kitAttrSel,
|
|
69
|
+
} from '../shared/dom-attrs';
|
|
38
70
|
|
|
39
71
|
// ───────── 样式常量:Tailwind 类串与候选类清单 ─────────
|
|
40
72
|
|
|
41
|
-
|
|
42
|
-
const
|
|
73
|
+
// 根用 grid-cols-1(minmax(0, 1fr))使固有最小宽为 0、最大宽随内容:窄舞台(Mode B / 窄列)零向右越界且由 BOARD_CLASS 优雅横向滚动
|
|
74
|
+
const ROOT_CLASS = 'grid w-full min-w-0 max-w-full grid-cols-1 gap-2 overflow-hidden';
|
|
75
|
+
const BOARD_CLASS = 'flex w-full min-w-0 max-w-full items-start gap-3 overflow-x-auto pb-2';
|
|
43
76
|
// 泳道 = 凹槽面的壳配方,卡片 = 壳配方(容器边 + 容器阴影令牌,KT-B2);移动菜单 = 浮起表面(KT-B4);提示条浅底无描边
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
const
|
|
77
|
+
// 长列自己滚:列设高度上限(头 / 尾 shrink-0,卡区 flex-1 overflow-y-auto);折叠态收成窄条
|
|
78
|
+
const LANE_SHELL = kitShellRecipe({ tone: 'sunken', shadow: false });
|
|
79
|
+
const LANE_CLASS = mergeClass('flex max-h-128 min-w-72 flex-1 flex-col gap-2 p-2', LANE_SHELL);
|
|
80
|
+
const LANE_FOLDED_CLASS = mergeClass('flex w-12 shrink-0 flex-col items-center gap-2 p-2', LANE_SHELL);
|
|
81
|
+
// 列头:行高 32(min-h-8,与项高同阶)、左右 8 与卡片外缘对齐(泳道 p-2 + 头 px-2 → 文字与卡片内容左缘同线于 16)
|
|
82
|
+
const PILL_ROUND = 'rounded-full';
|
|
83
|
+
const LANE_HEAD_CLASS = 'flex min-h-8 shrink-0 items-center justify-between gap-2 px-2 text-sm';
|
|
84
|
+
const LANE_HEAD_FOLDED_CLASS = 'flex shrink-0 flex-col items-center gap-2 text-sm';
|
|
85
|
+
const LANE_TITLE_CLASS = mergeClass('min-w-0 flex-1 truncate', kitTypographyRecipe('menuItem'));
|
|
86
|
+
const LANE_DOT_BASE = `size-status-dot shrink-0 ${PILL_ROUND}`;
|
|
87
|
+
const COUNT_CLASS = mergeClass(kitClosedValueRecipe('neutral'), 'shrink-0 tabular-nums');
|
|
88
|
+
const COUNT_OVER_CLASS = mergeClass(kitClosedValueRecipe('danger'), 'shrink-0 font-medium tabular-nums');
|
|
89
|
+
const KANBAN_TONE_CANDIDATES: string = (
|
|
90
|
+
['neutral', 'primary', 'info', 'success', 'warning', 'danger', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8'] as const
|
|
91
|
+
).flatMap((t) => [kitToneSoftBadgeClass(t), kitToneDotClass(t)]).join(' ');
|
|
92
|
+
// 列头动作:折叠(始终可见,aria-expanded);行内一律 row 区的轻量按钮
|
|
93
|
+
const LANE_ACTION_CLASS = kitActionRecipe('more', { tight: true, size: 'sm', region: 'row' });
|
|
94
|
+
const LANE_BODY_CLASS = 'flex min-h-16 min-w-0 flex-1 flex-col gap-2 overflow-y-auto rounded-item';
|
|
95
|
+
// 列尾添加位:整宽的轻量按钮
|
|
96
|
+
const LANE_ADD_CLASS = mergeClass(kitActionRecipe('create', { tight: true, size: 'sm', region: 'row' }), 'w-full shrink-0 justify-start gap-1');
|
|
97
|
+
// 落点线:卡间 2px 主色圆端线;原位卡半透明
|
|
98
|
+
const DROP_LINE_CLASS = `h-0.5 shrink-0 ${PILL_ROUND} bg-primary`;
|
|
99
|
+
const CARD_GHOST_CLASS = KIT_DIMMED_CLASS;
|
|
100
|
+
const SKELETON_CARD_CLASS = mergeClass('flex flex-col gap-2 p-3', kitShellRecipe({ tone: 'base', shadow: false }));
|
|
101
|
+
const AVATAR_FACE_CLASS = mergeClass(`inline-flex size-full items-center justify-center overflow-hidden ${PILL_ROUND} text-xs font-medium`, kitDecorFillRecipe());
|
|
102
|
+
const AVATAR_CLASS = `${AVATAR_ROOT_CLASS.sm} ms-auto`;
|
|
103
|
+
const META_CLASS = mergeClass(mergeClass('flex flex-wrap items-center gap-x-2 gap-y-1', kitTypographyRecipe('captionPlain')), 'text-fg-muted');
|
|
104
|
+
// 拖放占位:落点列体浅主色底 + 内收虚线框(占位语义,不叠焦点环)
|
|
105
|
+
const DROP_CLASS = 'bg-state-layer-hover outline-2 outline-dashed -outline-offset-2 outline-primary';
|
|
51
106
|
const CARD_EDGE = kitShellRecipe({ tone: 'base' });
|
|
52
|
-
const CARD_CLASS =
|
|
107
|
+
const CARD_CLASS = mergeClass(mergeClass(mergeClass('flex flex-col gap-1', CARD_EDGE), mergeClass('p-3 transition-colors state-layer', kitTypographyRecipe('text'))), KIT_FOCUS_RING.item);
|
|
53
108
|
const CARD_DRAG_CLASS = 'cursor-grab active:cursor-grabbing';
|
|
54
|
-
|
|
55
|
-
const
|
|
109
|
+
// 标题两行截断防超高;禁用卡取禁用字色
|
|
110
|
+
const CARD_TITLE_CLASS = mergeClass('line-clamp-2 break-words', kitTypographyRecipe('menuItem'));
|
|
111
|
+
const CARD_TITLE_OFF_CLASS = mergeClass(mergeClass('line-clamp-2 break-words', kitTypographyRecipe('menuItem')), 'text-fg-disabled');
|
|
112
|
+
const CARD_OFF_CLASS = 'cursor-not-allowed text-fg-disabled';
|
|
113
|
+
const FACT_CLASS = 'inline-flex min-w-0 items-baseline gap-1';
|
|
56
114
|
const FACT_VALUE_CLASS = 'truncate text-fg';
|
|
57
|
-
const EMPTY_CLASS = 'px-2 py-3 text-center
|
|
58
|
-
|
|
115
|
+
const EMPTY_CLASS = mergeClass('px-2 py-3 text-center', kitTypographyRecipe('textMuted'));
|
|
116
|
+
// 空列:虚线占位块(拖到这里 / 添加)
|
|
117
|
+
const EMPTY_LANE_CLASS = mergeClass(mergeClass('rounded-item px-2 py-3 text-center', kitDashedEdgeRecipe()), kitTypographyRecipe('textMuted'));
|
|
118
|
+
const CARD_FOOT_CLASS = 'mt-1 flex min-w-0 items-center justify-between gap-2';
|
|
119
|
+
const MOVE_BTN_CLASS = mergeClass(kitEmphasisButtonRecipe('button.toolbar', { size: 'sm', tight: true }), 'shrink-0 whitespace-nowrap gap-1');
|
|
59
120
|
const MENU_CLASS = mergeClass('flex flex-col gap-1 p-1', kitSurfaceRecipe('raised'));
|
|
60
|
-
const MENU_ITEM_CLASS = 'flex h-7 items-center rounded-
|
|
61
|
-
const NOTICE_CLASS = 'rounded-
|
|
121
|
+
const MENU_ITEM_CLASS = mergeClass(mergeClass(mergeClass('flex h-7 items-center rounded-item px-2 text-start hover:bg-state-layer-hover active:bg-state-layer-press disabled:cursor-not-allowed disabled:text-fg-subtle', kitTypographyRecipe('captionPlain')), 'text-fg'), KIT_FOCUS_RING.button);
|
|
122
|
+
const NOTICE_CLASS = mergeClass(mergeClass('rounded-item bg-warning-soft px-3 py-1.5', kitTypographyRecipe('captionPlain')), 'text-warning-on-soft');
|
|
62
123
|
const HIDDEN_CLASS = 'hidden';
|
|
63
124
|
const LIVE_CLASS = 'sr-only';
|
|
64
125
|
|
|
65
126
|
/** 本组件自带的全部类(供编译器并入候选类) */
|
|
66
127
|
export const KIT_KANBAN_CLASS_CANDIDATES: readonly string[] = Object.freeze(
|
|
67
128
|
[...new Set([
|
|
68
|
-
ROOT_CLASS, BOARD_CLASS, LANE_CLASS, LANE_HEAD_CLASS, LANE_TITLE_CLASS, COUNT_CLASS, COUNT_OVER_CLASS, LANE_BODY_CLASS,
|
|
129
|
+
ROOT_CLASS, BOARD_CLASS, LANE_CLASS, LANE_HEAD_CLASS, LANE_TITLE_CLASS, LANE_DOT_BASE, COUNT_CLASS, COUNT_OVER_CLASS, KANBAN_TONE_CANDIDATES, LANE_BODY_CLASS,
|
|
69
130
|
DROP_CLASS, CARD_CLASS, CARD_DRAG_CLASS, CARD_TITLE_CLASS, FACT_CLASS, FACT_VALUE_CLASS, EMPTY_CLASS,
|
|
70
|
-
|
|
131
|
+
LANE_FOLDED_CLASS, LANE_HEAD_FOLDED_CLASS, LANE_ACTION_CLASS, LANE_ADD_CLASS, DROP_LINE_CLASS, CARD_GHOST_CLASS, SKELETON_CARD_CLASS,
|
|
132
|
+
AVATAR_FACE_CLASS, AVATAR_CLASS, META_CLASS, CARD_TITLE_OFF_CLASS, CARD_OFF_CLASS, EMPTY_LANE_CLASS, KIT_SKELETON_BAR_TITLE_MAIN, KIT_SKELETON_BAR_TITLE_SUB,
|
|
133
|
+
kitSelectedRecipe(),
|
|
134
|
+
CARD_FOOT_CLASS, MOVE_BTN_CLASS, MENU_CLASS, MENU_ITEM_CLASS, NOTICE_CLASS, HIDDEN_CLASS, LIVE_CLASS,
|
|
135
|
+
...KIT_COLOR_ROLE_CLASS_CANDIDATES,
|
|
71
136
|
].flatMap((s) => s.split(/\s+/)).filter((c) => c !== ''))].sort(),
|
|
72
137
|
);
|
|
73
138
|
|
|
@@ -76,6 +141,7 @@ export const KIT_KANBAN_CLASS_CANDIDATES: readonly string[] = Object.freeze(
|
|
|
76
141
|
export interface KitKanbanLane {
|
|
77
142
|
value: string;
|
|
78
143
|
label: string;
|
|
144
|
+
tone?: string;
|
|
79
145
|
}
|
|
80
146
|
|
|
81
147
|
export interface KitKanbanField {
|
|
@@ -88,6 +154,8 @@ export interface KitKanbanConfig {
|
|
|
88
154
|
lanes: KitKanbanLane[];
|
|
89
155
|
title: string;
|
|
90
156
|
fields: KitKanbanField[];
|
|
157
|
+
/** 卡行尾头像取的字段(负责人名);空 = 不画头像 */
|
|
158
|
+
avatar: string;
|
|
91
159
|
wip: Record<string, number>;
|
|
92
160
|
}
|
|
93
161
|
|
|
@@ -106,7 +174,8 @@ export function kanbanConfigOf(groupRaw: unknown, lanesRaw: unknown, cardRaw: un
|
|
|
106
174
|
const value = str(r.value).trim();
|
|
107
175
|
if (value === '' || seen.has(value)) continue;
|
|
108
176
|
seen.add(value);
|
|
109
|
-
|
|
177
|
+
const tone = str(r.tone).trim();
|
|
178
|
+
lanes.push({ value, label: str(r.label).trim() || value, ...(tone !== '' ? { tone } : {}) });
|
|
110
179
|
}
|
|
111
180
|
const card = recOf(cardRaw);
|
|
112
181
|
const fields: KitKanbanField[] = [];
|
|
@@ -119,7 +188,7 @@ export function kanbanConfigOf(groupRaw: unknown, lanesRaw: unknown, cardRaw: un
|
|
|
119
188
|
for (const [k, v] of Object.entries(recOf(wipRaw))) {
|
|
120
189
|
if (typeof v === 'number' && Number.isInteger(v) && v > 0) wip[k] = v;
|
|
121
190
|
}
|
|
122
|
-
return { group: str(groupRaw).trim(), lanes, title: str(card.title).trim(), fields, wip };
|
|
191
|
+
return { group: str(groupRaw).trim(), lanes, title: str(card.title).trim(), fields, avatar: str(card.avatar).trim(), wip };
|
|
123
192
|
}
|
|
124
193
|
|
|
125
194
|
/** 把卡 id 从 rows 取出,放进 to 泳道的第 index 位(0 起,超出放末尾),并改写 group 字段。纯函数,返回新数组;找不到卡返回 null */
|
|
@@ -143,18 +212,12 @@ export function moveKanbanCard(rows: readonly Row[], idField: string, group: str
|
|
|
143
212
|
* 空泳道 -> 0;落在首位 -> 首卡序值 - 1;落在末位 -> 末卡序值 + 1;落在两卡中间 -> 两卡序值的中点。
|
|
144
213
|
* 序值不是有限数时按下标计,保证总有一个数。
|
|
145
214
|
*/
|
|
146
|
-
export
|
|
147
|
-
if (peers.length === 0) return 0;
|
|
148
|
-
const at = (i: number): number => (Number.isFinite(peers[i]) ? peers[i]! : i);
|
|
149
|
-
if (pos <= 0) return at(0) - 1;
|
|
150
|
-
if (pos >= peers.length) return at(peers.length - 1) + 1;
|
|
151
|
-
return (at(pos - 1) + at(pos)) / 2;
|
|
152
|
-
}
|
|
215
|
+
export const kanbanOrderValue = orderValueAt;
|
|
153
216
|
|
|
154
217
|
// ───────── 组件 ─────────
|
|
155
218
|
|
|
156
219
|
interface DragPortLike {
|
|
157
|
-
draggable(el: HTMLElement, source: { id: string; data: () => Record<string, unknown>; canDrag?: () => boolean }): () => void;
|
|
220
|
+
draggable(el: HTMLElement, source: { id: string; data: () => Record<string, unknown>; canDrag?: () => boolean; onDragStart?(): void; onDragEnd?(): void }): () => void;
|
|
158
221
|
dropTarget(el: HTMLElement, target: {
|
|
159
222
|
id: string; edges?: readonly ('top' | 'bottom' | 'left' | 'right')[]; onOver?(edge: unknown): void; onLeave?(): void;
|
|
160
223
|
}): () => void;
|
|
@@ -173,7 +236,10 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
173
236
|
value: { type: 'array', default: null, desc: '行数组(view.value 绑定);给了就覆盖 data' },
|
|
174
237
|
group: { type: 'string', default: '', desc: '决定泳道的字段名' },
|
|
175
238
|
lanes: { type: 'array', default: [], desc: '泳道 [{ value, label }],顺序即显示顺序' },
|
|
176
|
-
card: { type: 'object', default: {}, desc: '卡片 { title: 字段, fields?: [字段 | { field, label }] }' },
|
|
239
|
+
card: { type: 'object', default: {}, desc: '卡片 { title: 字段, fields?: [字段 | { field, label }], avatar?: 行尾头像取的字段(负责人名) };行里 disabled 为 true 的卡取禁用字色且不可拖' },
|
|
240
|
+
loading: { type: 'boolean', default: false, desc: '读取中:没有卡时每列画 3 张卡高的骨架(aria-busy),已有卡则保留' },
|
|
241
|
+
add_label: { type: 'string', default: '', desc: '非空时每列列尾出现添加位(按钮文案),点击抛 add { lane }' },
|
|
242
|
+
fold: { type: 'boolean', default: true, desc: '列头带折叠钮(折叠成窄条,aria-expanded)' },
|
|
177
243
|
wip: { type: 'object', default: {}, desc: '在制品上限 { 泳道 value: 正整数 }:缺省泳道满了不接收新卡,超限计数标红' },
|
|
178
244
|
wip_mode: { type: 'enum', values: ['hard', 'soft'], default: 'hard', desc: 'hard 硬上限(满了拒收,抛 wip_blocked);soft 软上限(只提示并抛 wip_exceeded,照常移入)' },
|
|
179
245
|
id_field: { type: 'string', default: 'id', desc: '卡主键字段名' },
|
|
@@ -194,6 +260,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
194
260
|
},
|
|
195
261
|
change: { payload: { value: { type: 'array' } }, desc: '移动后抛出,value 为移动后的全部行(view.value 写回)' },
|
|
196
262
|
select: { payload: { id: { type: 'string' }, item: { type: 'object' } }, desc: '点卡片或 Enter / Space' },
|
|
263
|
+
add: { payload: { lane: { type: 'string' } }, desc: '点列尾添加位(add_label 非空时),lane 为泳道 value' },
|
|
197
264
|
wip_blocked: { payload: { id: { type: 'string' }, to: { type: 'string' }, limit: { type: 'number' } }, desc: '目标泳道已满,移入被拒(硬上限)' },
|
|
198
265
|
wip_exceeded: { payload: { id: { type: 'string' }, to: { type: 'string' }, limit: { type: 'number' } }, desc: '目标泳道已满仍照常移入(wip_mode: soft)' },
|
|
199
266
|
},
|
|
@@ -212,6 +279,8 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
212
279
|
let sig = '';
|
|
213
280
|
let tabKey: string | null = null;
|
|
214
281
|
let menuFor: string | null = null;
|
|
282
|
+
let selectedId: string | null = null;
|
|
283
|
+
const folded = new Set<string>();
|
|
215
284
|
let pendingFocus: string | null = null;
|
|
216
285
|
let cleanups: Array<() => void> = [];
|
|
217
286
|
let offMove: (() => void) | null = null;
|
|
@@ -243,6 +312,26 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
243
312
|
return engines?.dnd ?? null;
|
|
244
313
|
};
|
|
245
314
|
|
|
315
|
+
const laneRowsMap = (cfg: KitKanbanConfig): Map<string, Row[]> => {
|
|
316
|
+
const buckets = new Map<string, Row[]>();
|
|
317
|
+
for (const l of cfg.lanes) buckets.set(l.value, []);
|
|
318
|
+
for (const r of rows) {
|
|
319
|
+
if (idOf(r) === '') continue;
|
|
320
|
+
const g = str(r[cfg.group]);
|
|
321
|
+
const list = buckets.get(g);
|
|
322
|
+
if (list !== undefined) list.push(r);
|
|
323
|
+
}
|
|
324
|
+
const f = str(P().order);
|
|
325
|
+
if (f !== '') {
|
|
326
|
+
const key = (r: Row): number => { const n = Number(r[f]); return Number.isFinite(n) ? n : Number.MAX_SAFE_INTEGER; };
|
|
327
|
+
for (const [k, list] of buckets) {
|
|
328
|
+
if (list.length > 1) {
|
|
329
|
+
buckets.set(k, list.map((r, i) => ({ r, i })).sort((a, b) => key(a.r) - key(b.r) || a.i - b.i).map((x) => x.r));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return buckets;
|
|
334
|
+
};
|
|
246
335
|
const laneRows = (cfg: KitKanbanConfig, lane: string): Row[] => {
|
|
247
336
|
const list = rows.filter((r) => idOf(r) !== '' && str(r[cfg.group]) === lane);
|
|
248
337
|
const f = str(P().order);
|
|
@@ -396,36 +485,75 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
396
485
|
return node;
|
|
397
486
|
};
|
|
398
487
|
|
|
399
|
-
|
|
488
|
+
/** 行带禁用标记:取禁用字色、不注册拖拽、不出移动钮 */
|
|
489
|
+
const rowOff = (r: Row): boolean => r.disabled === true;
|
|
400
490
|
|
|
401
|
-
const
|
|
491
|
+
const cardKeys = (cfg: KitKanbanConfig, byLane?: ReadonlyMap<string, Row[]>): string[][] => {
|
|
492
|
+
const map = byLane ?? laneRowsMap(cfg);
|
|
493
|
+
return cfg.lanes.map((l) => (map.get(l.value) ?? []).map(idOf));
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
const buildCard = (cfg: KitKanbanConfig, row: Row, lane: string, hasDnd: boolean, byLane: ReadonlyMap<string, Row[]>): HTMLElement => {
|
|
402
497
|
const id = idOf(row);
|
|
403
|
-
const
|
|
498
|
+
const off = rowOff(row);
|
|
499
|
+
// 卡自报对象面(下方 kitMarkLevel):基础外观经层级角色出口(新模式剥掉取值表负责的类);禁用 / 选中状态配方照旧追加
|
|
500
|
+
const cardBase = kitLevelClass('face', CARD_CLASS);
|
|
501
|
+
const base = off ? mergeClass(cardBase, CARD_OFF_CLASS) : selectedId === id ? mergeClass(cardBase, kitSelectedRecipe()) : cardBase;
|
|
502
|
+
const card = el('div', hasDnd && !locked() && !off ? `${base} ${CARD_DRAG_CLASS}` : base);
|
|
404
503
|
card.id = `${uid}-card-${encodeURIComponent(id).replace(/%/g, '_')}`;
|
|
405
504
|
card.setAttribute('role', 'group');
|
|
406
|
-
card.setAttribute(
|
|
407
|
-
card.setAttribute(
|
|
505
|
+
card.setAttribute(KIT_ATTR_KEY, id);
|
|
506
|
+
card.setAttribute(KIT_ATTR_LANE, lane);
|
|
507
|
+
if (off) card.setAttribute('aria-disabled', 'true');
|
|
508
|
+
if (selectedId === id) card.setAttribute('aria-current', 'true');
|
|
509
|
+
// 看板的每张卡 = 对象面;当前卡自报交互状态(aria-current 上一行已写)
|
|
510
|
+
kitMarkLevel(card, 'face');
|
|
511
|
+
kitMarkPicked(card, 'current', selectedId === id, null);
|
|
408
512
|
card.tabIndex = tabKey === id ? 0 : -1;
|
|
409
513
|
const title = cfg.title !== '' ? str(row[cfg.title]) || id : id;
|
|
410
514
|
card.setAttribute('aria-label', title);
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
515
|
+
const titleEl = el('div', off ? CARD_TITLE_OFF_CLASS : CARD_TITLE_CLASS, title);
|
|
516
|
+
titleEl.setAttribute(KIT_ATTR_TEXT, 'clamp-2');
|
|
517
|
+
kitMarkPart(titleEl, 'block-title');
|
|
518
|
+
card.appendChild(titleEl);
|
|
519
|
+
// 第 2 行:元信息(字段 label + 值,可折行)、头像在行尾
|
|
520
|
+
const owner = cfg.avatar !== '' ? str(row[cfg.avatar]).trim() : '';
|
|
521
|
+
const metas = cfg.fields.filter((f) => { const v = row[f.field]; return v !== undefined && v !== null && v !== ''; });
|
|
522
|
+
if (metas.length > 0 || owner !== '') {
|
|
523
|
+
const meta = el('div', META_CLASS);
|
|
524
|
+
meta.setAttribute(KIT_ATTR_META, '');
|
|
525
|
+
for (const f of metas) {
|
|
526
|
+
const line = el('span', FACT_CLASS);
|
|
527
|
+
line.appendChild(el('span', '', f.label));
|
|
528
|
+
line.appendChild(el('span', off ? '' : FACT_VALUE_CLASS, str(row[f.field])));
|
|
529
|
+
meta.appendChild(line);
|
|
530
|
+
}
|
|
531
|
+
if (owner !== '') {
|
|
532
|
+
const av = el('span', AVATAR_CLASS);
|
|
533
|
+
av.setAttribute('role', 'img');
|
|
534
|
+
av.setAttribute('aria-label', owner);
|
|
535
|
+
const face = el('span', AVATAR_FACE_CLASS, initialsOf(owner));
|
|
536
|
+
face.setAttribute(KIT_LOOK_TONE_ATTR, kitDecorToneOf(owner));
|
|
537
|
+
av.appendChild(face);
|
|
538
|
+
meta.appendChild(av);
|
|
539
|
+
}
|
|
540
|
+
card.appendChild(meta);
|
|
419
541
|
}
|
|
420
|
-
// 移动菜单始终提供(WCAG 2.5.7
|
|
421
|
-
if (!locked()) {
|
|
422
|
-
const
|
|
542
|
+
// 移动菜单始终提供(WCAG 2.5.7:拖放之外必须有单指针替代;有拖放端口时也不隐藏);独立底部操作行 + 紧凑不折行钮 + 下拉箭头,避免视觉呈现为截断「移到...」
|
|
543
|
+
if (!locked() && !off) {
|
|
544
|
+
const customMove = str(P().move_label);
|
|
545
|
+
const moveLabel = customMove !== '' ? customMove : kitText('soma.kit.move_to', undefined, api.host).replace(/[….]+$/u, '');
|
|
546
|
+
const btn = el('button', MOVE_BTN_CLASS);
|
|
547
|
+
btn.append(el('span', '', moveLabel), kitIcon('chevron-down', 'xs'));
|
|
423
548
|
btn.type = 'button';
|
|
424
549
|
setKitFace(btn, 'raised');
|
|
425
|
-
btn.setAttribute(
|
|
550
|
+
btn.setAttribute(KIT_ATTR_MOVE, id);
|
|
551
|
+
kitMarkPart(btn, 'action');
|
|
426
552
|
btn.setAttribute('aria-haspopup', 'menu');
|
|
427
553
|
btn.setAttribute('aria-expanded', menuFor === id ? 'true' : 'false');
|
|
428
|
-
|
|
554
|
+
const foot = el('div', CARD_FOOT_CLASS);
|
|
555
|
+
foot.appendChild(btn);
|
|
556
|
+
card.appendChild(foot);
|
|
429
557
|
if (menuFor === id) {
|
|
430
558
|
const menu = el('div', MENU_CLASS);
|
|
431
559
|
menu.setAttribute('role', 'menu');
|
|
@@ -433,8 +561,8 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
433
561
|
const item = el('button', MENU_ITEM_CLASS, l.label);
|
|
434
562
|
item.type = 'button';
|
|
435
563
|
item.setAttribute('role', 'menuitem');
|
|
436
|
-
item.setAttribute(
|
|
437
|
-
const full = !softWip() && l.value !== lane && cfg.wip[l.value] !== undefined &&
|
|
564
|
+
item.setAttribute(KIT_ATTR_TO, l.value);
|
|
565
|
+
const full = !softWip() && l.value !== lane && cfg.wip[l.value] !== undefined && (byLane.get(l.value)?.length ?? 0) >= cfg.wip[l.value]!;
|
|
438
566
|
if (l.value === lane || full) item.disabled = true;
|
|
439
567
|
menu.appendChild(item);
|
|
440
568
|
}
|
|
@@ -450,61 +578,166 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
450
578
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
451
579
|
for (const fn of cleanups) fn();
|
|
452
580
|
cleanups = [];
|
|
581
|
+
const prevBoardLeft = board.scrollLeft;
|
|
582
|
+
const prevLaneTop = new Map<string, number>();
|
|
583
|
+
for (const bodyEl of board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_LANE_BODY))) {
|
|
584
|
+
const lk = bodyEl.getAttribute(KIT_ATTR_LANE_BODY);
|
|
585
|
+
if (lk !== null) prevLaneTop.set(lk, bodyEl.scrollTop);
|
|
586
|
+
}
|
|
453
587
|
// 重绘会重建全部节点:焦点原本在卡片内(含其按钮)时记下卡主键,重绘后还回去(props 更新 / 点移动钮不丢焦点)
|
|
454
588
|
if (pendingFocus === null) {
|
|
455
589
|
const active = document.activeElement;
|
|
456
590
|
if (active instanceof HTMLElement && board.contains(active)) {
|
|
457
|
-
pendingFocus = active.closest<HTMLElement>(
|
|
591
|
+
pendingFocus = active.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))?.getAttribute(KIT_ATTR_KEY) ?? null;
|
|
458
592
|
}
|
|
459
593
|
}
|
|
460
594
|
const cfg = config();
|
|
461
595
|
const port = dndPort();
|
|
462
596
|
const hasDnd = port !== null;
|
|
463
597
|
const emptyText = str(p.empty_text, kitText('soma.kit.empty_card', undefined, api.host));
|
|
464
|
-
const
|
|
465
|
-
const
|
|
598
|
+
const byLane = laneRowsMap(cfg);
|
|
599
|
+
const byId = new Map<string, Row>();
|
|
600
|
+
for (const r of rows) {
|
|
601
|
+
const k = idOf(r);
|
|
602
|
+
if (k !== '' && !byId.has(k)) byId.set(k, r);
|
|
603
|
+
}
|
|
604
|
+
const keys = cardKeys(cfg, byLane);
|
|
605
|
+
const all = keys.filter((_, i) => !folded.has(cfg.lanes[i]!.value)).flat();
|
|
466
606
|
if (tabKey === null || !all.includes(tabKey)) tabKey = all[0] ?? null;
|
|
607
|
+
const loading = bool(p.loading);
|
|
608
|
+
if (loading) board.setAttribute('aria-busy', 'true'); else board.removeAttribute('aria-busy');
|
|
609
|
+
kitMarkDataFacts(root, { loading, empty: rows.length === 0, readonly: locked() });
|
|
610
|
+
const clearDropLine = (): void => { for (const n of board?.querySelectorAll(kitAttrSel(KIT_ATTR_DROP_LINE)) ?? []) n.remove(); };
|
|
467
611
|
|
|
612
|
+
releaseReasonTipsIn(board);
|
|
468
613
|
board.textContent = '';
|
|
469
|
-
|
|
470
|
-
|
|
614
|
+
const autoSeq = kitReadHostAutoSequence(root);
|
|
615
|
+
for (const [laneIdx, lane] of cfg.lanes.entries()) {
|
|
616
|
+
const list = byLane.get(lane.value) ?? [];
|
|
471
617
|
const limit = cfg.wip[lane.value];
|
|
472
618
|
const over = limit !== undefined && list.length > limit;
|
|
473
|
-
const
|
|
474
|
-
|
|
619
|
+
const isFolded = p.fold !== false && folded.has(lane.value);
|
|
620
|
+
const laneTone = kitResolveStatusOrCategoryTone(
|
|
621
|
+
lane.label || lane.value,
|
|
622
|
+
laneIdx,
|
|
623
|
+
{
|
|
624
|
+
...(lane.tone !== undefined ? { explicitTone: lane.tone } : {}),
|
|
625
|
+
...(autoSeq !== undefined ? { autoSequence: autoSeq } : { host: root }),
|
|
626
|
+
},
|
|
627
|
+
);
|
|
628
|
+
const col = el('section', isFolded ? LANE_FOLDED_CLASS : LANE_CLASS);
|
|
629
|
+
col.setAttribute(KIT_ATTR_CONTAINER, 'card');
|
|
475
630
|
col.setAttribute('aria-label', lane.label);
|
|
476
|
-
col.setAttribute(
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
631
|
+
col.setAttribute(KIT_ATTR_LANE_BOX, lane.value);
|
|
632
|
+
// 泳道 = 看板这张面里左右分开的窗格(窗格 › 面头;窗格 › 对象面按合法表的邻接例外放行)
|
|
633
|
+
kitMarkLevel(col, 'pane'); kitApplyLevelClass(col);
|
|
634
|
+
if (isFolded) col.setAttribute(KIT_TIP_ATTR, lane.label);
|
|
635
|
+
const head = el('div', isFolded ? LANE_HEAD_FOLDED_CLASS : LANE_HEAD_CLASS);
|
|
636
|
+
kitMarkLevel(head, 'head'); kitApplyLevelClass(head);
|
|
637
|
+
const countCls = over ? COUNT_OVER_CLASS : mergeClass(COUNT_CLASS, kitToneSoftBadgeClass(laneTone));
|
|
638
|
+
const countEl = el('span', countCls, limit !== undefined ? `${list.length}/${limit}` : String(list.length));
|
|
639
|
+
if (isFolded) countEl.setAttribute(KIT_TIP_ATTR, lane.label);
|
|
640
|
+
const laneDot = (): HTMLElement => {
|
|
641
|
+
const dot = el('span', mergeClass(LANE_DOT_BASE, kitToneDotClass(laneTone)));
|
|
642
|
+
dot.setAttribute('aria-hidden', 'true');
|
|
643
|
+
dot.setAttribute(KIT_ATTR_LANE_DOT, '');
|
|
644
|
+
return dot;
|
|
645
|
+
};
|
|
646
|
+
const laneTitle = (): HTMLElement => {
|
|
647
|
+
const node = el('span', LANE_TITLE_CLASS, lane.label);
|
|
648
|
+
kitMarkPart(node, 'block-title');
|
|
649
|
+
node.setAttribute(KIT_TIPS_SCOPE_ATTR, '');
|
|
650
|
+
return node;
|
|
651
|
+
};
|
|
652
|
+
if (p.fold !== false) {
|
|
653
|
+
const fold = el('button', LANE_ACTION_CLASS);
|
|
654
|
+
fold.type = 'button';
|
|
655
|
+
setKitFace(fold, 'raised');
|
|
656
|
+
fold.setAttribute(KIT_ATTR_FOLD, lane.value);
|
|
657
|
+
fold.setAttribute('aria-expanded', isFolded ? 'false' : 'true');
|
|
658
|
+
fold.setAttribute('aria-label', `${kitText(isFolded ? 'soma.kit.expand' : 'soma.kit.collapse', undefined, api.host)}:${lane.label}`);
|
|
659
|
+
fold.appendChild(kitIcon(isFolded ? 'chevron-right' : 'chevron-down', 'sm', 'rtl:-scale-x-100'));
|
|
660
|
+
if (isFolded) { head.appendChild(fold); head.appendChild(laneDot()); head.appendChild(countEl); } else { head.appendChild(laneDot()); head.appendChild(laneTitle()); head.appendChild(countEl); head.appendChild(fold); }
|
|
661
|
+
} else {
|
|
662
|
+
head.appendChild(laneDot());
|
|
663
|
+
head.appendChild(laneTitle());
|
|
664
|
+
head.appendChild(countEl);
|
|
665
|
+
}
|
|
480
666
|
col.appendChild(head);
|
|
667
|
+
board.appendChild(col);
|
|
668
|
+
if (isFolded) continue;
|
|
481
669
|
const body = el('div', LANE_BODY_CLASS);
|
|
482
|
-
body.setAttribute(
|
|
483
|
-
if (list.length === 0) {
|
|
484
|
-
|
|
670
|
+
body.setAttribute(KIT_ATTR_LANE_BODY, lane.value);
|
|
671
|
+
if (list.length === 0 && loading) {
|
|
672
|
+
// 加载骨架:3 张卡高的条
|
|
673
|
+
body.setAttribute('aria-hidden', 'true');
|
|
674
|
+
for (let i = 0; i < 3; i++) {
|
|
675
|
+
const sk = el('div', SKELETON_CARD_CLASS);
|
|
676
|
+
sk.appendChild(el('span', KIT_SKELETON_BAR_TITLE_MAIN));
|
|
677
|
+
sk.appendChild(el('span', KIT_SKELETON_BAR_TITLE_SUB));
|
|
678
|
+
body.appendChild(sk);
|
|
679
|
+
}
|
|
680
|
+
} else if (list.length === 0) {
|
|
681
|
+
const empty = el('div', EMPTY_LANE_CLASS, emptyText);
|
|
485
682
|
empty.setAttribute('role', 'status');
|
|
683
|
+
// 空泳道的空状态块 = 子块
|
|
684
|
+
kitMarkLevel(empty, 'sub'); kitApplyLevelClass(empty);
|
|
486
685
|
body.appendChild(empty);
|
|
487
686
|
}
|
|
488
|
-
for (const row of list) body.appendChild(buildCard(cfg, row, lane.value, hasDnd));
|
|
687
|
+
for (const row of list) body.appendChild(buildCard(cfg, row, lane.value, hasDnd, byLane));
|
|
489
688
|
col.appendChild(body);
|
|
490
|
-
|
|
689
|
+
if (str(p.add_label) !== '' && !locked()) {
|
|
690
|
+
const add = el('button', LANE_ADD_CLASS);
|
|
691
|
+
add.type = 'button';
|
|
692
|
+
setKitFace(add, 'raised');
|
|
693
|
+
add.setAttribute(KIT_ATTR_ADD, lane.value);
|
|
694
|
+
kitMarkPart(add, 'action');
|
|
695
|
+
add.appendChild(kitIcon('plus', 'sm'));
|
|
696
|
+
add.appendChild(el('span', '', str(p.add_label)));
|
|
697
|
+
col.appendChild(add);
|
|
698
|
+
}
|
|
491
699
|
|
|
492
700
|
if (port && !locked()) {
|
|
493
701
|
const over2 = (on: boolean) => (): void => { for (const c of DROP_CLASS.split(' ')) body.classList.toggle(c, on); };
|
|
494
702
|
cleanups.push(port.dropTarget(body, { id: `${uid}:lane:${lane.value}`, onOver: over2(true), onLeave: over2(false) }));
|
|
495
|
-
for (const node of body.querySelectorAll<HTMLElement>(
|
|
496
|
-
const key = node.getAttribute(
|
|
497
|
-
|
|
498
|
-
|
|
703
|
+
for (const node of body.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))) {
|
|
704
|
+
const key = node.getAttribute(KIT_ATTR_KEY)!;
|
|
705
|
+
const dragRow = byId.get(key);
|
|
706
|
+
const noDrag = dragRow !== undefined && rowOff(dragRow);
|
|
707
|
+
if (!noDrag) {
|
|
708
|
+
cleanups.push(port.draggable(node, {
|
|
709
|
+
id: `${uid}:card:${key}`, data: () => ({ id: key, lane: lane.value }),
|
|
710
|
+
// 拖拽中自报交互状态:与幽灵态类同起同落
|
|
711
|
+
onDragStart: () => { for (const c of CARD_GHOST_CLASS.split(' ')) node.classList.add(c); kitMarkDragging(node, true); },
|
|
712
|
+
onDragEnd: () => { for (const c of CARD_GHOST_CLASS.split(' ')) node.classList.remove(c); kitMarkDragging(node, false); clearDropLine(); },
|
|
713
|
+
}));
|
|
714
|
+
}
|
|
715
|
+
cleanups.push(port.dropTarget(node, {
|
|
716
|
+
id: `${uid}:card:${key}`, edges: ['top', 'bottom'],
|
|
717
|
+
onOver: (edge) => {
|
|
718
|
+
clearDropLine();
|
|
719
|
+
const line = el('div', DROP_LINE_CLASS);
|
|
720
|
+
line.setAttribute(KIT_ATTR_DROP_LINE, '');
|
|
721
|
+
line.setAttribute('aria-hidden', 'true');
|
|
722
|
+
node.parentElement?.insertBefore(line, edge === 'bottom' ? node.nextSibling : node);
|
|
723
|
+
},
|
|
724
|
+
onLeave: clearDropLine,
|
|
725
|
+
}));
|
|
499
726
|
}
|
|
500
727
|
}
|
|
501
728
|
}
|
|
502
|
-
if (cfg.lanes.length === 0)
|
|
729
|
+
if (cfg.lanes.length === 0) { const empty = el('div', EMPTY_CLASS, emptyText); kitMarkLevel(empty, 'sub'); kitApplyLevelClass(empty); board.appendChild(empty); }
|
|
503
730
|
|
|
504
731
|
if (pendingFocus !== null) {
|
|
505
|
-
const target = [...board.querySelectorAll<HTMLElement>(
|
|
732
|
+
const target = [...board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === pendingFocus);
|
|
506
733
|
pendingFocus = null;
|
|
507
|
-
target?.focus();
|
|
734
|
+
target?.focus({ preventScroll: true });
|
|
735
|
+
}
|
|
736
|
+
board.scrollLeft = prevBoardLeft;
|
|
737
|
+
for (const bodyEl of board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_LANE_BODY))) {
|
|
738
|
+
const lk = bodyEl.getAttribute(KIT_ATTR_LANE_BODY);
|
|
739
|
+
const savedTop = lk !== null ? prevLaneTop.get(lk) : undefined;
|
|
740
|
+
if (savedTop !== undefined) bodyEl.scrollTop = savedTop;
|
|
508
741
|
}
|
|
509
742
|
}
|
|
510
743
|
|
|
@@ -531,8 +764,8 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
531
764
|
const focusCard = (id: string | undefined): void => {
|
|
532
765
|
if (id === undefined || !board) return;
|
|
533
766
|
tabKey = id;
|
|
534
|
-
for (const n of board.querySelectorAll<HTMLElement>(
|
|
535
|
-
[...board.querySelectorAll<HTMLElement>(
|
|
767
|
+
for (const n of board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))) n.tabIndex = n.getAttribute(KIT_ATTR_KEY) === id ? 0 : -1;
|
|
768
|
+
[...board.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === id)?.focus();
|
|
536
769
|
};
|
|
537
770
|
|
|
538
771
|
// 泳道内的纵向导航走 core 的共享键盘接线:集合 = 当前泳道的卡(按键前由 onKeydown 填),游标 = 焦点卡
|
|
@@ -557,9 +790,9 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
557
790
|
const target = e.target as HTMLElement | null;
|
|
558
791
|
// 菜单内:↑↓ 走项、Esc 关闭,其余交给按钮本身
|
|
559
792
|
const menuItem = target?.closest<HTMLElement>('[role="menuitem"]');
|
|
560
|
-
const cardEl = target?.closest<HTMLElement>(
|
|
793
|
+
const cardEl = target?.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY));
|
|
561
794
|
if (!cardEl) return;
|
|
562
|
-
const id = cardEl.getAttribute(
|
|
795
|
+
const id = cardEl.getAttribute(KIT_ATTR_KEY)!;
|
|
563
796
|
if (menuItem) {
|
|
564
797
|
const items = [...cardEl.querySelectorAll<HTMLButtonElement>('[role="menuitem"]')].filter((b) => !b.disabled);
|
|
565
798
|
const at = items.indexOf(menuItem as HTMLButtonElement);
|
|
@@ -580,7 +813,10 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
580
813
|
const key = kitKey(e.key, root);
|
|
581
814
|
if (key === 'Enter' || key === ' ') {
|
|
582
815
|
e.preventDefault();
|
|
816
|
+
selectedId = id;
|
|
817
|
+
pendingFocus = id;
|
|
583
818
|
api.emit('select', { id, item: rows.find((r) => idOf(r) === id) ?? {} });
|
|
819
|
+
paint();
|
|
584
820
|
return;
|
|
585
821
|
}
|
|
586
822
|
if ((key === 'm' || key === 'M') && !e.altKey && !e.ctrlKey && !e.metaKey && !locked()) {
|
|
@@ -589,7 +825,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
589
825
|
pendingFocus = menuFor === null ? id : null;
|
|
590
826
|
paint();
|
|
591
827
|
if (menuFor !== null) {
|
|
592
|
-
[...board!.querySelectorAll<HTMLElement>(
|
|
828
|
+
[...board!.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === id)
|
|
593
829
|
?.querySelector<HTMLElement>('[role="menuitem"]:not(:disabled)')?.focus();
|
|
594
830
|
}
|
|
595
831
|
return;
|
|
@@ -618,7 +854,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
618
854
|
}
|
|
619
855
|
e.preventDefault();
|
|
620
856
|
let nl = li + horizontal;
|
|
621
|
-
while (nl >= 0 && nl < keys.length && keys[nl]!.length === 0) nl += horizontal;
|
|
857
|
+
while (nl >= 0 && nl < keys.length && (keys[nl]!.length === 0 || folded.has(cfg.lanes[nl]!.value))) nl += horizontal;
|
|
622
858
|
const col = keys[nl];
|
|
623
859
|
if (col) focusCard(col[Math.min(ci, col.length - 1)]);
|
|
624
860
|
};
|
|
@@ -626,27 +862,43 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
626
862
|
const onClick = (event: Event): void => {
|
|
627
863
|
const target = event.target as HTMLElement | null;
|
|
628
864
|
if (!target) return;
|
|
629
|
-
const
|
|
630
|
-
|
|
865
|
+
const foldBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_FOLD));
|
|
866
|
+
if (foldBtn) {
|
|
867
|
+
const lane = foldBtn.getAttribute(KIT_ATTR_FOLD)!;
|
|
868
|
+
if (folded.has(lane)) folded.delete(lane); else folded.add(lane);
|
|
869
|
+
paint();
|
|
870
|
+
[...board!.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_FOLD))].find((n) => n.getAttribute(KIT_ATTR_FOLD) === lane)?.focus();
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
const addBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_ADD));
|
|
874
|
+
if (addBtn) {
|
|
875
|
+
api.emit('add', { lane: addBtn.getAttribute(KIT_ATTR_ADD)! });
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const toBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_TO));
|
|
879
|
+
const cardEl = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_KEY));
|
|
631
880
|
if (toBtn && cardEl) {
|
|
632
|
-
move(cardEl.getAttribute(
|
|
881
|
+
move(cardEl.getAttribute(KIT_ATTR_KEY)!, toBtn.getAttribute(KIT_ATTR_TO)!, laneRows(config(), toBtn.getAttribute(KIT_ATTR_TO)!).length);
|
|
633
882
|
return;
|
|
634
883
|
}
|
|
635
|
-
const moveBtn = target.closest<HTMLElement>(
|
|
884
|
+
const moveBtn = target.closest<HTMLElement>(kitAttrSel(KIT_ATTR_MOVE));
|
|
636
885
|
if (moveBtn) {
|
|
637
|
-
const id = moveBtn.getAttribute(
|
|
886
|
+
const id = moveBtn.getAttribute(KIT_ATTR_MOVE)!;
|
|
638
887
|
menuFor = menuFor === id ? null : id;
|
|
639
888
|
paint();
|
|
640
889
|
if (menuFor !== null) {
|
|
641
|
-
[...board!.querySelectorAll<HTMLElement>(
|
|
890
|
+
[...board!.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_KEY))].find((n) => n.getAttribute(KIT_ATTR_KEY) === id)
|
|
642
891
|
?.querySelector<HTMLElement>('[role="menuitem"]:not(:disabled)')?.focus();
|
|
643
892
|
}
|
|
644
893
|
return;
|
|
645
894
|
}
|
|
646
895
|
if (cardEl) {
|
|
647
|
-
const id = cardEl.getAttribute(
|
|
896
|
+
const id = cardEl.getAttribute(KIT_ATTR_KEY)!;
|
|
648
897
|
tabKey = id;
|
|
898
|
+
selectedId = id;
|
|
899
|
+
pendingFocus = id;
|
|
649
900
|
api.emit('select', { id, item: rows.find((r) => idOf(r) === id) ?? {} });
|
|
901
|
+
paint();
|
|
650
902
|
}
|
|
651
903
|
};
|
|
652
904
|
|
|
@@ -656,7 +908,7 @@ export function createKanban(): SomaComponentDefinition {
|
|
|
656
908
|
root.textContent = '';
|
|
657
909
|
noticeEl = el('div', HIDDEN_CLASS);
|
|
658
910
|
noticeEl.setAttribute('role', 'alert');
|
|
659
|
-
noticeEl.setAttribute(
|
|
911
|
+
noticeEl.setAttribute(KIT_ATTR_WIP_NOTICE, '');
|
|
660
912
|
board = el('div', BOARD_CLASS);
|
|
661
913
|
live = el('div', LIVE_CLASS);
|
|
662
914
|
live.setAttribute('role', 'status');
|