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
|
@@ -52,7 +52,12 @@ export declare const MaterialAdd: import("../utils").WithInstall<import("vue").D
|
|
|
52
52
|
type: import("vue").PropType<string>;
|
|
53
53
|
default: string;
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
search: import("vue").PropType<import("./types").MaterialAddSearch>;
|
|
56
|
+
searchDebounce: {
|
|
57
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
58
|
+
default: number;
|
|
59
|
+
};
|
|
60
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue" | "update:show" | "confirm" | "search-error")[], "change" | "update:modelValue" | "update:show" | "confirm" | "search-error", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
56
61
|
show: BooleanConstructor;
|
|
57
62
|
modelValue: {
|
|
58
63
|
type: import("vue").PropType<number[]>;
|
|
@@ -106,17 +111,24 @@ export declare const MaterialAdd: import("../utils").WithInstall<import("vue").D
|
|
|
106
111
|
type: import("vue").PropType<string>;
|
|
107
112
|
default: string;
|
|
108
113
|
};
|
|
114
|
+
search: import("vue").PropType<import("./types").MaterialAddSearch>;
|
|
115
|
+
searchDebounce: {
|
|
116
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
117
|
+
default: number;
|
|
118
|
+
};
|
|
109
119
|
}>> & {
|
|
110
120
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
111
121
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
112
122
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
113
123
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
124
|
+
"onSearch-error"?: ((...args: any[]) => any) | undefined;
|
|
114
125
|
}, {
|
|
115
126
|
title: string;
|
|
116
127
|
modelValue: number[];
|
|
117
128
|
show: boolean;
|
|
118
129
|
confirmText: string;
|
|
119
130
|
items: import("./types").MaterialAddItem[];
|
|
131
|
+
searchDebounce: string | number;
|
|
120
132
|
categories: import("./types").MaterialAddCategory[];
|
|
121
133
|
showCommonTab: boolean;
|
|
122
134
|
showAllTab: boolean;
|
|
@@ -129,7 +141,7 @@ export declare const MaterialAdd: import("../utils").WithInstall<import("vue").D
|
|
|
129
141
|
}>>;
|
|
130
142
|
export default MaterialAdd;
|
|
131
143
|
export type { MaterialAddProps } from './MaterialAdd';
|
|
132
|
-
export type { MaterialAddCategory, MaterialAddCategoryNode, MaterialAddItem } from './types';
|
|
144
|
+
export type { MaterialAddCategory, MaterialAddCategoryNode, MaterialAddItem, MaterialAddSearch, } from './types';
|
|
133
145
|
declare module 'vue' {
|
|
134
146
|
interface GlobalComponents {
|
|
135
147
|
VanMaterialAdd: typeof MaterialAdd;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
&__tree-card { margin-bottom: 12px; overflow: hidden; background: var(--van-white); border-radius: 8px; }
|
|
24
24
|
&__catalog-leaf { overflow: hidden; }
|
|
25
25
|
&__material-list { overflow: hidden; background: var(--van-white); border-radius: 8px; }
|
|
26
|
-
&
|
|
26
|
+
&__search-state { display: flex; align-items: center; justify-content: center; min-height: 160px; }
|
|
27
27
|
&__footer { position: relative; z-index: 2; flex: none; background: var(--van-white); box-shadow: 0 -2px 5px rgb(27 33 41 / 10%); .van-bottom-action-bar { box-shadow: none; } }
|
|
28
28
|
&__selected-panel { position: absolute; right: 0; bottom: 60px; left: 0; display: flex; flex-direction: column; max-height: 340px; overflow: hidden; background: var(--van-white); box-shadow: 0 -2px 5px rgb(27 33 41 / 10%); }
|
|
29
29
|
&__selected-header { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--van-padding-md) 4px; }
|
|
@@ -33,6 +33,7 @@ import "../../swipe-item/index.css";
|
|
|
33
33
|
import "../../material-detail/index.css";
|
|
34
34
|
import "../../tabs/index.css";
|
|
35
35
|
import "../../tab/index.css";
|
|
36
|
+
import "../../empty/index.css";
|
|
36
37
|
import "../../stepper/index.css";
|
|
37
38
|
import "../../material-action-bar/index.css";
|
|
38
39
|
import "../index.css";
|
|
@@ -33,6 +33,7 @@ import "../../swipe-item/index.less";
|
|
|
33
33
|
import "../../material-detail/index.less";
|
|
34
34
|
import "../../tabs/index.less";
|
|
35
35
|
import "../../tab/index.less";
|
|
36
|
+
import "../../empty/index.less";
|
|
36
37
|
import "../../stepper/index.less";
|
|
37
38
|
import "../../material-action-bar/index.less";
|
|
38
39
|
import "../index.less";
|
|
@@ -8,15 +8,16 @@ export declare type MaterialAddItem = {
|
|
|
8
8
|
category: string;
|
|
9
9
|
kind: 'material' | 'tool';
|
|
10
10
|
};
|
|
11
|
-
export declare type MaterialAddCategory = {
|
|
12
|
-
id: Numeric;
|
|
13
|
-
text: string;
|
|
14
|
-
kind: 'material' | 'tool';
|
|
15
|
-
categories: MaterialAddCategoryNode[];
|
|
16
|
-
};
|
|
17
11
|
export declare type MaterialAddCategoryNode = {
|
|
18
12
|
id?: Numeric;
|
|
19
13
|
value?: string;
|
|
20
14
|
text: string;
|
|
21
15
|
children?: MaterialAddCategoryNode[];
|
|
22
16
|
};
|
|
17
|
+
export declare type MaterialAddCategory = {
|
|
18
|
+
id: Numeric;
|
|
19
|
+
text: string;
|
|
20
|
+
kind: 'material' | 'tool';
|
|
21
|
+
categories: MaterialAddCategoryNode[];
|
|
22
|
+
};
|
|
23
|
+
export declare type MaterialAddSearch = (keyword: string) => void | Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import { type Numeric } from '../utils';
|
|
3
|
-
import { type TreeSelectItem } from '../tree-select';
|
|
4
|
-
import type { ObjectSelectSpecialty } from './types';
|
|
3
|
+
import { type TreeSelectItem, type TreeSelectLoadChildren } from '../tree-select';
|
|
4
|
+
import type { ObjectSelectSearch, ObjectSelectSpecialty } from './types';
|
|
5
5
|
declare const objectSelectProps: {
|
|
6
6
|
show: BooleanConstructor;
|
|
7
7
|
modelValue: {
|
|
@@ -24,6 +24,12 @@ declare const objectSelectProps: {
|
|
|
24
24
|
type: PropType<ObjectSelectSpecialty[]>;
|
|
25
25
|
default: () => ObjectSelectSpecialty[];
|
|
26
26
|
};
|
|
27
|
+
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
28
|
+
search: PropType<ObjectSelectSearch>;
|
|
29
|
+
searchDebounce: {
|
|
30
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
31
|
+
default: number;
|
|
32
|
+
};
|
|
27
33
|
};
|
|
28
34
|
export declare type ObjectSelectProps = ExtractPropTypes<typeof objectSelectProps>;
|
|
29
35
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -48,7 +54,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
54
|
type: PropType<ObjectSelectSpecialty[]>;
|
|
49
55
|
default: () => ObjectSelectSpecialty[];
|
|
50
56
|
};
|
|
51
|
-
|
|
57
|
+
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
58
|
+
search: PropType<ObjectSelectSearch>;
|
|
59
|
+
searchDebounce: {
|
|
60
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
61
|
+
default: number;
|
|
62
|
+
};
|
|
63
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue" | "load" | "update:show" | "confirm" | "load-error" | "search-error")[], "change" | "update:modelValue" | "load" | "update:show" | "confirm" | "load-error" | "search-error", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
52
64
|
show: BooleanConstructor;
|
|
53
65
|
modelValue: {
|
|
54
66
|
type: PropType<Numeric[]>;
|
|
@@ -70,16 +82,26 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
70
82
|
type: PropType<ObjectSelectSpecialty[]>;
|
|
71
83
|
default: () => ObjectSelectSpecialty[];
|
|
72
84
|
};
|
|
85
|
+
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
86
|
+
search: PropType<ObjectSelectSearch>;
|
|
87
|
+
searchDebounce: {
|
|
88
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
89
|
+
default: number;
|
|
90
|
+
};
|
|
73
91
|
}>> & {
|
|
74
92
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
93
|
+
onLoad?: ((...args: any[]) => any) | undefined;
|
|
75
94
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
76
95
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
77
96
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
97
|
+
"onLoad-error"?: ((...args: any[]) => any) | undefined;
|
|
98
|
+
"onSearch-error"?: ((...args: any[]) => any) | undefined;
|
|
78
99
|
}, {
|
|
79
100
|
title: string;
|
|
80
101
|
modelValue: Numeric[];
|
|
81
102
|
show: boolean;
|
|
82
103
|
confirmText: string;
|
|
104
|
+
searchDebounce: string | number;
|
|
83
105
|
spaceItems: TreeSelectItem[];
|
|
84
106
|
specialties: ObjectSelectSpecialty[];
|
|
85
107
|
}>;
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { computed, defineComponent, onBeforeUnmount, ref, shallowReactive, watch, createVNode as _createVNode, createTextVNode as _createTextVNode, Fragment as _Fragment } from "vue";
|
|
22
|
+
import { createNamespace, extend, makeArrayProp, makeNumericProp, makeStringProp } from "../utils/index.mjs";
|
|
3
23
|
import { ActionSheet } from "../action-sheet/index.mjs";
|
|
4
24
|
import { BlueMarkHeader } from "../blue-mark/index.mjs";
|
|
5
25
|
import { BottomActionBar } from "../bottom-action-bar/index.mjs";
|
|
6
26
|
import { Cell } from "../cell/index.mjs";
|
|
7
27
|
import { FilterTag } from "../filter-tag/index.mjs";
|
|
8
28
|
import { Icon } from "../icon/index.mjs";
|
|
29
|
+
import { Empty } from "../empty/index.mjs";
|
|
30
|
+
import { Loading } from "../loading/index.mjs";
|
|
9
31
|
import { NavBar } from "../nav-bar/index.mjs";
|
|
10
32
|
import { Search } from "../search/index.mjs";
|
|
11
33
|
import { Tab } from "../tab/index.mjs";
|
|
@@ -46,13 +68,7 @@ const spaceItems = [{
|
|
|
46
68
|
id: "high-voltage",
|
|
47
69
|
text: "\u9AD8\u538B\u8BA1\u91CF\u67DC",
|
|
48
70
|
selectable: false,
|
|
49
|
-
children: [
|
|
50
|
-
id: "metering-cabinet-1",
|
|
51
|
-
text: "B3_\u9AD8\u538B\u8BA1\u91CF\u67DC_1#"
|
|
52
|
-
}, {
|
|
53
|
-
id: "metering-cabinet-2",
|
|
54
|
-
text: "B3_\u9AD8\u538B\u8BA1\u91CF\u67DC_2#"
|
|
55
|
-
}]
|
|
71
|
+
children: []
|
|
56
72
|
}]
|
|
57
73
|
}, {
|
|
58
74
|
id: "chiller-room",
|
|
@@ -372,13 +388,16 @@ const objectSelectProps = {
|
|
|
372
388
|
specialties: {
|
|
373
389
|
type: Array,
|
|
374
390
|
default: () => specialties
|
|
375
|
-
}
|
|
391
|
+
},
|
|
392
|
+
loadChildren: Function,
|
|
393
|
+
search: Function,
|
|
394
|
+
searchDebounce: makeNumericProp(300)
|
|
376
395
|
};
|
|
377
396
|
const flattenItems = (items) => items.flatMap((item) => [item, ...item.children ? flattenItems(item.children) : []]);
|
|
378
397
|
var stdin_default = defineComponent({
|
|
379
398
|
name,
|
|
380
399
|
props: objectSelectProps,
|
|
381
|
-
emits: ["update:show", "update:modelValue", "change", "confirm"],
|
|
400
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error", "search-error"],
|
|
382
401
|
setup(props, {
|
|
383
402
|
emit
|
|
384
403
|
}) {
|
|
@@ -391,6 +410,20 @@ var stdin_default = defineComponent({
|
|
|
391
410
|
const expandedSelected = ref(false);
|
|
392
411
|
const searching = ref(false);
|
|
393
412
|
const keyword = ref("");
|
|
413
|
+
const asyncSearchResults = ref([]);
|
|
414
|
+
const searchLoading = ref(false);
|
|
415
|
+
const searchFailed = ref(false);
|
|
416
|
+
const searchedItems = shallowReactive(/* @__PURE__ */ new Map());
|
|
417
|
+
let searchTimer;
|
|
418
|
+
let searchRequestId = 0;
|
|
419
|
+
const loadedChildren = shallowReactive(/* @__PURE__ */ new Map());
|
|
420
|
+
const getChildren = (item) => loadedChildren.get(item.id) || item.children || [];
|
|
421
|
+
const hydrateItems = (items) => items.map((item) => {
|
|
422
|
+
const children = getChildren(item);
|
|
423
|
+
return children.length ? extend({}, item, {
|
|
424
|
+
children: hydrateItems(children)
|
|
425
|
+
}) : item;
|
|
426
|
+
});
|
|
394
427
|
const currentSpecialtyItems = (specialty) => specialtyType.value === 0 ? specialty.deviceItems : specialty.systemItems;
|
|
395
428
|
const expandOnlySpecialty = () => {
|
|
396
429
|
if (props.specialties.length === 1) {
|
|
@@ -404,6 +437,12 @@ var stdin_default = defineComponent({
|
|
|
404
437
|
view.value = 0;
|
|
405
438
|
specialtyType.value = 0;
|
|
406
439
|
keyword.value = "";
|
|
440
|
+
asyncSearchResults.value = [];
|
|
441
|
+
searchLoading.value = false;
|
|
442
|
+
searchFailed.value = false;
|
|
443
|
+
searchRequestId += 1;
|
|
444
|
+
if (searchTimer)
|
|
445
|
+
clearTimeout(searchTimer);
|
|
407
446
|
searching.value = false;
|
|
408
447
|
expandedSelected.value = false;
|
|
409
448
|
expandedSpecialties.value = {
|
|
@@ -415,14 +454,65 @@ var stdin_default = defineComponent({
|
|
|
415
454
|
immediate: true
|
|
416
455
|
});
|
|
417
456
|
const selected = computed(() => props.modelValue);
|
|
418
|
-
const allItems = computed(() => flattenItems([...props.spaceItems, ...props.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])]));
|
|
419
|
-
const selectedItems = computed(() =>
|
|
457
|
+
const allItems = computed(() => flattenItems(hydrateItems([...props.spaceItems, ...props.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])])));
|
|
458
|
+
const selectedItems = computed(() => {
|
|
459
|
+
const items = /* @__PURE__ */ new Map();
|
|
460
|
+
allItems.value.forEach((item) => items.set(item.id, item));
|
|
461
|
+
searchedItems.forEach((item) => items.set(item.id, item));
|
|
462
|
+
return selected.value.flatMap((id) => {
|
|
463
|
+
const item = items.get(id);
|
|
464
|
+
return item ? [item] : [];
|
|
465
|
+
});
|
|
466
|
+
});
|
|
420
467
|
const searchResults = computed(() => {
|
|
421
468
|
const query = keyword.value.trim().toLowerCase();
|
|
422
469
|
if (!query)
|
|
423
470
|
return [];
|
|
471
|
+
if (props.search)
|
|
472
|
+
return asyncSearchResults.value;
|
|
424
473
|
return allItems.value.filter((item) => item.text.toLowerCase().includes(query));
|
|
425
474
|
});
|
|
475
|
+
const runSearch = (..._0) => __async(this, [..._0], function* (query = keyword.value.trim()) {
|
|
476
|
+
if (!props.search || !query)
|
|
477
|
+
return;
|
|
478
|
+
const requestId = ++searchRequestId;
|
|
479
|
+
searchLoading.value = true;
|
|
480
|
+
searchFailed.value = false;
|
|
481
|
+
try {
|
|
482
|
+
const results = yield props.search(query);
|
|
483
|
+
if (requestId !== searchRequestId)
|
|
484
|
+
return;
|
|
485
|
+
asyncSearchResults.value = results;
|
|
486
|
+
results.forEach((item) => searchedItems.set(item.id, item));
|
|
487
|
+
} catch (error) {
|
|
488
|
+
if (requestId !== searchRequestId)
|
|
489
|
+
return;
|
|
490
|
+
asyncSearchResults.value = [];
|
|
491
|
+
searchFailed.value = true;
|
|
492
|
+
emit("search-error", query, error);
|
|
493
|
+
} finally {
|
|
494
|
+
if (requestId === searchRequestId)
|
|
495
|
+
searchLoading.value = false;
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
const scheduleSearch = () => {
|
|
499
|
+
if (searchTimer)
|
|
500
|
+
clearTimeout(searchTimer);
|
|
501
|
+
searchRequestId += 1;
|
|
502
|
+
searchLoading.value = false;
|
|
503
|
+
searchFailed.value = false;
|
|
504
|
+
asyncSearchResults.value = [];
|
|
505
|
+
const query = keyword.value.trim();
|
|
506
|
+
if (!props.search || !query)
|
|
507
|
+
return;
|
|
508
|
+
searchTimer = setTimeout(runSearch, Number(props.searchDebounce));
|
|
509
|
+
};
|
|
510
|
+
watch([keyword, () => props.search], scheduleSearch);
|
|
511
|
+
onBeforeUnmount(() => {
|
|
512
|
+
searchRequestId += 1;
|
|
513
|
+
if (searchTimer)
|
|
514
|
+
clearTimeout(searchTimer);
|
|
515
|
+
});
|
|
426
516
|
const renderHighlightedText = (text) => {
|
|
427
517
|
const query = keyword.value.trim();
|
|
428
518
|
if (!query)
|
|
@@ -460,19 +550,29 @@ var stdin_default = defineComponent({
|
|
|
460
550
|
update([]);
|
|
461
551
|
expandedSelected.value = false;
|
|
462
552
|
};
|
|
553
|
+
const onLoad = (item, children) => {
|
|
554
|
+
loadedChildren.set(item.id, children);
|
|
555
|
+
emit("load", item, children);
|
|
556
|
+
};
|
|
557
|
+
const onLoadError = (item, error) => {
|
|
558
|
+
emit("load-error", item, error);
|
|
559
|
+
};
|
|
463
560
|
const renderTree = (items) => _createVNode("div", {
|
|
464
561
|
"class": bem("tree-card")
|
|
465
562
|
}, [_createVNode(TreeSelect, {
|
|
466
563
|
"modelValue": selected.value,
|
|
467
564
|
"expandedKeys": expandedKeys.value,
|
|
468
|
-
"items": items,
|
|
565
|
+
"items": hydrateItems(items),
|
|
469
566
|
"multiple": true,
|
|
470
567
|
"showParentSelect": true,
|
|
471
568
|
"cascade": false,
|
|
569
|
+
"loadChildren": props.loadChildren,
|
|
472
570
|
"onUpdate:modelValue": update,
|
|
473
571
|
"onUpdate:expandedKeys": (value) => {
|
|
474
572
|
expandedKeys.value = value;
|
|
475
|
-
}
|
|
573
|
+
},
|
|
574
|
+
"onLoad": onLoad,
|
|
575
|
+
"onLoad-error": onLoadError
|
|
476
576
|
}, null)]);
|
|
477
577
|
const renderSpecialty = (specialty) => {
|
|
478
578
|
var _a;
|
|
@@ -493,6 +593,45 @@ var stdin_default = defineComponent({
|
|
|
493
593
|
}, null), expanded && renderTree(items)]);
|
|
494
594
|
};
|
|
495
595
|
const close = () => emit("update:show", false);
|
|
596
|
+
const renderSearchContent = () => {
|
|
597
|
+
if (!keyword.value.trim())
|
|
598
|
+
return;
|
|
599
|
+
if (searchLoading.value) {
|
|
600
|
+
return _createVNode("div", {
|
|
601
|
+
"class": bem("search-state")
|
|
602
|
+
}, [_createVNode(Loading, {
|
|
603
|
+
"vertical": true
|
|
604
|
+
}, {
|
|
605
|
+
default: () => [_createTextVNode("\u52A0\u8F7D\u4E2D...")]
|
|
606
|
+
})]);
|
|
607
|
+
}
|
|
608
|
+
if (searchFailed.value) {
|
|
609
|
+
return _createVNode(Empty, {
|
|
610
|
+
"image": "network",
|
|
611
|
+
"description": "\u641C\u7D22\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"
|
|
612
|
+
}, null);
|
|
613
|
+
}
|
|
614
|
+
if (!searchResults.value.length) {
|
|
615
|
+
return _createVNode(Empty, {
|
|
616
|
+
"description": "\u6682\u65E0\u641C\u7D22\u7ED3\u679C"
|
|
617
|
+
}, null);
|
|
618
|
+
}
|
|
619
|
+
return _createVNode("div", {
|
|
620
|
+
"class": bem("tree-card", {
|
|
621
|
+
search: true
|
|
622
|
+
})
|
|
623
|
+
}, [searchResults.value.map((item) => _createVNode(Cell, {
|
|
624
|
+
"key": item.id,
|
|
625
|
+
"rightSelect": selected.value.includes(item.id),
|
|
626
|
+
"selectType": "checkbox",
|
|
627
|
+
"border": true,
|
|
628
|
+
"clickable": true,
|
|
629
|
+
"onClick": () => toggleSearchItem(item),
|
|
630
|
+
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
631
|
+
}, {
|
|
632
|
+
title: () => renderHighlightedText(item.text)
|
|
633
|
+
}))]);
|
|
634
|
+
};
|
|
496
635
|
return () => _createVNode(ActionSheet, {
|
|
497
636
|
"show": props.show,
|
|
498
637
|
"class": bem(),
|
|
@@ -503,10 +642,18 @@ var stdin_default = defineComponent({
|
|
|
503
642
|
"modelValue": keyword.value,
|
|
504
643
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
505
644
|
"class": bem("search"),
|
|
645
|
+
"variant": "pure",
|
|
506
646
|
"shape": "round",
|
|
507
647
|
"inputAlign": "left",
|
|
508
648
|
"autofocus": true,
|
|
509
649
|
"placeholder": "\u641C\u7D22\u5BF9\u8C61",
|
|
650
|
+
"onSearch": () => {
|
|
651
|
+
if (props.search) {
|
|
652
|
+
if (searchTimer)
|
|
653
|
+
clearTimeout(searchTimer);
|
|
654
|
+
runSearch();
|
|
655
|
+
}
|
|
656
|
+
},
|
|
510
657
|
"onCancel": () => {
|
|
511
658
|
searching.value = false;
|
|
512
659
|
keyword.value = "";
|
|
@@ -545,21 +692,7 @@ var stdin_default = defineComponent({
|
|
|
545
692
|
}, null)]
|
|
546
693
|
})]), _createVNode("div", {
|
|
547
694
|
"class": bem("body")
|
|
548
|
-
}, [searching.value ?
|
|
549
|
-
"class": bem("tree-card", {
|
|
550
|
-
search: true
|
|
551
|
-
})
|
|
552
|
-
}, [searchResults.value.map((item) => _createVNode(Cell, {
|
|
553
|
-
"key": item.id,
|
|
554
|
-
"rightSelect": selected.value.includes(item.id),
|
|
555
|
-
"selectType": "checkbox",
|
|
556
|
-
"border": true,
|
|
557
|
-
"clickable": true,
|
|
558
|
-
"onClick": () => toggleSearchItem(item),
|
|
559
|
-
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
560
|
-
}, {
|
|
561
|
-
title: () => renderHighlightedText(item.text)
|
|
562
|
-
}))]) : view.value === 0 ? renderTree(props.spaceItems) : _createVNode(_Fragment, null, [_createVNode("div", {
|
|
695
|
+
}, [searching.value ? renderSearchContent() : view.value === 0 ? renderTree(props.spaceItems) : _createVNode(_Fragment, null, [_createVNode("div", {
|
|
563
696
|
"class": bem("type-tabs")
|
|
564
697
|
}, [_createVNode(FilterTag, {
|
|
565
698
|
"selected": specialtyType.value === 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.van-object-select{display:flex;flex-direction:column;height:calc(100vh - 96px);max-height:calc(100vh - 96px);overflow:hidden;background:var(--van-gray-2)}.van-object-select>.van-action-sheet__content{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0;gap:0;padding:0;overflow:hidden}.van-object-select__nav{flex:none;align-self:stretch;box-sizing:border-box;width:100%;min-width:0;max-width:100%;overflow:hidden;--van-nav-bar-background-color: var(--van-gray-2)}.van-object-select__nav.van-nav-bar,.van-object-select__nav .van-nav-bar__content{box-sizing:border-box;width:100%;min-width:0;max-width:100%;overflow:hidden}.van-object-select__nav .van-nav-bar__right--slot{display:flex;gap:12px;padding-right:var(--van-padding-md)}.van-object-select__nav .van-nav-bar__left--slot{left:var(--van-padding-md)}.van-object-select__search{flex:none;padding:8px var(--van-padding-md);--van-search-padding: 0;--van-search-background-color: var(--van-gray-2);--van-search-content-background-color: var(--van-white)}.van-object-select__search .van-search__field{padding-left:0}.van-object-select__keyword{color:var(--van-primary-color)}.van-object-select__view-tabs{flex:none;padding-left:8px;background:transparent;--van-tabs-line-height: 44px;--van-tab-font-size: var(--van-font-size-md);--van-tabs-nav-background-color: transparent;--van-tabs-bottom-bar-width: 40px}.van-object-select__view-tabs .van-tabs__nav{background:transparent}.van-object-select__body{flex:1;min-height:0;padding:12px var(--van-padding-md);overflow-y:auto}.van-object-select__tree-card{overflow:hidden;background:var(--van-white);border-radius:8px}.van-object-select__tree-card--search{margin-top:0}.van-object-select__type-tabs{display:flex;gap:8px;margin-bottom:12px;--van-filter-tag-background-color: var(--van-gray-4)}.van-object-select__type-tabs .van-filter-tag{width:80px}.van-object-select__specialty{margin-bottom:12px}.van-object-select__specialty .van-blue-mark-header{padding:0 4px 8px}.van-object-select__footer{position:relative;flex:none;background:var(--van-white);box-shadow:0 -2px 5px rgba(27,33,41,.1)}.van-object-select__footer .van-bottom-action-bar{box-shadow:none}.van-object-select__selected-panel{position:absolute;right:0;bottom:60px;left:0;display:flex;flex-direction:column;max-height:min(340px,calc(100vh - 156px));overflow:hidden;background:var(--van-white);box-shadow:0 -2px 5px rgba(27,33,41,.1)}.van-object-select__selected-header{display:flex;flex:none;align-items:center;justify-content:space-between;padding:12px var(--van-padding-md) 4px}.van-object-select__clear,.van-object-select__collapse{display:inline-flex;align-items:center;padding:0;font:inherit;font-size:var(--van-font-size-md);line-height:var(--van-line-height-lg);background:transparent;border:0}.van-object-select__clear{color:var(--van-primary-color)}.van-object-select__collapse,.van-object-select__remove,.van-object-select__collapse .van-icon,.van-object-select__remove .van-icon{color:var(--van-gray-6)}.van-object-select__collapse{gap:2px}.van-object-select__selected-list{display:flex;flex:0 1 auto;flex-direction:column;gap:6px;min-height:0;padding:var(--van-padding-xs) var(--van-padding-md);overflow-y:auto;overscroll-behavior:contain}.van-object-select__selected-item{flex:none;min-height:44px;padding:11px var(--van-padding-md);background:var(--van-gray-1);border-radius:8px}.van-object-select__remove{display:inline-flex;align-self:flex-start;align-items:center;justify-content:center;width:22px;height:22px;padding:0;background:transparent;border:0}
|
|
1
|
+
.van-object-select{display:flex;flex-direction:column;height:calc(100vh - 96px);max-height:calc(100vh - 96px);overflow:hidden;background:var(--van-gray-2)}.van-object-select>.van-action-sheet__content{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0;gap:0;padding:0;overflow:hidden}.van-object-select__nav{flex:none;align-self:stretch;box-sizing:border-box;width:100%;min-width:0;max-width:100%;overflow:hidden;--van-nav-bar-background-color: var(--van-gray-2)}.van-object-select__nav.van-nav-bar,.van-object-select__nav .van-nav-bar__content{box-sizing:border-box;width:100%;min-width:0;max-width:100%;overflow:hidden}.van-object-select__nav .van-nav-bar__right--slot{display:flex;gap:12px;padding-right:var(--van-padding-md)}.van-object-select__nav .van-nav-bar__left--slot{left:var(--van-padding-md)}.van-object-select__search{flex:none;padding:8px var(--van-padding-md);--van-search-padding: 0;--van-search-background-color: var(--van-gray-2);--van-search-content-background-color: var(--van-white)}.van-object-select__search .van-search__field{padding-left:0}.van-object-select__keyword{color:var(--van-primary-color)}.van-object-select__view-tabs{flex:none;padding-left:8px;background:transparent;--van-tabs-line-height: 44px;--van-tab-font-size: var(--van-font-size-md);--van-tabs-nav-background-color: transparent;--van-tabs-bottom-bar-width: 40px}.van-object-select__view-tabs .van-tabs__nav{background:transparent}.van-object-select__body{flex:1;min-height:0;padding:12px var(--van-padding-md);overflow-y:auto}.van-object-select__tree-card{overflow:hidden;background:var(--van-white);border-radius:8px}.van-object-select__tree-card--search{margin-top:0}.van-object-select__search-state{display:flex;align-items:center;justify-content:center;min-height:160px}.van-object-select__type-tabs{display:flex;gap:8px;margin-bottom:12px;--van-filter-tag-background-color: var(--van-gray-4)}.van-object-select__type-tabs .van-filter-tag{width:80px}.van-object-select__specialty{margin-bottom:12px}.van-object-select__specialty .van-blue-mark-header{padding:0 4px 8px}.van-object-select__footer{position:relative;flex:none;background:var(--van-white);box-shadow:0 -2px 5px rgba(27,33,41,.1)}.van-object-select__footer .van-bottom-action-bar{box-shadow:none}.van-object-select__selected-panel{position:absolute;right:0;bottom:60px;left:0;display:flex;flex-direction:column;max-height:min(340px,calc(100vh - 156px));overflow:hidden;background:var(--van-white);box-shadow:0 -2px 5px rgba(27,33,41,.1)}.van-object-select__selected-header{display:flex;flex:none;align-items:center;justify-content:space-between;padding:12px var(--van-padding-md) 4px}.van-object-select__clear,.van-object-select__collapse{display:inline-flex;align-items:center;padding:0;font:inherit;font-size:var(--van-font-size-md);line-height:var(--van-line-height-lg);background:transparent;border:0}.van-object-select__clear{color:var(--van-primary-color)}.van-object-select__collapse,.van-object-select__remove,.van-object-select__collapse .van-icon,.van-object-select__remove .van-icon{color:var(--van-gray-6)}.van-object-select__collapse{gap:2px}.van-object-select__selected-list{display:flex;flex:0 1 auto;flex-direction:column;gap:6px;min-height:0;padding:var(--van-padding-xs) var(--van-padding-md);overflow-y:auto;overscroll-behavior:contain}.van-object-select__selected-item{flex:none;min-height:44px;padding:11px var(--van-padding-md);background:var(--van-gray-1);border-radius:8px}.van-object-select__remove{display:inline-flex;align-self:flex-start;align-items:center;justify-content:center;width:22px;height:22px;padding:0;background:transparent;border:0}
|
|
@@ -20,7 +20,13 @@ export declare const ObjectSelect: import("../utils").WithInstall<import("vue").
|
|
|
20
20
|
type: import("vue").PropType<import("./types").ObjectSelectSpecialty[]>;
|
|
21
21
|
default: () => import("./types").ObjectSelectSpecialty[];
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
loadChildren: import("vue").PropType<import("..").TreeSelectLoadChildren>;
|
|
24
|
+
search: import("vue").PropType<import("./types").ObjectSelectSearch>;
|
|
25
|
+
searchDebounce: {
|
|
26
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
27
|
+
default: number;
|
|
28
|
+
};
|
|
29
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue" | "load" | "update:show" | "confirm" | "load-error" | "search-error")[], "change" | "update:modelValue" | "load" | "update:show" | "confirm" | "load-error" | "search-error", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
30
|
show: BooleanConstructor;
|
|
25
31
|
modelValue: {
|
|
26
32
|
type: import("vue").PropType<import("../utils").Numeric[]>;
|
|
@@ -42,22 +48,32 @@ export declare const ObjectSelect: import("../utils").WithInstall<import("vue").
|
|
|
42
48
|
type: import("vue").PropType<import("./types").ObjectSelectSpecialty[]>;
|
|
43
49
|
default: () => import("./types").ObjectSelectSpecialty[];
|
|
44
50
|
};
|
|
51
|
+
loadChildren: import("vue").PropType<import("..").TreeSelectLoadChildren>;
|
|
52
|
+
search: import("vue").PropType<import("./types").ObjectSelectSearch>;
|
|
53
|
+
searchDebounce: {
|
|
54
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
55
|
+
default: number;
|
|
56
|
+
};
|
|
45
57
|
}>> & {
|
|
46
58
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
59
|
+
onLoad?: ((...args: any[]) => any) | undefined;
|
|
47
60
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
48
61
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
49
62
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
63
|
+
"onLoad-error"?: ((...args: any[]) => any) | undefined;
|
|
64
|
+
"onSearch-error"?: ((...args: any[]) => any) | undefined;
|
|
50
65
|
}, {
|
|
51
66
|
title: string;
|
|
52
67
|
modelValue: import("../utils").Numeric[];
|
|
53
68
|
show: boolean;
|
|
54
69
|
confirmText: string;
|
|
70
|
+
searchDebounce: string | number;
|
|
55
71
|
spaceItems: import("..").TreeSelectItem[];
|
|
56
72
|
specialties: import("./types").ObjectSelectSpecialty[];
|
|
57
73
|
}>>;
|
|
58
74
|
export default ObjectSelect;
|
|
59
75
|
export type { ObjectSelectProps } from './ObjectSelect';
|
|
60
|
-
export type { ObjectSelectSpecialty, ObjectSelectTree, ObjectSelectValue } from './types';
|
|
76
|
+
export type { ObjectSelectSearch, ObjectSelectSpecialty, ObjectSelectTree, ObjectSelectValue, } from './types';
|
|
61
77
|
declare module 'vue' {
|
|
62
78
|
interface GlobalComponents {
|
|
63
79
|
VanObjectSelect: typeof ObjectSelect;
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
&__body { flex: 1; min-height: 0; padding: 12px var(--van-padding-md); overflow-y: auto; }
|
|
53
53
|
&__tree-card { overflow: hidden; background: var(--van-white); border-radius: 8px; }
|
|
54
54
|
&__tree-card--search { margin-top: 0; }
|
|
55
|
+
&__search-state { display: flex; align-items: center; justify-content: center; min-height: 160px; }
|
|
55
56
|
&__type-tabs {
|
|
56
57
|
display: flex;
|
|
57
58
|
gap: 8px;
|
|
@@ -2,6 +2,7 @@ import type { Numeric } from '../utils';
|
|
|
2
2
|
import type { TreeSelectItem } from '../tree-select';
|
|
3
3
|
export declare type ObjectSelectTree = TreeSelectItem;
|
|
4
4
|
export declare type ObjectSelectValue = Numeric[];
|
|
5
|
+
export declare type ObjectSelectSearch = (keyword: string) => ObjectSelectTree[] | Promise<ObjectSelectTree[]>;
|
|
5
6
|
export declare type ObjectSelectSpecialty = {
|
|
6
7
|
id: string;
|
|
7
8
|
name: string;
|
|
@@ -8,6 +8,7 @@ export declare type TreeSelectItem = {
|
|
|
8
8
|
selectable?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare type TreeSelectChild = TreeSelectItem;
|
|
11
|
+
export declare type TreeSelectLoadChildren = (item: TreeSelectItem) => TreeSelectItem[] | Promise<TreeSelectItem[]>;
|
|
11
12
|
declare const treeSelectProps: {
|
|
12
13
|
items: {
|
|
13
14
|
type: PropType<TreeSelectItem[]>;
|
|
@@ -30,6 +31,7 @@ declare const treeSelectProps: {
|
|
|
30
31
|
type: BooleanConstructor;
|
|
31
32
|
default: true;
|
|
32
33
|
};
|
|
34
|
+
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
33
35
|
};
|
|
34
36
|
export declare type TreeSelectProps = ExtractPropTypes<typeof treeSelectProps>;
|
|
35
37
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -54,7 +56,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
54
56
|
type: BooleanConstructor;
|
|
55
57
|
default: true;
|
|
56
58
|
};
|
|
57
|
-
|
|
59
|
+
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
60
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "update:modelValue" | "load" | "update:expandedKeys" | "expand" | "load-error")[], "select" | "update:modelValue" | "load" | "update:expandedKeys" | "expand" | "load-error", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
58
61
|
items: {
|
|
59
62
|
type: PropType<TreeSelectItem[]>;
|
|
60
63
|
default: () => never[];
|
|
@@ -76,11 +79,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
76
79
|
type: BooleanConstructor;
|
|
77
80
|
default: true;
|
|
78
81
|
};
|
|
82
|
+
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
79
83
|
}>> & {
|
|
84
|
+
onLoad?: ((...args: any[]) => any) | undefined;
|
|
80
85
|
onSelect?: ((...args: any[]) => any) | undefined;
|
|
81
86
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
82
87
|
"onUpdate:expandedKeys"?: ((...args: any[]) => any) | undefined;
|
|
83
88
|
onExpand?: ((...args: any[]) => any) | undefined;
|
|
89
|
+
"onLoad-error"?: ((...args: any[]) => any) | undefined;
|
|
84
90
|
}, {
|
|
85
91
|
modelValue: Numeric[];
|
|
86
92
|
multiple: boolean;
|