@ebfe/vant-kit 0.0.1 → 0.0.3

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 (62) hide show
  1. package/es/field-multi-picker/README.md +97 -0
  2. package/es/field-multi-picker/index-sfc.less +3 -0
  3. package/es/field-multi-picker/index.ts +139 -0
  4. package/es/field-single-picker/README.md +94 -0
  5. package/es/field-single-picker/index-sfc.less +3 -0
  6. package/es/field-single-picker/index.ts +158 -0
  7. package/es/index.js +12 -5
  8. package/es/multi-picker/README.md +183 -0
  9. package/es/multi-picker/index-sfc.less +20 -0
  10. package/es/multi-picker/index.ts +399 -0
  11. package/es/single-picker/README.md +239 -0
  12. package/es/single-picker/index-sfc.less +1 -1
  13. package/es/single-picker/index.ts +253 -0
  14. package/lib/field-multi-picker/README.md +97 -0
  15. package/lib/field-multi-picker/index-sfc.less +3 -0
  16. package/lib/field-multi-picker/index.ts +139 -0
  17. package/lib/field-single-picker/README.md +94 -0
  18. package/lib/field-single-picker/index-sfc.less +3 -0
  19. package/lib/field-single-picker/index.ts +158 -0
  20. package/lib/index.js +13 -46
  21. package/lib/multi-picker/README.md +183 -0
  22. package/lib/multi-picker/index-sfc.less +20 -0
  23. package/lib/multi-picker/index.ts +399 -0
  24. package/lib/single-picker/README.md +239 -0
  25. package/lib/single-picker/index-sfc.less +1 -1
  26. package/lib/single-picker/index.ts +253 -0
  27. package/package.json +4 -4
  28. package/es/demo-button/index-sfc.css +0 -9
  29. package/es/demo-button/index-sfc.less +0 -9
  30. package/es/demo-button/index.d.ts +0 -44
  31. package/es/demo-button/index.js +0 -52
  32. package/es/index.d.ts +0 -10
  33. package/es/single-picker/index-sfc.css +0 -4
  34. package/es/single-picker/index.d.ts +0 -623
  35. package/es/single-picker/index.js +0 -249
  36. package/lib/demo-button/index-sfc.css +0 -9
  37. package/lib/demo-button/index-sfc.less +0 -9
  38. package/lib/demo-button/index.d.ts +0 -44
  39. package/lib/demo-button/index.js +0 -76
  40. package/lib/ebfe-vant-kit.cjs.js +0 -301
  41. package/lib/ebfe-vant-kit.es.js +0 -312
  42. package/lib/ebfe-vant-kit.js +0 -18216
  43. package/lib/ebfe-vant-kit.min.js +0 -13064
  44. package/lib/index.d.ts +0 -10
  45. package/lib/single-picker/index-sfc.css +0 -4
  46. package/lib/single-picker/index.d.ts +0 -623
  47. package/lib/single-picker/index.js +0 -261
  48. package/lib/single-picker/style/less.d.ts +0 -0
  49. package/lib/style.css +0 -7107
  50. package/lib/web-types.json +0 -35
  51. /package/es/{demo-button → field-multi-picker}/style/index.js +0 -0
  52. /package/es/{demo-button → field-multi-picker}/style/less.js +0 -0
  53. /package/{lib/demo-button → es/field-single-picker}/style/index.js +0 -0
  54. /package/{lib/demo-button → es/field-single-picker}/style/less.js +0 -0
  55. /package/es/{demo-button/style/index.d.ts → multi-picker/style/index.js} +0 -0
  56. /package/es/{demo-button/style/less.d.ts → multi-picker/style/less.js} +0 -0
  57. /package/{es/single-picker/style/index.d.ts → lib/field-multi-picker/style/index.js} +0 -0
  58. /package/{es/single-picker/style/less.d.ts → lib/field-multi-picker/style/less.js} +0 -0
  59. /package/lib/{demo-button/style/index.d.ts → field-single-picker/style/index.js} +0 -0
  60. /package/lib/{demo-button/style/less.d.ts → field-single-picker/style/less.js} +0 -0
  61. /package/lib/{index.css → multi-picker/style/index.js} +0 -0
  62. /package/lib/{single-picker/style/index.d.ts → multi-picker/style/less.js} +0 -0
