@ebfe/vant-kit 0.0.1

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 (48) hide show
  1. package/README.md +1 -0
  2. package/es/demo-button/index-sfc.css +9 -0
  3. package/es/demo-button/index-sfc.less +9 -0
  4. package/es/demo-button/index.d.ts +44 -0
  5. package/es/demo-button/index.js +52 -0
  6. package/es/demo-button/style/index.d.ts +0 -0
  7. package/es/demo-button/style/index.js +0 -0
  8. package/es/demo-button/style/less.d.ts +0 -0
  9. package/es/demo-button/style/less.js +0 -0
  10. package/es/index.d.ts +10 -0
  11. package/es/index.js +18 -0
  12. package/es/single-picker/index-sfc.css +4 -0
  13. package/es/single-picker/index-sfc.less +4 -0
  14. package/es/single-picker/index.d.ts +623 -0
  15. package/es/single-picker/index.js +249 -0
  16. package/es/single-picker/style/index.d.ts +0 -0
  17. package/es/single-picker/style/index.js +0 -0
  18. package/es/single-picker/style/less.d.ts +0 -0
  19. package/es/single-picker/style/less.js +0 -0
  20. package/es/vue-sfc-shim.d.ts +5 -0
  21. package/lib/demo-button/index-sfc.css +9 -0
  22. package/lib/demo-button/index-sfc.less +9 -0
  23. package/lib/demo-button/index.d.ts +44 -0
  24. package/lib/demo-button/index.js +76 -0
  25. package/lib/demo-button/style/index.d.ts +0 -0
  26. package/lib/demo-button/style/index.js +0 -0
  27. package/lib/demo-button/style/less.d.ts +0 -0
  28. package/lib/demo-button/style/less.js +0 -0
  29. package/lib/ebfe-vant-kit.cjs.js +301 -0
  30. package/lib/ebfe-vant-kit.es.js +312 -0
  31. package/lib/ebfe-vant-kit.js +18216 -0
  32. package/lib/ebfe-vant-kit.min.js +13064 -0
  33. package/lib/index.css +0 -0
  34. package/lib/index.d.ts +10 -0
  35. package/lib/index.js +58 -0
  36. package/lib/index.less +0 -0
  37. package/lib/single-picker/index-sfc.css +4 -0
  38. package/lib/single-picker/index-sfc.less +4 -0
  39. package/lib/single-picker/index.d.ts +623 -0
  40. package/lib/single-picker/index.js +261 -0
  41. package/lib/single-picker/style/index.d.ts +0 -0
  42. package/lib/single-picker/style/index.js +0 -0
  43. package/lib/single-picker/style/less.d.ts +0 -0
  44. package/lib/single-picker/style/less.js +0 -0
  45. package/lib/style.css +7107 -0
  46. package/lib/vue-sfc-shim.d.ts +5 -0
  47. package/lib/web-types.json +35 -0
  48. package/package.json +55 -0
@@ -0,0 +1,249 @@
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 };
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ declare module '*.vue' {
2
+ import { DefineComponent } from 'vue';
3
+ const Component: DefineComponent;
4
+ export default Component;
5
+ }
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,9 @@
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
+ }
@@ -0,0 +1,44 @@
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__;
@@ -0,0 +1,76 @@
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__;
File without changes
File without changes
File without changes
File without changes