@d-mok/quasar-app-extension-quasar-axe 1.0.13 → 1.0.17
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/package.json
CHANGED
|
@@ -9,12 +9,8 @@
|
|
|
9
9
|
aria-label="Menu"
|
|
10
10
|
@click="open = !open"
|
|
11
11
|
/>
|
|
12
|
-
|
|
13
12
|
<q-toolbar-title class="text-weight-bolder text-h5">{{ title }}</q-toolbar-title>
|
|
14
|
-
|
|
15
|
-
<slot name="appendix">
|
|
16
|
-
<div class="text-h6">/{{ appendix }}</div>
|
|
17
|
-
</slot>
|
|
13
|
+
<div class="text-h6">/{{ appendix }}</div>
|
|
18
14
|
</q-toolbar>
|
|
19
15
|
</q-header>
|
|
20
16
|
|
package/src/utils/ORM/basic.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { LoadingBar } from 'quasar'
|
|
|
5
5
|
import { Ordering, Criteria, strKeyOf, Sheet } from 'sapphire-js'
|
|
6
6
|
import { reactive } from 'vue'
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
export type Where<T> =
|
|
10
9
|
{ [K in keyof T]?
|
|
11
10
|
: T[K]
|
|
@@ -53,11 +52,6 @@ export abstract class BasicTable<T extends R, R extends object> extends Sheet<T>
|
|
|
53
52
|
*/
|
|
54
53
|
public readonly ordering: Readonly<Ordering<T>> = []
|
|
55
54
|
|
|
56
|
-
/**
|
|
57
|
-
* Auto Cache
|
|
58
|
-
*/
|
|
59
|
-
public readonly caching: boolean = false
|
|
60
|
-
|
|
61
55
|
|
|
62
56
|
|
|
63
57
|
private convert(data: R[]): T[] {
|
|
@@ -123,11 +117,9 @@ export abstract class BasicTable<T extends R, R extends object> extends Sheet<T>
|
|
|
123
117
|
let { data, error } = await q
|
|
124
118
|
handleError(data, error)
|
|
125
119
|
|
|
126
|
-
if (this.caching) this.pushCache(data)
|
|
127
120
|
let entities = this.convert(data)
|
|
128
121
|
action(entities)
|
|
129
122
|
this.order(...this.ordering)
|
|
130
|
-
if (this.caching) this.screenCache()
|
|
131
123
|
|
|
132
124
|
|
|
133
125
|
this.log(type, entities)
|
|
@@ -146,43 +138,14 @@ export abstract class BasicTable<T extends R, R extends object> extends Sheet<T>
|
|
|
146
138
|
|
|
147
139
|
|
|
148
140
|
/**
|
|
149
|
-
*
|
|
141
|
+
* make reactive
|
|
150
142
|
*/
|
|
151
|
-
|
|
152
|
-
if (this.caching)
|
|
153
|
-
this.restoreCache()
|
|
143
|
+
reactive(): this {
|
|
154
144
|
return reactive(this) as this
|
|
155
145
|
}
|
|
156
146
|
|
|
157
147
|
|
|
158
148
|
|
|
159
|
-
private get cache(): R[] {
|
|
160
|
-
return JSON.parse(localStorage.getItem(this.tableName) ?? '[]')
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
private set cache(data: R[]) {
|
|
164
|
-
let json = JSON.stringify(data)
|
|
165
|
-
localStorage.setItem(this.tableName, json)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private restoreCache() {
|
|
169
|
-
let entities = this.convert(this.cache)
|
|
170
|
-
this.set(entities)
|
|
171
|
-
this.log('restore cache')
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private pushCache(data: R[]) {
|
|
175
|
-
this.cache = [...this.cache, ...data]
|
|
176
|
-
this.log('push cache')
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
private screenCache() {
|
|
180
|
-
let ids: any[] = this.scan(this.idField)
|
|
181
|
-
this.cache = this.cache.filter($ => ids.includes($[this.idField]))
|
|
182
|
-
this.log('screen cache')
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
149
|
|
|
187
150
|
|
|
188
151
|
|