Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | import type {ValueOf} from 'type-fest';
import type {ReportActionListItemType, TaskListItemType, TransactionGroupListItemType, TransactionListItemType} from '@components/SelectionList/types';
import type {SearchKey} from '@libs/SearchUIUtils';
import type CONST from '@src/CONST';
import type {SearchDataTypes} from '@src/types/onyx/SearchResults';
/** Model of the selected transaction */
type SelectedTransactionInfo = {
/** Whether the transaction is selected */
isSelected: boolean;
/** If the transaction can be deleted */
canDelete: boolean;
/** If the transaction can be put on hold */
canHold: boolean;
/** If the transaction can be moved to other report */
canChangeReport: boolean;
/** Whether the transaction is currently held */
isHeld: boolean;
/** If the transaction can be removed from hold */
canUnhold: boolean;
/** The action that can be performed for the transaction */
action: ValueOf<typeof CONST.SEARCH.ACTION_TYPES>;
/** The reportID of the transaction */
reportID: string;
/** The policyID tied to the report the transaction is reported on */
policyID: string;
/** The transaction amount */
amount: number;
};
/** Model of selected transactions */
type SelectedTransactions = Record<string, SelectedTransactionInfo>;
/** Model of selected reports */
type SelectedReports = {
reportID: string;
policyID: string | undefined;
action: ValueOf<typeof CONST.SEARCH.ACTION_TYPES>;
total: number;
};
/** Model of payment data used by Search bulk actions */
type PaymentData = {
reportID: string;
amount: number;
paymentType: ValueOf<typeof CONST.IOU.PAYMENT_TYPE>;
};
type SortOrder = ValueOf<typeof CONST.SEARCH.SORT_ORDER>;
type SearchColumnType = ValueOf<typeof CONST.SEARCH.TABLE_COLUMNS>;
type ExpenseSearchStatus = ValueOf<typeof CONST.SEARCH.STATUS.EXPENSE>;
type InvoiceSearchStatus = ValueOf<typeof CONST.SEARCH.STATUS.INVOICE>;
type TripSearchStatus = ValueOf<typeof CONST.SEARCH.STATUS.TRIP>;
type ChatSearchStatus = ValueOf<typeof CONST.SEARCH.STATUS.CHAT>;
type TaskSearchStatus = ValueOf<typeof CONST.SEARCH.STATUS.TASK>;
type SingularSearchStatus = ExpenseSearchStatus | InvoiceSearchStatus | TripSearchStatus | ChatSearchStatus | TaskSearchStatus;
type SearchStatus = SingularSearchStatus | SingularSearchStatus[];
type SearchGroupBy = ValueOf<typeof CONST.SEARCH.GROUP_BY>;
type TableColumnSize = ValueOf<typeof CONST.SEARCH.TABLE_COLUMN_SIZES>;
type SearchDatePreset = ValueOf<typeof CONST.SEARCH.DATE_PRESETS>;
type SearchContextData = {
currentSearchHash: number;
currentSearchKey: SearchKey | undefined;
selectedTransactions: SelectedTransactions;
selectedTransactionIDs: string[];
selectedReports: SelectedReports[];
isOnSearch: boolean;
shouldTurnOffSelectionMode: boolean;
};
type SearchContext = SearchContextData & {
setCurrentSearchHashAndKey: (hash: number, key: SearchKey | undefined) => void;
/** If you want to set `selectedTransactionIDs`, pass an array as the first argument, object/record otherwise */
setSelectedTransactions: {
(selectedTransactionIDs: string[], unused?: undefined): void;
(selectedTransactions: SelectedTransactions, data: TransactionListItemType[] | TransactionGroupListItemType[] | ReportActionListItemType[] | TaskListItemType[]): void;
};
/** If you want to clear `selectedTransactionIDs`, pass `true` as the first argument */
clearSelectedTransactions: {
(hash?: number, shouldTurnOffSelectionMode?: boolean): void;
(clearIDs: true, unused?: undefined): void;
};
removeTransaction: (transactionID: string | undefined) => void;
shouldShowFiltersBarLoading: boolean;
setShouldShowFiltersBarLoading: (shouldShow: boolean) => void;
setLastSearchType: (type: string | undefined) => void;
lastSearchType: string | undefined;
shouldShowExportModeOption: boolean;
setShouldShowExportModeOption: (shouldShow: boolean) => void;
isExportMode: boolean;
setExportMode: (on: boolean) => void;
};
type ASTNode = {
operator: ValueOf<typeof CONST.SEARCH.SYNTAX_OPERATORS>;
left: ValueOf<typeof CONST.SEARCH.SYNTAX_FILTER_KEYS> | ASTNode;
right: string | ASTNode | string[];
};
type QueryFilter = {
operator: ValueOf<typeof CONST.SEARCH.SYNTAX_OPERATORS>;
value: string | number;
};
type SearchBooleanFilterKeys = typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.BILLABLE | typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.REIMBURSABLE;
type SearchDateFilterKeys =
| typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE
| typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED
| typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED
| typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID
| typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED
| typeof CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED;
type SearchFilterKey =
| ValueOf<typeof CONST.SEARCH.SYNTAX_FILTER_KEYS>
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.TYPE
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.STATUS
| typeof CONST.SEARCH.SYNTAX_ROOT_KEYS.GROUP_BY;
type UserFriendlyKey = ValueOf<typeof CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS>;
type QueryFilters = Array<{
key: SearchFilterKey;
filters: QueryFilter[];
}>;
type SearchQueryString = string;
type SearchQueryAST = {
type: SearchDataTypes;
status: SearchStatus;
sortBy: SearchColumnType;
sortOrder: SortOrder;
groupBy?: SearchGroupBy;
filters: ASTNode;
policyID?: string[];
};
type SearchQueryJSON = {
inputQuery: SearchQueryString;
hash: number;
/** Hash used for putting queries in recent searches list. It ignores sortOrder and sortBy, because we want to treat queries differing only in sort params as the same query */
recentSearchHash: number;
flatFilters: QueryFilters;
} & SearchQueryAST;
type SearchAutocompleteResult = {
autocomplete: SearchAutocompleteQueryRange | null;
ranges: SearchAutocompleteQueryRange[];
};
type SearchAutocompleteQueryRange = {
key: SearchFilterKey;
length: number;
start: number;
value: string;
};
type SearchParams = {
queryJSON: SearchQueryJSON;
searchKey: SearchKey | undefined;
offset: number;
prevReports?: string[];
shouldCalculateTotals: boolean;
};
export type {
SelectedTransactionInfo,
SelectedTransactions,
SearchColumnType,
SearchBooleanFilterKeys,
SearchDateFilterKeys,
SearchStatus,
SearchQueryJSON,
SearchQueryString,
SortOrder,
SearchContext,
SearchContextData,
ASTNode,
QueryFilter,
QueryFilters,
SearchFilterKey,
UserFriendlyKey,
ExpenseSearchStatus,
InvoiceSearchStatus,
TripSearchStatus,
ChatSearchStatus,
TaskSearchStatus,
SearchAutocompleteResult,
PaymentData,
SearchAutocompleteQueryRange,
SearchParams,
TableColumnSize,
SearchGroupBy,
SingularSearchStatus,
SearchDatePreset,
};
|