@ditojs/admin 1.20.1 → 1.22.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.20.1",
3
+ "version": "1.22.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",
@@ -39,14 +39,14 @@
39
39
  "not ie_mob > 0"
40
40
  ],
41
41
  "dependencies": {
42
- "@ditojs/build": "^1.20.0",
43
- "@ditojs/ui": "^1.20.0",
44
- "@ditojs/utils": "^1.20.0",
42
+ "@ditojs/build": "^1.22.0",
43
+ "@ditojs/ui": "^1.22.0",
44
+ "@ditojs/utils": "^1.22.0",
45
45
  "codeflask": "^1.4.1",
46
- "filesize": "^10.0.5",
46
+ "filesize": "^10.0.6",
47
47
  "filesize-parser": "^1.5.0",
48
48
  "nanoid": "^4.0.0",
49
- "tinycolor2": "^1.4.2",
49
+ "tinycolor2": "^1.5.2",
50
50
  "tiptap": "^1.32.2",
51
51
  "tiptap-commands": "^1.17.1",
52
52
  "tiptap-extensions": "^1.35.2",
@@ -54,7 +54,7 @@
54
54
  "vue": "^2.7.14",
55
55
  "vue-color": "^2.8.1",
56
56
  "vue-js-modal": "^2.0.1",
57
- "vue-multiselect": "^2.1.6",
57
+ "vue-multiselect": "^2.1.7",
58
58
  "vue-notification": "^1.3.20",
59
59
  "vue-router": "^3.6.5",
60
60
  "vue-spinner": "^1.0.4",
@@ -65,12 +65,12 @@
65
65
  "devDependencies": {
66
66
  "@ditojs/build": "^1.19.0",
67
67
  "pug": "^3.0.2",
68
- "sass": "1.56.1",
69
- "type-fest": "^3.3.0",
70
- "typescript": "^4.9.3",
71
- "vite": "^3.2.5",
72
- "vite-plugin-vue2": "^2.0.2"
68
+ "sass": "1.57.1",
69
+ "type-fest": "^3.5.3",
70
+ "typescript": "^4.9.4",
71
+ "vite": "^4.0.4",
72
+ "vite-plugin-vue2": "^2.0.3"
73
73
  },
74
74
  "types": "types",
75
- "gitHead": "66013b5bf5ba7c216f950f39f311f56851de2821"
75
+ "gitHead": "e1693edb8bf18e074606a842f2f2bacc1d2856cb"
76
76
  }
package/src/DitoAdmin.js CHANGED
@@ -288,10 +288,11 @@ function onBeforeViteUpdate(event) {
288
288
  // Why the stored `deps` are missing this part of the URL, I cannot say…
289
289
  const updates = []
290
290
  for (const update of event.updates) {
291
- updates.push(update, {
292
- ...update,
293
- acceptedPath: update.acceptedPath.replace(/\?v=[0-9a-f]+&/, '?')
294
- })
291
+ updates.push(update) // Keep the original update.
292
+ const acceptedPath = update.acceptedPath.replace(/\?v=[0-9a-f]+&/i, '?')
293
+ if (acceptedPath !== update.acceptedPath) {
294
+ updates.push({ ...update, acceptedPath })
295
+ }
295
296
  }
296
297
  event.updates = updates
297
298
  }
@@ -245,19 +245,11 @@ export default {
245
245
  const { response } = error
246
246
  if (!callback(error, response)) {
247
247
  const data = response?.data
248
- if (data && isString(data.type)) {
249
- this.notify({
250
- type: 'error',
251
- title: labelize(data.type),
252
- text: data.message || error
253
- })
254
- } else {
255
- this.notify({
256
- type: 'error',
257
- title: 'Request Error',
258
- text: error
259
- })
260
- }
248
+ const title = isString(data?.type)
249
+ ? labelize(data.type)
250
+ : 'Error'
251
+ const text = data?.message ?? error
252
+ this.notify({ type: 'error', title, text })
261
253
  }
262
254
  }
263
255
  this.setLoading(false, loadingOptions)
