cy-element-ui 1.0.77 → 1.0.79
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/date-picker.js +3 -3
- package/lib/element-ui.common.js +106 -125
- package/lib/form-item.js +92 -111
- package/lib/index.js +1 -1
- package/lib/time-picker.js +3 -3
- package/lib/time-select.js +3 -3
- package/package.json +1 -1
- package/packages/date-picker/src/picker.vue +1 -1
- package/packages/form/src/form-item.vue +364 -403
- package/src/index.js +1 -1
- package/packages/form/src/label-wrap.vue +0 -81
package/src/index.js
CHANGED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
props: {
|
|
5
|
-
isAutoWidth: Boolean,
|
|
6
|
-
updateAll: Boolean
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
inject: ['elForm', 'elFormItem'],
|
|
10
|
-
|
|
11
|
-
render: function(h) {
|
|
12
|
-
var slots = this.$slots.default;
|
|
13
|
-
if (!slots) return null;
|
|
14
|
-
if (this.isAutoWidth) {
|
|
15
|
-
var autoLabelWidth = this.elForm.autoLabelWidth;
|
|
16
|
-
var style = {};
|
|
17
|
-
if (autoLabelWidth && autoLabelWidth !== 'auto') {
|
|
18
|
-
var marginLeft = parseInt(autoLabelWidth, 10) - this.computedWidth;
|
|
19
|
-
if (marginLeft) {
|
|
20
|
-
style.marginLeft = marginLeft + 'px';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return h(
|
|
24
|
-
'div',
|
|
25
|
-
{ 'class': 'el-form-item__label-wrap', style: style },
|
|
26
|
-
[slots]
|
|
27
|
-
);
|
|
28
|
-
} else {
|
|
29
|
-
return slots[0];
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
methods: {
|
|
34
|
-
getLabelWidth: function() {
|
|
35
|
-
if (this.$el && this.$el.firstElementChild) {
|
|
36
|
-
var computedWidth = window.getComputedStyle(this.$el.firstElementChild).width;
|
|
37
|
-
return Math.ceil(parseFloat(computedWidth));
|
|
38
|
-
} else {
|
|
39
|
-
return 0;
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
updateLabelWidth: function(action) {
|
|
43
|
-
action = action || 'update';
|
|
44
|
-
if (this.$slots.default && this.isAutoWidth && this.$el.firstElementChild) {
|
|
45
|
-
if (action === 'update') {
|
|
46
|
-
this.computedWidth = this.getLabelWidth();
|
|
47
|
-
} else if (action === 'remove') {
|
|
48
|
-
this.elForm.deregisterLabelWidth(this.computedWidth);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
watch: {
|
|
55
|
-
computedWidth: function(val, oldVal) {
|
|
56
|
-
if (this.updateAll) {
|
|
57
|
-
this.elForm.registerLabelWidth(val, oldVal);
|
|
58
|
-
this.elFormItem.updateComputedLabelWidth(val);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
data: function() {
|
|
64
|
-
return {
|
|
65
|
-
computedWidth: 0
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
mounted: function() {
|
|
70
|
-
this.updateLabelWidth('update');
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
updated: function() {
|
|
74
|
-
this.updateLabelWidth('update');
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
beforeDestroy: function() {
|
|
78
|
-
this.updateLabelWidth('remove');
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
</script>
|