@@ -1,249 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) =>
8
- key in obj
9
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
10
- : (obj[key] = value);
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import './index-sfc.css';
21
- import { defineComponent as _defineComponent } from 'vue';
22
- import { computed, watch } from 'vue';
23
- import { debounce } from 'lodash';
24
- import { Popup as VanPopup, Picker as VanPicker, Search as VanSearch } from 'vant';
25
- import { useWrapperRef } from 'ebfe-vhooks';
26
- import { array2Single } from 'ebfe-utils';
27
- const __default__ = {
28
- name: 'SinglePicker',
29
- };
30
- const __vue_sfc__ = /* @__PURE__ */ _defineComponent(
31
- __spreadProps(__spreadValues({}, __default__), {
32
- props: {
33
- showSearch: { type: Boolean, required: false, default: false },
34
- modelValue: { type: null, required: true },
35
- pickerProps: { type: Object, required: true },
36
- },
37
- emits: ['search', 'confirm', 'update:modelValue'],
38
- setup(__props, { expose: __expose, emit: __emit }) {
39
- const Props = __props;
40
- const columnsFieldNames = computed(() => {
41
- var _a, _b;
42
- return Object.assign(
43
- { text: 'label', value: 'value' },
44
- (_b = (_a = Props == null ? void 0 : Props.pickerProps) == null ? void 0 : _a.columnsFieldNames) != null
45
- ? _b
46
- : {}
47
- );
48
- });
49
- const computedPickerProps = computed(() => {
50
- var _a;
51
- return Object.assign((_a = Props == null ? void 0 : Props.pickerProps) != null ? _a : {}, {
52
- columnsFieldNames: columnsFieldNames.value,
53
- });
54
- });
55
- const Emitter = __emit;
56
- const [popupShow, setPopupShow] = useWrapperRef(false);
57
- const triggerPopupShow = () => {
58
- setPopupShow(true);
59
- };
60
- const [modelFieldValue, setModelFieldValue] = useWrapperRef(Props.modelValue);
61
- watch(() => Props.modelValue, setModelFieldValue, { immediate: true });
62
- const updateModelFieldValue = (newValue) => {
63
- setModelFieldValue(newValue);
64
- Emitter('update:modelValue', newValue);
65
- };
66
- const [columnsIdMapDataCache, setColumnsIdMapDataCache] = useWrapperRef({});
67
- const patchColumnsIdMapDataCache = (columns) => {
68
- var _a;
69
- const newColumns = __spreadValues({}, (_a = columnsIdMapDataCache.value) != null ? _a : {});
70
- columns.forEach((item) => {
71
- const id = item[columnsFieldNames.value.value];
72
- newColumns[id] = item;
73
- });
74
- setColumnsIdMapDataCache(__spreadValues({}, newColumns));
75
- };
76
- watch(
77
- () => {
78
- var _a;
79
- return (_a = computedPickerProps.value) == null ? void 0 : _a.columns;
80
- },
81
- (columns) => {
82
- patchColumnsIdMapDataCache(columns != null ? columns : []);
83
- },
84
- { immediate: true }
85
- );
86
- const [selectedOption, setSelectedOption] = useWrapperRef('');
87
- watch(
88
- [modelFieldValue, columnsIdMapDataCache],
89
- ([newValue, columnsIdMapData]) => {
90
- setSelectedOption(columnsIdMapData == null ? void 0 : columnsIdMapData[newValue]);
91
- },
92
- { immediate: true }
93
- );
94
- const showValue = computed(() => {
95
- var _a;
96
- return (_a = selectedOption.value) == null ? void 0 : _a[columnsFieldNames.value.text];
97
- });
98
- const onConfirmPicker = (confirmInfo) => {
99
- var _a, _b, _c;
100
- const { selectedOptions, selectedValues } = confirmInfo;
101
- if ((_b = (_a = computedPickerProps.value) == null ? void 0 : _a.columns) == null ? void 0 : _b.length) {
102
- const option = array2Single(selectedOptions);
103
- Emitter('confirm', option);
104
- const newValue = option == null ? void 0 : option[columnsFieldNames.value.value];
105
- updateModelFieldValue(newValue);
106
- setPopupShow(false);
107
- } else {
108
- const selectedValue = array2Single(selectedValues);
109
- const option = (_c = columnsIdMapDataCache.value) == null ? void 0 : _c[selectedValue];
110
- Emitter('confirm', option);
111
- const newValue = option == null ? void 0 : option[columnsFieldNames.value.value];
112
- updateModelFieldValue(newValue);
113
- setPopupShow(false);
114
- }
115
- };
116
- const [keywords, _] = useWrapperRef(void 0);
117
- const onSearch = debounce((keywords2) => {
118
- Emitter('search', keywords2);
119
- }, 300);
120
- __expose({});
121
- const __returned__ = {
122
- Props,
123
- columnsFieldNames,
124
- computedPickerProps,
125
- Emitter,
126
- popupShow,
127
- setPopupShow,
128
- triggerPopupShow,
129
- modelFieldValue,
130
- setModelFieldValue,
131
- updateModelFieldValue,
132
- columnsIdMapDataCache,
133
- setColumnsIdMapDataCache,
134
- patchColumnsIdMapDataCache,
135
- selectedOption,
136
- setSelectedOption,
137
- showValue,
138
- onConfirmPicker,
139
- keywords,
140
- _,
141
- onSearch,
142
- get VanPopup() {
143
- return VanPopup;
144
- },
145
- get VanPicker() {
146
- return VanPicker;
147
- },
148
- get VanSearch() {
149
- return VanSearch;
150
- },
151
- };
152
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
153
- return __returned__;
154
- },
155
- })
156
- );
157
- import {
158
- renderSlot as _renderSlot,
159
- createCommentVNode as _createCommentVNode,
160
- normalizeProps as _normalizeProps,
161
- guardReactiveProps as _guardReactiveProps,
162
- openBlock as _openBlock,
163
- createBlock as _createBlock,
164
- mergeProps as _mergeProps,
165
- withCtx as _withCtx,
166
- renderList as _renderList,
167
- createSlots as _createSlots,
168
- createVNode as _createVNode,
169
- createElementBlock as _createElementBlock,
170
- } from 'vue';
171
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
172
- return (
173
- _openBlock(),
174
- _createElementBlock('div', null, [
175
- _renderSlot(_ctx.$slots, 'trigger', {
176
- triggerPopupShow: $setup.triggerPopupShow,
177
- showValue: $setup.showValue,
178
- selectedOption: $setup.selectedOption,
179
- }),
180
- _createVNode(
181
- $setup['VanPopup'],
182
- {
183
- show: $setup.popupShow,
184
- 'onUpdate:show': _cache[3] || (_cache[3] = ($event) => ($setup.popupShow = $event)),
185
- position: 'bottom',
186
- round: '',
187
- },
188
- {
189
- default: _withCtx(() => [
190
- _createVNode(
191
- $setup['VanPicker'],
192
- _mergeProps($setup.computedPickerProps, {
193
- onConfirm: _cache[1] || (_cache[1] = (value) => $setup.onConfirmPicker(value)),
194
- onCancel: _cache[2] || (_cache[2] = ($event) => $setup.setPopupShow(false)),
195
- }),
196
- _createSlots(
197
- {
198
- title: _withCtx(() => [
199
- $props.showSearch
200
- ? (_openBlock(),
201
- _createBlock(
202
- $setup['VanSearch'],
203
- {
204
- key: 0,
205
- shape: 'round',
206
- placeholder: '\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u8BCD',
207
- modelValue: $setup.keywords,
208
- 'onUpdate:modelValue': [
209
- _cache[0] || (_cache[0] = ($event) => ($setup.keywords = $event)),
210
- $setup.onSearch,
211
- ],
212
- },
213
- null,
214
- 8,
215
- ['modelValue', 'onUpdate:modelValue']
216
- ))
217
- : _createCommentVNode('v-if', true),
218
- ]),
219
- _: 2,
220
- /* DYNAMIC */
221
- },
222
- [
223
- _renderList(_ctx.$slots, (_slot, name) => {
224
- return {
225
- name,
226
- fn: _withCtx((slotData) => [
227
- _renderSlot(_ctx.$slots, name, _normalizeProps(_guardReactiveProps(slotData))),
228
- ]),
229
- };
230
- }),
231
- ]
232
- ),
233
- 1040
234
- /* FULL_PROPS, DYNAMIC_SLOTS */
235
- ),
236
- ]),
237
- _: 3,
238
- /* FORWARDED */
239
- },
240
- 8,
241
- ['show']
242
- ),
243
- ])
244
- );
245
- }
246
- __vue_sfc__.render = __vue_render__;
247
- __vue_sfc__.__scopeId = 'data-v-f2b42cbe';
248
- var stdin_default = __vue_sfc__;
249
- export { stdin_default as default };
@@ -1,9 +0,0 @@
1
- .demo-button[data-v-5ccde05a] {
2
- min-width: 120px;
3
- color: #fff;
4
- font-size: 16px;
5
- line-height: 36px;
6
- background-color: var(--5ccde05a-computedBgColor);
7
- border: none;
8
- border-radius: 30px;
9
- }
@@ -1,9 +0,0 @@
1
- .demo-button[data-v-5ccde05a] {
2
- min-width: 120px;
3
- color: #fff;
4
- font-size: 16px;
5
- line-height: 36px;
6
- background-color: var(--5ccde05a-computedBgColor);
7
- border: none;
8
- border-radius: 30px;
9
- }
@@ -1,44 +0,0 @@
1
- import './index-sfc.css';
2
- declare const __vue_sfc__: import('vue').DefineComponent<
3
- import('vue').ExtractPropTypes<{
4
- bgColor: {
5
- type: StringConstructor;
6
- required: false;
7
- default: string;
8
- };
9
- }>,
10
- {
11
- Props: any;
12
- computedBgColor: import('vue').ComputedRef<any>;
13
- },
14
- {},
15
- {},
16
- {},
17
- import('vue').ComponentOptionsMixin,
18
- import('vue').ComponentOptionsMixin,
19
- {},
20
- string,
21
- import('vue').PublicProps,
22
- Readonly<
23
- import('vue').ExtractPropTypes<{
24
- bgColor: {
25
- type: StringConstructor;
26
- required: false;
27
- default: string;
28
- };
29
- }>
30
- > &
31
- Readonly<{}>,
32
- {
33
- bgColor: string;
34
- },
35
- {},
36
- {},
37
- {},
38
- string,
39
- import('vue').ComponentProvideOptions,
40
- true,
41
- {},
42
- any
43
- >;
44
- export default __vue_sfc__;
@@ -1,76 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) =>
10
- key in obj
11
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
12
- : (obj[key] = value);
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
- var __export = (target, all) => {
23
- for (var name in all) __defProp(target, name, { get: all[name], enumerable: true });
24
- };
25
- var __copyProps = (to, from, except, desc) => {
26
- if ((from && typeof from === 'object') || typeof from === 'function') {
27
- for (let key of __getOwnPropNames(from))
28
- if (!__hasOwnProp.call(to, key) && key !== except)
29
- __defProp(to, key, {
30
- get: () => from[key],
31
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
32
- });
33
- }
34
- return to;
35
- };
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, '__esModule', { value: true }), mod);
37
- var stdin_exports = {};
38
- __export(stdin_exports, {
39
- default: () => stdin_default,
40
- });
41
- module.exports = __toCommonJS(stdin_exports);
42
- var import_index_sfc = require('./index-sfc.css');
43
- var import_vue = require('vue');
44
- var import_vue2 = require('vue');
45
- var import_vue3 = require('vue');
46
- const __default__ = {
47
- name: 'DemoButton',
48
- };
49
- const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(
50
- __spreadProps(__spreadValues({}, __default__), {
51
- props: {
52
- bgColor: { type: String, required: false, default: '#f44' },
53
- },
54
- setup(__props, { expose: __expose }) {
55
- __expose();
56
- (0, import_vue.useCssVars)((_ctx) => ({
57
- '5ccde05a-computedBgColor': computedBgColor.value,
58
- }));
59
- const Props = __props;
60
- const computedBgColor = (0, import_vue2.computed)(() => Props.bgColor);
61
- const __returned__ = { Props, computedBgColor };
62
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
63
- return __returned__;
64
- },
65
- })
66
- );
67
- const _hoisted_1 = { class: 'demo-button' };
68
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
69
- return (
70
- (0, import_vue3.openBlock)(),
71
- (0, import_vue3.createElementBlock)('button', _hoisted_1, [(0, import_vue3.renderSlot)(_ctx.$slots, 'default')])
72
- );
73
- }
74
- __vue_sfc__.render = __vue_render__;
75
- __vue_sfc__.__scopeId = 'data-v-5ccde05a';
76
- var stdin_default = __vue_sfc__;
@@ -1,301 +0,0 @@
1
- 'use strict';
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
3
- const vue = require('vue');
4
- const lodash = require('lodash');
5
- const vant = require('vant');
6
- const ebfeVhooks = require('ebfe-vhooks');
7
- const ebfeUtils = require('ebfe-utils');
8
- var __defProp$1 = Object.defineProperty;
9
- var __defProps$1 = Object.defineProperties;
10
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
11
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
12
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
13
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
14
- var __defNormalProp$1 = (obj, key, value) =>
15
- key in obj
16
- ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value })
17
- : (obj[key] = value);
18
- var __spreadValues$1 = (a, b) => {
19
- for (var prop in b || (b = {})) if (__hasOwnProp$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]);
20
- if (__getOwnPropSymbols$1)
21
- for (var prop of __getOwnPropSymbols$1(b)) {
22
- if (__propIsEnum$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]);
23
- }
24
- return a;
25
- };
26
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
27
- const __default__$1 = {
28
- name: 'DemoButton',
29
- };
30
- const __vue_sfc__$1 = /* @__PURE__ */ vue.defineComponent(
31
- __spreadProps$1(__spreadValues$1({}, __default__$1), {
32
- props: {
33
- bgColor: { type: String, required: false, default: '#f44' },
34
- },
35
- setup(__props, { expose: __expose }) {
36
- __expose();
37
- vue.useCssVars((_ctx) => ({
38
- '5ccde05a-computedBgColor': computedBgColor.value,
39
- }));
40
- const Props = __props;
41
- const computedBgColor = vue.computed(() => Props.bgColor);
42
- const __returned__ = { Props, computedBgColor };
43
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
44
- return __returned__;
45
- },
46
- })
47
- );
48
- const _hoisted_1 = { class: 'demo-button' };
49
- function __vue_render__$1(_ctx, _cache, $props, $setup, $data, $options) {
50
- return (vue.openBlock(), vue.createElementBlock('button', _hoisted_1, [vue.renderSlot(_ctx.$slots, 'default')]));
51
- }
52
- __vue_sfc__$1.render = __vue_render__$1;
53
- __vue_sfc__$1.__scopeId = 'data-v-5ccde05a';
54
- var stdin_default$2 = __vue_sfc__$1;
55
- var __defProp = Object.defineProperty;
56
- var __defProps = Object.defineProperties;
57
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
58
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
59
- var __hasOwnProp = Object.prototype.hasOwnProperty;
60
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
61
- var __defNormalProp = (obj, key, value) =>
62
- key in obj
63
- ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
64
- : (obj[key] = value);
65
- var __spreadValues = (a, b) => {
66
- for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
67
- if (__getOwnPropSymbols)
68
- for (var prop of __getOwnPropSymbols(b)) {
69
- if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
70
- }
71
- return a;
72
- };
73
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
74
- const __default__ = {
75
- name: 'SinglePicker',
76
- };
77
- const __vue_sfc__ = /* @__PURE__ */ vue.defineComponent(
78
- __spreadProps(__spreadValues({}, __default__), {
79
- props: {
80
- showSearch: { type: Boolean, required: false, default: false },
81
- modelValue: { type: null, required: true },
82
- pickerProps: { type: Object, required: true },
83
- },
84
- emits: ['search', 'confirm', 'update:modelValue'],
85
- setup(__props, { expose: __expose, emit: __emit }) {
86
- const Props = __props;
87
- const columnsFieldNames = vue.computed(() => {
88
- var _a, _b;
89
- return Object.assign(
90
- { text: 'label', value: 'value' },
91
- (_b = (_a = Props == null ? void 0 : Props.pickerProps) == null ? void 0 : _a.columnsFieldNames) != null
92
- ? _b
93
- : {}
94
- );
95
- });
96
- const computedPickerProps = vue.computed(() => {
97
- var _a;
98
- return Object.assign((_a = Props == null ? void 0 : Props.pickerProps) != null ? _a : {}, {
99
- columnsFieldNames: columnsFieldNames.value,
100
- });
101
- });
102
- const Emitter = __emit;
103
- const [popupShow, setPopupShow] = ebfeVhooks.useWrapperRef(false);
104
- const triggerPopupShow = () => {
105
- setPopupShow(true);
106
- };
107
- const [modelFieldValue, setModelFieldValue] = ebfeVhooks.useWrapperRef(Props.modelValue);
108
- vue.watch(() => Props.modelValue, setModelFieldValue, { immediate: true });
109
- const updateModelFieldValue = (newValue) => {
110
- setModelFieldValue(newValue);
111
- Emitter('update:modelValue', newValue);
112
- };
113
- const [columnsIdMapDataCache, setColumnsIdMapDataCache] = ebfeVhooks.useWrapperRef({});
114
- const patchColumnsIdMapDataCache = (columns) => {
115
- var _a;
116
- const newColumns = __spreadValues({}, (_a = columnsIdMapDataCache.value) != null ? _a : {});
117
- columns.forEach((item) => {
118
- const id = item[columnsFieldNames.value.value];
119
- newColumns[id] = item;
120
- });
121
- setColumnsIdMapDataCache(__spreadValues({}, newColumns));
122
- };
123
- vue.watch(
124
- () => {
125
- var _a;
126
- return (_a = computedPickerProps.value) == null ? void 0 : _a.columns;
127
- },
128
- (columns) => {
129
- patchColumnsIdMapDataCache(columns != null ? columns : []);
130
- },
131
- { immediate: true }
132
- );
133
- const [selectedOption, setSelectedOption] = ebfeVhooks.useWrapperRef('');
134
- vue.watch(
135
- [modelFieldValue, columnsIdMapDataCache],
136
- ([newValue, columnsIdMapData]) => {
137
- setSelectedOption(columnsIdMapData == null ? void 0 : columnsIdMapData[newValue]);
138
- },
139
- { immediate: true }
140
- );
141
- const showValue = vue.computed(() => {
142
- var _a;
143
- return (_a = selectedOption.value) == null ? void 0 : _a[columnsFieldNames.value.text];
144
- });
145
- const onConfirmPicker = (confirmInfo) => {
146
- var _a, _b, _c;
147
- const { selectedOptions, selectedValues } = confirmInfo;
148
- if ((_b = (_a = computedPickerProps.value) == null ? void 0 : _a.columns) == null ? void 0 : _b.length) {
149
- const option = ebfeUtils.array2Single(selectedOptions);
150
- Emitter('confirm', option);
151
- const newValue = option == null ? void 0 : option[columnsFieldNames.value.value];
152
- updateModelFieldValue(newValue);
153
- setPopupShow(false);
154
- } else {
155
- const selectedValue = ebfeUtils.array2Single(selectedValues);
156
- const option = (_c = columnsIdMapDataCache.value) == null ? void 0 : _c[selectedValue];
157
- Emitter('confirm', option);
158
- const newValue = option == null ? void 0 : option[columnsFieldNames.value.value];
159
- updateModelFieldValue(newValue);
160
- setPopupShow(false);
161
- }
162
- };
163
- const [keywords, _] = ebfeVhooks.useWrapperRef(void 0);
164
- const onSearch = lodash.debounce((keywords2) => {
165
- Emitter('search', keywords2);
166
- }, 300);
167
- __expose({});
168
- const __returned__ = {
169
- Props,
170
- columnsFieldNames,
171
- computedPickerProps,
172
- Emitter,
173
- popupShow,
174
- setPopupShow,
175
- triggerPopupShow,
176
- modelFieldValue,
177
- setModelFieldValue,
178
- updateModelFieldValue,
179
- columnsIdMapDataCache,
180
- setColumnsIdMapDataCache,
181
- patchColumnsIdMapDataCache,
182
- selectedOption,
183
- setSelectedOption,
184
- showValue,
185
- onConfirmPicker,
186
- keywords,
187
- _,
188
- onSearch,
189
- get VanPopup() {
190
- return vant.Popup;
191
- },
192
- get VanPicker() {
193
- return vant.Picker;
194
- },
195
- get VanSearch() {
196
- return vant.Search;
197
- },
198
- };
199
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
200
- return __returned__;
201
- },
202
- })
203
- );
204
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
205
- return (
206
- vue.openBlock(),
207
- vue.createElementBlock('div', null, [
208
- vue.renderSlot(_ctx.$slots, 'trigger', {
209
- triggerPopupShow: $setup.triggerPopupShow,
210
- showValue: $setup.showValue,
211
- selectedOption: $setup.selectedOption,
212
- }),
213
- vue.createVNode(
214
- $setup['VanPopup'],
215
- {
216
- show: $setup.popupShow,
217
- 'onUpdate:show': _cache[3] || (_cache[3] = ($event) => ($setup.popupShow = $event)),
218
- position: 'bottom',
219
- round: '',
220
- },
221
- {
222
- default: vue.withCtx(() => [
223
- vue.createVNode(
224
- $setup['VanPicker'],
225
- vue.mergeProps($setup.computedPickerProps, {
226
- onConfirm: _cache[1] || (_cache[1] = (value) => $setup.onConfirmPicker(value)),
227
- onCancel: _cache[2] || (_cache[2] = ($event) => $setup.setPopupShow(false)),
228
- }),
229
- vue.createSlots(
230
- {
231
- title: vue.withCtx(() => [
232
- $props.showSearch
233
- ? (vue.openBlock(),
234
- vue.createBlock(
235
- $setup['VanSearch'],
236
- {
237
- key: 0,
238
- shape: 'round',
239
- placeholder: '请输入搜索关键词',
240
- modelValue: $setup.keywords,
241
- 'onUpdate:modelValue': [
242
- _cache[0] || (_cache[0] = ($event) => ($setup.keywords = $event)),
243
- $setup.onSearch,
244
- ],
245
- },
246
- null,
247
- 8,
248
- ['modelValue', 'onUpdate:modelValue']
249
- ))
250
- : vue.createCommentVNode('v-if', true),
251
- ]),
252
- _: 2,
253
- /* DYNAMIC */
254
- },
255
- [
256
- vue.renderList(_ctx.$slots, (_slot, name) => {
257
- return {
258
- name,
259
- fn: vue.withCtx((slotData) => [
260
- vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotData))),
261
- ]),
262
- };
263
- }),
264
- ]
265
- ),
266
- 1040
267
- /* FULL_PROPS, DYNAMIC_SLOTS */
268
- ),
269
- ]),
270
- _: 3,
271
- /* FORWARDED */
272
- },
273
- 8,
274
- ['show']
275
- ),
276
- ])
277
- );
278
- }
279
- __vue_sfc__.render = __vue_render__;
280
- __vue_sfc__.__scopeId = 'data-v-f2b42cbe';
281
- var stdin_default$1 = __vue_sfc__;
282
- const version = '0.0.0';
283
- function install(app) {
284
- const components = [stdin_default$2, stdin_default$1];
285
- components.forEach((item) => {
286
- if (item.install) {
287
- app.use(item);
288
- } else if (item.name) {
289
- app.component(item.name, item);
290
- }
291
- });
292
- }
293
- var stdin_default = {
294
- install,
295
- version,
296
- };
297
- exports.DemoButton = stdin_default$2;
298
- exports.SinglePicker = stdin_default$1;
299
- exports.default = stdin_default;
300
- exports.install = install;
301
- exports.version = version;