bkui-vue 0.0.1-beta.346 → 0.0.1-beta.347

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
@@ -37860,7 +37860,6 @@ var SearchSelectInput = defineComponent({
37860
37860
  const {
37861
37861
  values
37862
37862
  } = usingItem.value;
37863
- debugger;
37864
37863
  if (!(values == null ? void 0 : values.length)) {
37865
37864
  if ((_a = keyword.value) == null ? void 0 : _a.length) {
37866
37865
  if (keyword.value.includes(valueSplitCode.value)) {
@@ -37902,6 +37901,7 @@ var SearchSelectInput = defineComponent({
37902
37901
  var _a, _b;
37903
37902
  if (!usingItem.value && !keyword.value) {
37904
37903
  emit("delete");
37904
+ nextTick(setMenuList);
37905
37905
  return;
37906
37906
  }
37907
37907
  if ((_a = usingItem.value) == null ? void 0 : _a.values.length) {
@@ -38003,15 +38003,15 @@ var SearchSelectInput = defineComponent({
38003
38003
  async function setMenuList() {
38004
38004
  var _a, _b, _c, _d, _e;
38005
38005
  let list = [];
38006
- if (typeof props2.getMenuList === "function" && !((_b = (_a = usingItem.value) == null ? void 0 : _a.searchItem) == null ? void 0 : _b.async)) {
38006
+ if (typeof props2.getMenuList === "function" && (typeof ((_b = (_a = usingItem.value) == null ? void 0 : _a.searchItem) == null ? void 0 : _b.async) === "undefined" || usingItem.value.searchItem.async === true)) {
38007
38007
  loading2.value = true;
38008
38008
  list = await props2.getMenuList((_c = usingItem.value) == null ? void 0 : _c.searchItem, keyword.value).catch(() => []);
38009
38009
  loading2.value = false;
38010
38010
  } else if (!(usingItem == null ? void 0 : usingItem.value)) {
38011
38011
  if (!((_d = keyword.value) == null ? void 0 : _d.length)) {
38012
- list = props2.data.slice();
38012
+ list = props2.data.filter((item) => !item.isSelected).slice();
38013
38013
  } else
38014
- props2.data.forEach((item) => {
38014
+ props2.data.filter((item) => !item.isSelected).forEach((item) => {
38015
38015
  var _a2, _b2;
38016
38016
  const isMatched = item.name.toLocaleLowerCase().includes(keyword.value.toLocaleLowerCase());
38017
38017
  if (isMatched) {
@@ -38320,6 +38320,10 @@ const SearchSelectProps = {
38320
38320
  valueSplitCode: {
38321
38321
  type: String,
38322
38322
  default: "|"
38323
+ },
38324
+ uniqueSelect: {
38325
+ type: Boolean,
38326
+ default: false
38323
38327
  }
38324
38328
  };
38325
38329
  var Component = defineComponent({
@@ -38341,14 +38345,28 @@ var Component = defineComponent({
38341
38345
  const editKey = ref("");
38342
38346
  const validateStr = ref("");
38343
38347
  const splitCode = computed(() => props2.valueSplitCode);
38348
+ let copyData;
38349
+ watch(() => props2.data, () => {
38350
+ var _a;
38351
+ copyData = ref(JSON.parse(JSON.stringify(props2.data)));
38352
+ (_a = copyData.value) == null ? void 0 : _a.forEach((item) => {
38353
+ item.isSelected = !!props2.modelValue.some((set) => set.id === item.id);
38354
+ });
38355
+ }, {
38356
+ immediate: true
38357
+ });
38344
38358
  watch(() => props2.modelValue, (v2) => {
38359
+ var _a, _b;
38345
38360
  if (!(v2 == null ? void 0 : v2.length)) {
38346
38361
  selectedList.value = [];
38362
+ (_a = copyData.value) == null ? void 0 : _a.forEach((item) => {
38363
+ item.isSelected = false;
38364
+ });
38347
38365
  return;
38348
38366
  }
38349
38367
  const list = [];
38350
38368
  v2.forEach((item) => {
38351
- var _a;
38369
+ var _a2;
38352
38370
  const seleted = selectedList.value.find((set) => set.id === item.id && set.name === item.name);
38353
38371
  if ((seleted == null ? void 0 : seleted.toValueKey()) === JSON.stringify(item)) {
38354
38372
  seleted.values = item.values || [];
@@ -38360,7 +38378,7 @@ var Component = defineComponent({
38360
38378
  searchItem = props2.conditions.find((set) => set.id === item.id);
38361
38379
  searchItem && (searchType = "condition");
38362
38380
  }
38363
- if (!searchItem && !((_a = item.values) == null ? void 0 : _a.length)) {
38381
+ if (!searchItem && !((_a2 = item.values) == null ? void 0 : _a2.length)) {
38364
38382
  searchType = "text";
38365
38383
  }
38366
38384
  const newSelected = new SelectedItem(searchItem || item, searchType, splitCode.value);
@@ -38369,6 +38387,9 @@ var Component = defineComponent({
38369
38387
  }
38370
38388
  });
38371
38389
  selectedList.value = list;
38390
+ (_b = copyData.value) == null ? void 0 : _b.forEach((item) => {
38391
+ item.isSelected = !!list.some((set) => set.id === item.id);
38392
+ });
38372
38393
  }, {
38373
38394
  immediate: true,
38374
38395
  deep: true
@@ -38466,6 +38487,7 @@ var Component = defineComponent({
38466
38487
  inputRef,
38467
38488
  wrapRef,
38468
38489
  isFocus,
38490
+ copyData,
38469
38491
  selectedList,
38470
38492
  overflowIndex,
38471
38493
  validateStr,
@@ -38508,7 +38530,7 @@ var Component = defineComponent({
38508
38530
  maxHeight
38509
38531
  }
38510
38532
  }, [createVNode(SearchSelected, {
38511
- "data": this.data,
38533
+ "data": this.copyData,
38512
38534
  "conditions": this.conditions,
38513
38535
  "selectedList": this.selectedList,
38514
38536
  "overflowIndex": this.overflowIndex,
@@ -38519,7 +38541,7 @@ var Component = defineComponent({
38519
38541
  "class": "search-container-input"
38520
38542
  }, [createVNode(SearchSelectInput, {
38521
38543
  "ref": "inputRef",
38522
- "data": this.data,
38544
+ "data": this.copyData,
38523
38545
  "showInputBefore": !this.selectedList.length,
38524
38546
  "showCondition": showCondition,
38525
38547
  "conditions": this.conditions,