From 93d067b346f3ccb816d310c52bfc49a21851b608 Mon Sep 17 00:00:00 2001 From: Johannes Zillmann Date: Fri, 29 Jan 2021 13:24:48 +0100 Subject: [PATCH] Page selection --- ui/public/index.html | 2 +- ui/src/Result.svelte | 1 - ui/src/Table.svelte | 140 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 115 insertions(+), 28 deletions(-) diff --git a/ui/public/index.html b/ui/public/index.html index 628b5d1..a26ef4e 100644 --- a/ui/public/index.html +++ b/ui/public/index.html @@ -5,7 +5,7 @@ - Snowpack App + PDF to Markdown diff --git a/ui/src/Result.svelte b/ui/src/Result.svelte index fddfae3..dda9d03 100644 --- a/ui/src/Result.svelte +++ b/ui/src/Result.svelte @@ -1,6 +1,5 @@ + +
+
+ + (openedPageIndex = !openedPageIndex)}> + + + + + {#if openedPageIndex} +
+ + + +
+ {#each new Array(maxPage + 1) as _, idx} +
itemsGroupedByPage.has(idx) && focusOnPage(idx)} + class="px-2 border border-gray-300 rounded-full text-center {itemsGroupedByPage.has(idx) ? 'hover:text-green-700 hover:border-green-700 cursor-pointer' : 'opacity-50'}"> + {idx} +
+ {/each} +
+
+ {/if} +
+ +
|
+
Transformation:
+ +
Parse Result
+ +
+
+ + + @@ -14,31 +77,67 @@ {/each} - {#each items as item, idx} - {#if idx > 0 && item.page !== items[idx - 1].page} - + {#each [...itemsGroupedByPage].filter(([page]) => !focused || page === focusedPage) as [pageNumber, items], pageIdx} + + {#if pageIdx > 0} + {/if} - - {#if idx === 0 || item.page !== items[idx - 1].page} - - {:else} - - {#each columns as column} - - {/each} - + {#each items as item, itemIdx} + + + {#if itemIdx === 0} + + {:else} + + {#each columns as column} + + {/each} + + {/each} {/each}
#
Page {item.page} - {/if} - {idx}{item.data[column]}
+
Page {pageNumber} {focused ? '' : ' / ' + maxPage}
+
+ {#if !focused} + focusOnPage(pageNumber)}> + + + {:else} + + + + {/if} +
+
+ {/if} + {itemIdx}{item.data[column]}