@qin-ui/antd-vue-pro 1.0.41 → 1.1.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.
- package/README.md +27 -9
- package/es/component-provider/index.js +70 -15
- package/es/form/{index-914194dc.js → index-1e0c8f68.js} +48 -84
- package/es/form/index.js +9 -10
- package/es/index.d.ts +1799 -154
- package/es/index.js +15 -14
- package/es/style.css +3 -3
- package/es/table/index.js +13 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
npm i @qin-ui/antd-vue-pro
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
> 注意:从v1.0.x 升级至 v1.1.x 版本有api优化调整,主要涉及到pro-component-provider组件component-vars的参数扁平化,版本升级时需注意
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
#### 1. pro-component-provider
|
|
@@ -153,7 +155,9 @@ ant-design-vue ui组件库form组件的二次封装
|
|
|
153
155
|
/** 中文名称 */
|
|
154
156
|
label?: SlotComponentType;
|
|
155
157
|
/** 插槽,可包含formItem插槽和component插槽 */
|
|
156
|
-
slots?:
|
|
158
|
+
slots?: Partial<
|
|
159
|
+
Record<(typeof FORM_ITEM_SLOT_KEYS)[number], SlotComponentType>
|
|
160
|
+
>;
|
|
157
161
|
/** 网格布局属性 */
|
|
158
162
|
grid?: Grid;
|
|
159
163
|
/** 子字段 */
|
|
@@ -174,6 +178,11 @@ ant-design-vue ui组件库form组件的二次封装
|
|
|
174
178
|
componentClassName?: string;
|
|
175
179
|
/** component容器包裹组件 */
|
|
176
180
|
componentContainer?: ContainerComponent;
|
|
181
|
+
/**
|
|
182
|
+
* 值处理函数,onUpdateValue前执行,函数返回值将作为更新值
|
|
183
|
+
* @example (val) => val?.trim()
|
|
184
|
+
*/
|
|
185
|
+
valueFormatter?: (val: any) => any;
|
|
177
186
|
}
|
|
178
187
|
```
|
|
179
188
|
|
|
@@ -222,11 +231,15 @@ ant-design-vue ui组件库form组件的二次封装
|
|
|
222
231
|
*/
|
|
223
232
|
type UseFormData = (initFormData: FormData) => {
|
|
224
233
|
/** 表单数据Ref */
|
|
225
|
-
formData: Ref<FormData>;
|
|
234
|
+
formData: Ref<D | FormData>;
|
|
226
235
|
/** 获取指定字段数据路径的值 */
|
|
227
236
|
getFormData: GetFormData;
|
|
228
237
|
/** 设置指定字段数据路径的值 */
|
|
229
238
|
setFormData: SetFormData;
|
|
239
|
+
/** 当前正在编辑的字段path */
|
|
240
|
+
activePath: Ref<string | undefined>;
|
|
241
|
+
/** 设置当前正在编辑的字段path */
|
|
242
|
+
setActivePath: SetActivePath;
|
|
230
243
|
};
|
|
231
244
|
```
|
|
232
245
|
|
|
@@ -244,7 +257,7 @@ import {
|
|
|
244
257
|
type ProFormInstance,
|
|
245
258
|
type Field,
|
|
246
259
|
type Fields,
|
|
247
|
-
} from '@qin-ui/antd-vue-pro';
|
|
260
|
+
} from '@qin-ui/antd-vue-pro/src';
|
|
248
261
|
import { h, ref } from 'vue';
|
|
249
262
|
|
|
250
263
|
const proFormRef = ref<ProFormInstance | null>(null);
|
|
@@ -272,11 +285,17 @@ const CodeContainer: Field['componentContainer'] = (p, ctx) => {
|
|
|
272
285
|
};
|
|
273
286
|
|
|
274
287
|
const initFields: Fields = [
|
|
288
|
+
{
|
|
289
|
+
label: '登记所在地(省/市/县、区)',
|
|
290
|
+
key: '登记所在地(省/市/县、区)',
|
|
291
|
+
component: 'cascader',
|
|
292
|
+
slots: {},
|
|
293
|
+
options: [],
|
|
294
|
+
},
|
|
275
295
|
{
|
|
276
296
|
label: '用户名',
|
|
277
297
|
key: 'username',
|
|
278
298
|
component: 'input',
|
|
279
|
-
maxlength: 20,
|
|
280
299
|
rules: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
|
281
300
|
},
|
|
282
301
|
{
|
|
@@ -289,6 +308,7 @@ const initFields: Fields = [
|
|
|
289
308
|
{ min: 4, message: '密码最小长度为5个字符' },
|
|
290
309
|
{ max: 18, message: '密码最大长度为18个字符' },
|
|
291
310
|
],
|
|
311
|
+
valueFormatter: val => val?.trim()
|
|
292
312
|
},
|
|
293
313
|
{
|
|
294
314
|
label: '验证码',
|
|
@@ -302,11 +322,9 @@ const initFields: Fields = [
|
|
|
302
322
|
const form = useForm({}, initFields);
|
|
303
323
|
|
|
304
324
|
const componentVars: ComponentVars = {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
'input-number': { max: 10 ** 12 - 1 },
|
|
309
|
-
},
|
|
325
|
+
input: { maxlength: 50, valueFormatter: val => val?.trim() },
|
|
326
|
+
textarea: { maxlength: 1000, valueFormatter: val => val?.trim() },
|
|
327
|
+
'input-number': { max: 10 ** 12 - 1 },
|
|
310
328
|
};
|
|
311
329
|
|
|
312
330
|
const submit = () => {
|
|
@@ -1,7 +1,65 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { inject, provide, defineComponent, renderSlot } from "vue";
|
|
2
|
+
const INJECT_KEYS = {
|
|
3
|
+
"pro-table": Symbol(""),
|
|
4
|
+
"pro-form": Symbol(""),
|
|
5
|
+
"pro-form-item": Symbol(""),
|
|
6
|
+
// field
|
|
7
|
+
"input": Symbol(""),
|
|
8
|
+
"textarea": Symbol(""),
|
|
9
|
+
"input-password": Symbol(""),
|
|
10
|
+
"input-search": Symbol(""),
|
|
11
|
+
"input-number": Symbol(""),
|
|
12
|
+
"select": Symbol(""),
|
|
13
|
+
"cascader": Symbol(""),
|
|
14
|
+
"date-picker": Symbol(""),
|
|
15
|
+
"date-picker.date": Symbol(""),
|
|
16
|
+
"date-picker.week": Symbol(""),
|
|
17
|
+
"date-picker.month": Symbol(""),
|
|
18
|
+
"date-picker.year": Symbol(""),
|
|
19
|
+
"date-picker.quarter": Symbol(""),
|
|
20
|
+
"range-picker": Symbol(""),
|
|
21
|
+
"time-picker": Symbol(""),
|
|
22
|
+
"checkbox-group": Symbol(""),
|
|
23
|
+
"radio-group": Symbol(""),
|
|
24
|
+
"switch": Symbol(""),
|
|
25
|
+
"slider": Symbol(""),
|
|
26
|
+
"tree-select": Symbol(""),
|
|
27
|
+
"transfer": Symbol("")
|
|
28
|
+
};
|
|
29
|
+
const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
|
|
30
|
+
const INIT_PROPS_MAP = /* @__PURE__ */ new Map([
|
|
31
|
+
[INJECT_KEYS["pro-table"], {}],
|
|
32
|
+
[INJECT_KEYS["pro-form"], {}],
|
|
33
|
+
[INJECT_KEYS["pro-form-item"], {}],
|
|
34
|
+
// field
|
|
35
|
+
[INJECT_KEYS["input"], { maxlength: 100, allowClear: true, placeholder: "请输入" }],
|
|
36
|
+
[INJECT_KEYS["textarea"], { maxlength: 200, autoSize: { minRows: 3, maxRows: 6 }, showCount: true, allowClear: true, placeholder: "请输入" }],
|
|
37
|
+
[INJECT_KEYS["input-password"], { maxlength: 100, allowClear: true, placeholder: "请输入" }],
|
|
38
|
+
[INJECT_KEYS["input-number"], { max: 10 ** 15 - 1, min: -(10 ** 15 + 1), controls: false, allowClear: true, placeholder: "请输入" }],
|
|
39
|
+
[INJECT_KEYS["select"], { allowClear: true, placeholder: "请选择", getPopupContainer }],
|
|
40
|
+
[INJECT_KEYS["cascader"], { allowClear: true, placeholder: "请选择", getPopupContainer }],
|
|
41
|
+
[INJECT_KEYS["date-picker"], { allowClear: true, getPopupContainer }],
|
|
42
|
+
[INJECT_KEYS["date-picker.week"], { allowClear: true, getPopupContainer }],
|
|
43
|
+
[INJECT_KEYS["date-picker.month"], { allowClear: true, getPopupContainer }],
|
|
44
|
+
[INJECT_KEYS["date-picker.year"], { allowClear: true, getPopupContainer }],
|
|
45
|
+
[INJECT_KEYS["date-picker.quarter"], { allowClear: true, getPopupContainer }],
|
|
46
|
+
[INJECT_KEYS["time-picker"], { allowClear: true, getPopupContainer }],
|
|
47
|
+
[INJECT_KEYS["range-picker"], { allowClear: true, getPopupContainer }],
|
|
48
|
+
[INJECT_KEYS["checkbox-group"], { allowClear: true, getPopupContainer }],
|
|
49
|
+
[INJECT_KEYS["radio-group"], {}],
|
|
50
|
+
[INJECT_KEYS["switch"], {}],
|
|
51
|
+
[INJECT_KEYS["slider"], {}],
|
|
52
|
+
[INJECT_KEYS["tree-select"], {}],
|
|
53
|
+
[INJECT_KEYS["transfer"], {}]
|
|
54
|
+
]);
|
|
55
|
+
const useInjectProps = (key) => {
|
|
56
|
+
const initProps = INIT_PROPS_MAP.get(key) ?? {};
|
|
57
|
+
const injectProps = inject(key, {});
|
|
58
|
+
return { ...initProps, ...injectProps };
|
|
59
|
+
};
|
|
60
|
+
const useProviderProps = (key, value) => {
|
|
61
|
+
provide(key, value);
|
|
62
|
+
};
|
|
5
63
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
64
|
__name: "index",
|
|
7
65
|
props: {
|
|
@@ -10,16 +68,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10
68
|
setup(__props) {
|
|
11
69
|
const props = __props;
|
|
12
70
|
if (props.componentVars) {
|
|
13
|
-
Object.
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
...PRO_TABLE_INJECT_COMPONENT_PROPS_KEYS
|
|
17
|
-
};
|
|
18
|
-
Object.entries(item).forEach(([key, value]) => {
|
|
19
|
-
if (Object.hasOwn(injectKeys, key)) {
|
|
20
|
-
provide(injectKeys[key], value);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
71
|
+
Object.entries(props.componentVars).forEach(([key, val]) => {
|
|
72
|
+
const injectKey = INJECT_KEYS[key];
|
|
73
|
+
useProviderProps(injectKey, val);
|
|
23
74
|
});
|
|
24
75
|
}
|
|
25
76
|
return (_ctx, _cache) => {
|
|
@@ -28,5 +79,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
79
|
}
|
|
29
80
|
});
|
|
30
81
|
export {
|
|
31
|
-
|
|
82
|
+
INIT_PROPS_MAP,
|
|
83
|
+
INJECT_KEYS,
|
|
84
|
+
_sfc_main as default,
|
|
85
|
+
useInjectProps,
|
|
86
|
+
useProviderProps
|
|
32
87
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { inject, ref, h as h$1, getCurrentInstance, nextTick, reactive, defineComponent, createVNode, shallowRef, watch, unref, provide, watchEffect, onBeforeUnmount, computed, isRef, Fragment, Comment, Text, isVNode, onMounted, cloneVNode, Transition, withDirectives, resolveDirective, onUpdated, onUnmounted, toRef, withModifiers, vShow, onBeforeMount, Teleport, TransitionGroup, toRaw, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, renderList, resolveDynamicComponent, normalizeProps, createSlots, createTextVNode, createCommentVNode, useAttrs, renderSlot, toDisplayString, shallowReactive } from "vue";
|
|
2
2
|
import { Input, Textarea, InputSearch, InputPassword, InputNumber, Select, Cascader, DatePicker as DatePicker$1, RangePicker, TimePicker as TimePicker$1, CheckboxGroup, RadioGroup, Switch, Slider, TreeSelect, Transfer, Row as Row$1, Col as Col$1, FormItem as FormItem$1, message, Form as Form$2 } from "ant-design-vue";
|
|
3
|
+
import { INIT_PROPS_MAP, useInjectProps, INJECT_KEYS } from "../component-provider/index.js";
|
|
3
4
|
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
4
5
|
const freeGlobal$1 = freeGlobal;
|
|
5
6
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
@@ -7113,7 +7114,7 @@ const useConfigInject = (name, props) => {
|
|
|
7113
7114
|
var _a, _b;
|
|
7114
7115
|
return (_a = props.getTargetContainer) !== null && _a !== void 0 ? _a : (_b = configProvider.getTargetContainer) === null || _b === void 0 ? void 0 : _b.value;
|
|
7115
7116
|
});
|
|
7116
|
-
const
|
|
7117
|
+
const getPopupContainer = computed(() => {
|
|
7117
7118
|
var _a, _b, _c;
|
|
7118
7119
|
return (_b = (_a = props.getContainer) !== null && _a !== void 0 ? _a : props.getPopupContainer) !== null && _b !== void 0 ? _b : (_c = configProvider.getPopupContainer) === null || _c === void 0 ? void 0 : _c.value;
|
|
7119
7120
|
});
|
|
@@ -7144,7 +7145,7 @@ const useConfigInject = (name, props) => {
|
|
|
7144
7145
|
direction,
|
|
7145
7146
|
size,
|
|
7146
7147
|
getTargetContainer,
|
|
7147
|
-
getPopupContainer
|
|
7148
|
+
getPopupContainer,
|
|
7148
7149
|
space,
|
|
7149
7150
|
pageHeader,
|
|
7150
7151
|
form,
|
|
@@ -12198,15 +12199,15 @@ const Trigger = defineComponent({
|
|
|
12198
12199
|
attachParent(popupContainer) {
|
|
12199
12200
|
wrapperRaf.cancel(this.attachId);
|
|
12200
12201
|
const {
|
|
12201
|
-
getPopupContainer
|
|
12202
|
+
getPopupContainer,
|
|
12202
12203
|
getDocument: getDocument2
|
|
12203
12204
|
} = this.$props;
|
|
12204
12205
|
const domNode = this.getRootDomNode();
|
|
12205
12206
|
let mountNode;
|
|
12206
|
-
if (!
|
|
12207
|
+
if (!getPopupContainer) {
|
|
12207
12208
|
mountNode = getDocument2(this.getRootDomNode()).body;
|
|
12208
|
-
} else if (domNode ||
|
|
12209
|
-
mountNode =
|
|
12209
|
+
} else if (domNode || getPopupContainer.length === 0) {
|
|
12210
|
+
mountNode = getPopupContainer(domNode);
|
|
12210
12211
|
}
|
|
12211
12212
|
if (mountNode) {
|
|
12212
12213
|
mountNode.appendChild(popupContainer);
|
|
@@ -12400,7 +12401,7 @@ const Trigger = defineComponent({
|
|
|
12400
12401
|
const children = filterEmpty(getSlot(this));
|
|
12401
12402
|
const {
|
|
12402
12403
|
alignPoint: alignPoint2,
|
|
12403
|
-
getPopupContainer
|
|
12404
|
+
getPopupContainer
|
|
12404
12405
|
} = this.$props;
|
|
12405
12406
|
const child = children[0];
|
|
12406
12407
|
this.childOriginEvents = getEvents(child);
|
|
@@ -12454,7 +12455,7 @@ const Trigger = defineComponent({
|
|
|
12454
12455
|
}), true, true);
|
|
12455
12456
|
const portal = createVNode(Portal, {
|
|
12456
12457
|
"key": "portal",
|
|
12457
|
-
"getContainer":
|
|
12458
|
+
"getContainer": getPopupContainer && (() => getPopupContainer(this.getRootDomNode())),
|
|
12458
12459
|
"didUpdate": this.handlePortalUpdate,
|
|
12459
12460
|
"visible": this.$data.sPopupVisible
|
|
12460
12461
|
}, {
|
|
@@ -13479,7 +13480,7 @@ const ToolTip = defineComponent({
|
|
|
13479
13480
|
}
|
|
13480
13481
|
const {
|
|
13481
13482
|
prefixCls,
|
|
13482
|
-
getPopupContainer
|
|
13483
|
+
getPopupContainer,
|
|
13483
13484
|
direction,
|
|
13484
13485
|
rootPrefixCls
|
|
13485
13486
|
} = useConfigInject("tooltip", props);
|
|
@@ -13628,7 +13629,7 @@ const ToolTip = defineComponent({
|
|
|
13628
13629
|
const arrowContentStyle = colorInfo.value.arrowStyle;
|
|
13629
13630
|
const vcTooltipProps = _extends$1(_extends$1(_extends$1({}, attrs), props), {
|
|
13630
13631
|
prefixCls: prefixCls.value,
|
|
13631
|
-
getPopupContainer:
|
|
13632
|
+
getPopupContainer: getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
|
|
13632
13633
|
builtinPlacements: tooltipPlacements.value,
|
|
13633
13634
|
visible: tempVisible,
|
|
13634
13635
|
ref: tooltip,
|
|
@@ -15719,52 +15720,6 @@ const RULE_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
|
15719
15720
|
]);
|
|
15720
15721
|
const FunctionRegexp = /^\s*function\s*\w*\s*\([^)]*\)\s*{([\s\S]*)}/g;
|
|
15721
15722
|
const ArrowFunctionRegexp = /^\s*(?:\([^)]*\)|\w+)\s*=>\s*\(?({[\s\S]*}|[^;]*)\)?/g;
|
|
15722
|
-
const INJECT_COMPONENT_PROPS_KEYS = {
|
|
15723
|
-
"input": Symbol(""),
|
|
15724
|
-
"textarea": Symbol(""),
|
|
15725
|
-
"input-password": Symbol(""),
|
|
15726
|
-
"input-search": Symbol(""),
|
|
15727
|
-
"input-number": Symbol(""),
|
|
15728
|
-
"select": Symbol(""),
|
|
15729
|
-
"cascader": Symbol(""),
|
|
15730
|
-
"date-picker": Symbol(""),
|
|
15731
|
-
"date-picker.date": Symbol(""),
|
|
15732
|
-
"date-picker.week": Symbol(""),
|
|
15733
|
-
"date-picker.month": Symbol(""),
|
|
15734
|
-
"date-picker.year": Symbol(""),
|
|
15735
|
-
"date-picker.quarter": Symbol(""),
|
|
15736
|
-
"range-picker": Symbol(""),
|
|
15737
|
-
"time-picker": Symbol(""),
|
|
15738
|
-
"checkbox-group": Symbol(""),
|
|
15739
|
-
"radio-group": Symbol(""),
|
|
15740
|
-
"switch": Symbol(""),
|
|
15741
|
-
"slider": Symbol(""),
|
|
15742
|
-
"tree-select": Symbol(""),
|
|
15743
|
-
"transfer": Symbol("")
|
|
15744
|
-
};
|
|
15745
|
-
const PROPS_KEYS = INJECT_COMPONENT_PROPS_KEYS;
|
|
15746
|
-
const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
|
|
15747
|
-
const INIT_COMPONENT_PROPS_MAP = /* @__PURE__ */ new Map([
|
|
15748
|
-
[PROPS_KEYS.input, { maxlength: 100, allowClear: true, placeholder: "请输入" }],
|
|
15749
|
-
[PROPS_KEYS.textarea, { maxlength: 200, autoSize: { minRows: 3, maxRows: 6 }, showCount: true, allowClear: true, placeholder: "请输入" }],
|
|
15750
|
-
[PROPS_KEYS["input-password"], { maxlength: 100, allowClear: true, placeholder: "请输入" }],
|
|
15751
|
-
[PROPS_KEYS["input-number"], { max: 10 ** 15 - 1, min: -(10 ** 15 + 1), controls: false, allowClear: true, placeholder: "请输入" }],
|
|
15752
|
-
[PROPS_KEYS.select, { allowClear: true, placeholder: "请选择", getPopupContainer }],
|
|
15753
|
-
[PROPS_KEYS.cascader, { allowClear: true, placeholder: "请选择", getPopupContainer }],
|
|
15754
|
-
[PROPS_KEYS["date-picker"], { allowClear: true, getPopupContainer }],
|
|
15755
|
-
[PROPS_KEYS["date-picker.week"], { allowClear: true, getPopupContainer }],
|
|
15756
|
-
[PROPS_KEYS["date-picker.month"], { allowClear: true, getPopupContainer }],
|
|
15757
|
-
[PROPS_KEYS["date-picker.year"], { allowClear: true, getPopupContainer }],
|
|
15758
|
-
[PROPS_KEYS["date-picker.quarter"], { allowClear: true, getPopupContainer }],
|
|
15759
|
-
[PROPS_KEYS["time-picker"], { allowClear: true, getPopupContainer }],
|
|
15760
|
-
[PROPS_KEYS["range-picker"], { allowClear: true, getPopupContainer }],
|
|
15761
|
-
[PROPS_KEYS["checkbox-group"], { allowClear: true, getPopupContainer }],
|
|
15762
|
-
[PROPS_KEYS["radio-group"], {}],
|
|
15763
|
-
[PROPS_KEYS.switch, {}],
|
|
15764
|
-
[PROPS_KEYS.slider, {}],
|
|
15765
|
-
[PROPS_KEYS["tree-select"], {}],
|
|
15766
|
-
[PROPS_KEYS.transfer, {}]
|
|
15767
|
-
]);
|
|
15768
15723
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
15769
15724
|
...{
|
|
15770
15725
|
name: "BaseFormItem"
|
|
@@ -16032,20 +15987,26 @@ const useFormData = (initFormData) => {
|
|
|
16032
15987
|
return void 0;
|
|
16033
15988
|
return get$1(formData.value, path);
|
|
16034
15989
|
};
|
|
16035
|
-
const setFormData = (
|
|
16036
|
-
let
|
|
15990
|
+
const setFormData = (...args) => {
|
|
15991
|
+
let path;
|
|
15992
|
+
let value;
|
|
15993
|
+
if (args.length === 2) {
|
|
15994
|
+
[path, value] = args;
|
|
15995
|
+
} else {
|
|
15996
|
+
[value] = args;
|
|
15997
|
+
}
|
|
16037
15998
|
if (path) {
|
|
16038
15999
|
if (typeof value === "function") {
|
|
16039
16000
|
const preValue = getFormData(path);
|
|
16040
|
-
|
|
16001
|
+
value = value(preValue);
|
|
16041
16002
|
}
|
|
16042
|
-
set$1(formData.value, path,
|
|
16003
|
+
set$1(formData.value, path, value);
|
|
16043
16004
|
} else {
|
|
16044
16005
|
if (typeof value === "function") {
|
|
16045
16006
|
const preValue = formData.value;
|
|
16046
|
-
|
|
16007
|
+
value = value(preValue);
|
|
16047
16008
|
}
|
|
16048
|
-
formData.value =
|
|
16009
|
+
formData.value = value;
|
|
16049
16010
|
}
|
|
16050
16011
|
};
|
|
16051
16012
|
return { formData, getFormData, setFormData, activePath, setActivePath };
|
|
@@ -16349,16 +16310,15 @@ const useCommand = ({ refs, form }) => {
|
|
|
16349
16310
|
};
|
|
16350
16311
|
const useInitProps = () => {
|
|
16351
16312
|
const initPropsMap = /* @__PURE__ */ new Map();
|
|
16352
|
-
|
|
16353
|
-
const injectProps =
|
|
16354
|
-
|
|
16355
|
-
initPropsMap.set(key, mergedProps);
|
|
16313
|
+
INIT_PROPS_MAP.forEach((val, key) => {
|
|
16314
|
+
const injectProps = useInjectProps(key);
|
|
16315
|
+
initPropsMap.set(key, injectProps);
|
|
16356
16316
|
});
|
|
16357
16317
|
const getInitProps = (field) => {
|
|
16358
16318
|
const { component, type: type4 = "" } = field;
|
|
16359
16319
|
if (COMPONENT_MAP.has(component)) {
|
|
16360
|
-
const k2 =
|
|
16361
|
-
return initPropsMap.get(
|
|
16320
|
+
const k2 = [component, type4].filter(Boolean).join(".");
|
|
16321
|
+
return initPropsMap.get(INJECT_KEYS[k2]) || {};
|
|
16362
16322
|
}
|
|
16363
16323
|
return {};
|
|
16364
16324
|
};
|
|
@@ -16387,6 +16347,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16387
16347
|
return get$1(formData == null ? void 0 : formData.value, props.path);
|
|
16388
16348
|
},
|
|
16389
16349
|
set(val) {
|
|
16350
|
+
const { valueFormatter } = mergedAttrs.value;
|
|
16351
|
+
if (valueFormatter && typeof valueFormatter === "function") {
|
|
16352
|
+
updateFormData == null ? void 0 : updateFormData(props.path, valueFormatter(val));
|
|
16353
|
+
return;
|
|
16354
|
+
}
|
|
16390
16355
|
updateFormData == null ? void 0 : updateFormData(props.path, val);
|
|
16391
16356
|
}
|
|
16392
16357
|
});
|
|
@@ -16475,7 +16440,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16475
16440
|
ref: setComponentRef,
|
|
16476
16441
|
[modelName.value]: value.value,
|
|
16477
16442
|
["onUpdate:" + modelName.value]: _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
16478
|
-
[modelName.value + "Modifiers"]: { trim: true },
|
|
16479
16443
|
class: [unref(attrs).componentClassName, "field-component"],
|
|
16480
16444
|
style: unref(attrs).componentStyle,
|
|
16481
16445
|
path: _ctx.path,
|
|
@@ -16499,7 +16463,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16499
16463
|
};
|
|
16500
16464
|
}
|
|
16501
16465
|
});
|
|
16502
|
-
const
|
|
16466
|
+
const index_vue_vue_type_style_index_0_scoped_ae4b888f_lang = "";
|
|
16503
16467
|
const _export_sfc = (sfc, props) => {
|
|
16504
16468
|
const target = sfc.__vccOpts || sfc;
|
|
16505
16469
|
for (const [key, val] of props) {
|
|
@@ -16507,7 +16471,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
16507
16471
|
}
|
|
16508
16472
|
return target;
|
|
16509
16473
|
};
|
|
16510
|
-
const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
16474
|
+
const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-ae4b888f"]]);
|
|
16511
16475
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
16512
16476
|
...{
|
|
16513
16477
|
name: "ContainerFragment",
|
|
@@ -16561,6 +16525,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16561
16525
|
emits: ["update:formData", "update:activePath"],
|
|
16562
16526
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
16563
16527
|
const props = __props;
|
|
16528
|
+
const injectProps = useInjectProps(INJECT_KEYS["pro-form"]);
|
|
16529
|
+
const injectAttrs = omit$1(injectProps, Object.keys(props));
|
|
16564
16530
|
const emit = __emit;
|
|
16565
16531
|
const refs = {
|
|
16566
16532
|
formItemRefs: {},
|
|
@@ -16620,11 +16586,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16620
16586
|
provide(UPDATE_ACTIVE_PATH, updateActivePath);
|
|
16621
16587
|
__expose(exposed);
|
|
16622
16588
|
return (_ctx, _cache) => {
|
|
16623
|
-
return openBlock(), createBlock(unref(Form$2), {
|
|
16589
|
+
return openBlock(), createBlock(unref(Form$2), mergeProps({
|
|
16624
16590
|
ref_key: "formInstanceRef",
|
|
16625
16591
|
ref: formInstanceRef,
|
|
16626
16592
|
model: _formData.value
|
|
16627
|
-
}, {
|
|
16593
|
+
}, { ...unref(injectAttrs), ..._ctx.$attrs }), {
|
|
16628
16594
|
default: withCtx(() => [
|
|
16629
16595
|
createVNode(unref(_sfc_main$4), {
|
|
16630
16596
|
fields: _fields.value,
|
|
@@ -16634,7 +16600,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16634
16600
|
renderSlot(_ctx.$slots, "default")
|
|
16635
16601
|
]),
|
|
16636
16602
|
_: 3
|
|
16637
|
-
},
|
|
16603
|
+
}, 16, ["model"]);
|
|
16638
16604
|
};
|
|
16639
16605
|
}
|
|
16640
16606
|
});
|
|
@@ -16643,7 +16609,6 @@ export {
|
|
|
16643
16609
|
BaseField as B,
|
|
16644
16610
|
COMPONENT_MAP as C,
|
|
16645
16611
|
FORM_ITEM_SLOT_KEYS as F,
|
|
16646
|
-
INJECT_COMPONENT_PROPS_KEYS as I,
|
|
16647
16612
|
RULE_TYPE_MAP as R,
|
|
16648
16613
|
UPDATE_FORM_DATA as U,
|
|
16649
16614
|
_sfc_main as _,
|
|
@@ -16659,14 +16624,13 @@ export {
|
|
|
16659
16624
|
UPDATE_ACTIVE_PATH as j,
|
|
16660
16625
|
FunctionRegexp as k,
|
|
16661
16626
|
ArrowFunctionRegexp as l,
|
|
16662
|
-
|
|
16663
|
-
|
|
16627
|
+
isFunctionString as m,
|
|
16628
|
+
jsonStringifyReplacer as n,
|
|
16664
16629
|
omit$1 as o,
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
useForm as u
|
|
16671
|
-
useInitProps as v
|
|
16630
|
+
jsonParseReviver as p,
|
|
16631
|
+
useFields as q,
|
|
16632
|
+
useFormData as r,
|
|
16633
|
+
useCommand as s,
|
|
16634
|
+
useInitProps as t,
|
|
16635
|
+
useForm as u
|
|
16672
16636
|
};
|
package/es/form/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { l, B, d, i, C, b, f, F, k,
|
|
1
|
+
import { l, B, d, i, C, b, f, F, k, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-1e0c8f68.js";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "ant-design-vue";
|
|
4
|
+
import "../component-provider/index.js";
|
|
4
5
|
export {
|
|
5
6
|
l as ArrowFunctionRegexp,
|
|
6
7
|
B as BaseField,
|
|
@@ -11,20 +12,18 @@ export {
|
|
|
11
12
|
f as FORM_DATA,
|
|
12
13
|
F as FORM_ITEM_SLOT_KEYS,
|
|
13
14
|
k as FunctionRegexp,
|
|
14
|
-
m as INIT_COMPONENT_PROPS_MAP,
|
|
15
|
-
I as INJECT_COMPONENT_PROPS_KEYS,
|
|
16
15
|
R as RULE_TYPE_MAP,
|
|
17
16
|
e as SlotComponent,
|
|
18
17
|
j as UPDATE_ACTIVE_PATH,
|
|
19
18
|
U as UPDATE_FORM_DATA,
|
|
20
19
|
h as UPDATE_REFS,
|
|
21
20
|
_ as default,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
m as isFunctionString,
|
|
22
|
+
p as jsonParseReviver,
|
|
23
|
+
n as jsonStringifyReplacer,
|
|
24
|
+
s as useCommand,
|
|
25
|
+
q as useFields,
|
|
27
26
|
u as useForm,
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
r as useFormData,
|
|
28
|
+
t as useInitProps
|
|
30
29
|
};
|