-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PATCH: feat(files-manager): add pdf page selection feature
- Loading branch information
1 parent
3cf4854
commit ffc91d0
Showing
8 changed files
with
418 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
src/BIMDataSmartComponents/BIMDataFileManager/components/PdfPageSelector.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<template> | ||
<div class="pdf-page-selector"> | ||
<div class="head"> | ||
<BIMDataButton ghost radius @click="$emit('close')"> | ||
<BIMDataIcon name="arrow" size="xxs" /> | ||
<span style="margin-left: 6px"> | ||
{{ $translate("back") }} | ||
</span> | ||
</BIMDataButton> | ||
<span class="flex item-center"> | ||
<BIMDataIcon name="filePdfPolychrome" size="m" margin="0 6px 0 0" /> | ||
<span>{{ model.name }}</span> | ||
</span> | ||
<BIMDataButton ghost rounded icon @click="$emit('close')"> | ||
<BIMDataIcon name="close" size="xxs" /> | ||
</BIMDataButton> | ||
</div> | ||
<div class="body"> | ||
<BIMDataResponsiveGrid | ||
style="width: 100%" | ||
itemWidth="157px" | ||
rowGap="6px" | ||
columnGap="6px" | ||
> | ||
<div | ||
v-for="page of pages" | ||
:key="page.id" | ||
class="pdf-page" | ||
:class="{ selected: selectedPage?.id === page.id }" | ||
@click="selectedPage = page" | ||
> | ||
<div class="pdf-page__img"> | ||
<template v-if="page.map_file"> | ||
<img :src="page.map_file" :alt="`page ${page.page_number}`" /> | ||
</template> | ||
<template v-else> | ||
<BIMDataIcon name="filePdfPolychrome" size="l" /> | ||
</template> | ||
</div> | ||
<div class="pdf-page__num"> | ||
{{ page.page_number }} | ||
</div> | ||
</div> | ||
</BIMDataResponsiveGrid> | ||
</div> | ||
<div class="foot"> | ||
<BIMDataButton | ||
width="100%" | ||
color="primary" | ||
fill | ||
radius | ||
@click="$emit('select', selectedPage)" | ||
> | ||
{{ $translate("validate") }} | ||
</BIMDataButton> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
// Components | ||
import BIMDataButton from "../../../BIMDataComponents/BIMDataButton/BIMDataButton.vue"; | ||
import BIMDataIcon from "../../../BIMDataComponents/BIMDataIcon/BIMDataIcon.vue"; | ||
import BIMDataResponsiveGrid from "../../../BIMDataComponents/BIMDataResponsiveGrid/BIMDataResponsiveGrid.vue"; | ||
export default { | ||
components: { | ||
BIMDataButton, | ||
BIMDataIcon, | ||
BIMDataResponsiveGrid, | ||
}, | ||
inject: ["$translate"], | ||
props: { | ||
model: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
emits: ["select", "close"], | ||
data() { | ||
return { | ||
selectedPage: null, | ||
}; | ||
}, | ||
computed: { | ||
pages() { | ||
return [this.model].concat(this.model.children ?? []); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
<style scoped lang="scss"> | ||
.pdf-page-selector { | ||
width: 100%; | ||
height: 100%; | ||
padding: var(--spacing-unit); | ||
background-color: var(--color-white); | ||
display: flex; | ||
flex-direction: column; | ||
.head { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
gap: var(--spacing-unit); | ||
} | ||
.body { | ||
flex-grow: 1; | ||
padding: var(--spacing-unit) calc(var(--spacing-unit) / 2); | ||
max-height: calc(100% - 2 * var(--spacing-unit) - 32px); | ||
overflow-y: auto; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: var(--spacing-unit); | ||
.pdf-page { | ||
cursor: pointer; | ||
&__img { | ||
width: 157px; | ||
height: 218px; | ||
background-color: var(--color-white); | ||
box-shadow: var(--box-shadow); | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
img { | ||
width: 100%; | ||
} | ||
} | ||
&__num { | ||
padding-top: calc(var(--spacing-unit) / 2); | ||
text-align: center; | ||
font-weight: bold; | ||
} | ||
&.selected .pdf-page__img { | ||
border: 4px solid var(--color-primary); | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.