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

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.17",
3
+ "version": "2.5.18",
4
4
  "description": "@form-create/ant-design-vue 内置组件",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "author": "xaboy",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@form-create/utils": "^2.5.17"
33
+ "@form-create/utils": "^2.5.18"
34
34
  },
35
35
  "bugs": {
36
36
  "url": "https://github.com/xaboy/form-create/issues"
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "b21068f23bf2b13bcf4ebb130d75fdb173f4c80a"
42
+ "gitHead": "8e12590732e9ac071d752049c8800dbffe7826ff"
43
43
  }
package/src/component.jsx CHANGED
@@ -1,4 +1,6 @@
1
1
  import {hasProperty} from '@form-create/utils/lib/type';
2
+ import {deepCopy} from '@form-create/utils/lib/deepextend';
3
+ import extend from '@form-create/utils/lib/extend';
2
4
 
3
5
  const NAME = 'fcGroup';
4
6
 
@@ -30,6 +32,7 @@ export default {
30
32
  type: Array,
31
33
  default: () => []
32
34
  },
35
+ defaultValue: Object,
33
36
  disabled: {
34
37
  type: Boolean,
35
38
  default: false
@@ -152,7 +155,11 @@ export default {
152
155
  submitBtn: false,
153
156
  resetBtn: false,
154
157
  };
155
- options.formData = this.field ? ({[this.field]: this._value(this.value[i])}) : (this.value[i] || {});
158
+ if (this.defaultValue) {
159
+ if (!options.formData) options.formData = {};
160
+ const defVal = deepCopy(this.defaultValue);
161
+ extend(options.formData, this.field ? {[this.field]: defVal} : defVal);
162
+ }
156
163
  this.$set(this.cacheRule, ++this.len, {rule, options});
157
164
  if (emit) {
158
165
  this.$nextTick(() => this.$emit('add', rule, Object.keys(this.cacheRule).length - 1));
@@ -161,6 +168,7 @@ export default {
161
168
  add$f(i, key, $f) {
162
169
  this.cacheRule[key].$f = $f;
163
170
  this.subForm();
171
+ this.formData(key, $f.formData());
164
172
  this.$nextTick(() => {
165
173
  if (this.syncDisabled) {
166
174
  $f.disabled(this.disabled);
@@ -263,6 +271,7 @@ export default {
263
271
  'emit-event': (name, ...args) => this.emitEvent(name, args, index, key),
264
272
  input: ($f) => this.add$f(index, key, $f)
265
273
  }}
274
+ value={this.field ? {[this.field]: this._value(this.value[index])} : this.value[index]}
266
275
  rule={rule}
267
276
  option={options} extendOption={true}/></ACol>
268
277
  {button ? <ACol span={2} pull={1} push={1}>{this.makeIcon(keys.length, index, key)}</ACol> : null}