@ditojs/admin 2.2.6 → 2.2.7-debug.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/admin",
3
- "version": "2.2.6",
3
+ "version": "2.2.7-debug.1",
4
4
  "type": "module",
5
5
  "description": "Dito.js Admin is a schema based admin interface for Dito.js Server, featuring auto-generated views and forms and built with Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/admin",
@@ -82,7 +82,7 @@
82
82
  "vite": "^4.3.1"
83
83
  },
84
84
  "types": "types",
85
- "gitHead": "f0449472c803ce29c76442f6b11f646c5bb5dd80",
85
+ "gitHead": "e79299ffdc4c7d26653f609bff4eb6d5df0ab07e",
86
86
  "scripts": {
87
87
  "build": "vite build",
88
88
  "watch": "yarn build --mode 'development' --watch",
@@ -3,7 +3,6 @@ import ResourceMixin from './ResourceMixin.js'
3
3
  import SchemaParentMixin from '../mixins/SchemaParentMixin.js'
4
4
  import { getSchemaAccessor, getStoreAccessor } from '../utils/accessor.js'
5
5
  import { getMemberResource } from '../utils/resource.js'
6
- import { replaceRoute } from '../utils/route.js'
7
6
  import {
8
7
  processRouteSchema,
9
8
  processForms,
@@ -44,6 +43,7 @@ export default {
44
43
  data() {
45
44
  return {
46
45
  wrappedPrimitives: null,
46
+ ignoreRouteChange: false,
47
47
  unwrappingPrimitives: false
48
48
  }
49
49
  },
@@ -177,9 +177,12 @@ export default {
177
177
  ...query
178
178
  }
179
179
  if (!equals(query, this.$route.query)) {
180
+ // Tell the `$route` watcher to ignore the changed triggered here:
181
+ this.ignoreRouteChange = true
182
+ this.$router.replace({ query, hash: this.$route.hash })
180
183
  // Change the route query parameters, but don't trigger a route
181
184
  // change, as that would cause the list to reload.
182
- replaceRoute({ query })
185
+ // replaceRoute({ query })
183
186
  }
184
187
  return query // Let getStoreAccessor() do the actual setting
185
188
  }
@@ -314,6 +317,10 @@ export default {
314
317
 
315
318
  watch: {
316
319
  $route(to, from) {
320
+ if (this.ignoreRouteChange) {
321
+ this.ignoreRouteChange = false
322
+ return
323
+ }
317
324
  if (from.path === to.path && from.hash === to.hash) {
318
325
  // Paths and hashes remain the same, so only queries have changed.
319
326
  // Update filter and reload data without clearing.
@@ -293,6 +293,7 @@ export default {
293
293
  },
294
294
 
295
295
  onInput() {
296
+ console.log('onInput()', this.name)
296
297
  this.markDirty()
297
298
  this.emitEvent('input')
298
299
  },
@@ -305,10 +306,14 @@ export default {
305
306
  // For some odd reason, the native change event now sometimes fires
306
307
  // twice on Vue3. Filter out second call.
307
308
  // TODO: Investigate why this happens, and if it's a bug in Vue3.
308
- if (value === this.changedValue) return
309
+ if (value === this.changedValue) {
310
+ console.log('onChange() double', this.name)
311
+ return
312
+ }
309
313
  this.changedValue = value
310
314
  }
311
315
 
316
+ console.log('onChange()', this.name, value)
312
317
  this.markDirty()
313
318
  this.emitEvent('change', {
314
319
  // Prevent endless parse recursion:
@@ -195,10 +195,17 @@ export default DitoTypeComponent.register('list', {
195
195
  },
196
196
  set query(query) {
197
197
  const component = getListComponent()
198
+ console.log('set query', !!component)
198
199
  if (component) {
199
200
  // Filter out undefined values for comparing with equals()
200
201
  const filter = obj => pickBy(obj, value => value !== undefined)
202
+ console.log(
203
+ 'set query',
204
+ JSON.stringify(filter(query)),
205
+ JSON.stringify(filter(component.query))
206
+ )
201
207
  if (!equals(filter(query), filter(component.query))) {
208
+ console.log('load data')
202
209
  component.query = query
203
210
  component.loadData(false)
204
211
  }
@@ -109,6 +109,13 @@ export function createFiltersPanel(api, filters, dataPath, proxy) {
109
109
 
110
110
  methods: {
111
111
  applyFilters() {
112
+ console.log(
113
+ 'applyFilters()',
114
+ JSON.stringify({
115
+ data: this.data,
116
+ filters: this.filters
117
+ })
118
+ )
112
119
  proxy.query = {
113
120
  ...proxy.query,
114
121
  filter: this.filters,
@@ -118,6 +125,7 @@ export function createFiltersPanel(api, filters, dataPath, proxy) {
118
125
  },
119
126
 
120
127
  clearFilters() {
128
+ console.log('clearFilters()')
121
129
  this.resetData()
122
130
  this.applyFilters()
123
131
  }