quasar-factory-lib 0.1.12 → 0.1.14

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.
@@ -1,10 +1,10 @@
1
- export const tableStore: import("pinia").StoreDefinition<"tableStore", {
1
+ export declare const tableStore: import("pinia").StoreDefinition<"tableStore", {
2
2
  filterValue: import("@vueuse/shared").RemovableRef<string>;
3
3
  lastFilterValue: import("@vueuse/shared").RemovableRef<string>;
4
- visiblecolumns: import("@vueuse/shared").RemovableRef<never[]>;
4
+ visiblecolumns: import("@vueuse/shared").RemovableRef<string[]>;
5
5
  prepared: import("@vueuse/shared").RemovableRef<boolean>;
6
6
  user: import("@vueuse/shared").RemovableRef<{}>;
7
7
  }, {}, {
8
- setFilterValue(val: any): void;
8
+ setFilterValue(val: string): void;
9
9
  cleanTableFilter(): void;
10
10
  }>;
package/package.json CHANGED
@@ -98,6 +98,6 @@
98
98
  "release": "standard-version"
99
99
  },
100
100
  "type": "module",
101
- "version": "0.1.12",
101
+ "version": "0.1.14",
102
102
  "author": ""
103
103
  }
@@ -550,7 +550,7 @@ export default defineComponent({
550
550
  qtableScrollElem.length > 0 ? qtableScrollElem[0] : window
551
551
  const fnAddScroll = (event: Event) => {
552
552
  const { scrollHeight, scrollTop, clientHeight } = event.target as HTMLElement
553
- if (Math.abs(scrollHeight - clientHeight - scrollTop - offSet) < 1) {
553
+ if (Math.abs(scrollHeight - clientHeight - scrollTop - offSet) <= 1) {
554
554
  console.log(`[${tableType}] You are at the bottom!`, this.totalPage)
555
555
  this.totalPage++
556
556
  }
@@ -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) < 1) {
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
  }
@@ -20,30 +20,6 @@ const infiniteScroll = {
20
20
  elementToScroll.addEventListener('scroll', fnAddScroll)
21
21
  })
22
22
  },
23
- handleInfiniteScrollNewTableCompositionAPi (nextTick, smallDevice, totalPage) {
24
- nextTick(() => {
25
- const elemClass = smallDevice ? 'q-table__grid-content' : 'q-table__middle scroll'
26
- const tableType = smallDevice ? 'Grid' : 'Table'
27
- const qtableScrollElem = document.getElementsByClassName(elemClass) as HTMLCollectionOf<HTMLElement>
28
- const elementToScroll =
29
- qtableScrollElem.length > 0 ? qtableScrollElem[0] : window
30
- const fnAddScroll = (event: Event) => {
31
- console.log(totalPage, 'totalPage')
32
- const { scrollHeight, scrollTop, clientHeight } = event.target as HTMLElement
33
- if (Math.abs(scrollHeight - clientHeight - scrollTop) < 1) {
34
- debugger
35
- console.log(`[${tableType}] You are at the bottom!`, totalPage)
36
- totalPage++
37
- }
38
- }
39
- window.removeEventListener('scroll', fnAddScroll)
40
- elementToScroll.removeEventListener('scroll', fnAddScroll)
41
- elementToScroll.addEventListener('scroll', fnAddScroll)
42
- })
43
- },
44
- /* paginationNewTable (self: { pageLength: number; }, rows: object []): object [] {
45
- return rows.slice(0, self.$refs.table.pageLength)
46
- }, */
47
23
  handleInfiniteScrollModal (self: { $nextTick: (arg0: () => void) => void; totalPageModal: number; smallDevice: boolean }, tableID: string): void {
48
24
  console.log('handleInfiniteScrollModal')
49
25
  self.$nextTick(() => {
@@ -61,7 +37,7 @@ const infiniteScroll = {
61
37
  }
62
38
  } else {
63
39
  const { scrollHeight, scrollTop, clientHeight } = target
64
- if (Math.abs(scrollHeight - clientHeight - scrollTop) < 1) {
40
+ if (Math.abs(scrollHeight - clientHeight - scrollTop) <= 1) {
65
41
  console.log('[Table] You are at the bottom!')
66
42
  self.$refs.table.totalPage++
67
43
  }
@@ -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/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
- // import infiniteScroll from '../components/Table/utils/infiniteScroll'
87
+ import infiniteScroll from '../components/Table/utils/infiniteScroll'
88
88
  import { tableStore } from '../store/table.js'
89
89
  export default {
90
90
  components: {
@@ -556,7 +556,7 @@ export default {
556
556
  setTimeout(() => {
557
557
  this.tableStyle = setTableHeight.setTableHeight()
558
558
  this.$refs.table.handleInfiniteScrollTableCompositionAPi()
559
- // infiniteScroll.handleInfiniteScrollNewTable(this)
559
+ //infiniteScroll.handleInfiniteScrollNewTable(this)
560
560
  }, 500)
561
561
  },
562
562
  showSkeleton (val: boolean) {
@@ -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
+ })