-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(component): Added missing components
- Loading branch information
1 parent
c2bf41a
commit 0e487b2
Showing
8 changed files
with
213 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<AppLayout> | ||
<template #header> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
Create File | ||
</h2> | ||
</template> | ||
|
||
<Create title="Files" /> | ||
</AppLayout> | ||
</template> | ||
|
||
<script> | ||
import create from "Pub/js/Projectbuilder/Model/create" | ||
export default { | ||
extends: create, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<AppLayout> | ||
<template #header> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
Edit File: {{ file.name }} | ||
</h2> | ||
</template> | ||
|
||
<Edit :element="file" title="Files" /> | ||
</AppLayout> | ||
</template> | ||
|
||
<script> | ||
import edit from "Pub/js/Projectbuilder/Model/edit" | ||
export default { | ||
extends: edit, | ||
props: { | ||
file: Object, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<AppLayout> | ||
<template #header> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
Files | ||
</h2> | ||
</template> | ||
|
||
<Index :elements="files" title="Files" /> | ||
</AppLayout> | ||
</template> | ||
|
||
<script> | ||
import index from "Pub/js/Projectbuilder/Model/index" | ||
export default { | ||
extends: index, | ||
props: { | ||
files: Object, | ||
}, | ||
} | ||
</script> |
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,26 @@ | ||
<template> | ||
<AppLayout> | ||
<template #header> | ||
<h2 class="font-semibold text-xl text-gray-800 leading-tight"> | ||
File: {{ file.name }} | ||
</h2> | ||
</template> | ||
|
||
<Show :element="file" title="Files" /> | ||
</AppLayout> | ||
</template> | ||
|
||
<script> | ||
import show from "Pub/js/Projectbuilder/Model/show" | ||
export default { | ||
extends: show, | ||
props: { | ||
file: Object, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<template> | ||
<div | ||
:class="'mt-2 mb-2 w-full h-auto bg-center bg-cover bg-no-repeat bg-clip-padding p-6 border rounded' + (!disabled ? ' border-4 border-dashed' : '')" | ||
:style="'background-image: url('+fileUrl+')'" | ||
v-on:drop="dropHandler" | ||
v-on:dragover="dragOverHandler" | ||
> | ||
<div v-if="!disabled" class="bg-gray-200 border rounded opacity-50 as-input h-48"> | ||
<input | ||
:id="'grid-'+ keyel +'-' + keyid" | ||
ref="file" | ||
type="file" | ||
class="appearance-none block w-full h-40 opacity-0 cursor-pointer h-full" | ||
:required="isRequired('file')" | ||
@change="processInputFile" | ||
> | ||
<span | ||
class="relative as-message px-2 py-1 bg-gray-800 text-gray-200 inline-block opacity-50 cursor-pointer" | ||
@click="triggerClick" | ||
> Drag & Drop / Click</span> | ||
</div> | ||
<div v-else class="h-40"></div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import PbInput from "Pub/js/Projectbuilder/pbinput" | ||
export default { | ||
extends: PbInput, | ||
name: "File", | ||
props: { | ||
url: String, | ||
}, | ||
data() { | ||
return { | ||
disabled: !!this.url, | ||
fileUrl: !!this.url ? this.url : null, | ||
} | ||
}, | ||
methods: { | ||
updateFilePreview(file) { | ||
let url = "#"; | ||
if (file && file.type.includes('image/')) { | ||
url = URL.createObjectURL(file) | ||
} | ||
this.fileUrl = url | ||
}, | ||
processInputFile() { | ||
let file = this.$refs.file.files[0] | ||
this.updatePreviewAndEmit(file) | ||
}, | ||
updatePreviewAndEmit(file) { | ||
const reader = new FileReader(); | ||
reader.onload = (e) => { | ||
this.updateFilePreview(file) | ||
}; | ||
reader.readAsDataURL(file) | ||
this.emitFileValue(file) | ||
}, | ||
dropHandler(ev) { | ||
ev.preventDefault(); | ||
if (this.disabled) { | ||
return | ||
} | ||
let file = ev.dataTransfer.files | ||
this.setFile(file); | ||
this.processInputFile() | ||
}, | ||
dragOverHandler(ev) { | ||
ev.preventDefault(); | ||
}, | ||
setFile(files) { | ||
document.getElementById('grid-'+ this.keyel +'-' + this.keyid).files = files; | ||
}, | ||
triggerClick(ev) { | ||
ev.target.previousElementSibling.click(); | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.as-message { | ||
transform: translate(0, -50%); | ||
bottom: 50%; | ||
} | ||
.as-input:hover { | ||
opacity: 0.65; | ||
} | ||
</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
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