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/row-editor.ts
CHANGED
|
@@ -12,27 +12,40 @@
|
|
|
12
12
|
// 假则组件不改行,由页面改 data.rows(受控,页面可在 add 里再做业务校验并写 data.error)。
|
|
13
13
|
// 录入草稿在组件内,重画与 columns 选项变化都不丢;数据只经 textContent / value 写入。
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import { kitApplyLevelClass } from './level-class';
|
|
16
|
+
import type { SomaComponentDefinition, SomaDataPort } from 'soma-core';
|
|
16
17
|
import { applyCommon, bool, createKitController, FIELD_CLASS, formatValue, ID_PROPS, INVALID_PROPS, joinClass, nextUid, num, str, type KitApi } from '../base/shared';
|
|
17
18
|
import { kitText, type KitTextKey } from '../i18n/kit-text';
|
|
18
19
|
import { setKitFace } from '../recipes';
|
|
20
|
+
import { KIT_FOCUS_RING } from '../recipes/state';
|
|
21
|
+
import { kitActionRecipe } from '../recipes/emphasis';
|
|
19
22
|
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
20
23
|
import { KIT_DIVIDER_FOOT_CLASS, KIT_DIVIDER_HEAD_CLASS, kitDividerRecipe } from '../recipes/divider';
|
|
21
24
|
import { KIT_BUSY_PROP_DEFS, kitBusyOf } from '../base/action-busy';
|
|
22
25
|
import { KIT_DATE_CLASS_CANDIDATES, mountKitDateField } from '../base/date';
|
|
23
26
|
import { KIT_LISTBOX_CLASS_CANDIDATES } from '../base/listbox-core';
|
|
24
|
-
import {
|
|
27
|
+
import { createSelect } from '../base/select';
|
|
28
|
+
import { createKitEmbedBag, mountKitComponent, type KitEmbedBag } from './embed';
|
|
25
29
|
import { fetchRemoteOptionRows } from './remote-options';
|
|
26
30
|
import { actionButton, BUTTON_CLASS_TOKENS, classTokens, emptyNode, mk, recOf, retryButton, rowsOf, textOf, TONE_SOFT } from './shape-util';
|
|
27
|
-
import { TEXT_ACTION_CLASS_TOKENS
|
|
28
|
-
import
|
|
31
|
+
import { TEXT_ACTION_CLASS_TOKENS } from './text-action-button';
|
|
32
|
+
import { KIT_ALIGN_CLASS, kitFieldPropsOf, kitHasOwnAlign, kitMarkDataFacts, kitMarkLevel, kitMarkPart } from './kit-contract';
|
|
33
|
+
import { kitApplyCols, kitColsGrid, kitStripGridCols } from '../base/kit-contract';
|
|
34
|
+
import { kitIsNextRuntime } from '../recipes/pipeline-runtime';
|
|
29
35
|
import { askKitConfirm } from './confirm-dialog';
|
|
30
36
|
import { watchKitOutcome } from './outcome-watch';
|
|
31
37
|
import { stagedDiff, stagedHeadKeys, stagedMarks, stagedModel } from './staged-rows';
|
|
32
38
|
import { testRegexGuarded } from 'soma-foundation/predicates';
|
|
39
|
+
import { kitWellRecipe } from '../recipes/surface';
|
|
40
|
+
import { mergeClass } from '../shared/merge-class';
|
|
41
|
+
import {
|
|
42
|
+
KIT_ATTR_ACTION, KIT_ATTR_BUSY, KIT_ATTR_CELL, KIT_ATTR_CELL_ERROR, KIT_ATTR_COLLAPSE, KIT_ATTR_CONTAINER, KIT_ATTR_FIELD, KIT_ATTR_FOOTER, KIT_ATTR_INDEX,
|
|
43
|
+
KIT_ATTR_OPTION_KEY, KIT_ATTR_REMOTE_WRAP, KIT_ATTR_RO_INDEX, KIT_ATTR_RO_SELECT, KIT_ATTR_ROW, KIT_ATTR_SELECT_HOST, KIT_ATTR_STAGE,
|
|
44
|
+
KIT_ATTR_STAGE_MARK, KIT_ATTR_TOTAL, KIT_ATTR_VALUE, kitAttrSel,
|
|
45
|
+
} from '../shared/dom-attrs';
|
|
33
46
|
|
|
34
47
|
// 集合本地草稿(staged):未同步条与行小标的类串(条与小标的语气取 warning-soft)
|
|
35
|
-
const STAGE_BAR_CLASS = `flex flex-wrap items-center justify-between gap-2 rounded-
|
|
48
|
+
const STAGE_BAR_CLASS = `flex flex-wrap items-center justify-between gap-2 rounded-item px-3 py-2 text-sm ${TONE_SOFT.warning}`;
|
|
36
49
|
const STAGE_BTNS_CLASS = 'flex items-center gap-2';
|
|
37
50
|
const STAGE_MARK_CLASS = `ms-2 rounded-full px-2 py-0.5 text-xs font-medium ${TONE_SOFT.warning}`;
|
|
38
51
|
const STAGE_NOTE_CLASS = 'w-full text-xs';
|
|
@@ -48,7 +61,8 @@ const FORM_COLS: Readonly<Record<number, string>> = Object.freeze({
|
|
|
48
61
|
5: 'grid-cols-1 @md:grid-cols-3 @2xl:grid-cols-5', 6: 'grid-cols-1 @md:grid-cols-3 @2xl:grid-cols-6',
|
|
49
62
|
});
|
|
50
63
|
|
|
51
|
-
|
|
64
|
+
// 子表 = 子块(层级策略 sub:纸面 N1 凹槽、细线档上下两线、扁平档起始边线;2026-11-25 第 4 关),里面的输入框保持白底 + 控件轮廓
|
|
65
|
+
const ROOT_CLASS = 'sub-block flex flex-col gap-3 p-3';
|
|
52
66
|
const TITLE_CLASS = 'text-sm font-semibold text-fg';
|
|
53
67
|
const HINT_CLASS = 'text-xs text-fg-subtle';
|
|
54
68
|
// 表头 / 行 / 合计行的线只经分隔线出口(发丝宽、分隔灰,KT-B1 / KT-B5)
|
|
@@ -74,28 +88,49 @@ const LABEL_CLASS = 'text-xs font-medium text-fg-muted';
|
|
|
74
88
|
const REQUIRED_MARK = 'text-danger-on-soft';
|
|
75
89
|
const TEXTAREA_LIKE = 'font-mono';
|
|
76
90
|
const ERROR_CLASS = 'text-sm text-danger-on-soft';
|
|
77
|
-
const LIST_WRAP = 'flex flex-col';
|
|
91
|
+
const LIST_WRAP = 'flex flex-col overflow-x-auto';
|
|
78
92
|
const NUM_ALIGN = 'text-end tabular-nums';
|
|
79
93
|
const FOOTER_ROW_CLASS = `grid grid-cols-12 items-center gap-2 ${KIT_DIVIDER_FOOT_CLASS} px-2 py-2 text-sm font-semibold text-fg`;
|
|
80
94
|
const HEAD_END_CLASS = toFlexRow(HEAD_CLASS);
|
|
81
95
|
const ROW_END_CLASS = toFlexRow(ROW_CLASS);
|
|
82
96
|
const FOOTER_END_CLASS = toFlexRow(FOOTER_ROW_CLASS);
|
|
97
|
+
const colMinWidth = (c: KitRowColumn): string => (c.kind === 'bool' ? 'min-w-20' : c.kind === 'number' ? 'min-w-24' : 'min-w-28');
|
|
83
98
|
const COUNT_CLASS = 'text-xs text-fg-subtle';
|
|
84
|
-
/**
|
|
85
|
-
const CELL_ERROR_CLASS = 'ring-1 ring-danger';
|
|
86
|
-
const DATE_FIELD_CLASS =
|
|
99
|
+
/** 出错单元格的外框(令牌色环 + 控件圆角消除直角刺眼,不撑行高) */
|
|
100
|
+
const CELL_ERROR_CLASS = 'ring-1 ring-danger rounded-control';
|
|
101
|
+
const DATE_FIELD_CLASS = mergeClass(
|
|
102
|
+
`block h-control w-full rounded-control ${DATE_EDGE} bg-surface ps-3 pe-8 text-sm text-fg transition-colors placeholder:text-fg-subtle ${KIT_FOCUS_RING.control} aria-invalid:border-danger disabled:cursor-not-allowed disabled:bg-control-disabled disabled:text-fg-disabled`,
|
|
103
|
+
kitWellRecipe('read-only'),
|
|
104
|
+
);
|
|
105
|
+
/** 行内删除:成行的按钮是轻按钮,危险语气只在决策点(确认框)取实底 —— 行区(region: row)的删除走 dangerSoft(设计稿 3.1″) */
|
|
106
|
+
const ROW_REMOVE_CLASS = kitActionRecipe('delete', { region: 'row' });
|
|
87
107
|
|
|
88
108
|
export const KIT_ROW_EDITOR_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
89
109
|
ROOT_CLASS, TITLE_CLASS, HINT_CLASS, HEAD_CLASS, ROW_CLASS, CELL_CLASS, CELL_MONO, CELL_MUTED, END_CLASS, FORM_CLASS, FIELD_WRAP,
|
|
90
110
|
LABEL_CLASS, REQUIRED_MARK, TEXTAREA_LIKE, ERROR_CLASS, LIST_WRAP, Object.values(SPAN_CLASS), Object.values(FORM_COLS),
|
|
91
|
-
FIELD_CLASS.md, BUTTON_CLASS_TOKENS, TEXT_ACTION_CLASS_TOKENS, 'self-end', '@container', NUM_ALIGN, FOOTER_ROW_CLASS,
|
|
111
|
+
FIELD_CLASS.md, BUTTON_CLASS_TOKENS, ROW_REMOVE_CLASS, TEXT_ACTION_CLASS_TOKENS, 'self-end', '@container', NUM_ALIGN, FOOTER_ROW_CLASS,
|
|
112
|
+
HEAD_END_CLASS, ROW_END_CLASS, FOOTER_END_CLASS, END_FLEX_CLASS, Object.values(FLEX_SPAN).join(' '), COUNT_CLASS, CELL_ERROR_CLASS, DATE_FIELD_CLASS,
|
|
113
|
+
KIT_DATE_CLASS_CANDIDATES, KIT_LISTBOX_CLASS_CANDIDATES,
|
|
92
114
|
STAGE_BAR_CLASS, STAGE_BTNS_CLASS, STAGE_MARK_CLASS, STAGE_NOTE_CLASS, 'sr-only',
|
|
115
|
+
'min-w-20', 'min-w-24', 'min-w-28', 'min-w-120',
|
|
93
116
|
);
|
|
94
117
|
|
|
95
118
|
// ── 数据规整纯函数:列声明、单元格文字、录入校验、草稿转行 ──
|
|
96
119
|
|
|
97
120
|
export type KitRowColumnKind = 'text' | 'select' | 'bool' | 'json' | 'number' | 'money' | 'date';
|
|
98
121
|
|
|
122
|
+
/**
|
|
123
|
+
* 列对齐类:页面线给了字段级逻辑对齐(props.kit.fields[列键].align)时按它,表头、单元格、合计格同一个值;
|
|
124
|
+
* 没给时保持原缺省(数值列止对齐 + 等宽数字,其余不加类)。数值列不论对齐方向都保留等宽数字,数字才对得齐。
|
|
125
|
+
*/
|
|
126
|
+
function columnAlignClass(p: Record<string, unknown>, c: KitRowColumn, base = ''): string {
|
|
127
|
+
const align = kitFieldPropsOf(p, c.key).align;
|
|
128
|
+
const numeric = isNumericRowKind(c.kind);
|
|
129
|
+
if (align === undefined) return numeric ? ` ${NUM_ALIGN}` : '';
|
|
130
|
+
// 自己已有的优先(与 base/kit-contract.ts#kitMergeAlignOverflow 同一条):格类串里已有文本对齐时页面线的逻辑对齐不再叠加
|
|
131
|
+
return `${kitHasOwnAlign(base) ? '' : ` ${KIT_ALIGN_CLASS[align]}`}${numeric ? ' tabular-nums' : ''}`;
|
|
132
|
+
}
|
|
133
|
+
|
|
99
134
|
/** 数值列(右对齐、可合计) */
|
|
100
135
|
export function isNumericRowKind(kind: KitRowColumnKind): boolean {
|
|
101
136
|
return kind === 'number' || kind === 'money';
|
|
@@ -399,6 +434,61 @@ export function validateInlineRows(
|
|
|
399
434
|
|
|
400
435
|
// ── 组件 ──
|
|
401
436
|
|
|
437
|
+
interface RowSelectHandle {
|
|
438
|
+
el: HTMLElement;
|
|
439
|
+
input: HTMLInputElement;
|
|
440
|
+
field: HTMLElement;
|
|
441
|
+
setOptions(options: ReadonlyArray<{ value: string; label: string }>): void;
|
|
442
|
+
setProps(patch: Record<string, unknown>): void;
|
|
443
|
+
dispose(): void;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function mountRowSelect(opts: {
|
|
447
|
+
options: ReadonlyArray<{ value: string; label: string }>;
|
|
448
|
+
value: string;
|
|
449
|
+
placeholder: string;
|
|
450
|
+
ariaLabel: string;
|
|
451
|
+
doc?: Document;
|
|
452
|
+
}): RowSelectHandle {
|
|
453
|
+
const ownerDoc = opts.doc ?? document;
|
|
454
|
+
const stage = ownerDoc.createElement('div');
|
|
455
|
+
let input: HTMLInputElement | null = null;
|
|
456
|
+
const mount = mountKitComponent(createSelect(), stage, {
|
|
457
|
+
options: opts.options.map((o) => ({ ...o })),
|
|
458
|
+
value: opts.value,
|
|
459
|
+
placeholder: opts.placeholder,
|
|
460
|
+
size: 'md',
|
|
461
|
+
aria_label: opts.ariaLabel,
|
|
462
|
+
}, {
|
|
463
|
+
change: (payload: { value?: unknown }) => {
|
|
464
|
+
const next = payload?.value === undefined || payload.value === null ? '' : String(payload.value);
|
|
465
|
+
mount.setProps({ value: next });
|
|
466
|
+
if (input) {
|
|
467
|
+
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
468
|
+
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
});
|
|
472
|
+
const el = mount.host;
|
|
473
|
+
el.remove();
|
|
474
|
+
const field = el.querySelector<HTMLElement>('[role="combobox"]') ?? el;
|
|
475
|
+
input = el.querySelector<HTMLInputElement>(`input${kitAttrSel(KIT_ATTR_VALUE)}`);
|
|
476
|
+
if (input === null) {
|
|
477
|
+
input = ownerDoc.createElement('input');
|
|
478
|
+
input.type = 'hidden';
|
|
479
|
+
input.setAttribute(KIT_ATTR_VALUE, '');
|
|
480
|
+
el.appendChild(input);
|
|
481
|
+
}
|
|
482
|
+
return {
|
|
483
|
+
el,
|
|
484
|
+
input,
|
|
485
|
+
field,
|
|
486
|
+
setOptions: (options) => mount.setProps({ options: options.map((o) => ({ ...o })) }),
|
|
487
|
+
setProps: (patch) => mount.setProps(patch),
|
|
488
|
+
dispose: () => mount.destroy(),
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
|
|
402
492
|
interface EditorState {
|
|
403
493
|
columnsSig: string;
|
|
404
494
|
draft: Record<string, string>;
|
|
@@ -415,6 +505,10 @@ interface EditorState {
|
|
|
415
505
|
emittedSnapshots: string[];
|
|
416
506
|
/** 行内编辑的单元格控件(自绘下拉 / 日期框):行表重建前统一释放 */
|
|
417
507
|
cellEmbeds: KitEmbedBag;
|
|
508
|
+
/** 录入区已挂载的远程候选 Select 实例(供异步选项返回时原地 setOptions 更新,不打断其它框焦点) */
|
|
509
|
+
entrySelects: Map<string, { handle: RowSelectHandle; wrap: HTMLElement }>;
|
|
510
|
+
/** 行内编辑区已挂载的远程候选 Select 实例 */
|
|
511
|
+
inlineSelects: Array<{ handle: RowSelectHandle; colKey: string; rowIndex: number; wrap: HTMLElement }>;
|
|
418
512
|
nodes: { list: HTMLElement; form: HTMLElement; err: HTMLElement; title: HTMLElement; hint: HTMLElement; count: HTMLElement } | null;
|
|
419
513
|
/** 录入区命令式嵌入的自绘下拉 / 日期框:录入区重建与卸载前统一释放(含已展开的浮层) */
|
|
420
514
|
embeds: KitEmbedBag;
|
|
@@ -424,7 +518,14 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
424
518
|
const states = new WeakMap<HTMLElement, EditorState>();
|
|
425
519
|
const stateOf = (root: HTMLElement): EditorState => {
|
|
426
520
|
let s = states.get(root);
|
|
427
|
-
if (!s) {
|
|
521
|
+
if (!s) {
|
|
522
|
+
s = {
|
|
523
|
+
columnsSig: '', draft: {}, rows: [], rowsSig: '', localError: '', cellErrors: [], cellErrSig: '',
|
|
524
|
+
pendingClear: false, listSig: '', emittedSnapshots: [], cellEmbeds: createKitEmbedBag(),
|
|
525
|
+
entrySelects: new Map(), inlineSelects: [], nodes: null, embeds: createKitEmbedBag(),
|
|
526
|
+
};
|
|
527
|
+
states.set(root, s);
|
|
528
|
+
}
|
|
428
529
|
return s;
|
|
429
530
|
};
|
|
430
531
|
const recordSnapshot = (st: EditorState): void => {
|
|
@@ -466,15 +567,38 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
466
567
|
interface RemoteSlot { state: 'loading' | 'ok' | 'failed'; options: Array<{ value: string; label: string }> }
|
|
467
568
|
const remotes = new WeakMap<HTMLElement, Map<string, RemoteSlot>>();
|
|
468
569
|
const optionsKeyOf = (of: KitRowOptionsFrom): string => JSON.stringify([of.from, of.params, of.rowsPath, of.valueKey, of.labelKey]);
|
|
469
|
-
const
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
570
|
+
const colsStructOf = (cols: readonly KitRowColumn[]): unknown[] => cols.map((c) => (
|
|
571
|
+
c.optionsFrom === null
|
|
572
|
+
? c
|
|
573
|
+
: { ...c, options: [], optionsError: false, optionsRetryState: undefined, optionsRetryLabel: undefined, placeholder: '' }
|
|
574
|
+
));
|
|
575
|
+
const syncOptionsRetryDom = (box: HTMLElement, column: KitRowColumn): void => {
|
|
576
|
+
const existing = box.querySelector<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACTION, 'options_retry'));
|
|
577
|
+
const need = (column.optionsRetryState === 'failed' || column.optionsRetryState === 'loading') && column.optionsKey !== undefined;
|
|
578
|
+
if (!need) {
|
|
579
|
+
existing?.remove();
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
473
582
|
const loading = column.optionsRetryState === 'loading';
|
|
474
|
-
const
|
|
475
|
-
|
|
583
|
+
const label = column.optionsRetryLabel ?? kitText(loading ? 'soma.kit.rows_options_loading' : 'soma.kit.ct_retry');
|
|
584
|
+
if (existing) {
|
|
585
|
+
existing.textContent = label;
|
|
586
|
+
existing.setAttribute(KIT_ATTR_OPTION_KEY, column.optionsKey!);
|
|
587
|
+
if (loading) existing.setAttribute('aria-disabled', 'true');
|
|
588
|
+
else existing.removeAttribute('aria-disabled');
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const retry = retryButton('options_retry', label);
|
|
592
|
+
retry.setAttribute(KIT_ATTR_OPTION_KEY, column.optionsKey!);
|
|
476
593
|
if (loading) retry.setAttribute('aria-disabled', 'true');
|
|
477
594
|
box.appendChild(retry);
|
|
595
|
+
};
|
|
596
|
+
const withOptionsRetry = (holder: HTMLElement, column: KitRowColumn): HTMLElement => {
|
|
597
|
+
if (column.optionsKey === undefined) return holder;
|
|
598
|
+
const box = mk('span', FIELD_WRAP);
|
|
599
|
+
box.setAttribute(KIT_ATTR_REMOTE_WRAP, column.optionsKey);
|
|
600
|
+
box.appendChild(holder);
|
|
601
|
+
syncOptionsRetryDom(box, column);
|
|
478
602
|
return box;
|
|
479
603
|
};
|
|
480
604
|
/** 把远程选项叠到列声明上(纯叠加;取数在这里发起,回来后整体重绘) */
|
|
@@ -587,7 +711,7 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
587
711
|
stg.bar = mk('div', '');
|
|
588
712
|
stg.bar.setAttribute('role', 'status');
|
|
589
713
|
stg.bar.setAttribute('aria-live', 'polite');
|
|
590
|
-
stg.bar.setAttribute(
|
|
714
|
+
stg.bar.setAttribute(KIT_ATTR_STAGE, '');
|
|
591
715
|
root.insertBefore(stg.bar, nodes.list);
|
|
592
716
|
}
|
|
593
717
|
const keys = stagedHeadKeys(diff);
|
|
@@ -602,7 +726,7 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
602
726
|
inner.appendChild(mk('span', '', `${kitText('soma.kit.stage_unsynced', { n: diff.count, added: diff.added.length, changed: diff.changed.length, removed: diff.removed.length }, root)}${keys.length > 0 ? `(${keys.join(kitText('soma.kit.list_sep', undefined, root))}${more})` : ''}`));
|
|
603
727
|
const btns = mk('div', STAGE_BTNS_CLASS);
|
|
604
728
|
btns.appendChild(actionButton({ key: 'stage_discard', label: kitText('soma.kit.stage_discard', undefined, root), tone: 'neutral', disabled: stg.syncing, reason: '' }));
|
|
605
|
-
btns.appendChild(actionButton({ key: 'stage_sync', label: kitText(stg.syncing ? 'soma.kit.stage_syncing' : 'soma.kit.stage_sync', undefined, root),
|
|
729
|
+
btns.appendChild(actionButton({ key: 'stage_sync', label: kitText(stg.syncing ? 'soma.kit.stage_syncing' : 'soma.kit.stage_sync', undefined, root), fn: 'apply', disabled: stg.syncing, reason: '' }));
|
|
606
730
|
inner.appendChild(btns);
|
|
607
731
|
if (stg.failMsg !== '') inner.appendChild(mk('p', STAGE_NOTE_CLASS, kitText('soma.kit.stage_failed', { message: stg.failMsg }, root)));
|
|
608
732
|
if (stg.stale) inner.appendChild(mk('p', STAGE_NOTE_CLASS, kitText('soma.kit.stage_stale', undefined, root)));
|
|
@@ -611,13 +735,13 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
611
735
|
}
|
|
612
736
|
// 行小标:工作副本第 i 行 <-> 行表第 i 个 [data-kit-row](表头与合计行没有该属性)
|
|
613
737
|
const marks = stagedMarks(stg.base ?? st.rows, st.rows, key);
|
|
614
|
-
nodes.list.querySelectorAll<HTMLElement>(
|
|
615
|
-
tr.querySelector(
|
|
738
|
+
nodes.list.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_ROW)).forEach((tr, i) => {
|
|
739
|
+
tr.querySelector(kitAttrSel(KIT_ATTR_STAGE_MARK))?.remove();
|
|
616
740
|
const m = marks[i];
|
|
617
741
|
const host = tr.firstElementChild;
|
|
618
742
|
if (!m || !host) return;
|
|
619
743
|
const tag = mk('span', STAGE_MARK_CLASS, kitText(m === 'new' ? 'soma.kit.stage_new' : 'soma.kit.stage_edited', undefined, root));
|
|
620
|
-
tag.setAttribute(
|
|
744
|
+
tag.setAttribute(KIT_ATTR_STAGE_MARK, m);
|
|
621
745
|
host.appendChild(tag);
|
|
622
746
|
});
|
|
623
747
|
if (diff.count !== stg.lastCount) {
|
|
@@ -716,7 +840,7 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
716
840
|
},
|
|
717
841
|
},
|
|
718
842
|
services: ['data', 'http'],
|
|
719
|
-
templateHtml: `<section
|
|
843
|
+
templateHtml: `<section ${KIT_ATTR_CONTAINER}="inset" data-soma-id="root" class="@container ${ROOT_CLASS}"></section>`,
|
|
720
844
|
controllerFactory: createKitController(() => ({
|
|
721
845
|
busyAware: true,
|
|
722
846
|
attach(root, api) {
|
|
@@ -730,12 +854,12 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
730
854
|
const el = event.target as HTMLInputElement | null;
|
|
731
855
|
if (!el) return;
|
|
732
856
|
// 行内多行编辑:单格改动写回行副本并抛 change(值没变不抛:文本框的 input 与 change 都会来)
|
|
733
|
-
const cell = el.getAttribute(
|
|
857
|
+
const cell = el.getAttribute(KIT_ATTR_CELL);
|
|
734
858
|
if (cell !== null) {
|
|
735
859
|
const p = api.props();
|
|
736
860
|
if (bool(p.readonly) || bool(p.disabled)) return;
|
|
737
861
|
const st = stateOf(root);
|
|
738
|
-
const index = Number(el.getAttribute(
|
|
862
|
+
const index = Number(el.getAttribute(KIT_ATTR_INDEX));
|
|
739
863
|
const col = rowColumnsOf(p.columns, root).find((c) => c.key === cell);
|
|
740
864
|
const row = st.rows[index];
|
|
741
865
|
if (!col || !row) return;
|
|
@@ -756,20 +880,20 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
756
880
|
if (bool(p.staged)) refreshStage(root, p);
|
|
757
881
|
return;
|
|
758
882
|
}
|
|
759
|
-
const k = el.getAttribute(
|
|
883
|
+
const k = el.getAttribute(KIT_ATTR_FIELD);
|
|
760
884
|
if (k === null || k === undefined) return;
|
|
761
885
|
stateOf(root).draft[k] = el.value;
|
|
762
886
|
};
|
|
763
887
|
const onClick = (event: Event): void => {
|
|
764
|
-
const btn = (event.target as HTMLElement | null)?.closest<HTMLButtonElement>(
|
|
888
|
+
const btn = (event.target as HTMLElement | null)?.closest<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACTION));
|
|
765
889
|
if (!btn || btn.disabled) return;
|
|
766
890
|
const p = api.props();
|
|
767
891
|
const st = stateOf(root);
|
|
768
892
|
const cols = rowColumnsOf(p.columns, root);
|
|
769
893
|
const key = keyOf();
|
|
770
|
-
const act = btn.getAttribute(
|
|
894
|
+
const act = btn.getAttribute(KIT_ATTR_ACTION);
|
|
771
895
|
if (act === 'options_retry') {
|
|
772
|
-
const optionKey = btn.getAttribute(
|
|
896
|
+
const optionKey = btn.getAttribute(KIT_ATTR_OPTION_KEY);
|
|
773
897
|
if (optionKey !== null && btn.getAttribute('aria-disabled') !== 'true') retryRemoteOptions(root, optionKey);
|
|
774
898
|
return;
|
|
775
899
|
}
|
|
@@ -792,12 +916,12 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
792
916
|
recordSnapshot(st);
|
|
793
917
|
api.emit('change', { value: st.rows, totals: rowTotals(cols, st.rows) });
|
|
794
918
|
paint(root, api.props());
|
|
795
|
-
const last = root.querySelectorAll<HTMLElement>(`[
|
|
796
|
-
(last[0] ?? root.querySelector<HTMLElement>('
|
|
919
|
+
const last = root.querySelectorAll<HTMLElement>(`[${KIT_ATTR_INDEX}="${st.rows.length - 1}"]${kitAttrSel(KIT_ATTR_CELL)}`);
|
|
920
|
+
(last[0] ?? root.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_ACTION, 'add_row')))?.focus();
|
|
797
921
|
return;
|
|
798
922
|
}
|
|
799
923
|
if (act === 'remove') {
|
|
800
|
-
const index = Number(btn.getAttribute(
|
|
924
|
+
const index = Number(btn.getAttribute(KIT_ATTR_INDEX));
|
|
801
925
|
const row = st.rows[index];
|
|
802
926
|
if (!row) return;
|
|
803
927
|
const minRows = Math.max(0, Math.floor(num(p.min_rows) ?? 0));
|
|
@@ -833,8 +957,8 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
833
957
|
api.emit('change', { value: st.rows, totals: rowTotals(cols, st.rows) });
|
|
834
958
|
paint(root, live);
|
|
835
959
|
// 行表重绘后焦点会丢:落到同位置(或最后一行)的删除钮,没有行了就落到录入区第一格
|
|
836
|
-
const removes = root.querySelectorAll<HTMLElement>('
|
|
837
|
-
(removes[Math.min(at, removes.length - 1)] ?? root.querySelector<HTMLElement>(
|
|
960
|
+
const removes = root.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_ACTION, 'remove'));
|
|
961
|
+
(removes[Math.min(at, removes.length - 1)] ?? root.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_FIELD)))?.focus();
|
|
838
962
|
}
|
|
839
963
|
};
|
|
840
964
|
// 有内容的行先自绘确认(danger),空行直接删;确认弹出期间重复点击不叠加
|
|
@@ -886,8 +1010,8 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
886
1010
|
// 文本框里按 Enter 等于点「添加」(输入法组合中不算)
|
|
887
1011
|
const onKeydown = (event: KeyboardEvent): void => {
|
|
888
1012
|
const el = event.target as HTMLElement | null;
|
|
889
|
-
if (event.key !== 'Enter' || event.isComposing || !(el instanceof HTMLInputElement) || !el.hasAttribute(
|
|
890
|
-
const add = root.querySelector<HTMLButtonElement>('
|
|
1013
|
+
if (event.key !== 'Enter' || event.isComposing || !(el instanceof HTMLInputElement) || !el.hasAttribute(KIT_ATTR_FIELD)) return;
|
|
1014
|
+
const add = root.querySelector<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACTION, 'add'));
|
|
891
1015
|
if (!add) return;
|
|
892
1016
|
event.preventDefault();
|
|
893
1017
|
add.click();
|
|
@@ -895,7 +1019,7 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
895
1019
|
// 表单把 aria-invalid 也标在组件根上(文档顺序里先于单元格):根被聚焦时转交给首个出错单元格
|
|
896
1020
|
const onRootFocus = (event: Event): void => {
|
|
897
1021
|
if (event.target !== root) return;
|
|
898
|
-
root.querySelector<HTMLElement>(
|
|
1022
|
+
root.querySelector<HTMLElement>(`${kitAttrSel(KIT_ATTR_ROW)} [aria-invalid="true"]`)?.focus({ preventScroll: true });
|
|
899
1023
|
};
|
|
900
1024
|
root.addEventListener('focus', onRootFocus);
|
|
901
1025
|
root.addEventListener('input', onInput);
|
|
@@ -910,6 +1034,8 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
910
1034
|
root.removeEventListener('keydown', onKeydown);
|
|
911
1035
|
states.get(root)?.embeds.release(root);
|
|
912
1036
|
states.get(root)?.cellEmbeds.release(root);
|
|
1037
|
+
states.get(root)?.entrySelects.clear();
|
|
1038
|
+
if (states.get(root)) states.get(root)!.inlineSelects = [];
|
|
913
1039
|
states.delete(root);
|
|
914
1040
|
remotes.delete(root);
|
|
915
1041
|
stages.get(root)?.off?.();
|
|
@@ -939,18 +1065,18 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
939
1065
|
st.cellErrors = list;
|
|
940
1066
|
}
|
|
941
1067
|
|
|
942
|
-
/** 把 st.cellErrors 画到单元格:控件 aria-invalid
|
|
1068
|
+
/** 把 st.cellErrors 画到单元格:控件 aria-invalid、外层 wrap 恢复圆角令牌色环(ring-1 ring-danger rounded-control)与 title 消息,无错的格还原 */
|
|
943
1069
|
function applyCellErrors(root: HTMLElement, st: EditorState): void {
|
|
944
1070
|
const bad = new Map<string, string>();
|
|
945
1071
|
for (const e of st.cellErrors) bad.set(`${e.row}\u0000${e.col}`, e.message);
|
|
946
1072
|
const tokens = CELL_ERROR_CLASS.split(' ');
|
|
947
|
-
root.querySelectorAll<HTMLElement>(
|
|
948
|
-
const message = bad.get(`${control.getAttribute(
|
|
1073
|
+
root.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_CELL)).forEach((control) => {
|
|
1074
|
+
const message = bad.get(`${control.getAttribute(KIT_ATTR_INDEX)}\u0000${control.getAttribute(KIT_ATTR_CELL)}`);
|
|
949
1075
|
// 自绘下拉的载体是 hidden input,可见且可聚焦的是同壳的 combobox
|
|
950
|
-
const visible = control.closest<HTMLElement>(
|
|
951
|
-
const wrap = control.closest<HTMLElement>(
|
|
1076
|
+
const visible = control.closest<HTMLElement>(kitAttrSel(KIT_ATTR_SELECT_HOST))?.querySelector<HTMLElement>('[role="combobox"]') ?? control;
|
|
1077
|
+
const wrap = control.closest<HTMLElement>(`${kitAttrSel(KIT_ATTR_ROW)} > span`);
|
|
952
1078
|
// 错误文字节点(仅读屏可见,不加行高):控件 aria-describedby 指向它,title 只作鼠标悬停的补充
|
|
953
|
-
const errNode = wrap?.querySelector<HTMLElement>(
|
|
1079
|
+
const errNode = wrap?.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_CELL_ERROR)) ?? null;
|
|
954
1080
|
const describedTokens = (visible.getAttribute('aria-describedby') ?? '').split(/\s+/).filter((t) => t !== '');
|
|
955
1081
|
if (message !== undefined) {
|
|
956
1082
|
visible.setAttribute('aria-invalid', 'true');
|
|
@@ -959,7 +1085,7 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
959
1085
|
if (wrap) {
|
|
960
1086
|
const node = errNode ?? mk('span', 'sr-only');
|
|
961
1087
|
if (!errNode) {
|
|
962
|
-
node.setAttribute(
|
|
1088
|
+
node.setAttribute(KIT_ATTR_CELL_ERROR, '');
|
|
963
1089
|
node.id = nextUid('kit-cell-err');
|
|
964
1090
|
wrap.appendChild(node);
|
|
965
1091
|
}
|
|
@@ -1000,22 +1126,31 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1000
1126
|
}
|
|
1001
1127
|
|
|
1002
1128
|
/** 行内编辑:一个单元格的控件(文本框 / 自绘下拉 / 自绘日期框),带 data-kit-cell 与行号,由根上的 input / change 监听收值 */
|
|
1003
|
-
function inlineControl(st: EditorState, c: KitRowColumn, value: unknown, index: number): HTMLElement {
|
|
1129
|
+
function inlineControl(root: HTMLElement, st: EditorState, p: Record<string, unknown>, c: KitRowColumn, value: unknown, index: number): HTMLElement {
|
|
1004
1130
|
const text = inlineText(c, value);
|
|
1005
1131
|
let control: HTMLInputElement;
|
|
1006
1132
|
let holder: HTMLElement;
|
|
1133
|
+
let selectHandle: RowSelectHandle | null = null;
|
|
1007
1134
|
if (c.kind === 'select' || c.kind === 'bool') {
|
|
1008
1135
|
const opts = c.kind === 'bool' ? [{ value: 'false', label: c.falseLabel }, { value: 'true', label: c.trueLabel }] : c.options;
|
|
1009
|
-
const field = st.cellEmbeds.add(
|
|
1010
|
-
|
|
1136
|
+
const field = st.cellEmbeds.add(mountRowSelect({
|
|
1137
|
+
options: opts,
|
|
1138
|
+
value: opts.some((o) => o.value === text) ? text : '',
|
|
1139
|
+
placeholder: c.placeholder,
|
|
1140
|
+
ariaLabel: c.label,
|
|
1141
|
+
doc: root.ownerDocument,
|
|
1142
|
+
}));
|
|
1143
|
+
field.el.setAttribute(KIT_ATTR_SELECT_HOST, '');
|
|
1011
1144
|
control = field.input;
|
|
1012
1145
|
holder = field.el;
|
|
1146
|
+
selectHandle = field;
|
|
1013
1147
|
} else if (c.kind === 'date') {
|
|
1014
1148
|
const field = st.cellEmbeds.add(mountKitDateField({ value: text, placeholder: c.placeholder, fieldClass: DATE_FIELD_CLASS }));
|
|
1015
1149
|
control = field.input;
|
|
1016
1150
|
holder = field.el;
|
|
1017
1151
|
} else {
|
|
1018
|
-
const
|
|
1152
|
+
const baseInputClass = c.mono || c.kind === 'json' ? `${FIELD_CLASS.md} ${TEXTAREA_LIKE}` : FIELD_CLASS.md;
|
|
1153
|
+
const input = mk('input', `${baseInputClass}${columnAlignClass(p, c)}`);
|
|
1019
1154
|
setKitFace(input, 'field');
|
|
1020
1155
|
input.type = 'text';
|
|
1021
1156
|
if (isNumericRowKind(c.kind)) input.inputMode = 'decimal';
|
|
@@ -1026,16 +1161,20 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1026
1161
|
control = input;
|
|
1027
1162
|
holder = input;
|
|
1028
1163
|
}
|
|
1029
|
-
control.setAttribute(
|
|
1030
|
-
control.setAttribute(
|
|
1031
|
-
|
|
1164
|
+
control.setAttribute(KIT_ATTR_CELL, c.key);
|
|
1165
|
+
control.setAttribute(KIT_ATTR_INDEX, String(index));
|
|
1166
|
+
const wrapped = withOptionsRetry(holder, c);
|
|
1167
|
+
if (selectHandle !== null && c.optionsKey !== undefined) {
|
|
1168
|
+
st.inlineSelects.push({ handle: selectHandle, colKey: c.key, rowIndex: index, wrap: wrapped });
|
|
1169
|
+
}
|
|
1170
|
+
return wrapped;
|
|
1032
1171
|
}
|
|
1033
1172
|
|
|
1034
1173
|
/** 行内编辑的合计行:随单格改动就地刷新数字(不重建行表,输入焦点不丢) */
|
|
1035
1174
|
function refreshTotals(root: HTMLElement, cols: readonly KitRowColumn[], rows: ReadonlyArray<Record<string, unknown>>, locale: string): void {
|
|
1036
1175
|
const totals = rowTotals(cols, rows);
|
|
1037
|
-
root.querySelectorAll<HTMLElement>(
|
|
1038
|
-
const c = cols.find((x) => x.key === el.getAttribute(
|
|
1176
|
+
root.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_TOTAL)).forEach((el) => {
|
|
1177
|
+
const c = cols.find((x) => x.key === el.getAttribute(KIT_ATTR_TOTAL));
|
|
1039
1178
|
const v = c ? totals[c.key] : undefined;
|
|
1040
1179
|
if (c && v !== undefined) el.textContent = rowCellText(c, v, locale);
|
|
1041
1180
|
});
|
|
@@ -1043,52 +1182,73 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1043
1182
|
|
|
1044
1183
|
/** 行内多行编辑的行表:每行每格就地可改;readonly / disabled 时退回纯文字;fixed_rows 时没有添加 / 删除 */
|
|
1045
1184
|
function paintInlineList(root: HTMLElement, st: EditorState, p: Record<string, unknown>, list: HTMLElement, cols: readonly KitRowColumn[], readonly: boolean, fixedRows: boolean): void {
|
|
1046
|
-
let focusRestore: { index: string; cell: string; start: number | null; end: number | null } | null = null;
|
|
1047
|
-
const active = typeof document !== 'undefined' ? document.activeElement : null;
|
|
1048
|
-
if (active
|
|
1049
|
-
const
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1185
|
+
let focusRestore: { index: string; cell: string; isCombo: boolean; start: number | null; end: number | null } | null = null;
|
|
1186
|
+
const active = typeof document !== 'undefined' ? document.activeElement as HTMLElement | null : null;
|
|
1187
|
+
if (active && list.contains(active)) {
|
|
1188
|
+
const tagged = active.closest<HTMLElement>(kitAttrSel(KIT_ATTR_SELECT_HOST))?.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_CELL)) ?? active;
|
|
1189
|
+
const idx = tagged.getAttribute(KIT_ATTR_INDEX);
|
|
1190
|
+
const cell = tagged.getAttribute(KIT_ATTR_CELL);
|
|
1191
|
+
if (idx !== null && cell !== null) {
|
|
1192
|
+
let start: number | null = null;
|
|
1193
|
+
let end: number | null = null;
|
|
1194
|
+
if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) {
|
|
1195
|
+
try { start = active.selectionStart; end = active.selectionEnd; } catch {}
|
|
1196
|
+
}
|
|
1197
|
+
focusRestore = { index: idx, cell, isCombo: active.getAttribute('role') === 'combobox', start, end };
|
|
1053
1198
|
}
|
|
1054
1199
|
}
|
|
1055
1200
|
st.cellEmbeds.release(list);
|
|
1201
|
+
st.inlineSelects = [];
|
|
1056
1202
|
list.textContent = '';
|
|
1057
1203
|
const shown = cols.filter((c) => c.list);
|
|
1058
1204
|
const structural = !readonly && !fixedRows;
|
|
1059
|
-
const
|
|
1205
|
+
const gridMin = !structural && shown.length >= 4 ? ' min-w-120' : '';
|
|
1206
|
+
const spanOf = (c: KitRowColumn): string => {
|
|
1207
|
+
const own = structural ? `${FLEX_SPAN[c.span] ?? 'flex-2'} ${colMinWidth(c)}` : `${SPAN_CLASS[c.span] ?? 'col-span-2'} ${colMinWidth(c)}`;
|
|
1208
|
+
return `${own}${columnAlignClass(p, c, own)}`;
|
|
1209
|
+
};
|
|
1060
1210
|
if (st.rows.length === 0) {
|
|
1061
1211
|
list.appendChild(emptyNode(str(p.empty_text, kitText('soma.kit.empty', undefined, root))));
|
|
1062
1212
|
} else {
|
|
1063
|
-
const head = mk('div', structural ? HEAD_END_CLASS : HEAD_CLASS);
|
|
1213
|
+
const head = mk('div', structural ? HEAD_END_CLASS : `${HEAD_CLASS}${gridMin}`);
|
|
1214
|
+
// 表头带 = 面头;表头格 = 字段名
|
|
1215
|
+
kitMarkLevel(head, 'head'); kitApplyLevelClass(head);
|
|
1064
1216
|
for (const c of shown) {
|
|
1065
1217
|
const cell = mk('span', spanOf(c), c.label);
|
|
1218
|
+
kitMarkPart(cell, 'field-name');
|
|
1066
1219
|
if (c.required && c.editable && !readonly) cell.appendChild(mk('span', REQUIRED_MARK, ' *'));
|
|
1067
1220
|
head.appendChild(cell);
|
|
1068
1221
|
}
|
|
1069
1222
|
if (structural) head.appendChild(mk('span', END_FLEX_CLASS, str(p.action_label)));
|
|
1070
1223
|
list.appendChild(head);
|
|
1071
1224
|
st.rows.forEach((row, index) => {
|
|
1072
|
-
const tr = mk('div', structural ? ROW_END_CLASS : ROW_CLASS);
|
|
1073
|
-
tr.setAttribute(
|
|
1225
|
+
const tr = mk('div', structural ? ROW_END_CLASS : `${ROW_CLASS}${gridMin}`);
|
|
1226
|
+
tr.setAttribute(KIT_ATTR_ROW, String(index));
|
|
1227
|
+
kitMarkLevel(tr, 'item', 'line'); kitApplyLevelClass(tr);
|
|
1074
1228
|
const rowName = kitText('soma.kit.rows_row_n', { n: index + 1 }, root);
|
|
1075
1229
|
tr.setAttribute('role', 'group');
|
|
1076
1230
|
tr.setAttribute('aria-label', rowName);
|
|
1077
1231
|
for (const c of shown) {
|
|
1078
|
-
const wrap = mk('span',
|
|
1232
|
+
const wrap = mk('span', spanOf(c));
|
|
1233
|
+
kitMarkPart(wrap, 'cell');
|
|
1079
1234
|
if (readonly || !c.editable || (str(p.locked_key) !== '' && row[str(p.locked_key)] === true)) {
|
|
1080
1235
|
const cls = c.mono || c.kind === 'json' ? CELL_MONO : c.key === shown[0]?.key ? CELL_CLASS : CELL_MUTED;
|
|
1081
1236
|
wrap.className = `${spanOf(c)} ${cls}`;
|
|
1082
1237
|
wrap.textContent = rowCellText(c, row[c.key], str(p.locale));
|
|
1238
|
+
if (c.optionsFrom !== null) {
|
|
1239
|
+
wrap.setAttribute(KIT_ATTR_RO_SELECT, c.key);
|
|
1240
|
+
wrap.setAttribute(KIT_ATTR_RO_INDEX, String(index));
|
|
1241
|
+
}
|
|
1083
1242
|
} else {
|
|
1084
|
-
wrap.appendChild(inlineControl(st, c, row[c.key], index));
|
|
1243
|
+
wrap.appendChild(inlineControl(root, st, p, c, row[c.key], index));
|
|
1085
1244
|
}
|
|
1086
1245
|
tr.appendChild(wrap);
|
|
1087
1246
|
}
|
|
1088
1247
|
if (structural) {
|
|
1089
1248
|
const cell = mk('span', END_FLEX_CLASS);
|
|
1090
|
-
const btn =
|
|
1091
|
-
btn.
|
|
1249
|
+
const btn = actionButton({ key: 'remove', label: str(p.remove_label, kitText('soma.kit.delete', undefined, root)), fn: 'remove', disabled: false, reason: '' });
|
|
1250
|
+
btn.className = ROW_REMOVE_CLASS;
|
|
1251
|
+
btn.setAttribute(KIT_ATTR_INDEX, String(index));
|
|
1092
1252
|
btn.setAttribute('aria-label', `${str(p.remove_label, kitText('soma.kit.delete', undefined, root))} ${rowName}`);
|
|
1093
1253
|
cell.appendChild(btn);
|
|
1094
1254
|
tr.appendChild(cell);
|
|
@@ -1098,13 +1258,16 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1098
1258
|
if (str(p.footer, 'none') === 'sum') {
|
|
1099
1259
|
const totals = rowTotals(shown, st.rows);
|
|
1100
1260
|
const labelCol = shown.find((c) => totals[c.key] === undefined);
|
|
1101
|
-
const foot = mk('div', structural ? FOOTER_END_CLASS : FOOTER_ROW_CLASS);
|
|
1102
|
-
foot.setAttribute(
|
|
1261
|
+
const foot = mk('div', structural ? FOOTER_END_CLASS : `${FOOTER_ROW_CLASS}${gridMin}`);
|
|
1262
|
+
foot.setAttribute(KIT_ATTR_FOOTER, 'sum');
|
|
1263
|
+
// 合计行 = 淡底带
|
|
1264
|
+
kitMarkLevel(foot, 'band'); kitApplyLevelClass(foot);
|
|
1103
1265
|
for (const c of shown) {
|
|
1104
1266
|
const total = totals[c.key];
|
|
1105
1267
|
const text = total !== undefined ? rowCellText(c, total, str(p.locale)) : c === labelCol ? str(p.total_label, kitText('soma.kit.total_label', undefined, root)) : '';
|
|
1106
1268
|
const cell = mk('span', spanOf(c), text);
|
|
1107
|
-
|
|
1269
|
+
kitMarkPart(cell, 'cell');
|
|
1270
|
+
if (total !== undefined) cell.setAttribute(KIT_ATTR_TOTAL, c.key);
|
|
1108
1271
|
foot.appendChild(cell);
|
|
1109
1272
|
}
|
|
1110
1273
|
if (structural) foot.appendChild(mk('span', END_FLEX_CLASS));
|
|
@@ -1113,16 +1276,21 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1113
1276
|
}
|
|
1114
1277
|
if (structural) {
|
|
1115
1278
|
const bar = mk('div', 'flex px-2 py-2');
|
|
1279
|
+
// 「添加一行」所在的底部工具行 = 底栏
|
|
1280
|
+
kitMarkLevel(bar, 'foot'); kitApplyLevelClass(bar);
|
|
1116
1281
|
bar.appendChild(actionButton({ key: 'add_row', label: str(p.add_label, kitText('soma.kit.rows_add_row', undefined, root)), tone: 'neutral', disabled: false, reason: '' }));
|
|
1117
1282
|
list.appendChild(bar);
|
|
1118
1283
|
}
|
|
1119
1284
|
if (focusRestore !== null) {
|
|
1120
|
-
const
|
|
1121
|
-
`[
|
|
1285
|
+
const rawTarget = list.querySelector<HTMLElement>(
|
|
1286
|
+
`[${KIT_ATTR_INDEX}="${focusRestore.index}"][${KIT_ATTR_CELL}="${focusRestore.cell}"]`,
|
|
1122
1287
|
);
|
|
1288
|
+
const target = focusRestore.isCombo
|
|
1289
|
+
? rawTarget?.closest<HTMLElement>(kitAttrSel(KIT_ATTR_SELECT_HOST))?.querySelector<HTMLElement>('[role="combobox"]') ?? rawTarget
|
|
1290
|
+
: rawTarget;
|
|
1123
1291
|
if (target) {
|
|
1124
1292
|
target.focus();
|
|
1125
|
-
if (focusRestore.start !== null && focusRestore.end !== null) {
|
|
1293
|
+
if (focusRestore.start !== null && focusRestore.end !== null && (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)) {
|
|
1126
1294
|
try { target.setSelectionRange(focusRestore.start, focusRestore.end); } catch {}
|
|
1127
1295
|
}
|
|
1128
1296
|
}
|
|
@@ -1186,6 +1354,8 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1186
1354
|
});
|
|
1187
1355
|
const shown = cols.filter((c) => c.list);
|
|
1188
1356
|
root.className = joinClass(`@container ${ROOT_CLASS}`, p.class);
|
|
1357
|
+
// 数据状态:没有行为空;只读 / 禁用为只读(录入区与删除钮都不画)
|
|
1358
|
+
kitMarkDataFacts(root, { empty: st.rows.length === 0, readonly });
|
|
1189
1359
|
|
|
1190
1360
|
if (!st.nodes) {
|
|
1191
1361
|
root.textContent = '';
|
|
@@ -1211,11 +1381,27 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1211
1381
|
// 行表
|
|
1212
1382
|
const key = str(p.row_key) !== '' ? str(p.row_key) : (cols[0]?.key ?? '');
|
|
1213
1383
|
if (inline) {
|
|
1214
|
-
//
|
|
1215
|
-
const listSig = JSON.stringify([cols, readonly, fixedRows, st.rows.length, str(p.locked_key), str(p.remove_label), str(p.action_label), str(p.footer), str(p.empty_text), str(p.add_label), str(p.locale)]);
|
|
1384
|
+
// 行内多行编辑:结构不变(列结构、行数、锁定态)就不重建,远程选项返回时原地调 setOptions 更新,输入框焦点与光标绝不丢失
|
|
1385
|
+
const listSig = JSON.stringify([colsStructOf(cols), readonly, fixedRows, st.rows.length, str(p.locked_key), str(p.remove_label), str(p.action_label), str(p.footer), str(p.empty_text), str(p.add_label), str(p.locale), cols.map((c) => kitFieldPropsOf(p, c.key).align ?? '')]);
|
|
1216
1386
|
if (listSig !== st.listSig) {
|
|
1217
1387
|
st.listSig = listSig;
|
|
1218
1388
|
paintInlineList(root, st, p, list, cols, readonly, fixedRows);
|
|
1389
|
+
} else {
|
|
1390
|
+
for (const item of st.inlineSelects) {
|
|
1391
|
+
const c = cols.find((x) => x.key === item.colKey);
|
|
1392
|
+
if (!c) continue;
|
|
1393
|
+
const curText = inlineText(c, st.rows[item.rowIndex]?.[c.key]);
|
|
1394
|
+
item.handle.setOptions(c.options);
|
|
1395
|
+
item.handle.setProps({ placeholder: c.placeholder, value: c.options.some((o) => o.value === curText) ? curText : '' });
|
|
1396
|
+
syncOptionsRetryDom(item.wrap, c);
|
|
1397
|
+
}
|
|
1398
|
+
list.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_RO_SELECT)).forEach((roEl) => {
|
|
1399
|
+
const colKey = roEl.getAttribute(KIT_ATTR_RO_SELECT) ?? '';
|
|
1400
|
+
const rIdx = Number(roEl.getAttribute(KIT_ATTR_RO_INDEX));
|
|
1401
|
+
const c = cols.find((x) => x.key === colKey);
|
|
1402
|
+
const row = st.rows[rIdx];
|
|
1403
|
+
if (c && row) roEl.textContent = rowCellText(c, row[colKey], str(p.locale));
|
|
1404
|
+
});
|
|
1219
1405
|
}
|
|
1220
1406
|
} else if (st.rows.length === 0) {
|
|
1221
1407
|
list.textContent = '';
|
|
@@ -1223,25 +1409,38 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1223
1409
|
} else {
|
|
1224
1410
|
list.textContent = '';
|
|
1225
1411
|
const structural = !readonly && !fixedRows;
|
|
1226
|
-
const
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1412
|
+
const gridMin = !structural && shown.length >= 4 ? ' min-w-120' : '';
|
|
1413
|
+
const head = mk('div', structural ? HEAD_END_CLASS : `${HEAD_CLASS}${gridMin}`);
|
|
1414
|
+
const spanOf = (c: KitRowColumn): string => {
|
|
1415
|
+
const own = structural ? `${FLEX_SPAN[c.span] ?? 'flex-2'} ${colMinWidth(c)}` : `${SPAN_CLASS[c.span] ?? 'col-span-2'} ${colMinWidth(c)}`;
|
|
1416
|
+
return `${own}${columnAlignClass(p, c, own)}`;
|
|
1417
|
+
};
|
|
1418
|
+
kitMarkLevel(head, 'head'); kitApplyLevelClass(head);
|
|
1419
|
+
for (const c of shown) {
|
|
1420
|
+
const hc = mk('span', spanOf(c), c.label);
|
|
1421
|
+
kitMarkPart(hc, 'field-name');
|
|
1422
|
+
head.appendChild(hc);
|
|
1423
|
+
}
|
|
1229
1424
|
if (structural) head.appendChild(mk('span', END_FLEX_CLASS, str(p.action_label)));
|
|
1230
1425
|
list.appendChild(head);
|
|
1231
1426
|
st.rows.forEach((row, index) => {
|
|
1232
|
-
const tr = mk('div', structural ? ROW_END_CLASS : ROW_CLASS);
|
|
1233
|
-
tr.setAttribute(
|
|
1427
|
+
const tr = mk('div', structural ? ROW_END_CLASS : `${ROW_CLASS}${gridMin}`);
|
|
1428
|
+
tr.setAttribute(KIT_ATTR_ROW, textOf(row[key]));
|
|
1429
|
+
kitMarkLevel(tr, 'item', 'line'); kitApplyLevelClass(tr);
|
|
1234
1430
|
const rowName = kitText('soma.kit.rows_row_n', { n: index + 1 }, root);
|
|
1235
1431
|
tr.setAttribute('role', 'group');
|
|
1236
1432
|
tr.setAttribute('aria-label', rowName);
|
|
1237
1433
|
for (const c of shown) {
|
|
1238
1434
|
const cls = c.mono || c.kind === 'json' ? CELL_MONO : c.key === shown[0]?.key ? CELL_CLASS : CELL_MUTED;
|
|
1239
|
-
|
|
1435
|
+
const td = mk('span', `${spanOf(c)} ${cls}`, rowCellText(c, row[c.key], str(p.locale)));
|
|
1436
|
+
kitMarkPart(td, 'cell');
|
|
1437
|
+
tr.appendChild(td);
|
|
1240
1438
|
}
|
|
1241
1439
|
if (structural) {
|
|
1242
1440
|
const cell = mk('span', END_FLEX_CLASS);
|
|
1243
|
-
const btn =
|
|
1244
|
-
btn.
|
|
1441
|
+
const btn = actionButton({ key: 'remove', label: str(p.remove_label, kitText('soma.kit.delete', undefined, root)), fn: 'remove', disabled: false, reason: '' });
|
|
1442
|
+
btn.className = ROW_REMOVE_CLASS;
|
|
1443
|
+
btn.setAttribute(KIT_ATTR_INDEX, String(index));
|
|
1245
1444
|
btn.setAttribute('aria-label', `${str(p.remove_label, kitText('soma.kit.delete', undefined, root))} ${rowName}`);
|
|
1246
1445
|
cell.appendChild(btn);
|
|
1247
1446
|
tr.appendChild(cell);
|
|
@@ -1251,12 +1450,15 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1251
1450
|
if (str(p.footer, 'none') === 'sum') {
|
|
1252
1451
|
const totals = rowTotals(shown, st.rows);
|
|
1253
1452
|
const labelCol = shown.find((c) => totals[c.key] === undefined);
|
|
1254
|
-
const foot = mk('div', structural ? FOOTER_END_CLASS : FOOTER_ROW_CLASS);
|
|
1255
|
-
foot.setAttribute(
|
|
1453
|
+
const foot = mk('div', structural ? FOOTER_END_CLASS : `${FOOTER_ROW_CLASS}${gridMin}`);
|
|
1454
|
+
foot.setAttribute(KIT_ATTR_FOOTER, 'sum');
|
|
1455
|
+
kitMarkLevel(foot, 'band'); kitApplyLevelClass(foot);
|
|
1256
1456
|
for (const c of shown) {
|
|
1257
1457
|
const total = totals[c.key];
|
|
1258
1458
|
const text = total !== undefined ? rowCellText(c, total, str(p.locale)) : c === labelCol ? str(p.total_label, kitText('soma.kit.total_label', undefined, root)) : '';
|
|
1259
|
-
|
|
1459
|
+
const fc = mk('span', spanOf(c), text);
|
|
1460
|
+
kitMarkPart(fc, 'cell');
|
|
1461
|
+
foot.appendChild(fc);
|
|
1260
1462
|
}
|
|
1261
1463
|
if (structural) foot.appendChild(mk('span', END_FLEX_CLASS));
|
|
1262
1464
|
list.appendChild(foot);
|
|
@@ -1274,18 +1476,55 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1274
1476
|
count.textContent = parts.join(' ');
|
|
1275
1477
|
}
|
|
1276
1478
|
|
|
1277
|
-
//
|
|
1479
|
+
// 录入区:列结构变化才重建(远程选项返回时原地 setOptions 更新;即使重建也记录并恢复当前聚焦字段与光标偏移)
|
|
1278
1480
|
const noEntry = readonly || inline || fixedRows;
|
|
1279
|
-
const colsSig = JSON.stringify([cols, noEntry, str(p.add_label)]);
|
|
1481
|
+
const colsSig = JSON.stringify([colsStructOf(cols), noEntry, str(p.add_label), kitIsNextRuntime(), cols.map((c) => kitFieldPropsOf(p, c.key).align ?? '')]);
|
|
1280
1482
|
if (colsSig !== st.columnsSig) {
|
|
1483
|
+
let formFocus: { field: string; isCombo: boolean; start: number | null; end: number | null } | null = null;
|
|
1484
|
+
const activeInForm = typeof document !== 'undefined' && form.contains(document.activeElement) ? document.activeElement as HTMLElement : null;
|
|
1485
|
+
if (activeInForm) {
|
|
1486
|
+
const hostField = activeInForm.closest<HTMLElement>(kitAttrSel(KIT_ATTR_SELECT_HOST))?.querySelector<HTMLElement>(kitAttrSel(KIT_ATTR_FIELD)) ?? activeInForm;
|
|
1487
|
+
const fKey = hostField.getAttribute(KIT_ATTR_FIELD);
|
|
1488
|
+
if (fKey) {
|
|
1489
|
+
let start: number | null = null;
|
|
1490
|
+
let end: number | null = null;
|
|
1491
|
+
if (activeInForm instanceof HTMLInputElement || activeInForm instanceof HTMLTextAreaElement) {
|
|
1492
|
+
try { start = activeInForm.selectionStart; end = activeInForm.selectionEnd; } catch {}
|
|
1493
|
+
}
|
|
1494
|
+
formFocus = { field: fKey, isCombo: activeInForm.getAttribute('role') === 'combobox', start, end };
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1281
1497
|
st.columnsSig = colsSig;
|
|
1282
1498
|
st.embeds.release(form);
|
|
1499
|
+
st.entrySelects.clear();
|
|
1283
1500
|
form.textContent = '';
|
|
1284
1501
|
const editable = cols.filter((c) => c.editable);
|
|
1285
1502
|
form.hidden = noEntry || editable.length === 0;
|
|
1286
|
-
if (
|
|
1287
|
-
|
|
1503
|
+
if (noEntry) {
|
|
1504
|
+
kitApplyCols(form, null);
|
|
1505
|
+
} else {
|
|
1506
|
+
const entryCols = Math.min(editable.length + 1, 6);
|
|
1507
|
+
const rawGridClass = `${FORM_CLASS} ${FORM_COLS[entryCols] ?? FORM_COLS[3]}`;
|
|
1508
|
+
const grid = mk('div', rawGridClass);
|
|
1288
1509
|
form.appendChild(grid);
|
|
1510
|
+
const nextCols = kitIsNextRuntime() && editable.length > 0 && entryCols >= 2 ? entryCols : null;
|
|
1511
|
+
let externalCollapse: string | null = null;
|
|
1512
|
+
for (let el: HTMLElement | null = grid.parentElement; el !== null; el = el.parentElement) {
|
|
1513
|
+
const val = el.getAttribute(KIT_ATTR_COLLAPSE);
|
|
1514
|
+
if (val !== null) { externalCollapse = val; break; }
|
|
1515
|
+
if (el.hasAttribute('data-soma-component')) break;
|
|
1516
|
+
}
|
|
1517
|
+
let varTracks = false;
|
|
1518
|
+
if (externalCollapse !== null) {
|
|
1519
|
+
varTracks = externalCollapse === 'to-single' ? kitApplyCols(grid, nextCols) : kitApplyCols(grid, null);
|
|
1520
|
+
} else if (nextCols !== null) {
|
|
1521
|
+
grid.setAttribute(KIT_ATTR_COLLAPSE, 'to-single');
|
|
1522
|
+
varTracks = kitApplyCols(grid, nextCols);
|
|
1523
|
+
} else {
|
|
1524
|
+
kitApplyCols(grid, null);
|
|
1525
|
+
}
|
|
1526
|
+
if (varTracks) grid.className = kitStripGridCols(rawGridClass);
|
|
1527
|
+
kitColsGrid(grid, varTracks);
|
|
1289
1528
|
for (const c of editable) {
|
|
1290
1529
|
if (st.draft[c.key] === undefined) st.draft[c.key] = c.kind === 'bool' ? (c.dflt === 'true' ? 'true' : 'false') : c.dflt;
|
|
1291
1530
|
const wrap = mk('label', FIELD_WRAP);
|
|
@@ -1294,6 +1533,7 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1294
1533
|
wrap.appendChild(lab);
|
|
1295
1534
|
let control: HTMLInputElement;
|
|
1296
1535
|
let holder: HTMLElement | null = null;
|
|
1536
|
+
let selectHandle: RowSelectHandle | null = null;
|
|
1297
1537
|
if (c.kind === 'select' || c.kind === 'bool') {
|
|
1298
1538
|
// 自绘下拉(没有原生 <select>):control 是它的 hidden 载体(带 data-kit-field,value 即选中项),holder 是外壳
|
|
1299
1539
|
const opts = c.kind === 'bool'
|
|
@@ -1301,17 +1541,25 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1301
1541
|
: c.options;
|
|
1302
1542
|
// 草稿值不在选项里时落到第一项(和原来原生下拉的表现一致)
|
|
1303
1543
|
if (!opts.some((o) => o.value === (st.draft[c.key] ?? '')) && opts[0]) st.draft[c.key] = opts[0].value;
|
|
1304
|
-
const field = st.embeds.add(
|
|
1305
|
-
|
|
1544
|
+
const field = st.embeds.add(mountRowSelect({
|
|
1545
|
+
options: opts,
|
|
1546
|
+
value: st.draft[c.key] ?? '',
|
|
1547
|
+
placeholder: c.placeholder,
|
|
1548
|
+
ariaLabel: c.label,
|
|
1549
|
+
doc: root.ownerDocument,
|
|
1550
|
+
}));
|
|
1551
|
+
field.el.setAttribute(KIT_ATTR_SELECT_HOST, '');
|
|
1306
1552
|
control = field.input;
|
|
1307
1553
|
holder = field.el;
|
|
1554
|
+
selectHandle = field;
|
|
1308
1555
|
} else if (c.kind === 'date') {
|
|
1309
1556
|
// 日期列:自绘日历框,控件是它的文本框(value 即日期文本)
|
|
1310
1557
|
const field = st.embeds.add(mountKitDateField({ value: st.draft[c.key] ?? '', placeholder: c.placeholder, fieldClass: DATE_FIELD_CLASS }));
|
|
1311
1558
|
control = field.input;
|
|
1312
1559
|
holder = field.el;
|
|
1313
1560
|
} else {
|
|
1314
|
-
const
|
|
1561
|
+
const baseInputClass = c.mono || c.kind === 'json' ? `${FIELD_CLASS.md} ${TEXTAREA_LIKE}` : FIELD_CLASS.md;
|
|
1562
|
+
const input = mk('input', `${baseInputClass}${columnAlignClass(p, c)}`);
|
|
1315
1563
|
setKitFace(input, 'field');
|
|
1316
1564
|
input.type = 'text';
|
|
1317
1565
|
if (isNumericRowKind(c.kind)) input.inputMode = 'decimal';
|
|
@@ -1320,16 +1568,42 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1320
1568
|
input.value = st.draft[c.key] ?? '';
|
|
1321
1569
|
control = input;
|
|
1322
1570
|
}
|
|
1323
|
-
control.setAttribute(
|
|
1324
|
-
|
|
1571
|
+
control.setAttribute(KIT_ATTR_FIELD, c.key);
|
|
1572
|
+
const wrapped = withOptionsRetry(holder ?? control, c);
|
|
1573
|
+
if (selectHandle !== null && c.optionsKey !== undefined) {
|
|
1574
|
+
st.entrySelects.set(c.key, { handle: selectHandle, wrap: wrapped });
|
|
1575
|
+
}
|
|
1576
|
+
wrap.appendChild(wrapped);
|
|
1325
1577
|
grid.appendChild(wrap);
|
|
1326
1578
|
}
|
|
1327
1579
|
const last = mk('div', `${FIELD_WRAP} self-end`);
|
|
1328
1580
|
last.appendChild(actionButton({ key: 'add', label: str(p.add_label, kitText('soma.kit.add', undefined, root)), tone: 'neutral', disabled: false, reason: '' }));
|
|
1329
1581
|
grid.appendChild(last);
|
|
1582
|
+
if (formFocus !== null) {
|
|
1583
|
+
const rawTarget = form.querySelector<HTMLElement>(`[${KIT_ATTR_FIELD}="${formFocus.field}"]`);
|
|
1584
|
+
const target = formFocus.isCombo
|
|
1585
|
+
? rawTarget?.closest<HTMLElement>(kitAttrSel(KIT_ATTR_SELECT_HOST))?.querySelector<HTMLElement>('[role="combobox"]') ?? rawTarget
|
|
1586
|
+
: rawTarget;
|
|
1587
|
+
if (target) {
|
|
1588
|
+
target.focus();
|
|
1589
|
+
if (formFocus.start !== null && formFocus.end !== null && (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)) {
|
|
1590
|
+
try { target.setSelectionRange(formFocus.start, formFocus.end); } catch {}
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1330
1594
|
}
|
|
1331
1595
|
} else {
|
|
1332
1596
|
form.hidden = noEntry || !cols.some((c) => c.editable);
|
|
1597
|
+
for (const [colKey, entry] of st.entrySelects) {
|
|
1598
|
+
const c = cols.find((x) => x.key === colKey);
|
|
1599
|
+
if (!c) continue;
|
|
1600
|
+
if (!c.options.some((o) => o.value === (st.draft[c.key] ?? '')) && c.options[0]) {
|
|
1601
|
+
st.draft[c.key] = c.options[0].value;
|
|
1602
|
+
}
|
|
1603
|
+
entry.handle.setOptions(c.options);
|
|
1604
|
+
entry.handle.setProps({ placeholder: c.placeholder, value: st.draft[c.key] ?? '' });
|
|
1605
|
+
syncOptionsRetryDom(entry.wrap, c);
|
|
1606
|
+
}
|
|
1333
1607
|
}
|
|
1334
1608
|
showError(root, st, textOf(data.error));
|
|
1335
1609
|
adoptCellErrors(st, p.cell_errors);
|
|
@@ -1338,20 +1612,20 @@ export function createRowEditor(): SomaComponentDefinition {
|
|
|
1338
1612
|
refreshStage(root, p);
|
|
1339
1613
|
// 忙闲通道:所接动作(add / remove / change)在进行中时添加、删除钮禁用并挂 aria-busy,结束后恢复(只还原自己置的禁用)
|
|
1340
1614
|
const busy = kitBusyOf(p);
|
|
1341
|
-
root.querySelectorAll<HTMLButtonElement>(
|
|
1615
|
+
root.querySelectorAll<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACTION)).forEach((b) => {
|
|
1342
1616
|
if (busy) {
|
|
1343
1617
|
b.disabled = true;
|
|
1344
1618
|
b.setAttribute('aria-busy', 'true');
|
|
1345
|
-
b.setAttribute(
|
|
1346
|
-
} else if (b.hasAttribute(
|
|
1619
|
+
b.setAttribute(KIT_ATTR_BUSY, '');
|
|
1620
|
+
} else if (b.hasAttribute(KIT_ATTR_BUSY)) {
|
|
1347
1621
|
b.disabled = false;
|
|
1348
1622
|
b.removeAttribute('aria-busy');
|
|
1349
|
-
b.removeAttribute(
|
|
1623
|
+
b.removeAttribute(KIT_ATTR_BUSY);
|
|
1350
1624
|
}
|
|
1351
1625
|
});
|
|
1352
1626
|
// 行数到下限:删除钮禁用(忙闲还原之后再压一次,保证两个来源都不被对方冲掉)
|
|
1353
1627
|
if (minRows > 0 && st.rows.length <= minRows) {
|
|
1354
|
-
root.querySelectorAll<HTMLButtonElement>('
|
|
1628
|
+
root.querySelectorAll<HTMLButtonElement>(kitAttrSel(KIT_ATTR_ACTION, 'remove')).forEach((b) => { b.disabled = true; });
|
|
1355
1629
|
}
|
|
1356
1630
|
}
|
|
1357
1631
|
}
|