quasar-factory-lib 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert/AlertDialog.vue.d.ts +1 -1
- package/dist/components/Table/utils/sort.d.ts +4 -4
- package/dist/layouts/PdaLayout.vue.d.ts +2 -2
- package/dist/pages/AlertPage.vue.d.ts +1 -1
- package/dist/pages/TablePage.vue.d.ts +2 -2
- package/dist/quasar-factory-lib.js +6 -6
- package/dist/quasar-factory-lib.umd.cjs +2 -2
- package/dist/store/table.d.ts +3 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/SkeletonAreas/SkeletonAreas.vue +0 -1
- package/src/components/SkeletonFormCreateTask/SkeletonFormCreateTask.vue +2 -17
- package/src/components/SkeletonFormCreateTask/style.css +14 -0
- package/src/components/Table/utils/infiniteScroll.ts +3 -3
- package/src/components/Table/utils/sort.ts +46 -0
- package/src/css/app.css +1 -0
- package/src/env.d.ts +64 -0
- package/src/layouts/PdaLayout.vue +5 -5
- package/src/store/table.ts +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<q-card class="
|
|
3
|
+
<q-card class="form-create-task fixed-center">
|
|
4
4
|
<q-item>
|
|
5
5
|
<q-item-section>
|
|
6
6
|
<q-item-label>
|
|
@@ -39,19 +39,4 @@
|
|
|
39
39
|
name: 'SkeletonFormCreateTask',
|
|
40
40
|
}
|
|
41
41
|
</script>
|
|
42
|
-
|
|
43
|
-
.q-card {
|
|
44
|
-
width: 400px;
|
|
45
|
-
}
|
|
46
|
-
@media only screen and (max-width: 1100px) {
|
|
47
|
-
.q-card {
|
|
48
|
-
width: 300px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
@media only screen and (max-width: 350px) {
|
|
52
|
-
.q-card {
|
|
53
|
-
margin: auto;
|
|
54
|
-
height: auto;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
</style>
|
|
42
|
+
|
|
@@ -10,7 +10,7 @@ const infiniteScroll = {
|
|
|
10
10
|
qtableScrollElem.length > 0 ? qtableScrollElem[0] : window
|
|
11
11
|
const fnAddScroll = (event: Event) => {
|
|
12
12
|
const { scrollHeight, scrollTop, clientHeight } = event.target as HTMLElement
|
|
13
|
-
if (Math.abs(scrollHeight - clientHeight - scrollTop)
|
|
13
|
+
if (Math.abs(scrollHeight - clientHeight - scrollTop) <= 1) {
|
|
14
14
|
console.log(`[${tableType}] You are at the bottom!`, self.$refs.table.totalPage)
|
|
15
15
|
self.$refs.table.totalPage++
|
|
16
16
|
}
|
|
@@ -30,7 +30,7 @@ const infiniteScroll = {
|
|
|
30
30
|
const fnAddScroll = (event: Event) => {
|
|
31
31
|
console.log(totalPage, 'totalPage')
|
|
32
32
|
const { scrollHeight, scrollTop, clientHeight } = event.target as HTMLElement
|
|
33
|
-
if (Math.abs(scrollHeight - clientHeight - scrollTop)
|
|
33
|
+
if (Math.abs(scrollHeight - clientHeight - scrollTop) <= 1) {
|
|
34
34
|
debugger
|
|
35
35
|
console.log(`[${tableType}] You are at the bottom!`, totalPage)
|
|
36
36
|
totalPage++
|
|
@@ -61,7 +61,7 @@ const infiniteScroll = {
|
|
|
61
61
|
}
|
|
62
62
|
} else {
|
|
63
63
|
const { scrollHeight, scrollTop, clientHeight } = target
|
|
64
|
-
if (Math.abs(scrollHeight - clientHeight - scrollTop)
|
|
64
|
+
if (Math.abs(scrollHeight - clientHeight - scrollTop) <= 1) {
|
|
65
65
|
console.log('[Table] You are at the bottom!')
|
|
66
66
|
self.$refs.table.totalPage++
|
|
67
67
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const qTableSort = {
|
|
2
|
+
sortMethod<T extends Record<string, unknown>>(
|
|
3
|
+
rows: T[],
|
|
4
|
+
sortBy: keyof T,
|
|
5
|
+
descending: boolean,
|
|
6
|
+
values: (keyof T)[] = []
|
|
7
|
+
) {
|
|
8
|
+
const rowsFlat = [...rows]
|
|
9
|
+
console.log(sortBy, 'sortBy')
|
|
10
|
+
if (sortBy) {
|
|
11
|
+
if (values.includes(sortBy)) {
|
|
12
|
+
this.sortDates(sortBy, descending, rowsFlat)
|
|
13
|
+
} else {
|
|
14
|
+
rowsFlat.sort((a, b) => {
|
|
15
|
+
const x = descending ? b : a
|
|
16
|
+
const y = descending ? a : b
|
|
17
|
+
return x[sortBy] > y[sortBy] ? 1 : x[sortBy] < y[sortBy] ? -1 : 0
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return rowsFlat
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
sortDates<T extends Record<string, unknown>>(
|
|
26
|
+
sortBy: keyof T,
|
|
27
|
+
descending: boolean,
|
|
28
|
+
rowsFlat: T[]
|
|
29
|
+
) {
|
|
30
|
+
console.log(sortBy, 'sortBy')
|
|
31
|
+
rowsFlat.sort((columnA, columnB) => {
|
|
32
|
+
const a = columnA[sortBy] as string
|
|
33
|
+
const b = columnB[sortBy] as string
|
|
34
|
+
|
|
35
|
+
let x = descending ? b : a
|
|
36
|
+
let y = descending ? a : b
|
|
37
|
+
|
|
38
|
+
x = x.split('/').reverse().join('-')
|
|
39
|
+
y = y.split('/').reverse().join('-')
|
|
40
|
+
|
|
41
|
+
return x.localeCompare(y)
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
export default qTableSort
|
package/src/css/app.css
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@import url('../components/TaskNavBar/css/taskNavBar.css');
|
|
3
3
|
@import url('../components/ConfirmedTask/style.css');
|
|
4
4
|
@import url('../components/SkeletonAreas/style.css');
|
|
5
|
+
@import url('../components/SkeletonFormCreateTask/style.css');
|
|
5
6
|
@import url('./fonts.css');
|
|
6
7
|
:root {
|
|
7
8
|
--main-color: #FFF8F2;
|
package/src/env.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
import type { Quasar } from 'quasar'
|
|
4
|
+
import type { Router, RouteLocationNormalizedLoaded } from 'vue-router'
|
|
5
|
+
|
|
6
|
+
declare namespace NodeJS {
|
|
7
|
+
interface ProcessEnv {
|
|
8
|
+
NODE_ENV: string
|
|
9
|
+
VUE_ROUTER_MODE: 'hash' | 'history' | 'abstract' | undefined
|
|
10
|
+
VUE_ROUTER_BASE: string | undefined
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '@vue/runtime-core' {
|
|
15
|
+
interface ComponentCustomProperties {
|
|
16
|
+
$router: Router
|
|
17
|
+
$route: RouteLocationNormalizedLoaded
|
|
18
|
+
$q: Quasar
|
|
19
|
+
translate: (key: string, args?: unkown[]) => string
|
|
20
|
+
$t: I18n['global']['t']
|
|
21
|
+
$i18n: I18n
|
|
22
|
+
$refs: {
|
|
23
|
+
table: {
|
|
24
|
+
toogleColumnsSelectorVisibility: () => void
|
|
25
|
+
handleInfiniteScrollTableCompositionAPi: () => void
|
|
26
|
+
toggleSearchVisibility: (store: object) => void
|
|
27
|
+
filterInputFocus: ()=> void
|
|
28
|
+
totalPage: number
|
|
29
|
+
pageLength: number
|
|
30
|
+
enableDragAndDrop: boolean
|
|
31
|
+
}
|
|
32
|
+
AlertLabelsWithError: {
|
|
33
|
+
alert: boolean
|
|
34
|
+
labelsErrors: {
|
|
35
|
+
label: string
|
|
36
|
+
error: string
|
|
37
|
+
icon: string
|
|
38
|
+
spinner: boolean
|
|
39
|
+
}[]
|
|
40
|
+
setIconCircleCheck: (labelCode: string) => void
|
|
41
|
+
setLabelsSpinner: (labelCode: string, value: boolean) => void
|
|
42
|
+
}
|
|
43
|
+
ConfirmRef: {
|
|
44
|
+
openDialogAndSetMessage: (message: string) => void
|
|
45
|
+
}
|
|
46
|
+
ConfirmedTask: {
|
|
47
|
+
alert: boolean
|
|
48
|
+
}
|
|
49
|
+
AlertRef:{
|
|
50
|
+
openAlertAndSetMessage: (message: string) => void
|
|
51
|
+
}
|
|
52
|
+
sideBar: {
|
|
53
|
+
toggleRightDrawer:()=> void
|
|
54
|
+
setRightDrawerOpenToFalse: () => void
|
|
55
|
+
}
|
|
56
|
+
popup: {
|
|
57
|
+
hide: () => void
|
|
58
|
+
}
|
|
59
|
+
filterInput: {
|
|
60
|
+
inputFocus: () => void
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -84,7 +84,7 @@ import NavBarSkeleton from '../components/NavBarSkeleton/NavBarSkeleton.vue'
|
|
|
84
84
|
import TableRowsCounter from'../components/TableRowsCounter/TableRowsCounter.vue'
|
|
85
85
|
import AlertLabelsWithError from '../components/AlertLabelsWithError/AlertLabelsWithError.vue'
|
|
86
86
|
import setTableHeight from '../components/Table/utils/setTableHeight'
|
|
87
|
-
|
|
87
|
+
import infiniteScroll from '../components/Table/utils/infiniteScroll'
|
|
88
88
|
import { tableStore } from '../store/table.js'
|
|
89
89
|
export default {
|
|
90
90
|
components: {
|
|
@@ -555,16 +555,16 @@ export default {
|
|
|
555
555
|
'$q.screen.width' (): void {
|
|
556
556
|
setTimeout(() => {
|
|
557
557
|
this.tableStyle = setTableHeight.setTableHeight()
|
|
558
|
-
this.$refs.table.handleInfiniteScrollTableCompositionAPi()
|
|
559
|
-
|
|
558
|
+
// this.$refs.table.handleInfiniteScrollTableCompositionAPi()
|
|
559
|
+
infiniteScroll.handleInfiniteScrollNewTable(this)
|
|
560
560
|
}, 500)
|
|
561
561
|
},
|
|
562
562
|
showSkeleton (val: boolean) {
|
|
563
563
|
if (!val) {
|
|
564
564
|
setTimeout(() => {
|
|
565
565
|
this.tableStyle = setTableHeight.setTableHeight()
|
|
566
|
-
this.$refs.table.handleInfiniteScrollTableCompositionAPi()
|
|
567
|
-
|
|
566
|
+
// this.$refs.table.handleInfiniteScrollTableCompositionAPi()
|
|
567
|
+
infiniteScroll.handleInfiniteScrollNewTable(this)
|
|
568
568
|
}, 500)
|
|
569
569
|
}
|
|
570
570
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
import { useStorage } from '@vueuse/core'
|
|
3
|
+
export const tableStore = defineStore('tableStore', {
|
|
4
|
+
state: () => ({
|
|
5
|
+
filterValue: useStorage('filterValue', ''),
|
|
6
|
+
lastFilterValue: useStorage('lastFilterValue', ''),
|
|
7
|
+
visiblecolumns: useStorage('visiblecolumns', []as string[]),
|
|
8
|
+
prepared: useStorage('prepared', false),
|
|
9
|
+
user: useStorage('user', {})
|
|
10
|
+
}),
|
|
11
|
+
getters: {
|
|
12
|
+
},
|
|
13
|
+
actions: {
|
|
14
|
+
setFilterValue (val: string): void {
|
|
15
|
+
this.filterValue = val
|
|
16
|
+
},
|
|
17
|
+
cleanTableFilter (): void {
|
|
18
|
+
this.filterValue = ''
|
|
19
|
+
this.lastFilterValue = ''
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
})
|