iov-design 2.15.60 → 2.15.62
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/autocomplete.css +1 -1
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/cascader.css +1 -1
- package/lib/theme-chalk/date-picker.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/input-number.css +1 -1
- package/lib/theme-chalk/input.css +1 -1
- package/lib/theme-chalk/iovfont.css +1 -1
- package/lib/theme-chalk/link.css +1 -1
- package/lib/theme-chalk/message-box.css +1 -1
- package/lib/theme-chalk/pagination.css +1 -1
- package/lib/theme-chalk/select.css +1 -1
- package/lib/theme-chalk/slider.css +1 -1
- package/lib/theme-chalk/time-picker.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 +818 -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,104 +1,104 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-popover
|
|
3
|
-
v-bind="$attrs"
|
|
4
|
-
v-model="visible"
|
|
5
|
-
trigger="click"
|
|
6
|
-
>
|
|
7
|
-
<div class="el-popconfirm">
|
|
8
|
-
<p class="el-popconfirm__main">
|
|
9
|
-
<i
|
|
10
|
-
v-if="!hideIcon"
|
|
11
|
-
:class="icon"
|
|
12
|
-
class="el-popconfirm__icon"
|
|
13
|
-
:style="{color: iconColor}"
|
|
14
|
-
></i>
|
|
15
|
-
{{title}}
|
|
16
|
-
</p>
|
|
17
|
-
<div class="el-popconfirm__action">
|
|
18
|
-
<el-button
|
|
19
|
-
size="mini"
|
|
20
|
-
:type="cancelButtonType"
|
|
21
|
-
@click="cancel"
|
|
22
|
-
>
|
|
23
|
-
{{ displayCancelButtonText }}
|
|
24
|
-
</el-button>
|
|
25
|
-
<el-button
|
|
26
|
-
size="mini"
|
|
27
|
-
:type="confirmButtonType"
|
|
28
|
-
@click="confirm"
|
|
29
|
-
>
|
|
30
|
-
{{ displayConfirmButtonText }}
|
|
31
|
-
</el-button>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
<slot name="reference" slot="reference"></slot>
|
|
35
|
-
</el-popover>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script>
|
|
39
|
-
import ElPopover from 'iov-design/packages/popover';
|
|
40
|
-
import ElButton from 'iov-design/packages/button';
|
|
41
|
-
import {t} from 'iov-design/src/locale';
|
|
42
|
-
|
|
43
|
-
export default {
|
|
44
|
-
name: 'ElPopconfirm',
|
|
45
|
-
props: {
|
|
46
|
-
title: {
|
|
47
|
-
type: String
|
|
48
|
-
},
|
|
49
|
-
confirmButtonText: {
|
|
50
|
-
type: String
|
|
51
|
-
},
|
|
52
|
-
cancelButtonText: {
|
|
53
|
-
type: String
|
|
54
|
-
},
|
|
55
|
-
confirmButtonType: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: 'primary'
|
|
58
|
-
},
|
|
59
|
-
cancelButtonType: {
|
|
60
|
-
type: String,
|
|
61
|
-
default: 'text'
|
|
62
|
-
},
|
|
63
|
-
icon: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: 'el-icon-question'
|
|
66
|
-
},
|
|
67
|
-
iconColor: {
|
|
68
|
-
type: String,
|
|
69
|
-
default: '#f90'
|
|
70
|
-
},
|
|
71
|
-
hideIcon: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: false
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
components: {
|
|
77
|
-
ElPopover,
|
|
78
|
-
ElButton
|
|
79
|
-
},
|
|
80
|
-
data() {
|
|
81
|
-
return {
|
|
82
|
-
visible: false
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
computed: {
|
|
86
|
-
displayConfirmButtonText() {
|
|
87
|
-
return this.confirmButtonText || t('el.popconfirm.confirmButtonText');
|
|
88
|
-
},
|
|
89
|
-
displayCancelButtonText() {
|
|
90
|
-
return this.cancelButtonText || t('el.popconfirm.cancelButtonText');
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
methods: {
|
|
94
|
-
confirm() {
|
|
95
|
-
this.visible = false;
|
|
96
|
-
this.$emit('confirm');
|
|
97
|
-
},
|
|
98
|
-
cancel() {
|
|
99
|
-
this.visible = false;
|
|
100
|
-
this.$emit('cancel');
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-popover
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
v-model="visible"
|
|
5
|
+
trigger="click"
|
|
6
|
+
>
|
|
7
|
+
<div class="el-popconfirm">
|
|
8
|
+
<p class="el-popconfirm__main">
|
|
9
|
+
<i
|
|
10
|
+
v-if="!hideIcon"
|
|
11
|
+
:class="icon"
|
|
12
|
+
class="el-popconfirm__icon"
|
|
13
|
+
:style="{color: iconColor}"
|
|
14
|
+
></i>
|
|
15
|
+
{{title}}
|
|
16
|
+
</p>
|
|
17
|
+
<div class="el-popconfirm__action">
|
|
18
|
+
<el-button
|
|
19
|
+
size="mini"
|
|
20
|
+
:type="cancelButtonType"
|
|
21
|
+
@click="cancel"
|
|
22
|
+
>
|
|
23
|
+
{{ displayCancelButtonText }}
|
|
24
|
+
</el-button>
|
|
25
|
+
<el-button
|
|
26
|
+
size="mini"
|
|
27
|
+
:type="confirmButtonType"
|
|
28
|
+
@click="confirm"
|
|
29
|
+
>
|
|
30
|
+
{{ displayConfirmButtonText }}
|
|
31
|
+
</el-button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<slot name="reference" slot="reference"></slot>
|
|
35
|
+
</el-popover>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import ElPopover from 'iov-design/packages/popover';
|
|
40
|
+
import ElButton from 'iov-design/packages/button';
|
|
41
|
+
import {t} from 'iov-design/src/locale';
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: 'ElPopconfirm',
|
|
45
|
+
props: {
|
|
46
|
+
title: {
|
|
47
|
+
type: String
|
|
48
|
+
},
|
|
49
|
+
confirmButtonText: {
|
|
50
|
+
type: String
|
|
51
|
+
},
|
|
52
|
+
cancelButtonText: {
|
|
53
|
+
type: String
|
|
54
|
+
},
|
|
55
|
+
confirmButtonType: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'primary'
|
|
58
|
+
},
|
|
59
|
+
cancelButtonType: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'text'
|
|
62
|
+
},
|
|
63
|
+
icon: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'el-icon-question'
|
|
66
|
+
},
|
|
67
|
+
iconColor: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: '#f90'
|
|
70
|
+
},
|
|
71
|
+
hideIcon: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
components: {
|
|
77
|
+
ElPopover,
|
|
78
|
+
ElButton
|
|
79
|
+
},
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
visible: false
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
computed: {
|
|
86
|
+
displayConfirmButtonText() {
|
|
87
|
+
return this.confirmButtonText || t('el.popconfirm.confirmButtonText');
|
|
88
|
+
},
|
|
89
|
+
displayCancelButtonText() {
|
|
90
|
+
return this.cancelButtonText || t('el.popconfirm.cancelButtonText');
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
methods: {
|
|
94
|
+
confirm() {
|
|
95
|
+
this.visible = false;
|
|
96
|
+
this.$emit('confirm');
|
|
97
|
+
},
|
|
98
|
+
cancel() {
|
|
99
|
+
this.visible = false;
|
|
100
|
+
this.$emit('cancel');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span>
|
|
3
|
-
<transition
|
|
4
|
-
:name="transition"
|
|
5
|
-
@after-enter="handleAfterEnter"
|
|
6
|
-
@after-leave="handleAfterLeave">
|
|
7
|
-
<div
|
|
8
|
-
class="el-popover el-popper"
|
|
9
|
-
:class="[popperClass, content && 'el-popover--plain']"
|
|
10
|
-
ref="popper"
|
|
11
|
-
v-show="!disabled && showPopper"
|
|
12
|
-
:style="{ width: width + 'px' }"
|
|
13
|
-
role="tooltip"
|
|
14
|
-
:id="tooltipId"
|
|
15
|
-
:aria-hidden="(disabled || !showPopper) ? 'true' : 'false'"
|
|
16
|
-
>
|
|
17
|
-
<div class="el-popover__title" v-if="title" v-text="title"></div>
|
|
18
|
-
<div class="el-popover__content">
|
|
19
|
-
<slot>{{ content }}</slot>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</transition>
|
|
23
|
-
<span class="el-popover__reference-wrapper" ref="wrapper" >
|
|
24
|
-
<slot name="reference"></slot>
|
|
25
|
-
</span>
|
|
26
|
-
</span>
|
|
27
|
-
</template>
|
|
28
|
-
<script>
|
|
29
|
-
import Popper from 'iov-design/src/utils/vue-popper';
|
|
30
|
-
import { on, off } from 'iov-design/src/utils/dom';
|
|
31
|
-
import { addClass, removeClass } from 'iov-design/src/utils/dom';
|
|
32
|
-
import { generateId } from 'iov-design/src/utils/util';
|
|
33
|
-
|
|
34
|
-
export default {
|
|
35
|
-
name: 'ElPopover',
|
|
36
|
-
|
|
37
|
-
mixins: [Popper],
|
|
38
|
-
|
|
39
|
-
props: {
|
|
40
|
-
trigger: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: 'click',
|
|
43
|
-
validator: value => ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1
|
|
44
|
-
},
|
|
45
|
-
openDelay: {
|
|
46
|
-
type: Number,
|
|
47
|
-
default: 0
|
|
48
|
-
},
|
|
49
|
-
closeDelay: {
|
|
50
|
-
type: Number,
|
|
51
|
-
default: 200
|
|
52
|
-
},
|
|
53
|
-
title: String,
|
|
54
|
-
disabled: Boolean,
|
|
55
|
-
content: String,
|
|
56
|
-
reference: {},
|
|
57
|
-
popperClass: String,
|
|
58
|
-
width: {},
|
|
59
|
-
visibleArrow: {
|
|
60
|
-
default: true
|
|
61
|
-
},
|
|
62
|
-
arrowOffset: {
|
|
63
|
-
type: Number,
|
|
64
|
-
default: 0
|
|
65
|
-
},
|
|
66
|
-
transition: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: 'fade-in-linear'
|
|
69
|
-
},
|
|
70
|
-
tabindex: {
|
|
71
|
-
type: Number,
|
|
72
|
-
default: 0
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
computed: {
|
|
77
|
-
tooltipId() {
|
|
78
|
-
return `el-popover-${generateId()}`;
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
watch: {
|
|
82
|
-
showPopper(val) {
|
|
83
|
-
if (this.disabled) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
val ? this.$emit('show') : this.$emit('hide');
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
mounted() {
|
|
91
|
-
let reference = this.referenceElm = this.reference || this.$refs.reference;
|
|
92
|
-
const popper = this.popper || this.$refs.popper;
|
|
93
|
-
|
|
94
|
-
if (!reference && this.$refs.wrapper.children) {
|
|
95
|
-
reference = this.referenceElm = this.$refs.wrapper.children[0];
|
|
96
|
-
}
|
|
97
|
-
// 可访问性
|
|
98
|
-
if (reference) {
|
|
99
|
-
addClass(reference, 'el-popover__reference');
|
|
100
|
-
reference.setAttribute('aria-describedby', this.tooltipId);
|
|
101
|
-
reference.setAttribute('tabindex', this.tabindex); // tab序列
|
|
102
|
-
popper.setAttribute('tabindex', 0);
|
|
103
|
-
|
|
104
|
-
if (this.trigger !== 'click') {
|
|
105
|
-
on(reference, 'focusin', () => {
|
|
106
|
-
this.handleFocus();
|
|
107
|
-
const instance = reference.__vue__;
|
|
108
|
-
if (instance && typeof instance.focus === 'function') {
|
|
109
|
-
instance.focus();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
on(popper, 'focusin', this.handleFocus);
|
|
113
|
-
on(reference, 'focusout', this.handleBlur);
|
|
114
|
-
on(popper, 'focusout', this.handleBlur);
|
|
115
|
-
}
|
|
116
|
-
on(reference, 'keydown', this.handleKeydown);
|
|
117
|
-
on(reference, 'click', this.handleClick);
|
|
118
|
-
}
|
|
119
|
-
if (this.trigger === 'click') {
|
|
120
|
-
on(reference, 'click', this.doToggle);
|
|
121
|
-
on(document, 'click', this.handleDocumentClick);
|
|
122
|
-
} else if (this.trigger === 'hover') {
|
|
123
|
-
on(reference, 'mouseenter', this.handleMouseEnter);
|
|
124
|
-
on(popper, 'mouseenter', this.handleMouseEnter);
|
|
125
|
-
on(reference, 'mouseleave', this.handleMouseLeave);
|
|
126
|
-
on(popper, 'mouseleave', this.handleMouseLeave);
|
|
127
|
-
} else if (this.trigger === 'focus') {
|
|
128
|
-
if (this.tabindex < 0) {
|
|
129
|
-
console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
|
|
130
|
-
}
|
|
131
|
-
if (reference.querySelector('input, textarea')) {
|
|
132
|
-
on(reference, 'focusin', this.doShow);
|
|
133
|
-
on(reference, 'focusout', this.doClose);
|
|
134
|
-
} else {
|
|
135
|
-
on(reference, 'mousedown', this.doShow);
|
|
136
|
-
on(reference, 'mouseup', this.doClose);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
beforeDestroy() {
|
|
142
|
-
this.cleanup();
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
deactivated() {
|
|
146
|
-
this.cleanup();
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
methods: {
|
|
150
|
-
doToggle() {
|
|
151
|
-
this.showPopper = !this.showPopper;
|
|
152
|
-
},
|
|
153
|
-
doShow() {
|
|
154
|
-
this.showPopper = true;
|
|
155
|
-
},
|
|
156
|
-
doClose() {
|
|
157
|
-
this.showPopper = false;
|
|
158
|
-
},
|
|
159
|
-
handleFocus() {
|
|
160
|
-
addClass(this.referenceElm, 'focusing');
|
|
161
|
-
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
|
|
162
|
-
},
|
|
163
|
-
handleClick() {
|
|
164
|
-
removeClass(this.referenceElm, 'focusing');
|
|
165
|
-
},
|
|
166
|
-
handleBlur() {
|
|
167
|
-
removeClass(this.referenceElm, 'focusing');
|
|
168
|
-
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
|
|
169
|
-
},
|
|
170
|
-
handleMouseEnter() {
|
|
171
|
-
clearTimeout(this._timer);
|
|
172
|
-
if (this.openDelay) {
|
|
173
|
-
this._timer = setTimeout(() => {
|
|
174
|
-
this.showPopper = true;
|
|
175
|
-
}, this.openDelay);
|
|
176
|
-
} else {
|
|
177
|
-
this.showPopper = true;
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
handleKeydown(ev) {
|
|
181
|
-
if (ev.keyCode === 27 && this.trigger !== 'manual') { // esc
|
|
182
|
-
this.doClose();
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
handleMouseLeave() {
|
|
186
|
-
clearTimeout(this._timer);
|
|
187
|
-
if (this.closeDelay) {
|
|
188
|
-
this._timer = setTimeout(() => {
|
|
189
|
-
this.showPopper = false;
|
|
190
|
-
}, this.closeDelay);
|
|
191
|
-
} else {
|
|
192
|
-
this.showPopper = false;
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
handleDocumentClick(e) {
|
|
196
|
-
let reference = this.reference || this.$refs.reference;
|
|
197
|
-
const popper = this.popper || this.$refs.popper;
|
|
198
|
-
|
|
199
|
-
if (!reference && this.$refs.wrapper.children) {
|
|
200
|
-
reference = this.referenceElm = this.$refs.wrapper.children[0];
|
|
201
|
-
}
|
|
202
|
-
if (!this.$el ||
|
|
203
|
-
!reference ||
|
|
204
|
-
this.$el.contains(e.target) ||
|
|
205
|
-
reference.contains(e.target) ||
|
|
206
|
-
!popper ||
|
|
207
|
-
popper.contains(e.target)) return;
|
|
208
|
-
this.showPopper = false;
|
|
209
|
-
},
|
|
210
|
-
handleAfterEnter() {
|
|
211
|
-
this.$emit('after-enter');
|
|
212
|
-
},
|
|
213
|
-
handleAfterLeave() {
|
|
214
|
-
this.$emit('after-leave');
|
|
215
|
-
this.doDestroy();
|
|
216
|
-
},
|
|
217
|
-
cleanup() {
|
|
218
|
-
if (this.openDelay || this.closeDelay) {
|
|
219
|
-
clearTimeout(this._timer);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
destroyed() {
|
|
225
|
-
const reference = this.reference;
|
|
226
|
-
|
|
227
|
-
off(reference, 'click', this.doToggle);
|
|
228
|
-
off(reference, 'mouseup', this.doClose);
|
|
229
|
-
off(reference, 'mousedown', this.doShow);
|
|
230
|
-
off(reference, 'focusin', this.doShow);
|
|
231
|
-
off(reference, 'focusout', this.doClose);
|
|
232
|
-
off(reference, 'mousedown', this.doShow);
|
|
233
|
-
off(reference, 'mouseup', this.doClose);
|
|
234
|
-
off(reference, 'mouseleave', this.handleMouseLeave);
|
|
235
|
-
off(reference, 'mouseenter', this.handleMouseEnter);
|
|
236
|
-
off(document, 'click', this.handleDocumentClick);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<span>
|
|
3
|
+
<transition
|
|
4
|
+
:name="transition"
|
|
5
|
+
@after-enter="handleAfterEnter"
|
|
6
|
+
@after-leave="handleAfterLeave">
|
|
7
|
+
<div
|
|
8
|
+
class="el-popover el-popper"
|
|
9
|
+
:class="[popperClass, content && 'el-popover--plain']"
|
|
10
|
+
ref="popper"
|
|
11
|
+
v-show="!disabled && showPopper"
|
|
12
|
+
:style="{ width: width + 'px' }"
|
|
13
|
+
role="tooltip"
|
|
14
|
+
:id="tooltipId"
|
|
15
|
+
:aria-hidden="(disabled || !showPopper) ? 'true' : 'false'"
|
|
16
|
+
>
|
|
17
|
+
<div class="el-popover__title" v-if="title" v-text="title"></div>
|
|
18
|
+
<div class="el-popover__content">
|
|
19
|
+
<slot>{{ content }}</slot>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</transition>
|
|
23
|
+
<span class="el-popover__reference-wrapper" ref="wrapper" >
|
|
24
|
+
<slot name="reference"></slot>
|
|
25
|
+
</span>
|
|
26
|
+
</span>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
import Popper from 'iov-design/src/utils/vue-popper';
|
|
30
|
+
import { on, off } from 'iov-design/src/utils/dom';
|
|
31
|
+
import { addClass, removeClass } from 'iov-design/src/utils/dom';
|
|
32
|
+
import { generateId } from 'iov-design/src/utils/util';
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'ElPopover',
|
|
36
|
+
|
|
37
|
+
mixins: [Popper],
|
|
38
|
+
|
|
39
|
+
props: {
|
|
40
|
+
trigger: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'click',
|
|
43
|
+
validator: value => ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1
|
|
44
|
+
},
|
|
45
|
+
openDelay: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 0
|
|
48
|
+
},
|
|
49
|
+
closeDelay: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: 200
|
|
52
|
+
},
|
|
53
|
+
title: String,
|
|
54
|
+
disabled: Boolean,
|
|
55
|
+
content: String,
|
|
56
|
+
reference: {},
|
|
57
|
+
popperClass: String,
|
|
58
|
+
width: {},
|
|
59
|
+
visibleArrow: {
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
arrowOffset: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 0
|
|
65
|
+
},
|
|
66
|
+
transition: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'fade-in-linear'
|
|
69
|
+
},
|
|
70
|
+
tabindex: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 0
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
computed: {
|
|
77
|
+
tooltipId() {
|
|
78
|
+
return `el-popover-${generateId()}`;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
watch: {
|
|
82
|
+
showPopper(val) {
|
|
83
|
+
if (this.disabled) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
val ? this.$emit('show') : this.$emit('hide');
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
mounted() {
|
|
91
|
+
let reference = this.referenceElm = this.reference || this.$refs.reference;
|
|
92
|
+
const popper = this.popper || this.$refs.popper;
|
|
93
|
+
|
|
94
|
+
if (!reference && this.$refs.wrapper.children) {
|
|
95
|
+
reference = this.referenceElm = this.$refs.wrapper.children[0];
|
|
96
|
+
}
|
|
97
|
+
// 可访问性
|
|
98
|
+
if (reference) {
|
|
99
|
+
addClass(reference, 'el-popover__reference');
|
|
100
|
+
reference.setAttribute('aria-describedby', this.tooltipId);
|
|
101
|
+
reference.setAttribute('tabindex', this.tabindex); // tab序列
|
|
102
|
+
popper.setAttribute('tabindex', 0);
|
|
103
|
+
|
|
104
|
+
if (this.trigger !== 'click') {
|
|
105
|
+
on(reference, 'focusin', () => {
|
|
106
|
+
this.handleFocus();
|
|
107
|
+
const instance = reference.__vue__;
|
|
108
|
+
if (instance && typeof instance.focus === 'function') {
|
|
109
|
+
instance.focus();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
on(popper, 'focusin', this.handleFocus);
|
|
113
|
+
on(reference, 'focusout', this.handleBlur);
|
|
114
|
+
on(popper, 'focusout', this.handleBlur);
|
|
115
|
+
}
|
|
116
|
+
on(reference, 'keydown', this.handleKeydown);
|
|
117
|
+
on(reference, 'click', this.handleClick);
|
|
118
|
+
}
|
|
119
|
+
if (this.trigger === 'click') {
|
|
120
|
+
on(reference, 'click', this.doToggle);
|
|
121
|
+
on(document, 'click', this.handleDocumentClick);
|
|
122
|
+
} else if (this.trigger === 'hover') {
|
|
123
|
+
on(reference, 'mouseenter', this.handleMouseEnter);
|
|
124
|
+
on(popper, 'mouseenter', this.handleMouseEnter);
|
|
125
|
+
on(reference, 'mouseleave', this.handleMouseLeave);
|
|
126
|
+
on(popper, 'mouseleave', this.handleMouseLeave);
|
|
127
|
+
} else if (this.trigger === 'focus') {
|
|
128
|
+
if (this.tabindex < 0) {
|
|
129
|
+
console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
|
|
130
|
+
}
|
|
131
|
+
if (reference.querySelector('input, textarea')) {
|
|
132
|
+
on(reference, 'focusin', this.doShow);
|
|
133
|
+
on(reference, 'focusout', this.doClose);
|
|
134
|
+
} else {
|
|
135
|
+
on(reference, 'mousedown', this.doShow);
|
|
136
|
+
on(reference, 'mouseup', this.doClose);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
beforeDestroy() {
|
|
142
|
+
this.cleanup();
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
deactivated() {
|
|
146
|
+
this.cleanup();
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
methods: {
|
|
150
|
+
doToggle() {
|
|
151
|
+
this.showPopper = !this.showPopper;
|
|
152
|
+
},
|
|
153
|
+
doShow() {
|
|
154
|
+
this.showPopper = true;
|
|
155
|
+
},
|
|
156
|
+
doClose() {
|
|
157
|
+
this.showPopper = false;
|
|
158
|
+
},
|
|
159
|
+
handleFocus() {
|
|
160
|
+
addClass(this.referenceElm, 'focusing');
|
|
161
|
+
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
|
|
162
|
+
},
|
|
163
|
+
handleClick() {
|
|
164
|
+
removeClass(this.referenceElm, 'focusing');
|
|
165
|
+
},
|
|
166
|
+
handleBlur() {
|
|
167
|
+
removeClass(this.referenceElm, 'focusing');
|
|
168
|
+
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
|
|
169
|
+
},
|
|
170
|
+
handleMouseEnter() {
|
|
171
|
+
clearTimeout(this._timer);
|
|
172
|
+
if (this.openDelay) {
|
|
173
|
+
this._timer = setTimeout(() => {
|
|
174
|
+
this.showPopper = true;
|
|
175
|
+
}, this.openDelay);
|
|
176
|
+
} else {
|
|
177
|
+
this.showPopper = true;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
handleKeydown(ev) {
|
|
181
|
+
if (ev.keyCode === 27 && this.trigger !== 'manual') { // esc
|
|
182
|
+
this.doClose();
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
handleMouseLeave() {
|
|
186
|
+
clearTimeout(this._timer);
|
|
187
|
+
if (this.closeDelay) {
|
|
188
|
+
this._timer = setTimeout(() => {
|
|
189
|
+
this.showPopper = false;
|
|
190
|
+
}, this.closeDelay);
|
|
191
|
+
} else {
|
|
192
|
+
this.showPopper = false;
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
handleDocumentClick(e) {
|
|
196
|
+
let reference = this.reference || this.$refs.reference;
|
|
197
|
+
const popper = this.popper || this.$refs.popper;
|
|
198
|
+
|
|
199
|
+
if (!reference && this.$refs.wrapper.children) {
|
|
200
|
+
reference = this.referenceElm = this.$refs.wrapper.children[0];
|
|
201
|
+
}
|
|
202
|
+
if (!this.$el ||
|
|
203
|
+
!reference ||
|
|
204
|
+
this.$el.contains(e.target) ||
|
|
205
|
+
reference.contains(e.target) ||
|
|
206
|
+
!popper ||
|
|
207
|
+
popper.contains(e.target)) return;
|
|
208
|
+
this.showPopper = false;
|
|
209
|
+
},
|
|
210
|
+
handleAfterEnter() {
|
|
211
|
+
this.$emit('after-enter');
|
|
212
|
+
},
|
|
213
|
+
handleAfterLeave() {
|
|
214
|
+
this.$emit('after-leave');
|
|
215
|
+
this.doDestroy();
|
|
216
|
+
},
|
|
217
|
+
cleanup() {
|
|
218
|
+
if (this.openDelay || this.closeDelay) {
|
|
219
|
+
clearTimeout(this._timer);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
destroyed() {
|
|
225
|
+
const reference = this.reference;
|
|
226
|
+
|
|
227
|
+
off(reference, 'click', this.doToggle);
|
|
228
|
+
off(reference, 'mouseup', this.doClose);
|
|
229
|
+
off(reference, 'mousedown', this.doShow);
|
|
230
|
+
off(reference, 'focusin', this.doShow);
|
|
231
|
+
off(reference, 'focusout', this.doClose);
|
|
232
|
+
off(reference, 'mousedown', this.doShow);
|
|
233
|
+
off(reference, 'mouseup', this.doClose);
|
|
234
|
+
off(reference, 'mouseleave', this.handleMouseLeave);
|
|
235
|
+
off(reference, 'mouseenter', this.handleMouseEnter);
|
|
236
|
+
off(document, 'click', this.handleDocumentClick);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
</script>
|