iov-design 2.15.60 → 2.15.61
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/README.md +148 -148
- package/lib/alert.js +24 -105
- package/lib/aside.js +24 -34
- package/lib/autocomplete.js +36 -240
- package/lib/avatar.js +21 -20
- package/lib/backtop.js +27 -52
- package/lib/badge.js +30 -58
- package/lib/breadcrumb-item.js +24 -53
- package/lib/breadcrumb.js +24 -37
- package/lib/button-group.js +24 -29
- package/lib/button.js +38 -60
- package/lib/calendar.js +29 -146
- package/lib/card.js +24 -51
- package/lib/carousel-item.js +30 -68
- package/lib/carousel.js +27 -159
- package/lib/cascader-panel.js +41 -64
- package/lib/cascader.js +37 -470
- package/lib/checkbox-button.js +28 -164
- package/lib/checkbox-group.js +24 -37
- package/lib/checkbox.js +35 -189
- package/lib/col.js +1 -0
- package/lib/collapse-item.js +27 -125
- package/lib/collapse.js +24 -37
- package/lib/color-picker.js +104 -424
- package/lib/container.js +24 -34
- package/lib/date-picker.js +126 -1981
- package/lib/descriptions-item.js +1 -0
- package/lib/descriptions.js +1 -0
- package/lib/dialog.js +24 -137
- package/lib/divider.js +29 -64
- package/lib/drawer.js +24 -139
- package/lib/dropdown-item.js +27 -45
- package/lib/dropdown-menu.js +24 -51
- package/lib/dropdown.js +21 -20
- package/lib/empty.js +24 -61
- package/lib/footer.js +24 -34
- package/lib/form-item.js +42 -128
- package/lib/form.js +27 -40
- package/lib/header.js +24 -34
- package/lib/icon.js +24 -29
- package/lib/image.js +36 -220
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +1 -0
- package/lib/input-number.js +30 -163
- package/lib/input.js +42 -274
- package/lib/iov-design.common.js +1635 -11132
- package/lib/link.js +31 -56
- package/lib/loading.js +24 -77
- package/lib/locale/format.js +10 -10
- package/lib/main.js +24 -29
- package/lib/menu-item-group.js +24 -40
- package/lib/menu-item.js +27 -83
- package/lib/menu.js +21 -20
- package/lib/message-box.js +24 -321
- package/lib/message.js +30 -82
- package/lib/mixins/migrating.js +20 -20
- package/lib/notification.js +24 -109
- package/lib/option-group.js +24 -50
- package/lib/option.js +27 -76
- package/lib/page-header.js +24 -56
- package/lib/pagination.js +24 -97
- package/lib/popconfirm.js +24 -97
- package/lib/popover.js +24 -89
- package/lib/progress.js +30 -133
- package/lib/radio-button.js +29 -111
- package/lib/radio-group.js +24 -39
- package/lib/radio.js +36 -152
- package/lib/rate.js +24 -94
- package/lib/result.js +72 -187
- package/lib/row.js +1 -0
- package/lib/scrollbar.js +1 -0
- package/lib/select.js +48 -637
- package/lib/skeleton-item.js +36 -68
- package/lib/skeleton.js +28 -70
- package/lib/slider.js +36 -267
- package/lib/spinner.js +24 -51
- package/lib/statistic.js +24 -76
- package/lib/step.js +29 -118
- package/lib/steps.js +27 -40
- package/lib/submenu.js +21 -20
- package/lib/switch.js +24 -130
- package/lib/tab-pane.js +24 -52
- package/lib/table-column.js +1 -0
- package/lib/table.js +93 -633
- package/lib/tabs.js +34 -49
- package/lib/tag.js +21 -20
- package/lib/theme-chalk/button.css +1 -1
- package/lib/theme-chalk/calendar.css +1 -1
- package/lib/theme-chalk/dropdown.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/link.css +1 -1
- package/lib/theme-chalk/message-box.css +1 -1
- package/lib/theme-chalk/transfer.css +1 -1
- package/lib/time-picker.js +58 -820
- package/lib/time-select.js +42 -303
- package/lib/timeline-item.js +29 -75
- package/lib/timeline.js +21 -20
- package/lib/tooltip.js +1 -0
- package/lib/transfer.js +36 -299
- package/lib/tree.js +54 -243
- package/lib/upload.js +86 -654
- package/lib/utils/clickoutside.js +7 -7
- package/lib/utils/vue-popper.js +7 -7
- package/package.json +154 -154
- package/packages/autocomplete/src/autocomplete-suggestions.vue +76 -76
- package/packages/autocomplete/src/autocomplete.vue +285 -285
- package/packages/button/src/button.vue +90 -90
- package/packages/calendar/src/date-table.vue +200 -200
- package/packages/calendar/src/main.vue +280 -280
- package/packages/carousel/src/item.vue +138 -138
- package/packages/carousel/src/main.vue +315 -315
- package/packages/cascader/src/cascader.vue +776 -776
- package/packages/cascader-panel/src/cascader-menu.vue +138 -138
- package/packages/cascader-panel/src/cascader-node.vue +246 -246
- package/packages/cascader-panel/src/cascader-panel.vue +391 -391
- package/packages/cascader-panel/src/node.js +166 -166
- package/packages/cascader-panel/src/store.js +58 -58
- package/packages/checkbox/src/checkbox-button.vue +199 -199
- package/packages/checkbox/src/checkbox-group.vue +49 -49
- package/packages/checkbox/src/checkbox.vue +225 -225
- package/packages/collapse/src/collapse-item.vue +114 -114
- package/packages/color-picker/src/components/picker-dropdown.vue +121 -121
- package/packages/color-picker/src/main.vue +188 -188
- package/packages/date-picker/src/basic/date-table.vue +441 -441
- package/packages/date-picker/src/basic/month-table.vue +269 -269
- package/packages/date-picker/src/basic/time-spinner.vue +304 -304
- package/packages/date-picker/src/basic/year-table.vue +111 -111
- package/packages/date-picker/src/panel/date-range.vue +680 -680
- package/packages/date-picker/src/panel/date.vue +609 -609
- package/packages/date-picker/src/panel/month-range.vue +289 -289
- package/packages/date-picker/src/panel/time-range.vue +248 -248
- package/packages/date-picker/src/panel/time-select.vue +178 -178
- package/packages/date-picker/src/panel/time.vue +186 -186
- package/packages/date-picker/src/picker.vue +967 -967
- package/packages/descriptions/src/index.js +180 -180
- package/packages/dialog/src/component.vue +262 -262
- package/packages/drawer/src/main.vue +205 -205
- package/packages/dropdown/src/dropdown-item.vue +37 -37
- package/packages/dropdown/src/dropdown-menu.vue +63 -63
- package/packages/dropdown/src/dropdown.vue +293 -293
- package/packages/empty/src/index.vue +70 -70
- package/packages/form/src/form-item.vue +324 -324
- package/packages/form/src/form.vue +182 -182
- package/packages/image/src/image-viewer.vue +330 -330
- package/packages/image/src/main.vue +249 -249
- package/packages/infinite-scroll/src/main.js +150 -150
- package/packages/input/src/input.vue +477 -477
- package/packages/input-number/src/input-number.vue +283 -283
- package/packages/loading/src/directive.js +133 -133
- package/packages/loading/src/index.js +106 -106
- package/packages/menu/src/menu-item.vue +112 -112
- package/packages/menu/src/menu.vue +325 -325
- package/packages/menu/src/submenu.vue +349 -349
- package/packages/message/src/main.js +91 -91
- package/packages/message-box/src/main.js +216 -216
- package/packages/message-box/src/main.vue +333 -333
- package/packages/notification/src/main.js +94 -94
- package/packages/page-header/src/main.vue +30 -30
- package/packages/pagination/src/pagination.js +390 -390
- package/packages/popconfirm/src/main.vue +104 -104
- package/packages/popover/src/main.vue +239 -239
- package/packages/radio/src/radio-button.vue +115 -115
- package/packages/radio/src/radio-group.vue +115 -115
- package/packages/radio/src/radio.vue +148 -148
- package/packages/rate/src/main.vue +348 -348
- package/packages/scrollbar/src/bar.js +92 -92
- package/packages/scrollbar/src/main.js +130 -130
- package/packages/select/src/option-group.vue +60 -60
- package/packages/select/src/option.vue +171 -171
- package/packages/select/src/select-dropdown.vue +74 -74
- package/packages/select/src/select.vue +979 -979
- package/packages/slider/src/button.vue +238 -238
- package/packages/slider/src/main.vue +427 -427
- package/packages/statistic/src/main.vue +204 -204
- package/packages/steps/src/steps.vue +68 -68
- package/packages/switch/src/component.vue +182 -182
- package/packages/table/src/config.js +153 -153
- package/packages/table/src/filter-panel.vue +194 -194
- package/packages/table/src/store/current.js +76 -76
- package/packages/table/src/store/helper.js +41 -41
- package/packages/table/src/store/index.js +147 -147
- package/packages/table/src/store/watcher.js +502 -502
- package/packages/table/src/table-body.js +469 -469
- package/packages/table/src/table-column.js +328 -328
- package/packages/table/src/table-header.js +571 -571
- package/packages/table/src/table-layout.js +249 -249
- package/packages/table/src/table-row.js +101 -101
- package/packages/table/src/table.vue +740 -740
- package/packages/table/src/util.js +273 -273
- package/packages/tabs/src/tab-bar.vue +57 -57
- package/packages/tabs/src/tab-nav.vue +294 -294
- package/packages/tabs/src/tabs.vue +201 -201
- package/packages/theme-chalk/src/button.scss +416 -416
- package/packages/theme-chalk/src/cascader.scss +252 -252
- package/packages/theme-chalk/src/checkbox.scss +419 -419
- package/packages/theme-chalk/src/common/var.scss +795 -795
- package/packages/theme-chalk/src/form.scss +201 -201
- package/packages/theme-chalk/src/input.scss +591 -591
- package/packages/theme-chalk/src/iovfont.scss +803 -803
- package/packages/theme-chalk/src/link.scss +8 -8
- package/packages/theme-chalk/src/message-box.scss +207 -207
- package/packages/theme-chalk/src/mixins/_button.scss +136 -136
- package/packages/theme-chalk/src/mixins/mixins.scss +190 -190
- package/packages/theme-chalk/src/radio-button.scss +115 -115
- package/packages/theme-chalk/src/select.scss +270 -270
- package/packages/theme-chalk/src/tabs.scss +755 -755
- package/packages/theme-chalk/src/upload.scss +568 -568
- package/packages/tooltip/src/main.js +242 -242
- package/packages/transfer/src/main.vue +231 -231
- package/packages/transfer/src/transfer-panel.vue +251 -251
- package/packages/tree/src/model/node.js +484 -484
- package/packages/tree/src/tree-node.vue +279 -279
- package/packages/tree/src/tree.vue +496 -496
- package/packages/upload/src/index.vue +420 -420
- package/packages/upload/src/upload-file.vue +98 -98
- package/packages/upload/src/upload-list.vue +115 -115
- package/packages/upload/src/upload-picture.vue +98 -98
- package/packages/upload/src/upload.vue +231 -231
- package/packages/upload/src/utils.js +31 -31
- package/src/directives/repeat-click.js +26 -26
- package/src/index.js +259 -259
- package/src/locale/format.js +46 -46
- package/src/locale/index.js +48 -48
- package/src/locale/lang/lo-LA.js +126 -126
- package/src/mixins/locale.js +9 -9
- package/src/mixins/migrating.js +54 -54
- package/src/transitions/collapse-transition.js +77 -77
- package/src/utils/clickoutside.js +76 -76
- package/src/utils/date-util.js +282 -282
- package/src/utils/popup/index.js +218 -218
- package/src/utils/popup/popup-manager.js +194 -194
- package/src/utils/util.js +245 -245
- package/src/utils/vdom.js +5 -5
- package/src/utils/vue-popper.js +198 -198
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="el-switch"
|
|
4
|
-
:class="[ size ? 'el-switch--' + size : '', type ? 'el-switch--' + type : '', {'is-disabled': switchDisabled}, {'is-checked': checked} ]"
|
|
5
|
-
role="switch"
|
|
6
|
-
:aria-checked="checked"
|
|
7
|
-
:aria-disabled="switchDisabled"
|
|
8
|
-
@click.prevent="switchValue"
|
|
9
|
-
>
|
|
10
|
-
<input
|
|
11
|
-
class="el-switch__input"
|
|
12
|
-
type="checkbox"
|
|
13
|
-
@change="handleChange"
|
|
14
|
-
ref="input"
|
|
15
|
-
:id="id"
|
|
16
|
-
:name="name"
|
|
17
|
-
:true-value="activeValue"
|
|
18
|
-
:false-value="inactiveValue"
|
|
19
|
-
:disabled="switchDisabled"
|
|
20
|
-
@keydown.enter="switchValue"
|
|
21
|
-
>
|
|
22
|
-
<span
|
|
23
|
-
:class="['el-switch__label', 'el-switch__label--left', inactiveIconClass ? 'el-switch__label--left-icon' : '', inactiveText ? 'el-switch__label--left-text' : '', !checked ? 'is-active' : '']"
|
|
24
|
-
v-if="inactiveIconClass || inactiveText">
|
|
25
|
-
<i :class="[inactiveIconClass]" v-if="inactiveIconClass"></i>
|
|
26
|
-
<span v-if="!inactiveIconClass && inactiveText" :aria-hidden="checked">{{ inactiveText }}</span>
|
|
27
|
-
</span>
|
|
28
|
-
<span class="el-switch__core" ref="core" :style="{ 'width': coreWidth > 0 ? coreWidth + 'px' : '' }">
|
|
29
|
-
</span>
|
|
30
|
-
<span
|
|
31
|
-
:class="['el-switch__label', 'el-switch__label--right', activeIconClass ? 'el-switch__label--right-icon' : '', activeText ? 'el-switch__label--right-text' : '', checked ? 'is-active' : '']"
|
|
32
|
-
v-if="activeIconClass || activeText">
|
|
33
|
-
<i :class="[activeIconClass]" v-if="activeIconClass"></i>
|
|
34
|
-
<span v-if="!activeIconClass && activeText" :aria-hidden="!checked">{{ activeText }}</span>
|
|
35
|
-
</span>
|
|
36
|
-
</div>
|
|
37
|
-
</template>
|
|
38
|
-
<script>
|
|
39
|
-
import emitter from 'iov-design/src/mixins/emitter';
|
|
40
|
-
import Focus from 'iov-design/src/mixins/focus';
|
|
41
|
-
import Migrating from 'iov-design/src/mixins/migrating';
|
|
42
|
-
|
|
43
|
-
export default {
|
|
44
|
-
name: 'ElSwitch',
|
|
45
|
-
mixins: [Focus('input'), Migrating, emitter],
|
|
46
|
-
inject: {
|
|
47
|
-
elForm: {
|
|
48
|
-
default: ''
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
props: {
|
|
52
|
-
value: {
|
|
53
|
-
type: [Boolean, String, Number],
|
|
54
|
-
default: false
|
|
55
|
-
},
|
|
56
|
-
disabled: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false
|
|
59
|
-
},
|
|
60
|
-
width: {
|
|
61
|
-
type: Number,
|
|
62
|
-
default: 0
|
|
63
|
-
},
|
|
64
|
-
activeIconClass: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: ''
|
|
67
|
-
},
|
|
68
|
-
inactiveIconClass: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: ''
|
|
71
|
-
},
|
|
72
|
-
activeText: String,
|
|
73
|
-
inactiveText: String,
|
|
74
|
-
activeColor: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: ''
|
|
77
|
-
},
|
|
78
|
-
inactiveColor: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: ''
|
|
81
|
-
},
|
|
82
|
-
activeValue: {
|
|
83
|
-
type: [Boolean, String, Number],
|
|
84
|
-
default: true
|
|
85
|
-
},
|
|
86
|
-
inactiveValue: {
|
|
87
|
-
type: [Boolean, String, Number],
|
|
88
|
-
default: false
|
|
89
|
-
},
|
|
90
|
-
name: {
|
|
91
|
-
type: String,
|
|
92
|
-
default: ''
|
|
93
|
-
},
|
|
94
|
-
validateEvent: {
|
|
95
|
-
type: Boolean,
|
|
96
|
-
default: true
|
|
97
|
-
},
|
|
98
|
-
size: {
|
|
99
|
-
type: String,
|
|
100
|
-
default: ''
|
|
101
|
-
},
|
|
102
|
-
type: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: 'circle'
|
|
105
|
-
},
|
|
106
|
-
id: String
|
|
107
|
-
},
|
|
108
|
-
data() {
|
|
109
|
-
return {
|
|
110
|
-
coreWidth: this.width
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
created() {
|
|
114
|
-
if (!~[this.activeValue, this.inactiveValue].indexOf(this.value)) {
|
|
115
|
-
this.$emit('input', this.inactiveValue);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
computed: {
|
|
119
|
-
checked() {
|
|
120
|
-
return this.value === this.activeValue;
|
|
121
|
-
},
|
|
122
|
-
switchDisabled() {
|
|
123
|
-
return this.disabled || (this.elForm || {}).disabled;
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
watch: {
|
|
127
|
-
checked() {
|
|
128
|
-
this.$refs.input.checked = this.checked;
|
|
129
|
-
if (this.activeColor || this.inactiveColor) {
|
|
130
|
-
this.setBackgroundColor();
|
|
131
|
-
}
|
|
132
|
-
if (this.validateEvent) {
|
|
133
|
-
this.dispatch('ElFormItem', 'el.form.change', [this.value]);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
methods: {
|
|
138
|
-
handleChange(event) {
|
|
139
|
-
const val = this.checked ? this.inactiveValue : this.activeValue;
|
|
140
|
-
this.$emit('input', val);
|
|
141
|
-
this.$emit('change', val);
|
|
142
|
-
this.$nextTick(() => {
|
|
143
|
-
// set input's checked property
|
|
144
|
-
// in case parent refuses to change component's value
|
|
145
|
-
if (this.$refs.input) {
|
|
146
|
-
this.$refs.input.checked = this.checked;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
},
|
|
150
|
-
setBackgroundColor() {
|
|
151
|
-
let newColor = this.checked ? this.activeColor : this.inactiveColor;
|
|
152
|
-
this.$refs.core.style.borderColor = newColor;
|
|
153
|
-
this.$refs.core.style.backgroundColor = newColor;
|
|
154
|
-
},
|
|
155
|
-
switchValue() {
|
|
156
|
-
!this.switchDisabled && this.handleChange();
|
|
157
|
-
},
|
|
158
|
-
getMigratingConfig() {
|
|
159
|
-
return {
|
|
160
|
-
props: {
|
|
161
|
-
'on-color': 'on-color is renamed to active-color.',
|
|
162
|
-
'off-color': 'off-color is renamed to inactive-color.',
|
|
163
|
-
'on-text': 'on-text is renamed to active-text.',
|
|
164
|
-
'off-text': 'off-text is renamed to inactive-text.',
|
|
165
|
-
'on-value': 'on-value is renamed to active-value.',
|
|
166
|
-
'off-value': 'off-value is renamed to inactive-value.',
|
|
167
|
-
'on-icon-class': 'on-icon-class is renamed to active-icon-class.',
|
|
168
|
-
'off-icon-class': 'off-icon-class is renamed to inactive-icon-class.'
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
mounted() {
|
|
174
|
-
/* istanbul ignore if */
|
|
175
|
-
this.coreWidth = this.width;
|
|
176
|
-
if (this.activeColor || this.inactiveColor) {
|
|
177
|
-
this.setBackgroundColor();
|
|
178
|
-
}
|
|
179
|
-
this.$refs.input.checked = this.checked;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="el-switch"
|
|
4
|
+
:class="[ size ? 'el-switch--' + size : '', type ? 'el-switch--' + type : '', {'is-disabled': switchDisabled}, {'is-checked': checked} ]"
|
|
5
|
+
role="switch"
|
|
6
|
+
:aria-checked="checked"
|
|
7
|
+
:aria-disabled="switchDisabled"
|
|
8
|
+
@click.prevent="switchValue"
|
|
9
|
+
>
|
|
10
|
+
<input
|
|
11
|
+
class="el-switch__input"
|
|
12
|
+
type="checkbox"
|
|
13
|
+
@change="handleChange"
|
|
14
|
+
ref="input"
|
|
15
|
+
:id="id"
|
|
16
|
+
:name="name"
|
|
17
|
+
:true-value="activeValue"
|
|
18
|
+
:false-value="inactiveValue"
|
|
19
|
+
:disabled="switchDisabled"
|
|
20
|
+
@keydown.enter="switchValue"
|
|
21
|
+
>
|
|
22
|
+
<span
|
|
23
|
+
:class="['el-switch__label', 'el-switch__label--left', inactiveIconClass ? 'el-switch__label--left-icon' : '', inactiveText ? 'el-switch__label--left-text' : '', !checked ? 'is-active' : '']"
|
|
24
|
+
v-if="inactiveIconClass || inactiveText">
|
|
25
|
+
<i :class="[inactiveIconClass]" v-if="inactiveIconClass"></i>
|
|
26
|
+
<span v-if="!inactiveIconClass && inactiveText" :aria-hidden="checked">{{ inactiveText }}</span>
|
|
27
|
+
</span>
|
|
28
|
+
<span class="el-switch__core" ref="core" :style="{ 'width': coreWidth > 0 ? coreWidth + 'px' : '' }">
|
|
29
|
+
</span>
|
|
30
|
+
<span
|
|
31
|
+
:class="['el-switch__label', 'el-switch__label--right', activeIconClass ? 'el-switch__label--right-icon' : '', activeText ? 'el-switch__label--right-text' : '', checked ? 'is-active' : '']"
|
|
32
|
+
v-if="activeIconClass || activeText">
|
|
33
|
+
<i :class="[activeIconClass]" v-if="activeIconClass"></i>
|
|
34
|
+
<span v-if="!activeIconClass && activeText" :aria-hidden="!checked">{{ activeText }}</span>
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import emitter from 'iov-design/src/mixins/emitter';
|
|
40
|
+
import Focus from 'iov-design/src/mixins/focus';
|
|
41
|
+
import Migrating from 'iov-design/src/mixins/migrating';
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: 'ElSwitch',
|
|
45
|
+
mixins: [Focus('input'), Migrating, emitter],
|
|
46
|
+
inject: {
|
|
47
|
+
elForm: {
|
|
48
|
+
default: ''
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
props: {
|
|
52
|
+
value: {
|
|
53
|
+
type: [Boolean, String, Number],
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
disabled: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false
|
|
59
|
+
},
|
|
60
|
+
width: {
|
|
61
|
+
type: Number,
|
|
62
|
+
default: 0
|
|
63
|
+
},
|
|
64
|
+
activeIconClass: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ''
|
|
67
|
+
},
|
|
68
|
+
inactiveIconClass: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ''
|
|
71
|
+
},
|
|
72
|
+
activeText: String,
|
|
73
|
+
inactiveText: String,
|
|
74
|
+
activeColor: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: ''
|
|
77
|
+
},
|
|
78
|
+
inactiveColor: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: ''
|
|
81
|
+
},
|
|
82
|
+
activeValue: {
|
|
83
|
+
type: [Boolean, String, Number],
|
|
84
|
+
default: true
|
|
85
|
+
},
|
|
86
|
+
inactiveValue: {
|
|
87
|
+
type: [Boolean, String, Number],
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
name: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: ''
|
|
93
|
+
},
|
|
94
|
+
validateEvent: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: true
|
|
97
|
+
},
|
|
98
|
+
size: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: ''
|
|
101
|
+
},
|
|
102
|
+
type: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: 'circle'
|
|
105
|
+
},
|
|
106
|
+
id: String
|
|
107
|
+
},
|
|
108
|
+
data() {
|
|
109
|
+
return {
|
|
110
|
+
coreWidth: this.width
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
created() {
|
|
114
|
+
if (!~[this.activeValue, this.inactiveValue].indexOf(this.value)) {
|
|
115
|
+
this.$emit('input', this.inactiveValue);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
computed: {
|
|
119
|
+
checked() {
|
|
120
|
+
return this.value === this.activeValue;
|
|
121
|
+
},
|
|
122
|
+
switchDisabled() {
|
|
123
|
+
return this.disabled || (this.elForm || {}).disabled;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
watch: {
|
|
127
|
+
checked() {
|
|
128
|
+
this.$refs.input.checked = this.checked;
|
|
129
|
+
if (this.activeColor || this.inactiveColor) {
|
|
130
|
+
this.setBackgroundColor();
|
|
131
|
+
}
|
|
132
|
+
if (this.validateEvent) {
|
|
133
|
+
this.dispatch('ElFormItem', 'el.form.change', [this.value]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
handleChange(event) {
|
|
139
|
+
const val = this.checked ? this.inactiveValue : this.activeValue;
|
|
140
|
+
this.$emit('input', val);
|
|
141
|
+
this.$emit('change', val);
|
|
142
|
+
this.$nextTick(() => {
|
|
143
|
+
// set input's checked property
|
|
144
|
+
// in case parent refuses to change component's value
|
|
145
|
+
if (this.$refs.input) {
|
|
146
|
+
this.$refs.input.checked = this.checked;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
setBackgroundColor() {
|
|
151
|
+
let newColor = this.checked ? this.activeColor : this.inactiveColor;
|
|
152
|
+
this.$refs.core.style.borderColor = newColor;
|
|
153
|
+
this.$refs.core.style.backgroundColor = newColor;
|
|
154
|
+
},
|
|
155
|
+
switchValue() {
|
|
156
|
+
!this.switchDisabled && this.handleChange();
|
|
157
|
+
},
|
|
158
|
+
getMigratingConfig() {
|
|
159
|
+
return {
|
|
160
|
+
props: {
|
|
161
|
+
'on-color': 'on-color is renamed to active-color.',
|
|
162
|
+
'off-color': 'off-color is renamed to inactive-color.',
|
|
163
|
+
'on-text': 'on-text is renamed to active-text.',
|
|
164
|
+
'off-text': 'off-text is renamed to inactive-text.',
|
|
165
|
+
'on-value': 'on-value is renamed to active-value.',
|
|
166
|
+
'off-value': 'off-value is renamed to inactive-value.',
|
|
167
|
+
'on-icon-class': 'on-icon-class is renamed to active-icon-class.',
|
|
168
|
+
'off-icon-class': 'off-icon-class is renamed to inactive-icon-class.'
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
mounted() {
|
|
174
|
+
/* istanbul ignore if */
|
|
175
|
+
this.coreWidth = this.width;
|
|
176
|
+
if (this.activeColor || this.inactiveColor) {
|
|
177
|
+
this.setBackgroundColor();
|
|
178
|
+
}
|
|
179
|
+
this.$refs.input.checked = this.checked;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
</script>
|
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
import { getPropByPath } from 'iov-design/src/utils/util';
|
|
2
|
-
|
|
3
|
-
export const cellStarts = {
|
|
4
|
-
default: {
|
|
5
|
-
order: ''
|
|
6
|
-
},
|
|
7
|
-
selection: {
|
|
8
|
-
width: 48,
|
|
9
|
-
minWidth: 48,
|
|
10
|
-
realWidth: 48,
|
|
11
|
-
order: '',
|
|
12
|
-
className: 'el-table-column--selection'
|
|
13
|
-
},
|
|
14
|
-
expand: {
|
|
15
|
-
width: 48,
|
|
16
|
-
minWidth: 48,
|
|
17
|
-
realWidth: 48,
|
|
18
|
-
order: ''
|
|
19
|
-
},
|
|
20
|
-
index: {
|
|
21
|
-
width: 48,
|
|
22
|
-
minWidth: 48,
|
|
23
|
-
realWidth: 48,
|
|
24
|
-
order: ''
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// 这些选项不应该被覆盖
|
|
29
|
-
export const cellForced = {
|
|
30
|
-
selection: {
|
|
31
|
-
renderHeader: function(h, { store }) {
|
|
32
|
-
const { selection, data, rowKey } = store.states;
|
|
33
|
-
let indeterminate = selection.length > 0 && !(selection.length === data.length);
|
|
34
|
-
|
|
35
|
-
if (rowKey) {
|
|
36
|
-
// 全选: v-model - true, indeterminate - false
|
|
37
|
-
// 半选: v-model - false, indeterminate - true
|
|
38
|
-
// 不选:v-model - false, indeterminate - false
|
|
39
|
-
|
|
40
|
-
// 已选择的数据中是否包括当前页的数据项 && !当前页数据全部选中
|
|
41
|
-
indeterminate = selection.some(o => data.some(row => row[rowKey] === o[rowKey])) && !(data.every(row => selection.some(o => row[rowKey] === o[rowKey])));
|
|
42
|
-
}
|
|
43
|
-
return [<el-checkbox
|
|
44
|
-
disabled={ data && data.length === 0 }
|
|
45
|
-
indeterminate={ indeterminate }
|
|
46
|
-
on-input={ this.toggleAllSelection }
|
|
47
|
-
value={ this.isAllSelected } />,
|
|
48
|
-
this.table.crossPageSelection && <el-dropdown
|
|
49
|
-
class="el-table__cross-page-selection"
|
|
50
|
-
placement="bottom-start"
|
|
51
|
-
trigger="click"
|
|
52
|
-
size="small"
|
|
53
|
-
onCommand={command => this.onSelectionChange(command, this.scope)}
|
|
54
|
-
on-visible-change={this.onVisibleChange}
|
|
55
|
-
>
|
|
56
|
-
<i class={['iov-icon-arrow-down', this.store.states.showSelectionDropdown ? 'show-selection-dropdown' : '']} />
|
|
57
|
-
<el-dropdown-menu slot="dropdown" class="table-selection__dropdown">
|
|
58
|
-
<el-dropdown-item disabled={ data && data.length === 0 } command={1}>全选当页</el-dropdown-item>
|
|
59
|
-
<el-dropdown-item disabled={ data && data.length === 0 } command={3}>全选所有页</el-dropdown-item>
|
|
60
|
-
<el-dropdown-item disabled={ data && data.length === 0 } command={2}>清空当页</el-dropdown-item>
|
|
61
|
-
<el-dropdown-item disabled={ data && data.length === 0 } command={4}>清空所有页</el-dropdown-item>
|
|
62
|
-
</el-dropdown-menu>
|
|
63
|
-
</el-dropdown>
|
|
64
|
-
];
|
|
65
|
-
},
|
|
66
|
-
renderCell: function(h, { row, column, isSelected, store, $index }) {
|
|
67
|
-
return <el-checkbox
|
|
68
|
-
nativeOn-click={ (event) => event.stopPropagation() }
|
|
69
|
-
value={ isSelected }
|
|
70
|
-
disabled={ column.selectable ? !column.selectable.call(null, row, $index) : false }
|
|
71
|
-
on-input={ () => { store.commit('rowSelectedChanged', row); } }
|
|
72
|
-
/>;
|
|
73
|
-
},
|
|
74
|
-
sortable: false,
|
|
75
|
-
resizable: false
|
|
76
|
-
},
|
|
77
|
-
index: {
|
|
78
|
-
renderHeader: function(h, { column }) {
|
|
79
|
-
return column.label || '#';
|
|
80
|
-
},
|
|
81
|
-
renderCell: function(h, { $index, column }) {
|
|
82
|
-
let i = $index + 1;
|
|
83
|
-
const index = column.index;
|
|
84
|
-
|
|
85
|
-
if (typeof index === 'number') {
|
|
86
|
-
i = $index + index;
|
|
87
|
-
} else if (typeof index === 'function') {
|
|
88
|
-
i = index($index);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return <div>{ i }</div>;
|
|
92
|
-
},
|
|
93
|
-
sortable: false
|
|
94
|
-
},
|
|
95
|
-
expand: {
|
|
96
|
-
renderHeader: function(h, { column }) {
|
|
97
|
-
return column.label || '';
|
|
98
|
-
},
|
|
99
|
-
renderCell: function(h, { row, store, isExpanded }) {
|
|
100
|
-
const classes = ['el-table__expand-icon'];
|
|
101
|
-
if (isExpanded) {
|
|
102
|
-
classes.push('el-table__expand-icon--expanded');
|
|
103
|
-
}
|
|
104
|
-
const callback = function(e) {
|
|
105
|
-
e.stopPropagation();
|
|
106
|
-
store.toggleRowExpansion(row);
|
|
107
|
-
};
|
|
108
|
-
return (<div class={ classes }
|
|
109
|
-
on-click={callback}>
|
|
110
|
-
<i class='el-icon'></i>
|
|
111
|
-
</div>);
|
|
112
|
-
},
|
|
113
|
-
sortable: false,
|
|
114
|
-
resizable: false,
|
|
115
|
-
className: 'el-table__expand-column'
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export function defaultRenderCell(h, { row, column, $index }) {
|
|
120
|
-
const property = column.property;
|
|
121
|
-
const emptyValuePlaceholder = column.emptyValuePlaceholder;
|
|
122
|
-
const value = property && getPropByPath(row, property).v;
|
|
123
|
-
if (column && column.formatter) {
|
|
124
|
-
return column.formatter(row, column, value, $index);
|
|
125
|
-
}
|
|
126
|
-
return emptyValuePlaceholder && ['', undefined, null].includes(value) ? emptyValuePlaceholder : value;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function treeCellPrefix(h, { row, treeNode, store }) {
|
|
130
|
-
if (!treeNode) return null;
|
|
131
|
-
const ele = [];
|
|
132
|
-
const callback = function(e) {
|
|
133
|
-
e.stopPropagation();
|
|
134
|
-
store.loadOrToggle(row);
|
|
135
|
-
};
|
|
136
|
-
if (treeNode.indent) {
|
|
137
|
-
ele.push(<span class="el-table__indent" style={{'padding-left': treeNode.indent + 'px'}}></span>);
|
|
138
|
-
}
|
|
139
|
-
if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
|
|
140
|
-
const expandClasses = ['el-table__expand-icon', treeNode.expanded ? 'el-table__expand-icon--expanded' : ''];
|
|
141
|
-
let iconClasses = ['el-icon'];
|
|
142
|
-
if (treeNode.loading) {
|
|
143
|
-
iconClasses = ['iov-icon-loading'];
|
|
144
|
-
}
|
|
145
|
-
ele.push(<div class={ expandClasses }
|
|
146
|
-
on-click={ callback }>
|
|
147
|
-
<i class={ iconClasses }></i>
|
|
148
|
-
</div>);
|
|
149
|
-
} else {
|
|
150
|
-
ele.push(<span class="el-table__placeholder"></span>);
|
|
151
|
-
}
|
|
152
|
-
return ele;
|
|
153
|
-
}
|
|
1
|
+
import { getPropByPath } from 'iov-design/src/utils/util';
|
|
2
|
+
|
|
3
|
+
export const cellStarts = {
|
|
4
|
+
default: {
|
|
5
|
+
order: ''
|
|
6
|
+
},
|
|
7
|
+
selection: {
|
|
8
|
+
width: 48,
|
|
9
|
+
minWidth: 48,
|
|
10
|
+
realWidth: 48,
|
|
11
|
+
order: '',
|
|
12
|
+
className: 'el-table-column--selection'
|
|
13
|
+
},
|
|
14
|
+
expand: {
|
|
15
|
+
width: 48,
|
|
16
|
+
minWidth: 48,
|
|
17
|
+
realWidth: 48,
|
|
18
|
+
order: ''
|
|
19
|
+
},
|
|
20
|
+
index: {
|
|
21
|
+
width: 48,
|
|
22
|
+
minWidth: 48,
|
|
23
|
+
realWidth: 48,
|
|
24
|
+
order: ''
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 这些选项不应该被覆盖
|
|
29
|
+
export const cellForced = {
|
|
30
|
+
selection: {
|
|
31
|
+
renderHeader: function(h, { store }) {
|
|
32
|
+
const { selection, data, rowKey } = store.states;
|
|
33
|
+
let indeterminate = selection.length > 0 && !(selection.length === data.length);
|
|
34
|
+
|
|
35
|
+
if (rowKey) {
|
|
36
|
+
// 全选: v-model - true, indeterminate - false
|
|
37
|
+
// 半选: v-model - false, indeterminate - true
|
|
38
|
+
// 不选:v-model - false, indeterminate - false
|
|
39
|
+
|
|
40
|
+
// 已选择的数据中是否包括当前页的数据项 && !当前页数据全部选中
|
|
41
|
+
indeterminate = selection.some(o => data.some(row => row[rowKey] === o[rowKey])) && !(data.every(row => selection.some(o => row[rowKey] === o[rowKey])));
|
|
42
|
+
}
|
|
43
|
+
return [<el-checkbox
|
|
44
|
+
disabled={ data && data.length === 0 }
|
|
45
|
+
indeterminate={ indeterminate }
|
|
46
|
+
on-input={ this.toggleAllSelection }
|
|
47
|
+
value={ this.isAllSelected } />,
|
|
48
|
+
this.table.crossPageSelection && <el-dropdown
|
|
49
|
+
class="el-table__cross-page-selection"
|
|
50
|
+
placement="bottom-start"
|
|
51
|
+
trigger="click"
|
|
52
|
+
size="small"
|
|
53
|
+
onCommand={command => this.onSelectionChange(command, this.scope)}
|
|
54
|
+
on-visible-change={this.onVisibleChange}
|
|
55
|
+
>
|
|
56
|
+
<i class={['iov-icon-arrow-down', this.store.states.showSelectionDropdown ? 'show-selection-dropdown' : '']} />
|
|
57
|
+
<el-dropdown-menu slot="dropdown" class="table-selection__dropdown">
|
|
58
|
+
<el-dropdown-item disabled={ data && data.length === 0 } command={1}>全选当页</el-dropdown-item>
|
|
59
|
+
<el-dropdown-item disabled={ data && data.length === 0 } command={3}>全选所有页</el-dropdown-item>
|
|
60
|
+
<el-dropdown-item disabled={ data && data.length === 0 } command={2}>清空当页</el-dropdown-item>
|
|
61
|
+
<el-dropdown-item disabled={ data && data.length === 0 } command={4}>清空所有页</el-dropdown-item>
|
|
62
|
+
</el-dropdown-menu>
|
|
63
|
+
</el-dropdown>
|
|
64
|
+
];
|
|
65
|
+
},
|
|
66
|
+
renderCell: function(h, { row, column, isSelected, store, $index }) {
|
|
67
|
+
return <el-checkbox
|
|
68
|
+
nativeOn-click={ (event) => event.stopPropagation() }
|
|
69
|
+
value={ isSelected }
|
|
70
|
+
disabled={ column.selectable ? !column.selectable.call(null, row, $index) : false }
|
|
71
|
+
on-input={ () => { store.commit('rowSelectedChanged', row); } }
|
|
72
|
+
/>;
|
|
73
|
+
},
|
|
74
|
+
sortable: false,
|
|
75
|
+
resizable: false
|
|
76
|
+
},
|
|
77
|
+
index: {
|
|
78
|
+
renderHeader: function(h, { column }) {
|
|
79
|
+
return column.label || '#';
|
|
80
|
+
},
|
|
81
|
+
renderCell: function(h, { $index, column }) {
|
|
82
|
+
let i = $index + 1;
|
|
83
|
+
const index = column.index;
|
|
84
|
+
|
|
85
|
+
if (typeof index === 'number') {
|
|
86
|
+
i = $index + index;
|
|
87
|
+
} else if (typeof index === 'function') {
|
|
88
|
+
i = index($index);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return <div>{ i }</div>;
|
|
92
|
+
},
|
|
93
|
+
sortable: false
|
|
94
|
+
},
|
|
95
|
+
expand: {
|
|
96
|
+
renderHeader: function(h, { column }) {
|
|
97
|
+
return column.label || '';
|
|
98
|
+
},
|
|
99
|
+
renderCell: function(h, { row, store, isExpanded }) {
|
|
100
|
+
const classes = ['el-table__expand-icon'];
|
|
101
|
+
if (isExpanded) {
|
|
102
|
+
classes.push('el-table__expand-icon--expanded');
|
|
103
|
+
}
|
|
104
|
+
const callback = function(e) {
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
store.toggleRowExpansion(row);
|
|
107
|
+
};
|
|
108
|
+
return (<div class={ classes }
|
|
109
|
+
on-click={callback}>
|
|
110
|
+
<i class='el-icon'></i>
|
|
111
|
+
</div>);
|
|
112
|
+
},
|
|
113
|
+
sortable: false,
|
|
114
|
+
resizable: false,
|
|
115
|
+
className: 'el-table__expand-column'
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export function defaultRenderCell(h, { row, column, $index }) {
|
|
120
|
+
const property = column.property;
|
|
121
|
+
const emptyValuePlaceholder = column.emptyValuePlaceholder;
|
|
122
|
+
const value = property && getPropByPath(row, property).v;
|
|
123
|
+
if (column && column.formatter) {
|
|
124
|
+
return column.formatter(row, column, value, $index);
|
|
125
|
+
}
|
|
126
|
+
return emptyValuePlaceholder && ['', undefined, null].includes(value) ? emptyValuePlaceholder : value;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function treeCellPrefix(h, { row, treeNode, store }) {
|
|
130
|
+
if (!treeNode) return null;
|
|
131
|
+
const ele = [];
|
|
132
|
+
const callback = function(e) {
|
|
133
|
+
e.stopPropagation();
|
|
134
|
+
store.loadOrToggle(row);
|
|
135
|
+
};
|
|
136
|
+
if (treeNode.indent) {
|
|
137
|
+
ele.push(<span class="el-table__indent" style={{'padding-left': treeNode.indent + 'px'}}></span>);
|
|
138
|
+
}
|
|
139
|
+
if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
|
|
140
|
+
const expandClasses = ['el-table__expand-icon', treeNode.expanded ? 'el-table__expand-icon--expanded' : ''];
|
|
141
|
+
let iconClasses = ['el-icon'];
|
|
142
|
+
if (treeNode.loading) {
|
|
143
|
+
iconClasses = ['iov-icon-loading'];
|
|
144
|
+
}
|
|
145
|
+
ele.push(<div class={ expandClasses }
|
|
146
|
+
on-click={ callback }>
|
|
147
|
+
<i class={ iconClasses }></i>
|
|
148
|
+
</div>);
|
|
149
|
+
} else {
|
|
150
|
+
ele.push(<span class="el-table__placeholder"></span>);
|
|
151
|
+
}
|
|
152
|
+
return ele;
|
|
153
|
+
}
|