(style: GenericStyle)
| 64 | type GenericStyle = Style & Partial<{if: GenericIf}>; |
| 65 | |
| 66 | function convertElement(style: GenericStyle): IConvertedStyle { |
| 67 | let ast: QuerySyntaxTree; |
| 68 | |
| 69 | return { |
| 70 | checksColumn: () => |
| 71 | !R.isNil(style.if) && |
| 72 | (!R.isNil(style.if.column_id) || |
| 73 | !R.isNil(style.if.column_type) || |
| 74 | !R.isNil(style.if.column_editable)), |
| 75 | checksFilter: () => |
| 76 | !R.isNil(style.if) && !R.isNil(style.if.filter_query), |
| 77 | checksDataRow: () => !R.isNil(style.if) && !R.isNil(style.if.row_index), |
| 78 | checksHeaderRow: () => |
| 79 | !R.isNil(style.if) && !R.isNil(style.if.header_index), |
| 80 | checksState: () => !R.isNil(style.if?.state), |
| 81 | checksStateActive: () => style.if?.state === 'active', |
| 82 | checksStateSelected: () => style.if?.state === 'selected', |
| 83 | matchesActive: (active: boolean) => |
| 84 | ifColumnStateActive(style.if, active), |
| 85 | matchesColumn: (column: IColumn | undefined) => |
| 86 | !style.if || |
| 87 | (!R.isNil(column) && |
| 88 | ifColumnId(style.if, column && column.id) && |
| 89 | ifColumnType(style.if, column && column.type) && |
| 90 | ifEditable(style.if, column && column.editable)), |
| 91 | matchesFilter: (datum: Datum) => |
| 92 | !style.if || |
| 93 | style.if.filter_query === undefined || |
| 94 | (ast = ast || new QuerySyntaxTree(style.if.filter_query)).evaluate( |
| 95 | datum |
| 96 | ), |
| 97 | matchesDataRow: (index: number) => ifRowIndex(style.if, index), |
| 98 | matchesHeaderRow: (index: number) => ifHeaderIndex(style.if, index), |
| 99 | matchesSelected: (selected: boolean) => |
| 100 | ifColumnStateSelected(style.if, selected), |
| 101 | style: convertStyle(style) |
| 102 | }; |
| 103 | } |
| 104 | |
| 105 | function convertStyle(style: Style): CSSProperties { |
| 106 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
no test coverage detected
searching dependent graphs…