druxt-entity 0.24.1 → 0.25.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.
|
@@ -135,7 +135,7 @@ export default {
|
|
|
135
135
|
*
|
|
136
136
|
* @return {object}
|
|
137
137
|
*/
|
|
138
|
-
fields: ({ errors, isEmpty, model, schema, schemaType }) => {
|
|
138
|
+
fields: ({ errors, isEmpty, lang, model, schema, schemaType }) => {
|
|
139
139
|
if (!schema) return false
|
|
140
140
|
|
|
141
141
|
const fields = {}
|
|
@@ -152,6 +152,7 @@ export default {
|
|
|
152
152
|
// @todo - Remove deprecated 'data'.
|
|
153
153
|
data: value,
|
|
154
154
|
errors: (errors || []).filter((o) => ((o.source || {}).pointer || '').startsWith(`/data/attributes/${field.id}`)),
|
|
155
|
+
langcode: lang,
|
|
155
156
|
relationship,
|
|
156
157
|
schema: {
|
|
157
158
|
config: schema.config,
|
|
@@ -315,7 +316,12 @@ export default {
|
|
|
315
316
|
|
|
316
317
|
if (this.uuid && !this.value) {
|
|
317
318
|
const query = this.getQuery(settings)
|
|
318
|
-
const resource = await this.getResource({
|
|
319
|
+
const resource = await this.getResource({
|
|
320
|
+
id: this.uuid,
|
|
321
|
+
prefix: this.lang,
|
|
322
|
+
type: this.type,
|
|
323
|
+
query
|
|
324
|
+
})
|
|
319
325
|
const entity = { ...(resource.data || {}) }
|
|
320
326
|
entity.included = resource.included
|
|
321
327
|
this.model = JSON.parse(JSON.stringify(entity || {}))
|
|
@@ -409,23 +415,37 @@ export default {
|
|
|
409
415
|
*
|
|
410
416
|
* @example @lang js
|
|
411
417
|
* [
|
|
418
|
+
* 'DruxtEntity[ResourceType][DisplayMode][SchemaType][Langcode]',
|
|
412
419
|
* 'DruxtEntity[ResourceType][DisplayMode][SchemaType]',
|
|
420
|
+
* 'DruxtEntity[EntityType][DisplayMode][SchemaType][Langcode]',
|
|
413
421
|
* 'DruxtEntity[EntityType][DisplayMode][SchemaType]',
|
|
422
|
+
* 'DruxtEntity[ResourceType][DisplayMode][Langcode]',
|
|
414
423
|
* 'DruxtEntity[ResourceType][DisplayMode]',
|
|
424
|
+
* 'DruxtEntity[EntityType][DisplayMode][Langcode]',
|
|
415
425
|
* 'DruxtEntity[EntityType][DisplayMode]',
|
|
426
|
+
* 'DruxtEntity[ResourceType][Langcode]',
|
|
416
427
|
* 'DruxtEntity[ResourceType]',
|
|
428
|
+
* 'DruxtEntity[EntityType][Langcode]',
|
|
417
429
|
* 'DruxtEntity[EntityType]',
|
|
430
|
+
* 'DruxtEntity[DisplayMode][Langcode]',
|
|
418
431
|
* 'DruxtEntity[DisplayMode]',
|
|
419
432
|
* ]
|
|
420
433
|
*
|
|
421
434
|
* @example <caption>Article Node (default)</caption> @lang js
|
|
422
435
|
* [
|
|
436
|
+
* 'DruxtEntityNodeArticleDefaultViewEn',
|
|
423
437
|
* 'DruxtEntityNodeArticleDefaultView',
|
|
438
|
+
* 'DruxtEntityNodeDefaultViewEn',
|
|
424
439
|
* 'DruxtEntityNodeDefaultView',
|
|
440
|
+
* 'DruxtEntityNodeArticleDefaultEn',
|
|
425
441
|
* 'DruxtEntityNodeArticleDefault',
|
|
442
|
+
* 'DruxtEntityNodeDefaultEn',
|
|
426
443
|
* 'DruxtEntityNodeDefault',
|
|
444
|
+
* 'DruxtEntityNodeArticleEn',
|
|
427
445
|
* 'DruxtEntityNodeArticle',
|
|
446
|
+
* 'DruxtEntityNodeEn',
|
|
428
447
|
* 'DruxtEntityNode',
|
|
448
|
+
* 'DruxtEntityDefaultEn',
|
|
429
449
|
* 'DruxtEntityDefault',
|
|
430
450
|
* ]
|
|
431
451
|
*/
|
|
@@ -282,7 +282,11 @@ export default {
|
|
|
282
282
|
if (this.isFile && schemaType === 'view') {
|
|
283
283
|
return h('DruxtEntity', {
|
|
284
284
|
attrs,
|
|
285
|
-
props: {
|
|
285
|
+
props: {
|
|
286
|
+
langcode: this.lang,
|
|
287
|
+
type: item.type,
|
|
288
|
+
uuid: item.id
|
|
289
|
+
},
|
|
286
290
|
scopedSlots: { default: ({ entity }) => h('a', {
|
|
287
291
|
domProps: {
|
|
288
292
|
href: (entity.attributes.uri || {}).url,
|
|
@@ -296,7 +300,11 @@ export default {
|
|
|
296
300
|
if (this.isImage && schemaType === 'view') {
|
|
297
301
|
return h('DruxtEntity', {
|
|
298
302
|
attrs,
|
|
299
|
-
props: {
|
|
303
|
+
props: {
|
|
304
|
+
langcode: this.lang,
|
|
305
|
+
type: item.type,
|
|
306
|
+
uuid: item.id
|
|
307
|
+
},
|
|
300
308
|
scopedSlots: { default: ({ entity }) => h('img', {
|
|
301
309
|
domProps: {
|
|
302
310
|
src: (entity.attributes.uri || {}).url
|
|
@@ -335,6 +343,7 @@ export default {
|
|
|
335
343
|
return h('DruxtEntity', {
|
|
336
344
|
attrs,
|
|
337
345
|
props: {
|
|
346
|
+
langcode: this.lang,
|
|
338
347
|
mode: this.schema.settings.display.view_mode || 'default',
|
|
339
348
|
type: item.type,
|
|
340
349
|
uuid: item.id,
|
|
@@ -347,6 +356,7 @@ export default {
|
|
|
347
356
|
return h('details', [h('DruxtEntityForm', {
|
|
348
357
|
attrs,
|
|
349
358
|
props: {
|
|
359
|
+
langcode: this.lang,
|
|
350
360
|
mode: this.schema.settings.display.view_mode || 'default',
|
|
351
361
|
type: item.type,
|
|
352
362
|
uuid: item.id,
|
|
@@ -434,21 +444,33 @@ export default {
|
|
|
434
444
|
*
|
|
435
445
|
* @example @lang js
|
|
436
446
|
* [
|
|
447
|
+
* 'DruxtField[Type][Id][SchemaType][Langcode]',
|
|
437
448
|
* 'DruxtField[Type][Id][SchemaType]',
|
|
449
|
+
* 'DruxtField[Type][Id][Langcode]',
|
|
438
450
|
* 'DruxtField[Type][Id]',
|
|
451
|
+
* 'DruxtField[Type][SchemaType][Langcode]',
|
|
439
452
|
* 'DruxtField[Type][SchemaType]',
|
|
453
|
+
* 'DruxtField[Default][SchemaType][Langcode]',
|
|
440
454
|
* 'DruxtField[Default][SchemaType]',
|
|
455
|
+
* 'DruxtField[Type][Langcode]',
|
|
441
456
|
* 'DruxtField[Type]',
|
|
457
|
+
* 'DruxtField[Default][Langcode]',
|
|
442
458
|
* 'DruxtField[Default]',
|
|
443
459
|
* ]
|
|
444
460
|
*
|
|
445
461
|
* @example <caption>Media field</caption> @lang js
|
|
446
462
|
* [
|
|
463
|
+
* 'DruxtFieldEntityReferenceEntityViewFieldMediaImageViewEn',
|
|
447
464
|
* 'DruxtFieldEntityReferenceEntityViewFieldMediaImageView',
|
|
465
|
+
* 'DruxtFieldEntityReferenceEntityViewFieldMediaImageEn',
|
|
448
466
|
* 'DruxtFieldEntityReferenceEntityViewFieldMediaImage',
|
|
467
|
+
* 'DruxtFieldEntityReferenceEntityViewViewEn',
|
|
449
468
|
* 'DruxtFieldEntityReferenceEntityViewView',
|
|
469
|
+
* 'DruxtFieldDefaultViewEn',
|
|
450
470
|
* 'DruxtFieldDefaultView',
|
|
471
|
+
* 'DruxtFieldEntityReferenceEntityViewEn',
|
|
451
472
|
* 'DruxtFieldEntityReferenceEntityView',
|
|
473
|
+
* 'DruxtFieldDefaultEn',
|
|
452
474
|
* 'DruxtFieldDefault',
|
|
453
475
|
* ]
|
|
454
476
|
*/
|
package/dist/druxt-entity.esm.js
CHANGED
|
@@ -68,7 +68,7 @@ async function DruxtEntityStorybook({ stories }) {
|
|
|
68
68
|
}));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const DruxtEntityNuxtModule = function(moduleOptions = {}) {
|
|
71
|
+
const DruxtEntityNuxtModule = async function(moduleOptions = {}) {
|
|
72
72
|
const options = {
|
|
73
73
|
baseUrl: moduleOptions.baseUrl,
|
|
74
74
|
...(this.options || {}).druxt || {},
|
|
@@ -83,8 +83,8 @@ const DruxtEntityNuxtModule = function(moduleOptions = {}) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
this.addModule(["druxt", options]);
|
|
87
|
-
this.addModule(["druxt-schema", { baseUrl: options.baseUrl }]);
|
|
86
|
+
await this.addModule(["druxt", options]);
|
|
87
|
+
await this.addModule(["druxt-schema", { baseUrl: options.baseUrl }]);
|
|
88
88
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
89
89
|
dirs.push({
|
|
90
90
|
path: join(__dirname, "components"),
|
|
@@ -180,6 +180,10 @@ const DruxtEntityMixin = {
|
|
|
180
180
|
type: Object,
|
|
181
181
|
required: true
|
|
182
182
|
},
|
|
183
|
+
langcode: {
|
|
184
|
+
type: String,
|
|
185
|
+
default: void 0
|
|
186
|
+
},
|
|
183
187
|
schema: {
|
|
184
188
|
type: Object,
|
|
185
189
|
required: true
|
|
@@ -213,6 +217,10 @@ const DruxtFieldMixin = {
|
|
|
213
217
|
type: Array,
|
|
214
218
|
default: () => []
|
|
215
219
|
},
|
|
220
|
+
langcode: {
|
|
221
|
+
type: String,
|
|
222
|
+
default: void 0
|
|
223
|
+
},
|
|
216
224
|
inner: {
|
|
217
225
|
type: Object,
|
|
218
226
|
default: () => ({
|
|
@@ -272,5 +280,4 @@ const DruxtFieldMixin = {
|
|
|
272
280
|
}
|
|
273
281
|
};
|
|
274
282
|
|
|
275
|
-
export default
|
|
276
|
-
export { DruxtEntityComponentSuggestionMixin, DruxtEntityContextMixin, DruxtEntityMixin, DruxtFieldMixin };
|
|
283
|
+
export { DruxtEntityComponentSuggestionMixin, DruxtEntityContextMixin, DruxtEntityMixin, DruxtFieldMixin, DruxtEntityNuxtModule as default };
|
package/dist/druxt-entity.ssr.js
CHANGED
|
@@ -72,7 +72,7 @@ async function DruxtEntityStorybook({ stories }) {
|
|
|
72
72
|
}));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const DruxtEntityNuxtModule = function(moduleOptions = {}) {
|
|
75
|
+
const DruxtEntityNuxtModule = async function(moduleOptions = {}) {
|
|
76
76
|
const options = {
|
|
77
77
|
baseUrl: moduleOptions.baseUrl,
|
|
78
78
|
...(this.options || {}).druxt || {},
|
|
@@ -87,8 +87,8 @@ const DruxtEntityNuxtModule = function(moduleOptions = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
this.addModule(["druxt", options]);
|
|
91
|
-
this.addModule(["druxt-schema", { baseUrl: options.baseUrl }]);
|
|
90
|
+
await this.addModule(["druxt", options]);
|
|
91
|
+
await this.addModule(["druxt-schema", { baseUrl: options.baseUrl }]);
|
|
92
92
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
93
93
|
dirs.push({
|
|
94
94
|
path: path.join(__dirname, "components"),
|
|
@@ -184,6 +184,10 @@ const DruxtEntityMixin = {
|
|
|
184
184
|
type: Object,
|
|
185
185
|
required: true
|
|
186
186
|
},
|
|
187
|
+
langcode: {
|
|
188
|
+
type: String,
|
|
189
|
+
default: void 0
|
|
190
|
+
},
|
|
187
191
|
schema: {
|
|
188
192
|
type: Object,
|
|
189
193
|
required: true
|
|
@@ -217,6 +221,10 @@ const DruxtFieldMixin = {
|
|
|
217
221
|
type: Array,
|
|
218
222
|
default: () => []
|
|
219
223
|
},
|
|
224
|
+
langcode: {
|
|
225
|
+
type: String,
|
|
226
|
+
default: void 0
|
|
227
|
+
},
|
|
220
228
|
inner: {
|
|
221
229
|
type: Object,
|
|
222
230
|
default: () => ({
|
|
@@ -280,4 +288,4 @@ exports.DruxtEntityComponentSuggestionMixin = DruxtEntityComponentSuggestionMixi
|
|
|
280
288
|
exports.DruxtEntityContextMixin = DruxtEntityContextMixin;
|
|
281
289
|
exports.DruxtEntityMixin = DruxtEntityMixin;
|
|
282
290
|
exports.DruxtFieldMixin = DruxtFieldMixin;
|
|
283
|
-
exports
|
|
291
|
+
exports["default"] = DruxtEntityNuxtModule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-entity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Drupal Display Mode powered Entity, Form and Field Druxt components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"deepmerge": "^4.2.2",
|
|
48
|
-
"drupal-jsonapi-params": "^
|
|
49
|
-
"druxt": "^0.
|
|
50
|
-
"druxt-router": "^0.
|
|
51
|
-
"druxt-schema": "^0.10.
|
|
48
|
+
"drupal-jsonapi-params": "^2.0.0",
|
|
49
|
+
"druxt": "^0.19.0",
|
|
50
|
+
"druxt-router": "^0.27.0",
|
|
51
|
+
"druxt-schema": "^0.10.4"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|