dfish-widget 1.0.35 → 1.0.37

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/lib/index.esm.js CHANGED
@@ -2220,12 +2220,6 @@ var script$1g = {
2220
2220
  },
2221
2221
  // 表单验证。验证通过返回true /@ range -> validaterange
2222
2222
  async valid(range) {
2223
- if (this._err_ns) {
2224
- this._err_ns.forEach(v => {
2225
- let n = $$1.vueMap.get(v.wid);
2226
- n && n.warn(false);
2227
- });
2228
- }
2229
2223
  let e = await this.getValidError(range);
2230
2224
  if (e) {
2231
2225
  e.forEach(v => $$1.vueMap.get(v.wid).warn());
@@ -2241,6 +2235,12 @@ var script$1g = {
2241
2235
  saveModified(range, original) {
2242
2236
  this.getFormList(range).forEach(o => (o = $$1(o)).saveModified && o.saveModified(original));
2243
2237
  },
2238
+ resetFormStyle(range) {
2239
+ this.getFormList(range).forEach(f => {
2240
+ const c = $$1(f);
2241
+ c.warn && c.warn(false);
2242
+ });
2243
+ },
2244
2244
  resetForm(range, empty) {
2245
2245
  this.getFormList(range).forEach(f => {
2246
2246
  const c = $$1(f);
@@ -5997,6 +5997,12 @@ var script$A = {
5997
5997
  return this.x.modelValue
5998
5998
  let ov = this.x.modelValue;
5999
5999
  this.x.modelValue = v;
6000
+ if (ov == null) {
6001
+ ov = '';
6002
+ }
6003
+ if (v == null) {
6004
+ v = '';
6005
+ }
6000
6006
  let changed = ov !== v;
6001
6007
  if (typeof ov === 'object') {
6002
6008
  changed = JSON.stringify(ov) != JSON.stringify(v);
@@ -6048,6 +6054,21 @@ var script$A = {
6048
6054
  }
6049
6055
  }
6050
6056
  },
6057
+ getValidErrorSync(trigger, val) {
6058
+ let ques = trigger ? this.validTriggers[trigger] : this.validQueues;
6059
+ if (ques && (this.isNormal || (this.isReadonly && this.x.readonlyValidate))) {
6060
+ let v = val !== undefined ? val : this.isPlural ? this.groupFormVal() : this.formVal();
6061
+ if (typeof v !== 'string')
6062
+ v = Array.isArray(v) ? v.join(',') : v == null ? '' : ('' + v);
6063
+ v = v.trim();
6064
+ let hs = this.validHooks;
6065
+ for (let q of ques) {
6066
+ let rv = typeof q.rule !== 'object' ? q.rule : q.rule.value !== undefined ? q.rule.value : q.rule;
6067
+ let e = hs[q.type](v, rv, q);
6068
+ if (e) return e
6069
+ }
6070
+ }
6071
+ },
6051
6072
  formErr(que, arg) {
6052
6073
  let label = this.getLabelText();
6053
6074
  let type = que.type;
@@ -6152,6 +6173,7 @@ var script$A = {
6152
6173
  },
6153
6174
  // @empty -> 是否强制清空
6154
6175
  reset(empty) {
6176
+ this.warn(false);
6155
6177
  this.val(empty || this.defaultValue == null ? '' : this.defaultValue);
6156
6178
  },
6157
6179
  html_label() {
@@ -9871,8 +9893,9 @@ var script$b = {
9871
9893
  }
9872
9894
  this.x.format && this.doFormat();
9873
9895
  },
9896
+ // #fixme: 暂时用getValidErrorSync
9874
9897
  isUsableVal(v) {
9875
- return !this.getValidError(null, v)
9898
+ return !this.getValidErrorSync(null, v)
9876
9899
  },
9877
9900
  isFocusTarget(el) { // implement
9878
9901
  return (this.$refs.buttonMinus && this.$refs.buttonMinus.contains(el)) || (this.$refs.buttonPlus && this.$refs.buttonPlus.contains(el))
@@ -11395,6 +11418,7 @@ const init_text = $$1.loc.form.jigsaw_drag_right;
11395
11418
  this.isSuccess = false;
11396
11419
  this.text = init_text;
11397
11420
  this.setThumbLeft(0);
11421
+ this.warn(false);
11398
11422
  },
11399
11423
  refresh(e) {
11400
11424
  e.runType = 'click:refresh';