@form-create/component-antdv-group 2.5.18 → 2.5.20

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": "@form-create/component-antdv-group",
3
- "version": "2.5.18",
3
+ "version": "2.5.20",
4
4
  "description": "@form-create/ant-design-vue 内置组件",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "8e12590732e9ac071d752049c8800dbffe7826ff"
42
+ "gitHead": "196b3c5b14af477d3d86fa37418a60e47ac4bc1f"
43
43
  }
package/src/component.jsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import {hasProperty} from '@form-create/utils/lib/type';
2
- import {deepCopy} from '@form-create/utils/lib/deepextend';
2
+ import deepExtend, {deepCopy} from '@form-create/utils/lib/deepextend';
3
3
  import extend from '@form-create/utils/lib/extend';
4
4
 
5
5
  const NAME = 'fcGroup';
@@ -66,16 +66,33 @@ export default {
66
66
  },
67
67
  computed: {
68
68
  formRule() {
69
- if (this.rule) {
70
- return Array.isArray(this.rule) ? this.rule : [this.rule];
71
- }
72
69
  if (this.rules) {
73
70
  return this.rules;
74
71
  }
72
+ if (this.rule) {
73
+ return Array.isArray(this.rule) ? this.rule : [this.rule];
74
+ }
75
75
  return [];
76
76
  }
77
77
  },
78
78
  watch: {
79
+ formRule: {
80
+ handler(n, o) {
81
+ Object.keys(this.cacheRule).forEach(v => {
82
+ const item = this.cacheRule[v];
83
+ if (n === o) {
84
+ deepExtend(item.rule, n)
85
+ } else {
86
+ const val = item.$f.formData();
87
+ item.$f.once('reload', () => {
88
+ item.$f.setValue(val);
89
+ })
90
+ item.rule = deepCopy(n);
91
+ }
92
+ })
93
+ },
94
+ deep: true
95
+ },
79
96
  disabled(n) {
80
97
  if (this.syncDisabled) {
81
98
  const lst = this.cacheRule;
@@ -105,7 +122,6 @@ export default {
105
122
  for (let i = 0; i < len; i++) {
106
123
  this.removeRule(keys[total - i - 1]);
107
124
  }
108
- this.subForm();
109
125
  }
110
126
  n.forEach((val, i) => {
111
127
  this.setValue(keys[i], n[i]);
@@ -167,7 +183,6 @@ export default {
167
183
  },
168
184
  add$f(i, key, $f) {
169
185
  this.cacheRule[key].$f = $f;
170
- this.subForm();
171
186
  this.formData(key, $f.formData());
172
187
  this.$nextTick(() => {
173
188
  if (this.syncDisabled) {
@@ -176,9 +191,6 @@ export default {
176
191
  this.$emit('itemMounted', $f, Object.keys(this.cacheRule).indexOf(key));
177
192
  });
178
193
  },
179
- subForm() {
180
- this.formCreateInject.subForm(Object.keys(this.cacheRule).map(k => this.cacheRule[k].$f));
181
- },
182
194
  removeRule(key, emit) {
183
195
  const index = Object.keys(this.cacheRule).indexOf(key);
184
196
  this.$delete(this.cacheRule, key);
@@ -198,7 +210,6 @@ export default {
198
210
  return;
199
211
  }
200
212
  this.removeRule(key, true);
201
- this.subForm();
202
213
  this.value.splice(index, 1);
203
214
  this.input(this.value);
204
215
  },
@@ -265,7 +276,7 @@ export default {
265
276
  return <ARow align="middle" type="flex" key={key}
266
277
  style="border-bottom:1px dashed #d9d9d9;margin-bottom:10px;">
267
278
  <ACol span={button ? 20 : 24}><Type
268
- key={key}
279
+ key={key} inFor={true}
269
280
  on={{
270
281
  'update:value': (formData) => this.formData(key, formData),
271
282
  'emit-event': (name, ...args) => this.emitEvent(name, args, index, key),