@vunk/form 1.1.2 → 1.1.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.
@@ -5,8 +5,14 @@ declare const _default: import("vue").DefineComponent<{
5
5
  defaultModelValue: {
6
6
  default: boolean;
7
7
  };
8
- value: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
9
8
  disabled: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
9
+ loading: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
10
+ size: {
11
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large") | ((new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large"))[], unknown, "" | "default" | "small" | "large">>;
12
+ readonly required: false;
13
+ readonly validator: ((val: unknown) => boolean) | undefined;
14
+ __epPropKey: true;
15
+ };
10
16
  width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
11
17
  inlinePrompt: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
12
18
  activeIcon: {
@@ -23,33 +29,27 @@ declare const _default: import("vue").DefineComponent<{
23
29
  };
24
30
  activeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
25
31
  inactiveText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
32
+ activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
33
+ inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
26
34
  activeColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
27
35
  inactiveColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
28
36
  borderColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
29
- activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
30
- inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
31
37
  name: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
32
38
  validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
33
- id: StringConstructor;
34
- loading: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
35
39
  beforeChange: {
36
40
  readonly type: import("vue").PropType<() => boolean | Promise<boolean>>;
37
41
  readonly required: false;
38
42
  readonly validator: ((val: unknown) => boolean) | undefined;
39
43
  __epPropKey: true;
40
44
  };
41
- size: {
42
- readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large") | ((new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large"))[], unknown, "" | "default" | "small" | "large">>;
43
- readonly required: false;
44
- readonly validator: ((val: unknown) => boolean) | undefined;
45
- __epPropKey: true;
46
- };
45
+ id: StringConstructor;
47
46
  tabindex: {
48
47
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
49
48
  readonly required: false;
50
49
  readonly validator: ((val: unknown) => boolean) | undefined;
51
50
  __epPropKey: true;
52
51
  };
52
+ value: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
53
53
  required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
54
54
  label: StringConstructor;
55
55
  labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
@@ -128,10 +128,10 @@ declare const _default: import("vue").DefineComponent<{
128
128
  inactiveIcon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) | ((new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>))[], unknown, unknown> | undefined;
129
129
  activeText: string;
130
130
  inactiveText: string;
131
- activeColor: string;
132
- inactiveColor: string;
133
131
  activeValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
134
132
  inactiveValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
133
+ activeColor: string;
134
+ inactiveColor: string;
135
135
  beforeChange: (() => boolean | Promise<boolean>) | undefined;
136
136
  }>;
137
137
  switchOnEmits: {
@@ -151,8 +151,14 @@ declare const _default: import("vue").DefineComponent<{
151
151
  defaultModelValue: {
152
152
  default: boolean;
153
153
  };
154
- value: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
155
154
  disabled: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
155
+ loading: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
156
+ size: {
157
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large") | ((new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large"))[], unknown, "" | "default" | "small" | "large">>;
158
+ readonly required: false;
159
+ readonly validator: ((val: unknown) => boolean) | undefined;
160
+ __epPropKey: true;
161
+ };
156
162
  width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
157
163
  inlinePrompt: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
