@ditojs/admin 1.24.0 → 1.26.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/admin",
3
- "version": "1.24.0",
3
+ "version": "1.26.0",
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,9 +33,9 @@
33
33
  "not ie_mob > 0"
34
34
  ],
35
35
  "dependencies": {
36
- "@ditojs/build": "^1.24.0",
37
- "@ditojs/ui": "^1.24.0",
38
- "@ditojs/utils": "^1.24.0",
36
+ "@ditojs/build": "^1.25.0",
37
+ "@ditojs/ui": "^1.26.0",
38
+ "@ditojs/utils": "^1.26.0",
39
39
  "codeflask": "^1.4.1",
40
40
  "filesize": "^10.0.6",
41
41
  "filesize-parser": "^1.5.0",
@@ -66,7 +66,7 @@
66
66
  "vite-plugin-vue2": "^2.0.3"
67
67
  },
68
68
  "types": "types",
69
- "gitHead": "0ca96ce0335509daa9ebbac278ae2d346015baad",
69
+ "gitHead": "198c9832c863003c8c8fcd147bf61a5f99a39c91",
70
70
  "scripts": {
71
71
  "build": "vite build",
72
72
  "watch": "yarn build --mode 'development' --watch",
package/src/DitoAdmin.js CHANGED
@@ -43,7 +43,7 @@ export default class DitoAdmin {
43
43
  this.api = api = merge({ base: '/' }, dito.api, api)
44
44
  this.options = options
45
45
 
46
- // Setup default api setttings:
46
+ // Setup default api settings:
47
47
  api.locale ||= 'en-US'
48
48
  api.formats = merge({}, defaultFormats, api.formats)
49
49
  api.request ||= options => request(api, options)
@@ -207,8 +207,8 @@ class RequestError extends Error {
207
207
  async function request(api, {
208
208
  url,
209
209
  method = 'get',
210
- // TODO: `request.params` was deprecated in favor of `query` on 2022-11-01,
211
- // remove once not in use anywhere anymore.
210
+ // TODO: `request.params` was deprecated in favour of `query` on 2022-11-01,
211
+ // remove once not in use anywhere any more.
212
212
  params = null,
213
213
  query = params || null,
214
214
  headers = null,
@@ -361,14 +361,14 @@ export default DitoComponent.component('dito-form', {
361
361
  const getVerb = present => this.verbs[this.getSubmitVerb(present)]
362
362
 
363
363
  // Allow buttons to override both method and resource path to submit to:
364
- const butttonResource = getResource(button.schema.resource, {
364
+ const buttonResource = getResource(button.schema.resource, {
365
365
  parent: this.resource
366
366
  })
367
- const resource = butttonResource || this.resource
367
+ const resource = buttonResource || this.resource
368
368
  const method = resource?.method || this.method
369
369
  const data = this.getPayloadData(button, method)
370
370
  let success
371
- if (!butttonResource && this.isTransient) {
371
+ if (!buttonResource && this.isTransient) {
372
372
  success = await this.submitTransient(button, resource, method, data, {
373
373
  onSuccess: () => this.emitSchemaEvent(this.getSubmitVerb()),
374
374
  onError: error => this.emitSchemaEvent('error', {
@@ -12,7 +12,7 @@
12
12
  :collapsible="collapsible"
13
13
  :class="{ 'dito-schema-compact': isCompact }"
14
14
  )
15
- // Render dito-edit-buttons for inlined shemas separately from all
15
+ // Render dito-edit-buttons for inlined schemas separately from all
16
16
  // others in `TypeList` as a scope, for better handling of layout.
17
17
  template(#edit-buttons)
18
18
  dito-edit-buttons(
@@ -329,8 +329,8 @@ export default {
329
329
  const cacheKey = loadCache && `${
330
330
  options.method || 'get'} ${
331
331
  options.url} ${
332
- // TODO: `request.params` was deprecated in favor of `query` on
333
- // 2022-11-01, remove once not in use anywhere anymore.
332
+ // TODO: `request.params` was deprecated in favour of `query` on
333
+ // 2022-11-01, remove once not in use anywhere any more.
334
334
  JSON.stringify(options.query || options.params || '')} ${
335
335
  JSON.stringify(options.data || '')
336
336
  }`
@@ -464,7 +464,7 @@ export default {
464
464
  }
465
465
  }
466
466
  // Also scan schema for `on[A-Z]`-style callbacks and add them
467
- // TODO: Deperecate one format or the other, in favour of only one way of
467
+ // TODO: Deprecate one format or the other, in favour of only one way of
468
468
  // doing things. Decide which one to remove.
469
469
  for (const [key, value] of Object.entries(this.schema)) {
470
470
  if (/^on[A-Z]/.test(key)) {
@@ -103,7 +103,7 @@ export default {
103
103
  }
104
104
  const hadLabel = !!text
105
105
  text ||= ''
106
- // If no label was found so far, try to produce one from theindex.
106
+ // If no label was found so far, try to produce one from the index.
107
107
  if (!text) {
108
108
  // Always use extended style when auto-generating labels from index/id:
109
109
  extended = true
@@ -12,14 +12,14 @@
12
12
  .dito-code
13
13
  @extend %input
14
14
  position: relative
15
- // For propper sizing of content along with :style="style" setting above,
15
+ // For proper sizing of content along with :style="style" setting above,
16
16
  // for proper line-height calculation.
17
17
  padding: $input-padding
18
18
  &.dito-width-fill
19
19
  width: auto
20
20
  .codeflask
21
21
  background: none
22
- // Ignore theparent padding defined above which is only needed to set
22
+ // Ignore the parent padding defined above which is only needed to set
23
23
  // the desired height with :style="style".
24
24
  top: 0
25
25
  left: 0
@@ -79,7 +79,7 @@ export default TypeComponent.register([
79
79
  },
80
80
 
81
81
  treeDataPath() {
82
- // Remove `name` from `dataPath`, as it is addeed
82
+ // Remove `name` from `dataPath`, as it is added
83
83
  // to `treeData` and `treeSchema`
84
84
  return this.isListSource
85
85
  ? this.dataPath.slice(0, this.dataPath.length - this.name.length)
@@ -6,7 +6,7 @@ import { nanoid } from 'nanoid'
6
6
 
7
7
  // SchemaGraph is a class to collect schema graph meta information in order to
8
8
  // process sources and relations for the given targets 'server' and 'clipboard',
9
- // acccording to the following table:
9
+ // according to the following table:
10
10
  //
11
11
  // | --------------------------------------------| --------- | --------- |
12
12
  // | data | server | clipboard |
@@ -121,7 +121,7 @@ export class SchemaGraph {
121
121
  const revValue = clipboard
122
122
  ? `@${id}`
123
123
  // Keep the ids unique in reference groups, since they reference
124
- // accross the full graph.
124
+ // across the full graph.
125
125
  : reference
126
126
  ? `${reference}-${id}`
127
127
  : id // A temporary id without a related, just preserve it.
@@ -4,7 +4,8 @@ import { getUid } from './uid.js'
4
4
  import { SchemaGraph } from './SchemaGraph.js'
5
5
  import { appendDataPath, isTemporaryId } from './data.js'
6
6
  import {
7
- isObject, isString, isArray, isFunction, isPromise, clone, camelize, isModule
7
+ isObject, isString, isArray, isFunction, isPromise, clone, camelize, isModule,
8
+ mapConcurrently
8
9
  } from '@ditojs/utils'
9
10
 
10
11
  const typeComponents = {}
@@ -130,19 +131,25 @@ export async function resolveSchemas(
130
131
  if (isArray(schemas)) {
131
132
  // Translate an array of dynamic import, each importing one named schema
132
133
  // module to an object with named entries.
133
- schemas = Object.fromEntries(await Promise.all(schemas.map(
134
- async item => {
135
- const schema = await resolveItem(item, true)
136
- return [schema.name, schema]
137
- }
138
- )))
134
+ schemas = Object.fromEntries(
135
+ await mapConcurrently(
136
+ schemas,
137
+ async item => {
138
+ const schema = await resolveItem(item, true)
139
+ return [schema.name, schema]
140
+ }
141
+ )
142
+ )
139
143
  } else if (isObject(schemas)) {
140
- schemas = Object.fromEntries(await Promise.all(Object.entries(schemas).map(
141
- async ([key, item]) => {
142
- const schema = await resolveItem(item, true)
143
- return [key, schema]
144
- }
145
- )))
144
+ schemas = Object.fromEntries(
145
+ await mapConcurrently(
146
+ Object.entries(schemas),
147
+ async ([key, item]) => {
148
+ const schema = await resolveItem(item, true)
149
+ return [key, schema]
150
+ }
151
+ )
152
+ )
146
153
  }
147
154
  return schemas
148
155
  }