import type { AttributeDefinition, RallyDataContext, RallyModelName, RallyObject, RallyStore, RallyWSAPIStoreConfig } from '../../utils/rallySDKTypes.js'; import type { Component, Snippet } from 'svelte'; import type { FilterState } from '../Filter/types.js'; import type { ButtonProps } from '../Button/types.js'; import type { InputProps, TextAreaProps } from '../Input/types.js'; import type { MultiSelectComboboxProps, SingleSelectComboboxProps } from '../Combobox/types.js'; export interface Props> { additionalFilters?: any[] | undefined; filterConfig?: FilterConfig; data?: GridItem[] | Promise; store?: RallyStore | undefined; storeConfig?: RallyWSAPIStoreConfig | undefined; artifactType?: RallyModelName | RallyModelName[] | undefined; stateId?: string | undefined; enableBulkSelection?: boolean; hierarchyConfig?: HierarchyConfig; collectionPopupConfig?: CollectionPopupConfig; showSummaryRow?: boolean; showFooter?: boolean; columnConfig?: ColumnConfig; pageSizeConfig?: PageSizeConfig; exportConfig?: ExportConfig; savedViewConfig?: SavedViewConfig; updateButtonConfig?: UpdateButtonConfig; displayPreferenceConfig?: DisplayPreferenceConfig; selectedRows?: GridItem[] | GridItem[]; editable?: boolean; maxHeight?: string; /** * When providing a local data array, specify a field name that uniquely identifies each item * in order to allow indexing of rows in grid */ uniqueIdField?: string | undefined; headerLeft?: Snippet; headerCenter?: Snippet; headerRight?: Snippet; inlineFilterContainer?: Snippet; footerLeft?: Snippet; footerCenter?: Snippet; footerRight?: Snippet; onSelectedColumnsChange?: (selectedColumns: Column[]) => void; onRowClick?: (item: GridItem, rowIndex: number, event: MouseEvent) => void; onCellUpdated?: (item: GridItem, rowIndex: number, dataIndex: keyof GridItem) => void; onDataLoaded?: (data: GridItem[]) => void; onHierarchyDataLoaded?: (data: GridItem[]) => void; onViewModified?: (view: GridView) => void; } export declare enum ColumnType { numeric = "numeric", date = "date", textShort = "textShort", textLong = "textLong" } export type ComboEditorProps = RallyObject> = { componentType: 'combobox'; getProps: (value?: unknown, record?: DataType) => SingleSelectComboboxProps | MultiSelectComboboxProps; }; export type InputEditorProps = { componentType: 'input'; getProps: (value?: unknown, record?: DataType | undefined) => InputProps | TextAreaProps; }; export interface Column = RallyObject, C extends Record = Record> { text: string; dataIndex: Extract; columnType?: keyof typeof ColumnType; editorProps?: ComboEditorProps | InputEditorProps; isCustomized?: boolean; resizable?: boolean; sortable?: boolean; readOnly?: boolean; required?: boolean; editable?: boolean; filterable?: boolean; width?: number | string; attributeDefinition?: AttributeDefinition; renderer?: (value: any, record: DataType, rowIndex: number, columnIndex: number) => string | number | Promise; snippet?: Snippet<[value?: any, record?: DataType, rowIndex?: number, columnIndex?: number]>; component?: Component; componentProps?: C | ((value?: any, record?: DataType, rowIndex?: number, columnIndex?: number) => C); summaryRenderer?: 'percent' | ((records: DataType[]) => string | number); summaryValue?: string | number | undefined; sorterFn?: (a: unknown, b: unknown) => number; el?: HTMLHeadingElement; isLast?: boolean; id?: string | number; } export interface AdditionalGridData extends RallyObject { id?: string; cellDisplayValues?: Record; _Expanded?: boolean; _Parent?: T & AdditionalGridData; _Children?: (T & AdditionalGridData)[]; _ChildrenLoaded?: boolean; _Depth?: number; _ParentType?: HierarchyType; _GridParentId?: string; _UniqueId?: string; dirtyValue?: any; } export type GridState = { selectedColumns: { text: string; dataIndex: string; columnType?: keyof typeof ColumnType; resizable?: boolean; sortable?: boolean; width?: string | number; id?: string | number; }[]; filtersVisible: boolean; pageSize: number | undefined; displayPreference: DisplayPreference; }; export type HierarchyType = 'Children' | 'UserStories' | 'Tasks' | 'Defects' | 'Risks' | 'TestCases' | 'KeyResults' | 'AssociatedWork' | 'AssociatedItems' | 'CapacityPlanItems' | 'CapacityPlanProjects' | 'AssociatedProjects' | 'ChildCapacityPlans' | 'SubObjectives' | 'Artifacts' | 'Projects' | 'WorkProducts' | 'WorkItemsAffected' | 'Results' | 'DefectSuites'; export type DisplayPreference = 'Comfortable' | 'Roomy'; export type ColumnConfig> = { /** * If artifactType or storeConfig is provided, you can use this prop to supply a list of field * names/dataIndexes of initially selected columns */ initialColumnFieldNames?: string[] | undefined; /** * List of columns to initially display within the Grid. If this prop is not provided, it defaults * to whatever is passed to the columns prop */ selectedColumns?: Column[]; /** * Array of all available columns that can be shown within the Grid. If artifactType or storeConfig is * provided, this prop can be ommitted as columns will be derrived from the WSAPI Type Definition. * This prop can also be ommitted if a list of Column objects is passed to selectedColumns and the list * of columns will remain static. */ columns?: Column[]; columnBlockList?: string[]; showColumnChooser?: boolean; }; export type PageSizeConfig = { enable?: boolean; pageSize?: number; pageSizes?: number[]; }; export type ExportConfig = { enable?: boolean; strategy?: 'allTopLevelRecords' | 'allRecordsCurrentlyShown'; buttonProps?: Partial; fileName?: string; }; export type CollectionPopupConfig = { enable?: boolean; allowedCollectionTypes?: HierarchyType[]; gridProps?: Record; statefulByModel?: boolean; }; export type HierarchyConfig = { enable?: boolean; autoExpand?: boolean; allowedTypes?: HierarchyType[]; filtersBySubType?: Partial>; showExpandAllButton?: boolean; context?: RallyDataContext; }; export type GridView = { currentSort?: { column: { dataIndex: string; id?: string | number; }; direction: 'ASC' | 'DESC'; }; selectedColumns?: { dataIndex: string; id?: string | number; width?: string | number; }[]; pageSize: number; filters?: FilterState; displayPreference: DisplayPreference; }; export type SavedViewConfig = { enable?: boolean; getAdditionalViewData?: () => Record; onViewChange?: (view: Record) => Promise; }; export type UpdateButtonConfig = { enable?: boolean; buttonProps?: Partial; onClickFn?: () => void; hasUnappliedChanges?: boolean; }; export type FilterConfig = { enable?: boolean; buttonProps?: Partial; }; export type DisplayPreferenceConfig = { enable?: boolean; defaultDisplayPreference?: DisplayPreference; };