@vunk/form 1.4.2 → 1.4.4
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.
|
@@ -2083,13 +2083,24 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
2083
2083
|
}) {
|
|
2084
2084
|
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
2085
2085
|
const readonly = composables.useComputedReadonly(props2);
|
|
2086
|
+
const formData = vue.computed(() => {
|
|
2087
|
+
if (!props2.prop || props2.prop.length === 0) {
|
|
2088
|
+
return props2.modelValue;
|
|
2089
|
+
}
|
|
2090
|
+
const data = {};
|
|
2091
|
+
core.ensetData(data, {
|
|
2092
|
+
k: props2.prop,
|
|
2093
|
+
v: props2.modelValue
|
|
2094
|
+
});
|
|
2095
|
+
return data;
|
|
2096
|
+
});
|
|
2086
2097
|
const fullColumns = vue.computed(() => {
|
|
2087
2098
|
return props2.columns.map(column => {
|
|
2088
2099
|
return {
|
|
2089
2100
|
...column,
|
|
2090
2101
|
slots: e => vue.createVNode(formItemRenderer.VkfFormItemRenderer, {
|
|
2091
2102
|
"source": [{
|
|
2092
|
-
prop: [e.$index, column.prop].flat(),
|
|
2103
|
+
prop: [props2.prop ?? [], e.$index, column.prop].flat(),
|
|
2093
2104
|
templateType: column.templateType,
|
|
2094
2105
|
readonly: readonly.value,
|
|
2095
2106
|
...column.templateProps,
|
|
@@ -2130,9 +2141,9 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
2130
2141
|
emit("update:modelValue", [{}, ...props2.modelValue]);
|
|
2131
2142
|
};
|
|
2132
2143
|
const handleFormSetData = e => {
|
|
2133
|
-
const data = cloneDeep(
|
|
2144
|
+
const data = cloneDeep(formData.value);
|
|
2134
2145
|
core.ensetData(data, e);
|
|
2135
|
-
emit("update:modelValue", data);
|
|
2146
|
+
emit("update:modelValue", core.getValue(data, props2.prop));
|
|
2136
2147
|
};
|
|
2137
2148
|
return {
|
|
2138
2149
|
addToFirst,
|
|
@@ -2140,7 +2151,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
2140
2151
|
readonly,
|
|
2141
2152
|
fullColumns,
|
|
2142
2153
|
buttonsColumn,
|
|
2143
|
-
handleFormSetData
|
|
2154
|
+
handleFormSetData,
|
|
2155
|
+
formData
|
|
2144
2156
|
};
|
|
2145
2157
|
}
|
|
2146
2158
|
});
|
|
@@ -2159,7 +2171,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2159
2171
|
return vue.openBlock(), vue.createBlock(_component_VkfTemplateInstancesProvider, null, {
|
|
2160
2172
|
default: vue.withCtx(() => [
|
|
2161
2173
|
vue.createVNode(_component_VkfTemplatesDefault, {
|
|
2162
|
-
data: _ctx.
|
|
2174
|
+
data: _ctx.formData,
|
|
2163
2175
|
onSetData: _ctx.handleFormSetData
|
|
2164
2176
|
}, null, 8, ["data", "onSetData"]),
|
|
2165
2177
|
vue.createVNode(
|
|
@@ -6,7 +6,7 @@ import { useComputedReadonly } from '@vunk/form/composables';
|
|
|
6
6
|
import { VkfTemplatesDefault } from '@vunk/form/components/templates-default';
|
|
7
7
|
import { VkfTemplateInstancesProvider } from '@vunk/form/components/template-instances-provider';
|
|
8
8
|
import { VkfFormItemRenderer } from '@vunk/form/components/form-item-renderer';
|
|
9
|
-
import { ensetData } from '@vunk/core';
|
|
9
|
+
import { ensetData, getValue as getValue$1 } from '@vunk/core';
|
|
10
10
|
import { p as plus_default, f as minus_default } from '../index2.mjs';
|
|
11
11
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
12
12
|
|
|
@@ -2079,13 +2079,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2079
2079
|
}) {
|
|
2080
2080
|
const formItemBindProps = _VkfFormItemCtx.createBindProps(props2);
|
|
2081
2081
|
const readonly = useComputedReadonly(props2);
|
|
2082
|
+
const formData = computed(() => {
|
|
2083
|
+
if (!props2.prop || props2.prop.length === 0) {
|
|
2084
|
+
return props2.modelValue;
|
|
2085
|
+
}
|
|
2086
|
+
const data = {};
|
|
2087
|
+
ensetData(data, {
|
|
2088
|
+
k: props2.prop,
|
|
2089
|
+
v: props2.modelValue
|
|
2090
|
+
});
|
|
2091
|
+
return data;
|
|
2092
|
+
});
|
|
2082
2093
|
const fullColumns = computed(() => {
|
|
2083
2094
|
return props2.columns.map(column => {
|
|
2084
2095
|
return {
|
|
2085
2096
|
...column,
|
|
2086
2097
|
slots: e => createVNode(VkfFormItemRenderer, {
|
|
2087
2098
|
"source": [{
|
|
2088
|
-
prop: [e.$index, column.prop].flat(),
|
|
2099
|
+
prop: [props2.prop ?? [], e.$index, column.prop].flat(),
|
|
2089
2100
|
templateType: column.templateType,
|
|
2090
2101
|
readonly: readonly.value,
|
|
2091
2102
|
...column.templateProps,
|
|
@@ -2126,9 +2137,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2126
2137
|
emit("update:modelValue", [{}, ...props2.modelValue]);
|
|
2127
2138
|
};
|
|
2128
2139
|
const handleFormSetData = e => {
|
|
2129
|
-
const data = cloneDeep(
|
|
2140
|
+
const data = cloneDeep(formData.value);
|
|
2130
2141
|
ensetData(data, e);
|
|
2131
|
-
emit("update:modelValue", data);
|
|
2142
|
+
emit("update:modelValue", getValue$1(data, props2.prop));
|
|
2132
2143
|
};
|
|
2133
2144
|
return {
|
|
2134
2145
|
addToFirst,
|
|
@@ -2136,7 +2147,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2136
2147
|
readonly,
|
|
2137
2148
|
fullColumns,
|
|
2138
2149
|
buttonsColumn,
|
|
2139
|
-
handleFormSetData
|
|
2150
|
+
handleFormSetData,
|
|
2151
|
+
formData
|
|
2140
2152
|
};
|
|
2141
2153
|
}
|
|
2142
2154
|
});
|
|
@@ -2155,7 +2167,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2155
2167
|
return openBlock(), createBlock(_component_VkfTemplateInstancesProvider, null, {
|
|
2156
2168
|
default: withCtx(() => [
|
|
2157
2169
|
createVNode(_component_VkfTemplatesDefault, {
|
|
2158
|
-
data: _ctx.
|
|
2170
|
+
data: _ctx.formData,
|
|
2159
2171
|
onSetData: _ctx.handleFormSetData
|
|
2160
2172
|
}, null, 8, ["data", "onSetData"]),
|
|
2161
2173
|
createVNode(
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { __VkTableColumns } from '@vunk/plus/components/table-columns';
|
|
2
2
|
import { SetDataEvent } from '@vunk/core';
|
|
3
|
+
import { NormalObject } from '@vunk/shared';
|
|
3
4
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
5
|
columns: {
|
|
5
6
|
type: import("vue").PropType<import("./types").Column<any>[]>;
|
|
6
7
|
default: () => any[];
|
|
7
8
|
};
|
|
8
9
|
modelValue: {
|
|
9
|
-
type: import("vue").PropType<
|
|
10
|
+
type: import("vue").PropType<NormalObject[]>;
|
|
10
11
|
default: () => any[];
|
|
11
12
|
};
|
|
12
13
|
readonly: {
|
|
@@ -69,6 +70,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
69
70
|
fullColumns: import("vue").ComputedRef<__VkTableColumns.Source<import("@vunk/core").NormalObject>[]>;
|
|
70
71
|
buttonsColumn: import("vue").ComputedRef<__VkTableColumns.Source<import("@vunk/core").NormalObject>>;
|
|
71
72
|
handleFormSetData: (e: SetDataEvent) => void;
|
|
73
|
+
formData: import("vue").ComputedRef<NormalObject | NormalObject[]>;
|
|
72
74
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
73
75
|
'update:modelValue': any;
|
|
74
76
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -77,7 +79,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
77
79
|
default: () => any[];
|
|
78
80
|
};
|
|
79
81
|
modelValue: {
|
|
80
|
-
type: import("vue").PropType<
|
|
82
|
+
type: import("vue").PropType<NormalObject[]>;
|
|
81
83
|
default: () => any[];
|
|
82
84
|
};
|
|
83
85
|
readonly: {
|
|
@@ -145,7 +147,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
145
147
|
labelWidth: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
146
148
|
inlineMessage: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, BooleanConstructor], unknown, unknown>;
|
|
147
149
|
showMessage: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
148
|
-
modelValue:
|
|
150
|
+
modelValue: NormalObject[];
|
|
149
151
|
columns: import("./types").Column<any>[];
|
|
150
152
|
splicable: boolean;
|
|
151
153
|
}, {}, {
|