@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.
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 +3 -3
  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,261 +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_lodash = require('lodash');
46
- var import_vant = require('vant');
47
- var import_ebfe_vhooks = require('ebfe-vhooks');
48
- var import_ebfe_utils = require('ebfe-utils');
49
- var import_vue3 = require('vue');
50
- const __default__ = {
51
- name: 'SinglePicker',
52
- };
53
- const __vue_sfc__ = /* @__PURE__ */ (0, import_vue.defineComponent)(
54
- __spreadProps(__spreadValues({}, __default__), {
55
- props: {
56
- showSearch: { type: Boolean, required: false, default: false },
57
- modelValue: { type: null, required: true },
58
- pickerProps: { type: Object, required: true },
59
- },
60
- emits: ['search', 'confirm', 'update:modelValue'],
61
- setup(__props, { expose: __expose, emit: __emit }) {
62
- const Props = __props;
63
- const columnsFieldNames = (0, import_vue2.computed)(() => {
64
- var _a, _b;
65
- return Object.assign(
66
- { text: 'label', value: 'value' },
67
- (_b = (_a = Props == null ? void 0 : Props.pickerProps) == null ? void 0 : _a.columnsFieldNames) != null
68
- ? _b
69
- : {}
70
- );
71
- });
72
- const computedPickerProps = (0, import_vue2.computed)(() => {
73
- var _a;
74
- return Object.assign((_a = Props == null ? void 0 : Props.pickerProps) != null ? _a : {}, {
75
- columnsFieldNames: columnsFieldNames.value,
76
- });
77
- });
78
- const Emitter = __emit;
79
- const [popupShow, setPopupShow] = (0, import_ebfe_vhooks.useWrapperRef)(false);
80
- const triggerPopupShow = () => {
81
- setPopupShow(true);
82
- };
83
- const [modelFieldValue, setModelFieldValue] = (0, import_ebfe_vhooks.useWrapperRef)(Props.modelValue);
84
- (0, import_vue2.watch)(() => Props.modelValue, setModelFieldValue, { immediate: true });
85
- const updateModelFieldValue = (newValue) => {
86
- setModelFieldValue(newValue);
87
- Emitter('update:modelValue', newValue);
88
- };
89
- const [columnsIdMapDataCache, setColumnsIdMapDataCache] = (0, import_ebfe_vhooks.useWrapperRef)({});
90
- const patchColumnsIdMapDataCache = (columns) => {
91
- var _a;
92
- const newColumns = __spreadValues({}, (_a = columnsIdMapDataCache.value) != null ? _a : {});
93
- columns.forEach((item) => {
94
- const id = item[columnsFieldNames.value.value];
95
- newColumns[id] = item;
96
- });
97
- setColumnsIdMapDataCache(__spreadValues({}, newColumns));
98
- };
99
- (0, import_vue2.watch)(
100
- () => {
101
- var _a;
102
- return (_a = computedPickerProps.value) == null ? void 0 : _a.columns;
103
- },
104
- (columns) => {
105
- patchColumnsIdMapDataCache(columns != null ? columns : []);
106
- },
107
- { immediate: true }
108
- );
109
- const [selectedOption, setSelectedOption] = (0, import_ebfe_vhooks.useWrapperRef)('');
110
- (0, import_vue2.watch)(
111
- [modelFieldValue, columnsIdMapDataCache],
112
- ([newValue, columnsIdMapData]) => {
113
- setSelectedOption(columnsIdMapData == null ? void 0 : columnsIdMapData[newValue]);
114
- },
115
- { immediate: true }
116
- );
117
- const showValue = (0, import_vue2.computed)(() => {
118
- var _a;
119
- return (_a = selectedOption.value) == null ? void 0 : _a[columnsFieldNames.value.text];
120
- });
121
- const onConfirmPicker = (confirmInfo) => {
122
- var _a, _b, _c;
123
- const { selectedOptions, selectedValues } = confirmInfo;
124
- if ((_b = (_a = computedPickerProps.value) == null ? void 0 : _a.columns) == null ? void 0 : _b.length) {
125
- const option = (0, import_ebfe_utils.array2Single)(selectedOptions);
126
- Emitter('confirm', option);
127
- const newValue = option == null ? void 0 : option[columnsFieldNames.value.value];
128
- updateModelFieldValue(newValue);
129
- setPopupShow(false);
130
- } else {
131
- const selectedValue = (0, import_ebfe_utils.array2Single)(selectedValues);
132
- const option = (_c = columnsIdMapDataCache.value) == null ? void 0 : _c[selectedValue];
133
- Emitter('confirm', option);
134
- const newValue = option == null ? void 0 : option[columnsFieldNames.value.value];
135
- updateModelFieldValue(newValue);
136
- setPopupShow(false);
137
- }
138
- };
139
- const [keywords, _] = (0, import_ebfe_vhooks.useWrapperRef)(void 0);
140
- const onSearch = (0, import_lodash.debounce)((keywords2) => {
141
- Emitter('search', keywords2);
142
- }, 300);
143
- __expose({});
144
- const __returned__ = {
145
- Props,
146
- columnsFieldNames,
147
- computedPickerProps,
148
- Emitter,
149
- popupShow,
150
- setPopupShow,
151
- triggerPopupShow,
152
- modelFieldValue,
153
- setModelFieldValue,
154
- updateModelFieldValue,
155
- columnsIdMapDataCache,
156
- setColumnsIdMapDataCache,
157
- patchColumnsIdMapDataCache,
158
- selectedOption,
159
- setSelectedOption,
160
- showValue,
161
- onConfirmPicker,
162
- keywords,
163
- _,
164
- onSearch,
165
- get VanPopup() {
166
- return import_vant.Popup;
167
- },
168
- get VanPicker() {
169
- return import_vant.Picker;
170
- },
171
- get VanSearch() {
172
- return import_vant.Search;
173
- },
174
- };
175
- Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
176
- return __returned__;
177
- },
178
- })
179
- );
180
- function __vue_render__(_ctx, _cache, $props, $setup, $data, $options) {
181
- return (
182
- (0, import_vue3.openBlock)(),
183
- (0, import_vue3.createElementBlock)('div', null, [
184
- (0, import_vue3.renderSlot)(_ctx.$slots, 'trigger', {
185
- triggerPopupShow: $setup.triggerPopupShow,
186
- showValue: $setup.showValue,
187
- selectedOption: $setup.selectedOption,
188
- }),
189
- (0, import_vue3.createVNode)(
190
- $setup['VanPopup'],
191
- {
192
- show: $setup.popupShow,
193
- 'onUpdate:show': _cache[3] || (_cache[3] = ($event) => ($setup.popupShow = $event)),
194
- position: 'bottom',
195
- round: '',
196
- },
197
- {
198
- default: (0, import_vue3.withCtx)(() => [
199
- (0, import_vue3.createVNode)(
200
- $setup['VanPicker'],
201
- (0, import_vue3.mergeProps)($setup.computedPickerProps, {
202
- onConfirm: _cache[1] || (_cache[1] = (value) => $setup.onConfirmPicker(value)),
203
- onCancel: _cache[2] || (_cache[2] = ($event) => $setup.setPopupShow(false)),
204
- }),
205
- (0, import_vue3.createSlots)(
206
- {
207
- title: (0, import_vue3.withCtx)(() => [
208
- $props.showSearch
209
- ? ((0, import_vue3.openBlock)(),
210
- (0, import_vue3.createBlock)(
211
- $setup['VanSearch'],
212
- {
213
- key: 0,
214
- shape: 'round',
215
- placeholder: '\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u8BCD',
216
- modelValue: $setup.keywords,
217
- 'onUpdate:modelValue': [
218
- _cache[0] || (_cache[0] = ($event) => ($setup.keywords = $event)),
219
- $setup.onSearch,
220
- ],
221
- },
222
- null,
223
- 8,
224
- ['modelValue', 'onUpdate:modelValue']
225
- ))
226
- : (0, import_vue3.createCommentVNode)('v-if', true),
227
- ]),
228
- _: 2,
229
- /* DYNAMIC */
230
- },
231
- [
232
- (0, import_vue3.renderList)(_ctx.$slots, (_slot, name) => {
233
- return {
234
- name,
235
- fn: (0, import_vue3.withCtx)((slotData) => [
236
- (0, import_vue3.renderSlot)(
237
- _ctx.$slots,
238
- name,
239
- (0, import_vue3.normalizeProps)((0, import_vue3.guardReactiveProps)(slotData))
240
- ),
241
- ]),
242
- };
243
- }),
244
- ]
245
- ),
246
- 1040
247
- /* FULL_PROPS, DYNAMIC_SLOTS */
248
- ),
249
- ]),
250
- _: 3,
251
- /* FORWARDED */
252
- },
253
- 8,
254
- ['show']
255
- ),
256
- ])
257
- );
258
- }
259
- __vue_sfc__.render = __vue_render__;
260
- __vue_sfc__.__scopeId = 'data-v-f2b42cbe';
261
- var stdin_default = __vue_sfc__;
File without changes