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
|
@@ -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
3
|
import { type TreeSelectItem, type TreeSelectLoadChildren } from '../tree-select';
|
|
4
|
-
import type { ObjectSelectSpecialty } from './types';
|
|
4
|
+
import type { ObjectSelectSearch, ObjectSelectSpecialty } from './types';
|
|
5
5
|
declare const objectSelectProps: {
|
|
6
6
|
show: BooleanConstructor;
|
|
7
7
|
modelValue: {
|
|
@@ -25,6 +25,11 @@ declare const objectSelectProps: {
|
|
|
25
25
|
default: () => ObjectSelectSpecialty[];
|
|
26
26
|
};
|
|
27
27
|
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
28
|
+
search: PropType<ObjectSelectSearch>;
|
|
29
|
+
searchDebounce: {
|
|
30
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
31
|
+
default: number;
|
|
32
|
+
};
|
|
28
33
|
};
|
|
29
34
|
export declare type ObjectSelectProps = ExtractPropTypes<typeof objectSelectProps>;
|
|
30
35
|
declare const _default: import("vue").DefineComponent<{
|
|
@@ -50,7 +55,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
50
55
|
default: () => ObjectSelectSpecialty[];
|
|
51
56
|
};
|
|
52
57
|
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
53
|
-
|
|
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<{
|
|
54
64
|
show: BooleanConstructor;
|
|
55
65
|
modelValue: {
|
|
56
66
|
type: PropType<Numeric[]>;
|
|
@@ -73,6 +83,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
73
83
|
default: () => ObjectSelectSpecialty[];
|
|
74
84
|
};
|
|
75
85
|
loadChildren: PropType<TreeSelectLoadChildren>;
|
|
86
|
+
search: PropType<ObjectSelectSearch>;
|
|
87
|
+
searchDebounce: {
|
|
88
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
89
|
+
default: number;
|
|
90
|
+
};
|
|
76
91
|
}>> & {
|
|
77
92
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
78
93
|
onLoad?: ((...args: any[]) => any) | undefined;
|
|
@@ -80,11 +95,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
80
95
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
81
96
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
82
97
|
"onLoad-error"?: ((...args: any[]) => any) | undefined;
|
|
98
|
+
"onSearch-error"?: ((...args: any[]) => any) | undefined;
|
|
83
99
|
}, {
|
|
84
100
|
title: string;
|
|
85
101
|
modelValue: Numeric[];
|
|
86
102
|
show: boolean;
|
|
87
103
|
confirmText: string;
|
|
104
|
+
searchDebounce: string | number;
|
|
88
105
|
spaceItems: TreeSelectItem[];
|
|
89
106
|
specialties: ObjectSelectSpecialty[];
|
|
90
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";
|
|
@@ -367,13 +389,15 @@ const objectSelectProps = {
|
|
|
367
389
|
type: Array,
|
|
368
390
|
default: () => specialties
|
|
369
391
|
},
|
|
370
|
-
loadChildren: Function
|
|
392
|
+
loadChildren: Function,
|
|
393
|
+
search: Function,
|
|
394
|
+
searchDebounce: makeNumericProp(300)
|
|
371
395
|
};
|
|
372
396
|
const flattenItems = (items) => items.flatMap((item) => [item, ...item.children ? flattenItems(item.children) : []]);
|
|
373
397
|
var stdin_default = defineComponent({
|
|
374
398
|
name,
|
|
375
399
|
props: objectSelectProps,
|
|
376
|
-
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error"],
|
|
400
|
+
emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error", "search-error"],
|
|
377
401
|
setup(props, {
|
|
378
402
|
emit
|
|
379
403
|
}) {
|
|
@@ -386,6 +410,12 @@ var stdin_default = defineComponent({
|
|
|
386
410
|
const expandedSelected = ref(false);
|
|
387
411
|
const searching = ref(false);
|
|
388
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;
|
|
389
419
|
const loadedChildren = shallowReactive(/* @__PURE__ */ new Map());
|
|
390
420
|
const getChildren = (item) => loadedChildren.get(item.id) || item.children || [];
|
|
391
421
|
const hydrateItems = (items) => items.map((item) => {
|
|
@@ -407,6 +437,12 @@ var stdin_default = defineComponent({
|
|
|
407
437
|
view.value = 0;
|
|
408
438
|
specialtyType.value = 0;
|
|
409
439
|
keyword.value = "";
|
|
440
|
+
asyncSearchResults.value = [];
|
|
441
|
+
searchLoading.value = false;
|
|
442
|
+
searchFailed.value = false;
|
|
443
|
+
searchRequestId += 1;
|
|
444
|
+
if (searchTimer)
|
|
445
|
+
clearTimeout(searchTimer);
|
|
410
446
|
searching.value = false;
|
|
411
447
|
expandedSelected.value = false;
|
|
412
448
|
expandedSpecialties.value = {
|
|
@@ -419,13 +455,64 @@ var stdin_default = defineComponent({
|
|
|
419
455
|
});
|
|
420
456
|
const selected = computed(() => props.modelValue);
|
|
421
457
|
const allItems = computed(() => flattenItems(hydrateItems([...props.spaceItems, ...props.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])])));
|
|
422
|
-
const selectedItems = computed(() =>
|
|
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
|
+
});
|
|
423
467
|
const searchResults = computed(() => {
|
|
424
468
|
const query = keyword.value.trim().toLowerCase();
|
|
425
469
|
if (!query)
|
|
426
470
|
return [];
|
|
471
|
+
if (props.search)
|
|
472
|
+
return asyncSearchResults.value;
|
|
427
473
|
return allItems.value.filter((item) => item.text.toLowerCase().includes(query));
|
|
428
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
|
+
});
|
|
429
516
|
const renderHighlightedText = (text) => {
|
|
430
517
|
const query = keyword.value.trim();
|
|
431
518
|
if (!query)
|
|
@@ -506,6 +593,45 @@ var stdin_default = defineComponent({
|
|
|
506
593
|
}, null), expanded && renderTree(items)]);
|
|
507
594
|
};
|
|
508
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
|
+
};
|
|
509
635
|
return () => _createVNode(ActionSheet, {
|
|
510
636
|
"show": props.show,
|
|
511
637
|
"class": bem(),
|
|
@@ -516,10 +642,18 @@ var stdin_default = defineComponent({
|
|
|
516
642
|
"modelValue": keyword.value,
|
|
517
643
|
"onUpdate:modelValue": ($event) => keyword.value = $event,
|
|
518
644
|
"class": bem("search"),
|
|
645
|
+
"variant": "pure",
|
|
519
646
|
"shape": "round",
|
|
520
647
|
"inputAlign": "left",
|
|
521
648
|
"autofocus": true,
|
|
522
649
|
"placeholder": "\u641C\u7D22\u5BF9\u8C61",
|
|
650
|
+
"onSearch": () => {
|
|
651
|
+
if (props.search) {
|
|
652
|
+
if (searchTimer)
|
|
653
|
+
clearTimeout(searchTimer);
|
|
654
|
+
runSearch();
|
|
655
|
+
}
|
|
656
|
+
},
|
|
523
657
|
"onCancel": () => {
|
|
524
658
|
searching.value = false;
|
|
525
659
|
keyword.value = "";
|
|
@@ -558,21 +692,7 @@ var stdin_default = defineComponent({
|
|
|
558
692
|
}, null)]
|
|
559
693
|
})]), _createVNode("div", {
|
|
560
694
|
"class": bem("body")
|
|
561
|
-
}, [searching.value ?
|
|
562
|
-
"class": bem("tree-card", {
|
|
563
|
-
search: true
|
|
564
|
-
})
|
|
565
|
-
}, [searchResults.value.map((item) => _createVNode(Cell, {
|
|
566
|
-
"key": item.id,
|
|
567
|
-
"rightSelect": selected.value.includes(item.id),
|
|
568
|
-
"selectType": "checkbox",
|
|
569
|
-
"border": true,
|
|
570
|
-
"clickable": true,
|
|
571
|
-
"onClick": () => toggleSearchItem(item),
|
|
572
|
-
"onUpdate:rightSelect": () => toggleSearchItem(item)
|
|
573
|
-
}, {
|
|
574
|
-
title: () => renderHighlightedText(item.text)
|
|
575
|
-
}))]) : 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", {
|
|
576
696
|
"class": bem("type-tabs")
|
|
577
697
|
}, [_createVNode(FilterTag, {
|
|
578
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}
|
|
@@ -21,7 +21,12 @@ export declare const ObjectSelect: import("../utils").WithInstall<import("vue").
|
|
|
21
21
|
default: () => import("./types").ObjectSelectSpecialty[];
|
|
22
22
|
};
|
|
23
23
|
loadChildren: import("vue").PropType<import("..").TreeSelectLoadChildren>;
|
|
24
|
-
|
|
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<{
|
|
25
30
|
show: BooleanConstructor;
|
|
26
31
|
modelValue: {
|
|
27
32
|
type: import("vue").PropType<import("../utils").Numeric[]>;
|
|
@@ -44,6 +49,11 @@ export declare const ObjectSelect: import("../utils").WithInstall<import("vue").
|
|
|
44
49
|
default: () => import("./types").ObjectSelectSpecialty[];
|
|
45
50
|
};
|
|
46
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
|
+
};
|
|
47
57
|
}>> & {
|
|
48
58
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
49
59
|
onLoad?: ((...args: any[]) => any) | undefined;
|
|
@@ -51,17 +61,19 @@ export declare const ObjectSelect: import("../utils").WithInstall<import("vue").
|
|
|
51
61
|
"onUpdate:show"?: ((...args: any[]) => any) | undefined;
|
|
52
62
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
53
63
|
"onLoad-error"?: ((...args: any[]) => any) | undefined;
|
|
64
|
+
"onSearch-error"?: ((...args: any[]) => any) | undefined;
|
|
54
65
|
}, {
|
|
55
66
|
title: string;
|
|
56
67
|
modelValue: import("../utils").Numeric[];
|
|
57
68
|
show: boolean;
|
|
58
69
|
confirmText: string;
|
|
70
|
+
searchDebounce: string | number;
|
|
59
71
|
spaceItems: import("..").TreeSelectItem[];
|
|
60
72
|
specialties: import("./types").ObjectSelectSpecialty[];
|
|
61
73
|
}>>;
|
|
62
74
|
export default ObjectSelect;
|
|
63
75
|
export type { ObjectSelectProps } from './ObjectSelect';
|
|
64
|
-
export type { ObjectSelectSpecialty, ObjectSelectTree, ObjectSelectValue } from './types';
|
|
76
|
+
export type { ObjectSelectSearch, ObjectSelectSpecialty, ObjectSelectTree, ObjectSelectValue, } from './types';
|
|
65
77
|
declare module 'vue' {
|
|
66
78
|
interface GlobalComponents {
|
|
67
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;
|