@ebfe/vant-kit 0.0.3 → 0.0.4

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.
Files changed (55) hide show
  1. package/dist/ColoringAvatar/ColoringAvatar.vue.d.ts +16 -0
  2. package/dist/FieldMultiPicker/FieldMultiPicker.vue.d.ts +126 -0
  3. package/dist/FieldSinglePicker/FieldSinglePicker.vue.d.ts +32 -0
  4. package/dist/MultiPicker/MultiPicker.vue.d.ts +52 -0
  5. package/dist/SinglePicker/SinglePicker.vue.d.ts +37 -0
  6. package/dist/index.d.ts +8 -0
  7. package/dist/vant-kit.css +1 -0
  8. package/dist/vant-kit.es.js +14051 -0
  9. package/dist/vant-kit.umd.js +44 -0
  10. package/package.json +31 -32
  11. package/es/field-multi-picker/README.md +0 -97
  12. package/es/field-multi-picker/index-sfc.less +0 -3
  13. package/es/field-multi-picker/index.ts +0 -139
  14. package/es/field-multi-picker/style/index.js +0 -0
  15. package/es/field-multi-picker/style/less.js +0 -0
  16. package/es/field-single-picker/README.md +0 -94
  17. package/es/field-single-picker/index-sfc.less +0 -3
  18. package/es/field-single-picker/index.ts +0 -158
  19. package/es/field-single-picker/style/index.js +0 -0
  20. package/es/field-single-picker/style/less.js +0 -0
  21. package/es/index.js +0 -25
  22. package/es/multi-picker/README.md +0 -183
  23. package/es/multi-picker/index-sfc.less +0 -20
  24. package/es/multi-picker/index.ts +0 -399
  25. package/es/multi-picker/style/index.js +0 -0
  26. package/es/multi-picker/style/less.js +0 -0
  27. package/es/single-picker/README.md +0 -239
  28. package/es/single-picker/index-sfc.less +0 -4
  29. package/es/single-picker/index.ts +0 -253
  30. package/es/single-picker/style/index.js +0 -0
  31. package/es/single-picker/style/less.js +0 -0
  32. package/es/vue-sfc-shim.d.ts +0 -5
  33. package/lib/field-multi-picker/README.md +0 -97
  34. package/lib/field-multi-picker/index-sfc.less +0 -3
  35. package/lib/field-multi-picker/index.ts +0 -139
  36. package/lib/field-multi-picker/style/index.js +0 -0
  37. package/lib/field-multi-picker/style/less.js +0 -0
  38. package/lib/field-single-picker/README.md +0 -94
  39. package/lib/field-single-picker/index-sfc.less +0 -3
  40. package/lib/field-single-picker/index.ts +0 -158
  41. package/lib/field-single-picker/style/index.js +0 -0
  42. package/lib/field-single-picker/style/less.js +0 -0
  43. package/lib/index.js +0 -25
  44. package/lib/index.less +0 -0
  45. package/lib/multi-picker/README.md +0 -183
  46. package/lib/multi-picker/index-sfc.less +0 -20
  47. package/lib/multi-picker/index.ts +0 -399
  48. package/lib/multi-picker/style/index.js +0 -0
  49. package/lib/multi-picker/style/less.js +0 -0
  50. package/lib/single-picker/README.md +0 -239
  51. package/lib/single-picker/index-sfc.less +0 -4
  52. package/lib/single-picker/index.ts +0 -253
  53. package/lib/single-picker/style/index.js +0 -0
  54. package/lib/single-picker/style/less.js +0 -0
  55. package/lib/vue-sfc-shim.d.ts +0 -5
