import { type ObjectScope, type SortOrder } from "./_helpers.mjs"; import type { CustomObject, CustomObjectFieldInput } from "./custom-object.mjs"; import { type ExistingManifestContextOptions } from "./existing-manifest-context.mjs"; import type { Field } from "./field.mjs"; import type { ManifestComponentDeletion } from "./manifest-builder.mjs"; export interface ListViewDeletionIdentifier { viewId: string; objectRqlName: string; } /** * Per-column display configuration for a list view. */ export interface ListViewColumnConfig { /** * Relative display width for this column. */ widthRatio: number; } /** * Initialization properties for {@link ListViewDef}. */ export interface ListViewDefProps { /** * Display name of this list view shown in the UI (e.g. `'All members'`). * * Required. */ name: string; /** * Columns to display, as live {@link Field} references or standard field names. At least one field is required. * * Required. */ fields: CustomObjectFieldInput[]; /** * Whether this view is visible to all users (`true`) or only the record owner (`false`). * * Required. */ isPublic: boolean; /** * Stable identifier for this view. Pass a human-readable slug * (e.g. `'view_gym_all_members'`) to keep it stable across regenerations. * * Optional. Auto-generated when omitted. @default generateId('view') */ viewId?: string; /** * Field to sort by. Required when `sortOrder` is set. * * Optional. */ orderBy?: CustomObjectFieldInput; /** * Sort direction. One of `'ASC'` | `'DESC'`. Requires `orderBy` to be set. * * Optional. */ sortOrder?: SortOrder; /** * Record scope for this view. One of `'all'` | `'my_records'`. * * Optional. @default `'all'` */ objectScope?: ObjectScope; /** * Human-readable description of this view. * * Required. */ description: string; /** * Per-column configuration overrides keyed by field API name. * * Only `widthRatio` is currently supported. Presentation hints such as * badge/status rendering are not list-view column config options. * * Optional. @default `{}` */ columnConfig?: Record; /** * RQL filter expression to pre-filter records shown in this view * (e.g. `'(session_date__c == TODAY())'`). * * Optional. @default null */ rqlFilter?: string; } export interface ListViewDefLoadFromExistingOptions extends ExistingManifestContextOptions { customObjectApiName?: string; } /** * Defines a list view and registers it with the manifest. * * A list view defines which fields appear as columns, their sort order, and an * optional RQL filter. You can define multiple views per custom object; each * appears as a selectable view in the object's list page. * * @example * ```ts * new ListViewDef(memberObj, { * viewId: 'view_gym_all_members', * name: 'All members', * description: 'Directory with membership status', * fields: ['name', memberEmail, memberPhone, memberStatusField, memberJoinDate], * orderBy: 'name', * sortOrder: 'ASC', * isPublic: true, * objectScope: 'all', * }); * * // Filtered view example: * new ListViewDef(sessionObj, { * viewId: 'view_gym_today_sessions', * name: 'Today\'s class sessions', * fields: [sessionTrainerRef, sessionStartField, sessionClassTypeField], * orderBy: sessionStartField, * sortOrder: 'ASC', * isPublic: true, * objectScope: 'all', * rqlFilter: '(session_date__c == TODAY())', * }); * ``` */ export declare class ListViewDef { static readonly componentType: "CUSTOM_OBJECT_LIST_VIEW"; static toDeletionIdentifier(identifier: ListViewDeletionIdentifier): ManifestComponentDeletion; private readonly _viewId; private readonly _customObjectApiName; private readonly _name; private readonly _fields; private readonly _isPublic; private readonly _orderBy; private readonly _sortOrder; private readonly _objectScope; private readonly _description; private readonly _columnConfig; private readonly _rqlFilter; /** * @param customObject - The custom object this view belongs to. * @param props - Initialization properties. * @throws {Error} If `name` is empty, `fields` is empty, or `sortOrder` is set without `orderBy`. */ constructor(customObject: CustomObject, props: ListViewDefProps); /** * Loads this list view from the active existing-manifest JSON context. */ static loadFromExisting(viewId: string, options?: ListViewDefLoadFromExistingOptions): ListViewDef; /** @internal Hydrates a list view from existing manifest wire JSON. */ static _fromExistingComponent(customObject: CustomObject, component: Record, resolveField: (apiName: string) => Field): ListViewDef; /** * Returns the stable identifier for this view (e.g. `'view_gym_all_members'`). */ getViewId(): string; /** * Returns the api_name of the custom object this view belongs to. */ getCustomObjectApiName(): string; /** * Serializes this list view to the wire format consumed by the manifest install endpoint. * * @returns A plain object with `type: 'CUSTOM_OBJECT_LIST_VIEW'`. * Optional fields are omitted when unset. */ toDict(): Record; } //# sourceMappingURL=list-view.d.mts.map