(options: VisualConstructorOptions)
| 76 | public static fetchMoreTimeout = 5000; |
| 77 | |
| 78 | constructor(options: VisualConstructorOptions) { |
| 79 | // console.log('Visual constructor', options); |
| 80 | this.host = options.host; |
| 81 | this.events = this.host.eventService; |
| 82 | this.selectionManager = this.host.createSelectionManager(); |
| 83 | this.persistAction = {}; |
| 84 | |
| 85 | if (document) { |
| 86 | options.element.style.position = 'relative'; |
| 87 | this.viewElement = util.addDiv(options.element, 'sanddance-powerbi'); |
| 88 | this.errorElement = util.addDiv(options.element, 'sanddance-error'); |
| 89 | this.errorElement.style.position = 'absolute'; |
| 90 | |
| 91 | const props: Props = { |
| 92 | mounted: (app: App) => { |
| 93 | this.app = app; |
| 94 | }, |
| 95 | onContextMenu: (e: MouseEvent | PointerEvent, selectionId?: powerbiVisualsApi.extensibility.ISelectionId) => { |
| 96 | const position: powerbiVisualsApi.extensibility.IPoint = { |
| 97 | x: e.clientX, |
| 98 | y: e.clientY, |
| 99 | }; |
| 100 | this.selectionManager.showContextMenu(selectionId || {}, position); |
| 101 | }, |
| 102 | onViewChange: viewChangeOptions => { |
| 103 | // console.log('onViewChange', this.renderingOptions); |
| 104 | if (this.renderingOptions) { |
| 105 | this.events.renderingFinished(this.renderingOptions); |
| 106 | |
| 107 | this.persist({ reason: 'onViewChange', ...viewChangeOptions }, null); |
| 108 | } |
| 109 | }, |
| 110 | onSnapshotsChanged: snapshots => { |
| 111 | this.persist({ reason: 'onSnapshotsChanged' }, snapshots); |
| 112 | }, |
| 113 | onError: (e: any) => { |
| 114 | if (this.renderingOptions) { |
| 115 | this.events.renderingFailed(this.renderingOptions); |
| 116 | this.renderingOptions = null; |
| 117 | } |
| 118 | }, |
| 119 | onDataFilter: (searchFilter, filteredData) => { |
| 120 | // console.log('onDataFilter', filteredData); |
| 121 | if (filteredData) { |
| 122 | const result = convertFilter(searchFilter, this.columns, filteredData); |
| 123 | this.applySelection(result.selectedIds); |
| 124 | this.applyFilters(result.filters); |
| 125 | this.filters = { sd: searchFilter, pbi: result.filters }; |
| 126 | } else { |
| 127 | this.filters = null; |
| 128 | this.clearFilter(); |
| 129 | this.clearSelection(); |
| 130 | } |
| 131 | }, |
| 132 | onSelectionChanged: (searchFilter, activeIndex, selectedData) => { |
| 133 | // console.log('onDataSelected', selectedData); |
| 134 | if (selectedData) { |
| 135 | const result = convertFilter(searchFilter, this.columns, selectedData); |
nothing calls this directly
no test coverage detected