persagy-vant 0.0.43 → 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 +25 -3
- package/es/object-select/ObjectSelect.mjs +163 -30
- package/es/object-select/index.css +1 -1
- package/es/object-select/index.d.ts +18 -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/es/tree-select/TreeSelect.d.ts +7 -1
- package/es/tree-select/TreeSelect.mjs +107 -54
- package/es/tree-select/index.css +1 -1
- package/es/tree-select/index.d.ts +6 -2
- package/es/tree-select/index.less +6 -0
- package/es/tree-select/style/index.mjs +1 -0
- package/es/tree-select/style/less.mjs +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 +25 -3
- package/lib/object-select/ObjectSelect.js +161 -28
- package/lib/object-select/index.css +1 -1
- package/lib/object-select/index.d.ts +18 -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/tree-select/TreeSelect.d.ts +7 -1
- package/lib/tree-select/TreeSelect.js +107 -52
- package/lib/tree-select/index.css +1 -1
- package/lib/tree-select/index.d.ts +6 -2
- package/lib/tree-select/index.less +6 -0
- package/lib/tree-select/style/index.js +1 -0
- package/lib/tree-select/style/less.js +1 -0
- package/lib/vant.cjs.js +492 -118
- package/lib/vant.es.js +493 -119
- package/lib/vant.js +492 -118
- 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/skills/use-persagy-vant/references/component-catalog.md +1 -1
package/lib/vant.cjs.js
CHANGED
|
@@ -7610,21 +7610,21 @@ var stdin_default$1o = vue.defineComponent({
|
|
|
7610
7610
|
}, [renderChildren()]);
|
|
7611
7611
|
}
|
|
7612
7612
|
});
|
|
7613
|
-
var __defProp
|
|
7613
|
+
var __defProp = Object.defineProperty;
|
|
7614
7614
|
var __defProps = Object.defineProperties;
|
|
7615
7615
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7616
|
-
var __getOwnPropSymbols
|
|
7617
|
-
var __hasOwnProp
|
|
7618
|
-
var __propIsEnum
|
|
7619
|
-
var __defNormalProp
|
|
7620
|
-
var __spreadValues
|
|
7616
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7617
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7618
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7619
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7620
|
+
var __spreadValues = (a, b) => {
|
|
7621
7621
|
for (var prop in b || (b = {}))
|
|
7622
|
-
if (__hasOwnProp
|
|
7623
|
-
__defNormalProp
|
|
7624
|
-
if (__getOwnPropSymbols
|
|
7625
|
-
for (var prop of __getOwnPropSymbols
|
|
7626
|
-
if (__propIsEnum
|
|
7627
|
-
__defNormalProp
|
|
7622
|
+
if (__hasOwnProp.call(b, prop))
|
|
7623
|
+
__defNormalProp(a, prop, b[prop]);
|
|
7624
|
+
if (__getOwnPropSymbols)
|
|
7625
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
7626
|
+
if (__propIsEnum.call(b, prop))
|
|
7627
|
+
__defNormalProp(a, prop, b[prop]);
|
|
7628
7628
|
}
|
|
7629
7629
|
return a;
|
|
7630
7630
|
};
|
|
@@ -7880,7 +7880,7 @@ var stdin_default$1n = vue.defineComponent({
|
|
|
7880
7880
|
name: tab.title,
|
|
7881
7881
|
disabled: tab.disabled
|
|
7882
7882
|
}));
|
|
7883
|
-
return actions.map((action, index) => __spreadProps(__spreadValues
|
|
7883
|
+
return actions.map((action, index) => __spreadProps(__spreadValues({}, action), {
|
|
7884
7884
|
color: index === state.currentIndex ? "var(--van-primary-color)" : action.color,
|
|
7885
7885
|
className: [action.className, bem$1d("more-option", {
|
|
7886
7886
|
active: index === state.currentIndex
|
|
@@ -13034,21 +13034,25 @@ var stdin_default$K = vue.defineComponent({
|
|
|
13034
13034
|
}
|
|
13035
13035
|
});
|
|
13036
13036
|
const InfoCard = withInstall(stdin_default$K);
|
|
13037
|
-
var
|
|
13038
|
-
|
|
13039
|
-
var
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
|
|
13037
|
+
var __async$5 = (__this, __arguments, generator) => {
|
|
13038
|
+
return new Promise((resolve, reject) => {
|
|
13039
|
+
var fulfilled = (value) => {
|
|
13040
|
+
try {
|
|
13041
|
+
step(generator.next(value));
|
|
13042
|
+
} catch (e) {
|
|
13043
|
+
reject(e);
|
|
13044
|
+
}
|
|
13045
|
+
};
|
|
13046
|
+
var rejected = (value) => {
|
|
13047
|
+
try {
|
|
13048
|
+
step(generator.throw(value));
|
|
13049
|
+
} catch (e) {
|
|
13050
|
+
reject(e);
|
|
13051
|
+
}
|
|
13052
|
+
};
|
|
13053
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
13054
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
13055
|
+
});
|
|
13052
13056
|
};
|
|
13053
13057
|
const [name$B, bem$B] = createNamespace("tree-select");
|
|
13054
13058
|
const treeSelectProps = {
|
|
@@ -13060,20 +13064,31 @@ const treeSelectProps = {
|
|
|
13060
13064
|
selectableParent: Boolean,
|
|
13061
13065
|
showParentSelect: Boolean,
|
|
13062
13066
|
showSelectLevels: Array,
|
|
13063
|
-
showDivider: truthProp
|
|
13067
|
+
showDivider: truthProp,
|
|
13068
|
+
loadChildren: Function
|
|
13064
13069
|
};
|
|
13065
13070
|
var stdin_default$J = vue.defineComponent({
|
|
13066
13071
|
name: name$B,
|
|
13067
13072
|
props: treeSelectProps,
|
|
13068
|
-
emits: ["update:modelValue", "update:expandedKeys", "select", "expand"],
|
|
13073
|
+
emits: ["update:modelValue", "update:expandedKeys", "select", "expand", "load", "load-error"],
|
|
13069
13074
|
setup(props2, {
|
|
13070
13075
|
emit,
|
|
13071
13076
|
slots
|
|
13072
13077
|
}) {
|
|
13073
13078
|
const selectedKeys = vue.computed(() => props2.modelValue);
|
|
13074
13079
|
const expandedKeys = vue.computed(() => props2.expandedKeys);
|
|
13080
|
+
const resolvedChildren = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
13081
|
+
const loadingKeys = vue.shallowReactive(/* @__PURE__ */ new Set());
|
|
13082
|
+
const loadedKeys = vue.shallowReactive(/* @__PURE__ */ new Set());
|
|
13075
13083
|
const isExpanded = (id) => expandedKeys.value.includes(id);
|
|
13076
13084
|
const isSelected = (id) => selectedKeys.value.includes(id);
|
|
13085
|
+
const isLoading = (id) => loadingKeys.has(id);
|
|
13086
|
+
const getChildren = (item) => {
|
|
13087
|
+
var _a;
|
|
13088
|
+
return ((_a = item.children) == null ? void 0 : _a.length) ? item.children : resolvedChildren.get(item.id) || item.children || [];
|
|
13089
|
+
};
|
|
13090
|
+
const isLoadable = (item) => !!props2.loadChildren && Array.isArray(item.children) && !item.children.length && !loadedKeys.has(item.id);
|
|
13091
|
+
const isBranch = (item) => !!getChildren(item).length || isLoadable(item) || isLoading(item.id);
|
|
13077
13092
|
const isSelectionVisible = (hasChildren, level) => {
|
|
13078
13093
|
var _a;
|
|
13079
13094
|
const configuredVisibility = (_a = props2.showSelectLevels) == null ? void 0 : _a[level];
|
|
@@ -13085,10 +13100,7 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13085
13100
|
paddingLeft: `calc(var(--van-padding-md) + ${level * 16}px)`,
|
|
13086
13101
|
"--van-tree-select-divider-left": `calc(var(--van-padding-md) + ${level * 16}px)`
|
|
13087
13102
|
});
|
|
13088
|
-
const getDescendantIds = (item) =>
|
|
13089
|
-
var _a;
|
|
13090
|
-
return ((_a = item.children) == null ? void 0 : _a.flatMap((child) => [child.id, ...getDescendantIds(child)])) || [];
|
|
13091
|
-
};
|
|
13103
|
+
const getDescendantIds = (item) => getChildren(item).flatMap((child) => [child.id, ...getDescendantIds(child)]);
|
|
13092
13104
|
const getSelectionState = (item) => {
|
|
13093
13105
|
const descendantIds = getDescendantIds(item);
|
|
13094
13106
|
if (!props2.cascade || !descendantIds.length) {
|
|
@@ -13103,11 +13115,11 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13103
13115
|
};
|
|
13104
13116
|
const syncParentSelection = (items, values) => {
|
|
13105
13117
|
items.forEach((item) => {
|
|
13106
|
-
|
|
13107
|
-
if (!
|
|
13118
|
+
const children = getChildren(item);
|
|
13119
|
+
if (!children.length)
|
|
13108
13120
|
return;
|
|
13109
|
-
syncParentSelection(
|
|
13110
|
-
const childIds =
|
|
13121
|
+
syncParentSelection(children, values);
|
|
13122
|
+
const childIds = children.map((child) => child.id);
|
|
13111
13123
|
const index = values.indexOf(item.id);
|
|
13112
13124
|
const allChildrenSelected = childIds.every((id) => values.includes(id));
|
|
13113
13125
|
if (allChildrenSelected && index === -1)
|
|
@@ -13116,13 +13128,45 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13116
13128
|
values.splice(index, 1);
|
|
13117
13129
|
});
|
|
13118
13130
|
};
|
|
13119
|
-
const
|
|
13131
|
+
const updateExpanded = (id, expanded) => {
|
|
13120
13132
|
const next = expandedKeys.value.slice();
|
|
13121
13133
|
const index = next.indexOf(id);
|
|
13122
|
-
|
|
13134
|
+
if (expanded && index === -1)
|
|
13135
|
+
next.push(id);
|
|
13136
|
+
if (!expanded && index !== -1)
|
|
13137
|
+
next.splice(index, 1);
|
|
13123
13138
|
emit("update:expandedKeys", next);
|
|
13124
|
-
emit("expand", id,
|
|
13139
|
+
emit("expand", id, expanded);
|
|
13125
13140
|
};
|
|
13141
|
+
const toggleExpanded = (item) => __async$5(this, null, function* () {
|
|
13142
|
+
const {
|
|
13143
|
+
id
|
|
13144
|
+
} = item;
|
|
13145
|
+
if (isLoading(id))
|
|
13146
|
+
return;
|
|
13147
|
+
if (isExpanded(id)) {
|
|
13148
|
+
updateExpanded(id, false);
|
|
13149
|
+
return;
|
|
13150
|
+
}
|
|
13151
|
+
if (isLoadable(item)) {
|
|
13152
|
+
loadingKeys.add(id);
|
|
13153
|
+
try {
|
|
13154
|
+
const result = yield props2.loadChildren(item);
|
|
13155
|
+
const children = Array.isArray(result) ? result : [];
|
|
13156
|
+
resolvedChildren.set(id, children);
|
|
13157
|
+
loadedKeys.add(id);
|
|
13158
|
+
emit("load", item, children);
|
|
13159
|
+
if (children.length)
|
|
13160
|
+
updateExpanded(id, true);
|
|
13161
|
+
} catch (error) {
|
|
13162
|
+
emit("load-error", item, error);
|
|
13163
|
+
} finally {
|
|
13164
|
+
loadingKeys.delete(id);
|
|
13165
|
+
}
|
|
13166
|
+
return;
|
|
13167
|
+
}
|
|
13168
|
+
updateExpanded(id, true);
|
|
13169
|
+
});
|
|
13126
13170
|
const updateSelected = (item, selected) => {
|
|
13127
13171
|
if (item.disabled || item.selectable === false)
|
|
13128
13172
|
return;
|
|
@@ -13141,12 +13185,13 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13141
13185
|
emit("select", item, selected);
|
|
13142
13186
|
};
|
|
13143
13187
|
const renderNodes = (items, level = 0) => items.map((item) => {
|
|
13144
|
-
|
|
13145
|
-
const hasChildren =
|
|
13188
|
+
const children = getChildren(item);
|
|
13189
|
+
const hasChildren = isBranch(item);
|
|
13146
13190
|
const expanded = isExpanded(item.id);
|
|
13191
|
+
const loading = isLoading(item.id);
|
|
13147
13192
|
const renderTitle = () => {
|
|
13148
|
-
var
|
|
13149
|
-
return ((
|
|
13193
|
+
var _a;
|
|
13194
|
+
return ((_a = slots.title) == null ? void 0 : _a.call(slots, {
|
|
13150
13195
|
item,
|
|
13151
13196
|
level,
|
|
13152
13197
|
hasChildren
|
|
@@ -13166,36 +13211,29 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13166
13211
|
}
|
|
13167
13212
|
const selectable = item.selectable !== false && isSelectionVisible(hasChildren, level);
|
|
13168
13213
|
const selectionState = getSelectionState(item);
|
|
13169
|
-
|
|
13170
|
-
"key": item.id,
|
|
13171
|
-
"class": bem$B("node")
|
|
13172
|
-
}, [vue.createVNode(Cell, {
|
|
13173
|
-
"class": bem$B("cell", {
|
|
13174
|
-
branch: hasChildren
|
|
13175
|
-
}),
|
|
13176
|
-
"title": item.text,
|
|
13177
|
-
"border": props2.showDivider,
|
|
13178
|
-
"style": getNodeStyle(level),
|
|
13179
|
-
"rightSelect": selectable && selectionState !== "indeterminate" ? selectionState === "checked" : void 0,
|
|
13180
|
-
"selectType": props2.multiple ? "checkbox" : "radio",
|
|
13181
|
-
"onUpdate:rightSelect": (value) => updateSelected(item, value)
|
|
13182
|
-
}, __spreadValues({
|
|
13214
|
+
const cellSlots = {
|
|
13183
13215
|
title: () => [hasChildren ? vue.createVNode("button", {
|
|
13184
13216
|
"type": "button",
|
|
13185
13217
|
"class": bem$B("expand-control"),
|
|
13186
13218
|
"disabled": item.disabled,
|
|
13219
|
+
"aria-busy": loading,
|
|
13220
|
+
"aria-disabled": loading,
|
|
13187
13221
|
"onClick": (event) => {
|
|
13188
13222
|
event.stopPropagation();
|
|
13189
|
-
toggleExpanded(item
|
|
13223
|
+
toggleExpanded(item);
|
|
13190
13224
|
}
|
|
13191
|
-
}, [vue.createVNode(
|
|
13225
|
+
}, [loading ? vue.createVNode(Loading, {
|
|
13226
|
+
"class": bem$B("loading"),
|
|
13227
|
+
"size": "var(--van-tree-select-arrow-size)"
|
|
13228
|
+
}, null) : vue.createVNode(Icon, {
|
|
13192
13229
|
"name": "trangle-down",
|
|
13193
13230
|
"class": bem$B("arrow", {
|
|
13194
13231
|
expanded
|
|
13195
13232
|
})
|
|
13196
13233
|
}, null), vue.createVNode("span", null, [renderTitle()])]) : vue.createVNode("span", null, [renderTitle()])]
|
|
13197
|
-
}
|
|
13198
|
-
|
|
13234
|
+
};
|
|
13235
|
+
if (selectable && selectionState === "indeterminate") {
|
|
13236
|
+
cellSlots["right-select"] = () => vue.createVNode("button", {
|
|
13199
13237
|
"type": "button",
|
|
13200
13238
|
"class": bem$B("indeterminate"),
|
|
13201
13239
|
"aria-label": `部分选中${item.text}`,
|
|
@@ -13203,13 +13241,27 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13203
13241
|
event.stopPropagation();
|
|
13204
13242
|
updateSelected(item, true);
|
|
13205
13243
|
}
|
|
13206
|
-
}, null)
|
|
13207
|
-
}
|
|
13244
|
+
}, null);
|
|
13245
|
+
}
|
|
13246
|
+
return vue.createVNode("div", {
|
|
13247
|
+
"key": item.id,
|
|
13248
|
+
"class": bem$B("node")
|
|
13249
|
+
}, [vue.createVNode(Cell, {
|
|
13250
|
+
"class": bem$B("cell", {
|
|
13251
|
+
branch: hasChildren
|
|
13252
|
+
}),
|
|
13253
|
+
"title": item.text,
|
|
13254
|
+
"border": props2.showDivider,
|
|
13255
|
+
"style": getNodeStyle(level),
|
|
13256
|
+
"rightSelect": selectable && selectionState !== "indeterminate" ? selectionState === "checked" : void 0,
|
|
13257
|
+
"selectType": props2.multiple ? "checkbox" : "radio",
|
|
13258
|
+
"onUpdate:rightSelect": (value) => updateSelected(item, value)
|
|
13259
|
+
}, cellSlots), vue.createVNode(vue.Transition, {
|
|
13208
13260
|
"name": "van-tree-select-expand"
|
|
13209
13261
|
}, {
|
|
13210
13262
|
default: () => [hasChildren && expanded && vue.createVNode("div", {
|
|
13211
13263
|
"class": bem$B("children")
|
|
13212
|
-
}, [renderNodes(
|
|
13264
|
+
}, [renderNodes(children, level + 1)])]
|
|
13213
13265
|
})]);
|
|
13214
13266
|
});
|
|
13215
13267
|
return () => vue.createVNode("div", {
|
|
@@ -13219,6 +13271,26 @@ var stdin_default$J = vue.defineComponent({
|
|
|
13219
13271
|
});
|
|
13220
13272
|
const TreeSelect = withInstall(stdin_default$J);
|
|
13221
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
|
+
};
|
|
13222
13294
|
const [name$A, bem$A] = createNamespace("location-select");
|
|
13223
13295
|
const locations = [[{
|
|
13224
13296
|
id: "basement",
|
|
@@ -13353,12 +13425,14 @@ const props$1 = {
|
|
|
13353
13425
|
type: Array,
|
|
13354
13426
|
default: () => locations
|
|
13355
13427
|
},
|
|
13356
|
-
tabTitles: makeArrayProp()
|
|
13428
|
+
tabTitles: makeArrayProp(),
|
|
13429
|
+
search: Function,
|
|
13430
|
+
searchDebounce: makeNumericProp(300)
|
|
13357
13431
|
};
|
|
13358
13432
|
var stdin_default$H = vue.defineComponent({
|
|
13359
13433
|
name: name$A,
|
|
13360
13434
|
props: props$1,
|
|
13361
|
-
emits: ["update:show", "update:modelValue", "change"],
|
|
13435
|
+
emits: ["update:show", "update:modelValue", "change", "search-error"],
|
|
13362
13436
|
setup(props2, {
|
|
13363
13437
|
emit
|
|
13364
13438
|
}) {
|
|
@@ -13368,6 +13442,12 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13368
13442
|
const customValue = vue.ref("");
|
|
13369
13443
|
const expandedKeys = vue.ref(["basement", "b3"]);
|
|
13370
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;
|
|
13371
13451
|
const titles = vue.computed(() => props2.tabTitles.length ? props2.tabTitles : ["ABC座地下室", "A座", "B座", "C座", "D座"]);
|
|
13372
13452
|
const allItems = vue.computed(() => props2.items.flatMap(flatten));
|
|
13373
13453
|
const currentRoot = vue.computed(() => {
|
|
@@ -13378,7 +13458,48 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13378
13458
|
var _a;
|
|
13379
13459
|
return ((_a = currentRoot.value) == null ? void 0 : _a.children) || [];
|
|
13380
13460
|
});
|
|
13381
|
-
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);
|
|
13382
13503
|
vue.watch(() => props2.show, (show) => {
|
|
13383
13504
|
if (show) {
|
|
13384
13505
|
active.value = 0;
|
|
@@ -13386,11 +13507,16 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13386
13507
|
expandedKeys.value = ["basement", "b3"];
|
|
13387
13508
|
}
|
|
13388
13509
|
});
|
|
13510
|
+
vue.onBeforeUnmount(() => {
|
|
13511
|
+
searchRequestId += 1;
|
|
13512
|
+
if (searchTimer)
|
|
13513
|
+
clearTimeout(searchTimer);
|
|
13514
|
+
});
|
|
13389
13515
|
const close = () => emit("update:show", false);
|
|
13390
13516
|
const select = (value) => {
|
|
13391
13517
|
const selected = value[0];
|
|
13392
13518
|
if (selected !== void 0) {
|
|
13393
|
-
const selectedItem = allItems.value.find((item) => item.id === selected);
|
|
13519
|
+
const selectedItem = allItems.value.find((item) => item.id === selected) || searchedItems.get(selected);
|
|
13394
13520
|
emit("update:modelValue", selected);
|
|
13395
13521
|
emit("change", selected, selectedItem == null ? void 0 : selectedItem.text);
|
|
13396
13522
|
close();
|
|
@@ -13405,6 +13531,37 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13405
13531
|
showCustom.value = false;
|
|
13406
13532
|
close();
|
|
13407
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
|
+
};
|
|
13408
13565
|
return () => vue.createVNode(ActionSheet, {
|
|
13409
13566
|
"show": props2.show,
|
|
13410
13567
|
"class": bem$A(),
|
|
@@ -13435,23 +13592,20 @@ var stdin_default$H = vue.defineComponent({
|
|
|
13435
13592
|
"modelValue": query.value,
|
|
13436
13593
|
"onUpdate:modelValue": ($event) => query.value = $event,
|
|
13437
13594
|
"class": bem$A("search"),
|
|
13595
|
+
"variant": "pure",
|
|
13438
13596
|
"shape": "round",
|
|
13439
13597
|
"inputAlign": "left",
|
|
13440
|
-
"placeholder": "请输入搜索关键词"
|
|
13598
|
+
"placeholder": "请输入搜索关键词",
|
|
13599
|
+
"onSearch": () => {
|
|
13600
|
+
if (props2.search) {
|
|
13601
|
+
if (searchTimer)
|
|
13602
|
+
clearTimeout(searchTimer);
|
|
13603
|
+
runSearch();
|
|
13604
|
+
}
|
|
13605
|
+
}
|
|
13441
13606
|
}, null), query.value ? vue.createVNode("div", {
|
|
13442
13607
|
"class": bem$A("body")
|
|
13443
|
-
}, [vue.createVNode(
|
|
13444
|
-
"class": bem$A("card")
|
|
13445
|
-
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
13446
|
-
"key": item.id,
|
|
13447
|
-
"title": item.text,
|
|
13448
|
-
"rightSelect": props2.modelValue === item.id,
|
|
13449
|
-
"selectType": "radio",
|
|
13450
|
-
"border": true,
|
|
13451
|
-
"clickable": true,
|
|
13452
|
-
"onClick": () => select([item.id]),
|
|
13453
|
-
"onUpdate:rightSelect": () => select([item.id])
|
|
13454
|
-
}, null))])]) : vue.createVNode(vue.Fragment, null, [vue.createVNode(Tabs, {
|
|
13608
|
+
}, [renderSearchContent()]) : vue.createVNode(vue.Fragment, null, [vue.createVNode(Tabs, {
|
|
13455
13609
|
"active": active.value,
|
|
13456
13610
|
"onUpdate:active": ($event) => active.value = $event,
|
|
13457
13611
|
"showMore": showMore.value,
|
|
@@ -14119,6 +14273,26 @@ var stdin_default$D = vue.defineComponent({
|
|
|
14119
14273
|
});
|
|
14120
14274
|
const MaterialDetail = withInstall(stdin_default$D);
|
|
14121
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
|
+
};
|
|
14122
14296
|
const [name$w, bem$w] = createNamespace("material-add");
|
|
14123
14297
|
const defaultItems = [{
|
|
14124
14298
|
id: "refrigerant",
|
|
@@ -14426,12 +14600,14 @@ const materialAddProps = {
|
|
|
14426
14600
|
commonTabText: makeStringProp("常用物料"),
|
|
14427
14601
|
allTabText: makeStringProp("全部物料"),
|
|
14428
14602
|
materialTabText: makeStringProp("物资"),
|
|
14429
|
-
toolTabText: makeStringProp("工具")
|
|
14603
|
+
toolTabText: makeStringProp("工具"),
|
|
14604
|
+
search: Function,
|
|
14605
|
+
searchDebounce: makeNumericProp(300)
|
|
14430
14606
|
};
|
|
14431
14607
|
var stdin_default$B = vue.defineComponent({
|
|
14432
14608
|
name: name$w,
|
|
14433
14609
|
props: materialAddProps,
|
|
14434
|
-
emits: ["update:show", "update:modelValue", "change", "confirm"],
|
|
14610
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "search-error"],
|
|
14435
14611
|
setup(props2, {
|
|
14436
14612
|
emit
|
|
14437
14613
|
}) {
|
|
@@ -14447,6 +14623,10 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14447
14623
|
const activeKind = vue.ref(getDefaultKind());
|
|
14448
14624
|
const keyword = vue.ref("");
|
|
14449
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;
|
|
14450
14630
|
const expandedKeys = vue.ref([]);
|
|
14451
14631
|
const expandedSelected = vue.ref(false);
|
|
14452
14632
|
const detailItem = vue.ref();
|
|
@@ -14518,6 +14698,11 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14518
14698
|
activeTab.value = getDefaultTab();
|
|
14519
14699
|
activeKind.value = getDefaultKind();
|
|
14520
14700
|
keyword.value = "";
|
|
14701
|
+
searchLoading.value = false;
|
|
14702
|
+
searchFailed.value = false;
|
|
14703
|
+
searchRequestId += 1;
|
|
14704
|
+
if (searchTimer)
|
|
14705
|
+
clearTimeout(searchTimer);
|
|
14521
14706
|
searching.value = false;
|
|
14522
14707
|
expandedKeys.value = getDefaultExpandedKeys();
|
|
14523
14708
|
expandedSelected.value = false;
|
|
@@ -14535,6 +14720,40 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14535
14720
|
expandedKeys.value = getDefaultExpandedKeys();
|
|
14536
14721
|
}
|
|
14537
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
|
+
});
|
|
14538
14757
|
const setActiveTab = (tab) => {
|
|
14539
14758
|
activeTab.value = tab;
|
|
14540
14759
|
if (tab === "all") {
|
|
@@ -14601,9 +14820,25 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14601
14820
|
}, null);
|
|
14602
14821
|
const renderList = () => vue.createVNode("div", {
|
|
14603
14822
|
"class": bem$w("material-list")
|
|
14604
|
-
}, [visibleItems.value.length ? visibleItems.value.map((item) => renderMaterialCell(item, props2.items.indexOf(item))) : vue.createVNode(
|
|
14605
|
-
"
|
|
14606
|
-
},
|
|
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
|
+
};
|
|
14607
14842
|
const renderCatalog = () => {
|
|
14608
14843
|
const catalogItems = getCatalogItems();
|
|
14609
14844
|
const defaultExpandedKeys = getDefaultExpandedKeys();
|
|
@@ -14660,11 +14895,19 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14660
14895
|
"modelValue": keyword.value,
|
|
14661
14896
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
14662
14897
|
"class": bem$w("search"),
|
|
14898
|
+
"variant": "pure",
|
|
14663
14899
|
"shape": "round",
|
|
14664
14900
|
"inputAlign": "left",
|
|
14665
14901
|
"autofocus": true,
|
|
14666
14902
|
"showAction": true,
|
|
14667
14903
|
"placeholder": "搜索物资/工具名称",
|
|
14904
|
+
"onSearch": () => {
|
|
14905
|
+
if (props2.search) {
|
|
14906
|
+
if (searchTimer)
|
|
14907
|
+
clearTimeout(searchTimer);
|
|
14908
|
+
runSearch();
|
|
14909
|
+
}
|
|
14910
|
+
},
|
|
14668
14911
|
"onCancel": () => {
|
|
14669
14912
|
searching.value = false;
|
|
14670
14913
|
keyword.value = "";
|
|
@@ -14718,7 +14961,7 @@ var stdin_default$B = vue.defineComponent({
|
|
|
14718
14961
|
default: () => [props2.toolTabText]
|
|
14719
14962
|
})])]), vue.createVNode("div", {
|
|
14720
14963
|
"class": bem$w("body")
|
|
14721
|
-
}, [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", {
|
|
14722
14965
|
"class": bem$w("footer")
|
|
14723
14966
|
}, [renderSelectPanel(), vue.createVNode(BottomActionBar, {
|
|
14724
14967
|
"fixed": false,
|
|
@@ -15814,6 +16057,26 @@ var stdin_default$u = vue.defineComponent({
|
|
|
15814
16057
|
}
|
|
15815
16058
|
});
|
|
15816
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
|
+
};
|
|
15817
16080
|
const [name$o, bem$o] = createNamespace("object-select");
|
|
15818
16081
|
const spaceItems = [{
|
|
15819
16082
|
id: "shenzhen-hq",
|
|
@@ -15849,13 +16112,7 @@ const spaceItems = [{
|
|
|
15849
16112
|
id: "high-voltage",
|
|
15850
16113
|
text: "高压计量柜",
|
|
15851
16114
|
selectable: false,
|
|
15852
|
-
children: [
|
|
15853
|
-
id: "metering-cabinet-1",
|
|
15854
|
-
text: "B3_高压计量柜_1#"
|
|
15855
|
-
}, {
|
|
15856
|
-
id: "metering-cabinet-2",
|
|
15857
|
-
text: "B3_高压计量柜_2#"
|
|
15858
|
-
}]
|
|
16115
|
+
children: []
|
|
15859
16116
|
}]
|
|
15860
16117
|
}, {
|
|
15861
16118
|
id: "chiller-room",
|
|
@@ -16175,13 +16432,16 @@ const objectSelectProps = {
|
|
|
16175
16432
|
specialties: {
|
|
16176
16433
|
type: Array,
|
|
16177
16434
|
default: () => specialties
|
|
16178
|
-
}
|
|
16435
|
+
},
|
|
16436
|
+
loadChildren: Function,
|
|
16437
|
+
search: Function,
|
|
16438
|
+
searchDebounce: makeNumericProp(300)
|
|
16179
16439
|
};
|
|
16180
16440
|
const flattenItems$1 = (items) => items.flatMap((item) => [item, ...item.children ? flattenItems$1(item.children) : []]);
|
|
16181
16441
|
var stdin_default$t = vue.defineComponent({
|
|
16182
16442
|
name: name$o,
|
|
16183
16443
|
props: objectSelectProps,
|
|
16184
|
-
emits: ["update:show", "update:modelValue", "change", "confirm"],
|
|
16444
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error", "search-error"],
|
|
16185
16445
|
setup(props2, {
|
|
16186
16446
|
emit
|
|
16187
16447
|
}) {
|
|
@@ -16194,6 +16454,20 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16194
16454
|
const expandedSelected = vue.ref(false);
|
|
16195
16455
|
const searching = vue.ref(false);
|
|
16196
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;
|
|
16463
|
+
const loadedChildren = vue.shallowReactive(/* @__PURE__ */ new Map());
|
|
16464
|
+
const getChildren = (item) => loadedChildren.get(item.id) || item.children || [];
|
|
16465
|
+
const hydrateItems = (items) => items.map((item) => {
|
|
16466
|
+
const children = getChildren(item);
|
|
16467
|
+
return children.length ? extend({}, item, {
|
|
16468
|
+
children: hydrateItems(children)
|
|
16469
|
+
}) : item;
|
|
16470
|
+
});
|
|
16197
16471
|
const currentSpecialtyItems = (specialty) => specialtyType.value === 0 ? specialty.deviceItems : specialty.systemItems;
|
|
16198
16472
|
const expandOnlySpecialty = () => {
|
|
16199
16473
|
if (props2.specialties.length === 1) {
|
|
@@ -16207,6 +16481,12 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16207
16481
|
view.value = 0;
|
|
16208
16482
|
specialtyType.value = 0;
|
|
16209
16483
|
keyword.value = "";
|
|
16484
|
+
asyncSearchResults.value = [];
|
|
16485
|
+
searchLoading.value = false;
|
|
16486
|
+
searchFailed.value = false;
|
|
16487
|
+
searchRequestId += 1;
|
|
16488
|
+
if (searchTimer)
|
|
16489
|
+
clearTimeout(searchTimer);
|
|
16210
16490
|
searching.value = false;
|
|
16211
16491
|
expandedSelected.value = false;
|
|
16212
16492
|
expandedSpecialties.value = {
|
|
@@ -16218,14 +16498,65 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16218
16498
|
immediate: true
|
|
16219
16499
|
});
|
|
16220
16500
|
const selected = vue.computed(() => props2.modelValue);
|
|
16221
|
-
const allItems = vue.computed(() => flattenItems$1([...props2.spaceItems, ...props2.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])]));
|
|
16222
|
-
const selectedItems = vue.computed(() =>
|
|
16501
|
+
const allItems = vue.computed(() => flattenItems$1(hydrateItems([...props2.spaceItems, ...props2.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])])));
|
|
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
|
+
});
|
|
16223
16511
|
const searchResults = vue.computed(() => {
|
|
16224
16512
|
const query = keyword.value.trim().toLowerCase();
|
|
16225
16513
|
if (!query)
|
|
16226
16514
|
return [];
|
|
16515
|
+
if (props2.search)
|
|
16516
|
+
return asyncSearchResults.value;
|
|
16227
16517
|
return allItems.value.filter((item) => item.text.toLowerCase().includes(query));
|
|
16228
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
|
+
});
|
|
16229
16560
|
const renderHighlightedText = (text) => {
|
|
16230
16561
|
const query = keyword.value.trim();
|
|
16231
16562
|
if (!query)
|
|
@@ -16263,19 +16594,29 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16263
16594
|
update([]);
|
|
16264
16595
|
expandedSelected.value = false;
|
|
16265
16596
|
};
|
|
16597
|
+
const onLoad = (item, children) => {
|
|
16598
|
+
loadedChildren.set(item.id, children);
|
|
16599
|
+
emit("load", item, children);
|
|
16600
|
+
};
|
|
16601
|
+
const onLoadError = (item, error) => {
|
|
16602
|
+
emit("load-error", item, error);
|
|
16603
|
+
};
|
|
16266
16604
|
const renderTree = (items) => vue.createVNode("div", {
|
|
16267
16605
|
"class": bem$o("tree-card")
|
|
16268
16606
|
}, [vue.createVNode(TreeSelect, {
|
|
16269
16607
|
"modelValue": selected.value,
|
|
16270
16608
|
"expandedKeys": expandedKeys.value,
|
|
16271
|
-
"items": items,
|
|
16609
|
+
"items": hydrateItems(items),
|
|
16272
16610
|
"multiple": true,
|
|
16273
16611
|
"showParentSelect": true,
|
|
16274
16612
|
"cascade": false,
|
|
16613
|
+
"loadChildren": props2.loadChildren,
|
|
16275
16614
|
"onUpdate:modelValue": update,
|
|
16276
16615
|
"onUpdate:expandedKeys": (value) => {
|
|
16277
16616
|
expandedKeys.value = value;
|
|
16278
|
-
}
|
|
16617
|
+
},
|
|
16618
|
+
"onLoad": onLoad,
|
|
16619
|
+
"onLoad-error": onLoadError
|
|
16279
16620
|
}, null)]);
|
|
16280
16621
|
const renderSpecialty = (specialty) => {
|
|
16281
16622
|
var _a;
|
|
@@ -16296,6 +16637,45 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16296
16637
|
}, null), expanded && renderTree(items)]);
|
|
16297
16638
|
};
|
|
16298
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
|
+
};
|
|
16299
16679
|
return () => vue.createVNode(ActionSheet, {
|
|
16300
16680
|
"show": props2.show,
|
|
16301
16681
|
"class": bem$o(),
|
|
@@ -16306,10 +16686,18 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16306
16686
|
"modelValue": keyword.value,
|
|
16307
16687
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
16308
16688
|
"class": bem$o("search"),
|
|
16689
|
+
"variant": "pure",
|
|
16309
16690
|
"shape": "round",
|
|
16310
16691
|
"inputAlign": "left",
|
|
16311
16692
|
"autofocus": true,
|
|
16312
16693
|
"placeholder": "搜索对象",
|
|
16694
|
+
"onSearch": () => {
|
|
16695
|
+
if (props2.search) {
|
|
16696
|
+
if (searchTimer)
|
|
16697
|
+
clearTimeout(searchTimer);
|
|
16698
|
+
runSearch();
|
|
16699
|
+
}
|
|
16700
|
+
},
|
|
16313
16701
|
"onCancel": () => {
|
|
16314
16702
|
searching.value = false;
|
|
16315
16703
|
keyword.value = "";
|
|
@@ -16348,21 +16736,7 @@ var stdin_default$t = vue.defineComponent({
|
|
|
16348
16736
|
}, null)]
|
|
16349
16737
|
})]), vue.createVNode("div", {
|
|
16350
16738
|
"class": bem$o("body")
|
|
16351
|
-
}, [searching.value ?
|
|
16352
|
-
"class": bem$o("tree-card", {
|
|
16353
|
-
search: true
|
|
16354
|
-
})
|
|
16355
|
-
}, [searchResults.value.map((item) => vue.createVNode(Cell, {
|
|
16356
|
-
"key": item.id,
|
|
16357
|
-
"rightSelect": selected.value.includes(item.id),
|
|
16358
|
-
"selectType": "checkbox",
|
|
16359
|
-
"border": true,
|
|
16360
|
-
"clickable": true,
|
|
16361
|
-
"onClick": () => toggleSearchItem(item),
|
|
16362
|
-
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
16363
|
-
}, {
|
|
16364
|
-
title: () => renderHighlightedText(item.text)
|
|
16365
|
-
}))]) : 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", {
|
|
16366
16740
|
"class": bem$o("type-tabs")
|
|
16367
16741
|
}, [vue.createVNode(FilterTag, {
|
|
16368
16742
|
"selected": specialtyType.value === 0,
|
|
@@ -21400,7 +21774,7 @@ const Lazyload = {
|
|
|
21400
21774
|
});
|
|
21401
21775
|
}
|
|
21402
21776
|
};
|
|
21403
|
-
const version = "0.0.
|
|
21777
|
+
const version = "0.0.45";
|
|
21404
21778
|
function install(app) {
|
|
21405
21779
|
const components = [
|
|
21406
21780
|
ActionBar,
|