|
70 | 70 | </tiny-filter-box> |
71 | 71 | <div |
72 | 72 | ref="tags" |
73 | | - :class="['tiny-base-select__tags', { 'is-showicon': slots.prefix, 'not-selected': !state.selected.length }]" |
| 73 | + :class="[ |
| 74 | + 'tiny-base-select__tags', |
| 75 | + { 'is-showicon': slots.prefix, 'not-selected': !state.selected.length }, |
| 76 | + { 'is-show-tag': !state.isShowTagText } |
| 77 | + ]" |
74 | 78 | v-if="multiple && !state.isDisplayOnly && !shape" |
75 | 79 | :style="state.tagsStyle" |
76 | 80 | > |
77 | | - <span v-if="!state.selectDisabled"> |
| 81 | + <span v-if="!state.isShowTagText"> |
78 | 82 | <span v-if="collapseTags && state.selected.length"> |
79 | 83 | <tiny-tag |
80 | 84 | :closable="!state.selectDisabled" |
|
119 | 123 | <span class="tiny-base-select__tags-text">+ {{ state.selected.length - 1 }}</span> |
120 | 124 | </tiny-tag> |
121 | 125 | </span> |
| 126 | + <!-- 显示所有标签的循环 --> |
122 | 127 | <span ref="tags-content" v-if="!collapseTags"> |
| 128 | + <!-- 当 showAllTextTag 时, 用all-text属性做为tag。 xdesign规范 --> |
123 | 129 | <tiny-tag |
124 | | - v-if="hoverExpand || clickExpand" |
125 | | - :class="['tiny-base-select__tags-collapse', { 'is-hidden': state.isHidden }]" |
| 130 | + v-if="showAllTextTag && state.selectCls === 'checked-sur'" |
126 | 131 | :type="state.getTagType" |
127 | | - key="tags-collapse" |
128 | | - data-tag="tags-collapse" |
129 | | - :closable="false" |
| 132 | + key="tags-all-text-tag" |
| 133 | + data-tag="tags-all-text-tag" |
| 134 | + :disabled="state.isDisabled" |
| 135 | + :closable="true" |
130 | 136 | :size="state.collapseTagSize" |
131 | | - @click="onClickCollapseTag($event)" |
| 137 | + @close="toggleCheckAll(false)" |
132 | 138 | > |
133 | | - <template v-if="hoverExpand"> + {{ state.collapseTagsLength }} </template> |
134 | | - <icon-ellipsis v-else></icon-ellipsis> |
| 139 | + {{ allText || t('ui.base.all') }} |
135 | 140 | </tiny-tag> |
136 | | - <tiny-tag |
137 | | - v-for="(item, index) in state.selected" |
138 | | - :key="getValueKey(item)" |
139 | | - :class="{ 'not-visible': state.toHideIndex <= index && !state.isExpand }" |
140 | | - :closable="!item.disabled && !item.required" |
141 | | - :size="state.collapseTagSize" |
142 | | - :hit="item.state ? item.state.hitState : item.hitState" |
143 | | - :type="state.getTagType" |
144 | | - @close="deleteTag($event, item)" |
145 | | - disable-transitions |
146 | | - > |
147 | | - <tiny-tooltip |
148 | | - effect="light" |
149 | | - placement="top" |
150 | | - @mouseenter.native="handleEnterTag($event, getValueKey(item))" |
| 141 | + <!-- 当非 showAllTextTag 时,原来的模式渲染 --> |
| 142 | + <template v-else> |
| 143 | + <tiny-tag |
| 144 | + v-if="hoverExpand || clickExpand" |
| 145 | + :class="['tiny-base-select__tags-collapse', { 'is-hidden': state.isHidden || state.isDisabled }]" |
| 146 | + :type="state.getTagType" |
| 147 | + key="tags-collapse" |
| 148 | + data-tag="tags-collapse" |
| 149 | + only-icon |
| 150 | + :closable="false" |
| 151 | + :size="state.collapseTagSize" |
| 152 | + @click="onClickCollapseTag($event)" |
151 | 153 | > |
152 | | - <span v-if="!state.visible && state.overflow === index" class="tiny-base-select__tags-text"> |
153 | | - {{ item.state ? item.state.currentLabel + '... ' : item.currentLabel + '... ' }} |
154 | | - </span> |
155 | | - <span v-else class="tiny-base-select__tags-text"> |
156 | | - <slot name="label" :item="getLabelSlotValue(item)"> |
157 | | - {{ item.state ? item.state.currentLabel : item.currentLabel }} |
158 | | - </slot> |
159 | | - </span> |
160 | | - <template v-if="state.tooltipContent[getValueKey(item)]" #content> |
161 | | - <span v-if="!state.visible && state.overflow === index"> |
| 154 | + <template v-if="hoverExpand"> + {{ state.collapseTagsLength }} </template> |
| 155 | + <icon-ellipsis v-else></icon-ellipsis> |
| 156 | + </tiny-tag> |
| 157 | + <tiny-tag |
| 158 | + v-for="(item, index) in state.selected" |
| 159 | + :key="getValueKey(item)" |
| 160 | + :class="{ |
| 161 | + 'not-visible': state.toHideIndex <= index && !state.isExpand, |
| 162 | + 'is-required': item.required |
| 163 | + }" |
| 164 | + :closable="isTagClosable(item)" |
| 165 | + :disabled="state.isDisabled || item.disabled" |
| 166 | + :size="state.collapseTagSize" |
| 167 | + :hit="item.state ? item.state.hitState : item.hitState" |
| 168 | + :type="state.getTagType" |
| 169 | + @close="deleteTag($event, item)" |
| 170 | + disable-transitions |
| 171 | + > |
| 172 | + <tiny-tooltip |
| 173 | + effect="light" |
| 174 | + placement="top" |
| 175 | + @mouseenter.native="handleEnterTag($event, getValueKey(item))" |
| 176 | + > |
| 177 | + <span v-if="!state.visible && state.overflow === index" class="tiny-base-select__tags-text"> |
162 | 178 | {{ item.state ? item.state.currentLabel + '... ' : item.currentLabel + '... ' }} |
163 | 179 | </span> |
164 | | - <span v-else> |
| 180 | + <span v-else class="tiny-base-select__tags-text"> |
165 | 181 | <slot name="label" :item="getLabelSlotValue(item)"> |
166 | 182 | {{ item.state ? item.state.currentLabel : item.currentLabel }} |
167 | 183 | </slot> |
168 | 184 | </span> |
169 | | - </template> |
170 | | - </tiny-tooltip> |
171 | | - </tiny-tag> |
| 185 | + <template v-if="state.tooltipContent[getValueKey(item)]" #content> |
| 186 | + <span v-if="!state.visible && state.overflow === index"> |
| 187 | + {{ item.state ? item.state.currentLabel + '... ' : item.currentLabel + '... ' }} |
| 188 | + </span> |
| 189 | + <span v-else> |
| 190 | + <slot name="label" :item="getLabelSlotValue(item)"> |
| 191 | + {{ item.state ? item.state.currentLabel : item.currentLabel }} |
| 192 | + </slot> |
| 193 | + </span> |
| 194 | + </template> |
| 195 | + </tiny-tooltip> |
| 196 | + </tiny-tag> |
172 | 197 |
|
173 | | - <!-- 收起按钮 --> |
174 | | - <span |
175 | | - v-if="clickExpand && state.showCollapseTag" |
176 | | - class="tiny-base-select__collapse-text" |
177 | | - @click="onClickCollapseTag($event)" |
178 | | - > |
179 | | - {{ t('ui.select.collapse') }} |
180 | | - <icon-chevron-up></icon-chevron-up> |
181 | | - </span> |
| 198 | + <!-- 收起按钮 --> |
| 199 | + <span |
| 200 | + v-if="clickExpand && state.showCollapseTag" |
| 201 | + class="tiny-base-select__collapse-text" |
| 202 | + @click="onClickCollapseTag($event)" |
| 203 | + > |
| 204 | + {{ t('ui.select.collapse') }} |
| 205 | + <icon-chevron-up></icon-chevron-up> |
| 206 | + </span> |
| 207 | + </template> |
182 | 208 | </span> |
183 | 209 | </span> |
184 | 210 |
|
@@ -694,6 +720,7 @@ export default defineComponent({ |
694 | 720 | 'showProportion', |
695 | 721 | 'clickExpand', |
696 | 722 | 'maxVisibleRows', |
| 723 | + 'showAllTextTag', |
697 | 724 | 'allText' |
698 | 725 | ], |
699 | 726 | setup(props, context) { |
|
0 commit comments