@ditojs/admin 2.4.2 → 2.4.3

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.4.2",
3
+ "version": "2.4.3",
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",
@@ -83,7 +83,7 @@
83
83
  "vite": "^4.3.1"
84
84
  },
85
85
  "types": "types",
86
- "gitHead": "3041bd1b47272ac99276fbeca8152cbfb1d75b77",
86
+ "gitHead": "fa8525e80d6cce3844fb8c62d665c60761a564b1",
87
87
  "scripts": {
88
88
  "build": "vite build",
89
89
  "watch": "yarn build --mode 'development' --watch",
@@ -189,6 +189,9 @@ const TYPES = {
189
189
 
190
190
  img {
191
191
  display: block;
192
+ // SVG images need 100% settings to scale into the container.
193
+ width: 100%;
194
+ height: 100%;
192
195
  min-width: var(--min-size);
193
196
  min-height: var(--min-size);
194
197
  max-width: var(--max-size);
@@ -192,17 +192,37 @@ export default {
192
192
  return value
193
193
  },
194
194
 
195
+ removeStore(key) {
196
+ delete this.store[key]
197
+ },
198
+
199
+ getStoreKeyByIndex(index) {
200
+ return this.store.$keysByIndex?.[index]
201
+ },
202
+
203
+ setStoreKeyByIndex(index, key) {
204
+ this.store.$keysByIndex ??= {}
205
+ this.store.$keysByIndex[index] = key
206
+ },
207
+
195
208
  getChildStore(key, index) {
196
- // When storing, temporary ids change to permanent ones and thus the key
197
- // can change, so we need to store the index as well, to be able to find
198
- // the store again after the item was saved.
199
- const store = (
200
- this.getStore(key) ||
201
- index != null && this.getStore(index) ||
202
- this.setStore(key, reactive({}))
203
- )
204
- if (index != null) {
205
- this.setStore(index, store)
209
+ let store = this.getStore(key)
210
+ if (!store && index != null) {
211
+ // When storing, temporary ids change to permanent ones and thus the key
212
+ // can change. To still find the store, we reference by index as well,
213
+ // to be able to find the store again after the item was saved.
214
+ const oldKey = this.getStoreKeyByIndex(index)
215
+ store = this.getStore(oldKey)
216
+ if (store) {
217
+ this.setStore(key, store)
218
+ this.removeStore(oldKey)
219
+ }
220
+ }
221
+ if (!store) {
222
+ store = this.setStore(key, reactive({}))
223
+ if (index != null) {
224
+ this.setStoreKeyByIndex(index, key)
225
+ }
206
226
  }
207
227
  return store
208
228
  },