soma-kit 0.1.13 → 0.1.15
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/package.json +3 -3
- package/packs/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- package/spec/generated/kit-app.schema.json +18 -2
- package/spec/generated/kit-page.schema.json +95 -0
- package/spec/kit-grammar.json +332 -75
- package/spec/kit-grammar.schema.json +1 -27
- package/src/app/app-config.ts +11 -5
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +82 -10
- package/src/app/define-kit-app.ts +6 -5
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +20 -8
- package/src/app/kit-view-context.ts +30 -4
- package/src/app/server-pages.ts +5 -1
- package/src/app/server.ts +15 -5
- package/src/app/theme-endpoint.ts +1 -1
- package/src/app/theme-runtime.ts +7 -2
- package/src/base/alert.ts +23 -20
- package/src/base/anchored-layer.ts +1 -1
- package/src/base/button.ts +34 -17
- package/src/base/cascader.ts +8 -4
- package/src/base/check-core.ts +9 -6
- package/src/base/color-picker.ts +10 -6
- package/src/base/command-palette.ts +10 -4
- package/src/base/context-menu.ts +5 -2
- package/src/base/date-range.ts +9 -6
- package/src/base/date.ts +10 -6
- package/src/base/delta.ts +4 -2
- package/src/base/divider.ts +15 -66
- package/src/base/end-edge.ts +14 -2
- package/src/base/fab.ts +11 -6
- package/src/base/gap-value.ts +25 -5
- package/src/base/hint-tips.ts +1 -1
- package/src/base/illustrations.ts +2 -1
- package/src/base/index.ts +20 -4
- package/src/base/inline-error.ts +84 -0
- package/src/base/input.ts +54 -18
- package/src/base/kbd.ts +4 -3
- package/src/base/link.ts +1 -1
- package/src/base/listbox-core.ts +70 -22
- package/src/base/mentions.ts +6 -3
- package/src/base/menu-button.ts +73 -50
- package/src/base/menu-core.ts +9 -2
- package/src/base/motion/hover-3d.ts +4 -1
- package/src/base/motion/hover-gallery.ts +4 -1
- package/src/base/otp.ts +7 -3
- package/src/base/overlay-runtime.ts +3 -2
- package/src/base/overlay-shell.ts +141 -0
- package/src/base/popover.ts +7 -6
- package/src/base/popup.ts +47 -41
- package/src/base/qty-stepper.ts +14 -9
- package/src/base/reason-tip.ts +2 -2
- package/src/{frames → base}/resize-handle.ts +1 -1
- package/src/base/segmented.ts +44 -35
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +52 -18
- package/src/base/state-panel.ts +34 -13
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +56 -57
- package/src/base/text.ts +38 -14
- package/src/base/textarea.ts +1 -1
- package/src/base/time-picker.ts +9 -5
- package/src/base/tree-select.ts +12 -9
- package/src/base/upload.ts +26 -17
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +10 -9
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +7 -6
- package/src/biz/category-crud/compile.ts +20 -6
- package/src/biz/category-crud/shell.ts +10 -7
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +15 -13
- package/src/biz/compose.ts +5 -5
- package/src/biz/data-components.ts +4 -0
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +17 -13
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +6 -5
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +269 -27
- package/src/biz/master-sub/detail-head.ts +62 -0
- package/src/biz/master-sub/index.ts +5 -4
- package/src/biz/master-sub/shell.ts +138 -69
- package/src/biz/multi-board/compile.ts +166 -11
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +25 -10
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +96 -24
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +15 -7
- package/src/biz/page-templates/domain-templates.ts +7 -3
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +5 -4
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
- package/src/biz/page-templates/sign-in-page/shell.ts +18 -18
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +12 -11
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +14 -10
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +83 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +76 -4
- package/src/biz/shared/overlay-shell.ts +65 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +13 -7
- package/src/biz/standard-crud/compile.ts +24 -4
- package/src/biz/standard-crud/shell.ts +38 -30
- package/src/biz/standard-crud/summary.ts +42 -0
- package/src/biz/step-form/compile.ts +1 -1
- package/src/biz/step-form/hub.ts +4 -0
- package/src/biz/step-form/shell.ts +16 -12
- package/src/biz/types.ts +15 -3
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +35 -8
- package/src/cli/kit-init.ts +149 -0
- package/src/cli/layout-cli.ts +7 -7
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +36 -230
- package/src/compile/component-candidates.ts +4 -1
- package/src/compile/hints.ts +5 -58
- package/src/compile/index.ts +2 -2
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +97 -18
- package/src/compile/layout-lint/rules-form.ts +6 -7
- package/src/compile/layout-lint/rules-table.ts +98 -14
- package/src/compile/page-composition.ts +191 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +80 -32
- package/src/compile/types.ts +5 -3
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +6 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +13 -5
- package/src/data/assignment-picker.ts +35 -20
- package/src/data/async-result-panel.ts +7 -3
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +10 -4
- package/src/data/carousel.ts +13 -5
- package/src/data/chart.ts +745 -48
- package/src/data/checklist.ts +9 -5
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +9 -3
- package/src/data/confirm-dialog.ts +57 -20
- package/src/data/diff.ts +4 -1
- package/src/data/dock.ts +5 -1
- package/src/data/embed.ts +1 -1
- package/src/data/engine-ports.ts +126 -0
- package/src/data/field-mapper.ts +16 -7
- package/src/data/flow-editor.ts +106 -29
- package/src/data/footer.ts +8 -2
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +8 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +22 -8
- package/src/data/item-list.ts +11 -3
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +13 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +400 -0
- package/src/data/media-grid.ts +5 -2
- package/src/data/mega-menu.ts +4 -3
- package/src/data/menu-dom.ts +9 -8
- package/src/data/menu.ts +35 -17
- package/src/data/mockup.ts +12 -8
- package/src/data/modal-dialog.ts +108 -57
- package/src/data/navbar.ts +13 -7
- package/src/data/notice-list.ts +53 -20
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +248 -151
- package/src/data/pager.ts +15 -10
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +19 -9
- package/src/data/permission-tree.ts +30 -13
- package/src/data/pricing-table.ts +10 -4
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +30 -14
- package/src/data/record-picker.ts +8 -4
- package/src/data/redirect.ts +1 -1
- package/src/data/request-console.ts +20 -7
- package/src/data/resident.ts +6 -10
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +12 -7
- package/src/data/rule-builder.ts +22 -11
- package/src/data/shape-util.ts +26 -14
- package/src/data/stat-group.ts +369 -84
- package/src/data/static-lazy.ts +7 -0
- package/src/data/static-registry.ts +14 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +13 -4
- package/src/data/system-switcher.ts +17 -7
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +8 -4
- package/src/data/transfer.ts +24 -11
- package/src/data/tree-table.ts +84 -17
- package/src/data/tree.ts +6 -3
- package/src/data/virtual-rows.ts +22 -11
- package/src/data/wrap.ts +2 -2
- package/src/data/wrapped-candidates.ts +22 -1
- package/src/frames/index.ts +4 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +123 -0
- package/src/frames/page-bar.ts +10 -16
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +37 -17
- package/src/frames/split-frame/shell.ts +17 -11
- package/src/frames/split-frame/wiring.ts +2 -2
- package/src/frames/tabs-frame/shell.ts +17 -9
- package/src/frames/top-main-frame.ts +1 -1
- package/src/frames/types.ts +6 -3
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +4 -3
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +156 -91
- package/src/generated/kit-grammar-runtime.ts +227 -58
- package/src/i18n/kit-text.ts +141 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +169 -0
- package/src/object-renderer/action-more.ts +160 -0
- package/src/object-renderer/arrange.ts +86 -26
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +72 -20
- package/src/object-renderer/collection-table.ts +178 -65
- package/src/object-renderer/collection.ts +129 -83
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +10 -5
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +7 -0
- package/src/object-renderer/emit-static.ts +243 -87
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +13 -2
- package/src/object-renderer/index.ts +6 -1
- package/src/object-renderer/layout-facts.ts +46 -6
- package/src/object-renderer/layout-plan.ts +136 -43
- package/src/object-renderer/layout-plan.types.ts +42 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/parts.ts +7 -259
- package/src/object-renderer/render-object.ts +60 -47
- package/src/object-renderer/table-actions.ts +135 -56
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +63 -25
- package/src/object-renderer/types.ts +16 -22
- package/src/recipes/app-blocks.ts +66 -0
- package/src/recipes/code-view.ts +56 -0
- package/src/recipes/compact-group.ts +31 -0
- package/src/recipes/container.ts +54 -13
- package/src/recipes/control.ts +77 -157
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +60 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +34 -1
- package/src/recipes/inherited-shell.ts +37 -0
- package/src/recipes/json-view.ts +49 -0
- package/src/recipes/markdown.ts +86 -0
- package/src/recipes/overlay.ts +149 -18
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +21 -5
- package/src/recipes/rail-grid.ts +3 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +20 -28
- package/src/recipes/status.ts +17 -8
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +120 -11
- package/src/recipes/tabs.ts +126 -0
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +7 -5
- package/src/recipes/typography.ts +24 -43
- package/src/shared/diagnostics.ts +16 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-value-format.ts +246 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +12 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- package/src/shared/path-guard.ts +1 -1
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/theme-runtime-shared.ts +19 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +49 -14
- package/src/theme/kit-theme.tpl +49 -14
- package/src/theme/nine-dim-structure.ts +129 -37
- package/src/theme/surface-layers.ts +17 -4
- package/src/theme/theme-tokens.ts +16 -5
- package/src/theme/typography.ts +21 -17
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- /package/src/{base → shared}/class-candidates.ts +0 -0
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
// 集合排布:table / cards / stack -> KitLayoutIR。table 用 div 栅格表,列在编译期展开。
|
|
2
2
|
|
|
3
3
|
import { kitRowActionsNarrowTier, kitRuleTableOf, kitTextWidthEm } from 'soma-foundation/kit-layout';
|
|
4
|
+
import { KIT_ARRANGE } from 'soma-foundation/arrange';
|
|
5
|
+
import { columnClassOfType } from 'soma-foundation/arrange/table';
|
|
6
|
+
import { kitText } from '../i18n/kit-text';
|
|
4
7
|
import { arrange, buildCell, type KitCellEnv } from './arrange';
|
|
5
8
|
import {
|
|
6
9
|
KIT_CLASS_DEFAULTS, KIT_CONTEXT_MENU, KIT_OBJECT_DEFAULTS, KIT_SKELETON, KIT_TABLE_EXT, KIT_TABLE_VIRTUAL, KIT_TREE_TABLE, KIT_WIDTH,
|
|
7
10
|
} from './defaults';
|
|
8
11
|
import {
|
|
9
12
|
actionsStepOf, alignClass, columnFilterOf, columnMetaOf, parseBatch, parseColExt, parseColumnGroups, parseEditMode, parseSelect, parseSummary, parseToolbar,
|
|
10
|
-
|
|
13
|
+
columnTrackPlan, dateContentEm, pillColumnType, plainRowClass, pyTokens, resolveResizable, resolveStickyCombo, scrollRowClass, scrollStepOf, STICKY_HEAD_CLASS, STICKY_HEAD_COMBO_CLASS, stepOf, stickyPlan, type ColExt, type ColGroup,
|
|
11
14
|
} from './collection-table';
|
|
15
|
+
import { splitRowActions } from './table-actions';
|
|
12
16
|
import { expandListIR, parseExpandDecl } from './collection-expand';
|
|
13
|
-
import { checkClasses, mergeClass } from '
|
|
14
|
-
import {
|
|
17
|
+
import { checkClasses, mergeClass } from '../shared/merge-class';
|
|
18
|
+
import { kitDividerVariantRecipe, kitStripBoundaryClasses } from '../recipes/divider';
|
|
19
|
+
import { hintOf, nameSuggestion } from '../shared/hints';
|
|
15
20
|
import { checkRowPath } from './view-binding';
|
|
16
|
-
import {
|
|
21
|
+
import { gridColsClasses, gridLevels, partsOverflow } from './parts';
|
|
17
22
|
|
|
18
23
|
/** 表头 / 行的栅格间距与横向内边距类(含容器查询变体 @lg:):带边框的整格网格模式里由单元格自己的内边距接管,整组去掉 */
|
|
19
24
|
const GRID_SPACING_TOKEN = /^(?:@[a-z0-9]+:)?(?:gap-\d+|gap-x-\d+|px-\d+)$/;
|
|
25
|
+
/** bordered: true 网格表的列间竖线(表头与数据格同一组):分隔线出口,非末列朝结束侧一条(KT-B5 / KT-B8 第 4 点) */
|
|
26
|
+
const GRID_COL_DIVIDER = kitDividerVariantRecipe('end', 'not-last');
|
|
20
27
|
import type {
|
|
21
28
|
KitAction,
|
|
22
29
|
KitDiagnostic,
|
|
@@ -64,7 +71,9 @@ function stateOf(c: KitCollectionStateDecl, env: KitCollectionEnv, path: string)
|
|
|
64
71
|
}
|
|
65
72
|
return v;
|
|
66
73
|
};
|
|
67
|
-
|
|
74
|
+
// 能预知版式的集合缺省出骨架(KT-K-table-6 / KT-K-empty-3,二-17):没写 loading 文案即骨架(形态由发射处按列 / 卡片推,推不出时回落文字盒);
|
|
75
|
+
// 写了自定义 loading 文案的按文案
|
|
76
|
+
const skeleton = c.loading === KIT_SKELETON.keyword || c.loading === undefined;
|
|
68
77
|
return { loading: skeleton ? STATE_DEFAULTS.loading : text('loading'), empty: text('empty'), error: text('error'), skeleton };
|
|
69
78
|
}
|
|
70
79
|
|
|
@@ -319,47 +328,42 @@ function keptInlineActionEm(actions: ReadonlyArray<{ name: string; tone?: string
|
|
|
319
328
|
return kept === undefined ? undefined : kitTextWidthEm(kept.name);
|
|
320
329
|
}
|
|
321
330
|
|
|
322
|
-
/**
|
|
323
|
-
function
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
/** 贴右固定操作格的原始类令牌(无容器查询前缀);headRow 为真时用表头带底色遮罩,避免吸右表头露白块 */
|
|
332
|
+
function stickyEndTokens(rowPy: readonly string[], headRow = false): string[] {
|
|
333
|
+
const pad = rowPy.flatMap((t) => {
|
|
334
|
+
const m = /^((?:[^:]+:)*)py-(.+)$/.exec(t);
|
|
335
|
+
return m === null ? [] : [`${m[1]}-my-${m[2]}`, t];
|
|
336
|
+
});
|
|
337
|
+
// 列表页对齐轴(祖先带 data-kit-axis)里行的左右内缩落在文字轴上,但贴右固定的格贴的是滚动容器边缘、不吃行内缩:格自己补轴内边距(content-box:宽度档不变,底仍铺到边缘),操作文字才落在右轴上
|
|
338
|
+
const axis = ['in-data-kit-axis:pe-card', 'in-data-kit-axis:box-content'];
|
|
339
|
+
const baseTokens = KIT_CLASS_DEFAULTS.tableNarrowStickyEnd
|
|
340
|
+
.split(/\s+/)
|
|
341
|
+
.map((t) => (headRow && t === 'before:bg-surface' ? 'before:bg-surface-band' : t));
|
|
342
|
+
return [...baseTokens, ...KIT_CLASS_DEFAULTS.tableEdgeRight.split(/\s+/), ...axis, ...pad].filter((t) => t !== '');
|
|
333
343
|
}
|
|
334
344
|
|
|
335
345
|
/**
|
|
336
346
|
* 窄容器档贴右固定操作格的类:classDefaults.tableNarrowStickyEnd + 抵消行纵向内边距(py-N → -my-N 再补回 py-N,内容仍居中),
|
|
337
347
|
* 整串加 `@max-<档>:` 前缀,窄档线以上(含)不生效、宽表输出不变。
|
|
338
348
|
*/
|
|
339
|
-
export function narrowStickyEnd(rowPy: readonly string[], tier: string): string {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
349
|
+
export function narrowStickyEnd(rowPy: readonly string[], tier: string, headRow = false): string {
|
|
350
|
+
return stickyEndTokens(rowPy, headRow).map((t) => `@max-${tier}:${t}`).join(' ');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** 宽表溢出吸右操作格(表最小宽超出桌面常规容器时无条件 sticky right-0 + 实底遮罩,防止宽表操作列掉出视口) */
|
|
354
|
+
const WIDE_TABLE_OVERFLOW_MIN_UNITS = 168;
|
|
355
|
+
function wideStickyEnd(rowPy: readonly string[], headRow = false): string {
|
|
356
|
+
return stickyEndTokens(rowPy, headRow).join(' ');
|
|
345
357
|
}
|
|
346
358
|
|
|
347
359
|
/**
|
|
348
|
-
*
|
|
349
|
-
*
|
|
360
|
+
* 表壳内层类:内层最小宽 = 列轨最小宽之和(columnTrackPlan.innerMinUnits,替换默认的固定最小宽),
|
|
361
|
+
* 容器放不下由外壳(overflow-x-auto)横向滚动;容器放得下时内层随容器宽、主列吸收余量。
|
|
350
362
|
*/
|
|
351
|
-
export function
|
|
363
|
+
export function trackInnerClass(base: string, plan: { innerMinUnits: number } | null): string {
|
|
352
364
|
if (plan === null) return base;
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
const wideMin = toks.map((t) => /^(@[a-z0-9]+):min-w-(\d+)$/.exec(t)).find((m) => m !== null);
|
|
356
|
-
if (narrowMin === undefined || narrowMin === null || wideMin === undefined || wideMin === null) return base;
|
|
357
|
-
const nMin = Number(narrowMin[1]);
|
|
358
|
-
const wMin = Number(wideMin[2]);
|
|
359
|
-
const need = plan.innerMinUnits;
|
|
360
|
-
if (need <= nMin) return base;
|
|
361
|
-
const rest = toks.filter((t) => !/^(?:@[a-z0-9]+:)?min-w-\d+$/.test(t));
|
|
362
|
-
return [...rest, `min-w-${need}`, `${wideMin[1]}:min-w-${Math.max(wMin, need)}`, ...(need > wMin ? [`@${tier}:min-w-${wMin}`] : [])].join(' ');
|
|
365
|
+
const rest = base.split(/\s+/).filter((t) => t !== '' && !/^(?:@[a-z0-9]+:)?min-w-\d+$/.test(t));
|
|
366
|
+
return [...rest, `min-w-${plan.innerMinUnits}`].join(' ');
|
|
363
367
|
}
|
|
364
368
|
|
|
365
369
|
export function collection(
|
|
@@ -474,22 +478,23 @@ export function collection(
|
|
|
474
478
|
: baseActionParts;
|
|
475
479
|
const avail = KIT_WIDTH.totalParts - selectParts - actionParts;
|
|
476
480
|
// 树表的 width 是权重(不要求和为 12、不报超出):没写的列按内容类型取默认权重,按比例分满可用份数
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
+
// 平铺表格没有任何列写 width 份数时同样按内容类型取默认权重(短标识 / 状态 / 数字窄、文本居中、长文本宽),不再等分:宽屏下 5 列不会被拉成等宽
|
|
482
|
+
const noDeclaredWidth = refs.every((r) => !(typeof r.width === 'number' && r.width > 0));
|
|
483
|
+
// 列宽由列轨求解(排布引擎 arrangeColumns:内容类 × 编译期信息 → [最小, 理想, 最大],见 collection-table.columnTrackPlan);
|
|
484
|
+
// 页面显式写了 width 份数的列按份数权重分余量(树表的份数是权重,不要求和为 12、不报超出;平铺表超出可用份数仍报 KIT-OBJ-004)
|
|
485
|
+
if (!scroll && !isTree && !noDeclaredWidth && partsOverflow(widths, avail)) {
|
|
481
486
|
env.diagnostics.push({
|
|
482
487
|
code: 'KIT-OBJ-004',
|
|
483
488
|
path: `${env.path}.collection`,
|
|
484
489
|
message: `列宽份数超出可用 ${avail} 份(总 ${KIT_WIDTH.totalParts},选择列 ${selectParts},操作列 ${actionParts})`,
|
|
485
490
|
});
|
|
486
491
|
}
|
|
487
|
-
const
|
|
488
|
-
const steps = refs.map((r, i) => stepOf(ext[i]!, r.width));
|
|
492
|
+
const steps = refs.map((r, i) => scrollStepOf(ext[i]!, r.width, typeof r.label === 'string' ? r.label : (env.schema[r.name]?.name ?? '')));
|
|
489
493
|
const selectStep = select === 'none' ? 0 : X.scroll.selectStep;
|
|
490
494
|
const actionsStep = actionsStepOf(rowActions.length);
|
|
495
|
+
const scrollWideActionsSticky = scroll && actionParts > 0 && !sticky && selectStep + actionsStep + steps.reduce((s, n) => s + n, 0) > WIDE_TABLE_OVERFLOW_MIN_UNITS;
|
|
491
496
|
// 表头行层级:并存、或虚拟滚动 + 固定列时抬到 z-20(表体固定格 z-10,同层时 DOM 靠后者在上,会盖住表头)
|
|
492
|
-
const headAboveFixed = scroll && (combo || (virt !== null && ext.some((e) => e.fixed !== undefined)));
|
|
497
|
+
const headAboveFixed = scroll && (combo || (virt !== null && (ext.some((e) => e.fixed !== undefined) || scrollWideActionsSticky)));
|
|
493
498
|
const plan = scroll ? stickyPlan(steps, ext, selectStep, actionsStep) : null;
|
|
494
499
|
const densityToolbar = toolbar.includes('density');
|
|
495
500
|
const bodyPy = pyTokens(dens.row);
|
|
@@ -499,19 +504,25 @@ export function collection(
|
|
|
499
504
|
const stripeSticky = striped ? D.tableCellStickyStriped : '';
|
|
500
505
|
const join = (...xs: Array<string | readonly string[]>): string => xs.flatMap((x) => (typeof x === 'string' ? [x] : [...x])).filter((x) => x !== '').join(' ');
|
|
501
506
|
|
|
502
|
-
//
|
|
503
|
-
|
|
504
|
-
const
|
|
505
|
-
const
|
|
507
|
+
// 列轨(非滚动模式:平铺 / 吸顶 / 树表 / 虚拟滚动共用,见 collection-table.columnTrackPlan);
|
|
508
|
+
// 窄档贴右固定操作格只用于平铺表(非树表、非吸顶表),低于 design 窄档线的容器里数据列横向滚动、操作格不被滚走
|
|
509
|
+
const trackOn = !scroll;
|
|
510
|
+
const narrowEnd = !scroll && !isTree && !sticky;
|
|
511
|
+
const narrowTier = trackOn ? kitRowActionsNarrowTier() : '';
|
|
506
512
|
const cells: KitCell[] = [];
|
|
507
513
|
const head: KitHeadCell[] = [];
|
|
508
514
|
const colExt: ColExt[] = [];
|
|
509
515
|
const summaryCellClasses: string[] = [];
|
|
516
|
+
// 滚动模式的主列:第一个不固定的文本类列吸收余量(容器宽过合计宽时 `grow`,列宽 w-N 仍是它的最小基准);写了可拖宽 / 多级表头时不吸收(列宽由拖拽 / 分组块定)
|
|
517
|
+
const scrollMainIdx = scroll && groups.length === 0 && !ext.some((e) => e.resizable === true)
|
|
518
|
+
? refs.findIndex((r, i) => ext[i]!.fixed === undefined && (KIT_ARRANGE.columns.mainClasses as readonly string[]).includes(columnClassOfType(env.schema[r.name]?.type ?? 'text')))
|
|
519
|
+
: -1;
|
|
520
|
+
const growScrollCell = D.tableScrollCell.split(/\s+/).map((t) => (t === 'flex-none' ? 'shrink-0 grow' : t)).join(' ');
|
|
510
521
|
refs.forEach((r, i) => {
|
|
511
|
-
const p = parts[i]!;
|
|
512
522
|
const ex = ext[i]!;
|
|
513
|
-
|
|
514
|
-
const
|
|
523
|
+
// 非滚动模式的列宽类(轨类)在下面的 track 里统一并到表头 / 行格 / 汇总格,这里只留空
|
|
524
|
+
const widthCls = scroll ? join(i === scrollMainIdx ? growScrollCell : D.tableScrollCell, `w-${steps[i]}`) : '';
|
|
525
|
+
const cell = buildCell(r, env, i, widthCls, { base: 1, wide: 1, full: 1 }, view, '');
|
|
515
526
|
if (!cell) return;
|
|
516
527
|
if (isTree && cell.action !== undefined) {
|
|
517
528
|
// 树表体是整体渲染的写死形状组件,单元格里没有可挂事件的字段实例
|
|
@@ -531,7 +542,7 @@ export function collection(
|
|
|
531
542
|
const stk = plan !== null && plan.offset[i] !== '';
|
|
532
543
|
const edge = plan === null ? '' : plan.edgeLeft === i ? D.tableEdgeLeft : plan.edgeRight === i ? D.tableEdgeRight : '';
|
|
533
544
|
const gridBorderCell = bordered && !scroll ? ['flex', 'items-center', 'px-3', ...bodyPy, ...denseRow] : [];
|
|
534
|
-
const colDivider = bordered ?
|
|
545
|
+
const colDivider = bordered ? GRID_COL_DIVIDER : '';
|
|
535
546
|
cell.cellClass = join(
|
|
536
547
|
cell.cellClass, al, ex.ellipsis ? D.tableCellEllipsis : '',
|
|
537
548
|
scroll ? [...bodyPy, ...denseRow] : gridBorderCell,
|
|
@@ -554,7 +565,6 @@ export function collection(
|
|
|
554
565
|
}
|
|
555
566
|
}
|
|
556
567
|
cells.push(cell);
|
|
557
|
-
keptParts.push(p);
|
|
558
568
|
colExt.push(ex);
|
|
559
569
|
// 固定列组:sticky / 偏移 / 边缘类挂在组块上(叶子格不再各自 sticky);左固定取首列偏移,右固定取末列偏移
|
|
560
570
|
const gi = groupOfName.get(r.name) ?? -1;
|
|
@@ -569,7 +579,7 @@ export function collection(
|
|
|
569
579
|
}
|
|
570
580
|
const headGridBorder = bordered && !scroll ? ['flex', 'items-center', 'px-3', ...headPy, ...denseHead] : [];
|
|
571
581
|
// 表头列间竖分隔线只在显式 bordered: true(完整网格线)时有;默认表头只有下分隔线(2026-11-17 评审 S6)
|
|
572
|
-
const headTick = bordered ?
|
|
582
|
+
const headTick = bordered ? GRID_COL_DIVIDER : '';
|
|
573
583
|
const headCls = join(
|
|
574
584
|
widthCls, 'truncate', 'whitespace-nowrap', al,
|
|
575
585
|
scroll ? [...headPy, ...denseHead] : headGridBorder,
|
|
@@ -588,24 +598,52 @@ export function collection(
|
|
|
588
598
|
}
|
|
589
599
|
head.push(h);
|
|
590
600
|
summaryCellClasses.push(join(
|
|
591
|
-
widthCls, al,
|
|
601
|
+
widthCls, al, 'overflow-hidden whitespace-nowrap truncate',
|
|
592
602
|
scroll ? [...bodyPy, ...denseRow] : '',
|
|
593
|
-
|
|
603
|
+
// 合计行固定列用与合计行一致的实底 bg-surface-sunken + z-20 遮罩,避免滚动数字透叠到固定列下
|
|
604
|
+
stk ? ['sticky z-20 bg-surface-sunken', plan!.offset[i]!, edge] : '',
|
|
594
605
|
));
|
|
595
606
|
});
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
607
|
+
// 宽档行内动作(与发射 KitTableActions 同一个切分函数):操作列按这些动作的文案估宽定宽
|
|
608
|
+
const wideSplit = rowActions.length > 0
|
|
609
|
+
? splitRowActions(rowActions.map((a) => ({ id: a.id, name: a.name, tone: a.tone === 'primary' ? 'primary' as const : a.tone === 'danger' ? 'danger' as const : 'neutral' as const, ...(a.more === true ? { more: true } : {}) })), kitRuleTableOf().rowActions.maxInline.wide, false)
|
|
610
|
+
: null;
|
|
611
|
+
const narrowGrid = trackOn && head.length > 0
|
|
612
|
+
? columnTrackPlan({
|
|
613
|
+
columns: head.map((h, i) => {
|
|
614
|
+
const r = refs.find((x) => x.name === cells[i]?.field);
|
|
615
|
+
const f = env.schema[cells[i]?.field ?? ''];
|
|
616
|
+
// 枚举 / 标签列的格子内容是带内边距的药丸:轨道最小宽 ≥ 最长选项文案 + 药丸内边距,药丸不会在窄格里竖着折成一字一行
|
|
617
|
+
const cellOptions = cells[i]?.props.options;
|
|
618
|
+
const options = Array.isArray(cellOptions) ? cellOptions : f?.options;
|
|
619
|
+
// 声明的长度上限(rules 里的 max_len / maxLength,多条取最小):文本列理想宽按它收窄(引擎 clamp 到 [最小, 最大])
|
|
620
|
+
const lens = (f?.rules ?? []).flatMap((rule) => [rule.max_len, rule.maxLength]).filter((n): n is number => typeof n === 'number' && n > 0);
|
|
621
|
+
const maxLen = lens.length > 0 ? Math.min(...lens) : undefined;
|
|
622
|
+
return {
|
|
623
|
+
name: cells[i]?.field ?? '', type: pillColumnType(f?.type, cells[i]?.component), ...(f?.key === true ? { key: true } : {}), label: h.label,
|
|
624
|
+
...(Array.isArray(options) ? { options: options as ReadonlyArray<{ label?: unknown; value?: unknown }> } : {}),
|
|
625
|
+
...(maxLen !== undefined ? { maxLen } : {}),
|
|
626
|
+
...(h.sort !== undefined ? { sortable: true } : {}),
|
|
627
|
+
...(h.filter !== undefined ? { filter: true } : {}),
|
|
628
|
+
...(typeof r?.width === 'number' && r.width > 0 ? { explicitWidth: r.width } : {}),
|
|
629
|
+
dateEm: dateContentEm(f?.type),
|
|
630
|
+
...(isTree && cells[i]?.field === indentName ? { treeIndent: true } : {}),
|
|
631
|
+
...(colExt[i]?.ellipsis === true ? { ellipsis: true } : {}),
|
|
632
|
+
// 格内附件:值后常显的「复制」钮算进列宽(不与长编码重叠、不截成半个字)
|
|
633
|
+
...(cells[i]?.props.copyable === true ? { attachLabelEms: [kitTextWidthEm(typeof cells[i]?.props.copy_label === 'string' ? cells[i]!.props.copy_label as string : kitText('soma.kit.copy'))] } : {}),
|
|
634
|
+
};
|
|
635
|
+
}),
|
|
636
|
+
hasSelect: selectParts > 0,
|
|
637
|
+
actionLabelEms: wideSplit === null ? [] : wideSplit.inline.map((a) => kitTextWidthEm(a.name)),
|
|
638
|
+
actionHasMore: wideSplit !== null && wideSplit.folded.length > 0,
|
|
639
|
+
...(keptInlineActionEm(rowActions) !== undefined ? { narrowActionLabelEm: keptInlineActionEm(rowActions) as number } : {}),
|
|
640
|
+
actionCount: actionParts > 0 ? rowActions.length : 0,
|
|
641
|
+
tier: narrowTier,
|
|
642
|
+
...(bordered ? { cellPadUnits: 6 } : {}),
|
|
605
643
|
})
|
|
606
644
|
: null;
|
|
607
645
|
if (narrowGrid !== null) {
|
|
608
|
-
//
|
|
646
|
+
// 各数据列的轨类并到行格、表头格与汇总格上(三处同一份列轨)
|
|
609
647
|
narrowGrid.cellClasses.forEach((cls, i) => {
|
|
610
648
|
if (cells[i] !== undefined) cells[i]!.cellClass = join(cells[i]!.cellClass, cls);
|
|
611
649
|
if (head[i] !== undefined) head[i]!.class = join(head[i]!.class, cls);
|
|
@@ -661,39 +699,47 @@ export function collection(
|
|
|
661
699
|
}
|
|
662
700
|
// 选择列 / 操作列:滚动模式下定宽,有固定列时 sticky(行里底色随行,表头里随表头)
|
|
663
701
|
const lead = (headRow: boolean): string => join(
|
|
664
|
-
scroll ? [D.tableScrollCell, `w-${selectStep}`, ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])] : [
|
|
665
|
-
bordered ?
|
|
702
|
+
scroll ? [D.tableScrollCell, `w-${selectStep}`, ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])] : [narrowGrid?.selectClass ?? '', ...(bordered ? ['flex', 'items-center', 'px-3', ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])] : [])],
|
|
703
|
+
bordered ? GRID_COL_DIVIDER : '',
|
|
666
704
|
plan !== null && plan.selectSticky ? [headRow ? D.tableHeadCellSticky : D.tableCellSticky, headRow ? '' : stripeSticky, 'left-0'] : '',
|
|
667
705
|
);
|
|
706
|
+
const wideOverflowSticky = narrowEnd && narrowGrid !== null && actionParts > 0 && narrowGrid.innerMinUnits > WIDE_TABLE_OVERFLOW_MIN_UNITS;
|
|
668
707
|
const tail = (headRow: boolean): string => join(
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
? [
|
|
672
|
-
: '',
|
|
673
|
-
|
|
708
|
+
// 操作列表头与单元格统一采用 flex items-center justify-end(消除 scroll/bordered/sticky 下 columnheader: end 与 cell: start 错位)
|
|
709
|
+
scroll
|
|
710
|
+
? [D.tableScrollCell, 'justify-end', headRow ? 'whitespace-nowrap' : '', `w-${actionsStep}`, ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])]
|
|
711
|
+
: [narrowGrid?.actionsClass ?? '', 'flex items-center justify-end', headRow ? 'whitespace-nowrap' : '', ...(bordered ? ['px-3', ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])] : [])],
|
|
712
|
+
(plan !== null && plan.actionsSticky) || scrollWideActionsSticky
|
|
713
|
+
? [headRow ? D.tableHeadCellSticky : D.tableCellSticky, headRow ? '' : stripeSticky, 'right-0', (plan?.edgeRight ?? -1) === -1 ? D.tableEdgeRight : '']
|
|
714
|
+
: '',
|
|
715
|
+
// 宽表溢出时操作列常驻吸右(不限窄容器档),普通表则在窄容器档吸右,防止操作列掉出视口
|
|
716
|
+
wideOverflowSticky
|
|
717
|
+
? wideStickyEnd(bordered ? [] : pyTokens(headRow ? dens.head : dens.row), headRow)
|
|
718
|
+
: (narrowEnd && narrowGrid !== null && actionParts > 0 ? narrowStickyEnd(bordered ? [] : pyTokens(headRow ? dens.head : dens.row), narrowTier, headRow) : ''),
|
|
674
719
|
);
|
|
675
720
|
const selectRow = selectParts > 0 ? lead(false) : '';
|
|
676
721
|
const actionsRow = actionParts > 0 ? tail(false) : '';
|
|
677
722
|
const selectHead = selectParts > 0 ? lead(true) : '';
|
|
678
723
|
const actionsHead = actionParts > 0 ? tail(true) : '';
|
|
679
724
|
const gridBorderedRow = (cls: string): string => cls.split(/\s+/).filter((t) => t !== '' && !GRID_SPACING_TOKEN.test(t) && t !== 'items-center' && !/^py-/.test(t)).concat(['gap-0', 'items-stretch']).join(' ');
|
|
680
|
-
const rowBase =
|
|
681
|
-
const headBase =
|
|
725
|
+
const rowBase = scroll ? scrollRowClass(dens.row) : bordered ? gridBorderedRow(dens.row) : dens.row;
|
|
726
|
+
const headBase = scroll ? scrollRowClass(dens.head) : bordered ? gridBorderedRow(dens.head) : dens.head;
|
|
682
727
|
const rawSummaryRow = D.tableSummaryRow;
|
|
683
728
|
const summaryRowBase = unbordered
|
|
684
|
-
? rawSummaryRow
|
|
729
|
+
? kitStripBoundaryClasses(rawSummaryRow)
|
|
685
730
|
: rawSummaryRow;
|
|
686
|
-
|
|
731
|
+
// 宽表横向滚动时给合计行留底部安全间距(pb-3),防止横向滚动条腰斩合计行数字
|
|
732
|
+
const summaryRowClass = summary === null ? "" : join(plainRowClass(rowBase), summaryRowBase, scroll ? "relative pb-3" : "", virt !== null ? KIT_TABLE_VIRTUAL.summarySticky : "");
|
|
687
733
|
const rawWrapBase = scroll ? D.tableScrollWrap : sticky ? '' : D.tableWrap;
|
|
688
734
|
const wrapBase = unbordered
|
|
689
|
-
? rawWrapBase
|
|
735
|
+
? kitStripBoundaryClasses(rawWrapBase)
|
|
690
736
|
: rawWrapBase;
|
|
691
737
|
return {
|
|
692
738
|
kind: 'table',
|
|
693
739
|
tree: isTree ? treeOf(c, cells, env) : null,
|
|
694
740
|
// 表壳恒是查询容器(普通 / 滚动 / 吸顶 / 虚拟 / 树表同一条):行操作窄档折叠、窄栅格的 `@max-<档>:` 变体都依赖最近的查询容器
|
|
695
|
-
wrapClass: mergeClass(join(/(^|\s)@container(\/\S+)?(\s|$)/.test(wrapBase) ? '' : '@container', wrapBase, (densityToolbar && !scroll) || (narrowGrid !== null && actionParts > 0) ? 'group/tbl' : '', virt !== null ? [KIT_TABLE_VIRTUAL.viewportBase, KIT_TABLE_VIRTUAL.viewportClass[virt.height]] : combo ? KIT_TABLE_VIRTUAL.viewportBase : ''), view.class, view.replaceClass),
|
|
696
|
-
innerClass: scroll ? D.tableScrollInner : sticky ? D.tableInner.split(/\s+/).filter((t) => !/^(?:@[a-z0-9]+:)?min-w-/.test(t)).join(' ') :
|
|
741
|
+
wrapClass: mergeClass(join(/(^|\s)@container(\/\S+)?(\s|$)/.test(wrapBase) ? '' : '@container', wrapBase, (densityToolbar && !scroll) || (narrowEnd && narrowGrid !== null && actionParts > 0) ? 'group/tbl' : '', virt !== null ? [KIT_TABLE_VIRTUAL.viewportBase, KIT_TABLE_VIRTUAL.viewportClass[virt.height]] : combo ? KIT_TABLE_VIRTUAL.viewportBase : ''), view.class, view.replaceClass),
|
|
742
|
+
innerClass: scroll ? D.tableScrollInner : sticky ? D.tableInner.split(/\s+/).filter((t) => !/^(?:@[a-z0-9]+:)?min-w-/.test(t)).join(' ') : trackInnerClass(D.tableInner, narrowGrid),
|
|
697
743
|
headClass: join(headBase, headAboveFixed ? STICKY_HEAD_COMBO_CLASS : sticky || virt !== null ? STICKY_HEAD_CLASS : '', !scroll ? denseHead : ''),
|
|
698
744
|
head,
|
|
699
745
|
rowClass: mergeClass(join(rowBase, !scroll ? denseRow : ''), view.rowClass, view.replaceClass),
|
|
@@ -752,7 +798,7 @@ export function collection(
|
|
|
752
798
|
const list = `${D.cardsList} ${gridColsClasses(gridLevels(cols))}`;
|
|
753
799
|
const rawCardsItem = D.cardsItem;
|
|
754
800
|
const cardsItem = c.bordered === false
|
|
755
|
-
? rawCardsItem
|
|
801
|
+
? kitStripBoundaryClasses(rawCardsItem)
|
|
756
802
|
: rawCardsItem;
|
|
757
803
|
return {
|
|
758
804
|
kind: 'cards',
|
|
@@ -779,22 +825,22 @@ export function collection(
|
|
|
779
825
|
return {
|
|
780
826
|
kind: 'stack',
|
|
781
827
|
wrapClass: '',
|
|
782
|
-
listClass: mergeClass(D.compactList, mergeClass(c.class ?? '', view.class), view.replaceClass),
|
|
783
|
-
itemClass: mergeClass(D.compactItem, view.rowClass, view.replaceClass),
|
|
828
|
+
listClass: mergeClass(view.paneItem === true ? D.paneList : D.compactList, mergeClass(c.class ?? '', view.class), view.replaceClass),
|
|
829
|
+
itemClass: mergeClass(view.paneItem === true ? D.paneItem : D.compactItem, view.rowClass, view.replaceClass),
|
|
784
830
|
inner,
|
|
785
831
|
rowActions,
|
|
786
832
|
...(itemRowTone !== undefined ? { rowTone: itemRowTone } : {}),
|
|
787
833
|
pager: optionalPagerOf(c.page),
|
|
788
834
|
...countIr,
|
|
789
835
|
state: stateOf(c, env, `${env.path}.collection`),
|
|
790
|
-
...(titleCell !== undefined ? { compact: { title: titleCell, meta: metaCells } } : {}),
|
|
836
|
+
...(titleCell !== undefined ? { compact: { title: titleCell, meta: metaCells, ...(view.paneItem === true ? { pane: true } : {}) } } : {}),
|
|
791
837
|
...ctxMenuIr,
|
|
792
838
|
};
|
|
793
839
|
}
|
|
794
840
|
|
|
795
841
|
const rawStackItem = D.stackItem;
|
|
796
842
|
const stackItem = c.bordered === false
|
|
797
|
-
? rawStackItem
|
|
843
|
+
? kitStripBoundaryClasses(rawStackItem)
|
|
798
844
|
: rawStackItem;
|
|
799
845
|
return {
|
|
800
846
|
kind: 'stack',
|
|
@@ -14,7 +14,7 @@ import { regionMirrorStatePath } from 'soma-core';
|
|
|
14
14
|
import type { SomaScopeDecl, SomaScopeMirrorDecl, SomaScopeSliceDecl } from 'soma-core';
|
|
15
15
|
import { getCompileEnvelope, resolveEnvelopeSubPath } from '../shared/envelope';
|
|
16
16
|
import { KIT_CORE_MAPPING, KIT_FORM_LINKAGE, KIT_GRAMMAR } from './defaults';
|
|
17
|
-
import { hintOf, nameSuggestion } from '../
|
|
17
|
+
import { hintOf, nameSuggestion } from '../shared/hints';
|
|
18
18
|
import { checkFieldRules } from './field-value';
|
|
19
19
|
import { staticOptionsOf } from './linkage';
|
|
20
20
|
import { classifyParamBinding, viewPathToCore } from './view-binding';
|
|
@@ -121,6 +121,12 @@ export interface KitClassDefaults {
|
|
|
121
121
|
compactMetaItem: string;
|
|
122
122
|
compactSep: string;
|
|
123
123
|
compactActions: string;
|
|
124
|
+
/** 主从页左窗格条目(paneItem 紧凑列表):列表容器 / 条目(选中 = 白面 + 左 2px 品牌色指示条)/ 名称行与编码行 / 右侧标签 / 等宽编码文字 */
|
|
125
|
+
paneList: string;
|
|
126
|
+
paneItem: string;
|
|
127
|
+
paneRow: string;
|
|
128
|
+
paneTag: string;
|
|
129
|
+
paneCode: string;
|
|
124
130
|
staticRoot: string;
|
|
125
131
|
groupsWrap: string;
|
|
126
132
|
groupSection: string;
|
|
@@ -247,11 +253,8 @@ export const KIT_TREE_TABLE = {
|
|
|
247
253
|
maxDepth: KIT_TREE_TABLE_LIMITS.maxDepth as number,
|
|
248
254
|
windowThreshold: KIT_TREE_TABLE_LIMITS.windowThreshold as number,
|
|
249
255
|
windowBatch: KIT_TREE_TABLE_LIMITS.windowBatch as number,
|
|
250
|
-
/**
|
|
251
|
-
|
|
252
|
-
columnWeightRules: G.treeTable.columnWeightRules as {
|
|
253
|
-
identifierNamePattern: string; dateTypes: readonly string[]; shortTypes: readonly string[]; longTypes: readonly string[];
|
|
254
|
-
},
|
|
256
|
+
/** 日期类列的类型闭集(窄容器栅格里按内容给最小宽);列的默认权重不在这里——由排布引擎给出(collection-table#columnWeightsOf) */
|
|
257
|
+
columnWeightRules: G.treeTable.columnWeightRules as { dateTypes: readonly string[] },
|
|
255
258
|
} as const;
|
|
256
259
|
|
|
257
260
|
export const KIT_SKELETON = {
|
|
@@ -272,3 +275,5 @@ export const KIT_DIAGNOSTIC_MESSAGES: Readonly<Record<string, string>> = G.diagn
|
|
|
272
275
|
|
|
273
276
|
/** 必填星号:标签旁的红色子元素(彩色文字只用 -on-soft;start = 标签前,end = 标签后)。对齐 Element / MUI 的红星 */
|
|
274
277
|
export const KIT_REQUIRED_STAR_CLASS = { start: 'me-1 text-danger-on-soft', end: 'ms-1 text-danger-on-soft' } as const;
|
|
278
|
+
/** 「(选填)」标记(必填是多数时只标选填,KT-K-form-3):标签后、弱化墨、常规字重 */
|
|
279
|
+
export const KIT_OPTIONAL_MARK_CLASS = 'ms-1 font-normal text-fg-subtle';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
// 多个行操作各抛各的槽位事件 `row_action_<序号>`(序号 = 动作在组件 actions 数组里的位置),每个动作各绑一条管道。
|
|
19
19
|
|
|
20
20
|
import type { KitAction, KitCell, KitDiagnostic, KitLayoutIR, KitObjectIR, KitViewOnValue } from './types';
|
|
21
|
-
import { hintOf, nameSuggestion } from '../
|
|
21
|
+
import { hintOf, nameSuggestion } from '../shared/hints';
|
|
22
22
|
import { filterAnchor, headAnchor, pagerAnchor } from './compile-data';
|
|
23
23
|
import { registerSliceReload } from './filter-reload';
|
|
24
24
|
import { KIT_ACTION_SLOT_BASE, actionSlotEvent, actionSlotOverflow } from '../base/action-slots';
|
|
@@ -24,6 +24,10 @@ export interface KitEmitInput {
|
|
|
24
24
|
formInitialPath?: string;
|
|
25
25
|
/** 表格行可点选(抛 row_action,builtin select) */
|
|
26
26
|
pickOnRow?: boolean;
|
|
27
|
+
/** 分页条的附加类(业务壳给:列表页贴工作面底 sticky + 轴内边距) */
|
|
28
|
+
pagerClass?: string;
|
|
29
|
+
/** 列表默认紧凑档(页面类型默认密度:列表页 = 紧凑):表格外壳标 data-kit-dense,行高取紧凑档;表格工具栏里用户选过密度则以用户为准 */
|
|
30
|
+
defaultDense?: boolean;
|
|
27
31
|
/** 勾选列接 selection:协调组件 focus 切片 sel 镜像的路径;给了才发射可勾选的勾选列与 row_select 事件 */
|
|
28
32
|
selectedPath?: string;
|
|
29
33
|
/** 行删除在途置灰读的协调组件作用域(忙闲通道名 = 作用域 + 行主键,须与 KitCrudBridge 的 scope 一致);缺省用本对象作用域 */
|
|
@@ -56,6 +60,7 @@ export function emitObject(obj: KitObject, ctx: KitRenderContext, input: KitEmit
|
|
|
56
60
|
const stat = emitStatic(ir, {
|
|
57
61
|
...(formDetail !== null ? { formDetail } : {}),
|
|
58
62
|
listShape: listShapeOf(obj.behavior),
|
|
63
|
+
...(typeof obj.behavior.list?.rowsPath === 'string' && obj.behavior.list.rowsPath !== '' ? { staticRowsPath: obj.behavior.list.rowsPath } : {}),
|
|
59
64
|
...(ctx.locale !== undefined ? { locale: ctx.locale } : {}),
|
|
60
65
|
schema: obj.schema,
|
|
61
66
|
actions: obj.behavior.actions ?? [],
|
|
@@ -64,6 +69,8 @@ export function emitObject(obj: KitObject, ctx: KitRenderContext, input: KitEmit
|
|
|
64
69
|
...(input.formModePath !== undefined ? { formModePath: input.formModePath } : {}),
|
|
65
70
|
...(input.formInitialPath !== undefined ? { formInitialPath: input.formInitialPath } : {}),
|
|
66
71
|
...(input.pickOnRow === true ? { pickOnRow: true } : {}),
|
|
72
|
+
...(input.pagerClass !== undefined ? { pagerClass: input.pagerClass } : {}),
|
|
73
|
+
...(input.defaultDense === true ? { defaultDense: true } : {}),
|
|
67
74
|
...(input.selectedPath !== undefined ? { selectedPath: input.selectedPath } : {}),
|
|
68
75
|
...(input.removeScope !== undefined ? { removeScope: input.removeScope } : {}),
|
|
69
76
|
...(input.expandPath !== undefined ? { expandPath: input.expandPath } : {}),
|