@mixd-id/web-scaffold 0.1.230406152 → 0.1.230406154
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/components/Modal2.vue +9 -1
- package/src/components/TreeViewItem.vue +25 -15
- package/src/utils/listpage1.js +61 -46
- package/src/utils/listview.js +30 -20
package/package.json
CHANGED
|
@@ -126,7 +126,15 @@ export default{
|
|
|
126
126
|
|
|
127
127
|
computedState(to, from){
|
|
128
128
|
this.setState(to)
|
|
129
|
-
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
$route(to, from){
|
|
132
|
+
if(from.path !== to.path && !to.hash){
|
|
133
|
+
let overlay = document.querySelector('.bW9k')
|
|
134
|
+
if(overlay && overlay.classList.contains('bW9l'))
|
|
135
|
+
overlay.classList.remove('bW9l')
|
|
136
|
+
}
|
|
137
|
+
},
|
|
130
138
|
|
|
131
139
|
},
|
|
132
140
|
|
|
@@ -41,8 +41,6 @@
|
|
|
41
41
|
|
|
42
42
|
<script>
|
|
43
43
|
|
|
44
|
-
import {copyToClipboard} from "../utils/helpers.mjs";
|
|
45
|
-
|
|
46
44
|
let dragged = null
|
|
47
45
|
let guide1 = null
|
|
48
46
|
|
|
@@ -145,14 +143,6 @@ export default{
|
|
|
145
143
|
}
|
|
146
144
|
}
|
|
147
145
|
|
|
148
|
-
/*console.log('#1', {
|
|
149
|
-
startIdx,
|
|
150
|
-
targetIdx,
|
|
151
|
-
destIdx,
|
|
152
|
-
moveDirection,
|
|
153
|
-
dragArea: dragged.dragArea
|
|
154
|
-
})*/
|
|
155
|
-
|
|
156
146
|
dragged.targetParent.splice(destIdx, 0, dragged.parent.splice(startIdx, 1)[0])
|
|
157
147
|
|
|
158
148
|
this.$emit('change')
|
|
@@ -181,7 +171,6 @@ export default{
|
|
|
181
171
|
if(dragged.target !== this.item){
|
|
182
172
|
const rect = this.$refs.item.getBoundingClientRect()
|
|
183
173
|
dragged.centerY = rect.y + (rect.height / 2)
|
|
184
|
-
//console.log('#BS', dragged.centerY, this.item.name)
|
|
185
174
|
}
|
|
186
175
|
dragged.target = this.item
|
|
187
176
|
dragged.targetParent = this.parent
|
|
@@ -194,8 +183,6 @@ export default{
|
|
|
194
183
|
this.$el.insertBefore(guide1, null)
|
|
195
184
|
dragged.dragArea = 1
|
|
196
185
|
}
|
|
197
|
-
|
|
198
|
-
//console.log('centerY', dragged.dragArea, e.clientY, dragged.centerY)
|
|
199
186
|
},
|
|
200
187
|
|
|
201
188
|
hoverMouseOut(e){
|
|
@@ -215,10 +202,14 @@ export default{
|
|
|
215
202
|
|
|
216
203
|
computed: {
|
|
217
204
|
|
|
205
|
+
isSelected(){
|
|
206
|
+
return this.selectedItem === this.item
|
|
207
|
+
},
|
|
208
|
+
|
|
218
209
|
itemClass(){
|
|
219
210
|
return [
|
|
220
211
|
this.$style.item,
|
|
221
|
-
this.
|
|
212
|
+
this.isSelected ? this.$style.active : '',
|
|
222
213
|
this.state === 3 ? this.$style.active : '',
|
|
223
214
|
]
|
|
224
215
|
.filter(_=>_)
|
|
@@ -232,7 +223,26 @@ export default{
|
|
|
232
223
|
childCollapsed: false,
|
|
233
224
|
hvm: null
|
|
234
225
|
}
|
|
235
|
-
}
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
watch: {
|
|
229
|
+
|
|
230
|
+
item: {
|
|
231
|
+
handler(){
|
|
232
|
+
this.childCollapsed = false
|
|
233
|
+
},
|
|
234
|
+
deep: true
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
isSelected(to){
|
|
238
|
+
if(to){
|
|
239
|
+
this.$el.scrollIntoView({
|
|
240
|
+
behavior: 'smooth',
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
},
|
|
236
246
|
|
|
237
247
|
}
|
|
238
248
|
|
package/src/utils/listpage1.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { Op } = module.parent.require('sequelize')
|
|
2
2
|
const Sequelize = module.parent.require('sequelize')
|
|
3
|
-
const dayjs = require("dayjs")
|
|
4
|
-
const Exceljs = require("exceljs")
|
|
5
|
-
const { getPresetSortWhereParams
|
|
3
|
+
const dayjs = require("dayjs")
|
|
4
|
+
const Exceljs = require("exceljs")
|
|
5
|
+
const { getPresetSortWhereParams } = require("./helpers")
|
|
6
6
|
|
|
7
7
|
let ListPage1 = {
|
|
8
8
|
|
|
@@ -32,25 +32,25 @@ let ListPage1 = {
|
|
|
32
32
|
for(let i = 0 ; i < currentPreset.presets.length ; i++){
|
|
33
33
|
|
|
34
34
|
Object.assign({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
name: 'Default',
|
|
36
|
+
columns: [],
|
|
37
|
+
sorts: [],
|
|
38
|
+
filters: [],
|
|
39
|
+
summaries: [],
|
|
40
|
+
},
|
|
41
41
|
currentPreset.presets[i])
|
|
42
42
|
|
|
43
43
|
if(currentPreset.presets[i].summaries){
|
|
44
44
|
for(let j = 0 ; j < currentPreset.presets[i].summaries.length ; j++){
|
|
45
45
|
|
|
46
46
|
Object.assign({
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
map: {
|
|
48
|
+
mapRadius: 16,
|
|
49
|
+
mapType: "heatmap",
|
|
50
|
+
zoom: 7
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
currentPreset.presets[i].summaries[j])
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -110,6 +110,7 @@ let ListPage1 = {
|
|
|
110
110
|
async loadSummary(params){
|
|
111
111
|
|
|
112
112
|
if(!this.conn){
|
|
113
|
+
console.error('Unable to load summary, connection not found')
|
|
113
114
|
return
|
|
114
115
|
}
|
|
115
116
|
|
|
@@ -311,7 +312,7 @@ let ListPage1 = {
|
|
|
311
312
|
const sheet = workbook.addWorksheet('Export ' + this.name);
|
|
312
313
|
sheet.columns = columns
|
|
313
314
|
|
|
314
|
-
let where =
|
|
315
|
+
let where = {}
|
|
315
316
|
let replacements = []
|
|
316
317
|
let order = [
|
|
317
318
|
[ 'updatedAt', 'desc' ],
|
|
@@ -348,6 +349,14 @@ let ListPage1 = {
|
|
|
348
349
|
}
|
|
349
350
|
attributes = Object.keys(attributes)
|
|
350
351
|
|
|
352
|
+
if(preset.filters){
|
|
353
|
+
const { where:presetWhere } = this.getPresetFilterParams(preset)
|
|
354
|
+
where = {
|
|
355
|
+
...where,
|
|
356
|
+
...presetWhere
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
351
360
|
if(preset.sorts){
|
|
352
361
|
const { order:presetOrder } = this.getPresetSortParams(preset)
|
|
353
362
|
if(presetOrder){
|
|
@@ -355,25 +364,21 @@ let ListPage1 = {
|
|
|
355
364
|
}
|
|
356
365
|
}
|
|
357
366
|
|
|
358
|
-
if(preset.search
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
const { where:presetWhere } = this.getPresetFilterParams(preset)
|
|
366
|
-
where.push(presetWhere)
|
|
367
|
+
if(preset.search){
|
|
368
|
+
const tableName = this.model.name
|
|
369
|
+
where = {
|
|
370
|
+
...where,
|
|
371
|
+
[Op.and]: Sequelize.literal(`MATCH(\`${tableName}\`.tag) AGAINST (? IN BOOLEAN MODE)`)
|
|
372
|
+
}
|
|
373
|
+
replacements.push(preset.search)
|
|
367
374
|
}
|
|
368
375
|
|
|
369
376
|
if(this.downloadFilters){
|
|
370
|
-
|
|
377
|
+
await this.downloadFilters(params, where)
|
|
371
378
|
}
|
|
372
379
|
|
|
373
380
|
const rows = await this.model.findAll({
|
|
374
|
-
where
|
|
375
|
-
[Op.and]: where
|
|
376
|
-
},
|
|
381
|
+
where,
|
|
377
382
|
attributes: {
|
|
378
383
|
...attributes,
|
|
379
384
|
include: attributeIncludes
|
|
@@ -433,7 +438,7 @@ let ListPage1 = {
|
|
|
433
438
|
|
|
434
439
|
const { afterItem, itemsPerPage = this.itemsPerPage ?? 24 } = params
|
|
435
440
|
const { preset = {} } = params
|
|
436
|
-
let where =
|
|
441
|
+
let where = {}
|
|
437
442
|
let replacements = []
|
|
438
443
|
let order = [
|
|
439
444
|
[ 'updatedAt', 'desc' ],
|
|
@@ -481,8 +486,19 @@ let ListPage1 = {
|
|
|
481
486
|
}
|
|
482
487
|
attributes = Object.keys(attributes)
|
|
483
488
|
|
|
489
|
+
if(preset.filters){
|
|
490
|
+
const { where:presetWhere } = this.getPresetFilterParams(preset, includes)
|
|
491
|
+
where = {
|
|
492
|
+
...where,
|
|
493
|
+
...presetWhere
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
484
497
|
if(typeof this['loadFilters'] === 'function'){
|
|
485
|
-
where
|
|
498
|
+
where = {
|
|
499
|
+
...where,
|
|
500
|
+
...(await this['loadFilters'](params) ?? {})
|
|
501
|
+
}
|
|
486
502
|
}
|
|
487
503
|
|
|
488
504
|
if(preset.sorts){
|
|
@@ -492,27 +508,26 @@ let ListPage1 = {
|
|
|
492
508
|
}
|
|
493
509
|
}
|
|
494
510
|
|
|
495
|
-
if(preset.search
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const { where:presetWhere } = this.getPresetFilterParams(preset, includes)
|
|
503
|
-
where.push(presetWhere)
|
|
511
|
+
if(preset.search){
|
|
512
|
+
const tableName = this.model.name
|
|
513
|
+
where = {
|
|
514
|
+
...where,
|
|
515
|
+
[Op.and]: Sequelize.literal(`MATCH(\`${tableName}\`.tag) AGAINST (? IN BOOLEAN MODE)`)
|
|
516
|
+
}
|
|
517
|
+
replacements.push(preset.search)
|
|
504
518
|
}
|
|
505
519
|
|
|
506
520
|
if(afterItem){
|
|
507
521
|
const sortWhere = getPresetSortWhereParams(order, afterItem)
|
|
508
|
-
where
|
|
522
|
+
where = {
|
|
523
|
+
...where,
|
|
524
|
+
...sortWhere
|
|
525
|
+
}
|
|
509
526
|
}
|
|
510
527
|
|
|
511
528
|
let derivedSql
|
|
512
529
|
let { rows:items, count } = await this.model.findAndCountAll({
|
|
513
|
-
where
|
|
514
|
-
[Op.and]: where
|
|
515
|
-
},
|
|
530
|
+
where,
|
|
516
531
|
attributes: {
|
|
517
532
|
...attributes,
|
|
518
533
|
include: attributeIncludes
|
|
@@ -1314,7 +1329,7 @@ let ListPage1 = {
|
|
|
1314
1329
|
default:
|
|
1315
1330
|
items.forEach((item) => {
|
|
1316
1331
|
if(!('operator' in item) ||
|
|
1317
|
-
|
|
1332
|
+
([ 'startsWith', 'endsWith', 'contains', '=' ].includes(item.operator) && !'value' in item))
|
|
1318
1333
|
return
|
|
1319
1334
|
|
|
1320
1335
|
const operator = item.operator
|
package/src/utils/listview.js
CHANGED
|
@@ -146,26 +146,31 @@ let ListView = {
|
|
|
146
146
|
}
|
|
147
147
|
attributes = Object.keys(attributes)
|
|
148
148
|
|
|
149
|
-
if(preset.
|
|
150
|
-
const {
|
|
151
|
-
if(
|
|
152
|
-
|
|
149
|
+
if(preset.search && typeof this.searchFn === 'function'){
|
|
150
|
+
const { where:presetWhere, replacements:presetReplacements } = await this.searchFn(preset) ?? {}
|
|
151
|
+
if(presetWhere){
|
|
152
|
+
where.push(presetWhere)
|
|
153
|
+
replacements = replacements.concat(presetReplacements ?? [])
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
-
if(preset.search && this.matchAgainst){
|
|
157
|
-
where.push({
|
|
158
|
-
[Op.and]: Sequelize.literal(this.matchAgainst)
|
|
159
|
-
})
|
|
160
|
-
replacements.push(ftWildcard(preset.search))
|
|
161
|
-
}
|
|
162
156
|
else if(preset.filters){
|
|
163
157
|
const { where:presetWhere } = this.getPresetFilterParams(preset)
|
|
164
158
|
where.push(presetWhere)
|
|
165
159
|
}
|
|
166
160
|
|
|
167
|
-
if(this.
|
|
168
|
-
where
|
|
161
|
+
if(typeof this.filterFn === 'function'){
|
|
162
|
+
const { where:filterWhere, replacements:filterReplacements } = await this.filterFn(preset) ?? {}
|
|
163
|
+
if(filterWhere){
|
|
164
|
+
where.push(filterWhere)
|
|
165
|
+
replacements = replacements.concat(filterReplacements ?? [])
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if(preset.sorts){
|
|
170
|
+
const { order:presetOrder } = this.getPresetSortParams(preset)
|
|
171
|
+
if(presetOrder){
|
|
172
|
+
order = presetOrder
|
|
173
|
+
}
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
const rows = await this.model.findAll({
|
|
@@ -276,19 +281,24 @@ let ListView = {
|
|
|
276
281
|
}
|
|
277
282
|
attributes = Object.keys(attributes)
|
|
278
283
|
|
|
279
|
-
if(preset.search && this.
|
|
280
|
-
where.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
if(preset.search && typeof this.searchFn === 'function'){
|
|
285
|
+
const { where:presetWhere, replacements:presetReplacements } = await this.searchFn(preset) ?? {}
|
|
286
|
+
if(presetWhere){
|
|
287
|
+
where.push(presetWhere)
|
|
288
|
+
replacements = replacements.concat(presetReplacements ?? [])
|
|
289
|
+
}
|
|
284
290
|
}
|
|
285
291
|
else if(preset.filters){
|
|
286
292
|
const { where:presetWhere } = this.getPresetFilterParams(preset, includes)
|
|
287
293
|
where.push(presetWhere)
|
|
288
294
|
}
|
|
289
295
|
|
|
290
|
-
if(typeof this
|
|
291
|
-
where
|
|
296
|
+
if(typeof this.filterFn === 'function'){
|
|
297
|
+
const { where:filterWhere, replacements:filterReplacements } = await this.filterFn(preset) ?? {}
|
|
298
|
+
if(filterWhere){
|
|
299
|
+
where.push(filterWhere)
|
|
300
|
+
replacements = replacements.concat(filterReplacements ?? [])
|
|
301
|
+
}
|
|
292
302
|
}
|
|
293
303
|
|
|
294
304
|
if(preset.sorts){
|