@@ -1,253 +0,0 @@
1
- // @ts-nocheck
2
- import './index-sfc.css';
3
- import { defineComponent as _defineComponent } from 'vue';
4
- import type { PickerColumn, PickerOption, PickerProps } from 'vant';
5
- import { computed, watch } from 'vue';
6
- import { debounce } from 'lodash';
7
- import { Popup as VanPopup, Picker as VanPicker, Search as VanSearch } from 'vant';
8
- import { useWrapperRef } from '@ebfe/vhooks';
9
- import { array2Single } from '@ebfe/utils';
10
-
11
- const __default__ = {
12
- name: 'SinglePicker',
13
- };
14
-
15
- export type TSinglePickerProps = {
16
- showSearch?: boolean;
17
- searchDelay?: number;
18
- modelValue: any;
19
- pickerProps: Partial<PickerProps>;
20
- };
21
-
22
- export type TConfirmDisabledOptionPayload = {
23
- option: any;
24
- closePopup: () => void;
25
- };
26
-
27
- const __vue_sfc__ = /*@__PURE__*/ _defineComponent({
28
- ...__default__,
29
- props: {
30
- showSearch: { type: Boolean, required: false, default: false },
31
- searchDelay: { type: Number, required: false, default: 300 },
32
- modelValue: { type: null, required: true },
33
- pickerProps: { type: Object, required: true },
34
- },
35
- emits: ['search', 'confirm', 'confirmDisabledOption', 'update:modelValue'],
36
- setup(__props: any, { expose: __expose, emit: __emit }) {
37
- const Props = __props;
38
-
39
- const columnsFieldNames = computed(() =>
40
- Object.assign({ text: 'label', value: 'value' }, Props?.pickerProps?.columnsFieldNames ?? {})
41
- );
42
- const computedPickerProps = computed(() =>
43
- Object.assign(Props?.pickerProps ?? {}, {
44
- columnsFieldNames: columnsFieldNames.value,
45
- })
46
- );
47
-
48
- const Emitter = __emit;
49
-
50
- const [popupShow, setPopupShow] = useWrapperRef<boolean>(false);
51
- const triggerPopupShow = () => {
52
- setPopupShow(true);
53
- };
54
-
55
- const [modelFieldValue, setModelFieldValue] = useWrapperRef<any>(Props.modelValue);
56
- watch(() => Props.modelValue, setModelFieldValue, { immediate: true });
57
- const updateModelFieldValue = (newValue) => {
58
- setModelFieldValue(newValue);
59
- // console.log('updateModelFieldValue');
60
- Emitter('update:modelValue', newValue);
61
- };
62
-
63
- /**
64
- * idMapData 缓存
65
- */
66
- const [columnsIdMapDataCache, setColumnsIdMapDataCache] = useWrapperRef<{
67
- string: (PickerOption | PickerColumn)[];
68
- }>({} as any);
69
- const patchColumnsIdMapDataCache = (columns: (PickerOption | PickerColumn)[]) => {
70
- const newColumns = { ...(columnsIdMapDataCache.value ?? {}) };
71
- columns.forEach((item) => {
72
- const id = item[columnsFieldNames.value.value];
73
- newColumns[id] = item;
74
- });
75
- setColumnsIdMapDataCache({ ...newColumns });
76
- };
77
- watch(
78
- () => computedPickerProps.value?.columns,
79
- (columns) => {
80
- patchColumnsIdMapDataCache(columns! ?? []);
81
- },
82
- { immediate: true }
83
- );
84
-
85
- /**
86
- * selectedOption
87
- */
88
- const [selectedOption, setSelectedOption] = useWrapperRef<string>('');
89
- watch(
90
- [modelFieldValue, columnsIdMapDataCache],
91
- ([newValue, columnsIdMapData]) => {
92
- setSelectedOption(columnsIdMapData?.[newValue]);
93
- },
94
- { immediate: true }
95
- );
96
- const showValue = computed(() => {
97
- return selectedOption.value?.[columnsFieldNames.value.text];
98
- });
99
-
100
- /**
101
- * 兼容搜索模式
102
- * 如果触发筛选后 columns 不存在,直接点击确认,则依旧选中上次选择的值(selectedValues 能够正确取到,而 selectedOptions 不行)
103
- */
104
- const onConfirmPicker = (confirmInfo) => {
105
- const { selectedOptions, selectedValues } = confirmInfo;
106
- let option;
107
- if (computedPickerProps.value?.columns?.length) {
108
- option = array2Single(selectedOptions);
109
- } else {
110
- const selectedValue = array2Single(selectedValues);
111
- option = columnsIdMapDataCache.value?.[selectedValue];
112
- }
113
- if (option.disabled) {
114
- Emitter('confirmDisabledOption', {
115
- option,
116
- closePopup: () => setPopupShow(false),
117
- });
118
- return;
119
- }
120
- Emitter('confirm', option);
121
- const newValue = option?.[columnsFieldNames.value.value];
122
- updateModelFieldValue(newValue);
123
- setPopupShow(false);
124
- };
125
-
126
- const [keywords, _] = useWrapperRef<string | undefined>(undefined);
127
-
128
- const onSearch = debounce((keywords: string) => {
129
- Emitter('search', keywords);
130
- }, Props.searchDelay);
131
-
132
- __expose({});
133
-
134
- const __returned__ = {
135
- Props,
136
- columnsFieldNames,
137
- computedPickerProps,
138
- Emitter,
139
- popupShow,
140
- setPopupShow,
141
- triggerPopupShow,
142
- modelFieldValue,
143
- setModelFieldValue,
144
- updateModelFieldValue,
145
- columnsIdMapDataCache,
146
- setColumnsIdMapDataCache,
147
- patchColumnsIdMapDataCache,
148
- selectedOption,
149
- setSelectedOption,
150
- showValue,
151
- onConfirmPicker,
152
- keywords,
153
- _,
154
- onSearch,
155
- get VanPopup() {
156
- return VanPopup;
157
- },
158
- get VanPicker() {
159
- return VanPicker;
160
- },
161
- get VanSearch() {
162
- return VanSearch;
163
- },
164
- };
165
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
166
- return __returned__;
167
- },
168
- });
169
- import {
170
- renderSlot as _renderSlot,
171
- createCommentVNode as _createCommentVNode,
172
- mergeProps as _mergeProps,
173
- createVNode as _createVNode,
174
- withCtx as _withCtx,
175
- renderList as _renderList,
176
- createSlots as _createSlots,
177
- openBlock as _openBlock,
178
- createElementBlock as _createElementBlock,
179
- } from 'vue';
180
-
181
- const _hoisted_1 = { class: 'single-picker' };
182
-
183
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
184
- return (
185
- _openBlock(),
186
- _createElementBlock('div', _hoisted_1, [
187
- _renderSlot(_ctx.$slots, 'trigger', {
188
- triggerPopupShow: $setup.triggerPopupShow,
189
- showValue: $setup.showValue,
190
- selectedOption: $setup.selectedOption,
191
- }),
192
- _createVNode(
193
- $setup['VanPopup'],
194
- {
195
- show: $setup.popupShow,
196
- 'onUpdate:show': _cache[3] || (_cache[3] = ($event) => ($setup.popupShow = $event)),
197
- position: 'bottom',
198
- round: '',
199
- },
200
- {
201
- default: _withCtx(() => [
202
- _createVNode(
203
- $setup['VanPicker'],
204
- _mergeProps($setup.computedPickerProps, {
205
- onConfirm: _cache[1] || (_cache[1] = (value) => $setup.onConfirmPicker(value)),
206
- onCancel: _cache[2] || (_cache[2] = ($event) => $setup.setPopupShow(false)),
207
- }),
208
- _createSlots({ _: 2 /* DYNAMIC */ }, [
209
- _renderList(_ctx.$slots, (_slot, name) => {
210
- return {
211
- name: name,
212
- fn: _withCtx((slotData) => [_renderSlot(_ctx.$slots, name, _mergeProps(slotData, { key: name }))]),
213
- };
214
- }),
215
- $props.showSearch
216
- ? {
217
- name: 'title',
218
- fn: _withCtx(() => [
219
- _createVNode(
220
- $setup['VanSearch'],
221
- {
222
- shape: 'round',
223
- placeholder: '请输入搜索关键词',
224
- modelValue: $setup.keywords,
225
- 'onUpdate:modelValue': [
226
- _cache[0] || (_cache[0] = ($event) => ($setup.keywords = $event)),
227
- $setup.onSearch,
228
- ],
229
- },
230
- null,
231
- 8 /* PROPS */,
232
- ['modelValue', 'onUpdate:modelValue']
233
- ),
234
- ]),
235
- key: '0',
236
- }
237
- : undefined,
238
- ]),
239
- 1040 /* FULL_PROPS, DYNAMIC_SLOTS */
240
- ),
241
- ]),
242
- _: 3 /* FORWARDED */,
243
- },
244
- 8 /* PROPS */,
245
- ['show']
246
- ),
247
- ])
248
- );
249
- }
250
- __vue_sfc__.render = __vue_render__;
251
-
252
- __vue_sfc__.__scopeId = 'data-v-03e3b57e';
253
- export default __vue_sfc__;
File without changes
File without changes
@@ -1,5 +0,0 @@
1
- declare module '*.vue' {
2
- import { DefineComponent } from 'vue';
3
- const Component: DefineComponent;
4
- export default Component;
5
- }