@qin-ui/element-plus-pro 1.0.8 → 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/AI-CONTEXT.md +49 -37
- package/LICENSE +9 -0
- package/api.json +45 -28
- package/bin/init-ai.mjs +0 -0
- package/es/components/component-provider/components/index.vue.d.ts +27 -0
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -0
- package/es/components/component-provider/constants/index.d.ts +16 -0
- package/es/components/component-provider/constants/index.d.ts.map +1 -0
- package/es/components/component-provider/index.d.ts +4 -0
- package/es/components/component-provider/index.d.ts.map +1 -0
- package/es/components/component-provider/types/index.d.ts +35 -0
- package/es/components/component-provider/types/index.d.ts.map +1 -0
- package/es/components/form/components/BaseField/index.vue.d.ts +13 -0
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -0
- package/es/components/form/components/BaseField/utils/index.d.ts +3 -0
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +9 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts +23 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts +31 -0
- package/es/components/form/components/GroupedFieldAttrs/index.vue.d.ts.map +1 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts +24 -0
- package/es/components/form/components/PathProvider/index.vue.d.ts.map +1 -0
- package/es/components/form/components/ProForm/index.vue.d.ts +36 -0
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts +7 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -0
- package/es/components/form/components/index.d.ts +12 -0
- package/es/components/form/components/index.d.ts.map +1 -0
- package/es/components/form/constants/index.d.ts +67 -0
- package/es/components/form/constants/index.d.ts.map +1 -0
- package/es/components/form/hooks/index.d.ts +5 -0
- package/es/components/form/hooks/index.d.ts.map +1 -0
- package/es/components/form/hooks/useFields.d.ts +57 -0
- package/es/components/form/hooks/useFields.d.ts.map +1 -0
- package/es/components/form/hooks/useForm.d.ts +93 -0
- package/es/components/form/hooks/useForm.d.ts.map +1 -0
- package/es/components/form/hooks/useFormRef.d.ts +30 -0
- package/es/components/form/hooks/useFormRef.d.ts.map +1 -0
- package/es/components/form/index.d.ts +7 -0
- package/es/components/form/index.d.ts.map +1 -0
- package/es/components/form/types/index.d.ts +234 -0
- package/es/components/form/types/index.d.ts.map +1 -0
- package/es/components/table/components/ColumnControl.vue.d.ts +9 -0
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts +18 -0
- package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -0
- package/es/components/table/components/ProTable.vue.d.ts +47 -0
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -0
- package/es/components/table/components/SearchForm.vue.d.ts +48 -0
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -0
- package/es/components/table/components/SizeControl.vue.d.ts +12 -0
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -0
- package/es/components/table/components/TableColumnRenderer.vue.d.ts +17 -0
- package/es/components/table/components/TableColumnRenderer.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/DownOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts +3 -0
- package/es/components/table/components/icons/FilterOutlined.vue.d.ts.map +1 -0
- package/es/components/table/components/index.d.ts +5 -0
- package/es/components/table/components/index.d.ts.map +1 -0
- package/es/components/table/index.d.ts +33 -0
- package/es/components/table/index.d.ts.map +1 -0
- package/es/components/table/types/index.d.ts +67 -0
- package/es/components/table/types/index.d.ts.map +1 -0
- package/es/components/table/useTable.d.ts +111 -0
- package/es/components/table/useTable.d.ts.map +1 -0
- package/es/element-plus-pro.css +10 -10
- package/es/index.d.ts +76 -1472
- package/es/index.d.ts.map +1 -0
- package/es/index.js +1534 -29
- package/es/index.js.map +1 -0
- package/es/shared/core/index.d.ts +6 -0
- package/es/shared/core/index.d.ts.map +1 -0
- package/es/shared/ui/index.d.ts +12 -0
- package/es/shared/ui/index.d.ts.map +1 -0
- package/package.json +20 -13
- package/src/components/component-provider/components/index.vue +67 -0
- package/src/components/component-provider/constants/index.ts +209 -0
- package/src/components/component-provider/index.ts +6 -0
- package/src/components/component-provider/types/index.ts +64 -0
- package/src/components/form/components/BaseField/index.vue +181 -0
- package/src/components/form/components/BaseField/utils/index.ts +15 -0
- package/src/components/form/components/BaseFormItem/index.vue +170 -0
- package/src/components/form/components/ContainerFragment/index.vue +24 -0
- package/src/components/form/components/GroupedFieldAttrs/index.vue +115 -0
- package/src/components/form/components/PathProvider/index.vue +19 -0
- package/src/components/form/components/ProForm/index.vue +106 -0
- package/src/components/form/components/SlotComponent/index.vue +26 -0
- package/src/components/form/components/index.ts +15 -0
- package/src/components/form/constants/index.ts +116 -0
- package/src/components/form/hooks/index.ts +5 -0
- package/src/components/form/hooks/useFields.ts +67 -0
- package/src/components/form/hooks/useForm.ts +110 -0
- package/src/components/form/hooks/useFormRef.ts +35 -0
- package/src/components/form/index.ts +29 -0
- package/src/components/form/types/index.ts +300 -0
- package/src/components/table/components/ColumnControl.vue +136 -0
- package/src/components/table/components/DefaultSearchFormContainer.vue +14 -0
- package/src/components/table/components/DefaultTableContainer.vue +14 -0
- package/src/components/table/components/ProTable.vue +420 -0
- package/src/components/table/components/SearchForm.vue +302 -0
- package/src/components/table/components/SizeControl.vue +55 -0
- package/src/components/table/components/TableColumnRenderer.vue +71 -0
- package/src/components/table/components/icons/ColumnHeightOutlined.vue +4 -0
- package/src/components/table/components/icons/DownOutlined.vue +4 -0
- package/src/components/table/components/icons/FilterOutlined.vue +4 -0
- package/src/components/table/components/index.ts +4 -0
- package/src/components/table/index.ts +38 -0
- package/src/components/table/types/index.ts +77 -0
- package/src/components/table/useTable.ts +144 -0
- package/src/index.ts +81 -0
- package/src/shared/core/index.ts +38 -0
- package/src/shared/ui/index.ts +106 -0
- package/es/component-provider/index-Bmx9Q9Q-.js +0 -220
- package/es/component-provider/index.js +0 -4
- package/es/core/index-C0Pbv44C.js +0 -360
- package/es/form/index-D8btGgqa.js +0 -470
- package/es/form/index.js +0 -13
- package/es/table/index.js +0 -856
- package/es/vendor/utils/lodash-es-p6jau26B.js +0 -1120
|
@@ -1,470 +0,0 @@
|
|
|
1
|
-
import { inject, computed, provide, toValue, defineComponent, renderSlot, mergeProps, normalizeProps, guardReactiveProps, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString, useSlots, watchEffect, withModifiers } from "vue";
|
|
2
|
-
import { ElFormItem, ElCol, ElTable, ElPagination, useFormDisabled, ElTransfer, ElTreeSelect, ElSlider, ElSwitch, ElRadioGroup, ElCheckboxGroup, ElTimeSelect, ElTimePicker, ElDatePicker, ElCascader, ElSelect, ElAutocomplete, ElInputNumber, ElInput, ElRow, ElForm } from "element-plus";
|
|
3
|
-
import { I as INJECT_CONFIG, g as getInjectConfig, a as INJECT_COMPONENTS } from "../component-provider/index-Bmx9Q9Q-.js";
|
|
4
|
-
import { I as InjectionPathKey, g as getObject, u as useForm$1, a as InjectionFormKey, c as camelizeProperties, b as useFields$1, d as useFormRef$1 } from "../core/index-C0Pbv44C.js";
|
|
5
|
-
import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
|
|
6
|
-
const tableProps = () => ElTable.props || {};
|
|
7
|
-
const paginationProps = () => ElPagination.props || {};
|
|
8
|
-
const gridItemProps = () => ElCol.props || {};
|
|
9
|
-
const formItemProps = () => ElFormItem.props || {};
|
|
10
|
-
const DisabledContextKey = Symbol("pro-form-disabled-context");
|
|
11
|
-
const useDisabledContext = () => {
|
|
12
|
-
const formDisabled = useFormDisabled();
|
|
13
|
-
return inject(
|
|
14
|
-
DisabledContextKey,
|
|
15
|
-
computed(() => !!formDisabled.value)
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
const useDisabledContextProvider = (disabled) => {
|
|
19
|
-
provide(
|
|
20
|
-
DisabledContextKey,
|
|
21
|
-
computed(() => !!toValue(disabled))
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
const FORM_ITEM_SLOT_KEYS = ["label", "error"];
|
|
25
|
-
const componentMap = {
|
|
26
|
-
"input": ElInput,
|
|
27
|
-
"input-number": ElInputNumber,
|
|
28
|
-
"autocomplete": ElAutocomplete,
|
|
29
|
-
"select": ElSelect,
|
|
30
|
-
"cascader": ElCascader,
|
|
31
|
-
"date-picker": ElDatePicker,
|
|
32
|
-
"time-picker": ElTimePicker,
|
|
33
|
-
"time-select": ElTimeSelect,
|
|
34
|
-
"checkbox-group": ElCheckboxGroup,
|
|
35
|
-
"radio-group": ElRadioGroup,
|
|
36
|
-
"switch": ElSwitch,
|
|
37
|
-
"slider": ElSlider,
|
|
38
|
-
"tree-select": ElTreeSelect,
|
|
39
|
-
"transfer": ElTransfer
|
|
40
|
-
};
|
|
41
|
-
const TeleportComponentNamePrefix = "TeleportComponent_";
|
|
42
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
43
|
-
__name: "index",
|
|
44
|
-
props: {
|
|
45
|
-
path: {}
|
|
46
|
-
},
|
|
47
|
-
setup(__props) {
|
|
48
|
-
const props = __props;
|
|
49
|
-
const namePath = computed(() => {
|
|
50
|
-
return Array.isArray(props.path) ? props.path.join(".") : props.path;
|
|
51
|
-
});
|
|
52
|
-
provide(InjectionPathKey, namePath);
|
|
53
|
-
return (_ctx, _cache) => {
|
|
54
|
-
return renderSlot(_ctx.$slots, "default", { path: namePath.value });
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
59
|
-
__name: "index",
|
|
60
|
-
props: {
|
|
61
|
-
field: {}
|
|
62
|
-
},
|
|
63
|
-
setup(__props) {
|
|
64
|
-
const formItemPropKeys = Object.keys(formItemProps());
|
|
65
|
-
const gridItemPropKeys = Object.keys(gridItemProps());
|
|
66
|
-
const props = __props;
|
|
67
|
-
const config = INJECT_CONFIG["pro-form-item"];
|
|
68
|
-
const injectFormItemProps = inject(config.injectionKey, config.default);
|
|
69
|
-
const groupedAttributes = computed(() => {
|
|
70
|
-
let gridItemProps2 = {};
|
|
71
|
-
let formItemProps2 = {};
|
|
72
|
-
const componentProps = { slots: {} };
|
|
73
|
-
const formItemSlots = {};
|
|
74
|
-
if (isPlainObject(props.field)) {
|
|
75
|
-
const { path, name, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = props.field;
|
|
76
|
-
const {
|
|
77
|
-
class: injectClassName,
|
|
78
|
-
style: injectStyle,
|
|
79
|
-
span: injectSpan,
|
|
80
|
-
formItemContainer: injectFormItemContainer,
|
|
81
|
-
xs,
|
|
82
|
-
sm,
|
|
83
|
-
md,
|
|
84
|
-
lg,
|
|
85
|
-
xl,
|
|
86
|
-
...injectRest
|
|
87
|
-
} = injectFormItemProps;
|
|
88
|
-
const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, span: injectSpan };
|
|
89
|
-
gridItemProps2 = fields ? { span: span ?? 24 } : initGridItemProps;
|
|
90
|
-
formItemProps2 = mergeProps(
|
|
91
|
-
injectRest,
|
|
92
|
-
{ class: injectClassName, style: injectStyle },
|
|
93
|
-
{ class: toValue(formItemClass), style: toValue(formItemStyle) },
|
|
94
|
-
formItemDataAttrs
|
|
95
|
-
);
|
|
96
|
-
formItemProps2.container = formItemContainer ?? injectFormItemContainer;
|
|
97
|
-
Object.keys(rest).forEach((k) => {
|
|
98
|
-
if (gridItemPropKeys.includes(k)) {
|
|
99
|
-
gridItemProps2[k] = rest[k];
|
|
100
|
-
} else if (formItemPropKeys.includes(k)) {
|
|
101
|
-
formItemProps2[k] = rest[k];
|
|
102
|
-
} else {
|
|
103
|
-
componentProps[k] = rest[k];
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
Object.assign(componentProps, componentDataAttrs);
|
|
107
|
-
Object.keys(slots).forEach((k) => {
|
|
108
|
-
if (FORM_ITEM_SLOT_KEYS.includes(k)) {
|
|
109
|
-
formItemSlots[k] = slots[k];
|
|
110
|
-
} else {
|
|
111
|
-
componentProps["slots"][k] = slots[k];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return { gridItemProps: gridItemProps2, formItemProps: formItemProps2, componentProps, formItemSlots };
|
|
116
|
-
});
|
|
117
|
-
return (_ctx, _cache) => {
|
|
118
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(groupedAttributes.value)));
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
123
|
-
...{ name: "BaseFormItem", inheritAttrs: false },
|
|
124
|
-
__name: "index",
|
|
125
|
-
props: {
|
|
126
|
-
grid: { type: [Boolean, Object], default: () => void 0 },
|
|
127
|
-
fields: { default: () => [] },
|
|
128
|
-
disabled: { type: Boolean, default: () => void 0 }
|
|
129
|
-
},
|
|
130
|
-
setup(__props) {
|
|
131
|
-
const validFields = computed(() => {
|
|
132
|
-
var _a, _b;
|
|
133
|
-
return (_b = (_a = __props.fields).filter) == null ? void 0 : _b.call(_a, (field) => !field.hidden);
|
|
134
|
-
});
|
|
135
|
-
useDisabledContextProvider(computed(() => __props.disabled));
|
|
136
|
-
const config = INJECT_CONFIG["pro-form"];
|
|
137
|
-
const { grid: injectGrid } = inject(config.injectionKey, config.default);
|
|
138
|
-
const enableGrid = computed(() => {
|
|
139
|
-
if (__props.grid !== void 0) return !!__props.grid;
|
|
140
|
-
return !!injectGrid;
|
|
141
|
-
});
|
|
142
|
-
const computedGridProps = computed(() => {
|
|
143
|
-
return enableGrid.value ? { ...getObject(injectGrid), ...getObject(__props.grid) } : {};
|
|
144
|
-
});
|
|
145
|
-
const formItemRefs = [];
|
|
146
|
-
const componentRefs = [];
|
|
147
|
-
const onFormItemMounted = (index, formItemProps2) => {
|
|
148
|
-
const field = validFields.value[index];
|
|
149
|
-
Object.assign(field, {
|
|
150
|
-
getFormItemRef: () => formItemRefs[index],
|
|
151
|
-
getFormItemComputedProps: () => formItemProps2
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
const onComponentMounted = (index) => {
|
|
155
|
-
const field = validFields.value[index];
|
|
156
|
-
Object.assign(field, {
|
|
157
|
-
getComponentRef: () => {
|
|
158
|
-
var _a;
|
|
159
|
-
return (_a = componentRefs[index]) == null ? void 0 : _a.getComponentRef();
|
|
160
|
-
},
|
|
161
|
-
getComponentComputedProps: () => {
|
|
162
|
-
var _a;
|
|
163
|
-
return (_a = componentRefs[index]) == null ? void 0 : _a.getComponentComputedProps();
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
return (_ctx, _cache) => {
|
|
168
|
-
const _component_BaseFormItem = resolveComponent("BaseFormItem");
|
|
169
|
-
return openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
|
|
170
|
-
component: enableGrid.value ? unref(ElRow) : void 0
|
|
171
|
-
}, computedGridProps.value, { style: { "width": "100%" } }), {
|
|
172
|
-
default: withCtx(() => [
|
|
173
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(validFields.value, ({ path: _path, ...field }, index) => {
|
|
174
|
-
return openBlock(), createBlock(_sfc_main$6, mergeProps({
|
|
175
|
-
key: unref(toPath)(toValue(_path ?? index)).join(".") || index
|
|
176
|
-
}, { ref_for: true }, { path: _path }), {
|
|
177
|
-
default: withCtx(({ path }) => [
|
|
178
|
-
createVNode(_sfc_main$5, { field }, {
|
|
179
|
-
default: withCtx(({
|
|
180
|
-
gridItemProps: gridItemProps2,
|
|
181
|
-
formItemProps: { container, ...formItemProps2 },
|
|
182
|
-
componentProps,
|
|
183
|
-
formItemSlots
|
|
184
|
-
}) => [
|
|
185
|
-
createVNode(unref(_sfc_main$2), mergeProps({
|
|
186
|
-
component: enableGrid.value ? unref(ElCol) : void 0
|
|
187
|
-
}, { ref_for: true }, gridItemProps2), {
|
|
188
|
-
default: withCtx(() => [
|
|
189
|
-
createVNode(unref(_sfc_main$2), {
|
|
190
|
-
component: container,
|
|
191
|
-
path
|
|
192
|
-
}, {
|
|
193
|
-
default: withCtx(() => [
|
|
194
|
-
createVNode(unref(ElFormItem), mergeProps({ ref_for: true }, formItemProps2, {
|
|
195
|
-
ref_for: true,
|
|
196
|
-
ref: (el) => formItemRefs[index] = el,
|
|
197
|
-
prop: unref(toPath)(path).join("."),
|
|
198
|
-
path,
|
|
199
|
-
onVnodeMounted: ($event) => onFormItemMounted(index, formItemProps2)
|
|
200
|
-
}), createSlots({
|
|
201
|
-
default: withCtx(() => [
|
|
202
|
-
field.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
|
|
203
|
-
key: 0,
|
|
204
|
-
grid: field.grid ?? __props.grid,
|
|
205
|
-
fields: field.fields,
|
|
206
|
-
disabled: toValue(field.disabled)
|
|
207
|
-
}, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$3), mergeProps({
|
|
208
|
-
key: 1,
|
|
209
|
-
ref_for: true,
|
|
210
|
-
ref: (el) => componentRefs[index] = el
|
|
211
|
-
}, { ref_for: true }, componentProps, {
|
|
212
|
-
path,
|
|
213
|
-
onVnodeMounted: ($event) => onComponentMounted(index)
|
|
214
|
-
}), null, 16, ["path", "onVnodeMounted"]))
|
|
215
|
-
]),
|
|
216
|
-
_: 2
|
|
217
|
-
}, [
|
|
218
|
-
renderList(formItemSlots, (slot, name) => {
|
|
219
|
-
return {
|
|
220
|
-
name,
|
|
221
|
-
fn: withCtx((scoped) => [
|
|
222
|
-
createVNode(unref(_sfc_main$1), mergeProps({
|
|
223
|
-
path,
|
|
224
|
-
component: slot
|
|
225
|
-
}, { ref_for: true }, scoped), null, 16, ["path", "component"])
|
|
226
|
-
])
|
|
227
|
-
};
|
|
228
|
-
})
|
|
229
|
-
]), 1040, ["prop", "path", "onVnodeMounted"])
|
|
230
|
-
]),
|
|
231
|
-
_: 2
|
|
232
|
-
}, 1032, ["component", "path"])
|
|
233
|
-
]),
|
|
234
|
-
_: 2
|
|
235
|
-
}, 1040, ["component"])
|
|
236
|
-
]),
|
|
237
|
-
_: 2
|
|
238
|
-
}, 1032, ["field"])
|
|
239
|
-
]),
|
|
240
|
-
_: 2
|
|
241
|
-
}, 1040);
|
|
242
|
-
}), 128))
|
|
243
|
-
]),
|
|
244
|
-
_: 1
|
|
245
|
-
}, 16, ["component"]);
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
const _export_sfc = (sfc, props) => {
|
|
250
|
-
const target = sfc.__vccOpts || sfc;
|
|
251
|
-
for (const [key, val] of props) {
|
|
252
|
-
target[key] = val;
|
|
253
|
-
}
|
|
254
|
-
return target;
|
|
255
|
-
};
|
|
256
|
-
const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1dd9fcdd"]]);
|
|
257
|
-
const useForm = useForm$1;
|
|
258
|
-
const getInitProps = (field) => {
|
|
259
|
-
const { component, type } = field;
|
|
260
|
-
if (typeof component === "string") {
|
|
261
|
-
const k = [component, type].filter(Boolean).join(".");
|
|
262
|
-
const config = getInjectConfig(k);
|
|
263
|
-
if (!config) return {};
|
|
264
|
-
const injectProps = inject(config.injectionKey, config.default);
|
|
265
|
-
return injectProps;
|
|
266
|
-
}
|
|
267
|
-
return {};
|
|
268
|
-
};
|
|
269
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
270
|
-
...{ name: "BaseField", inheritAttrs: false },
|
|
271
|
-
__name: "index",
|
|
272
|
-
props: {
|
|
273
|
-
component: { default: () => void 0 },
|
|
274
|
-
path: { default: "" }
|
|
275
|
-
},
|
|
276
|
-
setup(__props, { expose: __expose }) {
|
|
277
|
-
const form = useForm(false);
|
|
278
|
-
const { getFormData, setFormData } = form;
|
|
279
|
-
const componentRef = ref();
|
|
280
|
-
const attrs = useAttrs();
|
|
281
|
-
function getOldValue() {
|
|
282
|
-
return cloneDeep(getFormData == null ? void 0 : getFormData(__props.path));
|
|
283
|
-
}
|
|
284
|
-
const value = computed({
|
|
285
|
-
get() {
|
|
286
|
-
let val = getFormData == null ? void 0 : getFormData(__props.path);
|
|
287
|
-
const { valueFormatter } = groupedAttrs.value;
|
|
288
|
-
if (typeof valueFormatter === "object" && typeof valueFormatter.get === "function") {
|
|
289
|
-
val = valueFormatter.get(val);
|
|
290
|
-
}
|
|
291
|
-
return val;
|
|
292
|
-
},
|
|
293
|
-
set(val) {
|
|
294
|
-
let newVal = val;
|
|
295
|
-
const { valueFormatter } = groupedAttrs.value;
|
|
296
|
-
if (valueFormatter) {
|
|
297
|
-
if (typeof valueFormatter === "function") {
|
|
298
|
-
newVal = valueFormatter(val, getOldValue());
|
|
299
|
-
} else if (typeof valueFormatter.set === "function") {
|
|
300
|
-
newVal = valueFormatter.set(val, getOldValue());
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
setFormData == null ? void 0 : setFormData(__props.path, newVal);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
const parentDisabled = useDisabledContext();
|
|
307
|
-
const groupedAttrs = computed(() => {
|
|
308
|
-
const initProps = getInitProps({
|
|
309
|
-
component: __props.component,
|
|
310
|
-
type: attrs.type
|
|
311
|
-
});
|
|
312
|
-
const modelPropName = attrs.modelProp ?? initProps.modelProp ?? "modelValue";
|
|
313
|
-
const mergedProps = mergeProps(
|
|
314
|
-
initProps,
|
|
315
|
-
attrs,
|
|
316
|
-
{ class: attrs.componentClass, style: attrs.componentStyle },
|
|
317
|
-
{ class: initProps.componentClass, style: initProps.componentStyle },
|
|
318
|
-
{ disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
|
|
319
|
-
{ modelProp: modelPropName }
|
|
320
|
-
);
|
|
321
|
-
const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, ...rest } = mergedProps;
|
|
322
|
-
const modelBindingProp = modelProp ?? "modelValue";
|
|
323
|
-
const bindAttrs = omit(rest, [
|
|
324
|
-
modelBindingProp,
|
|
325
|
-
`onUpdate:${modelBindingProp}`
|
|
326
|
-
]);
|
|
327
|
-
return {
|
|
328
|
-
attrs: bindAttrs,
|
|
329
|
-
slots,
|
|
330
|
-
componentContainer,
|
|
331
|
-
modelProp: modelBindingProp,
|
|
332
|
-
valueFormatter
|
|
333
|
-
};
|
|
334
|
-
});
|
|
335
|
-
const teleportComponent = inject(
|
|
336
|
-
`${TeleportComponentNamePrefix}${__props.path}`,
|
|
337
|
-
void 0
|
|
338
|
-
);
|
|
339
|
-
const customComponents = inject(INJECT_COMPONENTS, {});
|
|
340
|
-
const is = computed(() => {
|
|
341
|
-
if (teleportComponent) return teleportComponent;
|
|
342
|
-
if (typeof __props.component === "string") {
|
|
343
|
-
return customComponents[__props.component] || componentMap[__props.component] || __props.component;
|
|
344
|
-
}
|
|
345
|
-
return __props.component;
|
|
346
|
-
});
|
|
347
|
-
__expose({
|
|
348
|
-
getComponentRef: () => componentRef.value,
|
|
349
|
-
getComponentComputedProps: () => groupedAttrs.value.attrs
|
|
350
|
-
});
|
|
351
|
-
return (_ctx, _cache) => {
|
|
352
|
-
return openBlock(), createBlock(unref(_sfc_main$2), {
|
|
353
|
-
component: groupedAttrs.value.componentContainer,
|
|
354
|
-
path: __props.path
|
|
355
|
-
}, {
|
|
356
|
-
default: withCtx(() => [
|
|
357
|
-
is.value ? (openBlock(), createBlock(resolveDynamicComponent(is.value), mergeProps({ key: 0 }, groupedAttrs.value.attrs, {
|
|
358
|
-
ref_key: "componentRef",
|
|
359
|
-
ref: componentRef,
|
|
360
|
-
[`${groupedAttrs.value.modelProp}`]: value.value,
|
|
361
|
-
[`onUpdate:${groupedAttrs.value.modelProp}`]: _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
362
|
-
path: __props.path
|
|
363
|
-
}), createSlots({ _: 2 }, [
|
|
364
|
-
renderList(groupedAttrs.value.slots, (slot, name) => {
|
|
365
|
-
return {
|
|
366
|
-
name,
|
|
367
|
-
fn: withCtx((scoped) => [
|
|
368
|
-
createVNode(unref(_sfc_main$1), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
369
|
-
])
|
|
370
|
-
};
|
|
371
|
-
})
|
|
372
|
-
]), 1040, ["path"])) : createCommentVNode("", true)
|
|
373
|
-
]),
|
|
374
|
-
_: 1
|
|
375
|
-
}, 8, ["component", "path"]);
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
380
|
-
...{ name: "ContainerFragment", inheritAttrs: false },
|
|
381
|
-
__name: "index",
|
|
382
|
-
props: {
|
|
383
|
-
component: { type: [Object, Function] }
|
|
384
|
-
},
|
|
385
|
-
setup(__props) {
|
|
386
|
-
return (_ctx, _cache) => {
|
|
387
|
-
return __props.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), {
|
|
388
|
-
default: withCtx(() => [
|
|
389
|
-
renderSlot(_ctx.$slots, "default")
|
|
390
|
-
]),
|
|
391
|
-
_: 3
|
|
392
|
-
}, 16)) : renderSlot(_ctx.$slots, "default", { key: 1 });
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
397
|
-
...{ name: "SlotComponent", inheritAttrs: false },
|
|
398
|
-
__name: "index",
|
|
399
|
-
props: {
|
|
400
|
-
component: { type: [Object, Function, String, Number, Boolean, null] }
|
|
401
|
-
},
|
|
402
|
-
setup(__props) {
|
|
403
|
-
return (_ctx, _cache) => {
|
|
404
|
-
return isVNode(__props.component) || typeof __props.component === "function" ? (openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), null, 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
405
|
-
createTextVNode(toDisplayString(__props.component), 1)
|
|
406
|
-
], 64));
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
411
|
-
...{ name: "ProForm", inheritAttrs: false },
|
|
412
|
-
__name: "index",
|
|
413
|
-
props: {
|
|
414
|
-
grid: { type: [Boolean, Object], default: false },
|
|
415
|
-
form: { default: () => ({}) }
|
|
416
|
-
},
|
|
417
|
-
setup(__props) {
|
|
418
|
-
provide(InjectionFormKey, __props.form);
|
|
419
|
-
const { formData, fields, setFormRef } = __props.form;
|
|
420
|
-
const _fields = computed(() => fields.value);
|
|
421
|
-
const config = INJECT_CONFIG["pro-form"];
|
|
422
|
-
const attrs = useAttrs();
|
|
423
|
-
const { grid: _injectGrid, ...injectAttrs } = inject(
|
|
424
|
-
config.injectionKey,
|
|
425
|
-
config.default
|
|
426
|
-
);
|
|
427
|
-
const slots = useSlots();
|
|
428
|
-
watchEffect(() => {
|
|
429
|
-
Object.keys(slots).forEach((name) => {
|
|
430
|
-
if (name === "default") return;
|
|
431
|
-
provide(`${TeleportComponentNamePrefix}${name}`, slots[name]);
|
|
432
|
-
});
|
|
433
|
-
});
|
|
434
|
-
return (_ctx, _cache) => {
|
|
435
|
-
return openBlock(), createBlock(unref(ElForm), mergeProps({
|
|
436
|
-
ref: (el) => {
|
|
437
|
-
var _a;
|
|
438
|
-
return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
|
|
439
|
-
},
|
|
440
|
-
model: unref(formData)
|
|
441
|
-
}, mergeProps(injectAttrs, unref(camelizeProperties)(unref(attrs))), {
|
|
442
|
-
class: "pro-form",
|
|
443
|
-
onSubmit: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
444
|
-
}, ["prevent"]))
|
|
445
|
-
}), {
|
|
446
|
-
default: withCtx(() => [
|
|
447
|
-
createVNode(unref(BaseFormItem), {
|
|
448
|
-
fields: _fields.value,
|
|
449
|
-
grid: __props.grid
|
|
450
|
-
}, null, 8, ["fields", "grid"]),
|
|
451
|
-
renderSlot(_ctx.$slots, "default")
|
|
452
|
-
]),
|
|
453
|
-
_: 3
|
|
454
|
-
}, 16, ["model"]);
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
});
|
|
458
|
-
const useFields = useFields$1;
|
|
459
|
-
const useFormRef = useFormRef$1;
|
|
460
|
-
export {
|
|
461
|
-
_export_sfc as _,
|
|
462
|
-
_sfc_main as a,
|
|
463
|
-
_sfc_main$2 as b,
|
|
464
|
-
_sfc_main$1 as c,
|
|
465
|
-
useFields as d,
|
|
466
|
-
useFormRef as e,
|
|
467
|
-
paginationProps as p,
|
|
468
|
-
tableProps as t,
|
|
469
|
-
useForm as u
|
|
470
|
-
};
|
package/es/form/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { b, c, a, d, u, e } from "./index-D8btGgqa.js";
|
|
2
|
-
import "vue";
|
|
3
|
-
import { e as e2 } from "../core/index-C0Pbv44C.js";
|
|
4
|
-
import "element-plus";
|
|
5
|
-
export {
|
|
6
|
-
b as ContainerFragment,
|
|
7
|
-
c as SlotComponent,
|
|
8
|
-
a as default,
|
|
9
|
-
d as useFields,
|
|
10
|
-
u as useForm,
|
|
11
|
-
e2 as useFormData,
|
|
12
|
-
e as useFormRef
|
|
13
|
-
};
|