Skip to content

Commit eebb893

Browse files
feat(list): a line between columns, 36px default rows and header, and 「+ Add calculation」 always shown in the footer (#36048) (#36069)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDWLrm1NrVxDWXCHsUrtL24)_ Fixes #36048 repo:objectstack#1 · os-sales · session_01L6bhgVphzAHrHnMrSMZGYb Clause-②: no (no export, prop or key added; one existing i18n value changes its wording) Metadata-protocol: none ## 维护者速读 - 列表页(比如「客户」)的表格:列与列之间多了一条和横线一样浅的竖线;默认行高和表头从 32 变成 36;底部一行里没选统计的列一直显示浅色的「+ 添加统计」,不用鼠标移上去。 - 这是列表页重做专题的观感改进(对照 Attio 的第 5、7、8 条)。 - 只改样子,不动数据和统计的存储;包里带的视图和没有权限的人仍然看不到入口。撤回这个 PR 即恢复原样。 - 无。 ## What changes | Item | Where | Before → after | |---|---|---| | Column lines | `OBJECT_GRID_TABLE_DENSITY` in `ui/packages/plugin-grid/src/ObjectGrid.tsx` | none → a 1px inset shadow on the right edge (`inset-shadow-[-1px_0_0_0]` in `border/50`, the row lines' colour and weight) on every header, body and footer cell but the last one | | Default row | `rowHeightCellClass`, `compact` arm, same file | `h-8` (32px) → `h-9` (36px); `short`, `medium`, `tall`, `extra_tall` unchanged | | Header | `OBJECT_GRID_TABLE_DENSITY` | `[&_thead_th]:h-8` → `h-9` (36px) | | Footer entry | `SummaryCellPicker` in `ui/packages/plugin-grid/src/objectGridSummaryPicker.tsx` | hint `opacity-0` until hover/focus → always shown, faint (`text-muted-foreground/70`), a `Plus` icon before it, darker on hover/focus | | Entry text | `grid.summary.calculate` in the 11 locale packs + the plugin's English default in `useColumnSummary.ts` | 「计算」/ Calculate → 「添加统计」/ Add calculation (zh-Hant 新增統計, ja 集計を追加, ko 계산 추가, de Berechnung hinzufügen, fr Ajouter un calcul, es Añadir cálculo, pt-BR Adicionar cálculo, ru Добавить расчёт, ar إضافة حساب) | - The row-height menu has three densities (Compact / Standard / Spacious). A view with no `rowHeight` lands on Compact, which is the card's "default", so Compact is the density that moves to 36. Standard (44) and Spacious (56) are unchanged. The seat's claim records this reading. - The frozen column draws no divider at rest today (#35548: a scroll shadow, none at rest). With this PR its edge is an ordinary column line at rest and keeps the shadow on top of the line once the rows scroll sideways under it. - **Why a shadow, not a border (L1-b S1, 7062990450).** The first head (`b5445c21`) drew the line as `border-r`. The table collapses its borders, and a collapsed border belongs to the table, not the cell: measured on 商机 at 900px wide, scrolled 120px sideways, the frozen checkbox and name columns lost their lines (the scrolling columns' lines did not paint over the frozen cells). An inset shadow is the cell's own, so the sticky cells carry it with them, and Tailwind composes it with `FROZEN_EDGE_SHADOW` in one `box-shadow` (both layers read back in the browser while scrolled). It also takes no width, so the column widths do not move. - The footer row stays 32px, as the claim states. - Who sees the entry is unchanged: the menu is wired only where the host passes `onColumnSummaryPick` (a reader who may change the view; #35933 keeps it off views a read-only package ships). Without it an empty footer cell still draws nothing. - Every embedded `object-grid` follows the new default. Related-list body tables use their own `BODY_TABLE_DENSITY` and are not touched; the phone list draws cards. ## Tests - `ui/e2e/list-frame-geometry-35548.spec.ts` (Playwright, compiled Tailwind against the real class sources, with the app's `--color-border` in the theme so both lines resolve to a real colour): header 36 and rows 36 (was 32 / 33), first row top still ≤ 168; new case: the header, body (the leading checkbox cell included) and footer cells carry exactly one inset shadow, `-1px 0px 0px 0px`, in the row line's computed colour, and no right border; the last cell of each carries none. 8/8 pass. - Ablation at `0a1f7470`: with the column-line entry deleted from `OBJECT_GRID_TABLE_DENSITY` (`scripts/ablation-replace.mjs`, mutation landed anchor 1 → 0), the new case goes red (`header: one column line`), the other 7 pass; restored, blob equals HEAD and `git diff HEAD` empty. - `rowHeightOffSpecBoundary.test.tsx`: the `compact` copy now carries `h-9`; it still differs from `short` by its leading, so all five densities keep their own copy. - `footerCalculationPicker-35702.test.tsx`: the hint reads 「Add calculation」 and carries no `opacity-0` at rest; a reader without `onPick` sees no 「Add calculation」 in the footer. ## Acceptance notes - In the browser the footer row measures 32.5px on a view that offers the menu (the picker button's own `h-8` plus the row's line) and 32 on one that does not; main measures the same, so this PR leaves it. - Overlap: #36045 (in-cell editors), #36024 (phone list, same e2e file) and #36054 also edit `ObjectGrid.tsx`; `overlap-check.mjs` reads all of them as merging cleanly at this head. The seat's landing order puts this PR after #36024 and #36045; this PR merges main and moves the pins then. - #36045 pins its in-cell inputs at `h-8`; in the 36px row an edit measured 36 on main + this PR (below). Re-measure after #36045 lands. ## Verification Read first, by risk: (1) `OBJECT_GRID_TABLE_DENSITY` — it reaches every cell of every `object-grid`; (2) the `compact` arm of `rowHeightCellClass`; (3) `SummaryCellPicker`'s hint. Two-minute check: open the 客户 list, add a personal view (switcher → 添加视图 → 我的视图), and the footer shows 「+ 添加统计」 under every column with a line between columns. <details><summary>Browser readings (app-crm, 1440×900, zh-CN, light and dark)</summary> Booted `objectstack dev --ui --seed-admin` from this branch (readings re-taken at `0a1f7470`) with the console built, then again with the three source files and the locale packs at `origin/main` (`8145424b`) for the "before" set. Measured with `getBoundingClientRect` / `getComputedStyle` in Chromium. | Reading | main | this PR | |---|---|---| | Header row height | 32 | 36 | | Data row height (Compact, the default) | 32 | 36 | | Standard, then back to Compact | — | 44, then 36 | | Double-click 年营收 to edit (editor focused) | — | rows stay 36 | | Column line (a body cell's right border) | 0px | 1px, same colour as the row line (light and dark) | | Footer, a personal view | 「计算」 on hover only | 「+ 添加统计」 in all four columns; clicking one opens the calculation menu (合计 … 无) | | Footer, the package's 所有记录 view | 「3 条记录」 only | 「3 条记录」 only (no entry) | | 商机 at 900×700, scrolled 120px sideways (frozen checkbox + name) | — | at `b5445c21` (border): the frozen columns' lines gone; at `0a1f7470` (inset shadow): both frozen lines stay, the name column's edge also carries `FROZEN_EDGE_SHADOW`, nothing paints over the frozen cells (light and dark) | Screenshots (before / after, light and dark, package view and personal view, the open footer menu, an edit in progress) are kept with the card's evidence for the reviewer (`build-seat1/36048/`). </details> <details><summary>Local gates</summary> - `pnpm --filter @object-ui/plugin-grid type-check`: pass. - `vitest run packages/i18n/ + the two plugin-grid files above`: Test Files 107 passed (107), Tests 1998 passed, 13 skipped. - `playwright test e2e/list-frame-geometry-35548.spec.ts --project=chromium` at `0a1f7470`: 8 passed. - `overlap-check.mjs --branch=HEAD`: VERDICT clean (main and 6 PR heads). - NOT MEASURED locally: the full `packages/plugin-grid/` vitest run (over the foreground limit here); CI's Test Core runs it. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgVphzAHrHnMrSMZGYb --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgVphzAHrHnMrSMZGYb)_ <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgVphzAHrHnMrSMZGYb --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6971ca7 commit eebb893

18 files changed

Lines changed: 111 additions & 34 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/plugin-grid': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(plugin-grid): a list draws a line between columns, its default rows and header are 36px tall, and the footer shows 「+ Add calculation」 at rest
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- A line of the same colour and weight as the row lines now runs between columns in the header, the rows and the footer row, with none after the last cell. The last frozen column keeps its scroll shadow on top of its line.
12+
- The default row height (`compact`, the density a view without `rowHeight` gets, shown as Compact in the row-height menu) is 36px instead of 32px, and the header is 36px too. The Standard and Spacious densities are unchanged.
13+
- In a list whose reader may change the view, every footer cell without a calculation shows a faint 「+ Add calculation」 at all times instead of only on hover. A reader who may not change the view still sees only the calculations already set. The `grid.summary.calculate` text changes in every language pack to match.

‎ui/e2e/list-frame-geometry-35548.spec.ts‎

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import { uiRoot } from '../scripts/ui-root.mjs';
1111
*
1212
* view bar 40 (the object's name as the page's heading, the switcher and
1313
* View settings on the left; search, New and ⋮ on the right) · condition
14-
* row 40, resident · header 32 · row 33, 13px on the heading, the header,
14+
* row 40, resident · header 36 · row 36, its line included
15+
* (objectstack#36048; 32 and 33 before it), 13px on the heading, the header,
1516
* the cells and the bar buttons, the view switcher as one trigger (type
1617
* icon → name → count → caret), and each column total under its own
1718
* column, right edge on the column's right edge. No page bar is drawn
18-
* above the view bar.
19+
* above the view bar. A line of the row lines' colour and weight runs
20+
* between columns in the header, the rows and the footer row, and none
21+
* after the last cell, drawn as an inset shadow (objectstack#36048).
1922
*
2023
* ⚠️ A Playwright spec, not a vitest test: jsdom has no layout engine, so a
2124
* height read there is 0 and a class-shape assertion would pass against
@@ -112,7 +115,7 @@ const DENSITY = (() => {
112115
const block = pick('grid', /export const OBJECT_GRID_TABLE_DENSITY = \[([\s\S]*?)\]\.join/, 'OBJECT_GRID_TABLE_DENSITY');
113116
return [...block.matchAll(/'([^']+)'/g)].map((m) => m[1]).join(' ');
114117
})();
115-
const ROW_CELL = carrying(pick('grid', /rowHeightMode === 'compact'\s*\?\s*'([^']+)'/, 'the default (compact) row arm'), ['h-8', 'text-[13px]'], 'row arm');
118+
const ROW_CELL = carrying(pick('grid', /rowHeightMode === 'compact'\s*\?\s*'([^']+)'/, 'the default (compact) row arm'), ['h-9', 'text-[13px]'], 'row arm');
116119
const ROW_ACTION = (() => {
117120
const at = SRC.rowAction.indexOf('data-testid="row-action-trigger"');
118121
const cls = [...SRC.rowAction.slice(0, at).matchAll(/className="([^"]+)"/g)].pop()?.[1];
@@ -206,7 +209,9 @@ const CANDIDATES = [
206209
let css = '';
207210
test.beforeAll(async () => {
208211
const twEntry = fileURLToPath(import.meta.resolve('tailwindcss/index.css'));
209-
const compiler = await compile('@import "tailwindcss";', {
212+
// The app's border colour, so the row line and the column line resolve to a
213+
// real colour each and their comparison below means something.
214+
const compiler = await compile('@import "tailwindcss"; @theme { --color-border: rgb(225 225 234); }', {
210215
base: path.dirname(twEntry),
211216
loadStylesheet: async (id: string, base: string) => {
212217
const file = id === 'tailwindcss' ? twEntry : path.resolve(base, id);
@@ -255,6 +260,31 @@ async function measure(page: Page, locale: 'zh' | 'en' = 'zh') {
255260
switcherOrder: ['type-icon', 'label', 'count', 'caret'].map((p) => rect($(`#sw-${p}`))!.left),
256261
cols,
257262
footText: ($('#tfoot') as HTMLElement).innerText,
263+
// objectstack#36048 — the column lines, read off one cell per part.
264+
lines: (() => {
265+
// The line is an inset shadow on the cell's right edge (a collapsed
266+
// border would stay behind a frozen cell when the rows scroll):
267+
// read the one inset layer, its offsets and its colour.
268+
const border = (el: Element | null) => {
269+
if (!el) return null;
270+
const layers = getComputedStyle(el).boxShadow.split(/,(?![^(]*\))/).map((l) => l.trim());
271+
const inset = layers.filter((l) => /\binset\b/.test(l) && !/^(rgba\(0, 0, 0, 0\)|transparent)\s/.test(l));
272+
const one = inset[0] ?? '';
273+
const m = /\s((?:-?[\d.]+px\s+){3}-?[\d.]+px)\s+inset$/.exec(one);
274+
return { insetLayers: inset.length, offsets: m ? m[1] : '', color: m ? one.slice(0, m.index).trim() : '', borderRight: getComputedStyle(el).borderRightWidth };
275+
};
276+
const rowLine = getComputedStyle(document.querySelector('tbody tr')!);
277+
return {
278+
rowLine: { width: rowLine.borderBottomWidth, color: rowLine.borderBottomColor },
279+
header: border($('thead th[data-col="account"]')),
280+
headerLast: border($('thead th:last-child')),
281+
body: border($('tbody tr td[data-col="account"]')),
282+
bodyLead: border($('tbody tr td:first-child')),
283+
bodyLast: border($('tbody tr td:last-child')),
284+
foot: border($('#tfoot td[data-col="account"]')),
285+
footLast: border($('#tfoot td:last-child')),
286+
};
287+
})(),
258288
overflowX: document.documentElement.scrollWidth - document.documentElement.clientWidth,
259289
};
260290
});
@@ -272,15 +302,15 @@ test.describe('the list page frame (objectstack#35548)', () => {
272302
expect([...at].sort((a, b) => a - b)).toEqual(at);
273303
});
274304

275-
test('1280×800: no page bar, view bar 40, condition row 40, header 32, rows 33, first row top ≤ 168', async ({ page }) => {
305+
test('1280×800: no page bar, view bar 40, condition row 40, header 36, rows 36, first row top ≤ 168', async ({ page }) => {
276306
const r = await measure(page);
277307
expect(r.page, 'a page bar is drawn above the view bar').toBeNull();
278308
expect(r.viewbar.top).toBeCloseTo(48, 0);
279309
expect(r.viewbar.height).toBeCloseTo(40, 0);
280310
expect(r.condition.height, 'the resident condition row').toBeCloseTo(40, 0);
281311
expect(r.thead.top, 'the header under the two rows').toBeCloseTo(128, 0);
282-
expect(r.thead.height).toBeCloseTo(32, 0);
283-
for (const h of r.rowHeights) expect(h, 'a data row is not 33px').toBeCloseTo(33, 0);
312+
expect(r.thead.height).toBeCloseTo(36, 0);
313+
for (const h of r.rowHeights) expect(h, 'a data row is not 36px').toBeCloseTo(36, 0);
284314
expect(r.firstRow.top).toBeLessThanOrEqual(168);
285315
expect(r.newButton.height).toBeGreaterThanOrEqual(24);
286316
expect(r.newButton.height).toBeLessThanOrEqual(28);
@@ -300,6 +330,22 @@ test.describe('the list page frame (objectstack#35548)', () => {
300330
for (const f of fonts.bar) expect(f).toBe('13px');
301331
});
302332

333+
test('a line between columns in the header, the rows and the footer, the row lines\' colour and weight, none after the last cell (objectstack#36048)', async ({ page }) => {
334+
const { lines } = await measure(page);
335+
expect(lines.rowLine.width).toBe('1px');
336+
expect(lines.rowLine.color).not.toBe('rgba(0, 0, 0, 0)');
337+
for (const [part, b] of Object.entries({ header: lines.header, body: lines.body, bodyLead: lines.bodyLead, foot: lines.foot })) {
338+
expect(b, part).not.toBeNull();
339+
expect(b!.insetLayers, `${part}: one column line`).toBe(1);
340+
expect(b!.offsets, `${part}: a 1px line on the right edge`).toBe('-1px 0px 0px 0px');
341+
expect(b!.color, `${part}: column line colour`).toBe(lines.rowLine.color);
342+
expect(b!.borderRight, `${part}: drawn as a shadow, not a border`).toBe('0px');
343+
}
344+
for (const [part, b] of Object.entries({ headerLast: lines.headerLast, bodyLast: lines.bodyLast, footLast: lines.footLast })) {
345+
expect(b!.insetLayers, `${part}: a line after the last cell`).toBe(0);
346+
}
347+
});
348+
303349
test('the switcher reads type icon → name → count → caret, left to right', async ({ page }) => {
304350
const { switcherOrder } = await measure(page);
305351
expect([...switcherOrder].sort((a, b) => a - b)).toEqual(switcherOrder);

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ const ar = {
714714
earliest: "الأقدم",
715715
latest: "الأحدث",
716716
pageName: "{{label}} (هذه الصفحة)",
717-
calculate: "حساب",
717+
calculate: "إضافة حساب",
718718
none: "لا شيء",
719719
menuPercentEmpty: "نسبة الفارغ",
720720
menuPercentFilled: "نسبة المعبأ",

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ const de = {
656656
earliest: "Frühestes",
657657
latest: "Spätestes",
658658
pageName: "{{label}} (diese Seite)",
659-
calculate: "Berechnen",
659+
calculate: "Berechnung hinzufügen",
660660
none: "Keine",
661661
menuPercentEmpty: "Anteil leer",
662662
menuPercentFilled: "Anteil gefüllt",

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ const en = {
908908
earliest: 'Earliest',
909909
latest: 'Latest',
910910
pageName: '{{label}} (this page)',
911-
calculate: 'Calculate',
911+
calculate: 'Add calculation',
912912
none: 'None',
913913
menuPercentEmpty: 'Percent empty',
914914
menuPercentFilled: 'Percent filled',

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ const es = {
674674
earliest: "Más antigua",
675675
latest: "Más reciente",
676676
pageName: "{{label}} (esta página)",
677-
calculate: "Calcular",
677+
calculate: "Añadir cálculo",
678678
none: "Ninguno",
679679
menuPercentEmpty: "Porcentaje vacío",
680680
menuPercentFilled: "Porcentaje con valor",

‎ui/packages/i18n/src/locales/fr.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ const fr = {
669669
earliest: "Plus ancienne",
670670
latest: "Plus récente",
671671
pageName: "{{label}} (cette page)",
672-
calculate: "Calculer",
672+
calculate: "Ajouter un calcul",
673673
none: "Aucun",
674674
menuPercentEmpty: "Pourcentage vide",
675675
menuPercentFilled: "Pourcentage rempli",

‎ui/packages/i18n/src/locales/ja.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ const ja = {
656656
earliest: "最も早い",
657657
latest: "最も遅い",
658658
pageName: "{{label}}(このページ)",
659-
calculate: "計算",
659+
calculate: "集計を追加",
660660
none: "なし",
661661
menuPercentEmpty: "空の割合",
662662
menuPercentFilled: "入力済みの割合",

‎ui/packages/i18n/src/locales/ko.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ const ko = {
656656
earliest: "가장 이른",
657657
latest: "가장 늦은",
658658
pageName: "{{label}} (이 페이지)",
659-
calculate: "계산",
659+
calculate: "계산 추가",
660660
none: "없음",
661661
menuPercentEmpty: "빈 값 비율",
662662
menuPercentFilled: "입력된 값 비율",

‎ui/packages/i18n/src/locales/pt-BR.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ const pt = {
669669
earliest: "Mais antiga",
670670
latest: "Mais recente",
671671
pageName: "{{label}} (esta página)",
672-
calculate: "Calcular",
672+
calculate: "Adicionar cálculo",
673673
none: "Nenhum",
674674
menuPercentEmpty: "Percentual vazio",
675675
menuPercentFilled: "Percentual preenchido",

0 commit comments

Comments
 (0)