bkui-vue 0.0.1-beta.345 → 0.0.1-beta.346
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.cjs.js +31 -31
- package/dist/index.esm.js +64 -37
- package/dist/index.umd.js +31 -31
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/search-select/index.d.ts +65 -7
- package/lib/search-select/index.js +1 -1
- package/lib/search-select/input.d.ts +2 -2
- package/lib/search-select/search-select.css +3 -2
- package/lib/search-select/search-select.d.ts +28 -2
- package/lib/search-select/search-select.less +8 -3
- package/lib/search-select/search-select.variable.css +3 -2
- package/lib/search-select/selected.d.ts +4 -4
- package/lib/search-select/utils.d.ts +5 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -37598,9 +37598,10 @@ var SearchInputMode = /* @__PURE__ */ ((SearchInputMode2) => {
|
|
37598
37598
|
return SearchInputMode2;
|
37599
37599
|
})(SearchInputMode || {});
|
37600
37600
|
class SelectedItem {
|
37601
|
-
constructor(searchItem, type = "default") {
|
37601
|
+
constructor(searchItem, type = "default", splitCode = "|") {
|
37602
37602
|
this.searchItem = searchItem;
|
37603
37603
|
this.type = type;
|
37604
|
+
this.splitCode = splitCode;
|
37604
37605
|
this.values = [];
|
37605
37606
|
this.id = searchItem.id;
|
37606
37607
|
this.name = searchItem.name;
|
@@ -37621,13 +37622,13 @@ class SelectedItem {
|
|
37621
37622
|
var _a;
|
37622
37623
|
if (this.isSpecialType())
|
37623
37624
|
return this.name;
|
37624
|
-
return `${this.keyInnerHtml}${((_a = this.values) == null ? void 0 : _a.map((item) => item.name).join(
|
37625
|
+
return `${this.keyInnerHtml}${((_a = this.values) == null ? void 0 : _a.map((item) => item.name).join(this.splitCode)) || ""}`;
|
37625
37626
|
}
|
37626
37627
|
get inputInnerText() {
|
37627
37628
|
var _a;
|
37628
37629
|
if (this.isSpecialType())
|
37629
37630
|
return this.name;
|
37630
|
-
return `${this.keyInnerText}${((_a = this.values) == null ? void 0 : _a.map((item) => item.name).join(
|
37631
|
+
return `${this.keyInnerText}${((_a = this.values) == null ? void 0 : _a.map((item) => item.name).join(this.splitCode)) || ""}`;
|
37631
37632
|
}
|
37632
37633
|
get keyInnerHtml() {
|
37633
37634
|
if (this.isSpecialType())
|
@@ -37697,7 +37698,7 @@ var SearchSelectInput = defineComponent({
|
|
37697
37698
|
type: String,
|
37698
37699
|
default: SearchInputMode.DEFAULT
|
37699
37700
|
},
|
37700
|
-
|
37701
|
+
getMenuList: Function,
|
37701
37702
|
validateValues: Function
|
37702
37703
|
},
|
37703
37704
|
emits: ["focus", "add", "delete"],
|
@@ -37720,7 +37721,8 @@ var SearchSelectInput = defineComponent({
|
|
37720
37721
|
const menuList = ref([]);
|
37721
37722
|
const {
|
37722
37723
|
editKey,
|
37723
|
-
onValidate
|
37724
|
+
onValidate,
|
37725
|
+
valueSplitCode
|
37724
37726
|
} = useSearchSelectInject();
|
37725
37727
|
watch(editKey, () => {
|
37726
37728
|
if (props2.mode === SearchInputMode.DEFAULT && editKey.value) {
|
@@ -37801,23 +37803,25 @@ var SearchSelectInput = defineComponent({
|
|
37801
37803
|
e && setMenuList();
|
37802
37804
|
}
|
37803
37805
|
function handleInputChange(event) {
|
37804
|
-
var _a, _b, _c, _d, _e, _f;
|
37806
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
37805
37807
|
clearInput();
|
37806
37808
|
let text = event.target.innerText;
|
37807
37809
|
if (/(\r|\n)/gm.test(text) || /\s{2}/gm.test(text)) {
|
37808
37810
|
event.preventDefault();
|
37809
|
-
text = text.replace(/(\r|\n)/gm,
|
37811
|
+
text = text.replace(/(\r|\n)/gm, valueSplitCode.value).replace(/\s{2}/gm, "");
|
37810
37812
|
inputRef.value.innerText = text;
|
37811
37813
|
setInputFocus();
|
37812
|
-
keyword.value = text;
|
37814
|
+
keyword.value = text.replace(((_a = usingItem.value) == null ? void 0 : _a.keyInnerText) || "", "").trim();
|
37813
37815
|
debounceSetMenuList();
|
37814
|
-
} else if (!keyword.value && text.length < (((
|
37815
|
-
const outerText = text.replace("\xA0", " ").replace(((
|
37816
|
-
outerText
|
37816
|
+
} else if (!keyword.value && text.length < (((_c = (_b = usingItem.value) == null ? void 0 : _b.inputInnerText) == null ? void 0 : _c.length) || 1)) {
|
37817
|
+
const outerText = text.replace("\xA0", " ").replace(((_d = usingItem.value) == null ? void 0 : _d.keyInnerText.replace("\xA0", " ").trim()) || "", "").trim();
|
37818
|
+
if (outerText || !(text == null ? void 0 : text.length)) {
|
37819
|
+
usingItem.value = null;
|
37820
|
+
}
|
37817
37821
|
keyword.value = outerText ? text : "";
|
37818
37822
|
debounceSetMenuList();
|
37819
|
-
} else if (!((
|
37820
|
-
keyword.value = text.replace("\xA0", " ").replace(((
|
37823
|
+
} else if (!((_f = (_e = usingItem.value) == null ? void 0 : _e.values) == null ? void 0 : _f.length)) {
|
37824
|
+
keyword.value = text.replace("\xA0", " ").replace(((_g = usingItem.value) == null ? void 0 : _g.keyInnerText.replace("\xA0", " ")) || "", "").trim();
|
37821
37825
|
setInputFocus();
|
37822
37826
|
debounceSetMenuList();
|
37823
37827
|
}
|
@@ -37848,7 +37852,7 @@ var SearchSelectInput = defineComponent({
|
|
37848
37852
|
const res2 = await validateUsingItemValues(value);
|
37849
37853
|
if (!res2)
|
37850
37854
|
return;
|
37851
|
-
emit("add", new SelectedItem(value, "text"));
|
37855
|
+
emit("add", new SelectedItem(value, "text", valueSplitCode.value));
|
37852
37856
|
keyword.value = "";
|
37853
37857
|
setMenuList();
|
37854
37858
|
return;
|
@@ -37856,16 +37860,31 @@ var SearchSelectInput = defineComponent({
|
|
37856
37860
|
const {
|
37857
37861
|
values
|
37858
37862
|
} = usingItem.value;
|
37863
|
+
debugger;
|
37859
37864
|
if (!(values == null ? void 0 : values.length)) {
|
37860
37865
|
if ((_a = keyword.value) == null ? void 0 : _a.length) {
|
37861
|
-
|
37862
|
-
|
37863
|
-
|
37864
|
-
|
37865
|
-
|
37866
|
-
|
37867
|
-
|
37868
|
-
|
37866
|
+
if (keyword.value.includes(valueSplitCode.value)) {
|
37867
|
+
const valueList = keyword.value.split(valueSplitCode.value);
|
37868
|
+
const res2 = await validateUsingItemValues({
|
37869
|
+
id: keyword.value,
|
37870
|
+
name: keyword.value
|
37871
|
+
});
|
37872
|
+
if (!res2)
|
37873
|
+
return;
|
37874
|
+
valueList.forEach((v2) => usingItem.value.addValue({
|
37875
|
+
id: v2,
|
37876
|
+
name: v2
|
37877
|
+
}));
|
37878
|
+
} else {
|
37879
|
+
const value = {
|
37880
|
+
id: keyword.value,
|
37881
|
+
name: keyword.value
|
37882
|
+
};
|
37883
|
+
const res2 = await validateUsingItemValues(value);
|
37884
|
+
if (!res2)
|
37885
|
+
return;
|
37886
|
+
usingItem.value.addValue(value);
|
37887
|
+
}
|
37869
37888
|
emit("add", usingItem.value);
|
37870
37889
|
keyword.value = "";
|
37871
37890
|
usingItem.value = null;
|
@@ -37900,13 +37919,13 @@ var SearchSelectInput = defineComponent({
|
|
37900
37919
|
if ((_a = item.value) == null ? void 0 : _a.id) {
|
37901
37920
|
const seleted = new SelectedItem(__spreadProps(__spreadValues({}, item), {
|
37902
37921
|
id: (_b = item.realId) != null ? _b : item.id
|
37903
|
-
}), type);
|
37922
|
+
}), type, valueSplitCode.value);
|
37904
37923
|
seleted.addValue(item.value);
|
37905
37924
|
setSelectedItem(seleted);
|
37906
37925
|
return;
|
37907
37926
|
}
|
37908
37927
|
if (!usingItem.value || !((_c = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _c.innerText)) {
|
37909
|
-
usingItem.value = new SelectedItem(item, type);
|
37928
|
+
usingItem.value = new SelectedItem(item, type, valueSplitCode.value);
|
37910
37929
|
keyword.value = "";
|
37911
37930
|
const isCondition = type === "condition";
|
37912
37931
|
isCondition && setSelectedItem();
|
@@ -37915,7 +37934,7 @@ var SearchSelectInput = defineComponent({
|
|
37915
37934
|
return;
|
37916
37935
|
}
|
37917
37936
|
if (((_d = usingItem.value) == null ? void 0 : _d.type) === "condition") {
|
37918
|
-
usingItem.value = new SelectedItem(item, type);
|
37937
|
+
usingItem.value = new SelectedItem(item, type, valueSplitCode.value);
|
37919
37938
|
setSelectedItem();
|
37920
37939
|
return;
|
37921
37940
|
}
|
@@ -37984,9 +38003,9 @@ var SearchSelectInput = defineComponent({
|
|
37984
38003
|
async function setMenuList() {
|
37985
38004
|
var _a, _b, _c, _d, _e;
|
37986
38005
|
let list = [];
|
37987
|
-
if (typeof props2.
|
38006
|
+
if (typeof props2.getMenuList === "function" && !((_b = (_a = usingItem.value) == null ? void 0 : _a.searchItem) == null ? void 0 : _b.async)) {
|
37988
38007
|
loading2.value = true;
|
37989
|
-
list = await props2.
|
38008
|
+
list = await props2.getMenuList((_c = usingItem.value) == null ? void 0 : _c.searchItem, keyword.value).catch(() => []);
|
37990
38009
|
loading2.value = false;
|
37991
38010
|
} else if (!(usingItem == null ? void 0 : usingItem.value)) {
|
37992
38011
|
if (!((_d = keyword.value) == null ? void 0 : _d.length)) {
|
@@ -38176,11 +38195,11 @@ var SearchSelected = defineComponent({
|
|
38176
38195
|
type: Array,
|
38177
38196
|
default: () => []
|
38178
38197
|
},
|
38179
|
-
|
38198
|
+
getMenuList: Function,
|
38180
38199
|
validateValues: Function
|
38181
38200
|
},
|
38182
38201
|
emits: ["delete"],
|
38183
|
-
setup(
|
38202
|
+
setup(_props, {
|
38184
38203
|
emit
|
38185
38204
|
}) {
|
38186
38205
|
const inputRef = ref(null);
|
@@ -38188,7 +38207,8 @@ var SearchSelected = defineComponent({
|
|
38188
38207
|
onEditClick,
|
38189
38208
|
onEditEnter,
|
38190
38209
|
onEditBlur,
|
38191
|
-
editKey
|
38210
|
+
editKey,
|
38211
|
+
valueSplitCode
|
38192
38212
|
} = useSearchSelectInject();
|
38193
38213
|
function handleDeleteSelected(index) {
|
38194
38214
|
emit("delete", index);
|
@@ -38211,7 +38231,7 @@ var SearchSelected = defineComponent({
|
|
38211
38231
|
return true;
|
38212
38232
|
}
|
38213
38233
|
function copySeletedItem(item) {
|
38214
|
-
const newItem = new SelectedItem(item.searchItem, item.type);
|
38234
|
+
const newItem = new SelectedItem(item.searchItem, item.type, valueSplitCode.value);
|
38215
38235
|
newItem.values = item.values.slice();
|
38216
38236
|
return newItem;
|
38217
38237
|
}
|
@@ -38239,7 +38259,7 @@ var SearchSelected = defineComponent({
|
|
38239
38259
|
"conditions": this.conditions,
|
38240
38260
|
"defautUsingItem": this.copySeletedItem(item),
|
38241
38261
|
"clickOutside": this.handleInputOutside,
|
38242
|
-
"
|
38262
|
+
"getMenuList": this.getMenuList,
|
38243
38263
|
"validateValues": this.validateValues,
|
38244
38264
|
"onAdd": (v2) => this.handleAddSelected(v2, index),
|
38245
38265
|
"onFocus": this.handleInputFocus
|
@@ -38296,7 +38316,11 @@ const SearchSelectProps = {
|
|
38296
38316
|
default: true
|
38297
38317
|
},
|
38298
38318
|
getMenuList: Function,
|
38299
|
-
validateValues: Function
|
38319
|
+
validateValues: Function,
|
38320
|
+
valueSplitCode: {
|
38321
|
+
type: String,
|
38322
|
+
default: "|"
|
38323
|
+
}
|
38300
38324
|
};
|
38301
38325
|
var Component = defineComponent({
|
38302
38326
|
name: "SearchSelect",
|
@@ -38316,6 +38340,7 @@ var Component = defineComponent({
|
|
38316
38340
|
const debounceResize = debounce(32, handleResize);
|
38317
38341
|
const editKey = ref("");
|
38318
38342
|
const validateStr = ref("");
|
38343
|
+
const splitCode = computed(() => props2.valueSplitCode);
|
38319
38344
|
watch(() => props2.modelValue, (v2) => {
|
38320
38345
|
if (!(v2 == null ? void 0 : v2.length)) {
|
38321
38346
|
selectedList.value = [];
|
@@ -38338,7 +38363,7 @@ var Component = defineComponent({
|
|
38338
38363
|
if (!searchItem && !((_a = item.values) == null ? void 0 : _a.length)) {
|
38339
38364
|
searchType = "text";
|
38340
38365
|
}
|
38341
|
-
const newSelected = new SelectedItem(searchItem || item, searchType);
|
38366
|
+
const newSelected = new SelectedItem(searchItem || item, searchType, splitCode.value);
|
38342
38367
|
newSelected.values = item.values || [];
|
38343
38368
|
list.push(newSelected);
|
38344
38369
|
}
|
@@ -38359,7 +38384,8 @@ var Component = defineComponent({
|
|
38359
38384
|
onEditEnter,
|
38360
38385
|
onEditBlur,
|
38361
38386
|
onValidate,
|
38362
|
-
editKey
|
38387
|
+
editKey,
|
38388
|
+
valueSplitCode: splitCode
|
38363
38389
|
});
|
38364
38390
|
function onEditClick(item, index) {
|
38365
38391
|
editKey.value = `${item.id}_${index}`;
|
@@ -38443,6 +38469,7 @@ var Component = defineComponent({
|
|
38443
38469
|
selectedList,
|
38444
38470
|
overflowIndex,
|
38445
38471
|
validateStr,
|
38472
|
+
splitCode,
|
38446
38473
|
onEditClick,
|
38447
38474
|
onEditEnter,
|
38448
38475
|
handleWrapClick,
|
@@ -38485,7 +38512,7 @@ var Component = defineComponent({
|
|
38485
38512
|
"conditions": this.conditions,
|
38486
38513
|
"selectedList": this.selectedList,
|
38487
38514
|
"overflowIndex": this.overflowIndex,
|
38488
|
-
"
|
38515
|
+
"getMenuList": this.getMenuList,
|
38489
38516
|
"validateValues": this.validateValues,
|
38490
38517
|
"onDelete": this.handleDeleteSelected
|
38491
38518
|
}, __spreadValues({}, menuSlots)), createVNode("div", {
|
@@ -38497,7 +38524,7 @@ var Component = defineComponent({
|
|
38497
38524
|
"showCondition": showCondition,
|
38498
38525
|
"conditions": this.conditions,
|
38499
38526
|
"clickOutside": this.handleInputOutside,
|
38500
|
-
"
|
38527
|
+
"getMenuList": this.getMenuList,
|
38501
38528
|
"validateValues": this.validateValues,
|
38502
38529
|
"onAdd": this.handleAddSelected,
|
38503
38530
|
"onDelete": this.handleDeleteSelected,
|