Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions .changeset/35892-related-tab-full-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'@object-ui/core': patch
'@object-ui/i18n': patch
'@object-ui/plugin-list': patch
'@object-ui/plugin-detail': patch
'@object-ui/app-shell': patch
---

feat(ui): a record page's related tab is the child object's full list

Clause-②: yes (widening) — a new export `ListConditionsBlock` (`@object-ui/plugin-list`, the condition row as a host element, not a registered node type) and its `ListConditionsHostProps`; a new slot `RelatedListConditionsSlotContext` and its `RelatedListConditionsProps` (`@object-ui/plugin-detail`), which the record page fills (`@object-ui/app-shell`); new exports `ConditionDiscardButton` and its type `ConditionDiscardButtonProps` (`@object-ui/plugin-list`) and `withHeaderSortPick` (`@object-ui/core`); new i18n keys in every `@object-ui/i18n` locale pack (`listConditions.chips.discard`, `listConditions.chips.discardHint`, `detail.relatedNoMatches`, `detail.deleteRowsTitle`, and the count family `detail.deleteRowsConfirmation` with its plural slots `_zero`, `_one`, `_two`, `_few`, `_many`, `_other` as each pack needs them); nothing removed or renamed
Metadata-protocol: none

On a record page, a related list opened as its own tab now works like the object's list page:

- The first row names the child list (its tile and title) on the left and keeps **+ Add** on the right. The **Open in list** button is gone.
- The second row is the list page's own condition row: **Sort** (several levels) and **Filter**, with no view switch, view settings or search. On a narrow tab or in the drawer their labels fold to icons.
- The table is the list page's grid: the column menu, cell editing as on the list page wherever the reader may edit the child object, row selection with the floating bulk bar (bulk delete asks once, deletes the selection in one batch call where the data source has one, and says how many rows went and how many did not), and the footer row, whose calculations cover every matching row, not just the loaded ones. A tab grouped by status draws no footer row.
- Rows load as the page scrolls instead of in pages.
- The tab title still counts every child; the footer counts the rows the filter keeps.
- What the reader changes (sort, filter, footer calculations) lasts while they stay on the record, for that reader only, across its tabs and between its page and its drawer, and is gone after a reload or on another record. **Discard** appears once something changed and puts the tab back; there is no Save. The list page's Discard and this one are one button.

Upgrade note: the header sort and the column widths and order that an earlier version remembered for a related tab in a reader's record-page preference (`sys_user_preference`) no longer apply: the tab opens in its declared order, and its column widths and order are now kept in the reader's browser, as the list page's are, so they start from the default once. Nothing stored is deleted. The default sort and columns of every related list are unchanged.

`@object-ui/core` adds `withHeaderSortPick`, the list page's rule for how a header sort joins an existing multi-level sort, now shared with the related tab. `@object-ui/app-shell`'s list Discard is drawn by `ConditionDiscardButton`; it looks and behaves as before.
32 changes: 11 additions & 21 deletions ui/packages/app-shell/src/views/ListDraftActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
cn,
} from '@object-ui/components';
import { useObjectTranslation } from '@object-ui/i18n';
import type { ListViewProps } from '@object-ui/plugin-list';
import { ConditionDiscardButton, type ListViewProps } from '@object-ui/plugin-list';
import { ChevronDown, CopyPlus, RotateCcw, Save } from 'lucide-react';

