@zkwq/business 0.0.4 → 0.0.6
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/package.json +2 -2
- package/src/components/base/ui/alert/Alert.vue +0 -94
- package/src/components/base/ui/autocomplete/autocomplete-suggestions.vue +0 -77
- package/src/components/base/ui/autocomplete/autocomplete.vue +0 -305
- package/src/components/base/ui/backtop/main.vue +0 -112
- package/src/components/base/ui/button/Button.vue +0 -84
- package/src/components/base/ui/button/ButtonGroup.vue +0 -10
- package/src/components/base/ui/carousel/Carousel.vue +0 -304
- package/src/components/base/ui/carousel/CarouselItem.vue +0 -137
- package/src/components/base/ui/cascader/cascader.vue +0 -650
- package/src/components/base/ui/cascader-panel/cascader-menu.vue +0 -138
- package/src/components/base/ui/cascader-panel/cascader-node.vue +0 -246
- package/src/components/base/ui/cascader-panel/cascader-panel.vue +0 -382
- package/src/components/base/ui/cascader-panel/node.js +0 -166
- package/src/components/base/ui/cascader-panel/store.js +0 -62
- package/src/components/base/ui/checkbox/checkbox-button.vue +0 -199
- package/src/components/base/ui/checkbox/checkbox-group.vue +0 -48
- package/src/components/base/ui/checkbox/checkbox.vue +0 -222
- package/src/components/base/ui/col/col.js +0 -71
- package/src/components/base/ui/collapse/collapse-item.vue +0 -180
- package/src/components/base/ui/collapse/collapse.vue +0 -73
- package/src/components/base/ui/color-picker/color.js +0 -317
- package/src/components/base/ui/color-picker/components/alpha-slider.vue +0 -132
- package/src/components/base/ui/color-picker/components/hue-slider.vue +0 -123
- package/src/components/base/ui/color-picker/components/picker-dropdown.vue +0 -119
- package/src/components/base/ui/color-picker/components/predefine.vue +0 -61
- package/src/components/base/ui/color-picker/components/sv-panel.vue +0 -100
- package/src/components/base/ui/color-picker/draggable.js +0 -36
- package/src/components/base/ui/color-picker/index.js +0 -2
- package/src/components/base/ui/color-picker/main.vue +0 -188
- package/src/components/base/ui/date-picker/basic/date-table.vue +0 -441
- package/src/components/base/ui/date-picker/basic/month-table.vue +0 -254
- package/src/components/base/ui/date-picker/basic/time-spinner.vue +0 -304
- package/src/components/base/ui/date-picker/basic/year-table.vue +0 -101
- package/src/components/base/ui/date-picker/panel/date-range.vue +0 -680
- package/src/components/base/ui/date-picker/panel/date.vue +0 -597
- package/src/components/base/ui/date-picker/panel/month-range.vue +0 -289
- package/src/components/base/ui/date-picker/panel/time-range.vue +0 -248
- package/src/components/base/ui/date-picker/panel/time-select.vue +0 -178
- package/src/components/base/ui/date-picker/panel/time.vue +0 -186
- package/src/components/base/ui/date-picker/picker/date-picker.js +0 -43
- package/src/components/base/ui/date-picker/picker/time-picker.js +0 -39
- package/src/components/base/ui/date-picker/picker/time-select.js +0 -21
- package/src/components/base/ui/date-picker/picker.vue +0 -942
- package/src/components/base/ui/dialog/Index.vue +0 -212
- package/src/components/base/ui/directive/repeat-click.js +0 -24
- package/src/components/base/ui/directive/ripple.js +0 -303
- package/src/components/base/ui/divider/Divider.vue +0 -37
- package/src/components/base/ui/drawer/Drawer.vue +0 -202
- package/src/components/base/ui/dropdown/dropdown-item.vue +0 -39
- package/src/components/base/ui/dropdown/dropdown-menu.vue +0 -63
- package/src/components/base/ui/dropdown/dropdown.vue +0 -308
- package/src/components/base/ui/form/Form.vue +0 -167
- package/src/components/base/ui/form/FormItem.vue +0 -334
- package/src/components/base/ui/form/LabelWrap.vue +0 -69
- package/src/components/base/ui/icon/icon.vue +0 -13
- package/src/components/base/ui/image/image-viewer.vue +0 -302
- package/src/components/base/ui/image/main.vue +0 -248
- package/src/components/base/ui/index.js +0 -189
- package/src/components/base/ui/input/Input.vue +0 -438
- package/src/components/base/ui/input/calcTextareaHeight.js +0 -104
- package/src/components/base/ui/input-number/input-number.vue +0 -285
- package/src/components/base/ui/locale/format.js +0 -32
- package/src/components/base/ui/locale/index.js +0 -48
- package/src/components/base/ui/locale/lang/zh-CN.js +0 -120
- package/src/components/base/ui/menu/menu-item-group.vue +0 -45
- package/src/components/base/ui/menu/menu-item.vue +0 -112
- package/src/components/base/ui/menu/menu-mixin.js +0 -44
- package/src/components/base/ui/menu/menu.vue +0 -312
- package/src/components/base/ui/menu/submenu.vue +0 -408
- package/src/components/base/ui/message/index.js +0 -2
- package/src/components/base/ui/message/main.js +0 -87
- package/src/components/base/ui/message/main.vue +0 -110
- package/src/components/base/ui/message-box/main.js +0 -216
- package/src/components/base/ui/message-box/main.vue +0 -323
- package/src/components/base/ui/mixin/emitter.js +0 -31
- package/src/components/base/ui/mixin/focus.js +0 -9
- package/src/components/base/ui/mixin/locale.js +0 -9
- package/src/components/base/ui/mixin/migrating.js +0 -33
- package/src/components/base/ui/pagination/pager.vue +0 -163
- package/src/components/base/ui/pagination/pagination.jsx +0 -391
- package/src/components/base/ui/popover/directive.js +0 -20
- package/src/components/base/ui/popover/index.js +0 -14
- package/src/components/base/ui/popover/main.vue +0 -236
- package/src/components/base/ui/progress/Progress.vue +0 -227
- package/src/components/base/ui/radio/radio-button.vue +0 -114
- package/src/components/base/ui/radio/radio-group.vue +0 -111
- package/src/components/base/ui/radio/radio.vue +0 -134
- package/src/components/base/ui/row/row.js +0 -47
- package/src/components/base/ui/scrollbar/bar.jsx +0 -91
- package/src/components/base/ui/scrollbar/index.jsx +0 -203
- package/src/components/base/ui/scrollbar/util.js +0 -32
- package/src/components/base/ui/select/Option.vue +0 -168
- package/src/components/base/ui/select/OptionGroup.vue +0 -60
- package/src/components/base/ui/select/Select.vue +0 -920
- package/src/components/base/ui/select/SelectDropdown.vue +0 -74
- package/src/components/base/ui/select/navigation-mixin.js +0 -54
- package/src/components/base/ui/skeleton/index.js +0 -8
- package/src/components/base/ui/skeleton/src/img-placeholder.vue +0 -16
- package/src/components/base/ui/skeleton/src/index.vue +0 -80
- package/src/components/base/ui/skeleton/src/item.vue +0 -22
- package/src/components/base/ui/skeleton-item/index.js +0 -8
- package/src/components/base/ui/slider/button.vue +0 -238
- package/src/components/base/ui/slider/main.vue +0 -427
- package/src/components/base/ui/slider/marker.js +0 -18
- package/src/components/base/ui/style/alert.scss +0 -147
- package/src/components/base/ui/style/animations.scss +0 -65
- package/src/components/base/ui/style/autocomplete.scss +0 -81
- package/src/components/base/ui/style/backtop.scss +0 -20
- package/src/components/base/ui/style/button-group.scss +0 -0
- package/src/components/base/ui/style/button.scss +0 -380
- package/src/components/base/ui/style/carousel-item.scss +0 -50
- package/src/components/base/ui/style/carousel.scss +0 -161
- package/src/components/base/ui/style/cascader-panel.scss +0 -120
- package/src/components/base/ui/style/cascader.scss +0 -185
- package/src/components/base/ui/style/checkbox-button.scss +0 -0
- package/src/components/base/ui/style/checkbox-group.scss +0 -0
- package/src/components/base/ui/style/checkbox.scss +0 -360
- package/src/components/base/ui/style/col.scss +0 -156
- package/src/components/base/ui/style/collapse-item.scss +0 -0
- package/src/components/base/ui/style/collapse.scss +0 -114
- package/src/components/base/ui/style/color-picker.scss +0 -387
- package/src/components/base/ui/style/config.scss +0 -4
- package/src/components/base/ui/style/date-picker/date-picker.scss +0 -97
- package/src/components/base/ui/style/date-picker/date-range-picker.scss +0 -101
- package/src/components/base/ui/style/date-picker/date-table.scss +0 -151
- package/src/components/base/ui/style/date-picker/month-table.scss +0 -82
- package/src/components/base/ui/style/date-picker/picker-panel.scss +0 -117
- package/src/components/base/ui/style/date-picker/picker.scss +0 -197
- package/src/components/base/ui/style/date-picker/time-picker.scss +0 -85
- package/src/components/base/ui/style/date-picker/time-range-picker.scss +0 -31
- package/src/components/base/ui/style/date-picker/time-spinner.scss +0 -110
- package/src/components/base/ui/style/date-picker/year-table.scss +0 -51
- package/src/components/base/ui/style/date-picker.scss +0 -12
- package/src/components/base/ui/style/dialog.scss +0 -123
- package/src/components/base/ui/style/divider.scss +0 -47
- package/src/components/base/ui/style/drawer.scss +0 -218
- package/src/components/base/ui/style/dropdown-item.scss +0 -0
- package/src/components/base/ui/style/dropdown-menu.scss +0 -0
- package/src/components/base/ui/style/dropdown.scss +0 -185
- package/src/components/base/ui/style/form-item.scss +0 -0
- package/src/components/base/ui/style/form.scss +0 -203
- package/src/components/base/ui/style/function.scss +0 -43
- package/src/components/base/ui/style/icon.scss +0 -1167
- package/src/components/base/ui/style/image.scss +0 -184
- package/src/components/base/ui/style/index.scss +0 -57
- package/src/components/base/ui/style/input-number.scss +0 -187
- package/src/components/base/ui/style/input.scss +0 -477
- package/src/components/base/ui/style/menu-item-group.scss +0 -0
- package/src/components/base/ui/style/menu-item.scss +0 -0
- package/src/components/base/ui/style/menu.scss +0 -294
- package/src/components/base/ui/style/message-box.scss +0 -231
- package/src/components/base/ui/style/message.scss +0 -120
- package/src/components/base/ui/style/mixins.scss +0 -196
- package/src/components/base/ui/style/option-group.scss +0 -42
- package/src/components/base/ui/style/option.scss +0 -36
- package/src/components/base/ui/style/pagination.scss +0 -295
- package/src/components/base/ui/style/popover.scss +0 -40
- package/src/components/base/ui/style/popper.scss +0 -102
- package/src/components/base/ui/style/popup.scss +0 -42
- package/src/components/base/ui/style/progress.scss +0 -141
- package/src/components/base/ui/style/radio-button.scss +0 -113
- package/src/components/base/ui/style/radio-group.scss +0 -9
- package/src/components/base/ui/style/radio.scss +0 -203
- package/src/components/base/ui/style/ripple.scss +0 -35
- package/src/components/base/ui/style/row.scss +0 -39
- package/src/components/base/ui/style/scrollbar.scss +0 -75
- package/src/components/base/ui/style/select-dropdown.scss +0 -59
- package/src/components/base/ui/style/select.scss +0 -154
- package/src/components/base/ui/style/skeleton-item.scss +0 -84
- package/src/components/base/ui/style/skeleton.scss +0 -40
- package/src/components/base/ui/style/slider.scss +0 -250
- package/src/components/base/ui/style/switch.scss +0 -116
- package/src/components/base/ui/style/tabs.scss +0 -602
- package/src/components/base/ui/style/tag.scss +0 -174
- package/src/components/base/ui/style/tooltip.scss +0 -146
- package/src/components/base/ui/style/transition.scss +0 -138
- package/src/components/base/ui/style/upload.scss +0 -603
- package/src/components/base/ui/style/utils.scss +0 -39
- package/src/components/base/ui/style/var.scss +0 -1011
- package/src/components/base/ui/switch/index.vue +0 -174
- package/src/components/base/ui/tabs/tab-bar.vue +0 -57
- package/src/components/base/ui/tabs/tab-nav.vue +0 -294
- package/src/components/base/ui/tabs/tab-pane.vue +0 -56
- package/src/components/base/ui/tabs/tabs.vue +0 -191
- package/src/components/base/ui/tag/Tag.vue +0 -60
- package/src/components/base/ui/tooltip/tooltip.jsx +0 -234
- package/src/components/base/ui/upload/Index.vue +0 -340
- package/src/components/base/ui/upload/Upload.vue +0 -216
- package/src/components/base/ui/upload/UploadDragger.vue +0 -70
- package/src/components/base/ui/upload/UploadList.vue +0 -100
- package/src/components/base/ui/upload/ajax.js +0 -85
- package/src/components/base/ui/util/aria-dialog.js +0 -90
- package/src/components/base/ui/util/aria-utils.js +0 -122
- package/src/components/base/ui/util/clickoutside.js +0 -76
- package/src/components/base/ui/util/date-util.js +0 -292
- package/src/components/base/ui/util/date.js +0 -355
- package/src/components/base/ui/util/debounce.js +0 -21
- package/src/components/base/ui/util/deepmerge.js +0 -100
- package/src/components/base/ui/util/dom.js +0 -215
- package/src/components/base/ui/util/index.js +0 -262
- package/src/components/base/ui/util/menu/aria-menubar.js +0 -14
- package/src/components/base/ui/util/menu/aria-menuitem.js +0 -49
- package/src/components/base/ui/util/menu/aria-submenu.js +0 -59
- package/src/components/base/ui/util/merge.js +0 -14
- package/src/components/base/ui/util/popper.js +0 -1235
- package/src/components/base/ui/util/popup/index.js +0 -218
- package/src/components/base/ui/util/popup/popup-manager.js +0 -194
- package/src/components/base/ui/util/resize-events.js +0 -32
- package/src/components/base/ui/util/scroll-into-view.js +0 -27
- package/src/components/base/ui/util/scrollbar-width.js +0 -29
- package/src/components/base/ui/util/shared.js +0 -7
- package/src/components/base/ui/util/throttle.js +0 -91
- package/src/components/base/ui/util/types.js +0 -24
- package/src/components/base/ui/util/vdom.js +0 -5
- package/src/components/base/ui/util/vue-popper.js +0 -188
- package/src/components/normal/AggsItemH.vue +0 -145
- package/src/index.js +0 -10
- package/src/static/base-icons.ttf +0 -0
- package/src/static/base-icons.woff +0 -0
- package/src/static/label_bg.png +0 -0
- package/src/static/term-label-bg.png +0 -0
- package/src/style/app-article.scss +0 -698
- package/src/style/app-comment.scss +0 -259
- package/src/style/app-recommend.scss +0 -48
- package/src/style/app-richtext.scss +0 -176
- package/src/style/index.scss +0 -523
|
@@ -1,650 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="reference"
|
|
4
|
-
:class="[
|
|
5
|
-
'base-cascader',
|
|
6
|
-
realSize && `base-cascader--${realSize}`,
|
|
7
|
-
{ 'is-disabled': isDisabled }
|
|
8
|
-
]"
|
|
9
|
-
v-clickoutside="() => toggleDropDownVisible(false)"
|
|
10
|
-
@mouseenter="inputHover = true"
|
|
11
|
-
@mouseleave="inputHover = false"
|
|
12
|
-
@click="() => toggleDropDownVisible(readonly ? undefined : true)"
|
|
13
|
-
@keydown="handleKeyDown">
|
|
14
|
-
|
|
15
|
-
<base-input
|
|
16
|
-
ref="input"
|
|
17
|
-
v-model="multiple ? presentText : inputValue"
|
|
18
|
-
:size="realSize"
|
|
19
|
-
:placeholder="placeholder"
|
|
20
|
-
:readonly="readonly"
|
|
21
|
-
:disabled="isDisabled"
|
|
22
|
-
:validate-event="false"
|
|
23
|
-
:class="{ 'is-focus': dropDownVisible }"
|
|
24
|
-
@focus="handleFocus"
|
|
25
|
-
@blur="handleBlur"
|
|
26
|
-
@input="handleInput">
|
|
27
|
-
<template slot="suffix">
|
|
28
|
-
<i
|
|
29
|
-
v-if="clearBtnVisible"
|
|
30
|
-
key="clear"
|
|
31
|
-
class="base-input__icon base-icon-circle-close"
|
|
32
|
-
@click.stop="handleClear"></i>
|
|
33
|
-
<i
|
|
34
|
-
v-else
|
|
35
|
-
key="arrow-down"
|
|
36
|
-
:class="[
|
|
37
|
-
'base-input__icon',
|
|
38
|
-
'base-icon-arrow-down',
|
|
39
|
-
dropDownVisible && 'is-reverse'
|
|
40
|
-
]"
|
|
41
|
-
@click.stop="toggleDropDownVisible()"></i>
|
|
42
|
-
</template>
|
|
43
|
-
</base-input>
|
|
44
|
-
|
|
45
|
-
<div v-if="multiple" class="base-cascader__tags">
|
|
46
|
-
<base-tag
|
|
47
|
-
v-for="(tag, index) in presentTags"
|
|
48
|
-
:key="tag.key"
|
|
49
|
-
type="info"
|
|
50
|
-
:size="tagSize"
|
|
51
|
-
:hit="tag.hitState"
|
|
52
|
-
:closable="tag.closable"
|
|
53
|
-
disable-transitions
|
|
54
|
-
@close="deleteTag(index)">
|
|
55
|
-
<span>{{ tag.text }}</span>
|
|
56
|
-
</base-tag>
|
|
57
|
-
<input
|
|
58
|
-
v-if="filterable && !isDisabled"
|
|
59
|
-
v-modbase.trim="inputValue"
|
|
60
|
-
type="text"
|
|
61
|
-
class="base-cascader__search-input"
|
|
62
|
-
:placeholder="presentTags.length ? '' : placeholder"
|
|
63
|
-
@input="e => handleInput(inputValue, e)"
|
|
64
|
-
@click.stop="toggleDropDownVisible(true)"
|
|
65
|
-
@keydown.delete="handleDelete">
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<transition name="base-zoom-in-top" @after-leave="handleDropdownLeave">
|
|
69
|
-
<div
|
|
70
|
-
v-show="dropDownVisible"
|
|
71
|
-
ref="popper"
|
|
72
|
-
:class="['base-popper', 'base-cascader__dropdown', popperClass]">
|
|
73
|
-
<base-cascader-panel
|
|
74
|
-
ref="panel"
|
|
75
|
-
v-show="!filtering"
|
|
76
|
-
v-model="checkedValue"
|
|
77
|
-
:options="options"
|
|
78
|
-
:props="config"
|
|
79
|
-
:border="false"
|
|
80
|
-
:render-label="$scopedSlots.default"
|
|
81
|
-
@expand-change="handleExpandChange"
|
|
82
|
-
@close="toggleDropDownVisible(false)"></base-cascader-panel>
|
|
83
|
-
<base-scrollbar
|
|
84
|
-
ref="suggestionPanel"
|
|
85
|
-
v-if="filterable"
|
|
86
|
-
v-show="filtering"
|
|
87
|
-
tag="ul"
|
|
88
|
-
class="base-cascader__suggestion-panel"
|
|
89
|
-
view-class="base-cascader__suggestion-list"
|
|
90
|
-
@keydown.native="handleSuggestionKeyDown">
|
|
91
|
-
<template v-if="suggestions.length">
|
|
92
|
-
<li
|
|
93
|
-
v-for="(item, index) in suggestions"
|
|
94
|
-
:key="item.uid"
|
|
95
|
-
:class="[
|
|
96
|
-
'base-cascader__suggestion-item',
|
|
97
|
-
item.checked && 'is-checked'
|
|
98
|
-
]"
|
|
99
|
-
:tabindex="-1"
|
|
100
|
-
@click="handleSuggestionClick(index)">
|
|
101
|
-
<span>{{ item.text }}</span>
|
|
102
|
-
<i v-if="item.checked" class="base-icon-check"></i>
|
|
103
|
-
</li>
|
|
104
|
-
</template>
|
|
105
|
-
<slot v-else name="empty">
|
|
106
|
-
<li class="base-cascader__empty-text">{{ t('base.cascader.noMatch') }}</li>
|
|
107
|
-
</slot>
|
|
108
|
-
</base-scrollbar>
|
|
109
|
-
</div>
|
|
110
|
-
</transition>
|
|
111
|
-
</div>
|
|
112
|
-
</template>
|
|
113
|
-
|
|
114
|
-
<script>
|
|
115
|
-
import Popper from '../util/vue-popper';
|
|
116
|
-
import Clickoutside from '../util/clickoutside';
|
|
117
|
-
import Emitter from '../mixin/emitter';
|
|
118
|
-
import Locale from '../mixin/locale';
|
|
119
|
-
import Migrating from '../mixin/migrating';
|
|
120
|
-
import BaseInput from '../input/Input';
|
|
121
|
-
import BaseTag from '../tag/Tag';
|
|
122
|
-
import BaseScrollbar from '../scrollbar/index';
|
|
123
|
-
import BaseCascaderPanel from '../cascader-panel/cascader-panel';
|
|
124
|
-
import AriaUtils from '../util/aria-utils';
|
|
125
|
-
import { t } from '../locale/index';
|
|
126
|
-
import { isEqual, isEmpty, kebabCase } from '../util/index';
|
|
127
|
-
import { isUndefined, isFunction } from '../util/types';
|
|
128
|
-
import { isDef } from '../util/shared';
|
|
129
|
-
import { addResizeListener, removeResizeListener } from '../util/resize-events';
|
|
130
|
-
import debounce from '../util/debounce';
|
|
131
|
-
|
|
132
|
-
const { keys: KeyCode } = AriaUtils;
|
|
133
|
-
const MigratingProps = {
|
|
134
|
-
expandTrigger: {
|
|
135
|
-
newProp: 'expandTrigger',
|
|
136
|
-
type: String
|
|
137
|
-
},
|
|
138
|
-
changeOnSelect: {
|
|
139
|
-
newProp: 'checkStrictly',
|
|
140
|
-
type: Boolean
|
|
141
|
-
},
|
|
142
|
-
hoverThreshold: {
|
|
143
|
-
newProp: 'hoverThreshold',
|
|
144
|
-
type: Number
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const PopperMixin = {
|
|
149
|
-
props: {
|
|
150
|
-
placement: {
|
|
151
|
-
type: String,
|
|
152
|
-
default: 'bottom-start'
|
|
153
|
-
},
|
|
154
|
-
appendToBody: Popper.props.appendToBody,
|
|
155
|
-
visibleArrow: {
|
|
156
|
-
type: Boolean,
|
|
157
|
-
default: true
|
|
158
|
-
},
|
|
159
|
-
arrowOffset: Popper.props.arrowOffset,
|
|
160
|
-
offset: Popper.props.offset,
|
|
161
|
-
boundariesPadding: Popper.props.boundariesPadding,
|
|
162
|
-
popperOptions: Popper.props.popperOptions
|
|
163
|
-
},
|
|
164
|
-
methods: Popper.methods,
|
|
165
|
-
data: Popper.data,
|
|
166
|
-
beforeDestroy: Popper.beforeDestroy
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const InputSizeMap = {
|
|
170
|
-
medium: 36,
|
|
171
|
-
small: 32,
|
|
172
|
-
mini: 28
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export default {
|
|
176
|
-
name: 'BaseCascader',
|
|
177
|
-
|
|
178
|
-
directives: { Clickoutside },
|
|
179
|
-
|
|
180
|
-
mixins: [PopperMixin, Emitter, Locale, Migrating],
|
|
181
|
-
|
|
182
|
-
inject: {
|
|
183
|
-
baseForm: {
|
|
184
|
-
default: ''
|
|
185
|
-
},
|
|
186
|
-
baseFormItem: {
|
|
187
|
-
default: ''
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
components: {
|
|
192
|
-
BaseInput,
|
|
193
|
-
BaseTag,
|
|
194
|
-
BaseScrollbar,
|
|
195
|
-
BaseCascaderPanel
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
props: {
|
|
199
|
-
value: {},
|
|
200
|
-
options: Array,
|
|
201
|
-
props: Object,
|
|
202
|
-
size: String,
|
|
203
|
-
placeholder: {
|
|
204
|
-
type: String,
|
|
205
|
-
default: () => t('base.cascader.placeholder')
|
|
206
|
-
},
|
|
207
|
-
disabled: Boolean,
|
|
208
|
-
clearable: Boolean,
|
|
209
|
-
filterable: Boolean,
|
|
210
|
-
filterMethod: Function,
|
|
211
|
-
separator: {
|
|
212
|
-
type: String,
|
|
213
|
-
default: ' / '
|
|
214
|
-
},
|
|
215
|
-
showAllLevels: {
|
|
216
|
-
type: Boolean,
|
|
217
|
-
default: true
|
|
218
|
-
},
|
|
219
|
-
collapseTags: Boolean,
|
|
220
|
-
debounce: {
|
|
221
|
-
type: Number,
|
|
222
|
-
default: 300
|
|
223
|
-
},
|
|
224
|
-
beforeFilter: {
|
|
225
|
-
type: Function,
|
|
226
|
-
default: () => (() => {})
|
|
227
|
-
},
|
|
228
|
-
popperClass: String
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
data() {
|
|
232
|
-
return {
|
|
233
|
-
dropDownVisible: false,
|
|
234
|
-
checkedValue: this.value || null,
|
|
235
|
-
inputHover: false,
|
|
236
|
-
inputValue: null,
|
|
237
|
-
presentText: null,
|
|
238
|
-
presentTags: [],
|
|
239
|
-
checkedNodes: [],
|
|
240
|
-
filtering: false,
|
|
241
|
-
suggestions: [],
|
|
242
|
-
inputInitialHeight: 0,
|
|
243
|
-
pressDeleteCount: 0
|
|
244
|
-
};
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
computed: {
|
|
248
|
-
realSize() {
|
|
249
|
-
const _baseFormItemSize = (this.baseFormItem || {}).baseFormItemSize;
|
|
250
|
-
return this.size || _baseFormItemSize || (this.$ELEMENT || {}).size;
|
|
251
|
-
},
|
|
252
|
-
tagSize() {
|
|
253
|
-
return ['small', 'mini'].indexOf(this.realSize) > -1
|
|
254
|
-
? 'mini'
|
|
255
|
-
: 'small';
|
|
256
|
-
},
|
|
257
|
-
isDisabled() {
|
|
258
|
-
return this.disabled || (this.baseForm || {}).disabled;
|
|
259
|
-
},
|
|
260
|
-
config() {
|
|
261
|
-
const config = this.props || {};
|
|
262
|
-
const { $attrs } = this;
|
|
263
|
-
|
|
264
|
-
Object
|
|
265
|
-
.keys(MigratingProps)
|
|
266
|
-
.forEach(oldProp => {
|
|
267
|
-
const { newProp, type } = MigratingProps[oldProp];
|
|
268
|
-
let oldValue = $attrs[oldProp] || $attrs[kebabCase(oldProp)];
|
|
269
|
-
if (isDef(oldProp) && !isDef(config[newProp])) {
|
|
270
|
-
if (type === Boolean && oldValue === '') {
|
|
271
|
-
oldValue = true;
|
|
272
|
-
}
|
|
273
|
-
config[newProp] = oldValue;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
return config;
|
|
278
|
-
},
|
|
279
|
-
multiple() {
|
|
280
|
-
return this.config.multiple;
|
|
281
|
-
},
|
|
282
|
-
leafOnly() {
|
|
283
|
-
return !this.config.checkStrictly;
|
|
284
|
-
},
|
|
285
|
-
readonly() {
|
|
286
|
-
return !this.filterable || this.multiple;
|
|
287
|
-
},
|
|
288
|
-
clearBtnVisible() {
|
|
289
|
-
if (!this.clearable || this.isDisabled || this.filtering || !this.inputHover) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return this.multiple
|
|
294
|
-
? !!this.checkedNodes.filter(node => !node.isDisabled).length
|
|
295
|
-
: !!this.presentText;
|
|
296
|
-
},
|
|
297
|
-
panel() {
|
|
298
|
-
return this.$refs.panel;
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
watch: {
|
|
303
|
-
disabled() {
|
|
304
|
-
this.computePresentContent();
|
|
305
|
-
},
|
|
306
|
-
value(val) {
|
|
307
|
-
if (!isEqual(val, this.checkedValue)) {
|
|
308
|
-
this.checkedValue = val;
|
|
309
|
-
this.computePresentContent();
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
checkedValue(val) {
|
|
313
|
-
const { value, dropDownVisible } = this;
|
|
314
|
-
const { checkStrictly, multiple } = this.config;
|
|
315
|
-
|
|
316
|
-
if (!isEqual(val, value) || isUndefined(value)) {
|
|
317
|
-
this.computePresentContent();
|
|
318
|
-
// hide dropdown when single mode
|
|
319
|
-
if (!multiple && !checkStrictly && dropDownVisible) {
|
|
320
|
-
this.toggleDropDownVisible(false);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
this.$emit('input', val);
|
|
324
|
-
this.$emit('change', val);
|
|
325
|
-
this.dispatch('BaseFormItem', 'base.form.change', [val]);
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
options: {
|
|
329
|
-
handler: function() {
|
|
330
|
-
this.$nextTick(this.computePresentContent);
|
|
331
|
-
},
|
|
332
|
-
deep: true
|
|
333
|
-
},
|
|
334
|
-
presentText(val) {
|
|
335
|
-
this.inputValue = val;
|
|
336
|
-
},
|
|
337
|
-
presentTags(val, oldVal) {
|
|
338
|
-
if (this.multiple && (val.length || oldVal.length)) {
|
|
339
|
-
this.$nextTick(this.updateStyle);
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
filtering(val) {
|
|
343
|
-
this.$nextTick(this.updatePopper);
|
|
344
|
-
}
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
mounted() {
|
|
348
|
-
const { input } = this.$refs;
|
|
349
|
-
if (input && input.$el) {
|
|
350
|
-
this.inputInitialHeight = input.$el.offsetHeight || InputSizeMap[this.realSize] || 40;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
if (!isEmpty(this.value)) {
|
|
354
|
-
this.computePresentContent();
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
this.filterHandler = debounce(this.debounce, () => {
|
|
358
|
-
const { inputValue } = this;
|
|
359
|
-
|
|
360
|
-
if (!inputValue) {
|
|
361
|
-
this.filtering = false;
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
const before = this.beforeFilter(inputValue);
|
|
366
|
-
if (before && before.then) {
|
|
367
|
-
before.then(this.getSuggestions);
|
|
368
|
-
} else if (before !== false) {
|
|
369
|
-
this.getSuggestions();
|
|
370
|
-
} else {
|
|
371
|
-
this.filtering = false;
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
addResizeListener(this.$el, this.updateStyle);
|
|
376
|
-
},
|
|
377
|
-
|
|
378
|
-
beforeDestroy() {
|
|
379
|
-
removeResizeListener(this.$el, this.updateStyle);
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
methods: {
|
|
383
|
-
getMigratingConfig() {
|
|
384
|
-
return {
|
|
385
|
-
props: {
|
|
386
|
-
'expand-trigger': 'expand-trigger is removed, use `props.expandTrigger` instead.',
|
|
387
|
-
'change-on-select': 'change-on-select is removed, use `props.checkStrictly` instead.',
|
|
388
|
-
'hover-threshold': 'hover-threshold is removed, use `props.hoverThreshold` instead'
|
|
389
|
-
},
|
|
390
|
-
events: {
|
|
391
|
-
'active-item-change': 'active-item-change is renamed to expand-change'
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
},
|
|
395
|
-
toggleDropDownVisible(visible) {
|
|
396
|
-
if (this.isDisabled) return;
|
|
397
|
-
|
|
398
|
-
const { dropDownVisible } = this;
|
|
399
|
-
const { input } = this.$refs;
|
|
400
|
-
visible = isDef(visible) ? visible : !dropDownVisible;
|
|
401
|
-
if (visible !== dropDownVisible) {
|
|
402
|
-
this.dropDownVisible = visible;
|
|
403
|
-
if (visible) {
|
|
404
|
-
this.$nextTick(() => {
|
|
405
|
-
this.updatePopper();
|
|
406
|
-
this.panel.scrollIntoView();
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
input.$refs.input.setAttribute('aria-expanded', visible);
|
|
410
|
-
this.$emit('visible-change', visible);
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
handleDropdownLeave() {
|
|
414
|
-
this.filtering = false;
|
|
415
|
-
this.inputValue = this.presentText;
|
|
416
|
-
},
|
|
417
|
-
handleKeyDown(event) {
|
|
418
|
-
switch (event.keyCode) {
|
|
419
|
-
case KeyCode.enter:
|
|
420
|
-
this.toggleDropDownVisible();
|
|
421
|
-
break;
|
|
422
|
-
case KeyCode.down:
|
|
423
|
-
this.toggleDropDownVisible(true);
|
|
424
|
-
this.focusFirstNode();
|
|
425
|
-
event.preventDefault();
|
|
426
|
-
break;
|
|
427
|
-
case KeyCode.esc:
|
|
428
|
-
case KeyCode.tab:
|
|
429
|
-
this.toggleDropDownVisible(false);
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
},
|
|
433
|
-
handleFocus(e) {
|
|
434
|
-
this.$emit('focus', e);
|
|
435
|
-
},
|
|
436
|
-
handleBlur(e) {
|
|
437
|
-
this.$emit('blur', e);
|
|
438
|
-
},
|
|
439
|
-
handleInput(val, event) {
|
|
440
|
-
!this.dropDownVisible && this.toggleDropDownVisible(true);
|
|
441
|
-
|
|
442
|
-
if (event && event.isComposing) return;
|
|
443
|
-
if (val) {
|
|
444
|
-
this.filterHandler();
|
|
445
|
-
} else {
|
|
446
|
-
this.filtering = false;
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
handleClear() {
|
|
450
|
-
this.presentText = '';
|
|
451
|
-
this.panel.clearCheckedNodes();
|
|
452
|
-
},
|
|
453
|
-
handleExpandChange(value) {
|
|
454
|
-
this.$nextTick(this.updatePopper.bind(this));
|
|
455
|
-
this.$emit('expand-change', value);
|
|
456
|
-
this.$emit('active-item-change', value); // Deprecated
|
|
457
|
-
},
|
|
458
|
-
focusFirstNode() {
|
|
459
|
-
this.$nextTick(() => {
|
|
460
|
-
const { filtering } = this;
|
|
461
|
-
const { popper, suggestionPanel } = this.$refs;
|
|
462
|
-
let firstNode = null;
|
|
463
|
-
|
|
464
|
-
if (filtering && suggestionPanel) {
|
|
465
|
-
firstNode = suggestionPanbase.$el.querySelector('.base-cascader__suggestion-item');
|
|
466
|
-
} else {
|
|
467
|
-
const firstMenu = popper.querySelector('.base-cascader-menu');
|
|
468
|
-
firstNode = firstMenu.querySelector('.base-cascader-node[tabindex="-1"]');
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
if (firstNode) {
|
|
472
|
-
firstNode.focus();
|
|
473
|
-
!filtering && firstNode.click();
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
},
|
|
477
|
-
computePresentContent() {
|
|
478
|
-
// nextTick is required, because checked nodes may not change right now
|
|
479
|
-
this.$nextTick(() => {
|
|
480
|
-
if (this.config.multiple) {
|
|
481
|
-
this.computePresentTags();
|
|
482
|
-
this.presentText = this.presentTags.length ? ' ' : null;
|
|
483
|
-
} else {
|
|
484
|
-
this.computePresentText();
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
},
|
|
488
|
-
computePresentText() {
|
|
489
|
-
const { checkedValue, config } = this;
|
|
490
|
-
if (!isEmpty(checkedValue)) {
|
|
491
|
-
const node = this.panel.getNodeByValue(checkedValue);
|
|
492
|
-
if (node && (config.checkStrictly || node.isLeaf)) {
|
|
493
|
-
this.presentText = node.getText(this.showAllLevels, this.separator);
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
this.presentText = null;
|
|
498
|
-
},
|
|
499
|
-
computePresentTags() {
|
|
500
|
-
const { isDisabled, leafOnly, showAllLevels, separator, collapseTags } = this;
|
|
501
|
-
const checkedNodes = this.getCheckedNodes(leafOnly);
|
|
502
|
-
const tags = [];
|
|
503
|
-
|
|
504
|
-
const genTag = node => ({
|
|
505
|
-
node,
|
|
506
|
-
key: node.uid,
|
|
507
|
-
text: node.getText(showAllLevels, separator),
|
|
508
|
-
hitState: false,
|
|
509
|
-
closable: !isDisabled && !node.isDisabled
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
if (checkedNodes.length) {
|
|
513
|
-
const [first, ...rest] = checkedNodes;
|
|
514
|
-
const restCount = rest.length;
|
|
515
|
-
tags.push(genTag(first));
|
|
516
|
-
|
|
517
|
-
if (restCount) {
|
|
518
|
-
if (collapseTags) {
|
|
519
|
-
tags.push({
|
|
520
|
-
key: -1,
|
|
521
|
-
text: `+ ${restCount}`,
|
|
522
|
-
closable: false
|
|
523
|
-
});
|
|
524
|
-
} else {
|
|
525
|
-
rest.forEach(node => tags.push(genTag(node)));
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
this.checkedNodes = checkedNodes;
|
|
531
|
-
this.presentTags = tags;
|
|
532
|
-
},
|
|
533
|
-
getSuggestions() {
|
|
534
|
-
let { filterMethod } = this;
|
|
535
|
-
|
|
536
|
-
if (!isFunction(filterMethod)) {
|
|
537
|
-
filterMethod = (node, keyword) => node.text.includes(keyword);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
const suggestions = this.panel.getFlattedNodes(this.leafOnly)
|
|
541
|
-
.filter(node => {
|
|
542
|
-
if (node.isDisabled) return false;
|
|
543
|
-
node.text = node.getText(this.showAllLevels, this.separator) || '';
|
|
544
|
-
return filterMethod(node, this.inputValue);
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
if (this.multiple) {
|
|
548
|
-
this.presentTags.forEach(tag => {
|
|
549
|
-
tag.hitState = false;
|
|
550
|
-
});
|
|
551
|
-
} else {
|
|
552
|
-
suggestions.forEach(node => {
|
|
553
|
-
node.checked = isEqual(this.checkedValue, node.getValueByOption());
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
this.filtering = true;
|
|
558
|
-
this.suggestions = suggestions;
|
|
559
|
-
this.$nextTick(this.updatePopper);
|
|
560
|
-
},
|
|
561
|
-
handleSuggestionKeyDown(event) {
|
|
562
|
-
const { keyCode, target } = event;
|
|
563
|
-
switch (keyCode) {
|
|
564
|
-
case KeyCode.enter:
|
|
565
|
-
target.click();
|
|
566
|
-
break;
|
|
567
|
-
case KeyCode.up:
|
|
568
|
-
const prev = target.previousElementSibling;
|
|
569
|
-
prev && prev.focus();
|
|
570
|
-
break;
|
|
571
|
-
case KeyCode.down:
|
|
572
|
-
const next = target.nextElementSibling;
|
|
573
|
-
next && next.focus();
|
|
574
|
-
break;
|
|
575
|
-
case KeyCode.esc:
|
|
576
|
-
case KeyCode.tab:
|
|
577
|
-
this.toggleDropDownVisible(false);
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
},
|
|
581
|
-
handleDelete() {
|
|
582
|
-
const { inputValue, pressDeleteCount, presentTags } = this;
|
|
583
|
-
const lastIndex = presentTags.length - 1;
|
|
584
|
-
const lastTag = presentTags[lastIndex];
|
|
585
|
-
this.pressDeleteCount = inputValue ? 0 : pressDeleteCount + 1;
|
|
586
|
-
|
|
587
|
-
if (!lastTag) return;
|
|
588
|
-
|
|
589
|
-
if (this.pressDeleteCount) {
|
|
590
|
-
if (lastTag.hitState) {
|
|
591
|
-
this.deleteTag(lastIndex);
|
|
592
|
-
} else {
|
|
593
|
-
lastTag.hitState = true;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
},
|
|
597
|
-
handleSuggestionClick(index) {
|
|
598
|
-
const { multiple } = this;
|
|
599
|
-
const targetNode = this.suggestions[index];
|
|
600
|
-
|
|
601
|
-
if (multiple) {
|
|
602
|
-
const { checked } = targetNode;
|
|
603
|
-
targetNode.doCheck(!checked);
|
|
604
|
-
this.panel.calculateMultiCheckedValue();
|
|
605
|
-
} else {
|
|
606
|
-
this.checkedValue = targetNode.getValueByOption();
|
|
607
|
-
this.toggleDropDownVisible(false);
|
|
608
|
-
}
|
|
609
|
-
},
|
|
610
|
-
deleteTag(index) {
|
|
611
|
-
const { checkedValue } = this;
|
|
612
|
-
const val = checkedValue[index];
|
|
613
|
-
this.checkedValue = checkedValue.filter((n, i) => i !== index);
|
|
614
|
-
this.$emit('remove-tag', val);
|
|
615
|
-
},
|
|
616
|
-
updateStyle() {
|
|
617
|
-
const { $el, inputInitialHeight } = this;
|
|
618
|
-
if (this.$isServer || !$el) return;
|
|
619
|
-
|
|
620
|
-
const { suggestionPanel } = this.$refs;
|
|
621
|
-
const inputInner = $el.querySelector('.base-input__inner');
|
|
622
|
-
|
|
623
|
-
if (!inputInner) return;
|
|
624
|
-
|
|
625
|
-
const tags = $el.querySelector('.base-cascader__tags');
|
|
626
|
-
let suggestionPanelEl = null;
|
|
627
|
-
|
|
628
|
-
if (suggestionPanel && (suggestionPanelEl = suggestionPanbase.$el)) {
|
|
629
|
-
const suggestionList = suggestionPanelEl.querySelector('.base-cascader__suggestion-list');
|
|
630
|
-
suggestionList.style.minWidth = inputInner.offsetWidth + 'px';
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
if (tags) {
|
|
634
|
-
const { offsetHeight } = tags;
|
|
635
|
-
const height = Math.max(offsetHeight + 6, inputInitialHeight) + 'px';
|
|
636
|
-
inputInner.style.height = height;
|
|
637
|
-
this.updatePopper();
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
|
|
641
|
-
/**
|
|
642
|
-
* public methods
|
|
643
|
-
*/
|
|
644
|
-
getCheckedNodes(leafOnly) {
|
|
645
|
-
return this.panel.getCheckedNodes(leafOnly);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
</script>
|
|
650
|
-
|