@form-create/iview 2.5.31 → 2.5.32

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/iview v2.5.31
2
+ * @form-create/iview v2.5.32
3
3
  * (c) 2018-2023 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -305,7 +305,9 @@
305
305
  },
306
306
  render: function render() {
307
307
  var h = arguments[0];
308
- return h("CheckboxGroup", helper([{}, this.formCreateInject.prop, {}, {
308
+ return h("CheckboxGroup", helper([{}, this.formCreateInject.prop, {
309
+ "ref": "el"
310
+ }, {
309
311
  "props": {
310
312
  value: this.trueValue
311
313
  }
@@ -322,6 +324,9 @@
322
324
  "key": '' + index + '-' + opt.value
323
325
  }]));
324
326
  }), getSlot(this.$slots)]);
327
+ },
328
+ mounted: function mounted() {
329
+ this.$emit('fc.el', this.$refs.el);
325
330
  }
326
331
  };
327
332
 
@@ -862,6 +867,7 @@
862
867
  value: this.trueValue
863
868
  }
864
869
  }, {
870
+ "ref": "el",
865
871
  "on": {
866
872
  "input": this.onInput
867
873
  }
@@ -874,6 +880,9 @@
874
880
  "key": '' + index + '-' + opt.value
875
881
  }]));
876
882
  }), getSlot(this.$slots)]);
883
+ },
884
+ mounted: function mounted() {
885
+ this.$emit('fc.el', this.$refs.el);
877
886
  }
878
887
  };
879
888
 
@@ -929,7 +938,9 @@
929
938
  },
930
939
  render: function render(h, ctx) {
931
940
  var options = ctx.props.formCreateInject.options;
932
- return h("Select", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
941
+ return h("Select", helper([{}, ctx.data, {
942
+ "ref": "el"
943
+ }]), [(Array.isArray(options) ? options : []).map(function (props, index) {
933
944
  var slot = props.slot;
934
945
  return h("Option", helper([{}, {
935
946
  "props": props
@@ -939,6 +950,9 @@
939
950
  "slot": props.slotName || 'default'
940
951
  }, [is.Function(slot) ? props.slot(h) : slot]) : null]);
941
952
  }), ctx.children]);
953
+ },
954
+ mounted: function mounted() {
955
+ this.$emit('fc.el', this.$refs.el);
942
956
  }
943
957
  };
944
958
 
@@ -1007,6 +1021,9 @@
1007
1021
  }, {
1008
1022
  "on": on
1009
1023
  }]), [getSlot(this.$slots)]);
1024
+ },
1025
+ mounted: function mounted() {
1026
+ this.$emit('fc.el', this.$refs.tree);
1010
1027
  }
1011
1028
  };
1012
1029
 
