@mixd-id/web-scaffold 0.1.230406013 → 0.1.230406015
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
<div :class="computedClass">
|
|
4
|
-
<input :class="$style.input" maxlength="1" type="tel"
|
|
4
|
+
<input :class="$style.input" maxlength="1" type="tel" @focus="onFocus"
|
|
5
5
|
ref="verify" @keydown="verifyKeyDown" v-for="i in parseInt(length)"
|
|
6
6
|
:value="typeof modelValue === 'string' ? modelValue.split('')[i - 1] : ''"
|
|
7
7
|
@paste="verifyPaste" @keyup="verifyKeyUp($event, i - 1)" />
|
|
@@ -81,6 +81,10 @@ export default{
|
|
|
81
81
|
if((new RegExp('^\\d{' + this.size + '}$')).test(text)){
|
|
82
82
|
this.$emit('update:modelValue', text)
|
|
83
83
|
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
onFocus(e){
|
|
87
|
+
e.target.select()
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
}
|
|
@@ -321,7 +321,7 @@ export default{
|
|
|
321
321
|
formatColumn(item, column){
|
|
322
322
|
|
|
323
323
|
let value
|
|
324
|
-
if(column.key.indexOf('.') > -1){
|
|
324
|
+
if((column.key ?? '').toString().indexOf('.') > -1){
|
|
325
325
|
const columnKeys = column.key.split('.')
|
|
326
326
|
const columnAs = columnKeys[0]
|
|
327
327
|
const columnKey = columnKeys[1]
|
|
@@ -448,6 +448,10 @@ export default{
|
|
|
448
448
|
width: 100%;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
+
.table tr{
|
|
452
|
+
vertical-align: top;
|
|
453
|
+
}
|
|
454
|
+
|
|
451
455
|
.table th{
|
|
452
456
|
@apply relative text-left;
|
|
453
457
|
}
|
package/src/utils/helpers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const md5 = require("md5");
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
const { Op } = module.parent.require('sequelize')
|
|
4
|
+
const axios = module.parent.require('axios')
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
const ceil = (num, precision = 0) => {
|
|
@@ -96,7 +97,7 @@ const saveBuffer = async(buffer, dir = '/storage/files/images') => {
|
|
|
96
97
|
|
|
97
98
|
const type = await fileTypeFromBuffer(buffer)
|
|
98
99
|
|
|
99
|
-
const storagePath = process.env.ROOT_PATH +
|
|
100
|
+
const storagePath = process.env.ROOT_PATH + dir
|
|
100
101
|
const ext = type && type.ext ? '.' + type.ext : ''
|
|
101
102
|
const filename = md5(buffer) + ext
|
|
102
103
|
const to = storagePath + '/' + filename
|
package/src/utils/listpage1.js
CHANGED
|
@@ -89,6 +89,14 @@ let ListPage1 = {
|
|
|
89
89
|
|
|
90
90
|
const { items, hasNext, count } = await this._load(params)
|
|
91
91
|
|
|
92
|
+
if(this.name){
|
|
93
|
+
if(!this.socket.loadParams){
|
|
94
|
+
this.socket.loadParams = {}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.socket.loadParams[this.name] = params
|
|
98
|
+
}
|
|
99
|
+
|
|
92
100
|
return {
|
|
93
101
|
items,
|
|
94
102
|
hasNext,
|
|
@@ -477,6 +485,13 @@ let ListPage1 = {
|
|
|
477
485
|
}
|
|
478
486
|
}
|
|
479
487
|
|
|
488
|
+
if(typeof this['loadFilters'] === 'function'){
|
|
489
|
+
where = {
|
|
490
|
+
...where,
|
|
491
|
+
...(await this['loadFilters'](params) ?? {})
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
480
495
|
if(preset.sorts){
|
|
481
496
|
const { order:presetOrder } = this.getPresetSortParams(preset, includes)
|
|
482
497
|
if(presetOrder){
|
|
@@ -541,7 +556,7 @@ let ListPage1 = {
|
|
|
541
556
|
}*/
|
|
542
557
|
|
|
543
558
|
if(this.socket){
|
|
544
|
-
this.socket.
|
|
559
|
+
this.socket.join(this.channel)
|
|
545
560
|
}
|
|
546
561
|
|
|
547
562
|
return {
|
|
@@ -1046,8 +1061,6 @@ let ListPage1 = {
|
|
|
1046
1061
|
|
|
1047
1062
|
if(preset.filters){
|
|
1048
1063
|
|
|
1049
|
-
//console.log(util.inspect(preset.filters, false, null, true /* enable colors */))
|
|
1050
|
-
|
|
1051
1064
|
preset.filters.forEach((filter) => {
|
|
1052
1065
|
|
|
1053
1066
|
if(!filter.enabled) return
|
|
@@ -1127,12 +1140,6 @@ let ListPage1 = {
|
|
|
1127
1140
|
})
|
|
1128
1141
|
}
|
|
1129
1142
|
|
|
1130
|
-
//console.log(util.inspect(where, false, null, true /* enable colors */))
|
|
1131
|
-
|
|
1132
|
-
/*console.log(util.inspect(preset.filters, false, null, true /!* enable colors *!/))
|
|
1133
|
-
console.log(where)
|
|
1134
|
-
console.log(replacements)*/
|
|
1135
|
-
|
|
1136
1143
|
return {
|
|
1137
1144
|
where,
|
|
1138
1145
|
replacements
|
|
@@ -1284,6 +1291,13 @@ let ListPage1 = {
|
|
|
1284
1291
|
[Op.lte]: parseFloat(value)
|
|
1285
1292
|
}
|
|
1286
1293
|
break
|
|
1294
|
+
|
|
1295
|
+
case 'in':
|
|
1296
|
+
whereValue = {
|
|
1297
|
+
...whereValue,
|
|
1298
|
+
[Op.in]: Array.isArray(value) ? value : (value.toString().split(','))
|
|
1299
|
+
}
|
|
1300
|
+
break
|
|
1287
1301
|
}
|
|
1288
1302
|
})
|
|
1289
1303
|
break
|
|
@@ -1349,6 +1363,14 @@ let ListPage1 = {
|
|
|
1349
1363
|
[Op.regexp]: value
|
|
1350
1364
|
})
|
|
1351
1365
|
break
|
|
1366
|
+
|
|
1367
|
+
case 'in':
|
|
1368
|
+
console.log('#number in', Array.isArray(value) ? value : (value.toString().split(',')))
|
|
1369
|
+
whereValue = {
|
|
1370
|
+
...whereValue,
|
|
1371
|
+
[Op.in]: Array.isArray(value) ? value : (value.toString().split(','))
|
|
1372
|
+
}
|
|
1373
|
+
break
|
|
1352
1374
|
}
|
|
1353
1375
|
})
|
|
1354
1376
|
break
|
|
@@ -1407,13 +1429,44 @@ let ListPage1 = {
|
|
|
1407
1429
|
|
|
1408
1430
|
async onHooks(model, event, items, socket){
|
|
1409
1431
|
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1432
|
+
if(socket.loadParams[this.name] && [ 'create', 'update' ].includes(event)){
|
|
1433
|
+
const loadParams = { ...socket.loadParams[this.name] }
|
|
1434
|
+
|
|
1435
|
+
if(!loadParams.preset.filters)
|
|
1436
|
+
loadParams.preset.filters = []
|
|
1437
|
+
const filterIndex = loadParams.preset.filters.findIndex(filter => filter.key === 'id')
|
|
1438
|
+
if(filterIndex > -1){
|
|
1439
|
+
loadParams.preset.filters[filterIndex] = {
|
|
1440
|
+
enabled: true,
|
|
1441
|
+
type: "number",
|
|
1442
|
+
key: "id",
|
|
1443
|
+
filters: [
|
|
1444
|
+
{
|
|
1445
|
+
operator: "in",
|
|
1446
|
+
value: items.map((_) => _.id)
|
|
1447
|
+
}
|
|
1448
|
+
]
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
else{
|
|
1452
|
+
loadParams.preset.filters.push({
|
|
1453
|
+
enabled: true,
|
|
1454
|
+
type: "number",
|
|
1455
|
+
key: "id",
|
|
1456
|
+
filters: [
|
|
1457
|
+
{
|
|
1458
|
+
operator: "in",
|
|
1459
|
+
value: items.map((_) => _.id)
|
|
1460
|
+
}
|
|
1461
|
+
]
|
|
1462
|
+
})
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
const res = await this.load(loadParams)
|
|
1466
|
+
items = res.items
|
|
1416
1467
|
}
|
|
1468
|
+
|
|
1469
|
+
socket.emit(model, event, items)
|
|
1417
1470
|
}
|
|
1418
1471
|
|
|
1419
1472
|
|