package/types/index.d.ts CHANGED
@@ -35,8 +35,8 @@ export type RequestMethod = <T>({
35
35
  method: HTTPVerb
36
36
  data: any
37
37
  /** @deprecated use query instead */
38
- params: ConstructorParameters<typeof URLSearchParams>[0]
39
- query: ConstructorParameters<typeof URLSearchParams>[0]
38
+ params: Record<string, string | string[]> | [string, string][]
39
+ query: Record<string, string | string[]> | [string, string][]
40
40
  headers: Record<string, string>
41
41
  }) => Promise<RequestMethodResponse<T>>
42
42
 
@@ -1035,11 +1035,14 @@ export type DitoContext<$Item = any> = {
1035
1035
  cache?: 'local' | 'global'
1036
1036
  url: string
1037
1037
  /**
1038
- * @defaultValue `'get'`
1038
+ * @default 'get'
1039
1039
  */
1040
1040
  method?: HTTPVerb
1041
- params?: any
1041
+ /** @deprecated use query instead */
1042
+ params?: Record<string, string | string[]> | [string, string][]
1043
+ query?: Record<string, string | string[]> | [string, string][]
1042
1044
  data?: any
1045
+ resource?: Resource
1043
1046
  }): Promise<T>
1044
1047
  format: typeof utilsFormat
1045
1048
  navigate(location: string | { path: string }): Promise<boolean>
@@ -1056,31 +1059,16 @@ export type DitoContext<$Item = any> = {
1056
1059
  }
1057
1060
 
1058
1061
  export type View<$Item = any> = {
1062
+ type: 'view',
1059
1063
  resource?: Form['resource']
1060
1064
  clipboard?: Form['clipboard']
1061
- } & (
1062
- | InputSchema<$Item>
1063
- | RadioSchema<$Item>
1064
- | CheckboxSchema<$Item>
1065
- | CheckboxesSchema<$Item>
1066
- | ColorSchema<$Item>
1067
- | SelectSchema<$Item>
1068
- | MultiselectSchema<$Item>
1069
- | ListSchema<$Item>
1070
- | TextareaSchema<$Item>
1071
- | CodeSchema<$Item>
1072
- | NumberSchema<$Item>
1073
- | SliderSchema<$Item>
1074
- | UploadSchema<$Item>
1075
- | MarkupSchema<$Item>
1076
- | ButtonSchema<$Item>
1077
- | SwitchSchema<$Item>
1078
- | DateSchema<$Item>
1079
- | ComponentSchema<$Item>
1080
- | LabelSchema<$Item>
1081
- | SectionSchema<$Item>
1082
- | HiddenSchema<$Item>
1083
- )
1065
+ component?: Component<$Item>
1066
+ } | {
1067
+ type: 'view',
1068
+ resource?: Form['resource']
1069
+ clipboard?: Form['clipboard']
1070
+ components?: Components<$Item>
1071
+ }
1084
1072
 
1085
1073
  export type Component<$Item = any> =
1086
1074
  | InputSchema<$Item>
@@ -1105,7 +1093,7 @@ export type Component<$Item = any> =
1105
1093
  | SectionSchema<$Item>
1106
1094
  | HiddenSchema<$Item>
1107
1095
 
1108
- export type Components<$Item = any> = {
1096
+ export type Components<$Item = any> = Component<$Item>[] | {
1109
1097
  [$name: string]: Component<$Item>
1110
1098
  }
1111
1099
 
@@ -1115,6 +1103,8 @@ export type Buttons<$Item> = Record<
1115
1103
  >
1116
1104
 
1117
1105
  export type Form<$Item = any> = {
1106
+ type: 'form'
1107
+
1118
1108
  /**
1119
1109
  * The name of the item model produced by the form.
1120
1110
  */
@@ -1133,9 +1123,9 @@ export type Form<$Item = any> = {
1133
1123
  */
1134
1124
  tabs?: Record<
1135
1125
  string,
1136
- Omit<Form<$Item>, 'tabs'> & {
1126
+ Omit<Form<$Item>, 'tabs' | 'type'> & {
1137
1127
  defaultTab?: OrItemAccessor<$Item, {}, boolean>
1138
- }
1128
+ }
1139
1129
  >
1140
1130
  // TODO: document components
1141
1131
  components?: Components<$Item>