@panpanzhao/component-ui 0.0.25 → 0.0.27
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/component-ui.common.js +185 -49
- package/lib/components/crud.js +4 -4
- package/lib/components/form-input.js +155 -28
- package/lib/components/form-item.js +21 -12
- package/lib/index.js +1 -1
- package/package.json +2 -2
|
@@ -314,31 +314,31 @@ module.exports = require("element-ui/lib/cascader");
|
|
|
314
314
|
/* 47 */
|
|
315
315
|
/***/ (function(module, exports) {
|
|
316
316
|
|
|
317
|
-
module.exports = require("element-ui/lib/
|
|
317
|
+
module.exports = require("element-ui/lib/date-picker");
|
|
318
318
|
|
|
319
319
|
/***/ }),
|
|
320
320
|
/* 48 */
|
|
321
321
|
/***/ (function(module, exports) {
|
|
322
322
|
|
|
323
|
-
module.exports = require("element-ui/lib/
|
|
323
|
+
module.exports = require("element-ui/lib/switch");
|
|
324
324
|
|
|
325
325
|
/***/ }),
|
|
326
326
|
/* 49 */
|
|
327
327
|
/***/ (function(module, exports) {
|
|
328
328
|
|
|
329
|
-
module.exports = require("element-ui/lib/
|
|
329
|
+
module.exports = require("element-ui/lib/slider");
|
|
330
330
|
|
|
331
331
|
/***/ }),
|
|
332
332
|
/* 50 */
|
|
333
333
|
/***/ (function(module, exports) {
|
|
334
334
|
|
|
335
|
-
module.exports = require("element-ui/lib/
|
|
335
|
+
module.exports = require("element-ui/lib/transfer");
|
|
336
336
|
|
|
337
337
|
/***/ }),
|
|
338
338
|
/* 51 */
|
|
339
339
|
/***/ (function(module, exports) {
|
|
340
340
|
|
|
341
|
-
module.exports = require("element-ui/lib/
|
|
341
|
+
module.exports = require("element-ui/lib/time-picker");
|
|
342
342
|
|
|
343
343
|
/***/ }),
|
|
344
344
|
/* 52 */
|
|
@@ -971,6 +971,9 @@ var formula_ = __webpack_require__(3);
|
|
|
971
971
|
return {};
|
|
972
972
|
}
|
|
973
973
|
},
|
|
974
|
+
valueIsString: Boolean,
|
|
975
|
+
optionBack: Boolean,
|
|
976
|
+
//事件改变是否返回选中的值
|
|
974
977
|
apiOpen: {
|
|
975
978
|
type: Boolean,
|
|
976
979
|
default: function _default() {
|
|
@@ -991,10 +994,17 @@ var formula_ = __webpack_require__(3);
|
|
|
991
994
|
},
|
|
992
995
|
computed: {
|
|
993
996
|
attrs: function attrs() {
|
|
997
|
+
//值处理
|
|
998
|
+
var _value = this.$attrs.value ? this.$attrs.value : this.$attrs.multiple ? [] : null;
|
|
999
|
+
if (this.$attrs.multiple && this.valueIsString && this.$attrs.value) {
|
|
1000
|
+
_value = typeof this.$attrs.value === "string" ? this.$attrs.value.split(",") : this.$attrs.value;
|
|
1001
|
+
}
|
|
994
1002
|
return Object.assign({
|
|
995
1003
|
clearable: true,
|
|
996
1004
|
placeholder: "请选择"
|
|
997
|
-
}, this.$attrs
|
|
1005
|
+
}, this.$attrs, {
|
|
1006
|
+
value: _value
|
|
1007
|
+
});
|
|
998
1008
|
},
|
|
999
1009
|
dictOption: function dictOption() {
|
|
1000
1010
|
if (this.dictCode && this.$COMPONENT.dataSource && this.$COMPONENT.dataSource.dict) {
|
|
@@ -1052,7 +1062,7 @@ var formula_ = __webpack_require__(3);
|
|
|
1052
1062
|
},
|
|
1053
1063
|
initApi: function initApi() {
|
|
1054
1064
|
var _this = this;
|
|
1055
|
-
if (!(this.api.url && this.request)) {
|
|
1065
|
+
if (!(this.api && this.api.url && this.request)) {
|
|
1056
1066
|
return false;
|
|
1057
1067
|
}
|
|
1058
1068
|
var reqData = Object(external_lodash_["merge"])({}, this.api.data);
|
|
@@ -1138,9 +1148,6 @@ var formula_ = __webpack_require__(3);
|
|
|
1138
1148
|
if (this.selectMode === "tree") {
|
|
1139
1149
|
return this.renderTree(h);
|
|
1140
1150
|
}
|
|
1141
|
-
if (this.attrs.multiple && !Array.isArray(this.attrs.value)) {
|
|
1142
|
-
this.attrs.value = [];
|
|
1143
|
-
}
|
|
1144
1151
|
var param = {
|
|
1145
1152
|
props: this.attrs,
|
|
1146
1153
|
slots: this.$slots,
|
|
@@ -1149,7 +1156,27 @@ var formula_ = __webpack_require__(3);
|
|
|
1149
1156
|
return _this4.renderOptions(h, scoped);
|
|
1150
1157
|
}
|
|
1151
1158
|
},
|
|
1152
|
-
on: this.$listeners
|
|
1159
|
+
on: Object.assign({}, this.$listeners, {
|
|
1160
|
+
change: function change(value) {
|
|
1161
|
+
var _value = value;
|
|
1162
|
+
if (_this4.$attrs.multiple && _this4.valueIsString) {
|
|
1163
|
+
_value = value.toString();
|
|
1164
|
+
}
|
|
1165
|
+
var selectOption = [];
|
|
1166
|
+
if (_this4.optionBack) {
|
|
1167
|
+
if (_this4.$attrs.multiple) {
|
|
1168
|
+
selectOption = value && value.length > 0 ? _this4.optionData.filter(function (item) {
|
|
1169
|
+
return value.indexOf(item[_this4._optionProps.value]) > -1;
|
|
1170
|
+
}) : [];
|
|
1171
|
+
} else {
|
|
1172
|
+
selectOption = value ? _this4.optionData.filter(function (item) {
|
|
1173
|
+
return item[_this4._optionProps.value] === value;
|
|
1174
|
+
}) : [];
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
_this4.$emit("change", _value, selectOption);
|
|
1178
|
+
}
|
|
1179
|
+
})
|
|
1153
1180
|
};
|
|
1154
1181
|
return h("el-select", babel_helper_vue_jsx_merge_props_default()([{}, param]));
|
|
1155
1182
|
}
|
|
@@ -1293,7 +1320,7 @@ var radio_button_default = /*#__PURE__*/__webpack_require__.n(radio_button_);
|
|
|
1293
1320
|
methods: {
|
|
1294
1321
|
initApi: function initApi() {
|
|
1295
1322
|
var _this = this;
|
|
1296
|
-
if (!(this.api && this.request)) {
|
|
1323
|
+
if (!(this.api && this.api.url && this.request)) {
|
|
1297
1324
|
return false;
|
|
1298
1325
|
}
|
|
1299
1326
|
this.request({
|
|
@@ -1414,6 +1441,7 @@ var checkbox_button_default = /*#__PURE__*/__webpack_require__.n(checkbox_button
|
|
|
1414
1441
|
}
|
|
1415
1442
|
},
|
|
1416
1443
|
selectMode: String,
|
|
1444
|
+
valueIsString: Boolean,
|
|
1417
1445
|
options: {
|
|
1418
1446
|
type: Array,
|
|
1419
1447
|
default: function _default() {
|
|
@@ -1446,9 +1474,15 @@ var checkbox_button_default = /*#__PURE__*/__webpack_require__.n(checkbox_button
|
|
|
1446
1474
|
},
|
|
1447
1475
|
computed: {
|
|
1448
1476
|
attrs: function attrs() {
|
|
1477
|
+
//值处理
|
|
1478
|
+
var _value = this.$attrs.value ? this.$attrs.value : [];
|
|
1479
|
+
if (this.valueIsString && this.$attrs.value) {
|
|
1480
|
+
_value = typeof this.$attrs.value === "string" ? this.$attrs.value.split(",") : this.$attrs.value;
|
|
1481
|
+
}
|
|
1449
1482
|
return Object.assign({}, this.$attrs, {
|
|
1450
1483
|
size: this.size,
|
|
1451
|
-
border: this.border
|
|
1484
|
+
border: this.border,
|
|
1485
|
+
value: _value
|
|
1452
1486
|
});
|
|
1453
1487
|
},
|
|
1454
1488
|
dictOption: function dictOption() {
|
|
@@ -1498,7 +1532,7 @@ var checkbox_button_default = /*#__PURE__*/__webpack_require__.n(checkbox_button
|
|
|
1498
1532
|
methods: {
|
|
1499
1533
|
initApi: function initApi() {
|
|
1500
1534
|
var _this = this;
|
|
1501
|
-
if (!(this.api && this.request)) {
|
|
1535
|
+
if (!(this.api && this.api.url && this.request)) {
|
|
1502
1536
|
return false;
|
|
1503
1537
|
}
|
|
1504
1538
|
this.request({
|
|
@@ -1548,9 +1582,6 @@ var checkbox_button_default = /*#__PURE__*/__webpack_require__.n(checkbox_button
|
|
|
1548
1582
|
},
|
|
1549
1583
|
render: function render(h) {
|
|
1550
1584
|
var _this4 = this;
|
|
1551
|
-
if (!Array.isArray(this.attrs.value)) {
|
|
1552
|
-
this.attrs.value = [];
|
|
1553
|
-
}
|
|
1554
1585
|
var param = {
|
|
1555
1586
|
props: this.attrs,
|
|
1556
1587
|
slots: this.$slots,
|
|
@@ -1559,7 +1590,16 @@ var checkbox_button_default = /*#__PURE__*/__webpack_require__.n(checkbox_button
|
|
|
1559
1590
|
return _this4.renderOptions(h, scoped);
|
|
1560
1591
|
}
|
|
1561
1592
|
},
|
|
1562
|
-
on: this.$listeners
|
|
1593
|
+
on: Object.assign({}, this.$listeners, {
|
|
1594
|
+
change: function change(value) {
|
|
1595
|
+
debugger;
|
|
1596
|
+
var _value = value;
|
|
1597
|
+
if (_this4.valueIsString) {
|
|
1598
|
+
_value = value.toString();
|
|
1599
|
+
}
|
|
1600
|
+
_this4.$emit("change", _value);
|
|
1601
|
+
}
|
|
1602
|
+
})
|
|
1563
1603
|
};
|
|
1564
1604
|
return h("el-checkbox-group", babel_helper_vue_jsx_merge_props_default()([{}, param]));
|
|
1565
1605
|
}
|
|
@@ -1709,26 +1749,114 @@ var Cascader_component = Object(componentNormalizer["a" /* default */])(
|
|
|
1709
1749
|
)
|
|
1710
1750
|
|
|
1711
1751
|
/* harmony default export */ var Cascader = (Cascader_component.exports);
|
|
1752
|
+
// EXTERNAL MODULE: external "element-ui/lib/date-picker"
|
|
1753
|
+
var date_picker_ = __webpack_require__(47);
|
|
1754
|
+
var date_picker_default = /*#__PURE__*/__webpack_require__.n(date_picker_);
|
|
1755
|
+
|
|
1756
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/form/src/item/DatePicker.vue?vue&type=script&lang=js&
|
|
1757
|
+
|
|
1758
|
+
|
|
1759
|
+
/* harmony default export */ var DatePickervue_type_script_lang_js_ = ({
|
|
1760
|
+
name: "DatePicker",
|
|
1761
|
+
components: {
|
|
1762
|
+
elDatePicker: date_picker_default.a
|
|
1763
|
+
},
|
|
1764
|
+
props: {
|
|
1765
|
+
startProp: String,
|
|
1766
|
+
endProp: String
|
|
1767
|
+
},
|
|
1768
|
+
computed: {
|
|
1769
|
+
attrs: function attrs() {
|
|
1770
|
+
//值处理
|
|
1771
|
+
var _value = this.$attrs.value;
|
|
1772
|
+
if (["monthrange", "daterange", "datetimerange"].indexOf(this.$attrs.type) > -1 && this.startProp && this.endProp && this._form && !_value) {
|
|
1773
|
+
var startPropValue = this._form.formModel[this.startProp];
|
|
1774
|
+
var endPropValue = this._form.formModel[this.endProp];
|
|
1775
|
+
if (startPropValue && endPropValue) {
|
|
1776
|
+
_value = [startPropValue, endPropValue];
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
var res = Object.assign({
|
|
1780
|
+
clearable: true,
|
|
1781
|
+
placeholder: "请选择",
|
|
1782
|
+
valueFormat: "timestamp"
|
|
1783
|
+
}, this.$attrs, {
|
|
1784
|
+
value: _value
|
|
1785
|
+
});
|
|
1786
|
+
return res;
|
|
1787
|
+
},
|
|
1788
|
+
_form: function _form() {
|
|
1789
|
+
var parent = this.$parent;
|
|
1790
|
+
while (parent) {
|
|
1791
|
+
if (parent.$options.componentName !== 'Form' && parent.$options.componentName !== 'FormQuery') {
|
|
1792
|
+
parent = parent.$parent;
|
|
1793
|
+
} else {
|
|
1794
|
+
return parent;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return false;
|
|
1798
|
+
}
|
|
1799
|
+
},
|
|
1800
|
+
render: function render(h) {
|
|
1801
|
+
var _this = this;
|
|
1802
|
+
var param = {
|
|
1803
|
+
props: this.attrs,
|
|
1804
|
+
slots: this.$slots,
|
|
1805
|
+
scopedSlots: this.$scopedSlots,
|
|
1806
|
+
on: Object.assign({}, this.$listeners, {
|
|
1807
|
+
change: function change(value) {
|
|
1808
|
+
if (["monthrange", "daterange", "datetimerange"].indexOf(_this.$attrs.type) > -1 && _this.startProp && _this.endProp && _this._form) {
|
|
1809
|
+
var formModel = _this._form.formModel;
|
|
1810
|
+
if (formModel) {
|
|
1811
|
+
_this.$set(formModel, _this.startProp, value && value[0]);
|
|
1812
|
+
_this.$set(formModel, _this.endProp, value && value[1]);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
_this.$emit("change", value);
|
|
1816
|
+
}
|
|
1817
|
+
})
|
|
1818
|
+
};
|
|
1819
|
+
return h("el-date-picker", babel_helper_vue_jsx_merge_props_default()([{}, param]));
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
// CONCATENATED MODULE: ./src/components/form/src/item/DatePicker.vue?vue&type=script&lang=js&
|
|
1823
|
+
/* harmony default export */ var item_DatePickervue_type_script_lang_js_ = (DatePickervue_type_script_lang_js_);
|
|
1824
|
+
// CONCATENATED MODULE: ./src/components/form/src/item/DatePicker.vue
|
|
1825
|
+
var DatePicker_render, DatePicker_staticRenderFns
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
/* normalize component */
|
|
1831
|
+
|
|
1832
|
+
var DatePicker_component = Object(componentNormalizer["a" /* default */])(
|
|
1833
|
+
item_DatePickervue_type_script_lang_js_,
|
|
1834
|
+
DatePicker_render,
|
|
1835
|
+
DatePicker_staticRenderFns,
|
|
1836
|
+
false,
|
|
1837
|
+
null,
|
|
1838
|
+
null,
|
|
1839
|
+
null
|
|
1840
|
+
|
|
1841
|
+
)
|
|
1842
|
+
|
|
1843
|
+
/* harmony default export */ var DatePicker = (DatePicker_component.exports);
|
|
1712
1844
|
// EXTERNAL MODULE: external "element-ui/lib/switch"
|
|
1713
|
-
var switch_ = __webpack_require__(
|
|
1845
|
+
var switch_ = __webpack_require__(48);
|
|
1714
1846
|
var switch_default = /*#__PURE__*/__webpack_require__.n(switch_);
|
|
1715
1847
|
|
|
1716
1848
|
// EXTERNAL MODULE: external "element-ui/lib/slider"
|
|
1717
|
-
var slider_ = __webpack_require__(
|
|
1849
|
+
var slider_ = __webpack_require__(49);
|
|
1718
1850
|
var slider_default = /*#__PURE__*/__webpack_require__.n(slider_);
|
|
1719
1851
|
|
|
1720
1852
|
// EXTERNAL MODULE: external "element-ui/lib/transfer"
|
|
1721
|
-
var transfer_ = __webpack_require__(
|
|
1853
|
+
var transfer_ = __webpack_require__(50);
|
|
1722
1854
|
var transfer_default = /*#__PURE__*/__webpack_require__.n(transfer_);
|
|
1723
1855
|
|
|
1724
1856
|
// EXTERNAL MODULE: external "element-ui/lib/time-picker"
|
|
1725
|
-
var time_picker_ = __webpack_require__(
|
|
1857
|
+
var time_picker_ = __webpack_require__(51);
|
|
1726
1858
|
var time_picker_default = /*#__PURE__*/__webpack_require__.n(time_picker_);
|
|
1727
1859
|
|
|
1728
|
-
// EXTERNAL MODULE: external "element-ui/lib/date-picker"
|
|
1729
|
-
var date_picker_ = __webpack_require__(51);
|
|
1730
|
-
var date_picker_default = /*#__PURE__*/__webpack_require__.n(date_picker_);
|
|
1731
|
-
|
|
1732
1860
|
// EXTERNAL MODULE: external "element-ui/lib/upload"
|
|
1733
1861
|
var upload_ = __webpack_require__(52);
|
|
1734
1862
|
var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
|
|
@@ -1744,7 +1872,6 @@ var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
|
|
|
1744
1872
|
|
|
1745
1873
|
|
|
1746
1874
|
|
|
1747
|
-
// import elCascader from "element-ui/packages/cascader";
|
|
1748
1875
|
|
|
1749
1876
|
|
|
1750
1877
|
|
|
@@ -1760,7 +1887,7 @@ var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
|
|
|
1760
1887
|
Switchs: switch_default.a,
|
|
1761
1888
|
Upload: upload_default.a,
|
|
1762
1889
|
TimePicker: time_picker_default.a,
|
|
1763
|
-
DatePicker:
|
|
1890
|
+
DatePicker: DatePicker,
|
|
1764
1891
|
Input: Input,
|
|
1765
1892
|
InputNumber: InputNumber,
|
|
1766
1893
|
Select: Select,
|
|
@@ -168,18 +168,7 @@ var external_lodash_ = __webpack_require__(2);
|
|
|
168
168
|
watch: {
|
|
169
169
|
value: function value(val) {
|
|
170
170
|
//监听form的formModel变化,处理config的value变化
|
|
171
|
-
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
this.setValue(val);
|
|
175
|
-
this.execEvent("input", val);
|
|
176
|
-
if (this.form && this.form.formModel) {
|
|
177
|
-
this.$emit("formItemChange", {
|
|
178
|
-
itemConfig: this.config,
|
|
179
|
-
itemProp: this.prop,
|
|
180
|
-
itemVal: val
|
|
181
|
-
});
|
|
182
|
-
}
|
|
171
|
+
this.initValue(val);
|
|
183
172
|
}
|
|
184
173
|
},
|
|
185
174
|
computed: {
|
|
@@ -240,7 +229,27 @@ var external_lodash_ = __webpack_require__(2);
|
|
|
240
229
|
});
|
|
241
230
|
}
|
|
242
231
|
},
|
|
232
|
+
created: function created() {
|
|
233
|
+
var formModel = this.form.formModel;
|
|
234
|
+
if (formModel) {
|
|
235
|
+
this.initValue(formModel[this.prop]);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
243
238
|
methods: {
|
|
239
|
+
initValue: function initValue(val) {
|
|
240
|
+
if (this.config.value === val) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
this.setValue(val);
|
|
244
|
+
this.execEvent("input", val);
|
|
245
|
+
if (this.form && this.form.formModel) {
|
|
246
|
+
this.$emit("formItemChange", {
|
|
247
|
+
itemConfig: this.config,
|
|
248
|
+
itemProp: this.prop,
|
|
249
|
+
itemVal: val
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
},
|
|
244
253
|
execEvent: function execEvent(eventName) {
|
|
245
254
|
var _this2 = this,
|
|
246
255
|
_itemEvent$exec;
|