158
164
  activeIcon: {
@@ -169,33 +175,27 @@ declare const _default: import("vue").DefineComponent<{
169
175
  };
170
176
  activeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
171
177
  inactiveText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
178
+ activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
179
+ inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
172
180
  activeColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
173
181
  inactiveColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
174
182
  borderColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
175
- activeValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, true, boolean>;
176
- inactiveValue: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
177
183
  name: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
178
184
  validateEvent: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
179
- id: StringConstructor;
180
- loading: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, false, boolean>;
181
185
  beforeChange: {
182
186
  readonly type: import("vue").PropType<() => boolean | Promise<boolean>>;
183
187
  readonly required: false;
184
188
  readonly validator: ((val: unknown) => boolean) | undefined;
185
189
  __epPropKey: true;
186
190
  };
187
- size: {
188
- readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large") | ((new (...args: any[]) => ("" | "default" | "small" | "large") & {}) | (() => "" | "default" | "small" | "large"))[], unknown, "" | "default" | "small" | "large">>;
189
- readonly required: false;
190
- readonly validator: ((val: unknown) => boolean) | undefined;
191
- __epPropKey: true;
192
- };
191
+ id: StringConstructor;
193
192
  tabindex: {
194
193
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
195
194
  readonly required: false;
196
195
  readonly validator: ((val: unknown) => boolean) | undefined;
197
196
  __epPropKey: true;
198
197
  };
198
+ value: import("element-plus/es/utils").EpPropFinalized<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown, false, boolean>;
199
199
  required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
200
200
  label: StringConstructor;
201
201
  labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
@@ -265,10 +265,10 @@ declare const _default: import("vue").DefineComponent<{
265
265
  inlinePrompt: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
266
266
  activeText: string;
267
267
  inactiveText: string;
268
- activeColor: string;
269
- inactiveColor: string;
270
268
  activeValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
271
269
  inactiveValue: import("element-plus/es/utils").EpPropMergeType<readonly [BooleanConstructor, StringConstructor, NumberConstructor], unknown, unknown>;
270
+ activeColor: string;
271
+ inactiveColor: string;
272
272
  defaultModelValue: boolean;
273
273
  }>;
274
274
  export default _default;
@@ -15,10 +15,24 @@ import { VkfButton } from '@vunk/form/components/button';
15
15
  import { VkfCascader } from '@vunk/form/components/cascader';
16
16
  import { VkfInputLink } from '@vunk/form/components/input-link';
17
17
 
18
+ const defaultIntoUndefined = (currentData, currentK, nextK) => {
19
+ if (nextK === void 0)
20
+ return;
21
+ if (typeof nextK === "number") {
22
+ currentData[currentK] = [];
23
+ } else {
24
+ currentData[currentK] = {};
25
+ }
26
+ };
27
+ const createIntoUndefined = () => defaultIntoUndefined;
18
28
  const props = {
19
29
  data: {
20
30
  type: Object,
21
31
  default: () => ({})
32
+ },
33
+ createIntoUndefined: {
34
+ type: Function,
35
+ default: createIntoUndefined
22
36
  }
23
37
  };
24
38
  const emits = {
@@ -52,10 +66,18 @@ const _sfc_main = defineComponent({
52
66
  },
53
67
  emits,
54
68
  props,
55
- setup() {
69
+ setup(props2) {
70
+ const getFormDataValue = (raw) => {
71
+ const prop = raw.prop;
72
+ const intoUndefined = props2.createIntoUndefined({
73
+ raw,
74
+ data: props2.data
75
+ });
76
+ return getValue(props2.data, prop, intoUndefined);
77
+ };
56
78
  return {
57
79
  pickObject,
58
- getValue
80
+ getFormDataValue
59
81
  };
60
82
  }
61
83
  });
@@ -81,10 +103,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
81
103
  _: 1
82
104
  }),