/** One part of a list that can differ from its view (`ListView`'s vocabulary). */
Expand Down Expand Up @@ -112,18 +112,13 @@ export function ListDraftActions({
return (
<span className={cn('flex shrink-0 items-center gap-1', className)} data-testid="list-draft">
{/* The wide face: Discard beside Save ▾. */}
<Button
type="button"
variant="ghost"
size="sm"
<ConditionDiscardButton
label={discardLabel}
title={discardTitle}
data-testid="list-draft-discard"
className="hidden h-6 shrink-0 gap-1 px-1.5 text-[13px] font-normal text-muted-foreground shadow-none @[40rem]/list:inline-flex"
onClick={onDiscard}
>
<RotateCcw className="h-3.5 w-3.5" aria-hidden="true" />
{discardLabel}
</Button>
className="hidden @[40rem]/list:inline-flex"
onDiscard={onDiscard}
/>
{offersSave ? (
<DropdownMenu>
<DropdownMenuTrigger asChild>
Expand Down Expand Up @@ -169,18 +164,13 @@ export function ListDraftActions({
</DropdownMenuContent>
</DropdownMenu>
) : (
<Button
type="button"
variant="ghost"
size="sm"
<ConditionDiscardButton
label={discardLabel}
title={discardTitle}
data-testid="list-draft-compact-discard"
className="inline-flex h-6 shrink-0 gap-1 px-1.5 text-[13px] font-normal text-muted-foreground shadow-none @[40rem]/list:hidden"
onClick={onDiscard}
>
<RotateCcw className="h-3.5 w-3.5" aria-hidden="true" />
{discardLabel}
</Button>
className="inline-flex @[40rem]/list:hidden"
onDiscard={onDiscard}
/>
)}
</span>
);
Expand Down
6 changes: 5 additions & 1 deletion ui/packages/app-shell/src/views/RecordDetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ import type { ConsoleActionDispatch } from '../consoleActionDispatch.js';
import { useRecordApprovals, openApprovalOf, isSubmitterOf } from '../hooks/useRecordApprovals.js';
import { RecordAttachmentsPanel } from './RecordAttachmentsPanel.js';
import { RecordApprovalsPanel } from './RecordApprovalsPanel.js';
import { ApprovalBandOnceScope, RecordStageMenu } from '@object-ui/plugin-detail';
import { ApprovalBandOnceScope, RecordStageMenu, RelatedListConditionsSlotContext } from '@object-ui/plugin-detail';
import { renderRelatedListConditions } from './relatedListConditions.js';
import { DeclaredActionsBar } from './DeclaredActionsBar.js';
import {
SYS_APPROVAL_REQUEST_OBJECT,
Expand Down Expand Up @@ -5603,6 +5604,8 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri
attachments: !!(filesEnabled && !hasAttachments && pureRecordId),
});
const pageTree = (
// objectstack#35892 — a related tab draws the list page's condition row.
<RelatedListConditionsSlotContext.Provider value={renderRelatedListConditions}>
<RecordHeaderBarContext.Provider value={headerBarForRecord}>
<RecordHeaderStateContext.Provider value={recordHeaderState}>
<RecordReadReportContext.Provider value={objectName === SYS_APPROVAL_REQUEST_OBJECT ? reportRecordRead : null}>
Expand Down Expand Up @@ -6103,6 +6106,7 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri
</RecordReadReportContext.Provider>
</RecordHeaderStateContext.Provider>
</RecordHeaderBarContext.Provider>
</RelatedListConditionsSlotContext.Provider>
);
// A drawer draws this view embedded and is its own host. A page is the host
// of the drawer its related rows and lookups open over it
Expand Down
32 changes: 32 additions & 0 deletions ui/packages/app-shell/src/views/relatedListConditions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* ObjectUI
* Copyright (c) 2024-present ObjectStack Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* The condition row a record page's related tab draws (objectstack#35892):
* the list page's own Sort and Filter, `@object-ui/plugin-list`'s
* `ListConditionsBlock`. `@object-ui/plugin-detail` draws the tab but cannot
* import `plugin-list` (which depends on it), so the record page hands the
* block in through `RelatedListConditionsSlotContext`. It loads with the first
* tab that draws it, as `plugin-list` loads for the list page.
*/

import { lazy, Suspense } from 'react';
import type { RelatedListConditionsProps } from '@object-ui/plugin-detail';

const ListConditionsBlock = lazy(() =>
import('@object-ui/plugin-list').then((m) => ({ default: m.ListConditionsBlock })),
);

/** The record page's `RelatedListConditionsSlotContext` value. */
export function renderRelatedListConditions(props: RelatedListConditionsProps) {
return (
<Suspense fallback={null}>
<ListConditionsBlock {...props} />
</Suspense>
);
}
1 change: 1 addition & 0 deletions ui/packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export {
readObjectSortability,
isPlatformSortableField,
filterPlatformSortableSort,
withHeaderSortPick,
} from './utils/column-sortability.js';
// [objectstack#27504] The served packaged-action activation: which declared
// actions the installation switched off, stamped by the data layer and asked
Expand Down
16 changes: 16 additions & 0 deletions ui/packages/core/src/utils/column-sortability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,19 @@ export function filterPlatformSortableSort<T extends { field?: string }>(
if (!Array.isArray(sort)) return [];
return sort.filter((item) => isPlatformSortableField(sortability, item?.field));
}

/**
* A column-header sort pick laid over the sort in force (objectstack#35876):
* the header menu hands back the ONE column the reader picked. With no sort
* or a single level, that column replaces the sort. With two levels or more it
* becomes the first level and every other level keeps its place after it; a
* column already in the sort moves up and takes the picked direction. No level
* is dropped. Shared by every host that draws the header menu over its own
* sort (the list page, a record page's related tab), so one click means one
* thing on both.
*/
export function withHeaderSortPick<T extends { field: string }>(current: readonly T[], picked: readonly T[]): T[] {
return picked.length === 1 && current.length >= 2
? [picked[0], ...current.filter((s) => s.field !== picked[0].field)]
: [...picked];
}
12 changes: 12 additions & 0 deletions ui/packages/i18n/src/locales/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1814,6 +1814,16 @@ const ar = {
deleteRow: "حذف",
deleteRowConfirmation: "حذف “{{name}}”؟",
deleteRowTitle: "حذف السجل",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "لا توجد سجلات تطابق عامل التصفية",
deleteRowsTitle: "حذف السجلات المحددة",
deleteRowsConfirmation: "سيتم حذف {{count}} سجل. لا يمكن التراجع عن ذلك.",
deleteRowsConfirmation_zero: "سيتم حذف {{count}} سجل. لا يمكن التراجع عن ذلك.",
deleteRowsConfirmation_one: "سيتم حذف {{count}} سجل. لا يمكن التراجع عن ذلك.",
deleteRowsConfirmation_two: "سيتم حذف سجلين ({{count}}). لا يمكن التراجع عن ذلك.",
deleteRowsConfirmation_few: "سيتم حذف {{count}} سجلات. لا يمكن التراجع عن ذلك.",
deleteRowsConfirmation_many: "سيتم حذف {{count}} سجلًا. لا يمكن التراجع عن ذلك.",
deleteRowsConfirmation_other: "سيتم حذف {{count}} سجل. لا يمكن التراجع عن ذلك.",
actions: "الإجراءات",
previousPage: "السابق",
nextPage: "التالي",
Expand Down Expand Up @@ -5698,6 +5708,8 @@ const ar = {
sortedBy: "مرتب حسب {{field}}",
reset: 'إعادة تعيين',
resetHint: 'العودة إلى طريقة العرض المحفوظة',
discard: 'تجاهل',
discardHint: 'العودة إلى الفرز والتصفية الافتراضيين',
remove: 'إزالة {{label}}',
toggleSort: 'عكس {{label}}',
dragSort: 'اسحب لتغيير أولوية الفرز',
Expand Down
8 changes: 8 additions & 0 deletions ui/packages/i18n/src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,12 @@ const de = {
deleteRow: "Löschen",
deleteRowConfirmation: "Möchten Sie „{{name}}“ wirklich löschen?",
deleteRowTitle: "Datensatz löschen",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "Keine Datensätze entsprechen dem Filter",
deleteRowsTitle: "Ausgewählte Datensätze löschen",
deleteRowsConfirmation: "{{count}} Datensätze werden gelöscht. Dies kann nicht rückgängig gemacht werden.",
deleteRowsConfirmation_one: "{{count}} Datensatz wird gelöscht. Dies kann nicht rückgängig gemacht werden.",
deleteRowsConfirmation_other: "{{count}} Datensätze werden gelöscht. Dies kann nicht rückgängig gemacht werden.",
actions: "Aktionen",
previousPage: "Zurück",
nextPage: "Weiter",
Expand Down Expand Up @@ -5092,6 +5098,8 @@ const de = {
sortedBy: "Sortiert nach {{field}}",
reset: 'Zurücksetzen',
resetHint: 'Zurück zur gespeicherten Ansicht',
discard: 'Verwerfen',
discardHint: 'Zurück zur Standardsortierung und zum Standardfilter',
remove: '{{label}} entfernen',
toggleSort: '{{label}} umkehren',
dragSort: 'Ziehen, um die Sortierpriorität zu ändern',
Expand Down
8 changes: 8 additions & 0 deletions ui/packages/i18n/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,12 @@ const en = {
deleteRow: 'Delete',
deleteRowConfirmation: 'Are you sure you want to delete "{{name}}"?',
deleteRowTitle: 'Delete record',
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: 'No records match the filter',
deleteRowsTitle: 'Delete selected records',
deleteRowsConfirmation: '{{count}} records will be deleted. This cannot be undone.',
deleteRowsConfirmation_one: '{{count}} record will be deleted. This cannot be undone.',
deleteRowsConfirmation_other: '{{count}} records will be deleted. This cannot be undone.',
actions: 'Actions',
previousPage: 'Previous',
nextPage: 'Next',
Expand Down Expand Up @@ -5852,6 +5858,8 @@ const en = {
sortedBy: 'Sorted by {{field}}',
reset: 'Reset',
resetHint: 'Back to the view as saved',
discard: 'Discard',
discardHint: 'Back to the default sort and filter',
remove: 'Remove {{label}}',
toggleSort: 'Reverse {{label}}',
dragSort: 'Drag to change the sort priority',
Expand Down
9 changes: 9 additions & 0 deletions ui/packages/i18n/src/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,13 @@ const es = {
deleteRow: "Eliminar",
deleteRowConfirmation: "¿Eliminar “{{name}}”?",
deleteRowTitle: "Eliminar registro",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "Ningún registro coincide con el filtro",
deleteRowsTitle: "Eliminar los registros seleccionados",
deleteRowsConfirmation: "Se eliminarán {{count}} registros. Esto no se puede deshacer.",
deleteRowsConfirmation_one: "Se eliminará {{count}} registro. Esto no se puede deshacer.",
deleteRowsConfirmation_many: "Se eliminarán {{count}} de registros. Esto no se puede deshacer.",
deleteRowsConfirmation_other: "Se eliminarán {{count}} registros. Esto no se puede deshacer.",
actions: "Acciones",
previousPage: "Anterior",
nextPage: "Siguiente",
Expand Down Expand Up @@ -5244,6 +5251,8 @@ const es = {
sortedBy: "Ordenado por {{field}}",
reset: 'Restablecer',
resetHint: 'Volver a la vista guardada',
discard: 'Descartar',
discardHint: 'Volver al orden y filtro predeterminados',
remove: 'Quitar {{label}}',
toggleSort: 'Invertir {{label}}',
dragSort: 'Arrastra para cambiar la prioridad del orden',
Expand Down
9 changes: 9 additions & 0 deletions ui/packages/i18n/src/locales/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,13 @@ const fr = {
deleteRow: "Supprimer",
deleteRowConfirmation: "Supprimer « {{name}} » ?",
deleteRowTitle: "Supprimer l'enregistrement",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "Aucun enregistrement ne correspond au filtre",
deleteRowsTitle: "Supprimer les enregistrements sélectionnés",
deleteRowsConfirmation: "{{count}} enregistrements seront supprimés. Cette action est irréversible.",
deleteRowsConfirmation_one: "{{count}} enregistrement sera supprimé. Cette action est irréversible.",
deleteRowsConfirmation_many: "{{count}} d'enregistrements seront supprimés. Cette action est irréversible.",
deleteRowsConfirmation_other: "{{count}} enregistrements seront supprimés. Cette action est irréversible.",
actions: "Actions",
previousPage: "Précédent",
nextPage: "Suivant",
Expand Down Expand Up @@ -5240,6 +5247,8 @@ const fr = {
sortedBy: "Trié par {{field}}",
reset: 'Réinitialiser',
resetHint: 'Revenir à la vue enregistrée',
discard: 'Abandonner',
discardHint: 'Revenir au tri et au filtre par défaut',
remove: 'Retirer {{label}}',
toggleSort: 'Inverser {{label}}',
dragSort: 'Faire glisser pour changer la priorité du tri',
Expand Down
8 changes: 8 additions & 0 deletions ui/packages/i18n/src/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,12 @@ const ja = {
history: "履歴",
historyEmpty: "履歴はまだありません",
deleteRowTitle: "レコードを削除",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "フィルターに一致するレコードはありません",
deleteRowsTitle: "選択したレコードを削除",
deleteRowsConfirmation: "{{count}} 件のレコードを削除します。この操作は元に戻せません。",
deleteRowsConfirmation_one: "{{count}} 件のレコードを削除します。この操作は元に戻せません。",
deleteRowsConfirmation_other: "{{count}} 件のレコードを削除します。この操作は元に戻せません。",
createdBy: "作成者",
updatedBy: "更新者",
created: "作成",
Expand Down Expand Up @@ -5094,6 +5100,8 @@ const ja = {
sortedBy: "{{field}} で並べ替え",
reset: 'リセット',
resetHint: '保存されたビューに戻す',
discard: '破棄',
discardHint: '既定の並べ替えと絞り込みに戻す',
remove: '{{label}}を削除',
toggleSort: '{{label}}を反転',
dragSort: 'ドラッグして並べ替えの優先順位を変更',
Expand Down
8 changes: 8 additions & 0 deletions ui/packages/i18n/src/locales/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,12 @@ const ko = {
deleteRow: "삭제",
deleteRowConfirmation: "“{{name}}”을(를) 삭제하시겠습니까?",
deleteRowTitle: "레코드 삭제",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "필터와 일치하는 레코드가 없습니다",
deleteRowsTitle: "선택한 레코드 삭제",
deleteRowsConfirmation: "레코드 {{count}}개가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.",
deleteRowsConfirmation_one: "레코드 {{count}}개가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.",
deleteRowsConfirmation_other: "레코드 {{count}}개가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.",
actions: "작업",
previousPage: "이전",
nextPage: "다음",
Expand Down Expand Up @@ -5091,6 +5097,8 @@ const ko = {
sortedBy: "{{field}} 기준 정렬",
reset: '초기화',
resetHint: '저장된 보기로 돌아가기',
discard: '변경 취소',
discardHint: '기본 정렬과 필터로 돌아가기',
remove: '{{label}} 제거',
toggleSort: '{{label}} 방향 바꾸기',
dragSort: '드래그하여 정렬 우선순위 변경',
Expand Down
9 changes: 9 additions & 0 deletions ui/packages/i18n/src/locales/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,13 @@ const pt = {
deleteRow: "Excluir",
deleteRowConfirmation: "Excluir “{{name}}”?",
deleteRowTitle: "Excluir registro",
// objectstack#35892 — the related tab: a filter that matches nothing, and its bulk delete.
relatedNoMatches: "Nenhum registro corresponde ao filtro",
deleteRowsTitle: "Excluir registros selecionados",
deleteRowsConfirmation: "{{count}} registros serão excluídos. Esta ação não pode ser desfeita.",
deleteRowsConfirmation_one: "{{count}} registro será excluído. Esta ação não pode ser desfeita.",
deleteRowsConfirmation_many: "{{count}} de registros serão excluídos. Esta ação não pode ser desfeita.",
deleteRowsConfirmation_other: "{{count}} registros serão excluídos. Esta ação não pode ser desfeita.",
actions: "Ações",
previousPage: "Anterior",
nextPage: "Próximo",
Expand Down Expand Up @@ -5239,6 +5246,8 @@ const pt = {
sortedBy: "Ordenado por {{field}}",
reset: 'Redefinir',
resetHint: 'Voltar à visualização salva',
discard: 'Descartar',
discardHint: 'Voltar à ordenação e ao filtro padrão',
remove: 'Remover {{label}}',
toggleSort: 'Inverter {{label}}',
dragSort: 'Arraste para mudar a prioridade da ordenação',
Expand Down
Loading
Loading