soma-kit 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +8 -5
- package/packs/ai/model-card.ts +3 -3
- package/packs/ops/error-budget-card.ts +3 -3
- package/packs/ops/release-readiness-card.ts +3 -3
- package/packs/security/control-evidence-card.ts +3 -3
- package/packs/security/finding-card.ts +3 -2
- package/packs/shared/card-util.ts +17 -0
- package/spec/generated/kit-app.schema.json +2148 -340
- package/spec/generated/kit-page.schema.json +1134 -139
- package/spec/kit-grammar.json +934 -92
- package/spec/kit-grammar.schema.json +167 -2
- package/src/app/app-config.ts +219 -186
- package/src/app/define-kit-actions.ts +126 -20
- package/src/app/define-kit-app.ts +49 -4
- package/src/app/index.ts +5 -0
- package/src/app/kit-view-context.ts +39 -1
- package/src/app/list-page-defaults.ts +14 -0
- package/src/app/server-pages.ts +239 -7
- package/src/app/server.ts +466 -25
- package/src/app/theme-endpoint.ts +67 -23
- package/src/app/theme-runtime.ts +414 -85
- package/src/app/theme-shards.ts +69 -0
- package/src/app/tier-compat.ts +107 -0
- package/src/base/action-busy.ts +215 -38
- package/src/base/affix.ts +137 -0
- package/src/base/alert.ts +104 -59
- package/src/base/anchored-layer.ts +7 -6
- package/src/base/avatar.ts +147 -61
- package/src/base/badge.ts +186 -0
- package/src/base/button-group.ts +227 -0
- package/src/base/button.ts +347 -50
- package/src/base/card.ts +233 -0
- package/src/base/cascader.ts +143 -32
- package/src/base/check-core.ts +193 -33
- package/src/base/checkbox.ts +67 -2
- package/src/base/choice.ts +132 -31
- package/src/base/collapse.ts +249 -0
- package/src/base/color-picker.ts +399 -27
- package/src/base/combobox.ts +6 -2
- package/src/base/command-palette.ts +148 -36
- package/src/base/context-menu.ts +23 -6
- package/src/base/countdown.ts +37 -15
- package/src/base/date-range.ts +114 -96
- package/src/base/date.ts +481 -74
- package/src/base/delta.ts +16 -9
- package/src/base/divider.ts +51 -33
- package/src/base/end-edge.ts +10 -4
- package/src/base/fab.ts +57 -21
- package/src/base/gap-value.ts +34 -15
- package/src/base/hint-tips.ts +99 -29
- package/src/base/identity-cells.ts +839 -0
- package/src/base/illustrations.ts +6 -4
- package/src/base/image.ts +40 -19
- package/src/base/index.ts +79 -22
- package/src/base/inline-error.ts +13 -7
- package/src/base/input.ts +135 -35
- package/src/base/kbd.ts +30 -17
- package/src/base/kit-contract.ts +400 -0
- package/src/base/link.ts +41 -20
- package/src/base/listbox-core.ts +282 -101
- package/src/base/loading-gate.ts +3 -0
- package/src/base/look.ts +197 -0
- package/src/base/mentions.ts +55 -22
- package/src/base/menu-button.ts +73 -22
- package/src/base/menu-core.ts +201 -24
- package/src/base/month-grid.ts +60 -3
- package/src/base/motion/aura.ts +52 -10
- package/src/base/motion/hover-3d.ts +7 -5
- package/src/base/motion/hover-gallery.ts +16 -12
- package/src/base/motion/limits.ts +10 -0
- package/src/base/motion/marquee.ts +18 -11
- package/src/base/motion/text-rotate.ts +34 -16
- package/src/base/notification.ts +292 -0
- package/src/base/number.ts +93 -12
- package/src/base/otp.ts +139 -27
- package/src/base/overlay-runtime.ts +30 -23
- package/src/base/overlay-shell.ts +59 -14
- package/src/base/period-picker.ts +868 -0
- package/src/base/popover.ts +624 -73
- package/src/base/popup.ts +187 -52
- package/src/base/portal-core.ts +99 -2
- package/src/base/price-text.ts +51 -17
- package/src/base/progress.ts +100 -18
- package/src/base/qr-code.ts +64 -17
- package/src/base/qty-stepper.ts +141 -22
- package/src/base/radio.ts +43 -2
- package/src/base/range.ts +194 -39
- package/src/base/rating.ts +117 -31
- package/src/base/reason-tip.ts +58 -16
- package/src/base/relation-cells.ts +541 -0
- package/src/base/resize-handle.ts +5 -3
- package/src/base/row-fresh.ts +84 -0
- package/src/base/section-spy.ts +79 -0
- package/src/base/segmented.ts +70 -26
- package/src/base/select.ts +8 -3
- package/src/base/shared.ts +482 -71
- package/src/base/spinner.ts +107 -0
- package/src/base/state-panel.ts +77 -22
- package/src/base/sticky-edge.ts +96 -29
- package/src/base/swap.ts +39 -21
- package/src/base/switch.ts +158 -38
- package/src/base/tabs.ts +292 -0
- package/src/base/tag-input.ts +123 -54
- package/src/base/tag.ts +184 -66
- package/src/base/text.ts +461 -71
- package/src/base/textarea.ts +88 -39
- package/src/base/time-picker.ts +335 -55
- package/src/base/time-range.ts +846 -0
- package/src/base/tree-select.ts +342 -88
- package/src/base/upload.ts +604 -158
- package/src/base/view-transition.ts +7 -3
- package/src/base/virtual-list.ts +49 -14
- package/src/biz/approval-desk/compile.ts +70 -5
- package/src/biz/approval-desk/index.ts +2 -0
- package/src/biz/approval-desk/shell.ts +52 -12
- package/src/biz/auth-panel/compile.ts +13 -3
- package/src/biz/auth-panel/shell.ts +27 -7
- package/src/biz/category-crud/compile.ts +51 -13
- package/src/biz/category-crud/index.ts +2 -0
- package/src/biz/category-crud/shell.ts +29 -9
- package/src/biz/checkout-page/compile.ts +37 -3
- package/src/biz/checkout-page/index.ts +1 -0
- package/src/biz/checkout-page/shell.ts +26 -9
- package/src/biz/compose.ts +6 -1
- package/src/biz/data-components.ts +2 -0
- package/src/biz/import-wizard/compile.ts +4 -1
- package/src/biz/import-wizard/index.ts +1 -0
- package/src/biz/import-wizard/shell.ts +32 -18
- package/src/biz/index.ts +1 -1
- package/src/biz/landing-page/compile.ts +3 -2
- package/src/biz/landing-page/shell.ts +22 -3
- package/src/biz/layout-contracts.ts +918 -0
- package/src/biz/link/hub.ts +199 -8
- package/src/biz/link/shared.ts +54 -15
- package/src/biz/master-sub/compile.ts +194 -57
- package/src/biz/master-sub/detail-head.ts +141 -18
- package/src/biz/master-sub/index.ts +3 -0
- package/src/biz/master-sub/shell.ts +186 -57
- package/src/biz/multi-board/compile.ts +87 -36
- package/src/biz/multi-board/composition.ts +7 -20
- package/src/biz/multi-board/index.ts +3 -2
- package/src/biz/multi-board/prose-fold.ts +15 -11
- package/src/biz/multi-board/shell.ts +148 -37
- package/src/biz/notification-center/compile.ts +20 -6
- package/src/biz/notification-center/index.ts +2 -0
- package/src/biz/notification-center/shell.ts +43 -10
- package/src/biz/page-templates/domain-templates.ts +145 -22
- package/src/biz/page-templates/result-page/compile.ts +4 -1
- package/src/biz/page-templates/result-page/index.ts +1 -0
- package/src/biz/page-templates/result-page/shell.ts +17 -4
- package/src/biz/page-templates/sign-in-page/compile.ts +19 -8
- package/src/biz/page-templates/sign-in-page/index.ts +1 -0
- package/src/biz/page-templates/sign-in-page/shell.ts +28 -12
- package/src/biz/record-detail/compile.ts +39 -11
- package/src/biz/record-detail/index.ts +1 -0
- package/src/biz/record-detail/shell.ts +41 -10
- package/src/biz/settings-center/compile.ts +4 -1
- package/src/biz/settings-center/index.ts +1 -0
- package/src/biz/settings-center/shell.ts +30 -9
- package/src/biz/shared/action-host.ts +137 -46
- package/src/biz/shared/compile-helpers.ts +130 -28
- package/src/biz/shared/coordinator.ts +628 -147
- package/src/biz/shared/focus-return.ts +180 -0
- package/src/biz/shared/object-aliases.ts +7 -1
- package/src/biz/shared/overlay-compile.ts +58 -10
- package/src/biz/shared/overlay-shell.ts +40 -10
- package/src/biz/shared/page-form-actions.ts +151 -0
- package/src/biz/shared/page-form.ts +255 -0
- package/src/biz/shared/pipeline.ts +74 -0
- package/src/biz/shared/runtime-hub.ts +101 -8
- package/src/biz/shared/verbs.ts +129 -0
- package/src/biz/single-form/compile.ts +4 -2
- package/src/biz/single-form/index.ts +2 -0
- package/src/biz/single-form/shell.ts +21 -11
- package/src/biz/standard-crud/compile.ts +206 -38
- package/src/biz/standard-crud/index.ts +2 -1
- package/src/biz/standard-crud/shell.ts +82 -22
- package/src/biz/standard-crud/summary.ts +2 -37
- package/src/biz/step-form/compile.ts +12 -3
- package/src/biz/step-form/hub.ts +165 -50
- package/src/biz/step-form/index.ts +1 -0
- package/src/biz/step-form/shell.ts +31 -15
- package/src/biz/types.ts +40 -4
- package/src/cli/kit-cli.ts +145 -26
- package/src/cli/kit-init.ts +3 -3
- package/src/cli/migrate/theme-map.ts +35 -28
- package/src/cli/migrate/ts-rules.ts +2 -2
- package/src/cli/migrate/types.ts +3 -3
- package/src/cli/migrate/yaml-rules.ts +11 -9
- package/src/cli/view-writes.ts +13 -0
- package/src/compile/closed-set.ts +102 -6
- package/src/compile/compile-page.ts +446 -53
- package/src/compile/component-candidates.ts +56 -4
- package/src/compile/danger-tier.ts +65 -0
- package/src/compile/hints.ts +1 -1
- package/src/compile/info-structure.ts +155 -0
- package/src/compile/layout-lint/rules-composition.ts +2 -1
- package/src/compile/layout-lint/rules-table.ts +4 -19
- package/src/compile/look-page.ts +551 -0
- package/src/compile/look.ts +376 -0
- package/src/compile/page-composition.ts +382 -46
- package/src/compile/page-hierarchy.ts +131 -0
- package/src/compile/page-pipeline-look.ts +156 -0
- package/src/compile/page-pipeline.ts +200 -0
- package/src/compile/parse.ts +12 -11
- package/src/compile/relation-render.ts +120 -0
- package/src/compile/remove-guard.ts +115 -41
- package/src/compile/stages.ts +645 -28
- package/src/compile/styles.ts +226 -26
- package/src/compile/types.ts +62 -5
- package/src/compile/view-check.ts +190 -1
- package/src/data/access-gate.ts +17 -9
- package/src/data/amount-breakdown.ts +49 -22
- package/src/data/anchor-nav.ts +73 -15
- package/src/data/approval-flow.ts +210 -124
- package/src/data/assignment-picker.ts +163 -85
- package/src/data/async-result-panel.ts +110 -46
- package/src/data/audit-log.ts +461 -0
- package/src/data/breadcrumbs.ts +141 -19
- package/src/data/calendar.ts +434 -96
- package/src/data/card-grid.ts +319 -0
- package/src/data/carousel.ts +72 -38
- package/src/data/cell-value.ts +253 -0
- package/src/data/chart.ts +904 -77
- package/src/data/checklist.ts +78 -35
- package/src/data/code-view.ts +106 -48
- package/src/data/comment-thread.ts +607 -87
- package/src/data/compare-view.ts +227 -0
- package/src/data/confirm-dialog.ts +198 -30
- package/src/data/context-menu.ts +95 -21
- package/src/data/d9-limits.ts +2 -0
- package/src/data/d9-util.ts +13 -5
- package/src/data/diff.ts +107 -50
- package/src/data/display-util.ts +9 -4
- package/src/data/dock.ts +33 -17
- package/src/data/embed.ts +142 -7
- package/src/data/engine-ports.ts +13 -4
- package/src/data/field-mapper.ts +104 -48
- package/src/data/file-list.ts +522 -0
- package/src/data/flow-editor.ts +603 -142
- package/src/data/flow-node-options.ts +24 -5
- package/src/data/flow-remote-options.ts +94 -19
- package/src/data/footer.ts +85 -27
- package/src/data/form-draft-registry.ts +183 -12
- package/src/data/gantt.ts +637 -117
- package/src/data/graph-view.ts +51 -0
- package/src/data/heat-calendar.ts +412 -0
- package/src/data/hero.ts +38 -15
- package/src/data/image-viewer.ts +261 -62
- package/src/data/index.ts +63 -1
- package/src/data/item-list.ts +217 -57
- package/src/data/json-view.ts +165 -100
- package/src/data/kanban.ts +339 -87
- package/src/data/kit-contract.ts +230 -0
- package/src/data/leaderboard.ts +343 -0
- package/src/data/level-class.ts +21 -0
- package/src/data/log-stream.ts +347 -0
- package/src/data/markdown-view.ts +155 -45
- package/src/data/matrix.ts +217 -112
- package/src/data/media-grid.ts +162 -38
- package/src/data/mega-menu.ts +39 -23
- package/src/data/menu-bar.ts +254 -0
- package/src/data/menu-dom.ts +50 -15
- package/src/data/menu.ts +131 -47
- package/src/data/mockup.ts +30 -22
- package/src/data/modal-dialog.ts +90 -13
- package/src/data/navbar.ts +143 -61
- package/src/data/notice-list.ts +100 -48
- package/src/data/notify-renderer.ts +61 -7
- package/src/data/object-form.ts +1389 -130
- package/src/data/org-chart.ts +544 -0
- package/src/data/outcome-watch.ts +90 -21
- package/src/data/pager.ts +122 -42
- package/src/data/panel-head.ts +237 -75
- package/src/data/permission-matrix.ts +371 -119
- package/src/data/permission-tree.ts +135 -80
- package/src/data/pricing-table.ts +106 -42
- package/src/data/prompt-dialog.ts +49 -21
- package/src/data/reaction-bar.ts +63 -31
- package/src/data/record-card.ts +239 -70
- package/src/data/record-picker.ts +56 -27
- package/src/data/redirect.ts +39 -15
- package/src/data/request-console.ts +131 -41
- package/src/data/resident.ts +11 -1
- package/src/data/result-panel.ts +65 -27
- package/src/data/rich-text.ts +206 -35
- package/src/data/row-confirm.ts +47 -0
- package/src/data/row-editor.ts +376 -102
- package/src/data/rule-builder.ts +129 -80
- package/src/data/schedule-grid.ts +238 -0
- package/src/data/segment-bar.ts +221 -0
- package/src/data/shape-util.ts +86 -43
- package/src/data/stage-flow.ts +244 -0
- package/src/data/staged-rows.ts +207 -24
- package/src/data/stat-group.ts +438 -86
- package/src/data/static-lazy.ts +18 -0
- package/src/data/static-registry.ts +38 -2
- package/src/data/status-strip.ts +171 -0
- package/src/data/steps.ts +63 -34
- package/src/data/summary-strip.ts +136 -0
- package/src/data/summary-util.ts +116 -0
- package/src/data/survey.ts +128 -47
- package/src/data/system-switcher.ts +40 -20
- package/src/data/target-progress.ts +208 -0
- package/src/data/text-action-button.ts +28 -7
- package/src/data/text-diff.ts +99 -31
- package/src/data/tile-grid.ts +343 -0
- package/src/data/timeline.ts +205 -36
- package/src/data/tour-guide.ts +110 -47
- package/src/data/transfer.ts +195 -47
- package/src/data/tree-table.ts +194 -112
- package/src/data/tree.ts +191 -70
- package/src/data/trend-line.ts +68 -12
- package/src/data/virtual-rows.ts +242 -102
- package/src/data/waterfall.ts +171 -0
- package/src/data/watermark.ts +35 -6
- package/src/data/wrap.ts +26 -4
- package/src/frames/blank-frame.ts +6 -4
- package/src/frames/index.ts +1 -2
- package/src/frames/inherited-shell.ts +54 -13
- package/src/frames/page-bar.ts +205 -27
- package/src/frames/page-status.ts +3 -2
- package/src/frames/resident-components.ts +0 -2
- package/src/frames/shared.ts +64 -21
- package/src/frames/single-frame.ts +20 -4
- package/src/frames/split-frame/shell.ts +11 -7
- package/src/frames/split-frame/wiring.ts +14 -10
- package/src/frames/tabs-frame/shell.ts +3 -2
- package/src/frames/tabs-frame/wiring.ts +2 -1
- package/src/frames/top-main-frame.ts +55 -3
- package/src/frames/types.ts +2 -0
- package/src/frames/workspace-frame/extras.ts +5 -3
- package/src/frames/workspace-frame/index.ts +1 -1
- package/src/frames/workspace-frame/pipeline-key.ts +6 -0
- package/src/frames/workspace-frame/shell.ts +22 -2
- package/src/frames/workspace-frame/state.ts +42 -14
- package/src/frames/workspace-frame/view.ts +697 -167
- package/src/generated/kit-grammar-runtime.ts +1015 -53
- package/src/generated/kit-page.ts +272 -0
- package/src/i18n/index.ts +2 -0
- package/src/i18n/kit-text.ts +96 -3
- package/src/object-renderer/action-group.ts +175 -23
- package/src/object-renderer/action-more.ts +48 -17
- package/src/object-renderer/arrange.ts +241 -29
- package/src/object-renderer/category-tone.ts +96 -0
- package/src/object-renderer/collapse-wiring.ts +19 -9
- package/src/object-renderer/collection-expand.ts +3 -3
- package/src/object-renderer/collection-parts.ts +432 -107
- package/src/object-renderer/collection-table.ts +347 -45
- package/src/object-renderer/collection.ts +291 -62
- package/src/object-renderer/compile-data.ts +12 -2
- package/src/object-renderer/defaults.ts +6 -5
- package/src/object-renderer/emit-events.ts +45 -19
- package/src/object-renderer/emit-object.ts +35 -9
- package/src/object-renderer/emit-static.ts +734 -159
- package/src/object-renderer/filter-plan.ts +3 -3
- package/src/object-renderer/filter-toolbar.ts +105 -18
- package/src/object-renderer/form-detail.ts +87 -2
- package/src/object-renderer/key-field.ts +21 -0
- package/src/object-renderer/layout-facts.ts +18 -2
- package/src/object-renderer/layout-plan.ts +6 -3
- package/src/object-renderer/overlay-decide.ts +44 -2
- package/src/object-renderer/pick-component.ts +8 -2
- package/src/object-renderer/pipeline-mode.ts +6 -0
- package/src/object-renderer/relation-field.ts +79 -0
- package/src/object-renderer/render-object.ts +71 -26
- package/src/object-renderer/request-actions.ts +119 -21
- package/src/object-renderer/table-actions.ts +424 -103
- package/src/object-renderer/table-gap.ts +2 -1
- package/src/object-renderer/table-reorder.ts +237 -0
- package/src/object-renderer/table-summary.ts +26 -12
- package/src/object-renderer/table-tools.ts +428 -128
- package/src/object-renderer/types.ts +91 -2
- package/src/object-renderer/value-present.ts +49 -0
- package/src/page-target/ai-surface.ts +15 -22
- package/src/page-target/compile.ts +5 -6
- package/src/page-target/drift.ts +0 -7
- package/src/page-target/intent-schema.ts +46 -43
- package/src/page-target/target.ts +4 -5
- package/src/page-target/writer-policy.ts +4 -5
- package/src/recipes/chrome-surface.ts +20 -0
- package/src/recipes/code-view.ts +15 -14
- package/src/recipes/color-role.ts +442 -0
- package/src/recipes/compact-group.ts +3 -2
- package/src/recipes/composition-projector.ts +321 -0
- package/src/recipes/container.ts +76 -19
- package/src/recipes/control.ts +64 -5
- package/src/recipes/desc-list.ts +101 -7
- package/src/recipes/divider.ts +30 -9
- package/src/recipes/emphasis.ts +90 -5
- package/src/recipes/field-text.ts +72 -0
- package/src/recipes/form-section.ts +177 -0
- package/src/recipes/frame-bleed.ts +3 -2
- package/src/recipes/index.ts +28 -4
- package/src/recipes/inherited-shell.ts +21 -15
- package/src/recipes/json-view.ts +6 -5
- package/src/recipes/look.ts +56 -0
- package/src/recipes/mark.ts +138 -0
- package/src/recipes/markdown.ts +16 -6
- package/src/recipes/overlay.ts +47 -19
- package/src/recipes/page-width.ts +31 -0
- package/src/recipes/pipeline-runtime.ts +366 -0
- package/src/recipes/placeholder.ts +37 -19
- package/src/recipes/rail-grid.ts +6 -3
- package/src/recipes/self-owned.ts +59 -0
- package/src/recipes/slot-align.ts +5 -3
- package/src/recipes/stat-state.ts +5 -5
- package/src/recipes/state.ts +54 -3
- package/src/recipes/status.ts +14 -14
- package/src/recipes/strip.ts +47 -5
- package/src/recipes/surface-edge.ts +3 -1
- package/src/recipes/surface.ts +33 -4
- package/src/recipes/table-gap.ts +3 -2
- package/src/recipes/table-native-edit.ts +22 -9
- package/src/recipes/table-row.ts +45 -12
- package/src/recipes/tabs.ts +54 -22
- package/src/recipes/text-diff.ts +15 -8
- package/src/recipes/text-fit.ts +132 -0
- package/src/recipes/title-row.ts +68 -3
- package/src/shared/action-func.ts +106 -0
- package/src/shared/color-scheme.ts +127 -0
- package/src/shared/confirm-decl.ts +5 -2
- package/src/shared/danger-facts.ts +55 -0
- package/src/shared/dom-attrs-registry.ts +1009 -0
- package/src/shared/dom-attrs.ts +743 -0
- package/src/shared/field-kind.ts +49 -0
- package/src/shared/field-value-format.ts +58 -12
- package/src/shared/glyphs.ts +127 -0
- package/src/shared/icons.ts +28 -1
- package/src/shared/identifier-field.ts +66 -0
- package/src/shared/list-pager.ts +23 -0
- package/src/shared/list-title.ts +29 -0
- package/src/shared/order-value.ts +15 -0
- package/src/shared/page-attrs-runtime.ts +327 -0
- package/src/shared/page-attrs.ts +262 -0
- package/src/shared/pipeline-mode.ts +64 -0
- package/src/shared/row-key.ts +15 -0
- package/src/shared/theme-runtime-shared.ts +165 -24
- package/src/shared/theme-usage.ts +16 -0
- package/src/shared/value-table-contract.ts +68 -0
- package/src/spatial/action-func.ts +4 -0
- package/src/spatial/declared-actions.ts +116 -0
- package/src/spatial/emit.ts +660 -0
- package/src/spatial/expand.ts +1482 -0
- package/src/spatial/field-types.ts +48 -0
- package/src/spatial/index.ts +82 -0
- package/src/spatial/layout.ts +697 -0
- package/src/spatial/look-apply.ts +206 -0
- package/src/spatial/page-decl.ts +44 -0
- package/src/spatial/page-object.ts +349 -0
- package/src/spatial/recognize.ts +491 -0
- package/src/spatial/self-report.ts +571 -0
- package/src/spatial/shape.ts +205 -0
- package/src/spatial/spatial-map.ts +136 -0
- package/src/spatial/tone.ts +145 -0
- package/src/theme/index.ts +11 -2
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +527 -16
- package/src/theme/kit-theme.tpl +491 -16
- package/src/theme/look-carrier.ts +65 -0
- package/src/theme/nine-dim-structure.ts +522 -185
- package/src/theme/private-vars.ts +153 -0
- package/src/theme/surface-layers.ts +3 -2
- package/src/theme/theme-tokens.ts +1601 -93
- package/src/theme/theme-types.ts +38 -59
- package/src/theme/value-table.ts +2379 -0
- package/src/frames/list-summary.ts +0 -123
- package/src/recipes/nowrap.ts +0 -16
- package/src/theme/block-theme.ts +0 -202
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
8
8
|
import { createKitController, type KitProps } from '../base/shared';
|
|
9
|
+
import { KIT_ATTR_PART } from '../shared/dom-attrs';
|
|
9
10
|
import { analyzeTableGaps, paintTableGapNotes } from '../recipes/table-gap';
|
|
10
11
|
import { KIT_PART_TABLE } from '../recipes/table-row';
|
|
11
12
|
|
|
@@ -29,7 +30,7 @@ export function createKitTableGap(): SomaComponentDefinition {
|
|
|
29
30
|
const rows = Array.isArray(p.rows) ? p.rows : [];
|
|
30
31
|
const fields = fieldsOf(p.fields);
|
|
31
32
|
// 宿主 -> 所属表格外壳(表头与行都在里面)
|
|
32
|
-
const scope = root.closest<HTMLElement>(`[
|
|
33
|
+
const scope = root.closest<HTMLElement>(`[${KIT_ATTR_PART}="${KIT_PART_TABLE}"]`) ?? root.parentElement ?? root.ownerDocument;
|
|
33
34
|
paintTableGapNotes(scope, analyzeTableGaps(rows, fields));
|
|
34
35
|
},
|
|
35
36
|
})),
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// 表格行拖拽排序(collection.reorder: <排序字段>)的纯逻辑与 DOM 接线,供 KitTableTools 使用。
|
|
2
|
+
//
|
|
3
|
+
// 抄 Ant Design Table 的 drag-sorting-handler 示例(行首拖拽柄 + 行为落点,`components/table/demo/drag-sorting-handler.tsx`):
|
|
4
|
+
// 柄是行首的按钮,行是落点(上 / 下沿);拖放经 core 拖放端口(services.engines.dnd),落点算出「纯顺序载荷」经 order_move 抛出,
|
|
5
|
+
// 页面接 `ACTION | data.orderMove`(载荷对齐 Kanban 的 move:target / orderField / position / set / object,序值算法同 kanbanOrderValue)。
|
|
6
|
+
// 键盘替代:焦点在柄上按 ↑ / ↓ 把本行上 / 下移一位(拖放之外的等价操作)。
|
|
7
|
+
// 不乐观改 DOM:行序由数据重取后 core 的 keyed 重排落定(失败不留半截状态)。
|
|
8
|
+
|
|
9
|
+
import { KIT_ATTR_DRAG_HANDLE, KIT_ATTR_GROUP_HEAD, KIT_ATTR_LEAD, KIT_ATTR_ROWS } from '../shared/dom-attrs';
|
|
10
|
+
import { orderValueAt } from '../shared/order-value';
|
|
11
|
+
import { KIT_ICON_CLASS_CANDIDATES, kitIcon } from '../shared/icons';
|
|
12
|
+
import { kitFocusRingRecipe } from '../recipes/state';
|
|
13
|
+
import { mergeClass } from '../shared/merge-class';
|
|
14
|
+
|
|
15
|
+
type Rec = Record<string, unknown>;
|
|
16
|
+
|
|
17
|
+
export interface ReorderDragPort {
|
|
18
|
+
draggable(el: HTMLElement, source: { id: string; data: () => Record<string, unknown>; canDrag?: () => boolean }): () => void;
|
|
19
|
+
dropTarget(el: HTMLElement, target: { id: string; edges?: readonly ('top' | 'bottom' | 'left' | 'right')[]; onOver?(edge: unknown): void; onLeave?(): void }): () => void;
|
|
20
|
+
onMove(handler: (intent: { sourceId: string; targetId: string; edge: unknown }) => void): () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 拖拽柄:行首小按钮,抓取手势、悬停淡底、块焦点环 */
|
|
24
|
+
export const REORDER_HANDLE_CLASS = mergeClass(
|
|
25
|
+
'inline-flex size-6 shrink-0 cursor-grab items-center justify-center rounded-item text-fg-subtle transition-colors hover:bg-state-layer-hover active:cursor-grabbing',
|
|
26
|
+
kitFocusRingRecipe('button'),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const REORDER_LEAD_CLASS = 'flex items-center gap-1';
|
|
30
|
+
export const REORDER_CLASS_CANDIDATES: readonly string[] = Object.freeze([...new Set([
|
|
31
|
+
...REORDER_HANDLE_CLASS.split(/\s+/),
|
|
32
|
+
...REORDER_LEAD_CLASS.split(/\s+/),
|
|
33
|
+
...KIT_ICON_CLASS_CANDIDATES,
|
|
34
|
+
].filter((c) => c !== ''))]);
|
|
35
|
+
|
|
36
|
+
export interface ReorderPayload {
|
|
37
|
+
id: string;
|
|
38
|
+
from: number;
|
|
39
|
+
to: number;
|
|
40
|
+
index: number;
|
|
41
|
+
target: string;
|
|
42
|
+
orderField: string;
|
|
43
|
+
/** 序值:落点相邻两行序值的中点(首行 -1 / 末行 +1 / 无邻行 0),与 Kanban 同一算法 */
|
|
44
|
+
position: number;
|
|
45
|
+
set: Record<string, never>;
|
|
46
|
+
object: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const keyOf = (row: unknown, keyField: string): string => {
|
|
50
|
+
const v = row !== null && typeof row === 'object' ? (row as Rec)[keyField] : undefined;
|
|
51
|
+
return v === undefined || v === null ? '' : String(v);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 一次拖放的纯顺序载荷:把 fromKey 行移到 toKey 行的上沿(edge 'top')或下沿('bottom')。
|
|
56
|
+
* 原位不动(落点就是现位置)、键不存在、与自己落点相同返回 null。
|
|
57
|
+
*/
|
|
58
|
+
export function reorderPayload(
|
|
59
|
+
rows: readonly unknown[], keyField: string, orderField: string, fromKey: string, toKey: string, edge: 'top' | 'bottom', object: string,
|
|
60
|
+
): ReorderPayload | null {
|
|
61
|
+
if (fromKey === '' || toKey === '' || fromKey === toKey) return null;
|
|
62
|
+
const from = rows.findIndex((r) => keyOf(r, keyField) === fromKey);
|
|
63
|
+
if (from < 0) return null;
|
|
64
|
+
const peers = rows.filter((r) => keyOf(r, keyField) !== fromKey);
|
|
65
|
+
const at = peers.findIndex((r) => keyOf(r, keyField) === toKey);
|
|
66
|
+
if (at < 0) return null;
|
|
67
|
+
const position = at + (edge === 'bottom' ? 1 : 0);
|
|
68
|
+
if (position === from) return null;
|
|
69
|
+
const orders = peers.map((r) => Number(r !== null && typeof r === 'object' ? (r as Rec)[orderField] : NaN));
|
|
70
|
+
return {
|
|
71
|
+
id: fromKey, from, to: position, index: position, target: fromKey, orderField,
|
|
72
|
+
position: orderValueAt(orders, position), set: {}, object,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** 键盘移位:把 fromKey 行上移(-1)/ 下移(+1)一位;到头返回 null */
|
|
77
|
+
export function reorderStepPayload(
|
|
78
|
+
rows: readonly unknown[], keyField: string, orderField: string, fromKey: string, step: -1 | 1, object: string,
|
|
79
|
+
): ReorderPayload | null {
|
|
80
|
+
const from = rows.findIndex((r) => keyOf(r, keyField) === fromKey);
|
|
81
|
+
const neighbour = rows[from + step];
|
|
82
|
+
if (from < 0 || neighbour === undefined) return null;
|
|
83
|
+
return reorderPayload(rows, keyField, orderField, fromKey, keyOf(neighbour, keyField), step === -1 ? 'top' : 'bottom', object);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ReorderBindOptions {
|
|
87
|
+
table: ParentNode;
|
|
88
|
+
port: ReorderDragPort | null;
|
|
89
|
+
/** 实例前缀(拖放 id 命名空间) */
|
|
90
|
+
uid: string;
|
|
91
|
+
rows: () => readonly unknown[];
|
|
92
|
+
keyField: string;
|
|
93
|
+
orderField: string;
|
|
94
|
+
object: string;
|
|
95
|
+
handleLabel: (key: string) => string;
|
|
96
|
+
onMove: (payload: ReorderPayload) => void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface BoundRowEntry {
|
|
100
|
+
key: string;
|
|
101
|
+
port: ReorderDragPort | null;
|
|
102
|
+
handle: HTMLButtonElement;
|
|
103
|
+
off: () => void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const tableBound = new WeakMap<ParentNode, Map<Element, BoundRowEntry>>();
|
|
107
|
+
const pendingFocus = new WeakMap<ParentNode, { key: string; at: number }>();
|
|
108
|
+
const PENDING_FOCUS_TTL_MS = 2000;
|
|
109
|
+
|
|
110
|
+
/** 数据行:行容器 `[data-kit-rows]` 的子节点,跳过 <template> 与分组组头 */
|
|
111
|
+
function dataRowsOf(table: ParentNode): Element[] {
|
|
112
|
+
const container = table.querySelector(`[${KIT_ATTR_ROWS}]`);
|
|
113
|
+
if (!container) return [];
|
|
114
|
+
return Array.from(container.children).filter((c) => c.tagName !== 'TEMPLATE' && !c.hasAttribute(KIT_ATTR_GROUP_HEAD));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function findHandleByKey(table: ParentNode, key: string): HTMLButtonElement | null {
|
|
118
|
+
for (const btn of Array.from(table.querySelectorAll<HTMLButtonElement>(`button[${KIT_ATTR_DRAG_HANDLE}]`))) {
|
|
119
|
+
if (btn.getAttribute(KIT_ATTR_DRAG_HANDLE) === key) return btn;
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 给每个数据行的前导槽(data-kit-lead)补拖拽柄并登记拖放;幂等(已绑且键没变的行不动),行键变了才重绑。
|
|
126
|
+
* 返回清理函数(释放全部登记)。无拖放端口时仍放柄 + 键盘移位,只是没有鼠标拖放。
|
|
127
|
+
*/
|
|
128
|
+
export function bindRowReorder(o: ReorderBindOptions): () => void {
|
|
129
|
+
const doc = o.table instanceof Document ? o.table : o.table.ownerDocument;
|
|
130
|
+
const active = doc?.activeElement;
|
|
131
|
+
const activeHandleKey = active instanceof HTMLElement && o.table.contains(active)
|
|
132
|
+
? active.getAttribute(KIT_ATTR_DRAG_HANDLE)
|
|
133
|
+
: null;
|
|
134
|
+
const pending = pendingFocus.get(o.table);
|
|
135
|
+
const canUsePending = pending !== undefined
|
|
136
|
+
&& Date.now() - pending.at <= PENDING_FOCUS_TTL_MS
|
|
137
|
+
&& (!active || active === doc?.body || active === doc?.documentElement || o.table.contains(active));
|
|
138
|
+
const restoreKey = activeHandleKey ?? (canUsePending ? pending!.key : null);
|
|
139
|
+
|
|
140
|
+
let rowMap = tableBound.get(o.table);
|
|
141
|
+
if (!rowMap) {
|
|
142
|
+
rowMap = new Map<Element, BoundRowEntry>();
|
|
143
|
+
tableBound.set(o.table, rowMap);
|
|
144
|
+
}
|
|
145
|
+
const activeRows = new Set<Element>();
|
|
146
|
+
const rows = o.rows();
|
|
147
|
+
|
|
148
|
+
dataRowsOf(o.table).forEach((row, i) => {
|
|
149
|
+
const key = keyOf(rows[i], o.keyField);
|
|
150
|
+
const lead = row.querySelector<HTMLElement>(`[${KIT_ATTR_LEAD}]`);
|
|
151
|
+
if (key === '' || !lead) return;
|
|
152
|
+
activeRows.add(row);
|
|
153
|
+
const prev = rowMap!.get(row);
|
|
154
|
+
if (prev && prev.key === key && prev.port === o.port && lead.contains(prev.handle)) {
|
|
155
|
+
prev.handle.setAttribute('aria-label', o.handleLabel(key));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
prev?.off();
|
|
159
|
+
lead.querySelector(`[${KIT_ATTR_DRAG_HANDLE}]`)?.remove();
|
|
160
|
+
// 前导槽横排:柄 + (勾选框 / 序号)
|
|
161
|
+
for (const c of REORDER_LEAD_CLASS.split(' ')) lead.classList.add(c);
|
|
162
|
+
const rowDoc = row.ownerDocument;
|
|
163
|
+
const handle = rowDoc.createElement('button');
|
|
164
|
+
handle.setAttribute('type', 'button');
|
|
165
|
+
handle.className = REORDER_HANDLE_CLASS;
|
|
166
|
+
handle.setAttribute(KIT_ATTR_DRAG_HANDLE, key);
|
|
167
|
+
handle.setAttribute('aria-label', o.handleLabel(key));
|
|
168
|
+
handle.setAttribute('aria-roledescription', 'sortable');
|
|
169
|
+
handle.appendChild(kitIcon('drag-handle', 'sm'));
|
|
170
|
+
lead.insertBefore(handle, lead.firstChild);
|
|
171
|
+
const cleanups: Array<() => void> = [];
|
|
172
|
+
const onKey = (event: Event): void => {
|
|
173
|
+
const ke = event as KeyboardEvent;
|
|
174
|
+
if (ke.altKey || ke.ctrlKey || ke.metaKey) return;
|
|
175
|
+
const k = ke.key;
|
|
176
|
+
if (k !== 'ArrowUp' && k !== 'ArrowDown') return;
|
|
177
|
+
ke.preventDefault();
|
|
178
|
+
ke.stopPropagation();
|
|
179
|
+
const payload = reorderStepPayload(o.rows(), o.keyField, o.orderField, key, k === 'ArrowUp' ? -1 : 1, o.object);
|
|
180
|
+
if (!payload) return;
|
|
181
|
+
pendingFocus.set(o.table, { key, at: Date.now() });
|
|
182
|
+
o.onMove(payload);
|
|
183
|
+
const curHandle = findHandleByKey(o.table, key);
|
|
184
|
+
if (curHandle && rowDoc.activeElement !== curHandle) {
|
|
185
|
+
curHandle.focus({ preventScroll: true });
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
handle.addEventListener('keydown', onKey);
|
|
189
|
+
cleanups.push(() => handle.removeEventListener('keydown', onKey));
|
|
190
|
+
if (o.port) {
|
|
191
|
+
cleanups.push(o.port.draggable(handle, { id: `${o.uid}:row:${key}`, data: () => ({ id: key }) }));
|
|
192
|
+
cleanups.push(o.port.dropTarget(row as HTMLElement, { id: `${o.uid}:row:${key}`, edges: ['top', 'bottom'] }));
|
|
193
|
+
}
|
|
194
|
+
let cleaned = false;
|
|
195
|
+
const off = (): void => {
|
|
196
|
+
if (cleaned) return;
|
|
197
|
+
cleaned = true;
|
|
198
|
+
for (const fn of cleanups) fn();
|
|
199
|
+
handle.remove();
|
|
200
|
+
rowMap?.delete(row);
|
|
201
|
+
};
|
|
202
|
+
rowMap!.set(row, { key, port: o.port, handle, off });
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// 清理已移除或失键的旧行拖拽与落点句柄,防止端口悬空残留
|
|
206
|
+
for (const [row, entry] of Array.from(rowMap.entries())) {
|
|
207
|
+
if (!activeRows.has(row)) entry.off();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (restoreKey !== null && restoreKey !== '') {
|
|
211
|
+
const targetHandle = findHandleByKey(o.table, restoreKey);
|
|
212
|
+
if (targetHandle) {
|
|
213
|
+
pendingFocus.delete(o.table);
|
|
214
|
+
if (doc?.activeElement !== targetHandle) {
|
|
215
|
+
targetHandle.focus({ preventScroll: true });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return () => {
|
|
221
|
+
pendingFocus.delete(o.table);
|
|
222
|
+
const current = tableBound.get(o.table);
|
|
223
|
+
if (!current) return;
|
|
224
|
+
for (const entry of Array.from(current.values())) entry.off();
|
|
225
|
+
tableBound.delete(o.table);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** 端口的 onMove 意图 -> 载荷(只认本实例前缀的行 id) */
|
|
230
|
+
export function reorderFromIntent(
|
|
231
|
+
intent: { sourceId: string; targetId: string; edge: unknown }, uid: string,
|
|
232
|
+
rows: readonly unknown[], keyField: string, orderField: string, object: string,
|
|
233
|
+
): ReorderPayload | null {
|
|
234
|
+
const prefix = `${uid}:row:`;
|
|
235
|
+
if (!intent.sourceId.startsWith(prefix) || !intent.targetId.startsWith(prefix)) return null;
|
|
236
|
+
return reorderPayload(rows, keyField, orderField, intent.sourceId.slice(prefix.length), intent.targetId.slice(prefix.length), intent.edge === 'bottom' ? 'bottom' : 'top', object);
|
|
237
|
+
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
// KitTableSummary:表格合计行(M 波 G2,写死小组件)。放在表格滚动容器内、行之后,列类与表格列一一对应,
|
|
2
2
|
// 所以固定列 / 对齐 / 列显隐(data-kit-col)与表体同步。只算当前页已载入的行:
|
|
3
|
-
// sum / avg / min / max 只看有限数值,count 数非空值;没有可算的值时该格留空。结果按列的 format
|
|
3
|
+
// sum / avg / min / max 只看有限数值,count 数非空值;没有可算的值时该格留空。结果按列的 format 显示:
|
|
4
|
+
// 百分比 / 金额与正文值组件同一组格式化 helper(base/text.ts#kitFormatMeasureValue,同样读列的 unit / currency / decimals,D-09),其余格式走 formatValue。
|
|
4
5
|
|
|
6
|
+
import { kitApplyLevelClass } from '../data/level-class';
|
|
5
7
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
6
8
|
import { CLASS_PROP, createKitController, formatValue, str } from '../base/shared';
|
|
9
|
+
import { kitDecimalsOf, kitFormatMeasureValue } from '../base/text';
|
|
7
10
|
import { kitText } from '../i18n/kit-text';
|
|
11
|
+
import { KIT_ATTR_COL } from '../shared/dom-attrs';
|
|
12
|
+
import { kitFieldPropsOf, kitMarkLevel, kitMarkPart, kitMergeAlignOverflow } from '../data/kit-contract';
|
|
8
13
|
|
|
9
14
|
type Op = 'sum' | 'avg' | 'min' | 'max' | 'count';
|
|
10
15
|
|
|
11
|
-
interface SumColumn { field: string; class: string; op: Op | ''; format: string }
|
|
16
|
+
interface SumColumn { field: string; class: string; op: Op | ''; format: string; unit: string; currency: string; decimals: number | undefined }
|
|
12
17
|
|
|
13
18
|
function columnsOf(raw: unknown): SumColumn[] {
|
|
14
19
|
if (!Array.isArray(raw)) return [];
|
|
@@ -17,7 +22,7 @@ function columnsOf(raw: unknown): SumColumn[] {
|
|
|
17
22
|
if (item === null || typeof item !== 'object') continue;
|
|
18
23
|
const r = item as Record<string, unknown>;
|
|
19
24
|
const op = r.op === 'sum' || r.op === 'avg' || r.op === 'min' || r.op === 'max' || r.op === 'count' ? r.op : '';
|
|
20
|
-
out.push({ field: str(r.field), class: str(r.class), op, format: str(r.format) });
|
|
25
|
+
out.push({ field: str(r.field), class: str(r.class), op, format: str(r.format).trim(), unit: str(r.unit).trim(), currency: str(r.currency).trim(), decimals: kitDecimalsOf(r.decimals) });
|
|
21
26
|
}
|
|
22
27
|
return out;
|
|
23
28
|
}
|
|
@@ -34,12 +39,14 @@ export function summarize(op: Op, rows: readonly unknown[], field: string): numb
|
|
|
34
39
|
return op === 'avg' ? sum / nums.length : sum;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
42
|
+
/** 合计值的显示文字(纯函数):count 列不带格式;百分比 / 金额与正文同一出口(D-09:正文 35% 合计不再显示 3,500%,正文 ¥12,345.60 合计不再显示 12345.6) */
|
|
43
|
+
export function summaryDisplay(value: number, col: Pick<SumColumn, 'format' | 'unit' | 'currency' | 'decimals'>): string {
|
|
44
|
+
// 消除 IEEE-754 浮点尾差(如 0.1 + 0.2 = 0.30000000000000004),不强行截断两位小数,交由格式化按列格式精准格式化
|
|
45
|
+
const clean = Number(value.toPrecision(12));
|
|
46
|
+
const measured = kitFormatMeasureValue(clean, col);
|
|
47
|
+
if (measured !== null) return measured;
|
|
48
|
+
if (col.format === '') return String(clean);
|
|
49
|
+
return formatValue(clean, col.format, '');
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
export function createKitTableSummary(): SomaComponentDefinition {
|
|
@@ -49,7 +56,7 @@ export function createKitTableSummary(): SomaComponentDefinition {
|
|
|
49
56
|
layer: 'data',
|
|
50
57
|
props: {
|
|
51
58
|
rows: { type: 'array', default: [], desc: '当前页行数组' },
|
|
52
|
-
columns: { type: 'array', default: [], desc: '列 [{ field, class, op?, format? }];op = sum / avg / min / max / count' },
|
|
59
|
+
columns: { type: 'array', default: [], desc: '列 [{ field, class, op?, format?, unit?, currency?, decimals? }];op = sum / avg / min / max / count;format / unit / currency / decimals 与正文值组件同一份(编译期从列的值组件入参抄来),合计格按它们与正文同一口径格式化' },
|
|
53
60
|
label: { type: 'string', default: '', desc: '合计行的标题文字' },
|
|
54
61
|
labelField: { type: 'string', default: '', desc: '标题放在哪一列(字段名)' },
|
|
55
62
|
selectClass: { type: 'string', default: '', desc: '选择列占位格的类(空 = 无选择列)' },
|
|
@@ -65,6 +72,8 @@ export function createKitTableSummary(): SomaComponentDefinition {
|
|
|
65
72
|
const doc = root.ownerDocument;
|
|
66
73
|
const rows = Array.isArray(p.rows) ? p.rows : [];
|
|
67
74
|
root.className = str(p.class);
|
|
75
|
+
// 合计行是集合里的汇总带:自报「淡底带」
|
|
76
|
+
kitMarkLevel(root, 'band'); kitApplyLevelClass(root);
|
|
68
77
|
// aria-label 只在有角色的元素上合法:表格语义(role=table 的外壳)下合计行是 row,其余情况不写名称
|
|
69
78
|
const tableRoles = str(p.semantics, 'none') === 'table';
|
|
70
79
|
if (tableRoles) {
|
|
@@ -87,12 +96,17 @@ export function createKitTableSummary(): SomaComponentDefinition {
|
|
|
87
96
|
const el = doc.createElement('div');
|
|
88
97
|
el.className = col.class;
|
|
89
98
|
if (tableRoles) el.setAttribute('role', 'cell');
|
|
90
|
-
el.setAttribute(
|
|
99
|
+
el.setAttribute(KIT_ATTR_COL, col.field);
|
|
100
|
+
// 合计格:元素部件「格」;对齐与表头 / 单元格读同一份字段级判定(props.kit.fields[列],没有时按列类原样)
|
|
101
|
+
kitMarkPart(el, 'cell');
|
|
102
|
+
const align = kitFieldPropsOf(p, col.field).align;
|
|
103
|
+
// 自己已有的优先:列类串里已有文本对齐时以它为准(与表头、正文同一口径)
|
|
104
|
+
if (align !== undefined) el.className = kitMergeAlignOverflow(col.class, align, undefined);
|
|
91
105
|
if (col.field === str(p.labelField)) {
|
|
92
106
|
el.textContent = str(p.label, kitText('soma.kit.total_label', undefined, root));
|
|
93
107
|
} else if (col.op !== '') {
|
|
94
108
|
const v = summarize(col.op, rows, col.field);
|
|
95
|
-
el.textContent = v === null ? '' :
|
|
109
|
+
el.textContent = v === null ? '' : summaryDisplay(v, col.op === 'count' ? { format: '', unit: '', currency: '', decimals: undefined } : col);
|
|
96
110
|
}
|
|
97
111
|
root.appendChild(el);
|
|
98
112
|
}
|