druxt-entity 0.21.2 → 0.23.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.
|
@@ -120,7 +120,7 @@ export default {
|
|
|
120
120
|
if (!schema) return false
|
|
121
121
|
|
|
122
122
|
const fields = {}
|
|
123
|
-
for (const field of schema.fields) {
|
|
123
|
+
for (const field of schema.fields || []) {
|
|
124
124
|
const relationship = !!((field.settings || {}).storage || {}).target_type || !!(model.relationships || {})[field.id]
|
|
125
125
|
const value = relationship ? ((model || {}).relationships || {})[field.id] : ((model || {}).attributes || {})[field.id]
|
|
126
126
|
|
|
@@ -249,8 +249,24 @@ export default {
|
|
|
249
249
|
* @returns {ComponentOptions}
|
|
250
250
|
*/
|
|
251
251
|
componentOptions: ({ mode, schema, schemaType, type }) => ([
|
|
252
|
-
[
|
|
253
|
-
[
|
|
252
|
+
// DruxtEntity[ResourceType][ViewMode][SchemaType]
|
|
253
|
+
[
|
|
254
|
+
(schema || {}).resourceType || type,
|
|
255
|
+
((schema || {}).config || {}).mode || mode,
|
|
256
|
+
((schema || {}).config || {}).schemaType || schemaType || 'view'
|
|
257
|
+
],
|
|
258
|
+
|
|
259
|
+
// DruxtEntity[EntityType][ViewMode][SchemaType]
|
|
260
|
+
[
|
|
261
|
+
((schema || {}).resourceType || type).split('--').shift(),
|
|
262
|
+
((schema || {}).config || {}).mode || mode,
|
|
263
|
+
((schema || {}).config || {}).schemaType || schemaType || 'view'
|
|
264
|
+
],
|
|
265
|
+
|
|
266
|
+
// DruxtEntity[ViewMode]
|
|
267
|
+
[
|
|
268
|
+
((schema || {}).config || {}).mode || mode,
|
|
269
|
+
],
|
|
254
270
|
]),
|
|
255
271
|
|
|
256
272
|
/**
|
|
@@ -369,17 +385,23 @@ export default {
|
|
|
369
385
|
* @example @lang js
|
|
370
386
|
* [
|
|
371
387
|
* 'DruxtEntity[ResourceType][DisplayMode][SchemaType]',
|
|
388
|
+
* 'DruxtEntity[EntityType][DisplayMode][SchemaType]',
|
|
372
389
|
* 'DruxtEntity[ResourceType][DisplayMode]',
|
|
390
|
+
* 'DruxtEntity[EntityType][DisplayMode]',
|
|
373
391
|
* 'DruxtEntity[ResourceType]',
|
|
392
|
+
* 'DruxtEntity[EntityType]',
|
|
374
393
|
* 'DruxtEntity[DisplayMode]',
|
|
375
394
|
* ]
|
|
376
395
|
*
|
|
377
396
|
* @example <caption>Article Node (default)</caption> @lang js
|
|
378
397
|
* [
|
|
379
398
|
* 'DruxtEntityNodeArticleDefaultView',
|
|
399
|
+
* 'DruxtEntityNodeDefaultView',
|
|
380
400
|
* 'DruxtEntityNodeArticleDefault',
|
|
381
|
-
* 'DruxtEntityNodeArticle',
|
|
382
401
|
* 'DruxtEntityNodeDefault',
|
|
402
|
+
* 'DruxtEntityNodeArticle',
|
|
403
|
+
* 'DruxtEntityNode',
|
|
404
|
+
* 'DruxtEntityDefault',
|
|
383
405
|
* ]
|
|
384
406
|
*/
|
|
385
407
|
|
|
@@ -92,16 +92,15 @@ export default {
|
|
|
92
92
|
if (this.model.id) {
|
|
93
93
|
method = 'updateResource'
|
|
94
94
|
}
|
|
95
|
-
this.response = await this.$druxt[method](this.model)
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
try {
|
|
97
|
+
this.response = await this.$druxt[method](this.model)
|
|
99
98
|
const resource = this.response.data.data
|
|
100
99
|
// Update the Vuex store.
|
|
101
100
|
this.$store.commit('druxt/addResource', { resource })
|
|
102
101
|
this.$emit('submit', resource)
|
|
103
|
-
}
|
|
104
|
-
|
|
102
|
+
} catch (err) {
|
|
103
|
+
this.response = err.response.data
|
|
105
104
|
this.$emit('error', this.response)
|
|
106
105
|
}
|
|
107
106
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-entity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Drupal Display Mode powered Entity, Form and Field Druxt components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"deepmerge": "^4.2.2",
|
|
48
48
|
"drupal-jsonapi-params": "^1.2.2",
|
|
49
|
-
"druxt": "^0.
|
|
50
|
-
"druxt-router": "^0.
|
|
51
|
-
"druxt-schema": "^0.
|
|
49
|
+
"druxt": "^0.16.0",
|
|
50
|
+
"druxt-router": "^0.25.0",
|
|
51
|
+
"druxt-schema": "^0.10.0"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
package/CHANGELOG.md
DELETED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
# druxt-entity
|
|
2
|
-
|
|
3
|
-
## 0.21.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [9161b38]
|
|
8
|
-
- druxt-router@0.24.0
|
|
9
|
-
|
|
10
|
-
## 0.21.1
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- 6ade3a2: Fixed Vuex mutation error
|
|
15
|
-
|
|
16
|
-
## 0.21.0
|
|
17
|
-
|
|
18
|
-
### Minor Changes
|
|
19
|
-
|
|
20
|
-
- 025315a: Added **include** option and the ability to filter related resources.
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
export default {
|
|
24
|
-
druxt: {
|
|
25
|
-
query: {
|
|
26
|
-
include: ["field_media_image", "field_media_image.field_media_image"],
|
|
27
|
-
fields: [
|
|
28
|
-
["file--file", ["uri"]],
|
|
29
|
-
["media--image", []]
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
- 025315a: Added **settings** property to the DruxtEntity and DruxtEntityForm components.
|
|
37
|
-
|
|
38
|
-
```vue
|
|
39
|
-
<template>
|
|
40
|
-
<DruxtEntity
|
|
41
|
-
:settings="{ query: { include: ['uid'] } }"
|
|
42
|
-
type="node--page"
|
|
43
|
-
:uuid="uuid"
|
|
44
|
-
/>
|
|
45
|
-
</template>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
- e7b1533: Refactored DruxtModule fetch hooks
|
|
49
|
-
|
|
50
|
-
### Patch Changes
|
|
51
|
-
|
|
52
|
-
- Updated dependencies [77ab204]
|
|
53
|
-
- druxt-schema@0.9.0
|
|
54
|
-
- druxt@0.13.0
|
|
55
|
-
- druxt-router@0.23.0
|
|
56
|
-
|
|
57
|
-
## 0.20.0
|
|
58
|
-
|
|
59
|
-
### Minor Changes
|
|
60
|
-
|
|
61
|
-
- 897dcbc: Updated DruxtEntityForm to use new DruxtClient methods
|
|
62
|
-
|
|
63
|
-
### Patch Changes
|
|
64
|
-
|
|
65
|
-
- Updated dependencies [4504a2f]
|
|
66
|
-
- druxt@0.12.0
|
|
67
|
-
- druxt-router@0.22.0
|
|
68
|
-
- druxt-schema@0.8.1
|
|
69
|
-
|
|
70
|
-
## 0.19.0
|
|
71
|
-
|
|
72
|
-
### Minor Changes
|
|
73
|
-
|
|
74
|
-
- dae345e: Added module level options
|
|
75
|
-
- 8d28c18: Updated storybook integration
|
|
76
|
-
- dae345e: Moved `$druxtEntity` plugin settings to `$druxt.settings.entity`
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- Updated dependencies [9d905e8]
|
|
81
|
-
- druxt-router@0.21.0
|
|
82
|
-
- druxt-schema@0.8.0
|
|
83
|
-
- druxt@0.11.0
|
|
84
|
-
|
|
85
|
-
## 0.18.0
|
|
86
|
-
|
|
87
|
-
### Minor Changes
|
|
88
|
-
|
|
89
|
-
- 715e5ef: Updated component registration method to use the Nuxt `components:dirs` hook
|
|
90
|
-
- 2b8c3f3: Updated to use DruxtDebug component
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- 49454cb: Fixed path to components in Storybook
|
|
95
|
-
- Updated dependencies [1ab762c]
|
|
96
|
-
- druxt-router@0.20.0
|
|
97
|
-
- druxt@0.10.0
|
|
98
|
-
- druxt-schema@0.7.10
|
|
99
|
-
|
|
100
|
-
## 0.17.1
|
|
101
|
-
|
|
102
|
-
### Patch Changes
|
|
103
|
-
|
|
104
|
-
- c4616df: Fixed dependencies
|
|
105
|
-
- Updated dependencies [c4616df]
|
|
106
|
-
- druxt-router@0.19.1
|
|
107
|
-
- druxt-schema@0.7.9
|
|
108
|
-
|
|
109
|
-
## 0.17.0
|
|
110
|
-
|
|
111
|
-
### Minor Changes
|
|
112
|
-
|
|
113
|
-
- 21170fb: Moved Vue components out of bundle
|
|
114
|
-
|
|
115
|
-
⚠ Potential breaking change
|
|
116
|
-
|
|
117
|
-
_**Note:** This only effects custom Druxt modules and implementations._
|
|
118
|
-
|
|
119
|
-
```diff
|
|
120
|
-
-import { DruxtEntity } from 'druxt-entity'
|
|
121
|
-
+import DruxtEntity from 'druxt-entity/dist/components/DruxtEntity.vue'
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Patch Changes
|
|
125
|
-
|
|
126
|
-
- Updated dependencies [21170fb]
|
|
127
|
-
- druxt@0.9.0
|
|
128
|
-
- druxt-router@0.19.0
|
|
129
|
-
- druxt-schema@0.7.8
|
|
130
|
-
|
|
131
|
-
## 0.16.0
|
|
132
|
-
|
|
133
|
-
### Minor Changes
|
|
134
|
-
|
|
135
|
-
- Added support for default template injection
|
|
136
|
-
|
|
137
|
-
- For details, see the [Druxt 0.8.0 release notes](/api/packages/druxt/CHANGELOG#080)
|
|
138
|
-
|
|
139
|
-
- Added support for schema-less entities
|
|
140
|
-
- Added improved defaults to the DruxtField component
|
|
141
|
-
- Deprecated DruxtField default field components
|
|
142
|
-
|
|
143
|
-
The components can be tree shaken with the following setting in `nuxt.config.js`:
|
|
144
|
-
|
|
145
|
-
```js
|
|
146
|
-
module.exports = {
|
|
147
|
-
druxt: {
|
|
148
|
-
entity: {
|
|
149
|
-
components: {
|
|
150
|
-
fields: false
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## 0.15.0
|
|
158
|
-
|
|
159
|
-
### Minor Changes
|
|
160
|
-
|
|
161
|
-
- Fixed issue with EntityReferenceLabel component
|
|
162
|
-
- Added watch to update DeruxtEntity data on props change
|
|
163
|
-
- Updated components v-model support
|
|
164
|
-
- Updated Storybook integration
|
|
165
|
-
- Updated dependencies
|
|
166
|
-
|
|
167
|
-
## 0.14.2
|
|
168
|
-
|
|
169
|
-
### Patch Changes
|
|
170
|
-
|
|
171
|
-
- Updated fetchKey
|
|
172
|
-
|
|
173
|
-
## 0.14.1
|
|
174
|
-
|
|
175
|
-
### Patch Changes
|
|
176
|
-
|
|
177
|
-
- Added custom fetchKey to fix hydration issues
|
|
178
|
-
|
|
179
|
-
## 0.14.0
|
|
180
|
-
|
|
181
|
-
### Minor Changes
|
|
182
|
-
|
|
183
|
-
- Added v-model support for DruxtEntity/DruxtEntityForm components
|
|
184
|
-
|
|
185
|
-
```vue
|
|
186
|
-
<template>
|
|
187
|
-
<DruxtEntity v-model="entity" />
|
|
188
|
-
<DruxtEntityForm v-model="entity" />
|
|
189
|
-
</template>
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## 0.13.0
|
|
193
|
-
|
|
194
|
-
### Minor Changes
|
|
195
|
-
|
|
196
|
-
- Added DruxtEntityForm component
|
|
197
|
-
|
|
198
|
-
```vue
|
|
199
|
-
<DruxtEntityForm type="node--page" @submit="onSubmit" @error="onError" />
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
- For more details, refer to the [DruxtEntityForm API documentation](/api/packages/entity/components/DruxtEntityForm)
|
|
203
|
-
|
|
204
|
-
## 0.12.0
|
|
205
|
-
|
|
206
|
-
### Minor Changes
|
|
207
|
-
|
|
208
|
-
- Added ability to filter JSON:API fields
|
|
209
|
-
- Updated Storybook integration
|
|
210
|
-
|
|
211
|
-
## 0.11.2
|
|
212
|
-
|
|
213
|
-
### Patch Changes
|
|
214
|
-
|
|
215
|
-
- Fixed issue with Storybook intergration
|
|
216
|
-
- Updated Storybook integration
|
|
217
|
-
|
|
218
|
-
## 0.11.1
|
|
219
|
-
|
|
220
|
-
### Patch Changes
|
|
221
|
-
|
|
222
|
-
- Fixed issue with Storybook intergration
|
|
223
|
-
|
|
224
|
-
## 0.11.0
|
|
225
|
-
|
|
226
|
-
### Minor Changes
|
|
227
|
-
|
|
228
|
-
- Added DruxtEntity Storybook integration
|
|
229
|
-
- Updated dependencies
|
|
230
|
-
|
|
231
|
-
## 0.10.1
|
|
232
|
-
|
|
233
|
-
### Patch Changes
|
|
234
|
-
|
|
235
|
-
- Added TextSummaryOrTrimmed field
|
|
236
|
-
- Added TextTrimmed field
|
|
237
|
-
- Updated dependencies
|
|
238
|
-
|
|
239
|
-
## 0.10.0
|
|
240
|
-
|
|
241
|
-
### Minor Changes
|
|
242
|
-
|
|
243
|
-
- Refactored module to use DruxtClient/DruxtStore
|
|
244
|
-
|
|
245
|
-
## 0.9.0
|
|
246
|
-
|
|
247
|
-
### Minor Changes
|
|
248
|
-
|
|
249
|
-
- Added support for Entity reference view mode
|
|
250
|
-
- Add ability to passthrough \$attrs
|
|
251
|
-
|
|
252
|
-
## 0.8.1
|
|
253
|
-
|
|
254
|
-
### Patch Changes
|
|
255
|
-
|
|
256
|
-
- Updated dependencies
|
|
257
|
-
|
|
258
|
-
## 0.8.0
|
|
259
|
-
|
|
260
|
-
### Minor Changes
|
|
261
|
-
|
|
262
|
-
- Added DruxtRouter Entity component
|
|
263
|
-
- Updated dependencies
|
|
264
|
-
|
|
265
|
-
## 0.7.2
|
|
266
|
-
|
|
267
|
-
### Patch Changes
|
|
268
|
-
|
|
269
|
-
- Updated dependencies
|
|
270
|
-
|
|
271
|
-
## 0.7.1
|
|
272
|
-
|
|
273
|
-
### Patch Changes
|
|
274
|
-
|
|
275
|
-
- Updated DruxtEntity for DruxtComponentMixin
|
|
276
|
-
- Updatd Field component mixins
|
|
277
|
-
- Updated dependencies
|
|
278
|
-
|
|
279
|
-
## 0.7.0
|
|
280
|
-
|
|
281
|
-
### Minor Changes
|
|
282
|
-
|
|
283
|
-
- Updated DruxtEntity for DruxtComponentMixin
|
|
284
|
-
|
|
285
|
-
## 0.6.3
|
|
286
|
-
|
|
287
|
-
### Patch Changes
|
|
288
|
-
|
|
289
|
-
- Fixed issue with images and HMR
|
|
290
|
-
|
|
291
|
-
## 0.6.2
|
|
292
|
-
|
|
293
|
-
### Patch Changes
|
|
294
|
-
|
|
295
|
-
- Fixed issue with `internal:` links
|
|
296
|
-
- Updated dependencies
|
|
297
|
-
|
|
298
|
-
## 0.6.1
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
|
-
|
|
302
|
-
- Updated dependencies
|
|
303
|
-
|
|
304
|
-
## 0.6.0
|
|
305
|
-
|
|
306
|
-
### Minor Changes
|
|
307
|
-
|
|
308
|
-
- Refactored to use Nuxt fetch hook
|
|
309
|
-
|
|
310
|
-
## 0.5.2
|
|
311
|
-
|
|
312
|
-
### Patch Changes
|
|
313
|
-
|
|
314
|
-
- Updated documentation
|
|
315
|
-
|
|
316
|
-
## 0.5.1
|
|
317
|
-
|
|
318
|
-
### Patch Changes
|
|
319
|
-
|
|
320
|
-
- Added support for UUIDs in component suggestions
|
|
321
|
-
|
|
322
|
-
## 0.5.0
|
|
323
|
-
|
|
324
|
-
### Minor Changes
|
|
325
|
-
|
|
326
|
-
- Added isEmpty method
|
|
327
|
-
- Added FileDefault and Image fields
|
|
328
|
-
- Added mode to EntityReferenceEntityView field
|
|
329
|
-
- Added component suggestion system
|
|
330
|
-
- Added context mixin
|
|
331
|
-
|
|
332
|
-
## 0.4.0
|
|
333
|
-
|
|
334
|
-
### Minor Changes
|
|
335
|
-
|
|
336
|
-
- Update Field and label system
|
|
337
|
-
- Updated Entity suggestions
|
|
338
|
-
|
|
339
|
-
## 0.3.1
|
|
340
|
-
|
|
341
|
-
### Patch Changes
|
|
342
|
-
|
|
343
|
-
- Added named slots for fields
|
|
344
|
-
|
|
345
|
-
## 0.3.0
|
|
346
|
-
|
|
347
|
-
### Minor Changes
|
|
348
|
-
|
|
349
|
-
- Added view mode suggestions
|
|
350
|
-
- Added field id suggestions
|
|
351
|
-
|
|
352
|
-
## 0.2.2
|
|
353
|
-
|
|
354
|
-
### Patch Changes
|
|
355
|
-
|
|
356
|
-
- Fixed issues with EntityReferenceLabel field
|
|
357
|
-
- Updated NuberInteger field
|
|
358
|
-
|
|
359
|
-
## 0.2.1
|
|
360
|
-
|
|
361
|
-
### Patch Changes
|
|
362
|
-
|
|
363
|
-
- Added BasicString field
|
|
364
|
-
- Added Timestamp field
|
|
365
|
-
- Fixed issue with ReferenceLabel field
|
|
366
|
-
- Fixed empty field filter
|
|
367
|
-
|
|
368
|
-
## 0.2.0
|
|
369
|
-
|
|
370
|
-
### Minor Changes
|
|
371
|
-
|
|
372
|
-
- Added better multivalue field support
|
|
373
|
-
- Added ResponsiveImage field
|
|
374
|
-
- Added EntityReferenceEntityView field
|
|
375
|
-
- Added NumberInteger field
|
|
376
|
-
- Added EntityReferenceRevisionsEntityView field
|
|
377
|
-
- Added ListDefault field
|
|
378
|
-
- Added Link field
|
|
379
|
-
- Added DatetimeDefault field
|
|
380
|
-
- Updated dependencies
|
|
381
|
-
|
|
382
|
-
## 0.1.0
|
|
383
|
-
|
|
384
|
-
### Initial release
|