Skip to content

Commit

Permalink
Merge branch 'vue-3' into vue-3-better-animation
Browse files Browse the repository at this point in the history
  • Loading branch information
formsdev committed Dec 8, 2023
2 parents 86f6ba5 + 24276f0 commit 8bf5abf
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 44 deletions.
2 changes: 1 addition & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Kernel extends HttpKernel
],

'api' => [
'throttle:60,1',
'throttle:100,1',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Session\Middleware\StartSession::class,
Expand Down
31 changes: 21 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@vueuse/core": "^10.5.0",
"@vueuse/motion": "^2.0.0",
"axios": "^0.21.1",
"chart.js": "^3.7.1",
"chart.js": "^4.4.0",
"clone-deep": "^4.0.1",
"date-fns": "^2.28.0",
"debounce": "^1.2.1",
Expand All @@ -30,7 +30,7 @@
"tinymotion": "^0.2.0",
"vform": "^2.1.1",
"vue": "^3.2.13",
"vue-chartjs": "^4.1.0",
"vue-chartjs": "^5.2.0",
"vue-codemirror": "^4.0.6",
"vue-confetti": "^2.3.0",
"vue-country-flag-next": "^2.3.2",
Expand Down
17 changes: 9 additions & 8 deletions resources/js/components/common/ScrollShadow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default {
bottom: false,
left: false
},
debounceTimeout: null
debounceTimeout: null,
scrollContainerObserver: null,
wrapObserver: null
}
},
mounted () {
Expand All @@ -60,20 +62,19 @@ export default {
const scrollContainerObserver = newResizeObserver(this.toggleShadow)
if (scrollContainerObserver) {
scrollContainerObserver.observe(this.$refs.scrollContainer)
// Cleanup when the component is unmounted.
this.$once('hook:unmounted', () => scrollContainerObserver.disconnect())
}
// Recalculate the container dimensions when the wrapper is resized.
const wrapObserver = newResizeObserver(this.calcDimensions)
if (wrapObserver) {
wrapObserver.observe(this.$el)
// Cleanup when the component is unmounted.
this.$once('hook:unmounted', () => wrapObserver.disconnect())
this.wrapObserver = newResizeObserver(this.calcDimensions)
if (this.wrapObserver) {
this.wrapObserver.observe(this.$el)
}
},
unmounted () {
window.removeEventListener('resize', this.calcDimensions)
// Cleanup when the component is unmounted.
this.wrapObserver.disconnect()
this.scrollContainerObserver.disconnect()
},
methods: {
async calcDimensions () {
Expand Down
8 changes: 4 additions & 4 deletions resources/js/components/open/forms/components/FormStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
</div>
<loader v-else-if="isLoading" class="h-6 w-6 text-nt-blue mx-auto" />
<LineChart v-else
:chart-options="chartOptions"
:chart-data="chartData"
:options="chartOptions"
:data="chartData"
/>
</div>
</template>

<script>
import axios from 'axios'
import { Line as LineChart } from 'vue-chartjs/legacy'
import { Line as LineChart } from 'vue-chartjs'
import {
Chart as ChartJS,
Title,
Expand Down Expand Up @@ -93,7 +93,7 @@ export default {
}
},
responsive: true,
maintainAspectRatio: false
maintainAspectRatio: true
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
</div>
</modal>

<loader v-if="!form || isLoading" class="h-6 w-6 text-nt-blue mx-auto" />
<loader v-if="!form || !formInitDone" class="h-6 w-6 text-nt-blue mx-auto" />
<div v-else>
<div class="flex flex-wrap items-end">
<div v-if="form && tableData.length > 0" class="flex flex-wrap items-end">
<div class="flex-grow">
<text-input class="w-64" :form="searchForm" name="search" placeholder="Search..." />
</div>
<div class="font-semibold flex gap-4">
<p v-if="form && !isLoading && formInitDone" class="float-right text-xs uppercase mb-2">
<p class="float-right text-xs uppercase mb-2">
<a
href="javascript:void(0);" class="text-gray-500" @click="showColumnsModal=true"
>Display columns</a>
</p>
<p v-if="form && !isLoading && tableData.length > 0" class="text-right text-xs uppercase">
<p class="text-right text-xs uppercase">
<a
:href="exportUrl" target="_blank"
>Export as CSV</a>
Expand Down Expand Up @@ -101,7 +101,6 @@ export default {
}
},
data () {
return {
formInitDone: false,
Expand Down Expand Up @@ -153,7 +152,7 @@ export default {
}
},
watch: {
form () {
'form.id' () {
if (this.form === null) {
return
}
Expand All @@ -167,7 +166,7 @@ export default {
},
methods: {
initFormStructure () {
if (!this.form || this.formInitDone) {
if (!this.form || !this.form.properties || this.formInitDone) {
return
}
Expand Down Expand Up @@ -215,6 +214,7 @@ export default {
const resData = response.data
this.tableData = this.tableData.concat(resData.data.map((record) => record.data))
this.dataChanged()
if (this.currentPage < resData.meta.last_page) {
this.currentPage += 1
Expand Down
4 changes: 3 additions & 1 deletion resources/js/components/open/tables/OpenTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ export default {
mounted () {
const parent = document.getElementById('table-page')
this.tableHash = cyrb53(JSON.stringify(this.form.properties))
parent.addEventListener('scroll', this.handleScroll, { passive: true })
if (parent) {
parent.addEventListener('scroll', this.handleScroll, { passive: true })
}
window.addEventListener('resize', this.handleScroll)
this.onStructureChange()
this.handleScroll()
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/open/tables/components/OpenSelect.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<span class="-mb-2" v-if="value">
<span v-if="value" class="-mb-2">
<template v-if="valueIsObject">
<open-tag v-for="val,index in value" :key="index" :opt="val" />
<open-tag v-for="(val,index) in value" :key="index+val" :opt="val" />
</template>
<open-tag v-else :opt="value" />
</span>
Expand Down
18 changes: 9 additions & 9 deletions resources/js/pages/forms/show/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
</span>
<span>- Edited {{ form.last_edited_human }}</span>
</p>
<div v-if="['draft','closed'].includes(form.visibility) || (form.tags && form.tags.length > 0)" class="mt-2 flex items-center flex-wrap gap-3">
<div v-if="['draft','closed'].includes(form.visibility) || (form.tags && form.tags.length > 0)"
class="mt-2 flex items-center flex-wrap gap-3"
>
<span v-if="form.visibility=='draft'"
class="inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-600 ring-1 ring-inset ring-gray-500/10 dark:text-white dark:bg-gray-700"
>
Expand Down Expand Up @@ -110,13 +112,11 @@
<div class="flex bg-white">
<div class="w-full md:w-4/5 lg:w-3/5 md:mx-auto md:max-w-4xl px-4">
<div class="py-4">
<transition name="fade" mode="out-in">
<router-view v-slot="{ Component }">
<transition name="page" mode="out-in">
<component :is="Component" :form="form" />
</transition>
</router-view>
</transition>
<router-view v-slot="{ Component }">
<transition name="page" mode="out-in">
<component :is="Component" :form="form" />
</transition>
</router-view>
</div>
</div>
</div>
Expand Down Expand Up @@ -210,7 +210,7 @@ export default {
computed: {
workingForm: {
get () {
get () {
return this.workingFormStore.content
},
/* We add a setter */
Expand Down

0 comments on commit 8bf5abf

Please sign in to comment.