Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
c6c353f
feat(plugin-grid): host cells and row tint on ObjectGrid (objectstack…
claude Nov 24, 2026
1bb0e1e
wip(app-shell): metadata list draws on ObjectGrid (objectstack#36897)
claude Nov 24, 2026
4f38216
wip(app-shell): row cells and controls on the grid; tests follow the …
claude Nov 24, 2026
aaa4f66
wip(app-shell): list create in the paired .custom package; object and…
claude Nov 24, 2026
fa99cce
wip: type-check (objectstack#36897)
claude Nov 24, 2026
51aeae2
test: grid host cells and tint; the table's order is the ‹ › order; h…
claude Nov 24, 2026
d618966
test(app-shell): list create lands in the pair; adapter schema, sort …
claude Nov 24, 2026
d53c47d
test(app-shell): the list offers New on a read-only base into its pai…
claude Nov 24, 2026
b6b3ae1
fix(app-shell): the list offers New on a read-only base exactly where…
claude Nov 24, 2026
2c60bdf
Merge origin/main into claude/issue-36897-list-objectgrid
claude Nov 24, 2026
11733ca
test(app-shell): pay the lint and plugin-detail loads at collection i…
claude Nov 24, 2026
490aad2
Merge origin/main into claude/issue-36897-list-objectgrid
claude Nov 24, 2026
1137895
test(e2e): the declared sharing rules reach spec reads the grid's scr…
claude Nov 24, 2026
23cc54e
fix(app-shell): no list create on a kernel package, which has no pair…
claude Nov 24, 2026
4a15359
Merge origin/main into claude/issue-36897-list-objectgrid
claude Nov 24, 2026
00e524f
Merge origin/main into claude/issue-36897-list-objectgrid: the 修改时间 c…
claude Nov 24, 2026
f1f1070
chore(changeset): Clause-② yes (widening) — ObjectGridComponentProps …
claude Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/36897-list-objectgrid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@object-ui/plugin-grid': patch
'@object-ui/app-shell': patch
---

feat(app-shell): every metadata type's list is drawn by ObjectGrid, and its New on a read-only base creates in the base's paired `.custom` package

Clause-②: yes (widening)
Metadata-protocol: none

- `@object-ui/plugin-grid`: `ObjectGrid` takes two generic host props for its table view — `hostCells` (a host draws a column's cells) and `rowTint` (a palette name per row, over `rowColor`).
- `@object-ui/app-shell`: the metadata list (Setup and Studio's All metadata area) is an `ObjectGrid` fed a declared schema and the page's rows in the list's own order; diagnostics tint, lock, the Active switch, Clone, the served columns and the 「修改时间」 column (its time, its unpublished-changes mark and its `changed` sort, objectstack#36898) are the page's cells; sort, search and page live in the address. The grid's personal columns, export, selection and inline edit are off for it.
- On a read-only base in Studio, the list's New creates in the paired `.custom` package (ADR-0146 D3): an object (with its organization-wide sharing default) and a flow (from a starting point) open the list's create dialog; another type opens the area's create in the pair. Under the customization wall no New is offered.
15 changes: 8 additions & 7 deletions ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { test, expect, type Locator } from '@playwright/test';
* - the first Clone button and the first Active switch both lie wholly inside
* the viewport AND inside the visible box of the table's scroller, with the
* table not scrolled at all;
* - when the table is wider than its box, the box says so
* (`data-overflow-right`, which drives the seam shadow on the pinned cells).
* - when the table is wider than its box, the grid draws its seam shadow at
* the pinned cells (objectstack#36897: the list is drawn by ObjectGrid).
*
* The unit pins for the same page are in
* `ResourceListPage.declaredSharingRules-12982.test.tsx`.
Expand All @@ -30,9 +30,10 @@ test.use({ viewport: { width: 1440, height: 1000 } });

test('at 1440 px, Clone and the Active switch are inside the viewport and the table box', async ({ page }) => {
await page.goto(LIST);
// The table's own scroll box, found by structure rather than by a test id,
// so the measurement reads the same element before and after the fix.
const scroller = page.locator('table').first().locator('xpath=..');
// The table's own scroll box. objectstack#36897 — the list is drawn by
// ObjectGrid, whose table box marks itself (`data-table-scroll-box`); the
// table's parent is no longer the element that scrolls.
const scroller = page.locator('[data-table-scroll-box]').first();
await expect(scroller).toBeVisible();
const clone = page.locator('[data-testid^="catalog-clone-"]').first();
const active = page.locator('[data-testid^="catalog-active-"]').first();
Expand All @@ -50,9 +51,9 @@ test('at 1440 px, Clone and the Active switch are inside the viewport and the ta
expect(b.x + b.width, `${what} ends inside the table box`).toBeLessThanOrEqual(frame.x + frame.width + 0.5);
}

// The box reports its overflow, which is what draws the seam shadow.
// While columns remain to the right, the grid draws its seam shadow.
const widths = await scroller.evaluate((el) => ({ scroll: el.scrollWidth, client: el.clientWidth }));
if (widths.scroll > widths.client + 1) {
await expect(scroller).toHaveAttribute('data-overflow-right', 'true');
await expect(page.getByTestId('data-table-scroll-shadow-right').first()).toBeVisible();
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

/**
* objectstack#36897 — the metadata list's 「新建」 for an object and a flow.
*
* - On a read-only base the item is written to the pair the ensure door
* answers (ADR-0146 D3), never to the base, and an object does not try to
* join an app menu (the pair has no app). On a writable package — the
* control — the door is never knocked on, the item is written to the list's
* package and the object joins the menu.
* - The object carries the organization-wide default it was given.
* - A flow is created from a starting point; one that watches an object
* writes nothing until it has one.
*/

// Paid at collection, not inside a case's clock (check:test-source-alias).
import '@objectstack/lint';
import '@testing-library/jest-dom/vitest';
import * as React from 'react';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';

const save = vi.fn(async (..._args: unknown[]) => ({}));
vi.mock('./useMetadata', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
useMetadataClient: () => ({ save }),
}));

const ensure = vi.fn(async (baseId: string) => ({
basePackageId: baseId,
packageId: `${baseId}.custom`,
namespace: 'hrx',
created: true,
writable: true,
}));
vi.mock('../studio-design/packages-io.js', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
ensureCustomizationPackage: (baseId: string) => ensure(baseId),
fetchPackages: async () => [
{ id: 'com.vendor.hr', namespace: 'hr' },
{ id: 'com.example.crm', namespace: 'crm' },
],
}));
const publish = vi.fn(async () => ({ ok: true }));
vi.mock('../studio-design/studioSaveBar.js', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
publishSavedItem: (...args: unknown[]) => publish(...(args as [])),
}));
vi.mock('../studio-design/StudioPillarKit.js', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
findTakenIdentifier: async () => null,
}));
const joinMenu = vi.fn(async () => ({ kind: 'joined' }));
vi.mock('../studio-design/newObjectJoinsAppMenu.js', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
addNewObjectToAppMenu: (...args: unknown[]) => joinMenu(...(args as [])),
}));

