native-document 1.0.178 → 1.0.180

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.178",
3
+ "version": "1.0.180",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -407,11 +407,12 @@ FormControl.prototype.$handleSubmit = async function(event) {
407
407
  return result;
408
408
 
409
409
  } catch(error) {
410
- this.$dispatchServerErrors(error);
411
- this.emit('error', error, this);
412
- if(!this.hasListeners('error')) {
410
+ const errorsMapper = this.$description.errorsMapper || FormControl.defaultErrorsMapper;
411
+ if(!errorsMapper && !this.hasListeners('error')) {
413
412
  throw error;
414
413
  }
414
+ this.$dispatchServerErrors(error);
415
+ this.emit('error', error, this);
415
416
  } finally {
416
417
  this.$description.submitting.set(false);
417
418
  this.emit('afterSubmit', this);
@@ -123,10 +123,10 @@ const buildSelectedLabel = ($desc) => {
123
123
  return $desc.placeholder || 'Select...';
124
124
  }
125
125
 
126
- const options = Array.isArray($desc.options) ? $desc.options : [];
126
+ const options = $desc.options;
127
127
 
128
128
  if(!$desc.multiple || !Array.isArray(val)) {
129
- const opt = options.find(o => (o.value ?? o) === val);
129
+ const opt = options.find(o => (o.value ?? o) == val);
130
130
  return opt?.label ?? opt ?? val;
131
131
  }
132
132