bkui-vue 0.0.1-beta.225 → 0.0.1-beta.226

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/dist/index.esm.js CHANGED
@@ -19349,6 +19349,31 @@ const getCharLength = (str) => {
19349
19349
  }
19350
19350
  return bitLen;
19351
19351
  };
19352
+ const useTagsOverflow = (tagInputRef, collapseTags, selectedTagList) => {
19353
+ watch([selectedTagList, collapseTags], () => {
19354
+ calcOverflow();
19355
+ }, { flush: "post" });
19356
+ const overflowTagIndex = ref(null);
19357
+ const calcOverflow = () => {
19358
+ if (!collapseTags.value)
19359
+ return;
19360
+ overflowTagIndex.value = null;
19361
+ setTimeout(() => {
19362
+ const tags = Array.from(tagInputRef.value.querySelectorAll(".tag-item"));
19363
+ const tagIndexInSecondRow = tags.findIndex((currentTag, index) => {
19364
+ if (!index) {
19365
+ return false;
19366
+ }
19367
+ const previousTag = tags[index - 1];
19368
+ return previousTag.offsetTop !== currentTag.offsetTop;
19369
+ });
19370
+ overflowTagIndex.value = tagIndexInSecondRow > 0 ? tagIndexInSecondRow - 1 : null;
19371
+ });
19372
+ };
19373
+ return {
19374
+ overflowTagIndex
19375
+ };
19376
+ };
19352
19377
  var ListTagRender = defineComponent({
19353
19378
  name: "ListTagRender",
19354
19379
  props: {
@@ -19425,6 +19450,10 @@ const tagProps = () => ({
19425
19450
  popoverProps: {
19426
19451
  type: Object,
19427
19452
  default: () => ({})
19453
+ },
19454
+ collapseTags: {
19455
+ type: Boolean,
19456
+ default: false
19428
19457
  }
19429
19458
  });
19430
19459
  var TagRender = defineComponent({
@@ -20091,6 +20120,10 @@ var Component$d = defineComponent({
20091
20120
  listState.localList.push(data2);
20092
20121
  }
20093
20122
  };
20123
+ const localCollapseTags = computed(() => props2.collapseTags ? props2.collapseTags && !state.isEdit : props2.collapseTags);
20124
+ const {
20125
+ overflowTagIndex
20126
+ } = useTagsOverflow(bkTagSelectorRef, localCollapseTags, tagList);
20094
20127
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
20095
20128
  popoverProps
20096
20129
  }, toRefs(state)), toRefs(listState)), toRefs(pageState)), {
@@ -20106,6 +20139,8 @@ var Component$d = defineComponent({
20106
20139
  selectorListRef,
20107
20140
  popoverRef,
20108
20141
  triggerClass,
20142
+ overflowTagIndex,
20143
+ localCollapseTags,
20109
20144
  focusInputTrigger,
20110
20145
  activeClass,
20111
20146
  handleInput,
@@ -20152,8 +20187,12 @@ var Component$d = defineComponent({
20152
20187
  content: item[this.tooltipKey],
20153
20188
  disabled: !this.tooltipKey
20154
20189
  };
20190
+ const isOverflow = this.localCollapseTags && this.overflowTagIndex && index >= this.overflowTagIndex;
20155
20191
  return withDirectives(createVNode("li", {
20156
20192
  "class": "tag-item",
20193
+ "style": {
20194
+ display: isOverflow ? "none" : ""
20195
+ },
20157
20196
  "onClick": this.tagFocus
20158
20197
  }, [createVNode(TagRender, {
20159
20198
  "node": item,
@@ -20178,7 +20217,13 @@ var Component$d = defineComponent({
20178
20217
  "onBlur": this.handleBlur,
20179
20218
  "onKeydown": this.handleKeydown,
20180
20219
  "onPaste": this.handlePaste
20181
- }, null), [[vModelText, this.curInputValue]])]), [[vShow, this.isEdit]])]), withDirectives(createVNode("p", {
20220
+ }, null), [[vModelText, this.curInputValue]])]), [[vShow, this.isEdit]]), !!this.overflowTagIndex && this.localCollapseTags && createVNode("li", {
20221
+ "class": "tag-item"
20222
+ }, [createVNode("div", {
20223
+ "class": "tag"
20224
+ }, [createVNode("span", {
20225
+ "class": "text"
20226
+ }, [createTextVNode("+"), this.selectedTagList.length - this.overflowTagIndex])])])]), withDirectives(createVNode("p", {
20182
20227
  "class": "placeholder"
20183
20228
  }, [this.placeholder]), [[vShow, this.isShowPlaceholder]]), (_c = (_b = (_a = this.$slots) == null ? void 0 : _a.suffix) == null ? void 0 : _b.call(_a)) != null ? _c : this.isShowClear && createVNode(close$1, {
20184
20229
  "class": "clear-icon",