persagy-vant 0.0.44 → 0.0.45
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/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/location-select/LocationSelect.d.ts +19 -1
- package/es/location-select/LocationSelect.mjs +123 -19
- package/es/location-select/index.css +1 -1
- package/es/location-select/index.d.ts +14 -1
- package/es/location-select/index.less +1 -0
- package/es/location-select/style/index.mjs +1 -0
- package/es/location-select/style/less.mjs +1 -0
- package/es/location-select/types.d.ts +2 -0
- package/es/location-select/types.mjs +0 -0
- package/es/material-add/MaterialAdd.d.ts +19 -2
- package/es/material-add/MaterialAdd.mjs +99 -8
- package/es/material-add/index.css +1 -1
- package/es/material-add/index.d.ts +14 -2
- package/es/material-add/index.less +1 -1
- package/es/material-add/style/index.mjs +1 -0
- package/es/material-add/style/less.mjs +1 -0
- package/es/material-add/types.d.ts +7 -6
- package/es/object-select/ObjectSelect.d.ts +19 -2
- package/es/object-select/ObjectSelect.mjs +140 -20
- package/es/object-select/index.css +1 -1
- package/es/object-select/index.d.ts +14 -2
- package/es/object-select/index.less +1 -0
- package/es/object-select/style/index.mjs +1 -0
- package/es/object-select/style/less.mjs +1 -0
- package/es/object-select/types.d.ts +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.less +2 -2
- package/lib/location-select/LocationSelect.d.ts +19 -1
- package/lib/location-select/LocationSelect.js +121 -17
- package/lib/location-select/index.css +1 -1
- package/lib/location-select/index.d.ts +14 -1
- package/lib/location-select/index.less +1 -0
- package/lib/location-select/style/index.js +1 -0
- package/lib/location-select/style/less.js +1 -0
- package/lib/location-select/types.d.ts +2 -0
- package/lib/location-select/types.js +15 -0
- package/lib/material-add/MaterialAdd.d.ts +19 -2
- package/lib/material-add/MaterialAdd.js +97 -6
- package/lib/material-add/index.css +1 -1
- package/lib/material-add/index.d.ts +14 -2
- package/lib/material-add/index.less +1 -1
- package/lib/material-add/style/index.js +1 -0
- package/lib/material-add/style/less.js +1 -0
- package/lib/material-add/types.d.ts +7 -6
- package/lib/object-select/ObjectSelect.d.ts +19 -2
- package/lib/object-select/ObjectSelect.js +138 -18
- package/lib/object-select/index.css +1 -1
- package/lib/object-select/index.d.ts +14 -2
- package/lib/object-select/index.less +1 -0
- package/lib/object-select/style/index.js +1 -0
- package/lib/object-select/style/less.js +1 -0
- package/lib/object-select/types.d.ts +1 -0
- package/lib/vant.cjs.js +353 -44
- package/lib/vant.es.js +353 -44
- package/lib/vant.js +353 -44
- package/lib/vant.min.js +1 -1
- package/lib/web-types.json +1 -1
- package/package.json +1 -1
- package/skills/use-persagy-vant/references/business-component-catalog.md +3 -3
package/lib/vant.js
CHANGED
|
@@ -14227,7 +14227,7 @@
|
|
|
14227
14227
|
}
|
|
14228
14228
|
});
|
|
14229
14229
|
const InfoCard = withInstall(stdin_default$K);
|
|
14230
|
-
var __async$
|
|
14230
|
+
var __async$5 = (__this, __arguments, generator) => {
|
|
14231
14231
|
return new Promise((resolve, reject) => {
|
|
14232
14232
|
var fulfilled = (value) => {
|
|
14233
14233
|
try {
|
|
@@ -14331,7 +14331,7 @@
|
|
|
14331
14331
|
emit("update:expandedKeys", next);
|
|
14332
14332
|
emit("expand", id, expanded);
|
|
14333
14333
|
};
|
|
14334
|
-
const toggleExpanded = (item) => __async$
|
|
14334
|
+
const toggleExpanded = (item) => __async$5(this, null, function* () {
|
|
14335
14335
|
const {
|
|
14336
14336
|
id
|
|
14337
14337
|
} = item;
|
|
@@ -14464,6 +14464,26 @@
|
|
|
14464
14464
|
});
|
|
14465
14465
|
const TreeSelect = withInstall(stdin_default$J);
|
|
14466
14466
|
var stdin_default$I = TreeSelect;
|
|
14467
|
+
var __async$4 = (__this, __arguments, generator) => {
|
|
14468
|
+
return new Promise((resolve, reject) => {
|
|
14469
|
+
var fulfilled = (value) => {
|
|
14470
|
+
try {
|
|
14471
|
+
step(generator.next(value));
|
|
14472
|
+
} catch (e) {
|
|
14473
|
+
reject(e);
|
|
14474
|
+
}
|
|
14475
|
+
};
|
|
14476
|
+
var rejected = (value) => {
|
|
14477
|
+
try {
|
|
14478
|
+
step(generator.throw(value));
|
|
14479
|
+
} catch (e) {
|
|
14480
|
+
reject(e);
|
|
14481
|
+
}
|
|
14482
|
+
};
|
|
14483
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
14484
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
14485
|
+
});
|
|
14486
|
+
};
|
|
14467
14487
|
const [name$A, bem$A] = createNamespace("location-select");
|
|
14468
14488
|
const locations = [[{
|
|
14469
14489
|
id: "basement",
|
|
@@ -14598,12 +14618,14 @@
|
|
|
14598
14618
|
type: Array,
|
|
14599
14619
|
default: () => locations
|
|
14600
14620
|
},
|
|
14601
|
-
tabTitles: makeArrayProp()
|
|
14621
|
+
tabTitles: makeArrayProp(),
|
|
14622
|
+
search: Function,
|
|
14623
|
+
searchDebounce: makeNumericProp(300)
|
|
14602
14624
|
};
|
|
14603
14625
|
var stdin_default$H = vue.defineComponent({
|
|
14604
14626
|
name: name$A,
|
|
14605
14627
|
props: props$1,
|
|
14606
|
-
emits: ["update:show", "update:modelValue", "change"],
|
|
14628
|
+
emits: ["update:show", "update:modelValue", "change", "search-error"],
|
|
14607
14629
|
setup(props2, {
|
|
14608
14630
|
emit
|
|
14609
14631
|
}) {
|
|
@@ -14613,6 +14635,12 @@
|
|
|
14613
14635
|
const customValue = vue.ref("");
|
|
14614
14636
|
const expandedKeys = vue.ref(["basement", "b3"]);
|
|
14615
14637
|
const query = vue.ref("");
|
|
14638
|
+
const asyncSearchResults = vue.ref([]);
|
|
14639
|
+
const searchLoading = vue.ref(false);
|
|
14640
|
+
const searchFailed = vue.ref(false);
|
|
14641
|
+
const searchedItems = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
14642
|
+
let searchTimer;
|
|
14643
|
+
let searchRequestId = 0;
|
|
14616
14644
|
const titles = vue.computed(() => props2.tabTitles.length ? props2.tabTitles : ["ABC座地下室", "A座", "B座", "C座", "D座"]);
|
|
14617
14645
|
const allItems = vue.computed(() => props2.items.flatMap(flatten));
|
|
14618
14646
|
const currentRoot = vue.computed(() => {
|
|
@@ -14623,7 +14651,48 @@
|
|
|
14623
14651
|
var _a;
|
|
14624
14652
|
return ((_a = currentRoot.value) == null ? void 0 : _a.children) || [];
|
|
14625
14653
|
});
|
|
14626
|
-
const searchResults = vue.computed(() =>
|
|
14654
|
+
const searchResults = vue.computed(() => {
|
|
14655
|
+
if (!query.value.trim())
|
|
14656
|
+
return [];
|
|
14657
|
+
if (props2.search)
|
|
14658
|
+
return asyncSearchResults.value;
|
|
14659
|
+
return allItems.value.filter((item) => item.text.includes(query.value));
|
|
14660
|
+
});
|
|
14661
|
+
const runSearch = (..._0) => __async$4(this, [..._0], function* (keyword = query.value.trim()) {
|
|
14662
|
+
if (!props2.search || !keyword)
|
|
14663
|
+
return;
|
|
14664
|
+
const requestId = ++searchRequestId;
|
|
14665
|
+
searchLoading.value = true;
|
|
14666
|
+
searchFailed.value = false;
|
|
14667
|
+
try {
|
|
14668
|
+
const results = yield props2.search(keyword);
|
|
14669
|
+
if (requestId !== searchRequestId)
|
|
14670
|
+
return;
|
|
14671
|
+
asyncSearchResults.value = results;
|
|
14672
|
+
results.forEach((item) => searchedItems.set(item.id, item));
|
|
14673
|
+
} catch (error) {
|
|
14674
|
+
if (requestId !== searchRequestId)
|
|
14675
|
+
return;
|
|
14676
|
+
asyncSearchResults.value = [];
|
|
14677
|
+
searchFailed.value = true;
|
|
14678
|
+
emit("search-error", keyword, error);
|
|
14679
|
+
} finally {
|
|
14680
|
+
if (requestId === searchRequestId)
|
|
14681
|
+
searchLoading.value = false;
|
|
14682
|
+
}
|
|
14683
|
+
});
|
|
14684
|
+
const scheduleSearch = () => {
|
|
14685
|
+
if (searchTimer)
|
|
14686
|
+
clearTimeout(searchTimer);
|
|
14687
|
+
searchRequestId += 1;
|
|
14688
|
+
searchLoading.value = false;
|
|
14689
|
+
searchFailed.value = false;
|
|
14690
|
+
asyncSearchResults.value = [];
|
|
14691
|
+
if (props2.search && query.value.trim()) {
|
|
14692
|
+
searchTimer = setTimeout(runSearch, Number(props2.searchDebounce));
|
|
14693
|
+
}
|
|
14694
|
+
};
|
|
14695
|
+
vue.watch([query, () => props2.search], scheduleSearch);
|
|
14627
14696
|
vue.watch(() => props2.show, (show) => {
|
|
14628
14697
|
if (show) {
|
|
14629
14698
|
active.value = 0;
|
|
@@ -14631,11 +14700,16 @@
|
|
|
14631
14700
|
expandedKeys.value = ["basement", "b3"];
|
|
14632
14701
|
}
|
|
14633
14702
|
});
|
|
14703
|
+
vue.onBeforeUnmount(() => {
|
|
14704
|
+
searchRequestId += 1;
|
|
14705
|
+
if (searchTimer)
|
|
14706
|
+
clearTimeout(searchTimer);
|
|
14707
|
+
});
|
|
14634
14708
|
const close = () => emit("update:show", false);
|
|
14635
14709
|
const select = (value) => {
|
|
14636
14710
|
const selected = value[0];
|
|
14637
14711
|
if (selected !== void 0) {
|
|
14638
|
-
const selectedItem = allItems.value.find((item) => item.id === selected);
|
|
14712
|
+
const selectedItem = allItems.value.find((item) => item.id === selected) || searchedItems.get(selected);
|
|
14639
14713
|
emit("update:modelValue", selected);
|
|
14640
14714
|
emit("change", selected, selectedItem == null ? void 0 : selectedItem.text);
|
|
14641
14715
|
close();
|
|
@@ -14650,6 +14724,37 @@
|
|
|
14650
14724
|
showCustom.value = false;
|
|
14651
14725
|
close();
|
|
14652
14726
|
};
|
|
14727
|
+
const renderSearchContent = () => {
|
|
14728
|
+
if (searchLoading.value)
|
|
14729
|
+
return vue.createVNode("div", {
|
|
14730
|
+
"class": bem$A("search-state")
|
|
14731
|
+
}, [vue.createVNode(Loading, {
|
|
14732
|
+
"vertical": true
|
|
14733
|
+
}, {
|
|
14734
|
+
default: () => [vue.createTextVNode("加载中...")]
|
|
14735
|
+
})]);
|
|
14736
|
+
if (searchFailed.value)
|
|
14737
|
+
return vue.createVNode(Empty, {
|
|
14738
|
+
"image": "network",
|
|
14739
|
+
"description": "搜索失败,请重试"
|
|
14740
|
+
}, null);
|
|
14741
|
+
if (!searchResults.value.length)
|
|
14742
|
+
return vue.createVNode(Empty, {
|
|
14743
|
+
"description": "暂无搜索结果"
|
|
14744
|
+
}, null);
|
|
14745
|
+
return vue.createVNode("div", {
|
|
14746
|
+
"class": bem$A("card")
|
|
14747
|
+
}, [searchResults.value.map((item, index) => vue.createVNode(Cell, {
|
|
14748
|
+
"key": item.id,
|
|
14749
|
+
"title": item.text,
|
|
14750
|
+
"rightSelect": props2.modelValue === item.id,
|
|
14751
|
+
"selectType": "radio",
|
|
14752
|
+
"border": index < searchResults.value.length - 1,
|
|
14753
|
+
"clickable": true,
|
|
14754
|
+
"onClick": () => select([item.id]),
|
|
14755
|
+
"onUpdate:rightSelect": () => select([item.id])
|
|
14756
|
+
}, null))]);
|
|
14757
|
+
};
|
|
14653
14758
|
return () => vue.createVNode(ActionSheet, {
|
|
14654
14759
|
"show": props2.show,
|
|
14655
14760
|
"class": bem$A(),
|
|
@@ -14680,23 +14785,20 @@
|
|
|
14680
14785
|
"modelValue": query.value,
|
|
14681
14786
|
"onUpdate:modelValue": ($event) => query.value = $event,
|
|
14682
14787
|
"class": bem$A("search"),
|
|
14788
|
+
"variant": "pure",
|
|
14683
14789
|
"shape": "round",
|
|
14684
14790
|
"inputAlign": "left",
|
|
14685
|
-
"placeholder": "请输入搜索关键词"
|
|
14791
|
+
"placeholder": "请输入搜索关键词",
|
|
14792
|
+
"onSearch": () => {
|
|
14793
|
+
if (props2.search) {
|
|
14794
|
+
if (searchTimer)
|
|
14795
|
+
clearTimeout(searchTimer);
|
|
14796
|
+
runSearch();
|
|
14797
|
+
}
|
|
14798
|
+
}
|
|
14686
14799
|
}, null), query.value ? vue.createVNode("div", {
|
|
14687
14800
|
"class": bem$A("body")
|
|
14688
|
-
}, [vue.createVNode(
|
|
14689
|
-
"class": bem$A("card")
|
|
14690
|
-
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
14691
|
-
"key": item.id,
|
|
14692
|
-
"title": item.text,
|
|
14693
|
-
"rightSelect": props2.modelValue === item.id,
|
|
14694
|
-
"selectType": "radio",
|
|
14695
|
-
"border": true,
|
|
14696
|
-
"clickable": true,
|
|
14697
|
-
"onClick": () => select([item.id]),
|
|
14698
|
-
"onUpdate:rightSelect": () => select([item.id])
|
|
14699
|
-
}, null))])]) : vue.createVNode(vue.Fragment, null, [vue.createVNode(Tabs, {
|
|
14801
|
+
}, [renderSearchContent()]) : vue.createVNode(vue.Fragment, null, [vue.createVNode(Tabs, {
|
|
14700
14802
|
"active": active.value,
|
|
14701
14803
|
"onUpdate:active": ($event) => active.value = $event,
|
|
14702
14804
|
"showMore": showMore.value,
|
|
@@ -15364,6 +15466,26 @@
|
|
|
15364
15466
|
});
|
|
15365
15467
|
const MaterialDetail = withInstall(stdin_default$D);
|
|
15366
15468
|
var stdin_default$C = MaterialDetail;
|
|
15469
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
15470
|
+
return new Promise((resolve, reject) => {
|
|
15471
|
+
var fulfilled = (value) => {
|
|
15472
|
+
try {
|
|
15473
|
+
step(generator.next(value));
|
|
15474
|
+
} catch (e) {
|
|
15475
|
+
reject(e);
|
|
15476
|
+
}
|
|
15477
|
+
};
|
|
15478
|
+
var rejected = (value) => {
|
|
15479
|
+
try {
|
|
15480
|
+
step(generator.throw(value));
|
|
15481
|
+
} catch (e) {
|
|
15482
|
+
reject(e);
|
|
15483
|
+
}
|
|
15484
|
+
};
|
|
15485
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
15486
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
15487
|
+
});
|
|
15488
|
+
};
|
|
15367
15489
|
const [name$w, bem$w] = createNamespace("material-add");
|
|
15368
15490
|
const defaultItems = [{
|
|
15369
15491
|
id: "refrigerant",
|
|
@@ -15671,12 +15793,14 @@
|
|
|
15671
15793
|
commonTabText: makeStringProp("常用物料"),
|
|
15672
15794
|
allTabText: makeStringProp("全部物料"),
|
|
15673
15795
|
materialTabText: makeStringProp("物资"),
|
|
15674
|
-
toolTabText: makeStringProp("工具")
|
|
15796
|
+
toolTabText: makeStringProp("工具"),
|
|
15797
|
+
search: Function,
|
|
15798
|
+
searchDebounce: makeNumericProp(300)
|
|
15675
15799
|
};
|
|
15676
15800
|
var stdin_default$B = vue.defineComponent({
|
|
15677
15801
|
name: name$w,
|
|
15678
15802
|
props: materialAddProps,
|
|
15679
|
-
emits: ["update:show", "update:modelValue", "change", "confirm"],
|
|
15803
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "search-error"],
|
|
15680
15804
|
setup(props2, {
|
|
15681
15805
|
emit
|
|
15682
15806
|
}) {
|
|
@@ -15692,6 +15816,10 @@
|
|
|
15692
15816
|
const activeKind = vue.ref(getDefaultKind());
|
|
15693
15817
|
const keyword = vue.ref("");
|
|
15694
15818
|
const searching = vue.ref(false);
|
|
15819
|
+
const searchLoading = vue.ref(false);
|
|
15820
|
+
const searchFailed = vue.ref(false);
|
|
15821
|
+
let searchTimer;
|
|
15822
|
+
let searchRequestId = 0;
|
|
15695
15823
|
const expandedKeys = vue.ref([]);
|
|
15696
15824
|
const expandedSelected = vue.ref(false);
|
|
15697
15825
|
const detailItem = vue.ref();
|
|
@@ -15763,6 +15891,11 @@
|
|
|
15763
15891
|
activeTab.value = getDefaultTab();
|
|
15764
15892
|
activeKind.value = getDefaultKind();
|
|
15765
15893
|
keyword.value = "";
|
|
15894
|
+
searchLoading.value = false;
|
|
15895
|
+
searchFailed.value = false;
|
|
15896
|
+
searchRequestId += 1;
|
|
15897
|
+
if (searchTimer)
|
|
15898
|
+
clearTimeout(searchTimer);
|
|
15766
15899
|
searching.value = false;
|
|
15767
15900
|
expandedKeys.value = getDefaultExpandedKeys();
|
|
15768
15901
|
expandedSelected.value = false;
|
|
@@ -15780,6 +15913,40 @@
|
|
|
15780
15913
|
expandedKeys.value = getDefaultExpandedKeys();
|
|
15781
15914
|
}
|
|
15782
15915
|
});
|
|
15916
|
+
const runSearch = (..._0) => __async$3(this, [..._0], function* (query = keyword.value.trim()) {
|
|
15917
|
+
if (!props2.search || !query)
|
|
15918
|
+
return;
|
|
15919
|
+
const requestId = ++searchRequestId;
|
|
15920
|
+
searchLoading.value = true;
|
|
15921
|
+
searchFailed.value = false;
|
|
15922
|
+
try {
|
|
15923
|
+
yield props2.search(query);
|
|
15924
|
+
} catch (error) {
|
|
15925
|
+
if (requestId !== searchRequestId)
|
|
15926
|
+
return;
|
|
15927
|
+
searchFailed.value = true;
|
|
15928
|
+
emit("search-error", query, error);
|
|
15929
|
+
} finally {
|
|
15930
|
+
if (requestId === searchRequestId)
|
|
15931
|
+
searchLoading.value = false;
|
|
15932
|
+
}
|
|
15933
|
+
});
|
|
15934
|
+
const scheduleSearch = () => {
|
|
15935
|
+
if (searchTimer)
|
|
15936
|
+
clearTimeout(searchTimer);
|
|
15937
|
+
searchRequestId += 1;
|
|
15938
|
+
searchLoading.value = false;
|
|
15939
|
+
searchFailed.value = false;
|
|
15940
|
+
if (props2.search && keyword.value.trim()) {
|
|
15941
|
+
searchTimer = setTimeout(runSearch, Number(props2.searchDebounce));
|
|
15942
|
+
}
|
|
15943
|
+
};
|
|
15944
|
+
vue.watch([keyword, () => props2.search], scheduleSearch);
|
|
15945
|
+
vue.onBeforeUnmount(() => {
|
|
15946
|
+
searchRequestId += 1;
|
|
15947
|
+
if (searchTimer)
|
|
15948
|
+
clearTimeout(searchTimer);
|
|
15949
|
+
});
|
|
15783
15950
|
const setActiveTab = (tab) => {
|
|
15784
15951
|
activeTab.value = tab;
|
|
15785
15952
|
if (tab === "all") {
|
|
@@ -15846,9 +16013,25 @@
|
|
|
15846
16013
|
}, null);
|
|
15847
16014
|
const renderList = () => vue.createVNode("div", {
|
|
15848
16015
|
"class": bem$w("material-list")
|
|
15849
|
-
}, [visibleItems.value.length ? visibleItems.value.map((item) => renderMaterialCell(item, props2.items.indexOf(item))) : vue.createVNode(
|
|
15850
|
-
"
|
|
15851
|
-
},
|
|
16016
|
+
}, [visibleItems.value.length ? visibleItems.value.map((item) => renderMaterialCell(item, props2.items.indexOf(item))) : vue.createVNode(Empty, {
|
|
16017
|
+
"description": "暂无匹配物料"
|
|
16018
|
+
}, null)]);
|
|
16019
|
+
const renderSearchContent = () => {
|
|
16020
|
+
if (searchLoading.value)
|
|
16021
|
+
return vue.createVNode("div", {
|
|
16022
|
+
"class": bem$w("search-state")
|
|
16023
|
+
}, [vue.createVNode(Loading, {
|
|
16024
|
+
"vertical": true
|
|
16025
|
+
}, {
|
|
16026
|
+
default: () => [vue.createTextVNode("加载中...")]
|
|
16027
|
+
})]);
|
|
16028
|
+
if (searchFailed.value)
|
|
16029
|
+
return vue.createVNode(Empty, {
|
|
16030
|
+
"image": "network",
|
|
16031
|
+
"description": "搜索失败,请重试"
|
|
16032
|
+
}, null);
|
|
16033
|
+
return renderList();
|
|
16034
|
+
};
|
|
15852
16035
|
const renderCatalog = () => {
|
|
15853
16036
|
const catalogItems = getCatalogItems();
|
|
15854
16037
|
const defaultExpandedKeys = getDefaultExpandedKeys();
|
|
@@ -15905,11 +16088,19 @@
|
|
|
15905
16088
|
"modelValue": keyword.value,
|
|
15906
16089
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
15907
16090
|
"class": bem$w("search"),
|
|
16091
|
+
"variant": "pure",
|
|
15908
16092
|
"shape": "round",
|
|
15909
16093
|
"inputAlign": "left",
|
|
15910
16094
|
"autofocus": true,
|
|
15911
16095
|
"showAction": true,
|
|
15912
16096
|
"placeholder": "搜索物资/工具名称",
|
|
16097
|
+
"onSearch": () => {
|
|
16098
|
+
if (props2.search) {
|
|
16099
|
+
if (searchTimer)
|
|
16100
|
+
clearTimeout(searchTimer);
|
|
16101
|
+
runSearch();
|
|
16102
|
+
}
|
|
16103
|
+
},
|
|
15913
16104
|
"onCancel": () => {
|
|
15914
16105
|
searching.value = false;
|
|
15915
16106
|
keyword.value = "";
|
|
@@ -15963,7 +16154,7 @@
|
|
|
15963
16154
|
default: () => [props2.toolTabText]
|
|
15964
16155
|
})])]), vue.createVNode("div", {
|
|
15965
16156
|
"class": bem$w("body")
|
|
15966
|
-
}, [searching.value && !keyword.value.trim() ? null : searching.value
|
|
16157
|
+
}, [searching.value && !keyword.value.trim() ? null : searching.value ? renderSearchContent() : activeTab.value === "common" ? renderList() : renderCatalog()]), vue.createVNode("div", {
|
|
15967
16158
|
"class": bem$w("footer")
|
|
15968
16159
|
}, [renderSelectPanel(), vue.createVNode(BottomActionBar, {
|
|
15969
16160
|
"fixed": false,
|
|
@@ -17059,6 +17250,26 @@
|
|
|
17059
17250
|
}
|
|
17060
17251
|
});
|
|
17061
17252
|
const NumberKeyboard = withInstall(stdin_default$u);
|
|
17253
|
+
var __async$2 = (__this, __arguments, generator) => {
|
|
17254
|
+
return new Promise((resolve, reject) => {
|
|
17255
|
+
var fulfilled = (value) => {
|
|
17256
|
+
try {
|
|
17257
|
+
step(generator.next(value));
|
|
17258
|
+
} catch (e) {
|
|
17259
|
+
reject(e);
|
|
17260
|
+
}
|
|
17261
|
+
};
|
|
17262
|
+
var rejected = (value) => {
|
|
17263
|
+
try {
|
|
17264
|
+
step(generator.throw(value));
|
|
17265
|
+
} catch (e) {
|
|
17266
|
+
reject(e);
|
|
17267
|
+
}
|
|
17268
|
+
};
|
|
17269
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
17270
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
17271
|
+
});
|
|
17272
|
+
};
|
|
17062
17273
|
const [name$o, bem$o] = createNamespace("object-select");
|
|
17063
17274
|
const spaceItems = [{
|
|
17064
17275
|
id: "shenzhen-hq",
|
|
@@ -17415,13 +17626,15 @@
|
|
|
17415
17626
|
type: Array,
|
|
17416
17627
|
default: () => specialties
|
|
17417
17628
|
},
|
|
17418
|
-
loadChildren: Function
|
|
17629
|
+
loadChildren: Function,
|
|
17630
|
+
search: Function,
|
|
17631
|
+
searchDebounce: makeNumericProp(300)
|
|
17419
17632
|
};
|
|
17420
17633
|
const flattenItems$1 = (items) => items.flatMap((item) => [item, ...item.children ? flattenItems$1(item.children) : []]);
|
|
17421
17634
|
var stdin_default$t = vue.defineComponent({
|
|
17422
17635
|
name: name$o,
|
|
17423
17636
|
props: objectSelectProps,
|
|
17424
|
-
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error"],
|
|
17637
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error", "search-error"],
|
|
17425
17638
|
setup(props2, {
|
|
17426
17639
|
emit
|
|
17427
17640
|
}) {
|
|
@@ -17434,6 +17647,12 @@
|
|
|
17434
17647
|
const expandedSelected = vue.ref(false);
|
|
17435
17648
|
const searching = vue.ref(false);
|
|
17436
17649
|
const keyword = vue.ref("");
|
|
17650
|
+
const asyncSearchResults = vue.ref([]);
|
|
17651
|
+
const searchLoading = vue.ref(false);
|
|
17652
|
+
const searchFailed = vue.ref(false);
|
|
17653
|
+
const searchedItems = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
17654
|
+
let searchTimer;
|
|
17655
|
+
let searchRequestId = 0;
|
|
17437
17656
|
const loadedChildren = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
17438
17657
|
const getChildren = (item) => loadedChildren.get(item.id) || item.children || [];
|
|
17439
17658
|
const hydrateItems = (items) => items.map((item) => {
|
|
@@ -17455,6 +17674,12 @@
|
|
|
17455
17674
|
view.value = 0;
|
|
17456
17675
|
specialtyType.value = 0;
|
|
17457
17676
|
keyword.value = "";
|
|
17677
|
+
asyncSearchResults.value = [];
|
|
17678
|
+
searchLoading.value = false;
|
|
17679
|
+
searchFailed.value = false;
|
|
17680
|
+
searchRequestId += 1;
|
|
17681
|
+
if (searchTimer)
|
|
17682
|
+
clearTimeout(searchTimer);
|
|
17458
17683
|
searching.value = false;
|
|
17459
17684
|
expandedSelected.value = false;
|
|
17460
17685
|
expandedSpecialties.value = {
|
|
@@ -17467,13 +17692,64 @@
|
|
|
17467
17692
|
});
|
|
17468
17693
|
const selected = vue.computed(() => props2.modelValue);
|
|
17469
17694
|
const allItems = vue.computed(() => flattenItems$1(hydrateItems([...props2.spaceItems, ...props2.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])])));
|
|
17470
|
-
const selectedItems = vue.computed(() =>
|
|
17695
|
+
const selectedItems = vue.computed(() => {
|
|
17696
|
+
const items = /* @__PURE__ */ new Map();
|
|
17697
|
+
allItems.value.forEach((item) => items.set(item.id, item));
|
|
17698
|
+
searchedItems.forEach((item) => items.set(item.id, item));
|
|
17699
|
+
return selected.value.flatMap((id) => {
|
|
17700
|
+
const item = items.get(id);
|
|
17701
|
+
return item ? [item] : [];
|
|
17702
|
+
});
|
|
17703
|
+
});
|
|
17471
17704
|
const searchResults = vue.computed(() => {
|
|
17472
17705
|
const query = keyword.value.trim().toLowerCase();
|
|
17473
17706
|
if (!query)
|
|
17474
17707
|
return [];
|
|
17708
|
+
if (props2.search)
|
|
17709
|
+
return asyncSearchResults.value;
|
|
17475
17710
|
return allItems.value.filter((item) => item.text.toLowerCase().includes(query));
|
|
17476
17711
|
});
|
|
17712
|
+
const runSearch = (..._0) => __async$2(this, [..._0], function* (query = keyword.value.trim()) {
|
|
17713
|
+
if (!props2.search || !query)
|
|
17714
|
+
return;
|
|
17715
|
+
const requestId = ++searchRequestId;
|
|
17716
|
+
searchLoading.value = true;
|
|
17717
|
+
searchFailed.value = false;
|
|
17718
|
+
try {
|
|
17719
|
+
const results = yield props2.search(query);
|
|
17720
|
+
if (requestId !== searchRequestId)
|
|
17721
|
+
return;
|
|
17722
|
+
asyncSearchResults.value = results;
|
|
17723
|
+
results.forEach((item) => searchedItems.set(item.id, item));
|
|
17724
|
+
} catch (error) {
|
|
17725
|
+
if (requestId !== searchRequestId)
|
|
17726
|
+
return;
|
|
17727
|
+
asyncSearchResults.value = [];
|
|
17728
|
+
searchFailed.value = true;
|
|
17729
|
+
emit("search-error", query, error);
|
|
17730
|
+
} finally {
|
|
17731
|
+
if (requestId === searchRequestId)
|
|
17732
|
+
searchLoading.value = false;
|
|
17733
|
+
}
|
|
17734
|
+
});
|
|
17735
|
+
const scheduleSearch = () => {
|
|
17736
|
+
if (searchTimer)
|
|
17737
|
+
clearTimeout(searchTimer);
|
|
17738
|
+
searchRequestId += 1;
|
|
17739
|
+
searchLoading.value = false;
|
|
17740
|
+
searchFailed.value = false;
|
|
17741
|
+
asyncSearchResults.value = [];
|
|
17742
|
+
const query = keyword.value.trim();
|
|
17743
|
+
if (!props2.search || !query)
|
|
17744
|
+
return;
|
|
17745
|
+
searchTimer = setTimeout(runSearch, Number(props2.searchDebounce));
|
|
17746
|
+
};
|
|
17747
|
+
vue.watch([keyword, () => props2.search], scheduleSearch);
|
|
17748
|
+
vue.onBeforeUnmount(() => {
|
|
17749
|
+
searchRequestId += 1;
|
|
17750
|
+
if (searchTimer)
|
|
17751
|
+
clearTimeout(searchTimer);
|
|
17752
|
+
});
|
|
17477
17753
|
const renderHighlightedText = (text) => {
|
|
17478
17754
|
const query = keyword.value.trim();
|
|
17479
17755
|
if (!query)
|
|
@@ -17554,6 +17830,45 @@
|
|
|
17554
17830
|
}, null), expanded && renderTree(items)]);
|
|
17555
17831
|
};
|
|
17556
17832
|
const close = () => emit("update:show", false);
|
|
17833
|
+
const renderSearchContent = () => {
|
|
17834
|
+
if (!keyword.value.trim())
|
|
17835
|
+
return;
|
|
17836
|
+
if (searchLoading.value) {
|
|
17837
|
+
return vue.createVNode("div", {
|
|
17838
|
+
"class": bem$o("search-state")
|
|
17839
|
+
}, [vue.createVNode(Loading, {
|
|
17840
|
+
"vertical": true
|
|
17841
|
+
}, {
|
|
17842
|
+
default: () => [vue.createTextVNode("加载中...")]
|
|
17843
|
+
})]);
|
|
17844
|
+
}
|
|
17845
|
+
if (searchFailed.value) {
|
|
17846
|
+
return vue.createVNode(Empty, {
|
|
17847
|
+
"image": "network",
|
|
17848
|
+
"description": "搜索失败,请重试"
|
|
17849
|
+
}, null);
|
|
17850
|
+
}
|
|
17851
|
+
if (!searchResults.value.length) {
|
|
17852
|
+
return vue.createVNode(Empty, {
|
|
17853
|
+
"description": "暂无搜索结果"
|
|
17854
|
+
}, null);
|
|
17855
|
+
}
|
|
17856
|
+
return vue.createVNode("div", {
|
|
17857
|
+
"class": bem$o("tree-card", {
|
|
17858
|
+
search: true
|
|
17859
|
+
})
|
|
17860
|
+
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
17861
|
+
"key": item.id,
|
|
17862
|
+
"rightSelect": selected.value.includes(item.id),
|
|
17863
|
+
"selectType": "checkbox",
|
|
17864
|
+
"border": true,
|
|
17865
|
+
"clickable": true,
|
|
17866
|
+
"onClick": () => toggleSearchItem(item),
|
|
17867
|
+
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
17868
|
+
}, {
|
|
17869
|
+
title: () => renderHighlightedText(item.text)
|
|
17870
|
+
}))]);
|
|
17871
|
+
};
|
|
17557
17872
|
return () => vue.createVNode(ActionSheet, {
|
|
17558
17873
|
"show": props2.show,
|
|
17559
17874
|
"class": bem$o(),
|
|
@@ -17564,10 +17879,18 @@
|
|
|
17564
17879
|
"modelValue": keyword.value,
|
|
17565
17880
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
17566
17881
|
"class": bem$o("search"),
|
|
17882
|
+
"variant": "pure",
|
|
17567
17883
|
"shape": "round",
|
|
17568
17884
|
"inputAlign": "left",
|
|
17569
17885
|
"autofocus": true,
|
|
17570
17886
|
"placeholder": "搜索对象",
|
|
17887
|
+
"onSearch": () => {
|
|
17888
|
+
if (props2.search) {
|
|
17889
|
+
if (searchTimer)
|
|
17890
|
+
clearTimeout(searchTimer);
|
|
17891
|
+
runSearch();
|
|
17892
|
+
}
|
|
17893
|
+
},
|
|
17571
17894
|
"onCancel": () => {
|
|
17572
17895
|
searching.value = false;
|
|
17573
17896
|
keyword.value = "";
|
|
@@ -17606,21 +17929,7 @@
|
|
|
17606
17929
|
}, null)]
|
|
17607
17930
|
})]), vue.createVNode("div", {
|
|
17608
17931
|
"class": bem$o("body")
|
|
17609
|
-
}, [searching.value ?
|
|
17610
|
-
"class": bem$o("tree-card", {
|
|
17611
|
-
search: true
|
|
17612
|
-
})
|
|
17613
|
-
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
17614
|
-
"key": item.id,
|
|
17615
|
-
"rightSelect": selected.value.includes(item.id),
|
|
17616
|
-
"selectType": "checkbox",
|
|
17617
|
-
"border": true,
|
|
17618
|
-
"clickable": true,
|
|
17619
|
-
"onClick": () => toggleSearchItem(item),
|
|
17620
|
-
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
17621
|
-
}, {
|
|
17622
|
-
title: () => renderHighlightedText(item.text)
|
|
17623
|
-
}))]) : view.value === 0 ? renderTree(props2.spaceItems) : vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
|
|
17932
|
+
}, [searching.value ? renderSearchContent() : view.value === 0 ? renderTree(props2.spaceItems) : vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
|
|
17624
17933
|
"class": bem$o("type-tabs")
|
|
17625
17934
|
}, [vue.createVNode(FilterTag, {
|
|
17626
17935
|
"selected": specialtyType.value === 0,
|
|
@@ -25052,7 +25361,7 @@
|
|
|
25052
25361
|
});
|
|
25053
25362
|
}
|
|
25054
25363
|
};
|
|
25055
|
-
const version = "0.0.
|
|
25364
|
+
const version = "0.0.45";
|
|
25056
25365
|
function install(app) {
|
|
25057
25366
|
const components = [
|
|
25058
25367
|
ActionBar,
|