@@ -1184,12 +1201,12 @@
1184
1201
  makeUpload: function makeUpload() {
1185
1202
  var h = this.$createElement;
1186
1203
  var isShow = !this.maxLength || this.maxLength > this.uploadList.length;
1187
- return h("Upload", helper([{}, this.formCreateInject.prop, {
1188
- "ref": "upload",
1189
- "style": {
1204
+ return h("Upload", helper([{}, this.formCreateInject.prop, {}, {
1205
+ style: {
1190
1206
  display: 'inline-block'
1191
1207
  },
1192
- "key": this.key('upload')
1208
+ key: this.key('upload'),
1209
+ ref: 'upload'
1193
1210
  }]), [isShow ? h("template", {
1194
1211
  "slot": "default"
1195
1212
  }, [this.$slots["default"] || h("div", {
@@ -1255,6 +1272,7 @@
1255
1272
  }, {
1256
1273
  deep: true
1257
1274
  });
1275
+ this.$emit('fc.el', this.$refs.upload);
1258
1276
  }
1259
1277
  };
1260
1278
  }
@@ -1334,390 +1352,419 @@
1334
1352
  return _extends$1.apply(this, arguments);
1335
1353
  }
1336
1354
 
1355
+ var css_248z$2 = "._fc-group{\n display: flex;\n min-height: 42px;\n justify-content: center;\n flex-direction: column;\n}\n\n._fc-group-disabled ._fc-group-btn, ._fc-group-disabled ._fc-group-add{\n cursor: not-allowed;\n}\n\n._fc-group-handle {\n display: flex;\n flex-direction: row;\n position: absolute;\n bottom: -15px;\n right: 30px;\n border-radius: 15px;\n border: 1px dashed #d9d9d9;\n padding: 3px 8px;\n background-color: #ffffff;\n}\n\n._fc-group-btn{\n cursor: pointer;\n}\n\n._fc-group-idx {\n position: absolute;\n bottom: -15px;\n left: 10px;\n width: 30px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #eee;\n border-radius: 15px;\n font-weight: 700;\n}\n\n._fc-group-handle ._fc-group-btn + ._fc-group-btn {\n margin-left: 7px;\n}\n\n._fc-group-container{\n position: relative;\n display: flex;\n flex-direction: column;\n border: 1px dashed #d9d9d9;\n padding: 20px;\n margin: 5px;\n border-radius: 5px;\n margin-bottom: 25px;\n padding-bottom: 25px;\n}\n\n._fc-group-arrow {\n position: relative;\n width: 20px;\n height: 20px;\n}\n\n._fc-group-arrow::before {\n content: \"\";\n position: absolute;\n top: 8px;\n left: 5px;\n width: 9px;\n height: 9px;\n border-left: 2px solid #999;\n border-top: 2px solid #999;\n}\n._fc-group-arrow::before {\n transform: rotate(45deg);\n}\n\n._fc-group-arrow._fc-group-down {\n transform: rotate(180deg);\n}\n\n._fc-group-plus-minus {\n width: 20px;\n height: 20px;\n position: relative;\n cursor: pointer;\n}\n\n._fc-group-plus-minus::before,\n._fc-group-plus-minus::after {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 60%;\n height: 2px;\n background-color: #409eff;\n transform: translate(-50%, -50%);\n}\n\n._fc-group-plus-minus::before {\n transform: translate(-50%, -50%) rotate(90deg);\n}\n\n._fc-group-plus-minus._fc-group-minus::before {\n display: none;\n}\n._fc-group-plus-minus._fc-group-minus::after {\n background-color: #f56c6c;\n}\n\n\n._fc-group-add{\n cursor: pointer;\n width: 25px;\n height: 25px;\n border: 1px solid rgb(64 158 255 / 50%);\n border-radius: 15px;\n}\n\n._fc-group-add._fc-group-plus-minus::before, ._fc-group-add._fc-group-plus-minus::after {\n width: 50%;\n}\n\n";
1356
+ styleInject(css_248z$2);
1357
+
1337
1358
  var NAME$6 = 'fcGroup';
1338
- function createGroup(config) {
1339
- return {
1340
- name: NAME$6,
1341
- props: {
1342
- field: String,
1343
- rule: [Array, Object],
1344
- rules: Array,
1345
- expand: Number,
1346
- options: Object,
1347
- formCreateInject: {
1348
- type: Object,
1349
- required: true
1350
- },
1351
- button: {
1352
- type: Boolean,
1353
- "default": true
1354
- },
1355
- max: {
1356
- type: Number,
1357
- "default": 0
1358
- },
1359
- min: {
1360
- type: Number,
1361
- "default": 0
1362
- },
1363
- value: {
1364
- type: Array,
1365
- "default": function _default() {
1366
- return [];
1367
- }
1368
- },
1369
- defaultValue: Object,
1370
- disabled: {
1371
- type: Boolean,
1372
- "default": false
1373
- },
1374
- syncDisabled: {
1375
- type: Boolean,
1376
- "default": true
1377
- },
1378
- fontSize: {
1379
- type: Number,
1380
- "default": 28
1381
- },
1382
- onBeforeRemove: {
1383
- type: Function,
1384
- "default": function _default() {}
1385
- },
1386
- onBeforeAdd: {
1387
- type: Function,
1388
- "default": function _default() {}
1389
- }
1359
+ var Group = {
1360
+ name: NAME$6,
1361
+ props: {
1362
+ field: String,
1363
+ rule: [Array, Object],
1364
+ rules: Array,
1365
+ expand: Number,
1366
+ options: Object,
1367
+ formCreateInject: {
1368
+ type: Object,
1369
+ required: true
1390
1370
  },
1391
- data: function data() {
1392
- return {
1393
- len: 0,
1394
- cacheRule: {},
1395
- cacheValue: {},
1396
- type: undefined
1397
- };
1371
+ button: {
1372
+ type: Boolean,
1373
+ "default": true
1398
1374
  },
1399
- computed: {
1400
- formRule: function formRule() {
1401
- if (this.rules) {
1402
- return this.rules;
1403
- }
1404
- if (this.rule) {
1405
- return Array.isArray(this.rule) ? this.rule : [this.rule];
1406
- }
1375
+ max: {
1376
+ type: Number,
1377
+ "default": 0
1378
+ },
1379
+ min: {
1380
+ type: Number,
1381
+ "default": 0
1382
+ },
1383
+ value: {
1384
+ type: Array,
1385
+ "default": function _default() {
1407
1386
  return [];
1408
1387
  }
1409
1388
  },
1410
- watch: {
1411
- formRule: {
1412
- handler: function handler(n, o) {
1413
- var _this = this;
1414
- Object.keys(this.cacheRule).forEach(function (v) {
1415
- var item = _this.cacheRule[v];
1416
- if (item.$f) {
1417
- var val = item.$f.formData();
1418
- if (n === o) {
1419
- item.$f.deferSyncValue(function () {
1420
- deepExtend(item.rule, n);
1421
- item.$f.setValue(val);
1422
- }, true);
1423
- } else {
1424
- var _val = item.$f.formData();
1425
- item.$f.once('reloading', function () {
1426
- item.$f.setValue(_val);
1427
- });
1428
- item.rule = deepCopy(n);
1429
- }
1430
- }
1431
- });
1432
- },
1433
- deep: true
1434
- },
1435
- disabled: function disabled(n) {
1436
- if (this.syncDisabled) {
1437
- var lst = this.cacheRule;
1438
- Object.keys(lst).forEach(function (k) {
1439
- lst[k].$f.disabled(n);
1440
- });
1441
- }
1442
- },
1443
- expand: function expand(n) {
1444
- var d = n - this.value.length;
1445
- if (d > 0) {
1446
- this.expandRule(d);
1447
- }
1389
+ sortBtn: {
1390
+ type: Boolean,
1391
+ "default": true
1392
+ },
1393
+ defaultValue: Object,
1394
+ disabled: {
1395
+ type: Boolean,
1396
+ "default": false
1397
+ },
1398
+ syncDisabled: {
1399
+ type: Boolean,
1400
+ "default": true
1401
+ },
1402
+ onBeforeRemove: {
1403
+ type: Function,
1404
+ "default": function _default() {}
1405
+ },
1406
+ onBeforeAdd: {
1407
+ type: Function,
1408
+ "default": function _default() {}
1409
+ },
1410
+ parse: Function
1411
+ },
1412
+ data: function data() {
1413
+ return {
1414
+ len: 0,
1415
+ cacheRule: {},
1416
+ cacheValue: {},
1417
+ sort: [],
1418
+ type: undefined
1419
+ };
1420
+ },
1421
+ computed: {
1422
+ formRule: function formRule() {
1423
+ if (this.rules) {
1424
+ return this.rules;
1425
+ }
1426
+ if (this.rule) {
1427
+ return Array.isArray(this.rule) ? this.rule : [this.rule];
1428
+ }
1429
+ return [];
1430
+ }
1431
+ },
1432
+ watch: {
1433
+ cacheRule: {
1434
+ handler: function handler(n) {
1435
+ this.sort = Object.keys(n);
1448
1436
  },
1449
- value: function value(n) {
1450
- var _this2 = this;
1451
- n = n || [];
1452
- var keys = Object.keys(this.cacheRule),
1453
- total = keys.length,
1454
- len = total - n.length;
1455
- if (len < 0) {
1456
- for (var i = len; i < 0; i++) {
1457
- this.addRule(n.length + i);
1458
- }
1459
- for (var _i = 0; _i < total; _i++) {
1460
- this.setValue(keys[_i], n[_i]);
1461
- }
1462
- } else {
1463
- if (len > 0) {
1464
- for (var _i2 = 0; _i2 < len; _i2++) {
1465
- this.removeRule(keys[total - _i2 - 1]);
1437
+ immediate: true
1438
+ },
1439
+ formRule: {
1440
+ handler: function handler(n, o) {
1441
+ var _this = this;
1442
+ Object.keys(this.cacheRule).forEach(function (v) {
1443
+ var item = _this.cacheRule[v];
1444
+ if (item.$f) {
1445
+ var val = item.$f.formData();
1446
+ if (n === o) {
1447
+ item.$f.deferSyncValue(function () {
1448
+ deepExtend(item.rule, n);
1449
+ item.$f.setValue(val);
1450
+ }, true);
1451
+ } else {
1452
+ var _val = item.$f.formData();
1453
+ item.$f.once('reloading', function () {
1454
+ item.$f.setValue(_val);
1455
+ });
1456
+ item.rule = deepCopy(n);
1466
1457
  }
1467
1458
  }
1468
- n.forEach(function (val, i) {
1469
- _this2.setValue(keys[i], n[i]);
1470
- });
1471
- }
1459
+ });
1460
+ },
1461
+ deep: true
1462
+ },
1463
+ disabled: function disabled(n) {
1464
+ if (this.syncDisabled) {
1465
+ var lst = this.cacheRule;
1466
+ Object.keys(lst).forEach(function (k) {
1467
+ lst[k].$f.disabled(n);
1468
+ });
1472
1469
  }
1473
1470
  },
1474
- methods: {
1475
- _value: function _value(v) {
1476
- return v && hasProperty(v, this.field) ? v[this.field] : v;
1477
- },
1478
- cache: function cache(k, val) {
1479
- this.cacheValue[k] = JSON.stringify(val);
1480
- },
1481
- input: function input(value) {
1482
- this.$emit('input', value);
1483
- this.$emit('change', value);
1484
- },
1485
- formData: function formData(key, _formData) {
1486
- var _this3 = this;
1487
- var cacheRule = this.cacheRule;
1488
- var keys = Object.keys(cacheRule);
1489
- if (keys.filter(function (k) {
1490
- return cacheRule[k].$f;
1491
- }).length !== keys.length) {
1492
- return;
1471
+ expand: function expand(n) {
1472
+ var d = n - this.value.length;
1473
+ if (d > 0) {
1474
+ this.expandRule(d);
1475
+ }
1476
+ },
1477
+ value: function value(n, o) {
1478
+ var _this2 = this;
1479
+ n = n || [];
1480
+ var keys = this.sort,
1481
+ total = keys.length,
1482
+ len = total - n.length;
1483
+ if (len < 0) {
1484
+ for (var i = len; i < 0; i++) {
1485
+ this.addRule(n.length + i);
1493
1486
  }
1494
- var value = keys.map(function (k) {
1495
- var data = key === k ? _formData : _objectSpread2({}, _this3.cacheRule[k].$f.form);
1496
- var value = _this3.field ? data[_this3.field] || null : data;
1497
- _this3.cache(k, value);
1498
- return value;
1499
- });
1500
- this.input(value);
1501
- },
1502
- setValue: function setValue(key, value) {
1503
- var field = this.field,
1504
- $f = this.cacheRule[key].$f;
1505
- if (field) {
1506
- value = _defineProperty({}, field, this._value(value));
1487
+ for (var _i = 0; _i < total; _i++) {
1488
+ this.setValue(keys[_i], n[_i]);
1507
1489
  }
1508
- if (this.cacheValue[key] === JSON.stringify(field ? value[field] : value)) {
1509
- return;
1490
+ } else {
1491
+ if (len > 0) {
1492
+ for (var _i2 = 0; _i2 < len; _i2++) {
1493
+ this.removeRule(keys[total - _i2 - 1]);
1494
+ }
1510
1495
  }
1511
- this.cache(key, value);
1512
- $f.coverValue(value || {});
1513
- },
1514
- addRule: function addRule(i, emit) {
1515
- var _this4 = this;
1516
- var rule = this.formCreateInject.form.copyRules(this.formRule);
1517
- var options = this.options ? _objectSpread2({}, this.options) : {
1518
- submitBtn: false,
1519
- resetBtn: false
1520
- };
1521
- if (this.defaultValue) {
1522
- if (!options.formData) options.formData = {};
1523
- var defVal = deepCopy(this.defaultValue);
1524
- extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1496
+ n.forEach(function (val, i) {
1497
+ _this2.setValue(keys[i], n[i]);
1498
+ });
1499
+ if (o.length && !n.length) {
1500
+ this.input([]);
1525
1501
  }
1526
- this.$set(this.cacheRule, ++this.len, {
1527
- rule: rule,
1528
- options: options
1502
+ }
1503
+ }
1504
+ },
1505
+ methods: {
1506
+ _value: function _value(v) {
1507
+ return v && hasProperty(v, this.field) ? v[this.field] : v;
1508
+ },
1509
+ cache: function cache(k, val) {
1510
+ this.cacheValue[k] = JSON.stringify(val);
1511
+ },
1512
+ input: function input(value) {
1513
+ this.$emit('input', value);
1514
+ this.$emit('change', value);
1515
+ },
1516
+ formData: function formData(key, _formData) {
1517
+ var _this3 = this;
1518
+ var cacheRule = this.cacheRule;
1519
+ var keys = this.sort;
1520
+ if (keys.filter(function (k) {
1521
+ return cacheRule[k].$f;
1522
+ }).length !== keys.length) {
1523
+ return;
1524
+ }
1525
+ var value = keys.map(function (k) {
1526
+ var data = key === k ? _formData : _objectSpread2({}, _this3.cacheRule[k].$f.form);
1527
+ var value = _this3.field ? data[_this3.field] || null : data;
1528
+ _this3.cache(k, value);
1529
+ return value;
1530
+ });
1531
+ this.input(value);
1532
+ },
1533
+ setValue: function setValue(key, value) {
1534
+ var field = this.field,
1535
+ $f = this.cacheRule[key].$f;
1536
+ if (field) {
1537
+ value = _defineProperty({}, field, this._value(value));
1538
+ }
1539
+ if (this.cacheValue[key] === JSON.stringify(field ? value[field] : value)) {
1540
+ return;
1541
+ }
1542
+ this.cache(key, value);
1543
+ $f.coverValue(value || {});
1544
+ },
1545
+ addRule: function addRule(i, emit) {
1546
+ var _this4 = this;
1547
+ var rule = this.formCreateInject.form.copyRules(this.formRule);
1548
+ var options = this.options ? _objectSpread2({}, this.options) : {
1549
+ submitBtn: false,
1550
+ resetBtn: false
1551
+ };
1552
+ if (this.defaultValue) {
1553
+ if (!options.formData) options.formData = {};
1554
+ var defVal = deepCopy(this.defaultValue);
1555
+ extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1556
+ }
1557
+ this.parse && this.parse({
1558
+ rule: rule,
1559
+ options: options,
1560
+ index: this.sort.length
1561
+ });
1562
+ this.$set(this.cacheRule, ++this.len, {
1563
+ rule: rule,
1564
+ options: options
1565
+ });
1566
+ if (emit) {
1567
+ this.$nextTick(function () {
1568
+ return _this4.$emit('add', rule, Object.keys(_this4.cacheRule).length - 1);
1529
1569
  });
1530
- if (emit) {
1531
- this.$nextTick(function () {
1532
- return _this4.$emit('add', rule, Object.keys(_this4.cacheRule).length - 1);
1533
- });
1570
+ }
1571
+ },
1572
+ add$f: function add$f(i, key, $f) {
1573
+ var _this5 = this;
1574
+ this.cacheRule[key].$f = $f;
1575
+ this.$nextTick(function () {
1576
+ if (_this5.syncDisabled) {
1577
+ $f.disabled(_this5.disabled);
1534
1578
  }
1535
- },
1536
- add$f: function add$f(i, key, $f) {
1537
- var _this5 = this;
1538
- this.cacheRule[key].$f = $f;
1539
- this.formData(key, $f.formData());
1579
+ _this5.$emit('itemMounted', $f, Object.keys(_this5.cacheRule).indexOf(key));
1580
+ });
1581
+ },
1582
+ removeRule: function removeRule(key, emit) {
1583
+ var _this6 = this;
1584
+ var index = Object.keys(this.cacheRule).indexOf(key);
1585
+ this.$delete(this.cacheRule, key);
1586
+ this.$delete(this.cacheValue, key);
1587
+ if (emit) {
1540
1588
  this.$nextTick(function () {
1541
- if (_this5.syncDisabled) {
1542
- $f.disabled(_this5.disabled);
1543
- }
1544
- _this5.$emit('itemMounted', $f, Object.keys(_this5.cacheRule).indexOf(key));
1589
+ return _this6.$emit('remove', index);
1545
1590
  });
1546
- },
1547
- removeRule: function removeRule(key, emit) {
1548
- var _this6 = this;
1549
- var index = Object.keys(this.cacheRule).indexOf(key);
1550
- this.$delete(this.cacheRule, key);
1551
- this.$delete(this.cacheValue, key);
1552
- if (emit) {
1553
- this.$nextTick(function () {
1554
- return _this6.$emit('remove', index);
1555
- });
1591
+ }
1592
+ },
1593
+ add: function add(i) {
1594
+ if (this.disabled || false === this.onBeforeAdd(this.value)) {
1595
+ return;
1596
+ }
1597
+ this.addRule(i, true);
1598
+ },
1599
+ del: function del(index, key) {
1600
+ if (this.disabled || false === this.onBeforeRemove(this.value, index)) {
1601
+ return;
1602
+ }
1603
+ this.removeRule(key, true);
1604
+ var value = _toConsumableArray(this.value);
1605
+ value.splice(index, 1);
1606
+ this.input(value);
1607
+ },
1608
+ addIcon: function addIcon(key) {
1609
+ var h = this.$createElement;
1610
+ return h("div", {
1611
+ "class": "_fc-group-btn _fc-group-plus-minus",
1612
+ "on": {
1613
+ "click": this.add
1556
1614
  }
1557
- },
1558
- add: function add(i) {
1559
- if (this.disabled || false === this.onBeforeAdd(this.value)) {
1560
- return;
1615
+ });
1616
+ },
1617
+ delIcon: function delIcon(index, key) {
1618
+ var _this7 = this;
1619
+ var h = this.$createElement;
1620
+ return h("div", {
1621
+ "class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
1622
+ "on": {
1623
+ "click": function click() {
1624
+ return _this7.del(index, key);
1625
+ }
1561
1626
  }
1562
- this.addRule(i, true);
1563
- },
1564
- del: function del(index, key) {
1565
- if (this.disabled || false === this.onBeforeRemove(this.value, index)) {
1566
- return;
1627
+ });
1628
+ },
1629
+ sortUpIcon: function sortUpIcon(index) {
1630
+ var _this8 = this;
1631
+ var h = this.$createElement;
1632
+ return h("div", {
1633
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-up",
1634
+ "on": {
1635
+ "click": function click() {
1636
+ return _this8.changeSort(index, -1);
1637
+ }
1567
1638
  }
1568
- this.removeRule(key, true);
1569
- this.value.splice(index, 1);
1570
- this.input(this.value);
1571
- },
1572
- addIcon: function addIcon(key) {
1573
- var h = this.$createElement;
1574
- return h("Icon", {
1575
- "key": "a".concat(key),
1576
- "attrs": {
1577
- "type": config.addIcon
1578
- },
1579
- "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#000'),
1580
- "on": {
1581
- "click": this.add
1639
+ });
1640
+ },
1641
+ sortDownIcon: function sortDownIcon(index) {
1642
+ var _this9 = this;
1643
+ var h = this.$createElement;
1644
+ return h("div", {
1645
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-down",
1646
+ "on": {
1647
+ "click": function click() {
1648
+ return _this9.changeSort(index, 1);
1582
1649
  }
1583
- });
1584
- },
1585
- delIcon: function delIcon(index, key) {
1586
- var _this7 = this;
1587
- var h = this.$createElement;
1588
- return h("Icon", {
1589
- "key": "d".concat(key),
1590
- "attrs": {
1591
- "type": config.removeIcon
1650
+ }
1651
+ });
1652
+ },
1653
+ changeSort: function changeSort(index, sort) {
1654
+ var a = this.sort[index];
1655
+ this.$set(this.sort, index, this.sort[index + sort]);
1656
+ this.sort[index + sort] = a;
1657
+ this.formData(0);
1658
+ },
1659
+ makeIcon: function makeIcon(total, index, key) {
1660
+ var _this10 = this;
1661
+ if (this.$scopedSlots.button) {
1662
+ return this.$scopedSlots.button({
1663
+ total: total,
1664
+ index: index,
1665
+ vm: this,
1666
+ key: key,
1667
+ del: function del() {
1668
+ return _this10.del(index, key);
1592
1669
  },
1593
- "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1594
- "on": {
1595
- "click": function click() {
1596
- return _this7.del(index, key);
1597
- }
1598
- }
1670
+ add: this.add
1599
1671
  });
1600
- },
1601
- makeIcon: function makeIcon(total, index, key) {
1602
- var _this8 = this;
1603
- if (this.$scopedSlots.button) {
1604
- return this.$scopedSlots.button({
1605
- total: total,
1606
- index: index,
1607
- vm: this,
1608
- key: key,
1609
- del: function del() {
1610
- return _this8.del(index, key);
1611
- },
1612
- add: this.add
1613
- });
1614
- }
1615
- if (index === 0) {
1616
- return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
1617
- }
1618
- if (total > this.min) {
1619
- return this.delIcon(index, key);
1620
- }
1621
- },
1622
- emitEvent: function emitEvent(name, args, index, key) {
1623
- this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
1624
- },
1625
- expandRule: function expandRule(n) {
1626
- for (var i = 0; i < n; i++) {
1627
- this.value.push(this.field ? null : {});
1628
- }
1629
1672
  }
1630
- },
1631
- created: function created() {
1632
- this.type = this.formCreateInject.form.$form();
1633
- var d = (this.expand || 0) - this.value.length;
1634
- if (d > 0) {
1635
- this.expandRule(d);
1673
+ var btn = [];
1674
+ if ((!this.max || total < this.max) && total === index + 1) {
1675
+ btn.push(this.addIcon(key));
1676
+ }
1677
+ if (total > this.min) {
1678
+ btn.push(this.delIcon(index, key));
1679
+ }
1680
+ if (this.sortBtn && index) {
1681
+ btn.push(this.sortUpIcon(index));
1636
1682
  }
1637
- for (var i = 0; i < this.value.length; i++) {
1638
- this.addRule(i);
1683
+ if (this.sortBtn && index !== total - 1) {
1684
+ btn.push(this.sortDownIcon(index));
1639
1685
  }
1686
+ return btn;
1640
1687
  },
1641
- render: function render() {
1642
- var _this9 = this;
1643
- var h = arguments[0];
1644
- var keys = Object.keys(this.cacheRule);
1645
- var button = this.button;
1646
- var Type = this.type;
1647
- return keys.length === 0 ? this.$scopedSlots["default"] ? this.$scopedSlots["default"]({
1648
- vm: this,
1649
- add: this.add
1650
- }) : h("Icon", {
1651
- "key": 'a_def',
1652
- "attrs": {
1653
- "type": config.addIcon
1654
- },
1655
- "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1688
+ emitEvent: function emitEvent(name, args, index, key) {
1689
+ this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
1690
+ },
1691
+ expandRule: function expandRule(n) {
1692
+ for (var i = 0; i < n; i++) {
1693
+ this.value.push(this.field ? null : {});
1694
+ }
1695
+ }
1696
+ },
1697
+ created: function created() {
1698
+ this.type = this.formCreateInject.form.$form();
1699
+ var d = (this.expand || 0) - this.value.length;
1700
+ if (d > 0) {
1701
+ this.expandRule(d);
1702
+ }
1703
+ for (var i = 0; i < this.value.length; i++) {
1704
+ this.addRule(i);
1705
+ }
1706
+ },
1707
+ render: function render() {
1708
+ var _this11 = this;
1709
+ var h = arguments[0];
1710
+ var keys = this.sort;
1711
+ var button = this.button;
1712
+ var Type = this.type;
1713
+ var disabled = this.disabled;
1714
+ var children = keys.length === 0 ? this.$scopedSlots["default"] ? this.$scopedSlots["default"]({
1715
+ vm: this,
1716
+ add: this.add
1717
+ }) : h("div", {
1718
+ "key": 'a_def',
1719
+ "class": "_fc-group-plus-minus _fc-group-add",
1720
+ "on": {
1721
+ "click": this.add
1722
+ }
1723
+ }) : keys.map(function (key, index) {
1724
+ var _this11$cacheRule$key = _this11.cacheRule[key],
1725
+ rule = _this11$cacheRule$key.rule,
1726
+ options = _this11$cacheRule$key.options;
1727
+ var btn = button && !disabled ? _this11.makeIcon(keys.length, index, key) : [];
1728
+ return h("div", {
1729
+ "class": "_fc-group-container",
1730
+ "key": key
1731
+ }, [h(Type, helper([{
1732
+ "key": key
1733
+ }, {
1656
1734
  "on": {
1657
- "click": this.add
1658
- }
1659
- }) : h("div", {
1660
- "key": 'con'
1661
- }, [keys.map(function (key, index) {
1662
- var _this9$cacheRule$key = _this9.cacheRule[key],
1663
- rule = _this9$cacheRule$key.rule,
1664
- options = _this9$cacheRule$key.options;
1665
- return h("Row", {
1666
- "attrs": {
1667
- "align": "middle",
1668
- "type": "flex"
1735
+ 'update:value': function updateValue(formData) {
1736
+ return _this11.formData(key, formData);
1669
1737
  },
1670
- "key": key,
1671
- "style": "border-bottom:1px dashed #dcdee2;margin-bottom:10px;"
1672
- }, [h("Col", {
1673
- "attrs": {
1674
- "span": button ? 20 : 24
1675
- }
1676
- }, [h(Type, helper([{
1677
- "key": key
1678
- }, {
1679
- "on": {
1680
- 'update:value': function updateValue(formData) {
1681
- return _this9.formData(key, formData);
1682
- },
1683
- 'emit-event': function emitEvent(name) {
1684
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1685
- args[_key - 1] = arguments[_key];
1686
- }
1687
- return _this9.emitEvent(name, args, index, key);
1688
- },
1689
- input: function input($f) {
1690
- return _this9.add$f(index, key, $f);
1738
+ 'emit-event': function emitEvent(name) {
1739
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1740
+ args[_key - 1] = arguments[_key];
1691
1741
  }
1742
+ return _this11.emitEvent(name, args, index, key);
1743
+ },
1744
+ input: function input($f) {
1745
+ return _this11.add$f(index, key, $f);
1692
1746
  }
1693
- }, {}, {
1694
- "props": {
1695
- value: _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
1696
- rule: rule,
1697
- option: options,
1698
- extendOption: true,
1699
- inFor: true
1700
- }
1701
- }]))]), button ? h("Col", helper([{}, {
1702
- "props": {
1703
- span: 2,
1704
- pull: 1,
1705
- push: 1
1706
- }
1707
- }]), [_this9.makeIcon(keys.length, index, key)]) : null]);
1708
- })]);
1709
- }
1710
- };
1711
- }
1712
-
1713
- var group = createGroup({
1714
- removeIcon: 'ios-remove-circle-outline',
1715
- addIcon: 'ios-add-circle-outline'
1716
- });
1717
- group.v2 = createGroup({
1718
- addIcon: 'ios-plus-outline',
1719
- removeIcon: 'ios-minus-outline'
1720
- });
1747
+ }
1748
+ }, {}, {
1749
+ "props": {
1750
+ inFor: true,
1751
+ value: _this11.field ? _defineProperty({}, _this11.field, _this11._value(_this11.value[index])) : _this11.value[index],
1752
+ rule: rule,
1753
+ option: options,
1754
+ extendOption: true
1755
+ }
1756
+ }])), h("div", {
1757
+ "class": "_fc-group-idx"
1758
+ }, [index + 1]), btn.length ? h("div", {
1759
+ "class": "_fc-group-handle"
1760
+ }, [btn]) : null]);
1761
+ });
1762
+ return h("div", {
1763
+ "key": 'con',
1764
+ "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
1765
+ }, [children]);
1766
+ }
1767
+ };
1721
1768
 
1722
1769
  var NAME$7 = 'fcSubForm';
1723
1770
  var Sub = {
@@ -1825,7 +1872,7 @@
1825
1872
  }
1826
1873
  };
1827
1874
 
1828
- var components = [Checkbox, Radio, Select, Tree, Sub, frame, upload, group];
1875
+ var components = [Checkbox, Radio, Select, Tree, Sub, frame, upload, Group];
1829
1876
 
1830
1877
  var NAME$8 = 'FormCreate';
1831
1878
  var getRuleInject = function getRuleInject(vm, parent) {
@@ -2621,7 +2668,7 @@
2621
2668
  },
2622
2669
  el: function el(id) {
2623
2670
  var ctx = h.getCtx(id);
2624
- if (ctx) return ctx.el || h.vm.$refs[ctx.ref];
2671
+ if (ctx) return ctx.exportEl || ctx.el || h.vm.$refs[ctx.ref];
2625
2672
  },
2626
2673
  closeModal: function closeModal(id) {
2627
2674
  var el = api.el(id);
@@ -3075,6 +3122,12 @@
3075
3122
  },
3076
3123
  'fc.sub-form': function fcSubForm(subForm) {
3077
3124
  _this8.$handle.addSubForm(ctx, subForm);
3125
+ },
3126
+ 'fc.el': function fcEl(el) {
3127
+ ctx.exportEl = el;
3128
+ if (el) {
3129
+ (el.$el || el).__rule__ = ctx.rule;
3130
+ }
3078
3131
  }
3079
3132
  }
3080
3133
  }];
@@ -3396,6 +3449,7 @@
3396
3449
  payload: {},
3397
3450
  input: !!rule.field,
3398
3451
  el: undefined,
3452
+ exportEl: undefined,
3399
3453
  defaultValue: rule.field ? deepCopy(defaultValue) : undefined,
3400
3454
  field: rule.field || undefined
3401
3455
  });
@@ -4790,6 +4844,15 @@
4790
4844
  };
4791
4845
  if (is.Function(option.parse)) {
4792
4846
  fn = option.parse;
4847
+ } else if (option.parse && is.String(option.parse)) {
4848
+ fn = function fn(v) {
4849
+ option.parse.split('.').forEach(function (k) {
4850
+ if (v) {
4851
+ v = v[k];
4852
+ }
4853
+ });
4854
+ return v;
4855
+ };
4793
4856
  }
4794
4857
  set(fn(body, rule, api));
4795
4858
  api.sync(rule);
@@ -5825,8 +5888,8 @@
5825
5888
  useFrame(maker);
5826
5889
  useTimePicker(maker);
5827
5890
 
5828
- var css_248z$2 = ".form-create .form-create .ivu-form-item {\n margin-bottom: 24px;\n}\n\n.form-create .form-create .ivu-form-item .ivu-form-item {\n margin-bottom: 0px;\n}\n";
5829
- styleInject(css_248z$2);
5891
+ var css_248z$3 = ".form-create .form-create .ivu-form-item {\n margin-bottom: 24px;\n}\n\n.form-create .form-create .ivu-form-item .ivu-form-item {\n margin-bottom: 0px;\n}\n";
5892
+ styleInject(css_248z$3);
5830
5893
 
5831
5894
  function tidyBtnProp(btn, def) {
5832
5895
  if (is.Boolean(btn)) btn = {
@@ -5838,6 +5901,14 @@
5838
5901
  }
5839
5902
  function extendApi(api, h) {
5840
5903
  extend(api, {
5904
+ formEl: function formEl() {
5905
+ return h.$manager.form();
5906
+ },
5907
+ wrapEl: function wrapEl(id) {
5908
+ var ctx = h.getFieldCtx(id);
5909
+ if (!ctx) return;
5910
+ return h.vm.$refs[ctx.wrapRef];
5911
+ },
5841
5912
  validate: function validate(callback) {
5842
5913
  return new Promise(function (resolve, reject) {
5843
5914
  var forms = api.children;
@@ -6000,7 +6071,7 @@
6000
6071
  function ivuFormCreate() {
6001
6072
  return FormCreateFactory({
6002
6073
  ui: "".concat("iview"),
6003
- version: "".concat("2.5.31"),
6074
+ version: "".concat("2.5.32"),
6004
6075
  manager: manager,
6005
6076
  install: install,
6006
6077
  extendApi: extendApi,