@mixd-id/web-scaffold 0.1.230406142 → 0.1.230406144
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 +1 -1
- package/src/index.js +3 -3
- package/src/utils/helpers.mjs +9 -6
- package/src/utils/listview.js +4 -11
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {defineAsyncComponent,
|
|
1
|
+
import {defineAsyncComponent, ref} from "vue"
|
|
2
2
|
import {observeInit} from './utils/helpers.mjs'
|
|
3
3
|
import throttle from "lodash/throttle"
|
|
4
4
|
|
|
@@ -273,9 +273,9 @@ export default{
|
|
|
273
273
|
app.config.globalProperties.$observe = observeInit()
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
-
app.config.globalProperties.$screenPrefix = util.calculateMediaPrefix(window.innerWidth)
|
|
276
|
+
app.config.globalProperties.$screenPrefix = ref(util.calculateMediaPrefix(window.innerWidth))
|
|
277
277
|
const onWindowResize = throttle(() => {
|
|
278
|
-
app.config.globalProperties.$screenPrefix = util.calculateMediaPrefix(window.innerWidth)
|
|
278
|
+
app.config.globalProperties.$screenPrefix.value = util.calculateMediaPrefix(window.innerWidth)
|
|
279
279
|
resizeEvents.forEach((fn) => fn())
|
|
280
280
|
}, 1000, { leading:true })
|
|
281
281
|
|
package/src/utils/helpers.mjs
CHANGED
|
@@ -267,14 +267,17 @@ function observeInit(){
|
|
|
267
267
|
|
|
268
268
|
const item = entry.target
|
|
269
269
|
const key = item.__observeKey
|
|
270
|
-
const { type, callback } = observeCols[key]
|
|
271
270
|
|
|
272
|
-
if(
|
|
273
|
-
callback
|
|
271
|
+
if(observeCols[key]){
|
|
272
|
+
const { type, callback } = observeCols[key]
|
|
274
273
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
if(typeof callback === 'function')
|
|
275
|
+
callback.apply(item)
|
|
276
|
+
|
|
277
|
+
if(type === 'once'){
|
|
278
|
+
observer.unobserve(item)
|
|
279
|
+
delete observeCols[key]
|
|
280
|
+
}
|
|
278
281
|
}
|
|
279
282
|
})
|
|
280
283
|
}
|
package/src/utils/listview.js
CHANGED
|
@@ -244,7 +244,7 @@ let ListView = {
|
|
|
244
244
|
[ 'id', 'desc' ],
|
|
245
245
|
]
|
|
246
246
|
|
|
247
|
-
let attributeIncludes
|
|
247
|
+
let attributeIncludes = []
|
|
248
248
|
if(this.getAttributeIncludes){
|
|
249
249
|
attributeIncludes = this.getAttributeIncludes(preset)
|
|
250
250
|
}
|
|
@@ -265,10 +265,6 @@ let ListView = {
|
|
|
265
265
|
switch(column.virtual.type){
|
|
266
266
|
|
|
267
267
|
case 'sql':
|
|
268
|
-
if(!Array.isArray(attributeIncludes)){
|
|
269
|
-
attributeIncludes = []
|
|
270
|
-
}
|
|
271
|
-
|
|
272
268
|
attributeIncludes.push([
|
|
273
269
|
Sequelize.literal(`(${column.virtual.value})`), column.key
|
|
274
270
|
])
|
|
@@ -327,10 +323,10 @@ let ListView = {
|
|
|
327
323
|
let derivedSql
|
|
328
324
|
let { rows:items, count } = await this.model.findAndCountAll({
|
|
329
325
|
where,
|
|
330
|
-
attributes:
|
|
326
|
+
attributes: [
|
|
331
327
|
...attributes,
|
|
332
|
-
|
|
333
|
-
|
|
328
|
+
...attributeIncludes
|
|
329
|
+
],
|
|
334
330
|
order,
|
|
335
331
|
limit: itemsPerPage + 1,
|
|
336
332
|
replacements,
|
|
@@ -1197,7 +1193,6 @@ let ListView = {
|
|
|
1197
1193
|
break
|
|
1198
1194
|
|
|
1199
1195
|
case 'in':
|
|
1200
|
-
console.log('#number in', Array.isArray(value) ? value : (value.toString().split(',')))
|
|
1201
1196
|
whereValue = {
|
|
1202
1197
|
...whereValue,
|
|
1203
1198
|
[Op.in]: Array.isArray(value) ? value : (value.toString().split(','))
|
|
@@ -1264,8 +1259,6 @@ let ListView = {
|
|
|
1264
1259
|
|
|
1265
1260
|
async onHooks(model, event, items, socket){
|
|
1266
1261
|
|
|
1267
|
-
//console.log('listview.js onHooks', model, event, items)
|
|
1268
|
-
|
|
1269
1262
|
if(socket.loadParams && socket.loadParams[this.name] && [ 'create', 'update' ].includes(event)){
|
|
1270
1263
|
const loadParams = { ...socket.loadParams[this.name] }
|
|
1271
1264
|
|