83
105
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfColorPicker" }, {
84
- default: withCtx(({ data: sourceData, templateIf }) => [
106
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
85
107
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfColorPicker, mergeProps({
86
108
  key: 0,
87
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
109
+ modelValue: _ctx.getFormDataValue(raw),
88
110
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
89
111
  k: sourceData.prop,
90
112
  v: $event
@@ -94,10 +116,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
94
116
  _: 1
95
117
  }),
96
118
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfUpload" }, {
97
- default: withCtx(({ data: sourceData, templateIf }) => [
119
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
98
120
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfUpload, mergeProps({
99
121
  key: 0,
100
- fileList: _ctx.getValue(_ctx.data, sourceData.prop),
122
+ fileList: _ctx.getFormDataValue(raw),
101
123
  "onUpdate:fileList": ($event) => _ctx.$emit("setData", {
102
124
  k: sourceData.prop,
103
125
  v: $event
@@ -107,10 +129,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
107
129
  _: 1
108
130
  }),
109
131
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfCheckbox" }, {
110
- default: withCtx(({ data: sourceData, templateIf }) => [
132
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
111
133
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfCheckbox, mergeProps({
112
134
  key: 0,
113
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
135
+ modelValue: _ctx.getFormDataValue(raw),
114
136
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
115
137
  k: sourceData.prop,
116
138
  v: $event
@@ -120,10 +142,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
120
142
  _: 1
121
143
  }),
122
144
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfRadio" }, {
123
- default: withCtx(({ data: sourceData, templateIf }) => [
145
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
124
146
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfRadio, mergeProps({
125
147
  key: 0,
126
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
148
+ modelValue: _ctx.getFormDataValue(raw),
127
149
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
128
150
  k: sourceData.prop,
129
151
  v: $event
@@ -133,10 +155,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
133
155
  _: 1
134
156
  }),
135
157
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfInput" }, {
136
- default: withCtx(({ data: sourceData, templateIf }) => [
158
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
137
159
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfInput, mergeProps({
138
160
  key: 0,
139
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
161
+ modelValue: _ctx.getFormDataValue(raw),
140
162
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
141
163
  k: sourceData.prop,
142
164
  v: $event
@@ -146,10 +168,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
146
168
  _: 1
147
169
  }),
148
170
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfSwitch" }, {
149
- default: withCtx(({ data: sourceData, templateIf }) => [
171
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
150
172
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfSwitch, mergeProps({
151
173
  key: 0,
152
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
174
+ modelValue: _ctx.getFormDataValue(raw),
153
175
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
154
176
  k: sourceData.prop,
155
177
  v: $event
@@ -159,10 +181,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
159
181
  _: 1
160
182
  }),
161
183
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfSelect" }, {
162
- default: withCtx(({ data: sourceData, templateIf }) => [
184
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
163
185
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfSelect, mergeProps({
164
186
  key: 0,
165
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
187
+ modelValue: _ctx.getFormDataValue(raw),
166
188
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
167
189
  k: sourceData.prop,
168
190
  v: $event
@@ -172,10 +194,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
172
194
  _: 1
173
195
  }),
174
196
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfDatePicker" }, {
175
- default: withCtx(({ data: sourceData, templateIf }) => [
197
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
176
198
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfDatePicker, mergeProps({
177
199
  key: 0,
178
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
200
+ modelValue: _ctx.getFormDataValue(raw),
179
201
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
180
202
  k: sourceData.prop,
181
203
  v: $event
@@ -185,10 +207,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
185
207
  _: 1
186
208
  }),
187
209
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfInputNumber" }, {
188
- default: withCtx(({ data: sourceData, templateIf }) => [
210
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
189
211
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfInputNumber, mergeProps({
190
212
  key: 0,
191
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
213
+ modelValue: _ctx.getFormDataValue(raw),
192
214
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
193
215
  k: sourceData.prop,
194
216
  v: $event
@@ -198,10 +220,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
198
220
  _: 1
199
221
  }),
200
222
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfCascader" }, {
201
- default: withCtx(({ data: sourceData, templateIf }) => [
223
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
202
224
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfCascader, mergeProps({
203
225
  key: 0,
204
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
226
+ modelValue: _ctx.getFormDataValue(raw),
205
227
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
206
228
  k: sourceData.prop,
207
229
  v: $event
@@ -211,10 +233,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
211
233
  _: 1
212
234
  }),
213
235
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfInputLink" }, {
214
- default: withCtx(({ data: sourceData, templateIf }) => [
236
+ default: withCtx(({ data: sourceData, templateIf, raw }) => [
215
237
  templateIf(_ctx.data) ? (openBlock(), createBlock(_component_VkfInputLink, mergeProps({
216
238
  key: 0,
217
- modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
239
+ modelValue: _ctx.getFormDataValue(raw),
218
240
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
219
241
  k: sourceData.prop,
220
242
  v: $event
@@ -5,6 +5,16 @@ export declare const props: {
5
5
  type: PropType<Record<string, any>>;
6
6
  default: () => {};
7
7
  };
8
+ createIntoUndefined: {
9
+ type: PropType<(arg: {
10
+ raw: any;
11
+ data: Record<string, any>;
12
+ }) => import("@vunk/core/shared/types").IntoUndefined>;
13
+ default: (arg: {
14
+ raw: any;
15
+ data: Record<string, any>;
16
+ }) => import("@vunk/core/shared/types").IntoUndefined;
17
+ };
8
18
  };
9
19
  export declare const emits: {
10
20
  setData: (e: SetDataEvent) => SetDataEvent<any>;
@@ -1,7 +1,21 @@
1
+ const defaultIntoUndefined = (currentData, currentK, nextK) => {
2
+ if (nextK === void 0)
3
+ return;
4
+ if (typeof nextK === "number") {
5
+ currentData[currentK] = [];
6
+ } else {
7
+ currentData[currentK] = {};
8
+ }
9
+ };
10
+ const createIntoUndefined = () => defaultIntoUndefined;
1
11
  const props = {
2
12
  data: {
3
13
  type: Object,
4
14
  default: () => ({})
15
+ },
16
+ createIntoUndefined: {
17
+ type: Function,
18
+ default: createIntoUndefined
5
19
  }
6
20
  };
7
21
  const emits = {
@@ -1,14 +1,25 @@
1
+ import { CoreSource } from './types';
1
2
  declare const _default: import("vue").DefineComponent<{
2
3
  data: {
3
4
  type: import("vue").PropType<Record<string, any>>;
4
5
  default: () => {};
5
6
  };
7
+ createIntoUndefined: {
8
+ type: import("vue").PropType<(arg: {
9
+ raw: any;
10
+ data: Record<string, any>;
11
+ }) => import("@vunk/core").IntoUndefined>;
12
+ default: (arg: {
13
+ raw: any;
14
+ data: Record<string, any>;
15
+ }) => import("@vunk/core").IntoUndefined;
16
+ };
6
17
  }, {
7
18
  pickObject: <T extends import("@vunk/core").NormalObject, EX extends (keyof T)[] | undefined, KI extends keyof T>(data: T, opts?: {
8
19
  excludes?: EX | undefined;
9
20
  includes?: KI[] | undefined;
10
21
  } | undefined) => { [P in EX extends (infer KE)[] ? Exclude<KI, KE> : KI]: T[P]; };
11
- getValue: (obj: any, k: string | number | any[], intoUndefined?: ((obj: any, k: string | number) => void) | undefined) => any;
22
+ getFormDataValue: (raw: CoreSource) => any;
12
23
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
24
  setData: (e: import("@vunk/core").SetDataEvent<any>) => import("@vunk/core").SetDataEvent<any>;
14
25
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -16,9 +27,23 @@ declare const _default: import("vue").DefineComponent<{
16
27
  type: import("vue").PropType<Record<string, any>>;
17
28
  default: () => {};
18
29
  };
30
+ createIntoUndefined: {
31
+ type: import("vue").PropType<(arg: {
32
+ raw: any;
33
+ data: Record<string, any>;
34
+ }) => import("@vunk/core").IntoUndefined>;
35
+ default: (arg: {
36
+ raw: any;
37
+ data: Record<string, any>;
38
+ }) => import("@vunk/core").IntoUndefined;
39
+ };
19
40
  }>> & {
20
41
  onSetData?: ((e: import("@vunk/core").SetDataEvent<any>) => any) | undefined;
21
42
  }, {
22
43
  data: Record<string, any>;
44
+ createIntoUndefined: (arg: {
45
+ raw: any;
46
+ data: Record<string, any>;
47
+ }) => import("@vunk/core").IntoUndefined;
23
48
  }>;
24
49
  export default _default;
@@ -11,6 +11,7 @@ import { __VkfUpload } from '@vunk/form/components/upload';
11
11
  import { __VkfColorPicker } from '@vunk/form/components/color-picker';
12
12
  import { __VkfCascader } from '@vunk/form/components/cascader';
13
13
  import { __VkfInputLink } from '@vunk/form/components/input-link';
14
+ import { IntoUndefined, Func } from '@vunk/core';
14
15
  export declare type VkfButtonSource<P extends string = string> = __VkfButton.Source<P>;
15
16
  export declare type VkfInputSource<P extends string = string> = __VkfInput.Source<P>;
16
17
  export declare type VkfDatePickerSource<P extends string = string> = __VkfDatePicker.Source<P>;
@@ -29,3 +30,22 @@ export interface ComponentSource extends BasicSource {
29
30
  }
30
31
  export declare type CoreSource<P extends string = string> = VkfInputSource<P> | VkfSwitchSource<P> | VkfSelectSource<P> | VkfDatePickerSource<P> | VkfInputNumberSource<P> | VkfRadioSource<P> | VkfCheckboxSource<P> | VkfUploadSource<P> | VkfColorPickerSource<P> | VkfButtonSource<P> | VkfCascaderSource<P> | VkfInputLinkSource<P>;
31
32
  export declare type Source<P extends string = string> = CoreSource<P> | ComponentSource;
33
+ /**
34
+ * @example
35
+ * ```ts
36
+ * const createIntoUndefined = ({ raw }) => {
37
+ * const objectFields = ['rules']
38
+ * const isObjectFields = objectFields.includes(raw.prop)
39
+ * return (currentData, currentK) => {
40
+ * )
41
+ * if (isObjectFields) {
42
+ * currentData[currentK] = {}
43
+ * }
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ export declare type CreateIntoUndefined = Func<{
49
+ raw: any;
50
+ data: Record<string, any>;
51
+ }, IntoUndefined>;
@@ -4,7 +4,7 @@ declare const _default: import("vue").DefineComponent<{
4
4
  default: () => {};
5
5
  };
6
6
  }, {
7
- getValue: (obj: any, k: string | number | any[], intoUndefined?: ((obj: any, k: string | number) => void) | undefined) => any;
7
+ getValue: (obj: any, k: any, intoUndefined?: import("@vunk/core").IntoUndefined | undefined) => any;
8
8
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  setData: (data: import("@vunk/core").SetDataEvent<any>) => import("@vunk/core").SetDataEvent<any>;
10
10
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -0,0 +1,4 @@
1
+ import VkfVditor from './src/index.vue';
2
+ export * as __VkfVditor from './src/types';
3
+ export { VkfVditor, };
4
+ export default VkfVditor;
@@ -0,0 +1,68 @@
1
+ import Vditor from 'vditor';
2
+ import { defineComponent, ref, onMounted, provide, openBlock, createElementBlock } from 'vue';
3
+
4
+ const props = {
5
+ modelValue: {
6
+ type: Object,
7
+ default: () => ({})
8
+ },
9
+ defaultOptions: {
10
+ type: Object,
11
+ default: () => ({})
12
+ }
13
+ };
14
+ const emits = {
15
+ load: (e) => e
16
+ };
17
+
18
+ var _export_sfc = (sfc, props) => {
19
+ const target = sfc.__vccOpts || sfc;
20
+ for (const [key, val] of props) {
21
+ target[key] = val;
22
+ }
23
+ return target;
24
+ };
25
+
26
+ const _sfc_main = defineComponent({
27
+ name: "VkfVditor",
28
+ emits,
29
+ props,
30
+ setup(props2, { emit }) {
31
+ const vditorNode = ref();
32
+ const ready = ref(false);
33
+ onMounted(() => {
34
+ const vditor = new Vditor(vditorNode.value, {
35
+ ...props2.defaultOptions,
36
+ cache: {
37
+ enable: true,
38
+ id: "VkfVditorCache",
39
+ ...props2.defaultOptions.cache || {}
40
+ },
41
+ after() {
42
+ ready.value = true;
43
+ emit("load", vditor);
44
+ provide("vkfVditor", vditor);
45
+ props2.defaultOptions.after?.();
46
+ }
47
+ });
48
+ });
49
+ return {
50
+ vditorNode
51
+ };
52
+ }
53
+ });
54
+ const _hoisted_1 = { ref: "vditorNode" };
55
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
56
+ return openBlock(), createElementBlock("div", _hoisted_1, null, 512);
57
+ }
58
+ var VkfVditor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "index.vue"]]);
59
+
60
+ var types = /*#__PURE__*/Object.freeze({
61
+ __proto__: null
62
+ });
63
+
64
+ VkfVditor.install = (app) => {
65
+ app.component(VkfVditor.name, VkfVditor);
66
+ };
67
+
68
+ export { VkfVditor, types as __VkfVditor, VkfVditor as default };
@@ -0,0 +1,15 @@
1
+ import { PropType } from 'vue';
2
+ import Vditor from 'vditor';
3
+ export declare const props: {
4
+ modelValue: {
5
+ type: PropType<unknown>;
6
+ default: () => {};
7
+ };
8
+ defaultOptions: {
9
+ type: PropType<IOptions>;
10
+ default: () => IOptions;
11
+ };
12
+ };
13
+ export declare const emits: {
14
+ load: (e: Vditor) => Vditor;
15
+ };
@@ -0,0 +1,15 @@
1
+ const props = {
2
+ modelValue: {
3
+ type: Object,
4
+ default: () => ({})
5
+ },
6
+ defaultOptions: {
7
+ type: Object,
8
+ default: () => ({})
9
+ }
10
+ };
11
+ const emits = {
12
+ load: (e) => e
13
+ };
14
+
15
+ export { emits, props };
@@ -0,0 +1,31 @@
1
+ import Vditor from 'vditor';
2
+ import { Ref } from 'vue';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ modelValue: {
5
+ type: import("vue").PropType<unknown>;
6
+ default: () => {};
7
+ };
8
+ defaultOptions: {
9
+ type: import("vue").PropType<IOptions>;
10
+ default: () => IOptions;
11
+ };
12
+ }, {
13
+ vditorNode: Ref<HTMLDivElement>;
14
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ load: (e: Vditor) => Vditor;
16
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
17
+ modelValue: {
18
+ type: import("vue").PropType<unknown>;
19
+ default: () => {};
20
+ };
21
+ defaultOptions: {
22
+ type: import("vue").PropType<IOptions>;
23
+ default: () => IOptions;
24
+ };
25
+ }>> & {
26
+ onLoad?: ((e: Vditor) => any) | undefined;
27
+ }, {
28
+ modelValue: {};
29
+ defaultOptions: IOptions;
30
+ }>;
31
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { NonVoidable } from '@vunk/core';
2
+ import Vditor from 'vditor';
3
+ export declare type DefaultOptions = NonVoidable<ConstructorParameters<typeof Vditor>[1]>;
4
+ export {};
@@ -0,0 +1 @@
1
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {