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.cjs.js
CHANGED
|
@@ -13034,7 +13034,7 @@ var stdin_default$K = vue.defineComponent({
|
|
|
13034
13034
|
}
|
|
13035
13035
|
});
|
|
13036
13036
|
const InfoCard = withInstall(stdin_default$K);
|
|
13037
|
-
var __async$
|
|
13037
|
+
var __async$5 = (__this, __arguments, generator) => {
|
|
13038
13038
|
return new Promise((resolve, reject) => {
|
|
13039
13039
|
var fulfilled = (value) => {
|
|
13040
13040
|
try {
|
|
@@ -13138,7 +13138,7 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13138
13138
|
emit("update:expandedKeys", next);
|
|
13139
13139
|
emit("expand", id, expanded);
|
|
13140
13140
|
};
|
|
13141
|
-
const toggleExpanded = (item) => __async$
|
|
13141
|
+
const toggleExpanded = (item) => __async$5(this, null, function* () {
|
|
13142
13142
|
const {
|
|
13143
13143
|
id
|
|
13144
13144
|
} = item;
|
|
@@ -13271,6 +13271,26 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13271
13271
|
});
|
|
13272
13272
|
const TreeSelect = withInstall(stdin_default$J);
|
|
13273
13273
|
var stdin_default$I = TreeSelect;
|
|
13274
|
+
var __async$4 = (__this, __arguments, generator) => {
|
|
13275
|
+
return new Promise((resolve, reject) => {
|
|
13276
|
+
var fulfilled = (value) => {
|
|
13277
|
+
try {
|
|
13278
|
+
step(generator.next(value));
|
|
13279
|
+
} catch (e) {
|
|
13280
|
+
reject(e);
|
|
13281
|
+
}
|
|
13282
|
+
};
|
|
13283
|
+
var rejected = (value) => {
|
|
13284
|
+
try {
|
|
13285
|
+
step(generator.throw(value));
|
|
13286
|
+
} catch (e) {
|
|
13287
|
+
reject(e);
|
|
13288
|
+
}
|
|
13289
|
+
};
|
|
13290
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
13291
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
13292
|
+
});
|
|
13293
|
+
};
|
|
13274
13294
|
const [name$A, bem$A] = createNamespace("location-select");
|
|
13275
13295
|
const locations = [[{
|
|
13276
13296
|
id: "basement",
|
|
@@ -13405,12 +13425,14 @@ const props$1 = {
|
|
|
13405
13425
|
type: Array,
|
|
13406
13426
|
default: () => locations
|
|
13407
13427
|
},
|
|
13408
|
-
tabTitles: makeArrayProp()
|
|
13428
|
+
tabTitles: makeArrayProp(),
|
|
13429
|
+
search: Function,
|
|
13430
|
+
searchDebounce: makeNumericProp(300)
|
|
13409
13431
|
};
|
|
13410
13432
|
var stdin_default$H = vue.defineComponent({
|
|
13411
13433
|
name: name$A,
|
|
13412
13434
|
props: props$1,
|
|
13413
|
-
emits: ["update:show", "update:modelValue", "change"],
|
|
13435
|
+
emits: ["update:show", "update:modelValue", "change", "search-error"],
|
|
13414
13436
|
setup(props2, {
|
|
13415
13437
|
emit
|
|
13416
13438
|
}) {
|
|
@@ -13420,6 +13442,12 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13420
13442
|
const customValue = vue.ref("");
|
|
13421
13443
|
const expandedKeys = vue.ref(["basement", "b3"]);
|
|
13422
13444
|
const query = vue.ref("");
|
|
13445
|
+
const asyncSearchResults = vue.ref([]);
|
|
13446
|
+
const searchLoading = vue.ref(false);
|
|
13447
|
+
const searchFailed = vue.ref(false);
|
|
13448
|
+
const searchedItems = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
13449
|
+
let searchTimer;
|
|
13450
|
+
let searchRequestId = 0;
|
|
13423
13451
|
const titles = vue.computed(() => props2.tabTitles.length ? props2.tabTitles : ["ABC座地下室", "A座", "B座", "C座", "D座"]);
|
|
13424
13452
|
const allItems = vue.computed(() => props2.items.flatMap(flatten));
|
|
13425
13453
|
const currentRoot = vue.computed(() => {
|
|
@@ -13430,7 +13458,48 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13430
13458
|
var _a;
|
|
13431
13459
|
return ((_a = currentRoot.value) == null ? void 0 : _a.children) || [];
|
|
13432
13460
|
});
|
|
13433
|
-
const searchResults = vue.computed(() =>
|
|
13461
|
+
const searchResults = vue.computed(() => {
|
|
13462
|
+
if (!query.value.trim())
|
|
13463
|
+
return [];
|
|
13464
|
+
if (props2.search)
|
|
13465
|
+
return asyncSearchResults.value;
|
|
13466
|
+
return allItems.value.filter((item) => item.text.includes(query.value));
|
|
13467
|
+
});
|
|
13468
|
+
const runSearch = (..._0) => __async$4(this, [..._0], function* (keyword = query.value.trim()) {
|
|
13469
|
+
if (!props2.search || !keyword)
|
|
13470
|
+
return;
|
|
13471
|
+
const requestId = ++searchRequestId;
|
|
13472
|
+
searchLoading.value = true;
|
|
13473
|
+
searchFailed.value = false;
|
|
13474
|
+
try {
|
|
13475
|
+
const results = yield props2.search(keyword);
|
|
13476
|
+
if (requestId !== searchRequestId)
|
|
13477
|
+
return;
|
|
13478
|
+
asyncSearchResults.value = results;
|
|
13479
|
+
results.forEach((item) => searchedItems.set(item.id, item));
|
|
13480
|
+
} catch (error) {
|
|
13481
|
+
if (requestId !== searchRequestId)
|
|
13482
|
+
return;
|
|
13483
|
+
asyncSearchResults.value = [];
|
|
13484
|
+
searchFailed.value = true;
|
|
13485
|
+
emit("search-error", keyword, error);
|
|
13486
|
+
} finally {
|
|
13487
|
+
if (requestId === searchRequestId)
|
|
13488
|
+
searchLoading.value = false;
|
|
13489
|
+
}
|
|
13490
|
+
});
|
|
13491
|
+
const scheduleSearch = () => {
|
|
13492
|
+
if (searchTimer)
|
|
13493
|
+
clearTimeout(searchTimer);
|
|
13494
|
+
searchRequestId += 1;
|
|
13495
|
+
searchLoading.value = false;
|
|
13496
|
+
searchFailed.value = false;
|
|
13497
|
+
asyncSearchResults.value = [];
|
|
13498
|
+
if (props2.search && query.value.trim()) {
|
|
13499
|
+
searchTimer = setTimeout(runSearch, Number(props2.searchDebounce));
|
|
13500
|
+
}
|
|
13501
|
+
};
|
|
13502
|
+
vue.watch([query, () => props2.search], scheduleSearch);
|
|
13434
13503
|
vue.watch(() => props2.show, (show) => {
|
|
13435
13504
|
if (show) {
|
|
13436
13505
|
active.value = 0;
|
|
@@ -13438,11 +13507,16 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13438
13507
|
expandedKeys.value = ["basement", "b3"];
|
|
13439
13508
|
}
|
|
13440
13509
|
});
|
|
13510
|
+
vue.onBeforeUnmount(() => {
|
|
13511
|
+
searchRequestId += 1;
|
|
13512
|
+
if (searchTimer)
|
|
13513
|
+
clearTimeout(searchTimer);
|
|
13514
|
+
});
|
|
13441
13515
|
const close = () => emit("update:show", false);
|
|
13442
13516
|
const select = (value) => {
|
|
13443
13517
|
const selected = value[0];
|
|
13444
13518
|
if (selected !== void 0) {
|
|
13445
|
-
const selectedItem = allItems.value.find((item) => item.id === selected);
|
|
13519
|
+
const selectedItem = allItems.value.find((item) => item.id === selected) || searchedItems.get(selected);
|
|
13446
13520
|
emit("update:modelValue", selected);
|
|
13447
13521
|
emit("change", selected, selectedItem == null ? void 0 : selectedItem.text);
|
|
13448
13522
|
close();
|
|
@@ -13457,6 +13531,37 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13457
13531
|
showCustom.value = false;
|
|
13458
13532
|
close();
|
|
13459
13533
|
};
|
|
13534
|
+
const renderSearchContent = () => {
|
|
13535
|
+
if (searchLoading.value)
|
|
13536
|
+
return vue.createVNode("div", {
|
|
13537
|
+
"class": bem$A("search-state")
|
|
13538
|
+
}, [vue.createVNode(Loading, {
|
|
13539
|
+
"vertical": true
|
|
13540
|
+
}, {
|
|
13541
|
+
default: () => [vue.createTextVNode("加载中...")]
|
|
13542
|
+
})]);
|
|
13543
|
+
if (searchFailed.value)
|
|
13544
|
+
return vue.createVNode(Empty, {
|
|
13545
|
+
"image": "network",
|
|
13546
|
+
"description": "搜索失败,请重试"
|
|
13547
|
+
}, null);
|
|
13548
|
+
if (!searchResults.value.length)
|
|
13549
|
+
return vue.createVNode(Empty, {
|
|
13550
|
+
"description": "暂无搜索结果"
|
|
13551
|
+
}, null);
|
|
13552
|
+
return vue.createVNode("div", {
|
|
13553
|
+
"class": bem$A("card")
|
|
13554
|
+
}, [searchResults.value.map((item, index) => vue.createVNode(Cell, {
|
|
13555
|
+
"key": item.id,
|
|
13556
|
+
"title": item.text,
|
|
13557
|
+
"rightSelect": props2.modelValue === item.id,
|
|
13558
|
+
"selectType": "radio",
|
|
13559
|
+
"border": index < searchResults.value.length - 1,
|
|
13560
|
+
"clickable": true,
|
|
13561
|
+
"onClick": () => select([item.id]),
|
|
13562
|
+
"onUpdate:rightSelect": () => select([item.id])
|
|
13563
|
+
}, null))]);
|
|
13564
|
+
};
|
|
13460
13565
|
return () => vue.createVNode(ActionSheet, {
|
|
13461
13566
|
"show": props2.show,
|
|
13462
13567
|
"class": bem$A(),
|
|
@@ -13487,23 +13592,20 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13487
13592
|
"modelValue": query.value,
|
|
13488
13593
|
"onUpdate:modelValue": ($event) => query.value = $event,
|
|
13489
13594
|
"class": bem$A("search"),
|
|
13595
|
+
"variant": "pure",
|
|
13490
13596
|
"shape": "round",
|
|
13491
13597
|
"inputAlign": "left",
|
|
13492
|
-
"placeholder": "请输入搜索关键词"
|
|
13598
|
+
"placeholder": "请输入搜索关键词",
|
|
13599
|
+
"onSearch": () => {
|
|
13600
|
+
if (props2.search) {
|
|
13601
|
+
if (searchTimer)
|
|
13602
|
+
clearTimeout(searchTimer);
|
|
13603
|
+
runSearch();
|
|
13604
|
+
}
|
|
13605
|
+
}
|
|
13493
13606
|
}, null), query.value ? vue.createVNode("div", {
|
|
13494
13607
|
"class": bem$A("body")
|
|
13495
|
-
}, [vue.createVNode(
|
|
13496
|
-
"class": bem$A("card")
|
|
13497
|
-
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
13498
|
-
"key": item.id,
|
|
13499
|
-
"title": item.text,
|
|
13500
|
-
"rightSelect": props2.modelValue === item.id,
|
|
13501
|
-
"selectType": "radio",
|
|
13502
|
-
"border": true,
|
|
13503
|
-
"clickable": true,
|
|
13504
|
-
"onClick": () => select([item.id]),
|
|
13505
|
-
"onUpdate:rightSelect": () => select([item.id])
|
|
13506
|
-
}, null))])]) : vue.createVNode(vue.Fragment, null, [vue.createVNode(Tabs, {
|
|
13608
|
+
}, [renderSearchContent()]) : vue.createVNode(vue.Fragment, null, [vue.createVNode(Tabs, {
|
|
13507
13609
|
"active": active.value,
|
|
13508
13610
|
"onUpdate:active": ($event) => active.value = $event,
|
|
13509
13611
|
"showMore": showMore.value,
|
|
@@ -14171,6 +14273,26 @@ var stdin_default$D = vue.defineComponent({
|
|
|
14171
14273
|
});
|
|
14172
14274
|
const MaterialDetail = withInstall(stdin_default$D);
|
|
14173
14275
|
var stdin_default$C = MaterialDetail;
|
|
14276
|
+
var __async$3 = (__this, __arguments, generator) => {
|
|
14277
|
+
return new Promise((resolve, reject) => {
|
|
14278
|
+
var fulfilled = (value) => {
|
|
14279
|
+
try {
|
|
14280
|
+
step(generator.next(value));
|
|
14281
|
+
} catch (e) {
|
|
14282
|
+
reject(e);
|
|
14283
|
+
}
|
|
14284
|
+
};
|
|
14285
|
+
var rejected = (value) => {
|
|
14286
|
+
try {
|
|
14287
|
+
step(generator.throw(value));
|
|
14288
|
+
} catch (e) {
|
|
14289
|
+
reject(e);
|
|
14290
|
+
}
|
|
14291
|
+
};
|
|
14292
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
14293
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
14294
|
+
});
|
|
14295
|
+
};
|
|
14174
14296
|
const [name$w, bem$w] = createNamespace("material-add");
|
|
14175
14297
|
const defaultItems = [{
|
|
14176
14298
|
id: "refrigerant",
|
|
@@ -14478,12 +14600,14 @@ const materialAddProps = {
|
|
|
14478
14600
|
commonTabText: makeStringProp("常用物料"),
|
|
14479
14601
|
allTabText: makeStringProp("全部物料"),
|
|
14480
14602
|
materialTabText: makeStringProp("物资"),
|
|
14481
|
-
toolTabText: makeStringProp("工具")
|
|
14603
|
+
toolTabText: makeStringProp("工具"),
|
|
14604
|
+
search: Function,
|
|
14605
|
+
searchDebounce: makeNumericProp(300)
|
|
14482
14606
|
};
|
|
14483
14607
|
var stdin_default$B = vue.defineComponent({
|
|
14484
14608
|
name: name$w,
|
|
14485
14609
|
props: materialAddProps,
|
|
14486
|
-
emits: ["update:show", "update:modelValue", "change", "confirm"],
|
|
14610
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "search-error"],
|
|
14487
14611
|
setup(props2, {
|
|
14488
14612
|
emit
|
|
14489
14613
|
}) {
|
|
@@ -14499,6 +14623,10 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14499
14623
|
const activeKind = vue.ref(getDefaultKind());
|
|
14500
14624
|
const keyword = vue.ref("");
|
|
14501
14625
|
const searching = vue.ref(false);
|
|
14626
|
+
const searchLoading = vue.ref(false);
|
|
14627
|
+
const searchFailed = vue.ref(false);
|
|
14628
|
+
let searchTimer;
|
|
14629
|
+
let searchRequestId = 0;
|
|
14502
14630
|
const expandedKeys = vue.ref([]);
|
|
14503
14631
|
const expandedSelected = vue.ref(false);
|
|
14504
14632
|
const detailItem = vue.ref();
|
|
@@ -14570,6 +14698,11 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14570
14698
|
activeTab.value = getDefaultTab();
|
|
14571
14699
|
activeKind.value = getDefaultKind();
|
|
14572
14700
|
keyword.value = "";
|
|
14701
|
+
searchLoading.value = false;
|
|
14702
|
+
searchFailed.value = false;
|
|
14703
|
+
searchRequestId += 1;
|
|
14704
|
+
if (searchTimer)
|
|
14705
|
+
clearTimeout(searchTimer);
|
|
14573
14706
|
searching.value = false;
|
|
14574
14707
|
expandedKeys.value = getDefaultExpandedKeys();
|
|
14575
14708
|
expandedSelected.value = false;
|
|
@@ -14587,6 +14720,40 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14587
14720
|
expandedKeys.value = getDefaultExpandedKeys();
|
|
14588
14721
|
}
|
|
14589
14722
|
});
|
|
14723
|
+
const runSearch = (..._0) => __async$3(this, [..._0], function* (query = keyword.value.trim()) {
|
|
14724
|
+
if (!props2.search || !query)
|
|
14725
|
+
return;
|
|
14726
|
+
const requestId = ++searchRequestId;
|
|
14727
|
+
searchLoading.value = true;
|
|
14728
|
+
searchFailed.value = false;
|
|
14729
|
+
try {
|
|
14730
|
+
yield props2.search(query);
|
|
14731
|
+
} catch (error) {
|
|
14732
|
+
if (requestId !== searchRequestId)
|
|
14733
|
+
return;
|
|
14734
|
+
searchFailed.value = true;
|
|
14735
|
+
emit("search-error", query, error);
|
|
14736
|
+
} finally {
|
|
14737
|
+
if (requestId === searchRequestId)
|
|
14738
|
+
searchLoading.value = false;
|
|
14739
|
+
}
|
|
14740
|
+
});
|
|
14741
|
+
const scheduleSearch = () => {
|
|
14742
|
+
if (searchTimer)
|
|
14743
|
+
clearTimeout(searchTimer);
|
|
14744
|
+
searchRequestId += 1;
|
|
14745
|
+
searchLoading.value = false;
|
|
14746
|
+
searchFailed.value = false;
|
|
14747
|
+
if (props2.search && keyword.value.trim()) {
|
|
14748
|
+
searchTimer = setTimeout(runSearch, Number(props2.searchDebounce));
|
|
14749
|
+
}
|
|
14750
|
+
};
|
|
14751
|
+
vue.watch([keyword, () => props2.search], scheduleSearch);
|
|
14752
|
+
vue.onBeforeUnmount(() => {
|
|
14753
|
+
searchRequestId += 1;
|
|
14754
|
+
if (searchTimer)
|
|
14755
|
+
clearTimeout(searchTimer);
|
|
14756
|
+
});
|
|
14590
14757
|
const setActiveTab = (tab) => {
|
|
14591
14758
|
activeTab.value = tab;
|
|
14592
14759
|
if (tab === "all") {
|
|
@@ -14653,9 +14820,25 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14653
14820
|
}, null);
|
|
14654
14821
|
const renderList = () => vue.createVNode("div", {
|
|
14655
14822
|
"class": bem$w("material-list")
|
|
14656
|
-
}, [visibleItems.value.length ? visibleItems.value.map((item) => renderMaterialCell(item, props2.items.indexOf(item))) : vue.createVNode(
|
|
14657
|
-
"
|
|
14658
|
-
},
|
|
14823
|
+
}, [visibleItems.value.length ? visibleItems.value.map((item) => renderMaterialCell(item, props2.items.indexOf(item))) : vue.createVNode(Empty, {
|
|
14824
|
+
"description": "暂无匹配物料"
|
|
14825
|
+
}, null)]);
|
|
14826
|
+
const renderSearchContent = () => {
|
|
14827
|
+
if (searchLoading.value)
|
|
14828
|
+
return vue.createVNode("div", {
|
|
14829
|
+
"class": bem$w("search-state")
|
|
14830
|
+
}, [vue.createVNode(Loading, {
|
|
14831
|
+
"vertical": true
|
|
14832
|
+
}, {
|
|
14833
|
+
default: () => [vue.createTextVNode("加载中...")]
|
|
14834
|
+
})]);
|
|
14835
|
+
if (searchFailed.value)
|
|
14836
|
+
return vue.createVNode(Empty, {
|
|
14837
|
+
"image": "network",
|
|
14838
|
+
"description": "搜索失败,请重试"
|
|
14839
|
+
}, null);
|
|
14840
|
+
return renderList();
|
|
14841
|
+
};
|
|
14659
14842
|
const renderCatalog = () => {
|
|
14660
14843
|
const catalogItems = getCatalogItems();
|
|
14661
14844
|
const defaultExpandedKeys = getDefaultExpandedKeys();
|
|
@@ -14712,11 +14895,19 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14712
14895
|
"modelValue": keyword.value,
|
|
14713
14896
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
14714
14897
|
"class": bem$w("search"),
|
|
14898
|
+
"variant": "pure",
|
|
14715
14899
|
"shape": "round",
|
|
14716
14900
|
"inputAlign": "left",
|
|
14717
14901
|
"autofocus": true,
|
|
14718
14902
|
"showAction": true,
|
|
14719
14903
|
"placeholder": "搜索物资/工具名称",
|
|
14904
|
+
"onSearch": () => {
|
|
14905
|
+
if (props2.search) {
|
|
14906
|
+
if (searchTimer)
|
|
14907
|
+
clearTimeout(searchTimer);
|
|
14908
|
+
runSearch();
|
|
14909
|
+
}
|
|
14910
|
+
},
|
|
14720
14911
|
"onCancel": () => {
|
|
14721
14912
|
searching.value = false;
|
|
14722
14913
|
keyword.value = "";
|
|
@@ -14770,7 +14961,7 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14770
14961
|
default: () => [props2.toolTabText]
|
|
14771
14962
|
})])]), vue.createVNode("div", {
|
|
14772
14963
|
"class": bem$w("body")
|
|
14773
|
-
}, [searching.value && !keyword.value.trim() ? null : searching.value
|
|
14964
|
+
}, [searching.value && !keyword.value.trim() ? null : searching.value ? renderSearchContent() : activeTab.value === "common" ? renderList() : renderCatalog()]), vue.createVNode("div", {
|
|
14774
14965
|
"class": bem$w("footer")
|
|
14775
14966
|
}, [renderSelectPanel(), vue.createVNode(BottomActionBar, {
|
|
14776
14967
|
"fixed": false,
|
|
@@ -15866,6 +16057,26 @@ var stdin_default$u = vue.defineComponent({
|
|
|
15866
16057
|
}
|
|
15867
16058
|
});
|
|
15868
16059
|
const NumberKeyboard = withInstall(stdin_default$u);
|
|
16060
|
+
var __async$2 = (__this, __arguments, generator) => {
|
|
16061
|
+
return new Promise((resolve, reject) => {
|
|
16062
|
+
var fulfilled = (value) => {
|
|
16063
|
+
try {
|
|
16064
|
+
step(generator.next(value));
|
|
16065
|
+
} catch (e) {
|
|
16066
|
+
reject(e);
|
|
16067
|
+
}
|
|
16068
|
+
};
|
|
16069
|
+
var rejected = (value) => {
|
|
16070
|
+
try {
|
|
16071
|
+
step(generator.throw(value));
|
|
16072
|
+
} catch (e) {
|
|
16073
|
+
reject(e);
|
|
16074
|
+
}
|
|
16075
|
+
};
|
|
16076
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
16077
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
16078
|
+
});
|
|
16079
|
+
};
|
|
15869
16080
|
const [name$o, bem$o] = createNamespace("object-select");
|
|
15870
16081
|
const spaceItems = [{
|
|
15871
16082
|
id: "shenzhen-hq",
|
|
@@ -16222,13 +16433,15 @@ const objectSelectProps = {
|
|
|
16222
16433
|
type: Array,
|
|
16223
16434
|
default: () => specialties
|
|
16224
16435
|
},
|
|
16225
|
-
loadChildren: Function
|
|
16436
|
+
loadChildren: Function,
|
|
16437
|
+
search: Function,
|
|
16438
|
+
searchDebounce: makeNumericProp(300)
|
|
16226
16439
|
};
|
|
16227
16440
|
const flattenItems$1 = (items) => items.flatMap((item) => [item, ...item.children ? flattenItems$1(item.children) : []]);
|
|
16228
16441
|
var stdin_default$t = vue.defineComponent({
|
|
16229
16442
|
name: name$o,
|
|
16230
16443
|
props: objectSelectProps,
|
|
16231
|
-
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error"],
|
|
16444
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error", "search-error"],
|
|
16232
16445
|
setup(props2, {
|
|
16233
16446
|
emit
|
|
16234
16447
|
}) {
|
|
@@ -16241,6 +16454,12 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16241
16454
|
const expandedSelected = vue.ref(false);
|
|
16242
16455
|
const searching = vue.ref(false);
|
|
16243
16456
|
const keyword = vue.ref("");
|
|
16457
|
+
const asyncSearchResults = vue.ref([]);
|
|
16458
|
+
const searchLoading = vue.ref(false);
|
|
16459
|
+
const searchFailed = vue.ref(false);
|
|
16460
|
+
const searchedItems = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
16461
|
+
let searchTimer;
|
|
16462
|
+
let searchRequestId = 0;
|
|
16244
16463
|
const loadedChildren = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
16245
16464
|
const getChildren = (item) => loadedChildren.get(item.id) || item.children || [];
|
|
16246
16465
|
const hydrateItems = (items) => items.map((item) => {
|
|
@@ -16262,6 +16481,12 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16262
16481
|
view.value = 0;
|
|
16263
16482
|
specialtyType.value = 0;
|
|
16264
16483
|
keyword.value = "";
|
|
16484
|
+
asyncSearchResults.value = [];
|
|
16485
|
+
searchLoading.value = false;
|
|
16486
|
+
searchFailed.value = false;
|
|
16487
|
+
searchRequestId += 1;
|
|
16488
|
+
if (searchTimer)
|
|
16489
|
+
clearTimeout(searchTimer);
|
|
16265
16490
|
searching.value = false;
|
|
16266
16491
|
expandedSelected.value = false;
|
|
16267
16492
|
expandedSpecialties.value = {
|
|
@@ -16274,13 +16499,64 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16274
16499
|
});
|
|
16275
16500
|
const selected = vue.computed(() => props2.modelValue);
|
|
16276
16501
|
const allItems = vue.computed(() => flattenItems$1(hydrateItems([...props2.spaceItems, ...props2.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])])));
|
|
16277
|
-
const selectedItems = vue.computed(() =>
|
|
16502
|
+
const selectedItems = vue.computed(() => {
|
|
16503
|
+
const items = /* @__PURE__ */ new Map();
|
|
16504
|
+
allItems.value.forEach((item) => items.set(item.id, item));
|
|
16505
|
+
searchedItems.forEach((item) => items.set(item.id, item));
|
|
16506
|
+
return selected.value.flatMap((id) => {
|
|
16507
|
+
const item = items.get(id);
|
|
16508
|
+
return item ? [item] : [];
|
|
16509
|
+
});
|
|
16510
|
+
});
|
|
16278
16511
|
const searchResults = vue.computed(() => {
|
|
16279
16512
|
const query = keyword.value.trim().toLowerCase();
|
|
16280
16513
|
if (!query)
|
|
16281
16514
|
return [];
|
|
16515
|
+
if (props2.search)
|
|
16516
|
+
return asyncSearchResults.value;
|
|
16282
16517
|
return allItems.value.filter((item) => item.text.toLowerCase().includes(query));
|
|
16283
16518
|
});
|
|
16519
|
+
const runSearch = (..._0) => __async$2(this, [..._0], function* (query = keyword.value.trim()) {
|
|
16520
|
+
if (!props2.search || !query)
|
|
16521
|
+
return;
|
|
16522
|
+
const requestId = ++searchRequestId;
|
|
16523
|
+
searchLoading.value = true;
|
|
16524
|
+
searchFailed.value = false;
|
|
16525
|
+
try {
|
|
16526
|
+
const results = yield props2.search(query);
|
|
16527
|
+
if (requestId !== searchRequestId)
|
|
16528
|
+
return;
|
|
16529
|
+
asyncSearchResults.value = results;
|
|
16530
|
+
results.forEach((item) => searchedItems.set(item.id, item));
|
|
16531
|
+
} catch (error) {
|
|
16532
|
+
if (requestId !== searchRequestId)
|
|
16533
|
+
return;
|
|
16534
|
+
asyncSearchResults.value = [];
|
|
16535
|
+
searchFailed.value = true;
|
|
16536
|
+
emit("search-error", query, error);
|
|
16537
|
+
} finally {
|
|
16538
|
+
if (requestId === searchRequestId)
|
|
16539
|
+
searchLoading.value = false;
|
|
16540
|
+
}
|
|
16541
|
+
});
|
|
16542
|
+
const scheduleSearch = () => {
|
|
16543
|
+
if (searchTimer)
|
|
16544
|
+
clearTimeout(searchTimer);
|
|
16545
|
+
searchRequestId += 1;
|
|
16546
|
+
searchLoading.value = false;
|
|
16547
|
+
searchFailed.value = false;
|
|
16548
|
+
asyncSearchResults.value = [];
|
|
16549
|
+
const query = keyword.value.trim();
|
|
16550
|
+
if (!props2.search || !query)
|
|
16551
|
+
return;
|
|
16552
|
+
searchTimer = setTimeout(runSearch, Number(props2.searchDebounce));
|
|
16553
|
+
};
|
|
16554
|
+
vue.watch([keyword, () => props2.search], scheduleSearch);
|
|
16555
|
+
vue.onBeforeUnmount(() => {
|
|
16556
|
+
searchRequestId += 1;
|
|
16557
|
+
if (searchTimer)
|
|
16558
|
+
clearTimeout(searchTimer);
|
|
16559
|
+
});
|
|
16284
16560
|
const renderHighlightedText = (text) => {
|
|
16285
16561
|
const query = keyword.value.trim();
|
|
16286
16562
|
if (!query)
|
|
@@ -16361,6 +16637,45 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16361
16637
|
}, null), expanded && renderTree(items)]);
|
|
16362
16638
|
};
|
|
16363
16639
|
const close = () => emit("update:show", false);
|
|
16640
|
+
const renderSearchContent = () => {
|
|
16641
|
+
if (!keyword.value.trim())
|
|
16642
|
+
return;
|
|
16643
|
+
if (searchLoading.value) {
|
|
16644
|
+
return vue.createVNode("div", {
|
|
16645
|
+
"class": bem$o("search-state")
|
|
16646
|
+
}, [vue.createVNode(Loading, {
|
|
16647
|
+
"vertical": true
|
|
16648
|
+
}, {
|
|
16649
|
+
default: () => [vue.createTextVNode("加载中...")]
|
|
16650
|
+
})]);
|
|
16651
|
+
}
|
|
16652
|
+
if (searchFailed.value) {
|
|
16653
|
+
return vue.createVNode(Empty, {
|
|
16654
|
+
"image": "network",
|
|
16655
|
+
"description": "搜索失败,请重试"
|
|
16656
|
+
}, null);
|
|
16657
|
+
}
|
|
16658
|
+
if (!searchResults.value.length) {
|
|
16659
|
+
return vue.createVNode(Empty, {
|
|
16660
|
+
"description": "暂无搜索结果"
|
|
16661
|
+
}, null);
|
|
16662
|
+
}
|
|
16663
|
+
return vue.createVNode("div", {
|
|
16664
|
+
"class": bem$o("tree-card", {
|
|
16665
|
+
search: true
|
|
16666
|
+
})
|
|
16667
|
+
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
16668
|
+
"key": item.id,
|
|
16669
|
+
"rightSelect": selected.value.includes(item.id),
|
|
16670
|
+
"selectType": "checkbox",
|
|
16671
|
+
"border": true,
|
|
16672
|
+
"clickable": true,
|
|
16673
|
+
"onClick": () => toggleSearchItem(item),
|
|
16674
|
+
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
16675
|
+
}, {
|
|
16676
|
+
title: () => renderHighlightedText(item.text)
|
|
16677
|
+
}))]);
|
|
16678
|
+
};
|
|
16364
16679
|
return () => vue.createVNode(ActionSheet, {
|
|
16365
16680
|
"show": props2.show,
|
|
16366
16681
|
"class": bem$o(),
|
|
@@ -16371,10 +16686,18 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16371
16686
|
"modelValue": keyword.value,
|
|
16372
16687
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
16373
16688
|
"class": bem$o("search"),
|
|
16689
|
+
"variant": "pure",
|
|
16374
16690
|
"shape": "round",
|
|
16375
16691
|
"inputAlign": "left",
|
|
16376
16692
|
"autofocus": true,
|
|
16377
16693
|
"placeholder": "搜索对象",
|
|
16694
|
+
"onSearch": () => {
|
|
16695
|
+
if (props2.search) {
|
|
16696
|
+
if (searchTimer)
|
|
16697
|
+
clearTimeout(searchTimer);
|
|
16698
|
+
runSearch();
|
|
16699
|
+
}
|
|
16700
|
+
},
|
|
16378
16701
|
"onCancel": () => {
|
|
16379
16702
|
searching.value = false;
|
|
16380
16703
|
keyword.value = "";
|
|
@@ -16413,21 +16736,7 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16413
16736
|
}, null)]
|
|
16414
16737
|
})]), vue.createVNode("div", {
|
|
16415
16738
|
"class": bem$o("body")
|
|
16416
|
-
}, [searching.value ?
|
|
16417
|
-
"class": bem$o("tree-card", {
|
|
16418
|
-
search: true
|
|
16419
|
-
})
|
|
16420
|
-
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
16421
|
-
"key": item.id,
|
|
16422
|
-
"rightSelect": selected.value.includes(item.id),
|
|
16423
|
-
"selectType": "checkbox",
|
|
16424
|
-
"border": true,
|
|
16425
|
-
"clickable": true,
|
|
16426
|
-
"onClick": () => toggleSearchItem(item),
|
|
16427
|
-
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
16428
|
-
}, {
|
|
16429
|
-
title: () => renderHighlightedText(item.text)
|
|
16430
|
-
}))]) : view.value === 0 ? renderTree(props2.spaceItems) : vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
|
|
16739
|
+
}, [searching.value ? renderSearchContent() : view.value === 0 ? renderTree(props2.spaceItems) : vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
|
|
16431
16740
|
"class": bem$o("type-tabs")
|
|
16432
16741
|
}, [vue.createVNode(FilterTag, {
|
|
16433
16742
|
"selected": specialtyType.value === 0,
|
|
@@ -21465,7 +21774,7 @@ const Lazyload = {
|
|
|
21465
21774
|
});
|
|
21466
21775
|
}
|
|
21467
21776
|
};
|
|
21468
|
-
const version = "0.0.
|
|
21777
|
+
const version = "0.0.45";
|
|
21469
21778
|
function install(app) {
|
|
21470
21779
|
const components = [
|
|
21471
21780
|
ActionBar,
|