From d62c73c9e15ea3d5000e057679acec1a158d3cb7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 27 Apr 2019 00:53:06 +0200 Subject: [PATCH] state widget: empty value = "" instead of null --- src/client/app/widgets/switchers/state.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/client/app/widgets/switchers/state.js b/src/client/app/widgets/switchers/state.js index 698371bb..dfc1a8fb 100644 --- a/src/client/app/widgets/switchers/state.js +++ b/src/client/app/widgets/switchers/state.js @@ -33,9 +33,11 @@ class State extends Widget { }, [], { - value: {type: 'string|object', value: '', help: [ - '- `string`: `"save"` or `"load"`', + value: {type: 'object|string', value: '', help: [ '- `object`: `"widget_id": VALUE` pairs', + '- `string`: `"save"` (trigger save action), `"load"` (trigger load action) or `""` (reset value)', + '', + 'Note: the widget\'s actual value is never `"save"` or `"load"`, it\'s either an empty string or an object.' ]} }) @@ -74,7 +76,7 @@ class State extends Widget { }) this.filter = this.getProp('filter') ? Array.isArray(this.getProp('filter')) ? this.getProp('filter') : [this.getProp('filter')] : false - this.value = null + this.value = '' } @@ -118,10 +120,10 @@ class State extends Widget { this.load(options.send) valid = true - } else if (v === null) { + } else if (v === '') { if (this.value) this.loadButton.container.classList.add('disabled') - this.value = null + this.value = '' } else if (typeof v === 'object' && !Array.isArray(v)) {