@ditojs/admin 2.6.9 → 2.7.0

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.
@@ -241,8 +241,9 @@ export default {
241
241
  // @overridable
242
242
  async scrollIntoView() {
243
243
  await this.focusSchema()
244
- const { element = this } = this.$refs
245
- ;(element.$el || element).scrollIntoView?.({
244
+ let { element = this } = this.$refs
245
+ element = element.scrollIntoView ? element : element.$el
246
+ element.scrollIntoView?.({
246
247
  behavior: 'smooth',
247
248
  block: 'center'
248
249
  })
@@ -252,14 +253,14 @@ export default {
252
253
  focusElement() {
253
254
  let { element = this } = this.$refs
254
255
  element = element.focus ? element : element.$el
255
- element?.focus?.()
256
+ element.focus?.()
256
257
  },
257
258
 
258
259
  // @overridable
259
260
  blurElement() {
260
261
  let { element = this } = this.$refs
261
262
  element = element.blur ? element : element.$el
262
- element?.blur?.()
263
+ element.blur?.()
263
264
  },
264
265
 
265
266
  async focusSchema() {
@@ -39,7 +39,7 @@
39
39
  DitoDraggable(
40
40
  tag="tbody"
41
41
  :modelValue="updateOrder(sourceSchema, listData, paginationRange)"
42
- :options="getSortableOptions(false)"
42
+ :options="getSortableOptions()"
43
43
  :draggable="draggable"
44
44
  @update:modelValue="value => (listData = value)"
45
45
  )
@@ -78,7 +78,7 @@
78
78
  :dataPath="getDataPath(index)"
79
79
  :data="item"
80
80
  :meta="nestedMeta"
81
- :store="getChildStore(getItemUid(schema, item), index)"
81
+ :store="getItemStore(schema, item, index)"
82
82
  :disabled="disabled || isLoading"
83
83
  :collapsed="collapsed"
84
84
  :collapsible="collapsible"
@@ -115,7 +115,7 @@
115
115
  :dataPath="getDataPath(index)"
116
116
  :data="item"
117
117
  :meta="nestedMeta"
118
- :store="getChildStore(getItemUid(schema, item), index)"
118
+ :store="getItemStore(schema, item, index)"
119
119
  @delete="deleteItem(item, index)"
120
120
  )
121
121
  //- Render create buttons inside table when not in a single component view:
@@ -161,6 +161,7 @@ import {
161
161
  import { createFiltersPanel } from '../utils/filter.js'
162
162
  import { appendDataPath } from '../utils/data.js'
163
163
  import { pickBy, equals, hyphenate } from '@ditojs/utils'
164
+ import { computed } from 'vue'
164
165
 
165
166
  // @vue/component
166
167
  export default DitoTypeComponent.register('list', {
@@ -171,28 +172,22 @@ export default DitoTypeComponent.register('list', {
171
172
  return type
172
173
  },
173
174
 
174
- getPanelSchema(api, schema, dataPath, schemaComponent) {
175
+ getPanelSchema(api, schema, dataPath, component) {
175
176
  const { filters } = schema
176
177
  // See if this list component wants to display a filter panel, and if so,
177
178
  // create the panel schema for it through `getFiltersPanel()`.
178
179
  if (filters) {
179
- // At the time of the creation of the panel schema, the schemaComponent is
180
- // not filled yet, so we can't get the target component (dataPath) right
181
- // away. Use a proxy and a getter instead, to get around this:
182
- const getListComponent = () =>
183
- schemaComponent.getComponentByDataPath(
184
- dataPath,
185
- component => component.type === 'list'
186
- )
180
+ return createFiltersPanel(
181
+ api,
182
+ filters,
183
+ dataPath,
184
+ // Pass a computed value to get / set the query, see getFiltersPanel()
185
+ computed({
186
+ get() {
187
+ return component.query
188
+ },
187
189
 
188
- return createFiltersPanel(api, filters, dataPath, {
189
- // Create a simple proxy to get / set the query, see getFiltersPanel()
190
- get query() {
191
- return getListComponent()?.query
192
- },
193
- set query(query) {
194
- const component = getListComponent()
195
- if (component) {
190
+ set(query) {
196
191
  // Filter out undefined values for comparing with equals()
197
192
  const filter = obj => pickBy(obj, value => value !== undefined)
198
193
  if (!equals(filter(query), filter(component.query))) {
@@ -200,8 +195,8 @@ export default DitoTypeComponent.register('list', {
200
195
  component.loadData(false)
201
196
  }
202
197
  }
203
- }
204
- })
198
+ })
199
+ )
205
200
  }
206
201
  },
207
202
 
@@ -35,7 +35,7 @@
35
35
  DitoDraggable(
36
36
  v-model="files"
37
37
  tag="tbody"
38
- :options="getSortableOptions(false)"
38
+ :options="getSortableOptions()"
39
39
  :draggable="draggable"
40
40
  )
41
41
  template(
@@ -43,7 +43,7 @@
43
43
  )
44
44
  tr(
45
45
  v-for="(file, index) in files"
46
- :key="file.key"
46
+ :key="file.name"
47
47
  )
48
48
  td(
49
49
  v-if="render"
@@ -63,7 +63,7 @@ export const filterComponents = {
63
63
  }
64
64
  }
65
65
 
66
- export function createFiltersPanel(api, filters, dataPath, proxy) {
66
+ export function createFiltersPanel(api, filters, dataPath, query) {
67
67
  const { sticky, ...filterSchemas } = filters
68
68
  const panel = {
69
69
  type: 'panel',
@@ -80,7 +80,7 @@ export function createFiltersPanel(api, filters, dataPath, proxy) {
80
80
  data() {
81
81
  return parseFiltersData(
82
82
  panel,
83
- proxy.query
83
+ query.value
84
84
  )
85
85
  },
86
86
 
@@ -106,8 +106,8 @@ export function createFiltersPanel(api, filters, dataPath, proxy) {
106
106
 
107
107
  methods: {
108
108
  applyFilters() {
109
- proxy.query = {
110
- ...proxy.query,
109
+ query.value = {
110
+ ...query.value,
111
111
  filter: this.filters,
112
112
  // Clear pagination when applying or clearing filters:
113
113
  page: undefined
@@ -1030,14 +1030,14 @@ export function getAllPanelEntries(
1030
1030
  api,
1031
1031
  schema,
1032
1032
  dataPath = null,
1033
- schemaComponent = null,
1033
+ component = null,
1034
1034
  tabComponent = null
1035
1035
  ) {
1036
1036
  const panelSchema = getTypeOptions(schema)?.getPanelSchema?.(
1037
1037
  api,
1038
1038
  schema,
1039
1039
  dataPath,
1040
- schemaComponent
1040
+ component
1041
1041
  )
1042
1042
  const panelEntries = panelSchema
1043
1043
  ? [getPanelEntry(panelSchema, dataPath, tabComponent)]
@@ -1,9 +0,0 @@
1
- const loggedDeprecations = new Set()
2
-
3
- export function deprecate(message) {
4
- // Only log deprecation messages once.
5
- if (!loggedDeprecations.has(message)) {
6
- loggedDeprecations.add(message)
7
- console.warn(message)
8
- }
9
- }