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