@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.
- package/dist/form-create.js +434 -363
- package/dist/form-create.min.js +2 -2
- package/dist/form-create.min.js.map +1 -1
- package/package.json +9 -9
- package/src/core/api.js +8 -0
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/iview v2.5.
|
|
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
|
|
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
|
-
|
|
1189
|
-
"style": {
|
|
1204
|
+
return h("Upload", helper([{}, this.formCreateInject.prop, {}, {
|
|
1205
|
+
style: {
|
|
1190
1206
|
display: 'inline-block'
|
|
1191
1207
|
},
|
|
1192
|
-
|
|
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
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
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
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
cacheRule: {},
|
|
1395
|
-
cacheValue: {},
|
|
1396
|
-
type: undefined
|
|
1397
|
-
};
|
|
1371
|
+
button: {
|
|
1372
|
+
type: Boolean,
|
|
1373
|
+
"default": true
|
|
1398
1374
|
},
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
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
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
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
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
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
|
-
|
|
1469
|
-
|
|
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
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
var
|
|
1488
|
-
|
|
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
|
|
1495
|
-
|
|
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
|
-
|
|
1509
|
-
|
|
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
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
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
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
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
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
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
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
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
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
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
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
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
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
"
|
|
1577
|
-
|
|
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
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
if (
|
|
1635
|
-
this.
|
|
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
|
-
|
|
1638
|
-
this.
|
|
1683
|
+
if (this.sortBtn && index !== total - 1) {
|
|
1684
|
+
btn.push(this.sortDownIcon(index));
|
|
1639
1685
|
}
|
|
1686
|
+
return btn;
|
|
1640
1687
|
},
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
var
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
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
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
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,
|
|
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$
|
|
5829
|
-
styleInject(css_248z$
|
|
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.
|
|
6074
|
+
version: "".concat("2.5.32"),
|
|
6004
6075
|
manager: manager,
|
|
6005
6076
|
install: install,
|
|
6006
6077
|
extendApi: extendApi,
|