@qin-ui/vant-pro 1.0.2 → 1.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.
- package/AI-CONTEXT.md +38 -0
- package/LICENSE +9 -0
- package/README.md +9 -2
- package/api.json +163 -0
- package/es/component-provider/index-DC_k4_R3.js +121 -0
- package/es/component-provider/index.js +2 -120
- package/es/core/{index-D-2iAH6o.js → index-B5vvm4Fj.js} +20 -20
- package/es/form/index.js +77 -89
- package/es/index.d.ts +464 -564
- package/es/index.js +17 -20
- package/package.json +12 -9
package/es/form/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Button, Signature, Area, Cascader, TimePicker, DatePicker, Picker, RadioGroup, CheckboxGroup, Uploader, Slider, Rate, Stepper, Switch, Field, Form, Popup } from "vant";
|
|
2
|
-
import { inject, reactive, ref, computed, provide, defineComponent,
|
|
3
|
-
import {
|
|
4
|
-
import { u as useForm$1, I as
|
|
5
|
-
import { e } from "../core/index-
|
|
2
|
+
import { inject, reactive, ref, computed, provide, defineComponent, useAttrs, mergeProps, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, createVNode, createCommentVNode, Teleport, resolveDynamicComponent, isRef, createSlots, renderList, renderSlot, normalizeProps, isVNode, createTextVNode, toDisplayString, guardReactiveProps, toValue, resolveComponent, useSlots, watchEffect, createElementVNode } from "vue";
|
|
3
|
+
import { g as getInjectConfig, I as INJECT_COMPONENTS, a as INJECT_CONFIG } from "../component-provider/index-DC_k4_R3.js";
|
|
4
|
+
import { u as useForm$1, I as InjectionPathKey, a as InjectionFormKey, c as camelizeProperties, b as useFields$1, d as useFormRef$1 } from "../core/index-B5vvm4Fj.js";
|
|
5
|
+
import { e } from "../core/index-B5vvm4Fj.js";
|
|
6
6
|
import { o as omit, c as cloneDeep, i as isPlainObject, t as toPath } from "../vendor/utils/lodash-es-DN4QDiDm.js";
|
|
7
7
|
const componentMap = {
|
|
8
8
|
field: Field,
|
|
@@ -69,59 +69,6 @@ function useForm(...args) {
|
|
|
69
69
|
const formPopup = useFormPopup(root);
|
|
70
70
|
return { ...form, formPopup };
|
|
71
71
|
}
|
|
72
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
73
|
-
...{ name: "ProForm", inheritAttrs: false },
|
|
74
|
-
__name: "index",
|
|
75
|
-
props: {
|
|
76
|
-
form: {}
|
|
77
|
-
},
|
|
78
|
-
setup(__props) {
|
|
79
|
-
const props = __props;
|
|
80
|
-
const form = props.form || useForm(true);
|
|
81
|
-
provide(InjectionFormKey, form);
|
|
82
|
-
const { fields, setFormRef, formPopup } = form;
|
|
83
|
-
const formFields = computed(() => {
|
|
84
|
-
const f = toValue(fields);
|
|
85
|
-
return Array.isArray(f) ? f : [];
|
|
86
|
-
});
|
|
87
|
-
const config = INJECT_CONFIG["pro-form"];
|
|
88
|
-
const injectAttrs = inject(config.injectionKey, config.default);
|
|
89
|
-
const slots = useSlots();
|
|
90
|
-
watchEffect(() => {
|
|
91
|
-
Object.keys(slots).forEach((name) => {
|
|
92
|
-
if (name === "default") return;
|
|
93
|
-
provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
const popupProps = computed(() => {
|
|
97
|
-
const { container, ...rest } = formPopup.props;
|
|
98
|
-
return rest;
|
|
99
|
-
});
|
|
100
|
-
return (_ctx, _cache) => {
|
|
101
|
-
return openBlock(), createBlock(unref(Form), mergeProps({
|
|
102
|
-
ref: (el) => {
|
|
103
|
-
var _a;
|
|
104
|
-
return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
|
|
105
|
-
}
|
|
106
|
-
}, mergeProps(unref(injectAttrs), unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
|
|
107
|
-
default: withCtx(() => [
|
|
108
|
-
createVNode(unref(_sfc_main), { fields: formFields.value }, null, 8, ["fields"]),
|
|
109
|
-
createVNode(unref(Popup), mergeProps(popupProps.value, {
|
|
110
|
-
show: unref(formPopup).visible.value,
|
|
111
|
-
onClose: unref(formPopup).close
|
|
112
|
-
}), {
|
|
113
|
-
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
114
|
-
createElementVNode("div", { id: "pro-form-popup-content" }, null, -1)
|
|
115
|
-
])]),
|
|
116
|
-
_: 1
|
|
117
|
-
}, 16, ["show", "onClose"]),
|
|
118
|
-
renderSlot(_ctx.$slots, "default")
|
|
119
|
-
]),
|
|
120
|
-
_: 3
|
|
121
|
-
}, 16);
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
72
|
const getInitProps = (field) => {
|
|
126
73
|
const { component } = field;
|
|
127
74
|
if (typeof component === "string") {
|
|
@@ -132,7 +79,7 @@ const getInitProps = (field) => {
|
|
|
132
79
|
}
|
|
133
80
|
return {};
|
|
134
81
|
};
|
|
135
|
-
const _sfc_main$
|
|
82
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
136
83
|
...{ name: "BaseField", inheritAttrs: false },
|
|
137
84
|
__name: "index",
|
|
138
85
|
props: {
|
|
@@ -277,7 +224,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
277
224
|
getComponentComputedProps: () => groupedAttrs.value.attrs
|
|
278
225
|
});
|
|
279
226
|
return (_ctx, _cache) => {
|
|
280
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
227
|
+
return openBlock(), createBlock(unref(_sfc_main$5), {
|
|
281
228
|
component: groupedAttrs.value.componentContainer,
|
|
282
229
|
path: __props.path
|
|
283
230
|
}, {
|
|
@@ -295,14 +242,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
295
242
|
"model-value": displayValue.value,
|
|
296
243
|
onClick: onFieldClick
|
|
297
244
|
}), null, 16, ["model-value"]),
|
|
298
|
-
unref(popupFieldPath) === __props.path ? (openBlock(), createBlock(unref(_sfc_main$
|
|
245
|
+
unref(popupFieldPath) === __props.path ? (openBlock(), createBlock(unref(_sfc_main$5), {
|
|
299
246
|
key: 0,
|
|
300
247
|
component: Teleport,
|
|
301
248
|
to: "#pro-form-popup-content",
|
|
302
249
|
defer: ""
|
|
303
250
|
}, {
|
|
304
251
|
default: withCtx(() => [
|
|
305
|
-
createVNode(unref(_sfc_main$
|
|
252
|
+
createVNode(unref(_sfc_main$5), {
|
|
306
253
|
component: popupContainer.value,
|
|
307
254
|
path: __props.path
|
|
308
255
|
}, {
|
|
@@ -315,7 +262,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
315
262
|
return {
|
|
316
263
|
name,
|
|
317
264
|
fn: withCtx((scoped) => [
|
|
318
|
-
createVNode(unref(_sfc_main$
|
|
265
|
+
createVNode(unref(_sfc_main$4), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
319
266
|
])
|
|
320
267
|
};
|
|
321
268
|
})
|
|
@@ -338,7 +285,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
338
285
|
return {
|
|
339
286
|
name,
|
|
340
287
|
fn: withCtx((scoped) => [
|
|
341
|
-
createVNode(unref(_sfc_main$
|
|
288
|
+
createVNode(unref(_sfc_main$4), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
342
289
|
])
|
|
343
290
|
};
|
|
344
291
|
})
|
|
@@ -358,7 +305,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
358
305
|
return {
|
|
359
306
|
name,
|
|
360
307
|
fn: withCtx((scoped) => [
|
|
361
|
-
createVNode(unref(_sfc_main$
|
|
308
|
+
createVNode(unref(_sfc_main$4), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
362
309
|
])
|
|
363
310
|
};
|
|
364
311
|
})
|
|
@@ -377,7 +324,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
377
324
|
return {
|
|
378
325
|
name,
|
|
379
326
|
fn: withCtx((scoped) => [
|
|
380
|
-
createVNode(unref(_sfc_main$
|
|
327
|
+
createVNode(unref(_sfc_main$4), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
381
328
|
])
|
|
382
329
|
};
|
|
383
330
|
})
|
|
@@ -389,7 +336,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
389
336
|
};
|
|
390
337
|
}
|
|
391
338
|
});
|
|
392
|
-
const _sfc_main$
|
|
339
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
393
340
|
...{ name: "ContainerFragment", inheritAttrs: false },
|
|
394
341
|
__name: "index",
|
|
395
342
|
props: {
|
|
@@ -406,7 +353,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
406
353
|
};
|
|
407
354
|
}
|
|
408
355
|
});
|
|
409
|
-
const _sfc_main$
|
|
356
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
410
357
|
...{ name: "SlotComponent", inheritAttrs: false },
|
|
411
358
|
__name: "index",
|
|
412
359
|
props: {
|
|
@@ -420,7 +367,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
420
367
|
};
|
|
421
368
|
}
|
|
422
369
|
});
|
|
423
|
-
const _sfc_main$
|
|
370
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
424
371
|
__name: "index",
|
|
425
372
|
props: {
|
|
426
373
|
path: {}
|
|
@@ -436,7 +383,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
436
383
|
};
|
|
437
384
|
}
|
|
438
385
|
});
|
|
439
|
-
const _sfc_main$
|
|
386
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
440
387
|
__name: "index",
|
|
441
388
|
props: {
|
|
442
389
|
field: {}
|
|
@@ -456,7 +403,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
456
403
|
};
|
|
457
404
|
}
|
|
458
405
|
});
|
|
459
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
406
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
460
407
|
...{ name: "BaseFormItem", inheritAttrs: false },
|
|
461
408
|
__name: "index",
|
|
462
409
|
props: {
|
|
@@ -472,14 +419,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
472
419
|
return (_ctx, _cache) => {
|
|
473
420
|
const _component_BaseFormItem = resolveComponent("BaseFormItem");
|
|
474
421
|
return openBlock(true), createElementBlock(Fragment, null, renderList(validFields.value, (field, index) => {
|
|
475
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
422
|
+
return openBlock(), createBlock(unref(_sfc_main$3), {
|
|
476
423
|
key: unref(toPath)(toValue(field.path || index)).join(".") || index,
|
|
477
424
|
path: toValue(field.path)
|
|
478
425
|
}, {
|
|
479
426
|
default: withCtx(({ path }) => [
|
|
480
|
-
createVNode(unref(_sfc_main$
|
|
427
|
+
createVNode(unref(_sfc_main$2), { field }, {
|
|
481
428
|
default: withCtx(({ componentProps }) => [
|
|
482
|
-
field.fields ? (openBlock(), createBlock(unref(_sfc_main$
|
|
429
|
+
field.fields ? (openBlock(), createBlock(unref(_sfc_main$5), mergeProps({
|
|
483
430
|
key: 0,
|
|
484
431
|
component: field.fieldContainer,
|
|
485
432
|
path
|
|
@@ -490,7 +437,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
490
437
|
}, null, 8, ["fields"])
|
|
491
438
|
]),
|
|
492
439
|
_: 2
|
|
493
|
-
}, 1040, ["component", "path"])) : (openBlock(), createBlock(unref(_sfc_main$
|
|
440
|
+
}, 1040, ["component", "path"])) : (openBlock(), createBlock(unref(_sfc_main$6), mergeProps({
|
|
494
441
|
key: 1,
|
|
495
442
|
ref_for: true
|
|
496
443
|
}, componentProps, { path }), null, 16, ["path"]))
|
|
@@ -504,26 +451,67 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
504
451
|
};
|
|
505
452
|
}
|
|
506
453
|
});
|
|
454
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
455
|
+
...{ name: "ProForm", inheritAttrs: false },
|
|
456
|
+
__name: "index",
|
|
457
|
+
props: {
|
|
458
|
+
form: {}
|
|
459
|
+
},
|
|
460
|
+
setup(__props) {
|
|
461
|
+
const props = __props;
|
|
462
|
+
const form = props.form || useForm(true);
|
|
463
|
+
provide(InjectionFormKey, form);
|
|
464
|
+
const { fields, setFormRef, formPopup } = form;
|
|
465
|
+
const formFields = computed(() => {
|
|
466
|
+
const f = toValue(fields);
|
|
467
|
+
return Array.isArray(f) ? f : [];
|
|
468
|
+
});
|
|
469
|
+
const config = INJECT_CONFIG["pro-form"];
|
|
470
|
+
const injectAttrs = inject(config.injectionKey, config.default);
|
|
471
|
+
const slots = useSlots();
|
|
472
|
+
watchEffect(() => {
|
|
473
|
+
Object.keys(slots).forEach((name) => {
|
|
474
|
+
if (name === "default") return;
|
|
475
|
+
provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
const popupProps = computed(() => {
|
|
479
|
+
const { container, ...rest } = formPopup.props;
|
|
480
|
+
return rest;
|
|
481
|
+
});
|
|
482
|
+
return (_ctx, _cache) => {
|
|
483
|
+
return openBlock(), createBlock(unref(Form), mergeProps({
|
|
484
|
+
ref: (el) => {
|
|
485
|
+
var _a;
|
|
486
|
+
return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
|
|
487
|
+
}
|
|
488
|
+
}, mergeProps(unref(injectAttrs), unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
|
|
489
|
+
default: withCtx(() => [
|
|
490
|
+
createVNode(unref(_sfc_main$1), { fields: formFields.value }, null, 8, ["fields"]),
|
|
491
|
+
createVNode(unref(Popup), mergeProps(popupProps.value, {
|
|
492
|
+
show: unref(formPopup).visible.value,
|
|
493
|
+
onClose: unref(formPopup).close
|
|
494
|
+
}), {
|
|
495
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [
|
|
496
|
+
createElementVNode("div", { id: "pro-form-popup-content" }, null, -1)
|
|
497
|
+
])]),
|
|
498
|
+
_: 1
|
|
499
|
+
}, 16, ["show", "onClose"]),
|
|
500
|
+
renderSlot(_ctx.$slots, "default")
|
|
501
|
+
]),
|
|
502
|
+
_: 3
|
|
503
|
+
}, 16);
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
507
|
const useFields = useFields$1;
|
|
508
508
|
const useFormRef = useFormRef$1;
|
|
509
509
|
export {
|
|
510
|
-
_sfc_main$5 as
|
|
511
|
-
_sfc_main$
|
|
512
|
-
_sfc_main as
|
|
513
|
-
_sfc_main$4 as ContainerFragment,
|
|
514
|
-
_sfc_main$1 as GroupedFieldAttrs,
|
|
515
|
-
InjectionFormKey,
|
|
516
|
-
InjectionPathKey,
|
|
517
|
-
InjectionPopupKey,
|
|
518
|
-
_sfc_main$2 as PathProvider,
|
|
519
|
-
_sfc_main$3 as SlotComponent,
|
|
520
|
-
TeleportComponentNamePrefix,
|
|
521
|
-
componentMap,
|
|
522
|
-
_sfc_main$6 as default,
|
|
523
|
-
getInitProps,
|
|
510
|
+
_sfc_main$5 as ContainerFragment,
|
|
511
|
+
_sfc_main$4 as SlotComponent,
|
|
512
|
+
_sfc_main as default,
|
|
524
513
|
useFields,
|
|
525
514
|
useForm,
|
|
526
515
|
e as useFormData,
|
|
527
|
-
useFormPopup,
|
|
528
516
|
useFormRef
|
|
529
517
|
};
|