druxt-entity 0.26.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.
@@ -396,7 +396,12 @@ export default {
396
396
  on: {
397
397
  input: (value) => {
398
398
  const type = !field.relationship ? 'attributes' : 'relationships'
399
- this.model[type][id] = value
399
+ if (value) {
400
+ this.model[type][id] = value
401
+ }
402
+ else if (this.model[type][id]) {
403
+ delete this.model[type][id]
404
+ }
400
405
  this.$emit('input', this.model)
401
406
  }
402
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-entity",
3
- "version": "0.26.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",