@ditojs/admin 2.11.0 → 2.11.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.11.0",
3
+ "version": "2.11.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",
@@ -33,8 +33,8 @@
33
33
  "not ie_mob > 0"
34
34
  ],
35
35
  "dependencies": {
36
- "@ditojs/ui": "^2.11.0",
37
- "@ditojs/utils": "^2.11.0",
36
+ "@ditojs/ui": "^2.11.1",
37
+ "@ditojs/utils": "^2.11.1",
38
38
  "@kyvg/vue3-notification": "^2.9.1",
39
39
  "@lk77/vue3-color": "^3.0.6",
40
40
  "@tiptap/core": "^2.0.4",
@@ -60,7 +60,7 @@
60
60
  "@tiptap/vue-3": "^2.0.4",
61
61
  "@vueuse/integrations": "^10.2.1",
62
62
  "codeflask": "^1.4.1",
63
- "filesize": "^10.0.7",
63
+ "filesize": "^10.0.8",
64
64
  "filesize-parser": "^1.5.0",
65
65
  "focus-trap": "^7.5.2",
66
66
  "nanoid": "^4.0.2",
@@ -83,7 +83,7 @@
83
83
  "vite": "^4.4.7"
84
84
  },
85
85
  "types": "types",
86
- "gitHead": "1589dbd472f04ec8a540e8b39bd7de8e2907872a",
86
+ "gitHead": "fb1e7ce180f5c9ce8e058a7ef22465e0428cd758",
87
87
  "scripts": {
88
88
  "build": "vite build",
89
89
  "watch": "yarn build --mode 'development' --watch",
package/src/DitoAdmin.js CHANGED
@@ -251,7 +251,8 @@ async function request(api, {
251
251
  params = null,
252
252
  query = params || null,
253
253
  headers = null,
254
- data = null
254
+ data = null,
255
+ signal = null
255
256
  }) {
256
257
  if (params) {
257
258
  deprecate(
@@ -271,7 +272,8 @@ async function request(api, {
271
272
  credentials:
272
273
  isApiUrl && api.cors?.credentials
273
274
  ? 'include'
274
- : 'same-origin'
275
+ : 'same-origin',
276
+ signal
275
277
  })
276
278
 
277
279
  if (response.headers.get('Content-Type')?.includes('application/json')) {
@@ -240,6 +240,8 @@ export default DitoComponent.component('DitoPane', {
240
240
  $self: &;
241
241
  $root-padding: $content-padding - $form-spacing-half;
242
242
 
243
+ --pane-padding: 0px;
244
+
243
245
  display: flex;
244
246
  position: relative;
245
247
  flex-flow: row wrap;
@@ -247,6 +249,7 @@ export default DitoComponent.component('DitoPane', {
247
249
  align-content: flex-start;
248
250
  // Remove the padding added by `.dito-container` inside `.dito-pane`:
249
251
  margin: -$form-spacing-half;
252
+ padding: var(--pane-padding);
250
253
  // Use `flex: 0%` for all `.dito-pane` except `.dito-pane__main`,
251
254
  // so that the `.dito-buttons-main` can be moved all the way to the bottom.
252
255
  flex: 0%;
@@ -260,10 +263,10 @@ export default DitoComponent.component('DitoPane', {
260
263
  margin: 0;
261
264
  // Move the negative margin used to remove the padding added by
262
265
  // `.dito-container` inside `.dito-pane` to the padding:
263
- padding: $root-padding;
266
+ --pane-padding: #{$root-padding};
264
267
 
265
268
  &#{$self}--single {
266
- padding: $content-padding;
269
+ --pane-padding: #{$content-padding};
267
270
  }
268
271
 
269
272
  &:has(> .dito-container--label-vertical:first-of-type) {
@@ -293,11 +296,11 @@ export default DitoComponent.component('DitoPane', {
293
296
  }
294
297
 
295
298
  &--padding-inlined {
296
- padding: 0;
299
+ --pane-padding: 0px;
297
300
  }
298
301
 
299
302
  &--padding-nested {
300
- padding: $form-spacing;
303
+ --pane-padding: #{$form-spacing};
301
304
 
302
305
  &:has(> .dito-container--label-vertical:first-of-type) {
303
306
  // Reduce top spacing when the first row has labels.
@@ -502,7 +502,9 @@ function addRoutes(router, routes) {
502
502
  .dito-drag-leave-active {
503
503
  $duration: 0.15s;
504
504
 
505
- transition: opacity $duration, backdrop-filter $duration;
505
+ transition:
506
+ opacity $duration,
507
+ backdrop-filter $duration;
506
508
 
507
509
  ~ * .dito-drop-target {
508
510
  transition: filter $duration;
@@ -321,14 +321,28 @@ export default {
321
321
  return url ? this.api.getApiUrl({ url, query: resource.query }) : null
322
322
  },
323
323
 
324
- async sendRequest({ method, url, resource, query, data, internal }) {
324
+ async sendRequest({
325
+ method,
326
+ url,
327
+ resource,
328
+ query,
329
+ data,
330
+ signal,
331
+ internal
332
+ }) {
325
333
  url ||= this.getResourceUrl(resource)
326
334
  method ||= resource?.method
327
335
  const checkUser = !internal && this.api.isApiUrl(url)
328
336
  if (checkUser) {
329
337
  await this.rootComponent.ensureUser()
330
338
  }
331
- const response = await this.api.request({ method, url, data, query })
339
+ const response = await this.api.request({
340
+ method,
341
+ url,
342
+ query,
343
+ data,
344
+ signal
345
+ })
332
346
  // Detect change of the own user, and fetch it again if it was changed.
333
347
  if (
334
348
  checkUser &&
@@ -20,7 +20,8 @@ export default {
20
20
 
21
21
  data() {
22
22
  return {
23
- loadedData: null
23
+ loadedData: null,
24
+ abortController: null
24
25
  }
25
26
  },
26
27
 
@@ -239,8 +240,12 @@ export default {
239
240
  updateRoot: true, // Display spinner in header when loading in resources
240
241
  updateView: this.isInView // Notify view of loading for view components
241
242
  }
243
+ this.abortController?.abort()
244
+ const controller = new AbortController()
245
+ this.abortController = controller
246
+ const { signal } = controller
247
+ const request = { method, resource, query, data, signal }
242
248
  this.setLoading(true, loadingOptions)
243
- const request = { method, resource, data, query }
244
249
  try {
245
250
  const response = await this.sendRequest(request)
246
251
  // Pass both request and response to the callback, so they can be
@@ -258,7 +263,10 @@ export default {
258
263
  this.notify({ type: 'error', title, text })
259
264
  }
260
265
  }
261
- this.setLoading(false, loadingOptions)
266
+ if (this.abortController === controller) {
267
+ this.abortController = null
268
+ this.setLoading(false, loadingOptions)
269
+ }
262
270
  },
263
271
 
264
272
  getPayloadData(button, method) {
@@ -142,11 +142,15 @@
142
142
  position: sticky;
143
143
  bottom: 0;
144
144
  z-index: $z-index-main-buttons;
145
- margin-bottom: -$content-padding;
145
+ background: $content-color-background;
146
146
  margin-top: 2 * $content-padding;
147
+ margin-bottom: calc(-1 * var(--pane-padding, 0px));
147
148
  box-shadow: 0 (-$content-padding) $content-padding (-$content-padding)
148
149
  $color-shadow;
149
- background: $content-color-background;
150
+
151
+ &:empty {
152
+ display: none;
153
+ }
150
154
  }
151
155
 
152
156
  &.dito-buttons-round,