@mixd-id/web-scaffold 0.1.240411036 → 0.1.240411039

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
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.240411036",
4
+ "version": "0.1.240411039",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -185,7 +185,6 @@ export default {
185
185
  bottom = window.innerHeight - rect.top + 8
186
186
  transformOrigin = 'bottom'
187
187
  maxHeight = Math.round(rect.top - 16)
188
- console.log('maxHeight', maxHeight)
189
188
  this.transition = 'slideup'
190
189
  }
191
190
  break
@@ -200,9 +199,6 @@ export default {
200
199
  minWidth: `${caller.clientWidth}px`,
201
200
  transformOrigin: transformOrigin
202
201
  }
203
-
204
- if(import.meta.env.DEV)
205
- console.log('ContextMenu open', this.computedStyle)
206
202
  }
207
203
 
208
204
  this.isOpen = true
@@ -282,15 +282,18 @@ export default{
282
282
  inject: [ 'socket', 'toast' ],
283
283
 
284
284
  props: {
285
- config: {
286
- type: Object,
287
- default: { columns:[], presets:[{}] }
288
- },
285
+ config: Object,
286
+ defaultConfig: Function,
289
287
  presetKey: String,
290
288
  subscribeKey: String,
291
289
  controller: String,
292
- src: undefined,
293
290
  title: String,
291
+ updateInterval: {
292
+ type: Number,
293
+ default: 1200
294
+ },
295
+
296
+ src: undefined,
294
297
  view: {
295
298
  type: String,
296
299
  validator(value) {
@@ -319,14 +322,7 @@ export default{
319
322
  type: [ String, Boolean ],
320
323
  default: true
321
324
  },
322
-
323
325
  sorts: [ Array, Function ],
324
-
325
- updateInterval: {
326
- type: Number,
327
- default: 1200
328
- },
329
-
330
326
  itemsFn: Function,
331
327
  onSignalFn: Function,
332
328
  },
@@ -424,7 +420,7 @@ export default{
424
420
  return new Promise(resolve => resolve())
425
421
  },
426
422
 
427
- loadPreset(){
423
+ async loadPreset(){
428
424
  if(!Object.keys(this.$route.query).map(_ => _.toLowerCase()).includes('reset')){
429
425
  if(this.presetKey){
430
426
  return this.socket.send(this.presetSrc, { key:this.presetKey })
@@ -440,6 +436,9 @@ export default{
440
436
  return new Promise(resolve => resolve())
441
437
  }
442
438
  else{
439
+ const defaultConfig = setupConfig(await this.defaultConfig())
440
+ Object.assign(this.cConfig, defaultConfig)
441
+
443
442
  return new Promise((resolve) => {
444
443
  const query = {}
445
444
  for(let key in this.$route.query){
@@ -944,7 +943,7 @@ export default{
944
943
  },
945
944
 
946
945
  cConfig(){
947
- return setupConfig(this.config)
946
+ return setupConfig(this.config ?? this._config)
948
947
  },
949
948
 
950
949
  contentSlots(){
@@ -1086,6 +1085,10 @@ export default{
1086
1085
  extItems: null,
1087
1086
  lastEnumItems: null,
1088
1087
  queue: null,
1088
+ _config: {
1089
+ columns:[],
1090
+ presets:[]
1091
+ }
1089
1092
  }
1090
1093
  },
1091
1094
 
@@ -1097,7 +1100,7 @@ export default{
1097
1100
 
1098
1101
  watch: {
1099
1102
 
1100
- config: {
1103
+ cConfig: {
1101
1104
  deep: true,
1102
1105
  handler(){
1103
1106
  this.savePreset()
@@ -1379,6 +1379,9 @@ const presetToSequelizeList = async(preset, {
1379
1379
  searchWhere = searchOpt.where
1380
1380
  searchReplacements = searchOpt.replacements
1381
1381
  }
1382
+ else{
1383
+ console.warn('### Preset search does not have any searchable columns defined, search will not work.')
1384
+ }
1382
1385
  }
1383
1386
  }
1384
1387
 
@@ -59,6 +59,20 @@ const pickColumns = function(columns, keys){
59
59
 
60
60
  const setupConfig = (config) => {
61
61
 
62
+ if(config.domains && !Array.isArray(config.presets)){
63
+ let defaultConfig
64
+ for(let key in config.domains){
65
+ if(location.host.indexOf(key) >= 0){
66
+ defaultConfig = config.domains[key]
67
+ break
68
+ }
69
+ }
70
+ if(!defaultConfig)
71
+ defaultConfig = config.domains['default'] ?? {}
72
+
73
+ Object.assign(config, JSON.parse(JSON.stringify(defaultConfig)))
74
+ }
75
+
62
76
  if(Array.isArray(config.presets)){
63
77
  for(let idx in config.presets){
64
78
  if(!Array.isArray(config.presets[idx].columns)){