druxt-entity 0.25.0 → 0.26.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/dist/components/DruxtEntity.vue +10 -1
- package/dist/components/DruxtField.vue +12 -0
- package/dist/druxt-entity.esm.js +1 -1
- package/dist/druxt-entity.ssr.js +1 -1
- package/package.json +4 -4
- package/templates/druxt-entity-form.instance.stories.js +3 -1
- package/templates/druxt-entity-form.stories.js +6 -2
- package/templates/druxt-entity.instance.stories.js +3 -1
- package/templates/druxt-entity.stories.js +12 -2
|
@@ -171,6 +171,10 @@ export default {
|
|
|
171
171
|
this.$fetch()
|
|
172
172
|
},
|
|
173
173
|
|
|
174
|
+
settings() {
|
|
175
|
+
this.$fetch()
|
|
176
|
+
},
|
|
177
|
+
|
|
174
178
|
schemaType() {
|
|
175
179
|
this.$fetch()
|
|
176
180
|
},
|
|
@@ -392,7 +396,12 @@ export default {
|
|
|
392
396
|
on: {
|
|
393
397
|
input: (value) => {
|
|
394
398
|
const type = !field.relationship ? 'attributes' : 'relationships'
|
|
395
|
-
|
|
399
|
+
if (value) {
|
|
400
|
+
this.model[type][id] = value
|
|
401
|
+
}
|
|
402
|
+
else if (this.model[type][id]) {
|
|
403
|
+
delete this.model[type][id]
|
|
404
|
+
}
|
|
396
405
|
this.$emit('input', this.model)
|
|
397
406
|
}
|
|
398
407
|
},
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import DruxtModule from 'druxt/dist/components/DruxtModule.vue'
|
|
4
4
|
|
|
5
|
+
// Extract the DruxtModule model watch.
|
|
6
|
+
const modelWatch = DruxtModule.watch.model
|
|
7
|
+
delete DruxtModule.watch.model
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* Renders a Drupal Field using Drupals by field type and formatter settings.
|
|
7
11
|
*
|
|
@@ -166,6 +170,14 @@ export default {
|
|
|
166
170
|
this.component.props.errors = this.errors
|
|
167
171
|
this.component.propsData.errors = this.errors
|
|
168
172
|
},
|
|
173
|
+
|
|
174
|
+
model() {
|
|
175
|
+
// Sanitize empty string based fields.
|
|
176
|
+
if (this.model === '') { this.model = undefined }
|
|
177
|
+
|
|
178
|
+
// Invoke the DruxtModule model watch callback.
|
|
179
|
+
modelWatch.call(this)
|
|
180
|
+
},
|
|
169
181
|
},
|
|
170
182
|
|
|
171
183
|
/** DruxtModule settings */
|
package/dist/druxt-entity.esm.js
CHANGED
|
@@ -21,7 +21,7 @@ async function DruxtEntityStorybook({ stories }) {
|
|
|
21
21
|
try {
|
|
22
22
|
return {
|
|
23
23
|
resourceType: `${entity}--${bundle}`,
|
|
24
|
-
entities: (await druxt.getCollection(`${entity}--${bundle}`, new DrupalJsonApiParams().addFields(`${entity}--${bundle}`, ["id", "title", "name", "info"]))).data.map((o) => ({
|
|
24
|
+
entities: (await druxt.getCollection(`${entity}--${bundle}`, new DrupalJsonApiParams().addFilter("status", 1).addFields(`${entity}--${bundle}`, ["id", "title", "name", "info"]))).data.map((o) => ({
|
|
25
25
|
id: o.id,
|
|
26
26
|
title: (o.attributes || {}).title || (o.attributes || {}).name || (o.attributes || {}).info || o.id
|
|
27
27
|
}))
|
package/dist/druxt-entity.ssr.js
CHANGED
|
@@ -25,7 +25,7 @@ async function DruxtEntityStorybook({ stories }) {
|
|
|
25
25
|
try {
|
|
26
26
|
return {
|
|
27
27
|
resourceType: `${entity}--${bundle}`,
|
|
28
|
-
entities: (await druxt$1.getCollection(`${entity}--${bundle}`, new drupalJsonapiParams.DrupalJsonApiParams().addFields(`${entity}--${bundle}`, ["id", "title", "name", "info"]))).data.map((o) => ({
|
|
28
|
+
entities: (await druxt$1.getCollection(`${entity}--${bundle}`, new drupalJsonapiParams.DrupalJsonApiParams().addFilter("status", 1).addFields(`${entity}--${bundle}`, ["id", "title", "name", "info"]))).data.map((o) => ({
|
|
29
29
|
id: o.id,
|
|
30
30
|
title: (o.attributes || {}).title || (o.attributes || {}).name || (o.attributes || {}).info || o.id
|
|
31
31
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt-entity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
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": "^2.0.0",
|
|
49
|
-
"druxt": "^0.
|
|
50
|
-
"druxt-router": "^0.
|
|
51
|
-
"druxt-schema": "^0.
|
|
49
|
+
"druxt": "^0.20.0",
|
|
50
|
+
"druxt-router": "^0.28.0",
|
|
51
|
+
"druxt-schema": "^0.11.0"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
@@ -76,7 +76,9 @@ export const <%= mode.charAt(0).toUpperCase() + mode.slice(1) %> = Template.bind
|
|
|
76
76
|
}
|
|
77
77
|
<%= mode.charAt(0).toUpperCase() + mode.slice(1) %>.parameters = {
|
|
78
78
|
docs: {
|
|
79
|
-
|
|
79
|
+
description: {
|
|
80
|
+
story: 'Render the content entity form using the **<%= mode %>** display mode.',
|
|
81
|
+
},
|
|
80
82
|
source: {
|
|
81
83
|
code: '<DruxtEntityForm\n mode="<%= mode %>"\n type="<%= options.resourceType %>"\n uuid=<%= devalue(((options.entities || [])[0] || {}).id || false) %>\n/>'
|
|
82
84
|
}
|
|
@@ -51,7 +51,9 @@ export const Wrapper = (args, { argTypes }) => ({
|
|
|
51
51
|
})
|
|
52
52
|
Wrapper.parameters = {
|
|
53
53
|
docs: {
|
|
54
|
-
|
|
54
|
+
description: {
|
|
55
|
+
story: 'The DruxtEntityForm component can be themed by using a Druxt Wrapper component.\n\nCreate an appropriately named component, using the relevant component option, with the following boilerplate:\n\n```jsx\n' + code + '\n```',
|
|
56
|
+
},
|
|
55
57
|
source: { code }
|
|
56
58
|
}
|
|
57
59
|
}
|
|
@@ -70,7 +72,9 @@ export const TemplateInjection = (args, { argTypes }) => ({
|
|
|
70
72
|
})
|
|
71
73
|
TemplateInjection.parameters = {
|
|
72
74
|
docs: {
|
|
73
|
-
|
|
75
|
+
description: {
|
|
76
|
+
story: 'The DruxtEntityForm component can be themed by injecting the default template into the compomnent.\n\n```jsx\n' + code + '\n```',
|
|
77
|
+
},
|
|
74
78
|
source: { code }
|
|
75
79
|
}
|
|
76
80
|
}
|
|
@@ -75,7 +75,9 @@ export const <%= mode.charAt(0).toUpperCase() + mode.slice(1) %> = Template.bind
|
|
|
75
75
|
}
|
|
76
76
|
<%= mode.charAt(0).toUpperCase() + mode.slice(1) %>.parameters = {
|
|
77
77
|
docs: {
|
|
78
|
-
|
|
78
|
+
description: {
|
|
79
|
+
story: 'Render the content entity using the **<%= mode %>** display mode.',
|
|
80
|
+
},
|
|
79
81
|
source: {
|
|
80
82
|
code: '<DruxtEntity\n mode="<%= mode %>"\n type="<%= options.resourceType %>"\n uuid=<%= devalue(((options.entities || [])[0] || {}).id || false) %>\n/>'
|
|
81
83
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import DruxtEntity from 'druxt-entity/dist/components/DruxtEntity.vue'
|
|
2
|
+
import DruxtModule from 'druxt/dist/components/DruxtModule.vue'
|
|
3
|
+
|
|
4
|
+
DruxtEntity.__docgenInfo.props = [
|
|
5
|
+
...DruxtModule.__docgenInfo.props,
|
|
6
|
+
...DruxtEntity.__docgenInfo.props,
|
|
7
|
+
].sort((a, b) => a.name < b.name ? -1 : 1).filter((o) => o.name !== 'v-model')
|
|
2
8
|
|
|
3
9
|
export default {
|
|
4
10
|
title: 'Druxt/Entity/DruxtEntity',
|
|
@@ -52,7 +58,9 @@ export const Wrapper = (args, { argTypes }) => ({
|
|
|
52
58
|
})
|
|
53
59
|
Wrapper.parameters = {
|
|
54
60
|
docs: {
|
|
55
|
-
|
|
61
|
+
description: {
|
|
62
|
+
story: 'The DruxtEntity component can be themed by using a Druxt Wrapper component.\n\nCreate an appropriately named component, using the relevant component option, with the following boilerplate:\n\n```jsx\n' + code + '\n```',
|
|
63
|
+
},
|
|
56
64
|
source: { code }
|
|
57
65
|
}
|
|
58
66
|
}
|
|
@@ -71,7 +79,9 @@ export const TemplateInjection = (args, { argTypes }) => ({
|
|
|
71
79
|
})
|
|
72
80
|
TemplateInjection.parameters = {
|
|
73
81
|
docs: {
|
|
74
|
-
|
|
82
|
+
description: {
|
|
83
|
+
story: 'The DruxtEntity component can be themed by injecting the default template into the compomnent.\n\n```jsx\n' + code + '\n```',
|
|
84
|
+
},
|
|
75
85
|
source: { code }
|
|
76
86
|
}
|
|
77
87
|
}
|