@ebfe/vant-kit 0.0.1 → 0.0.2
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/field-multi-picker/README.md +97 -0
- package/es/field-multi-picker/index-sfc.less +3 -0
- package/es/field-multi-picker/index.ts +139 -0
- package/es/field-single-picker/README.md +94 -0
- package/es/field-single-picker/index-sfc.less +3 -0
- package/es/field-single-picker/index.ts +158 -0
- package/es/index.js +12 -5
- package/es/multi-picker/README.md +183 -0
- package/es/multi-picker/index-sfc.less +20 -0
- package/es/multi-picker/index.ts +399 -0
- package/es/single-picker/README.md +239 -0
- package/es/single-picker/index-sfc.less +1 -1
- package/es/single-picker/index.ts +253 -0
- package/lib/field-multi-picker/README.md +97 -0
- package/lib/field-multi-picker/index-sfc.less +3 -0
- package/lib/field-multi-picker/index.ts +139 -0
- package/lib/field-single-picker/README.md +94 -0
- package/lib/field-single-picker/index-sfc.less +3 -0
- package/lib/field-single-picker/index.ts +158 -0
- package/lib/index.js +13 -46
- package/lib/multi-picker/README.md +183 -0
- package/lib/multi-picker/index-sfc.less +20 -0
- package/lib/multi-picker/index.ts +399 -0
- package/lib/single-picker/README.md +239 -0
- package/lib/single-picker/index-sfc.less +1 -1
- package/lib/single-picker/index.ts +253 -0
- package/package.json +3 -3
- package/es/demo-button/index-sfc.css +0 -9
- package/es/demo-button/index-sfc.less +0 -9
- package/es/demo-button/index.d.ts +0 -44
- package/es/demo-button/index.js +0 -52
- package/es/index.d.ts +0 -10
- package/es/single-picker/index-sfc.css +0 -4
- package/es/single-picker/index.d.ts +0 -623
- package/es/single-picker/index.js +0 -249
- package/lib/demo-button/index-sfc.css +0 -9
- package/lib/demo-button/index-sfc.less +0 -9
- package/lib/demo-button/index.d.ts +0 -44
- package/lib/demo-button/index.js +0 -76
- package/lib/ebfe-vant-kit.cjs.js +0 -301
- package/lib/ebfe-vant-kit.es.js +0 -312
- package/lib/ebfe-vant-kit.js +0 -18216
- package/lib/ebfe-vant-kit.min.js +0 -13064
- package/lib/index.d.ts +0 -10
- package/lib/single-picker/index-sfc.css +0 -4
- package/lib/single-picker/index.d.ts +0 -623
- package/lib/single-picker/index.js +0 -261
- package/lib/single-picker/style/less.d.ts +0 -0
- package/lib/style.css +0 -7107
- package/lib/web-types.json +0 -35
- /package/es/{demo-button → field-multi-picker}/style/index.js +0 -0
- /package/es/{demo-button → field-multi-picker}/style/less.js +0 -0
- /package/{lib/demo-button → es/field-single-picker}/style/index.js +0 -0
- /package/{lib/demo-button → es/field-single-picker}/style/less.js +0 -0
- /package/es/{demo-button/style/index.d.ts → multi-picker/style/index.js} +0 -0
- /package/es/{demo-button/style/less.d.ts → multi-picker/style/less.js} +0 -0
- /package/{es/single-picker/style/index.d.ts → lib/field-multi-picker/style/index.js} +0 -0
- /package/{es/single-picker/style/less.d.ts → lib/field-multi-picker/style/less.js} +0 -0
- /package/lib/{demo-button/style/index.d.ts → field-single-picker/style/index.js} +0 -0
- /package/lib/{demo-button/style/less.d.ts → field-single-picker/style/less.js} +0 -0
- /package/lib/{index.css → multi-picker/style/index.js} +0 -0
- /package/lib/{single-picker/style/index.d.ts → multi-picker/style/less.js} +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# MultiPicker
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
主要基于 vant 的 Popup、CheckboxGroup 等组件进行二次封装,方便处理多项选择的需求场景。
|
|
6
|
+
|
|
7
|
+
**主要功能描述**
|
|
8
|
+
|
|
9
|
+
- 支持自定义触发器
|
|
10
|
+
- 支持开启搜索功能
|
|
11
|
+
- 自定义文本提示信息
|
|
12
|
+
|
|
13
|
+
**对开发者的解脱**
|
|
14
|
+
|
|
15
|
+
- 符合 ui 设计
|
|
16
|
+
- 打开收起逻辑的编写
|
|
17
|
+
- 对所选项的 `真实值`、`展示值` 的处理
|
|
18
|
+
- 基于上次选中的结果进行编辑后,点击取消,回滚上次选中的状态
|
|
19
|
+
|
|
20
|
+
## 代码演示
|
|
21
|
+
|
|
22
|
+
### 基础用法
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<template>
|
|
26
|
+
<MultiPicker
|
|
27
|
+
v-model="pickerValue"
|
|
28
|
+
:options="options"
|
|
29
|
+
:field-names="fieldNames"
|
|
30
|
+
title="基础用法"
|
|
31
|
+
tip-txt="💫这是一段提示文本: 你可以根据业务需要自行定制展示的内容"
|
|
32
|
+
>
|
|
33
|
+
<template #trigger="{ triggerPopupShow, showValue }">
|
|
34
|
+
<div class="trigger-box">
|
|
35
|
+
<van-button type="primary" @click="triggerPopupShow"> 点击打开多选-选择器🤪 </van-button>
|
|
36
|
+
<p>show value: {{ showValue }}</p>
|
|
37
|
+
<p>modelValue: {{ pickerValue }}</p>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
</MultiPicker>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { useWrapperRef } from '@ebfe/vhooks';
|
|
45
|
+
import MultiPicker from '../index.vue';
|
|
46
|
+
import { Button as VanButton } from 'vant';
|
|
47
|
+
|
|
48
|
+
const options = [
|
|
49
|
+
{ name: '选项1', value: '1' },
|
|
50
|
+
{ name: '选项2', value: '2', disabled: true },
|
|
51
|
+
{ name: '选项3', value: '3' },
|
|
52
|
+
];
|
|
53
|
+
const fieldNames = {
|
|
54
|
+
label: 'name',
|
|
55
|
+
value: 'value',
|
|
56
|
+
};
|
|
57
|
+
const [pickerValue, _setPickerValue] = useWrapperRef<string[]>([]);
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<style scoped lang="less">
|
|
61
|
+
.trigger-box {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
align-items: center;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 开启搜索功能
|
|
71
|
+
|
|
72
|
+
- 传入 show-earch 展示搜索框
|
|
73
|
+
- 侦听 search 事件处理搜索逻辑
|
|
74
|
+
|
|
75
|
+
> 💫 对交互细节的优化:如果在输入关键字进行搜索后,新的数据源为空,此时点击确定,更新的值依旧为最近一次选中的选项。
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<template>
|
|
79
|
+
<MultiPicker
|
|
80
|
+
v-model="pickerValue"
|
|
81
|
+
:options="options"
|
|
82
|
+
:field-names="fieldNames"
|
|
83
|
+
title="基础用法"
|
|
84
|
+
tip-txt="💫开启了搜索功能"
|
|
85
|
+
show-search
|
|
86
|
+
@search="onSearch"
|
|
87
|
+
>
|
|
88
|
+
<template #trigger="{ triggerPopupShow, showValue }">
|
|
89
|
+
<div class="trigger-box">
|
|
90
|
+
<van-button type="primary" @click="triggerPopupShow"> 带搜索框🔍 </van-button>
|
|
91
|
+
<p>show value: {{ showValue }}</p>
|
|
92
|
+
<p>modelValue: {{ pickerValue }}</p>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
</MultiPicker>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script setup lang="ts">
|
|
99
|
+
import { useWrapperRef } from '@ebfe/vhooks';
|
|
100
|
+
import MultiPicker from '../index.vue';
|
|
101
|
+
import { Button as VanButton } from 'vant';
|
|
102
|
+
import { checkStrIsEmpty } from '@ebfe/utils';
|
|
103
|
+
|
|
104
|
+
const optionsDataSource = [
|
|
105
|
+
{ name: '选项1', value: '1' },
|
|
106
|
+
{ name: '选项2', value: '2', disabled: true },
|
|
107
|
+
{ name: '选项3', value: '3' },
|
|
108
|
+
{ name: '选项4', value: '4', disabled: true },
|
|
109
|
+
{ name: '选项5', value: '5' },
|
|
110
|
+
{ name: '选项6', value: '6' },
|
|
111
|
+
{ name: '选项7', value: '7', disabled: true },
|
|
112
|
+
{ name: '选项8', value: '8' },
|
|
113
|
+
{ name: '选项9', value: '9' },
|
|
114
|
+
{ name: '选项10', value: '10' },
|
|
115
|
+
{ name: '选项11', value: '11', disabled: true },
|
|
116
|
+
{ name: '选项12', value: '12' },
|
|
117
|
+
{ name: '选项13', value: '13', disabled: true },
|
|
118
|
+
{ name: '选项14', value: '14' },
|
|
119
|
+
{ name: '选项15', value: '15' },
|
|
120
|
+
{ name: '选项16', value: '16', disabled: true },
|
|
121
|
+
{ name: '选项17', value: '17' },
|
|
122
|
+
{ name: '选项18', value: '18' },
|
|
123
|
+
{ name: '选项19', value: '19' },
|
|
124
|
+
{ name: '选项20', value: '20' },
|
|
125
|
+
];
|
|
126
|
+
const [options, setOptions] = useWrapperRef(optionsDataSource);
|
|
127
|
+
|
|
128
|
+
const fieldNames = {
|
|
129
|
+
label: 'name',
|
|
130
|
+
value: 'value',
|
|
131
|
+
};
|
|
132
|
+
const [pickerValue, _setPickerValue] = useWrapperRef<string[]>([]);
|
|
133
|
+
|
|
134
|
+
const onSearch = (keywords: string) => {
|
|
135
|
+
if (checkStrIsEmpty(keywords)) {
|
|
136
|
+
setOptions(optionsDataSource);
|
|
137
|
+
} else {
|
|
138
|
+
setOptions(
|
|
139
|
+
optionsDataSource.filter((item) => item.name.toLocaleLowerCase().includes(keywords.toLocaleLowerCase()))
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<style scoped lang="less">
|
|
146
|
+
.trigger-box {
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
align-items: center;
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## API
|
|
156
|
+
|
|
157
|
+
### Props
|
|
158
|
+
|
|
159
|
+
TMultiPickerProps
|
|
160
|
+
|
|
161
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
162
|
+
| ------------ | ------------------ | -------------------------------------------------------------------------------------- | ---------------------------------- |
|
|
163
|
+
| v-model | 当前选中项对应的值 | string[] | - |
|
|
164
|
+
| options | 选项 | Array<{ label: string; value: string; disabled?: boolean }> (label、value支持属性别名) | - |
|
|
165
|
+
| fieldNames | 字段别名 | { label?: string; value?: string; } | { label: 'label', value: 'value' } |
|
|
166
|
+
| title | 标题 | string | - |
|
|
167
|
+
| tipTxt | 文本提示信息 | string | - |
|
|
168
|
+
| show-search | 是否显示搜索框 | boolean | false |
|
|
169
|
+
| search-delay | 搜索防抖时间(ms) | number | 300 |
|
|
170
|
+
|
|
171
|
+
### Events
|
|
172
|
+
|
|
173
|
+
| 事件名 | 说明 | 回调参数 |
|
|
174
|
+
| :------------- | :----------------------------- | :------------------------------------------------------- |
|
|
175
|
+
| confirm | 点击确认后触发的事件 | TConfirmEventPayload = { values: any[]; options: any[] } |
|
|
176
|
+
| search | 在搜索框输入时,触发的搜索事件 | keywords |
|
|
177
|
+
| toggleCheckbox | 触发选中、取消选中时的事件 | values |
|
|
178
|
+
|
|
179
|
+
### Slots
|
|
180
|
+
|
|
181
|
+
| 名称 | 说明 | 参数 |
|
|
182
|
+
| :------ | :----- | :-------------------------------------------------------------------------------- |
|
|
183
|
+
| trigger | 触发器 | `{ trigger-popup-show: () => void; show-value: string; selected-options: any[] }` |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@import 'vant/lib/index.css';
|
|
2
|
+
[data-v-d088a892] .van-search {
|
|
3
|
+
width: 250px;
|
|
4
|
+
}
|
|
5
|
+
.multi-picker-main[data-v-d088a892] {
|
|
6
|
+
min-height: 200px;
|
|
7
|
+
max-height: 60vh;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
}
|
|
12
|
+
.multi-picker-main .multi-picker-tip[data-v-d088a892] {
|
|
13
|
+
padding: 10px 16px;
|
|
14
|
+
text-align: center;
|
|
15
|
+
font-size: 13px;
|
|
16
|
+
color: #666666;
|
|
17
|
+
}
|
|
18
|
+
.multi-picker-main .multi-picker-cell-group[data-v-d088a892] {
|
|
19
|
+
overflow-y: auto;
|
|
20
|
+
}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import './index-sfc.css';
|
|
3
|
+
import { defineComponent as _defineComponent } from 'vue';
|
|
4
|
+
import { computed, watch } from 'vue';
|
|
5
|
+
import { debounce } from 'lodash';
|
|
6
|
+
import {
|
|
7
|
+
Popup as VanPopup,
|
|
8
|
+
CheckboxGroup as VanCheckboxGroup,
|
|
9
|
+
CellGroup as VanCellGroup,
|
|
10
|
+
Cell as VanCell,
|
|
11
|
+
Checkbox as VanCheckbox,
|
|
12
|
+
Search as VanSearch,
|
|
13
|
+
} from 'vant';
|
|
14
|
+
import { useWrapperRef } from '@ebfe/vhooks';
|
|
15
|
+
|
|
16
|
+
import { ref } from 'vue';
|
|
17
|
+
|
|
18
|
+
const __default__ = {
|
|
19
|
+
name: 'MultiPicker',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type IdMapData = {
|
|
23
|
+
[key in string]: any;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type TFieldNames = {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type TMultiPickerProps = {
|
|
32
|
+
// ids
|
|
33
|
+
modelValue: any[];
|
|
34
|
+
// 选项列表
|
|
35
|
+
options: any[];
|
|
36
|
+
// 字段别名
|
|
37
|
+
fieldNames?: TFieldNames;
|
|
38
|
+
// title
|
|
39
|
+
title?: string;
|
|
40
|
+
// 提示信息
|
|
41
|
+
tipTxt?: string;
|
|
42
|
+
// 搜索功能
|
|
43
|
+
showSearch?: boolean;
|
|
44
|
+
searchDelay?: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type TConfirmEventPayload = { values: any[]; options: any[] };
|
|
48
|
+
|
|
49
|
+
const __vue_sfc__ = /*@__PURE__*/ _defineComponent({
|
|
50
|
+
...__default__,
|
|
51
|
+
props: {
|
|
52
|
+
modelValue: { type: Array, required: true },
|
|
53
|
+
options: { type: Array, required: true },
|
|
54
|
+
fieldNames: { type: Object, required: false, default: undefined },
|
|
55
|
+
title: { type: String, required: false, default: undefined },
|
|
56
|
+
tipTxt: { type: String, required: false, default: undefined },
|
|
57
|
+
showSearch: { type: Boolean, required: false, default: false },
|
|
58
|
+
searchDelay: { type: Number, required: false, default: 300 },
|
|
59
|
+
},
|
|
60
|
+
emits: ['search', 'toggleCheckbox', 'confirm', 'update:modelValue'],
|
|
61
|
+
setup(__props: any, { expose: __expose, emit: __emit }) {
|
|
62
|
+
const Props = __props;
|
|
63
|
+
|
|
64
|
+
const computedFieldNames = computed(() =>
|
|
65
|
+
Object.assign({ label: 'label', value: 'value' }, Props?.fieldNames ?? {})
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const Emitter = __emit;
|
|
69
|
+
|
|
70
|
+
const [popupShow, setPopupShow] = useWrapperRef<boolean>(false);
|
|
71
|
+
// 用于展示的选项值
|
|
72
|
+
const [showValue, setShowValue] = useWrapperRef<string>('');
|
|
73
|
+
// checkbox实时绑定的选项值
|
|
74
|
+
const [checkboxModelValue, setCheckboxModelValue] = useWrapperRef<any[]>([]);
|
|
75
|
+
watch(
|
|
76
|
+
Props.modelValue,
|
|
77
|
+
(newValue) => {
|
|
78
|
+
setCheckboxModelValue(newValue);
|
|
79
|
+
},
|
|
80
|
+
{ immediate: true }
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* value 映射的选项信息
|
|
85
|
+
*/
|
|
86
|
+
const genIdMapOptionData = (options: any[]): IdMapData => {
|
|
87
|
+
const res = {} as IdMapData;
|
|
88
|
+
options?.forEach?.((item) => {
|
|
89
|
+
res[item[computedFieldNames.value.value]] = item;
|
|
90
|
+
});
|
|
91
|
+
// console.log('genIdMapOptionData', res);
|
|
92
|
+
return res;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const [optionsIdMapData, _setOptionsIdMapData] = useWrapperRef<IdMapData>(genIdMapOptionData(Props.options));
|
|
96
|
+
const patchIdMapOptionData = (newOptions) => {
|
|
97
|
+
newOptions?.forEach?.((item) => {
|
|
98
|
+
optionsIdMapData[item[computedFieldNames.value.value]] = item;
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
watch(() => Props.options, patchIdMapOptionData, { immediate: true });
|
|
102
|
+
|
|
103
|
+
const [selectedOptions, setSelectedOptions] = useWrapperRef<any[]>([]);
|
|
104
|
+
const handleUpdateModelValue = (values: any[]) => {
|
|
105
|
+
Emitter('update:modelValue', values);
|
|
106
|
+
setSelectedOptions(values?.map?.((v) => optionsIdMapData.value?.[v]));
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 根据 modelValue 回显 showModelValue
|
|
111
|
+
*/
|
|
112
|
+
const updateShowModelValueByModelValue = () => {
|
|
113
|
+
setShowValue(
|
|
114
|
+
Props.modelValue
|
|
115
|
+
?.map?.((item) => optionsIdMapData.value?.[item]?.[computedFieldNames.value?.label])
|
|
116
|
+
?.join?.('、')
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
watch(
|
|
120
|
+
[optionsIdMapData, () => Props.modelValue],
|
|
121
|
+
() => {
|
|
122
|
+
updateShowModelValueByModelValue();
|
|
123
|
+
},
|
|
124
|
+
{ immediate: true }
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 打开 popup
|
|
129
|
+
*/
|
|
130
|
+
const triggerPopupShow = () => {
|
|
131
|
+
setPopupShow(true);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 点击取消
|
|
136
|
+
*/
|
|
137
|
+
const handleCancel = () => {
|
|
138
|
+
setPopupShow(false);
|
|
139
|
+
// checkbox选中状态回滚
|
|
140
|
+
setCheckboxModelValue(Props.modelValue);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* checkbox
|
|
145
|
+
*/
|
|
146
|
+
const checkboxRefs = ref([]);
|
|
147
|
+
const toggle = (item: any, index: number) => {
|
|
148
|
+
if (item?.disabled) return;
|
|
149
|
+
(checkboxRefs.value?.[index] as any)?.toggle?.();
|
|
150
|
+
Emitter('toggleCheckbox', checkboxModelValue.value);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 确认选择
|
|
155
|
+
*/
|
|
156
|
+
const onConfirm = () => {
|
|
157
|
+
const newValue = checkboxModelValue.value;
|
|
158
|
+
handleUpdateModelValue(newValue);
|
|
159
|
+
Emitter('confirm', { values: newValue, options: selectedOptions.value });
|
|
160
|
+
setPopupShow(false);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 搜索功能
|
|
165
|
+
*/
|
|
166
|
+
const [keywords, _] = useWrapperRef<string | undefined>(undefined);
|
|
167
|
+
|
|
168
|
+
const onSearch = debounce((keywords: string) => {
|
|
169
|
+
Emitter('search', keywords);
|
|
170
|
+
}, Props.searchDelay);
|
|
171
|
+
|
|
172
|
+
__expose({
|
|
173
|
+
getOptionsIdMapData() {
|
|
174
|
+
return optionsIdMapData.value;
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const __returned__ = {
|
|
179
|
+
Props,
|
|
180
|
+
computedFieldNames,
|
|
181
|
+
Emitter,
|
|
182
|
+
popupShow,
|
|
183
|
+
setPopupShow,
|
|
184
|
+
showValue,
|
|
185
|
+
setShowValue,
|
|
186
|
+
checkboxModelValue,
|
|
187
|
+
setCheckboxModelValue,
|
|
188
|
+
genIdMapOptionData,
|
|
189
|
+
optionsIdMapData,
|
|
190
|
+
_setOptionsIdMapData,
|
|
191
|
+
patchIdMapOptionData,
|
|
192
|
+
selectedOptions,
|
|
193
|
+
setSelectedOptions,
|
|
194
|
+
handleUpdateModelValue,
|
|
195
|
+
updateShowModelValueByModelValue,
|
|
196
|
+
triggerPopupShow,
|
|
197
|
+
handleCancel,
|
|
198
|
+
checkboxRefs,
|
|
199
|
+
toggle,
|
|
200
|
+
onConfirm,
|
|
201
|
+
keywords,
|
|
202
|
+
_,
|
|
203
|
+
onSearch,
|
|
204
|
+
get VanPopup() {
|
|
205
|
+
return VanPopup;
|
|
206
|
+
},
|
|
207
|
+
get VanCheckboxGroup() {
|
|
208
|
+
return VanCheckboxGroup;
|
|
209
|
+
},
|
|
210
|
+
get VanCellGroup() {
|
|
211
|
+
return VanCellGroup;
|
|
212
|
+
},
|
|
213
|
+
get VanCell() {
|
|
214
|
+
return VanCell;
|
|
215
|
+
},
|
|
216
|
+
get VanCheckbox() {
|
|
217
|
+
return VanCheckbox;
|
|
218
|
+
},
|
|
219
|
+
get VanSearch() {
|
|
220
|
+
return VanSearch;
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
|
|
224
|
+
return __returned__;
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
import {
|
|
228
|
+
renderSlot as _renderSlot,
|
|
229
|
+
normalizeClass as _normalizeClass,
|
|
230
|
+
createElementVNode as _createElementVNode,
|
|
231
|
+
createVNode as _createVNode,
|
|
232
|
+
openBlock as _openBlock,
|
|
233
|
+
createElementBlock as _createElementBlock,
|
|
234
|
+
createCommentVNode as _createCommentVNode,
|
|
235
|
+
toDisplayString as _toDisplayString,
|
|
236
|
+
renderList as _renderList,
|
|
237
|
+
Fragment as _Fragment,
|
|
238
|
+
withModifiers as _withModifiers,
|
|
239
|
+
withCtx as _withCtx,
|
|
240
|
+
createBlock as _createBlock,
|
|
241
|
+
} from 'vue';
|
|
242
|
+
|
|
243
|
+
const _hoisted_1 = { class: 'multi-picker' };
|
|
244
|
+
const _hoisted_2 = { class: 'multi-picker-header van-picker__toolbar' };
|
|
245
|
+
const _hoisted_3 = { key: 0 };
|
|
246
|
+
const _hoisted_4 = { class: 'van-picker__title van-ellipsis' };
|
|
247
|
+
const _hoisted_5 = { class: 'multi-picker-main' };
|
|
248
|
+
const _hoisted_6 = {
|
|
249
|
+
key: 0,
|
|
250
|
+
class: 'multi-picker-tip',
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
|
|
254
|
+
return (
|
|
255
|
+
_openBlock(),
|
|
256
|
+
_createElementBlock('div', _hoisted_1, [
|
|
257
|
+
_renderSlot(_ctx.$slots, 'trigger', {
|
|
258
|
+
triggerPopupShow: $setup.triggerPopupShow,
|
|
259
|
+
showValue: $setup.showValue,
|
|
260
|
+
selectedOptions: $setup.selectedOptions,
|
|
261
|
+
}),
|
|
262
|
+
_createVNode(
|
|
263
|
+
$setup['VanPopup'],
|
|
264
|
+
{
|
|
265
|
+
show: $setup.popupShow,
|
|
266
|
+
'onUpdate:show': _cache[2] || (_cache[2] = ($event) => ($setup.popupShow = $event)),
|
|
267
|
+
onClickOverlay: $setup.handleCancel,
|
|
268
|
+
position: 'bottom',
|
|
269
|
+
round: '',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
default: _withCtx(() => [
|
|
273
|
+
_createVNode(
|
|
274
|
+
$setup['VanCheckboxGroup'],
|
|
275
|
+
{
|
|
276
|
+
modelValue: $setup.checkboxModelValue,
|
|
277
|
+
'onUpdate:modelValue': _cache[1] || (_cache[1] = ($event) => ($setup.checkboxModelValue = $event)),
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
default: _withCtx(() => [
|
|
281
|
+
_createElementVNode('div', _hoisted_2, [
|
|
282
|
+
_createElementVNode(
|
|
283
|
+
'button',
|
|
284
|
+
{
|
|
285
|
+
class: _normalizeClass(['van-picker__cancel', 'van-haptics-feedback']),
|
|
286
|
+
onClick: $setup.handleCancel,
|
|
287
|
+
},
|
|
288
|
+
'取消'
|
|
289
|
+
),
|
|
290
|
+
$props.showSearch
|
|
291
|
+
? (_openBlock(),
|
|
292
|
+
_createElementBlock('div', _hoisted_3, [
|
|
293
|
+
_createVNode(
|
|
294
|
+
$setup['VanSearch'],
|
|
295
|
+
{
|
|
296
|
+
shape: 'round',
|
|
297
|
+
placeholder: '请输入搜索关键词',
|
|
298
|
+
modelValue: $setup.keywords,
|
|
299
|
+
'onUpdate:modelValue': [
|
|
300
|
+
_cache[0] || (_cache[0] = ($event) => ($setup.keywords = $event)),
|
|
301
|
+
$setup.onSearch,
|
|
302
|
+
],
|
|
303
|
+
},
|
|
304
|
+
null,
|
|
305
|
+
8 /* PROPS */,
|
|
306
|
+
['modelValue', 'onUpdate:modelValue']
|
|
307
|
+
),
|
|
308
|
+
]))
|
|
309
|
+
: _renderSlot(_ctx.$slots, 'title', { key: 1 }, () => [
|
|
310
|
+
_createElementVNode('div', _hoisted_4, _toDisplayString($props.title), 1 /* TEXT */),
|
|
311
|
+
]),
|
|
312
|
+
_createElementVNode(
|
|
313
|
+
'button',
|
|
314
|
+
{
|
|
315
|
+
class: _normalizeClass(['van-picker__confirm', 'van-haptics-feedback']),
|
|
316
|
+
onClick: $setup.onConfirm,
|
|
317
|
+
},
|
|
318
|
+
'确定'
|
|
319
|
+
),
|
|
320
|
+
]),
|
|
321
|
+
_createElementVNode('div', _hoisted_5, [
|
|
322
|
+
$props.tipTxt
|
|
323
|
+
? (_openBlock(),
|
|
324
|
+
_createElementBlock('div', _hoisted_6, _toDisplayString($props.tipTxt), 1 /* TEXT */))
|
|
325
|
+
: _createCommentVNode('v-if', true),
|
|
326
|
+
_createVNode(
|
|
327
|
+
$setup['VanCellGroup'],
|
|
328
|
+
{
|
|
329
|
+
class: 'multi-picker-cell-group',
|
|
330
|
+
inset: '',
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
default: _withCtx(() => [
|
|
334
|
+
(_openBlock(true),
|
|
335
|
+
_createElementBlock(
|
|
336
|
+
_Fragment,
|
|
337
|
+
null,
|
|
338
|
+
_renderList($props.options, (item, index) => {
|
|
339
|
+
return (
|
|
340
|
+
_openBlock(),
|
|
341
|
+
_createBlock(
|
|
342
|
+
$setup['VanCell'],
|
|
343
|
+
{
|
|
344
|
+
clickable: '',
|
|
345
|
+
key: item?.[$setup.computedFieldNames.value],
|
|
346
|
+
title: item?.[$setup.computedFieldNames.label],
|
|
347
|
+
onClick: ($event) => $setup.toggle(item, index),
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
'right-icon': _withCtx(() => [
|
|
351
|
+
_createVNode(
|
|
352
|
+
$setup['VanCheckbox'],
|
|
353
|
+
{
|
|
354
|
+
name: item?.[$setup.computedFieldNames.value],
|
|
355
|
+
disabled: item?.disabled,
|
|
356
|
+
ref_for: true,
|
|
357
|
+
ref: (el) => {
|
|
358
|
+
($setup.checkboxRefs as any)[index] = el;
|
|
359
|
+
},
|
|
360
|
+
onClick: _withModifiers(($event) => $setup.toggle(item, index), ['stop']),
|
|
361
|
+
},
|
|
362
|
+
null,
|
|
363
|
+
8 /* PROPS */,
|
|
364
|
+
['name', 'disabled', 'onClick']
|
|
365
|
+
),
|
|
366
|
+
]),
|
|
367
|
+
_: 2 /* DYNAMIC */,
|
|
368
|
+
},
|
|
369
|
+
1032 /* PROPS, DYNAMIC_SLOTS */,
|
|
370
|
+
['title', 'onClick']
|
|
371
|
+
)
|
|
372
|
+
);
|
|
373
|
+
}),
|
|
374
|
+
128 /* KEYED_FRAGMENT */
|
|
375
|
+
)),
|
|
376
|
+
]),
|
|
377
|
+
_: 1 /* STABLE */,
|
|
378
|
+
}
|
|
379
|
+
),
|
|
380
|
+
]),
|
|
381
|
+
]),
|
|
382
|
+
_: 3 /* FORWARDED */,
|
|
383
|
+
},
|
|
384
|
+
8 /* PROPS */,
|
|
385
|
+
['modelValue']
|
|
386
|
+
),
|
|
387
|
+
]),
|
|
388
|
+
_: 3 /* FORWARDED */,
|
|
389
|
+
},
|
|
390
|
+
8 /* PROPS */,
|
|
391
|
+
['show']
|
|
392
|
+
),
|
|
393
|
+
])
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
__vue_sfc__.render = __vue_render__;
|
|
397
|
+
|
|
398
|
+
__vue_sfc__.__scopeId = 'data-v-d088a892';
|
|
399
|
+
export default __vue_sfc__;
|