import { MetadataListCreateDialog } from './MetadataListCreateDialog';
import { t } from './i18n';

afterEach(() => {
cleanup();
vi.clearAllMocks();
});

const L = 'en-US' as const;

function open(type: 'object' | 'flow', packageId: string, inPair: boolean) {
const onCreated = vi.fn();
render(
<MetadataListCreateDialog
type={type}
open
onOpenChange={() => {}}
packageId={packageId}
inPair={inPair}
locale={L}
onCreated={onCreated}
/>,
);
return onCreated;
}

function fill(labelKey: string, idKey: string, label: string, id: string) {
fireEvent.change(screen.getByLabelText(t(labelKey, L)), { target: { value: label } });
fireEvent.change(screen.getByLabelText(t(idKey, L)), { target: { value: id } });
fireEvent.click(screen.getByRole('button', { name: t('engine.studio.createLive', L) }));
}

describe('list 「新建」 lands in the paired .custom package on a read-only base (objectstack#36897)', () => {
it('an object on a read-only base: the ensure door is asked, the pair is written, its namespace names it, no menu join', async () => {
const onCreated = open('object', 'com.vendor.hr', true);
fireEvent.keyDown(screen.getByTestId('create-object-owd'), { key: 'ArrowDown' });
fireEvent.click(await screen.findByRole('option', { name: t('engine.studio.settings.sharingPublicRead', L) }));
fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Leave request', 'leave_request');
await waitFor(() => expect(onCreated).toHaveBeenCalled());
expect(ensure).toHaveBeenCalledWith('com.vendor.hr');
expect(save).toHaveBeenCalledTimes(1);
const [type, name, body, opts] = save.mock.calls[0] as unknown as [string, string, any, any];
expect([type, name]).toEqual(['object', 'hrx_leave_request']);
expect(opts).toMatchObject({ mode: 'draft', packageId: 'com.vendor.hr.custom', ifNoneMatch: '*' });
expect(body).toHaveProperty('sharingModel', 'public_read');
expect(publish).toHaveBeenCalledWith(expect.anything(), { type: 'object', name: 'hrx_leave_request', packageId: 'com.vendor.hr.custom' }, false);
expect(onCreated).toHaveBeenCalledWith({ name: 'hrx_leave_request', packageId: 'com.vendor.hr.custom' });
expect(joinMenu).not.toHaveBeenCalled();
});

it('CONTROL — an object in a writable package: no ensure, the list package is written and the object joins its menu', async () => {
const onCreated = open('object', 'com.example.crm', false);
fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Lead', 'lead');
await waitFor(() => expect(onCreated).toHaveBeenCalledWith({ name: 'crm_lead', packageId: 'com.example.crm' }));
expect(ensure).not.toHaveBeenCalled();
expect(save.mock.calls[0]?.[3]).toMatchObject({ packageId: 'com.example.crm' });
await waitFor(() => expect(joinMenu).toHaveBeenCalledTimes(1));
});

it('a flow on a read-only base: from a starting point, written to the pair, born off', async () => {
const onCreated = open('flow', 'com.vendor.hr', true);
fireEvent.click(screen.getByTestId('create-flow-preset-manual'));
fill('engine.studio.auto.nameLabel', 'engine.studio.auto.idLabel', 'Escalate', 'escalate');
await waitFor(() => expect(onCreated).toHaveBeenCalledWith({ name: 'escalate', packageId: 'com.vendor.hr.custom' }));
expect(ensure).toHaveBeenCalledWith('com.vendor.hr');
const [type, , body, opts] = save.mock.calls[0] as unknown as [string, string, any, any];
expect(type).toBe('flow');
expect(opts).toMatchObject({ packageId: 'com.vendor.hr.custom' });
expect(body.status).toBe('obsolete');
expect(JSON.stringify(body)).toContain('"triggerType":"manual"');
});

it('a starting point that watches an object writes nothing until it has one', async () => {
const onCreated = open('flow', 'com.vendor.hr', true);
fireEvent.click(screen.getByTestId('create-flow-preset-record_created'));
fill('engine.studio.auto.nameLabel', 'engine.studio.auto.idLabel', 'On hire', 'on_hire');
expect(await screen.findByText(t('engine.studio.auto.preset.needsObject', L))).toBeInTheDocument();
expect(ensure).not.toHaveBeenCalled();
expect(save).not.toHaveBeenCalled();
expect(onCreated).not.toHaveBeenCalled();
});
});
Loading
Loading