bkui-vue 0.0.1-beta.193 → 0.0.1-beta.195

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
@@ -33,7 +33,7 @@ var __publicField = (obj, key2, value) => {
33
33
  __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
34
34
  return value;
35
35
  };
36
- import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, isVNode, withDirectives, vShow, renderSlot, Fragment, toRefs, createApp, Teleport, resolveDirective, customRef, onBeforeMount, toRef, vModelText, unref, watchEffect, onUpdated, render as render$1, onUnmounted, shallowRef, toRaw, withModifiers, TransitionGroup } from "vue";
36
+ import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, isVNode, withDirectives, vShow, renderSlot, Fragment, toRefs, createApp, Teleport, resolveDirective, customRef, onBeforeMount, toRef, vModelText, unref, watchEffect, markRaw, onUpdated, render as render$1, onUnmounted, shallowRef, toRaw, withModifiers, TransitionGroup } from "vue";
37
37
  var reset = "";
38
38
  var alert = "";
39
39
  var affix = "";
@@ -10680,6 +10680,7 @@ const EventProps$2 = {
10680
10680
  onAfterShow: Function
10681
10681
  };
10682
10682
  const PopoverProps$1 = __spreadValues({
10683
+ contentCls: PropTypes.string.def(""),
10683
10684
  isShow: PropTypes.bool.def(false),
10684
10685
  always: PropTypes.bool.def(false),
10685
10686
  disabled: PropTypes.bool.def(false),
@@ -10818,11 +10819,13 @@ var Component$q = defineComponent({
10818
10819
  const handleAfterLeave = () => {
10819
10820
  ctx.emit("after-leave");
10820
10821
  };
10821
- const customThemeCls = compTheme.value.customThemes.join(" ");
10822
- const customTheme = compTheme.value.customThemes.reduce((out, cur) => __spreadValues({
10822
+ const customTheme = computed(() => compTheme.value.customThemes.reduce((out, cur) => __spreadValues({
10823
10823
  [`data-${cur}-theme`]: true
10824
- }, out), {});
10825
- const contentClass = `bk-popover-content ${customThemeCls}`;
10824
+ }, out), {}));
10825
+ const contentClass = computed(() => {
10826
+ const customThemeCls = compTheme.value.customThemes.join(" ");
10827
+ return `bk-popover-content ${customThemeCls} ${props2.contentCls}`.trim();
10828
+ });
10826
10829
  const handleClickContent = (e) => {
10827
10830
  const stopBehaviorFn = (behavior) => {
10828
10831
  if (typeof e[behavior] === "function") {
@@ -10853,9 +10856,9 @@ var Component$q = defineComponent({
10853
10856
  var _a2, _b2, _c;
10854
10857
  return [createVNode("div", mergeProps({
10855
10858
  "ref": refContent,
10856
- "class": contentClass,
10859
+ "class": contentClass.value,
10857
10860
  "style": compStyle.value
10858
- }, customTheme, {
10861
+ }, customTheme.value, {
10859
10862
  "onClick": handleClickContent
10860
10863
  }), [(_c = (_b2 = (_a2 = ctx.slots).content) == null ? void 0 : _b2.call(_a2)) != null ? _c : content.value, arrow2.value && createVNode("div", {
10861
10864
  "class": "arrow",
@@ -18884,12 +18887,12 @@ function useFlatList(props2) {
18884
18887
  displayKey,
18885
18888
  list
18886
18889
  } = toRefs(props2);
18887
- const flatList = reactive([]);
18890
+ const flatList = ref([]);
18888
18891
  watch([useGroup, saveKey, displayKey, list], () => {
18889
- flatList.splice(0, flatList.length);
18890
- let formatList = list.value;
18892
+ flatList.value = [];
18893
+ let formatList = markRaw(list.value);
18891
18894
  if (useGroup.value) {
18892
- formatList = list.value.reduce((formatList2, item) => {
18895
+ formatList = formatList.reduce((formatList2, item) => {
18893
18896
  let children = [];
18894
18897
  if (item.children) {
18895
18898
  children = item.children.map((child) => __spreadValues({
@@ -18902,16 +18905,8 @@ function useFlatList(props2) {
18902
18905
  return formatList2.concat(children);
18903
18906
  }, []);
18904
18907
  }
18905
- appendToTargetList(formatList);
18906
- }, { immediate: true, deep: true });
18907
- function appendToTargetList(targetList) {
18908
- const QUANTUM = 3e4;
18909
- const len = targetList.length;
18910
- for (let i2 = 0; i2 < len; i2 += QUANTUM) {
18911
- const appendList = targetList.slice(i2, Math.min(i2 + QUANTUM, len));
18912
- flatList.push(...appendList);
18913
- }
18914
- }
18908
+ flatList.value = formatList;
18909
+ }, { immediate: true });
18915
18910
  return flatList;
18916
18911
  }
18917
18912
  const getCharLength = (str) => {
@@ -19003,7 +18998,8 @@ const tagProps = () => ({
19003
18998
  withValidate: {
19004
18999
  type: Boolean,
19005
19000
  default: true
19006
- }
19001
+ },
19002
+ popoverProps: Object
19007
19003
  });
19008
19004
  var TagRender = defineComponent({
19009
19005
  name: "TagRender",
@@ -19042,7 +19038,7 @@ var Component$c = defineComponent({
19042
19038
  isHover: false,
19043
19039
  focusItemIndex: props2.allowCreate ? -1 : 0
19044
19040
  });
19045
- const popoverProps = reactive({
19041
+ const popoverProps = reactive(__spreadValues({
19046
19042
  isShow: false,
19047
19043
  width: 190,
19048
19044
  modifiers: [{
@@ -19051,7 +19047,7 @@ var Component$c = defineComponent({
19051
19047
  offset: [0, 4]
19052
19048
  }
19053
19049
  }]
19054
- });
19050
+ }, props2.popoverProps));
19055
19051
  const {
19056
19052
  maxResult
19057
19053
  } = toRefs(props2);
@@ -19077,7 +19073,7 @@ var Component$c = defineComponent({
19077
19073
  active: state.isEdit,
19078
19074
  disabled: props2.disabled
19079
19075
  }));
19080
- watch([() => [...props2.modelValue], () => [...props2.list]], () => {
19076
+ watch([() => props2.modelValue, () => props2.list], () => {
19081
19077
  var _a;
19082
19078
  nextTick(() => {
19083
19079
  initData();
@@ -19212,7 +19208,7 @@ var Component$c = defineComponent({
19212
19208
  trigger
19213
19209
  } = props2;
19214
19210
  listState.selectedTagList = [];
19215
- listState.localList = [...formatList];
19211
+ listState.localList = formatList.value;
19216
19212
  if (modelValue.length) {
19217
19213
  modelValue.forEach((tag2) => {
19218
19214
  const value = listState.localList.find((val) => tag2 === val[saveKey]);
@@ -19386,7 +19382,7 @@ var Component$c = defineComponent({
19386
19382
  e.stopPropagation();
19387
19383
  const removeList = listState.selectedTagList;
19388
19384
  listState.selectedTagList = [];
19389
- const existList = formatList.filter((item) => removeList.some((removeItem) => removeItem[props2.saveKey] === item[props2.saveKey]));
19385
+ const existList = formatList.value.filter((item) => removeList.some((removeItem) => removeItem[props2.saveKey] === item[props2.saveKey]));
19390
19386
  if ((props2.allowCreate && existList.length !== 0 || !props2.allowCreate) && !isSingleSelect.value) {
19391
19387
  listState.localList.push(...existList);
19392
19388
  }
@@ -19420,7 +19416,7 @@ var Component$c = defineComponent({
19420
19416
  swapElementPositions(tagInputItemRef.value, nodes[index - 1]);
19421
19417
  listState.selectedTagList.splice(index - 1, 1);
19422
19418
  focusInputTrigger();
19423
- const isExistInit = formatList.some((item) => item === target[props2.saveKey]);
19419
+ const isExistInit = formatList.value.some((item) => item === target[props2.saveKey]);
19424
19420
  if ((props2.allowCreate && isExistInit || !props2.allowCreate) && !isSingleSelect.value) {
19425
19421
  listState.localList.push(target);
19426
19422
  }
@@ -19643,7 +19639,7 @@ var Component$c = defineComponent({
19643
19639
  };
19644
19640
  const removeTag = (data2, index) => {
19645
19641
  listState.selectedTagList.splice(index, 1);
19646
- const isExistInit = formatList.some((item) => item === data2[props2.saveKey]);
19642
+ const isExistInit = formatList.value.some((item) => item === data2[props2.saveKey]);
19647
19643
  if ((props2.allowCreate && isExistInit || !props2.allowCreate) && !isSingleSelect.value) {
19648
19644
  listState.localList.push(data2);
19649
19645
  }
@@ -19678,56 +19674,20 @@ var Component$c = defineComponent({
19678
19674
  });
19679
19675
  },
19680
19676
  render() {
19681
- const renderSelectorList = () => {
19682
- if (this.useGroup) {
19683
- return this.renderList.map((group) => createVNode("li", {
19684
- "class": "bk-selector-group-item"
19685
- }, [createVNode("span", {
19686
- "class": "group-name"
19687
- }, [group.name, createTextVNode(" ("), group.children.length, createTextVNode(")")]), createVNode("ul", {
19688
- "class": "bk-selector-group-list-item"
19689
- }, [group.children.map((item, index) => createVNode("li", {
19690
- "class": ["bk-selector-list-item", {
19691
- disabled: item.disabled
19692
- }, this.activeClass(item, index)],
19693
- "onClick": this.handleTagSelected.bind(this, item, "select")
19694
- }, [createVNode(ListTagRender, {
19695
- "node": item,
19696
- "displayKey": this.displayKey,
19697
- "tpl": this.tpl,
19698
- "searchKey": this.searchKey,
19699
- "searchKeyword": this.curInputValue
19700
- }, null)]))])]));
19701
- }
19702
- return this.renderList.map((item, index) => createVNode("li", {
19703
- "class": ["bk-selector-list-item", {
19704
- disabled: item.disabled
19705
- }, this.activeClass(item, index)],
19706
- "onClick": this.handleTagSelected.bind(this, item, "select")
19707
- }, [createVNode(ListTagRender, {
19708
- "node": item,
19709
- "displayKey": this.displayKey,
19710
- "tpl": this.tpl,
19711
- "searchKey": this.searchKey,
19712
- "searchKeyword": this.curInputValue
19713
- }, null)]));
19714
- };
19715
19677
  return createVNode("div", {
19716
19678
  "class": "bk-tag-input",
19717
19679
  "ref": "bkTagSelectorRef",
19718
19680
  "onClick": this.focusInputTrigger,
19719
19681
  "onMouseenter": () => this.isHover = true,
19720
19682
  "onMouseleave": () => this.isHover = false
19721
- }, [createVNode(BkPopover, {
19683
+ }, [createVNode(BkPopover, mergeProps({
19722
19684
  "ref": "popoverRef",
19723
19685
  "theme": "light",
19724
19686
  "trigger": "manual",
19725
19687
  "placement": "bottom-start",
19726
- "arrow": false,
19727
- "width": this.popoverProps.width,
19728
- "isShow": this.popoverProps.isShow,
19729
- "modifiers": this.popoverProps.modifiers
19730
- }, {
19688
+ "content-cls": "bk-tag-input-popover-content",
19689
+ "arrow": false
19690
+ }, this.popoverProps), {
19731
19691
  default: () => {
19732
19692
  var _a, _b, _c;
19733
19693
  return createVNode("div", {
@@ -19787,7 +19747,35 @@ var Component$c = defineComponent({
19787
19747
  "max-height": `${this.contentMaxHeight}px`
19788
19748
  },
19789
19749
  "class": "outside-ul"
19790
- }, [renderSelectorList(), this.isPageLoading ? createVNode("li", {
19750
+ }, [this.renderList.map((group, index) => this.useGroup ? createVNode("li", {
19751
+ "class": "bk-selector-group-item"
19752
+ }, [createVNode("span", {
19753
+ "class": "group-name"
19754
+ }, [group.name, createTextVNode(" ("), group.children.length, createTextVNode(")")]), createVNode("ul", {
19755
+ "class": "bk-selector-group-list-item"
19756
+ }, [group.children.map((item, index2) => createVNode("li", {
19757
+ "class": ["bk-selector-list-item", {
19758
+ disabled: item.disabled
19759
+ }, this.activeClass(item, index2)],
19760
+ "onClick": this.handleTagSelected.bind(this, item, "select")
19761
+ }, [createVNode(ListTagRender, {
19762
+ "node": item,
19763
+ "displayKey": this.displayKey,
19764
+ "tpl": this.tpl,
19765
+ "searchKey": this.searchKey,
19766
+ "searchKeyword": this.curInputValue
19767
+ }, null)]))])]) : createVNode("li", {
19768
+ "class": ["bk-selector-list-item", {
19769
+ disabled: group.disabled
19770
+ }, this.activeClass(group, index)],
19771
+ "onClick": this.handleTagSelected.bind(this, group, "select")
19772
+ }, [createVNode(ListTagRender, {
19773
+ "node": group,
19774
+ "displayKey": this.displayKey,
19775
+ "tpl": this.tpl,
19776
+ "searchKey": this.searchKey,
19777
+ "searchKeyword": this.curInputValue
19778
+ }, null)])), this.isPageLoading ? createVNode("li", {
19791
19779
  "class": "bk-selector-list-item loading"
19792
19780
  }, [createVNode(BkLoading, {
19793
19781
  "theme": "primary",
@@ -31256,12 +31244,13 @@ var useFileHandler = (props2, hooks) => {
31256
31244
  remove(uploadFile);
31257
31245
  }
31258
31246
  }
31259
- async function handleError(err, rawFile) {
31247
+ async function handleError(err, rawFile, res) {
31260
31248
  const file = findFile(rawFile);
31261
31249
  if (!file)
31262
31250
  return;
31263
31251
  file.status = "fail";
31264
31252
  file.statusText = err.message;
31253
+ file.response = res;
31265
31254
  }
31266
31255
  async function handleSuccess(res, rawFile) {
31267
31256
  const file = findFile(rawFile);
@@ -31425,7 +31414,7 @@ var Component$1 = defineComponent({
31425
31414
  emit("success", res, file, fileList.value);
31426
31415
  } else {
31427
31416
  const err = new Error((result == null ? void 0 : result.message) || "unknow error");
31428
- handleError(err, file);
31417
+ handleError(err, file, res);
31429
31418
  emit("error", file, fileList.value, err);
31430
31419
  }
31431
31420
  delete requests.value[uid];