Skip to content

Commit 5f2eee0

Browse files
committed
test: percent fixture stores a fraction; changeset for the phone card read
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwy7XB37e8e1P6jRJ3
1 parent 32340f2 commit 5f2eee0

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/plugin-grid': patch
3+
'@object-ui/plugin-list': patch
4+
'@object-ui/plugin-detail': patch
5+
---
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Phone list cards now follow the object's `highlightFields`. When an object declares them, a card's amount is the first of those fields that draws as money, and its subtitle is the next three, in that order, with empty values dropped and each number, currency or percent part under its field label (`Quantity 2 · Sales Price ¥6,000.00 · Discount % 10.00%`). The view's column order no longer decides the card, so an order line that declares `highlightFields: ['total_price', 'quantity', 'unit_price', 'discount']` shows its line total bottom right while its wide table keeps its columns. A highlighted field no column shows is drawn too: the grid's own fetch, the list page's fetch and the related list's fetch now ask for the object's `highlightFields` beside its name field, through the same field-level security gate.
11+
12+
This changes the phone card of every object that declares `highlightFields` and shows its fields in a different order, or shows more than two of them: review an object's `highlightFields` order if its phone list now reads differently. An object without `highlightFields` keeps the column-order card. Nothing changes on desktop tables, apart from the fetch asking for the highlighted fields.

‎ui/packages/plugin-grid/src/__tests__/phoneCardAmount-34615.test.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,13 @@ describe('the phone card follows the object\'s highlightFields (objectstack#3789
294294
type: 'formula',
295295
label: 'Total',
296296
returnType: 'currency',
297-
expression: 'record.quantity * record.unit_price * (1 - record.discount / 100)',
297+
expression: 'record.quantity * record.unit_price * (1 - record.discount)',
298298
},
299299
line_number: { type: 'number', label: 'Line #', scale: 0 },
300300
access_pin: { type: 'password', label: 'Access PIN' },
301301
};
302302
const LINE_ROWS = [
303-
{ id: 'l1', line_number: 1, product_title: 'Admin Training Workshop', crm_product: 'Training', quantity: 2, unit_price: 6000, discount: 10, total_price: 10800, access_pin: 's3cr3t-pin' },
303+
{ id: 'l1', line_number: 1, product_title: 'Admin Training Workshop', crm_product: 'Training', quantity: 2, unit_price: 6000, discount: 0.1, total_price: 10800, access_pin: 's3cr3t-pin' },
304304
{ id: 'l2', line_number: 2, product_title: 'AI Agent Seat (Annual)', crm_product: 'Seat', quantity: 10, unit_price: 1000, discount: null, total_price: 10000, access_pin: 's3cr3t-pin' },
305305
];
306306
/** HotCRM's `relatedListColumns` for the order's lines. */
@@ -352,7 +352,7 @@ describe('the phone card follows the object\'s highlightFields (objectstack#3789
352352
const [quantity, price, discount] = parts(first).map((p) => p.textContent);
353353
expect(quantity).toBe('Quantity 2');
354354
expect(price).toBe('Sales Price CN¥6,000.00');
355-
expect(discount).toMatch(/^Discount % 10(\.00)?\s?%$/);
355+
expect(discount).toMatch(/^Discount % 10\.00\s?%$/);
356356
// The line number the table shows first is no longer a subtitle part.
357357
expect(within(first).getByTestId('grid-card-subtitle').textContent).not.toMatch(/^1 ·/);
358358
});

0 commit comments

Comments
 (0)