@stonecrop/stonecrop 0.60.0 → 0.60.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.
@@ -2962,7 +2962,7 @@ message: string;
2962
2962
  isValid: ComputedRef<boolean>;
2963
2963
  errorsByField: ComputedRef<Record<string, string[]>>;
2964
2964
  errorsFor: (field: string) => string[];
2965
- setError: (trigger: string, field: string, message: string) => void;
2965
+ setError: (trigger: string, field: string, message?: string) => void;
2966
2966
  clearTrigger: (trigger: string) => void;
2967
2967
  clearAll: () => void;
2968
2968
  validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
@@ -2980,7 +2980,7 @@ message: string;
2980
2980
  isValid: ComputedRef<boolean>;
2981
2981
  errorsByField: ComputedRef<Record<string, string[]>>;
2982
2982
  errorsFor: (field: string) => string[];
2983
- setError: (trigger: string, field: string, message: string) => void;
2983
+ setError: (trigger: string, field: string, message?: string) => void;
2984
2984
  clearTrigger: (trigger: string) => void;
2985
2985
  clearAll: () => void;
2986
2986
  validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
@@ -2998,7 +2998,7 @@ message: string;
2998
2998
  isValid: ComputedRef<boolean>;
2999
2999
  errorsByField: ComputedRef<Record<string, string[]>>;
3000
3000
  errorsFor: (field: string) => string[];
3001
- setError: (trigger: string, field: string, message: string) => void;
3001
+ setError: (trigger: string, field: string, message?: string) => void;
3002
3002
  clearTrigger: (trigger: string) => void;
3003
3003
  clearAll: () => void;
3004
3004
  validateField: (triggers: Record<string, TriggerDefinition>, changedField: string, record: Record<string, unknown>) => Promise<void>;
@@ -3026,7 +3026,10 @@ export declare interface ValidationError {
3026
3026
  trigger: string;
3027
3027
  /** The fieldname the error displays on (the `setError` target, not necessarily a fired field) */
3028
3028
  field: string;
3029
- /** The message to display */
3029
+ /**
3030
+ * The message to display; `''` when the trigger left it out (`setError(field)`), which the form words
3031
+ * with the field's own `validation.errorMessage`
3032
+ */
3030
3033
  message: string;
3031
3034
  }
3032
3035
 
package/dist/stonecrop.js CHANGED
@@ -3798,8 +3798,11 @@ var useValidationStore = defineStore("stonecrop-validation", () => {
3798
3798
  function errorsFor(field) {
3799
3799
  return errors.value.filter((e) => e.field === field).map((e) => e.message);
3800
3800
  }
3801
- /** Record an error contributed by `trigger`, displayed on `field`. */
3802
- function setError(trigger, field, message) {
3801
+ /**
3802
+ * Record an error contributed by `trigger`, displayed on `field`. With `message` left out it is recorded
3803
+ * as `''`, which the form words with the field's own `validation.errorMessage`.
3804
+ */
3805
+ function setError(trigger, field, message = "") {
3803
3806
  errors.value.push({
3804
3807
  trigger,
3805
3808
  field,