@vunk/form 0.0.1-alpha.10 → 0.0.1-alpha.13

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.
@@ -65,11 +65,25 @@ const VkfFormItemRenderer = defineComponent({
65
65
  const slotData = __spreadValues({}, c);
66
66
  Reflect.deleteProperty(slotData, "templateType");
67
67
  Reflect.deleteProperty(slotData, "templateSlots");
68
+ Reflect.deleteProperty(slotData, "templateIf");
69
+ const createIsShow = () => {
70
+ if (typeof c.templateIf === "boolean") {
71
+ const flag = c.templateIf;
72
+ return () => flag;
73
+ } else if (typeof c.templateIf === "string") {
74
+ const templateIf = new Function("data", c.templateIf);
75
+ return templateIf;
76
+ } else if (typeof c.templateIf === "function") {
77
+ return c.templateIf;
78
+ }
79
+ return () => true;
80
+ };
68
81
  const nodes = (_b = (_a2 = templateInstances[c.templateType].slots).default) == null ? void 0 : _b.call(_a2, {
69
82
  data: slotData,
70
83
  raw: c,
71
84
  Renderer,
72
- k: currentK
85
+ k: currentK,
86
+ isShow: createIsShow()
73
87
  });
74
88
  nodes && a.push(nodes);
75
89
  } else if ((_c = c.templateSlots) == null ? void 0 : _c.default) {
@@ -1,5 +1,7 @@
1
+ import { NormalObject } from '@vunk/core';
1
2
  export interface RendererTreeData {
2
3
  templateType?: string;
3
4
  templateSlots?: any;
5
+ templateIf?: string | ((e: NormalObject) => boolean) | boolean;
4
6
  [k: string]: any;
5
7
  }
@@ -1,4 +1,4 @@
1
- import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, mergeProps, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps } from 'vue';
1
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createBlock, mergeProps, createCommentVNode, resolveDynamicComponent, normalizeProps } from 'vue';
2
2
  import { VkfFormItemRendererTemplate } from '@vunk/form/components/form-item-renderer-template';
3
3
  import { VkfInput } from '@vunk/form/components/input';
4
4
  import { VkfSwitch } from '@vunk/form/components/switch';
@@ -47,68 +47,73 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
47
47
  const _component_VkfInputNumber = resolveComponent("VkfInputNumber");
48
48
  return openBlock(), createElementBlock(Fragment, null, [
49
49
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfInput" }, {
50
- default: withCtx(({ data: sourceData }) => [
51
- createVNode(_component_VkfInput, mergeProps({
50
+ default: withCtx(({ data: sourceData, isShow }) => [
51
+ isShow(_ctx.data) ? (openBlock(), createBlock(_component_VkfInput, mergeProps({
52
+ key: 0,
52
53
  modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
53
54
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
54
55
  k: sourceData.prop,
55
56
  v: $event
56
57
  })
57
- }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])
58
+ }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
58
59
  ]),
59
60
  _: 1
60
61
  }),
61
62
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfSwitch" }, {
62
- default: withCtx(({ data: sourceData }) => [
63
- createVNode(_component_VkfSwitch, mergeProps({
63
+ default: withCtx(({ data: sourceData, isShow }) => [
64
+ isShow(_ctx.data) ? (openBlock(), createBlock(_component_VkfSwitch, mergeProps({
65
+ key: 0,
64
66
  modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
65
67
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
66
68
  k: sourceData.prop,
67
69
  v: $event
68
70
  })
69
- }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])
71
+ }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
70
72
  ]),
71
73
  _: 1
72
74
  }),
73
75
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfSelect" }, {
74
- default: withCtx(({ data: sourceData }) => [
75
- createVNode(_component_VkfSelect, mergeProps({
76
+ default: withCtx(({ data: sourceData, isShow }) => [
77
+ isShow(_ctx.data) ? (openBlock(), createBlock(_component_VkfSelect, mergeProps({
78
+ key: 0,
76
79
  modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
77
80
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
78
81
  k: sourceData.prop,
79
82
  v: $event
80
83
  })
81
- }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])
84
+ }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
82
85
  ]),
83
86
  _: 1
84
87
  }),
85
88
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfDatePicker" }, {
86
- default: withCtx(({ data: sourceData }) => [
87
- createVNode(_component_VkfDatePicker, mergeProps({
89
+ default: withCtx(({ data: sourceData, isShow }) => [
90
+ isShow(_ctx.data) ? (openBlock(), createBlock(_component_VkfDatePicker, mergeProps({
91
+ key: 0,
88
92
  modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
89
93
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
90
94
  k: sourceData.prop,
91
95
  v: $event
92
96
  })
93
- }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])
97
+ }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
94
98
  ]),
95
99
  _: 1
96
100
  }),
97
101
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfInputNumber" }, {
98
- default: withCtx(({ data: sourceData }) => [
99
- createVNode(_component_VkfInputNumber, mergeProps({
102
+ default: withCtx(({ data: sourceData, isShow }) => [
103
+ isShow(_ctx.data) ? (openBlock(), createBlock(_component_VkfInputNumber, mergeProps({
104
+ key: 0,
100
105
  modelValue: _ctx.getValue(_ctx.data, sourceData.prop),
101
106
  "onUpdate:modelValue": ($event) => _ctx.$emit("setData", {
102
107
  k: sourceData.prop,
103
108
  v: $event
104
109
  })
105
- }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])
110
+ }, sourceData), null, 16, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("v-if", true)
106
111
  ]),
107
112
  _: 1
108
113
  }),
109
114
  createVNode(_component_VkfFormItemRendererTemplate, { type: "Component" }, {
110
- default: withCtx(({ data, raw }) => [
111
- (openBlock(), createBlock(resolveDynamicComponent(typeof data.is === "function" ? data.is(raw) : data.is), normalizeProps(guardReactiveProps(_ctx.pickObject(data, { excludes: ["is"] }))), null, 16))
115
+ default: withCtx(({ data, raw, isShow }) => [
116
+ isShow(data) ? (openBlock(), createBlock(resolveDynamicComponent(typeof data.is === "function" ? data.is(raw) : data.is), normalizeProps(mergeProps({ key: 0 }, _ctx.pickObject(data, { excludes: ["is"] }))), null, 16)) : createCommentVNode("v-if", true)
112
117
  ]),
113
118
  _: 1
114
119
  })
@@ -1,10 +1,18 @@
1
- import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, normalizeProps, guardReactiveProps, createBlock, resolveDynamicComponent, createElementVNode, mergeProps } from 'vue';
1
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, Fragment, createVNode, withCtx, createBlock, normalizeProps, mergeProps, resolveDynamicComponent, createCommentVNode } from 'vue';
2
2
  import { VkfFormItemRendererTemplate } from '@vunk/form/components/form-item-renderer-template';
3
3
  import { ElRow, ElCol } from 'element-plus';
4
4
  import { pickObject } from '@vunk/core/shared/utils-object';
5
5
 
6
+ const props = {
7
+ data: {
8
+ type: Object,
9
+ default: () => ({})
10
+ }
11
+ };
12
+
6
13
  var script = defineComponent({
7
14
  name: "VkfFormItemRendererTemplateLayout",
15
+ props,
8
16
  components: {
9
17
  ElRow,
10
18
  ElCol,
@@ -23,8 +31,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
23
31
  const _component_ElCol = resolveComponent("ElCol");
24
32
  return openBlock(), createElementBlock(Fragment, null, [
25
33
  createVNode(_component_VkfFormItemRendererTemplate, { type: "ElRow" }, {
26
- default: withCtx(({ data, Renderer, raw, k }) => [
27
- createVNode(_component_ElRow, normalizeProps(guardReactiveProps(data)), {
34
+ default: withCtx(({ data: props, Renderer, raw, k, isShow }) => [
35
+ isShow(_ctx.data) ? (openBlock(), createBlock(_component_ElRow, normalizeProps(mergeProps({ key: 0 }, props)), {
28
36
  default: withCtx(() => [
29
37
  (openBlock(), createBlock(resolveDynamicComponent(Renderer), {
30
38
  source: raw.templateSlots,
@@ -32,13 +40,13 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
32
40
  }, null, 8, ["source", "k"]))
33
41
  ]),
34
42
  _: 2
35
- }, 1040)
43
+ }, 1040)) : createCommentVNode("v-if", true)
36
44
  ]),
37
45
  _: 1
38
46
  }),
39
47
  createVNode(_component_VkfFormItemRendererTemplate, { type: "ElCol" }, {
40
- default: withCtx(({ data, Renderer, raw, k }) => [
41
- createVNode(_component_ElCol, normalizeProps(guardReactiveProps(data)), {
48
+ default: withCtx(({ data, Renderer, raw, k, isShow }) => [
49
+ isShow(data) ? (openBlock(), createBlock(_component_ElCol, normalizeProps(mergeProps({ key: 0 }, data)), {
42
50
  default: withCtx(() => [
43
51
  (openBlock(), createBlock(resolveDynamicComponent(Renderer), {
44
52
  source: raw.templateSlots,
@@ -46,13 +54,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
46
54
  }, null, 8, ["source", "k"]))
47
55
  ]),
48
56
  _: 2
49
- }, 1040)
57
+ }, 1040)) : createCommentVNode("v-if", true)
50
58
  ]),
51
59
  _: 1
52
60
  }),
53
61
  createVNode(_component_VkfFormItemRendererTemplate, { type: "VkfFlex" }, {
54
- default: withCtx(({ data, Renderer, raw, k }) => [
55
- createElementVNode("div", mergeProps({
62
+ default: withCtx(({ data, Renderer, raw, k, isShow }) => [
63
+ isShow(data) ? (openBlock(), createElementBlock("div", mergeProps({
64
+ key: 0,
56
65
  class: "vkf-flex",
57
66
  style: {
58
67
  "justify-content": data.justify,
@@ -70,7 +79,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
70
79
  source: raw.templateSlots,
71
80
  k: [...k, "templateSlots"]
72
81
  }, null, 8, ["source", "k"]))
73
- ], 16)
82
+ ], 16)) : createCommentVNode("v-if", true)
74
83
  ]),
75
84
  _: 1
76
85
  })
@@ -1,7 +1,8 @@
1
+ import { NormalObject } from '@vunk/core';
1
2
  import { PropType } from 'vue';
2
3
  export declare const props: {
3
- modelValue: {
4
- type: PropType<unknown>;
4
+ data: {
5
+ type: PropType<NormalObject>;
5
6
  default: () => {};
6
7
  };
7
8
  };
@@ -1,5 +1,5 @@
1
1
  const props = {
2
- modelValue: {
2
+ data: {
3
3
  type: Object,
4
4
  default: () => ({})
5
5
  }
@@ -1,7 +1,19 @@
1
- declare const _default: import("vue").DefineComponent<{}, {
1
+ declare const _default: import("vue").DefineComponent<{
2
+ data: {
3
+ type: import("vue").PropType<import("@vunk/core").NormalObject>;
4
+ default: () => {};
5
+ };
6
+ }, {
2
7
  pickObject: <T extends import("@vunk/core").NormalObject, EX extends (keyof T)[] | undefined, KI extends keyof T>(data: T, opts?: {
3
8
  excludes?: EX | undefined;
4
9
  includes?: KI[] | undefined;
5
10
  } | undefined) => { [P in EX extends (infer KE)[] ? Exclude<KI, KE> : KI]: T[P]; };
6
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
11
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
12
+ data: {
13
+ type: import("vue").PropType<import("@vunk/core").NormalObject>;
14
+ default: () => {};
15
+ };
16
+ }>>, {
17
+ data: import("@vunk/core").NormalObject;
18
+ }>;
7
19
  export default _default;
@@ -35,6 +35,10 @@ const props = __spreadProps(__spreadValues(__spreadValues({}, _VkfFormItemCtx.pr
35
35
  inputSlots: {
36
36
  type: Object,
37
37
  default: void 0
38
+ },
39
+ rows: {
40
+ type: Number,
41
+ default: void 0
38
42
  }
39
43
  });
40
44
  const createBindProps = bindPropsFactory(props);
@@ -76,7 +80,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
76
80
  default: withCtx(() => [
77
81
  createVNode(_component_ElInput, mergeProps({
78
82
  maxlength: _ctx.maxlength,
79
- minlength: _ctx.minlength
83
+ minlength: _ctx.minlength,
84
+ rows: _ctx.rows
80
85
  }, _ctx.inputBindProps, toHandlers(_ctx.inputOnEmits)), createSlots({
81
86
  default: withCtx(() => [
82
87
  renderSlot(_ctx.$slots, "default")
@@ -91,7 +96,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
91
96
  ])
92
97
  };
93
98
  })
94
- ]), 1040, ["maxlength", "minlength"])
99
+ ]), 1040, ["maxlength", "minlength", "rows"])
95
100
  ]),
96
101
  _: 3
97
102
  }, 16);
@@ -13,6 +13,10 @@ export declare const props: {
13
13
  type: PropType<InputSlots>;
14
14
  default: undefined;
15
15
  };
16
+ rows: {
17
+ type: NumberConstructor;
18
+ default: undefined;
19
+ };
16
20
  id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
17
21
  size: {
18
22
  readonly type: PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
@@ -98,7 +102,7 @@ export declare const props: {
98
102
  required: boolean;
99
103
  };
100
104
  };
101
- export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"type", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"id", keyof T2> | Extract<"clearable", keyof T2> | Extract<"prefixIcon", keyof T2> | Extract<"readonly", keyof T2> | Extract<"disabled", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"resize", keyof T2> | Extract<"autosize", keyof T2> | Extract<"autocomplete", keyof T2> | Extract<"formatter", keyof T2> | Extract<"parser", keyof T2> | Extract<"form", keyof T2> | Extract<"showPassword", keyof T2> | Extract<"showWordLimit", keyof T2> | Extract<"suffixIcon", keyof T2> | Extract<"containerRole", keyof T2> | Extract<"inputStyle", keyof T2> | Extract<"maxlength", keyof T2> | Extract<"minlength", keyof T2> | Extract<"inputSlots", keyof T2>)[] | undefined>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required", keyof T2>, KE> | Exclude<Extract<"type", keyof T2>, KE> | Exclude<Extract<"label", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"prop", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"error", keyof T2>, KE> | Exclude<Extract<"validateStatus", keyof T2>, KE> | Exclude<Extract<"for", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"formItemSize", keyof T2>, KE> | Exclude<Extract<"formItemSlots", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"tabindex", keyof T2>, KE> | Exclude<Extract<"validateEvent", keyof T2>, KE> | Exclude<Extract<"id", keyof T2>, KE> | Exclude<Extract<"clearable", keyof T2>, KE> | Exclude<Extract<"prefixIcon", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"placeholder", keyof T2>, KE> | Exclude<Extract<"modelValue", keyof T2>, KE> | Exclude<Extract<"resize", keyof T2>, KE> | Exclude<Extract<"autosize", keyof T2>, KE> | Exclude<Extract<"autocomplete", keyof T2>, KE> | Exclude<Extract<"formatter", keyof T2>, KE> | Exclude<Extract<"parser", keyof T2>, KE> | Exclude<Extract<"form", keyof T2>, KE> | Exclude<Extract<"showPassword", keyof T2>, KE> | Exclude<Extract<"showWordLimit", keyof T2>, KE> | Exclude<Extract<"suffixIcon", keyof T2>, KE> | Exclude<Extract<"containerRole", keyof T2>, KE> | Exclude<Extract<"inputStyle", keyof T2>, KE> | Exclude<Extract<"maxlength", keyof T2>, KE> | Exclude<Extract<"minlength", keyof T2>, KE> | Exclude<Extract<"inputSlots", keyof T2>, KE> : Extract<"required", keyof T2> | Extract<"type", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"id", keyof T2> | Extract<"clearable", keyof T2> | Extract<"prefixIcon", keyof T2> | Extract<"readonly", keyof T2> | Extract<"disabled", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"resize", keyof T2> | Extract<"autosize", keyof T2> | Extract<"autocomplete", keyof T2> | Extract<"formatter", keyof T2> | Extract<"parser", keyof T2> | Extract<"form", keyof T2> | Extract<"showPassword", keyof T2> | Extract<"showWordLimit", keyof T2> | Extract<"suffixIcon", keyof T2> | Extract<"containerRole", keyof T2> | Extract<"inputStyle", keyof T2> | Extract<"maxlength", keyof T2> | Extract<"minlength", keyof T2> | Extract<"inputSlots", keyof T2>]: { [k in Extract<"required", keyof T2> | Extract<"type", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"id", keyof T2> | Extract<"clearable", keyof T2> | Extract<"prefixIcon", keyof T2> | Extract<"readonly", keyof T2> | Extract<"disabled", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"resize", keyof T2> | Extract<"autosize", keyof T2> | Extract<"autocomplete", keyof T2> | Extract<"formatter", keyof T2> | Extract<"parser", keyof T2> | Extract<"form", keyof T2> | Extract<"showPassword", keyof T2> | Extract<"showWordLimit", keyof T2> | Extract<"suffixIcon", keyof T2> | Extract<"containerRole", keyof T2> | Extract<"inputStyle", keyof T2> | Extract<"maxlength", keyof T2> | Extract<"minlength", keyof T2> | Extract<"inputSlots", keyof T2>]: T2[k]; }[P]; }>;
105
+ export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"type", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"id", keyof T2> | Extract<"clearable", keyof T2> | Extract<"prefixIcon", keyof T2> | Extract<"readonly", keyof T2> | Extract<"disabled", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"resize", keyof T2> | Extract<"autosize", keyof T2> | Extract<"autocomplete", keyof T2> | Extract<"formatter", keyof T2> | Extract<"parser", keyof T2> | Extract<"form", keyof T2> | Extract<"showPassword", keyof T2> | Extract<"showWordLimit", keyof T2> | Extract<"suffixIcon", keyof T2> | Extract<"containerRole", keyof T2> | Extract<"inputStyle", keyof T2> | Extract<"maxlength", keyof T2> | Extract<"minlength", keyof T2> | Extract<"inputSlots", keyof T2> | Extract<"rows", keyof T2>)[] | undefined>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required", keyof T2>, KE> | Exclude<Extract<"type", keyof T2>, KE> | Exclude<Extract<"label", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"prop", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"error", keyof T2>, KE> | Exclude<Extract<"validateStatus", keyof T2>, KE> | Exclude<Extract<"for", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"formItemSize", keyof T2>, KE> | Exclude<Extract<"formItemSlots", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"tabindex", keyof T2>, KE> | Exclude<Extract<"validateEvent", keyof T2>, KE> | Exclude<Extract<"id", keyof T2>, KE> | Exclude<Extract<"clearable", keyof T2>, KE> | Exclude<Extract<"prefixIcon", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"placeholder", keyof T2>, KE> | Exclude<Extract<"modelValue", keyof T2>, KE> | Exclude<Extract<"resize", keyof T2>, KE> | Exclude<Extract<"autosize", keyof T2>, KE> | Exclude<Extract<"autocomplete", keyof T2>, KE> | Exclude<Extract<"formatter", keyof T2>, KE> | Exclude<Extract<"parser", keyof T2>, KE> | Exclude<Extract<"form", keyof T2>, KE> | Exclude<Extract<"showPassword", keyof T2>, KE> | Exclude<Extract<"showWordLimit", keyof T2>, KE> | Exclude<Extract<"suffixIcon", keyof T2>, KE> | Exclude<Extract<"containerRole", keyof T2>, KE> | Exclude<Extract<"inputStyle", keyof T2>, KE> | Exclude<Extract<"maxlength", keyof T2>, KE> | Exclude<Extract<"minlength", keyof T2>, KE> | Exclude<Extract<"inputSlots", keyof T2>, KE> | Exclude<Extract<"rows", keyof T2>, KE> : Extract<"required", keyof T2> | Extract<"type", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"id", keyof T2> | Extract<"clearable", keyof T2> | Extract<"prefixIcon", keyof T2> | Extract<"readonly", keyof T2> | Extract<"disabled", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"resize", keyof T2> | Extract<"autosize", keyof T2> | Extract<"autocomplete", keyof T2> | Extract<"formatter", keyof T2> | Extract<"parser", keyof T2> | Extract<"form", keyof T2> | Extract<"showPassword", keyof T2> | Extract<"showWordLimit", keyof T2> | Extract<"suffixIcon", keyof T2> | Extract<"containerRole", keyof T2> | Extract<"inputStyle", keyof T2> | Extract<"maxlength", keyof T2> | Extract<"minlength", keyof T2> | Extract<"inputSlots", keyof T2> | Extract<"rows", keyof T2>]: { [k in Extract<"required", keyof T2> | Extract<"type", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"prop", keyof T2> | Extract<"rules", keyof T2> | Extract<"error", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"tabindex", keyof T2> | Extract<"validateEvent", keyof T2> | Extract<"id", keyof T2> | Extract<"clearable", keyof T2> | Extract<"prefixIcon", keyof T2> | Extract<"readonly", keyof T2> | Extract<"disabled", keyof T2> | Extract<"placeholder", keyof T2> | Extract<"modelValue", keyof T2> | Extract<"resize", keyof T2> | Extract<"autosize", keyof T2> | Extract<"autocomplete", keyof T2> | Extract<"formatter", keyof T2> | Extract<"parser", keyof T2> | Extract<"form", keyof T2> | Extract<"showPassword", keyof T2> | Extract<"showWordLimit", keyof T2> | Extract<"suffixIcon", keyof T2> | Extract<"containerRole", keyof T2> | Extract<"inputStyle", keyof T2> | Extract<"maxlength", keyof T2> | Extract<"minlength", keyof T2> | Extract<"inputSlots", keyof T2> | Extract<"rows", keyof T2>]: T2[k]; }[P]; }>;
102
106
  export declare const emits: {
103
107
  "update:modelValue": (value: string) => boolean;
104
108
  input: (value: string) => boolean;
@@ -33,6 +33,10 @@ const props = __spreadProps(__spreadValues(__spreadValues({}, _VkfFormItemCtx.pr
33
33
  inputSlots: {
34
34
  type: Object,
35
35
  default: void 0
36
+ },
37
+ rows: {
38
+ type: Number,
39
+ default: void 0
36
40
  }
37
41
  });
38
42
  const createBindProps = bindPropsFactory(props);
@@ -11,6 +11,10 @@ declare const _default: import("vue").DefineComponent<{
11
11
  type: import("vue").PropType<import("./types").InputSlots>;
12
12
  default: undefined;
13
13
  };
14
+ rows: {
15
+ type: NumberConstructor;
16
+ default: undefined;
17
+ };
14
18
  id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
15
19
  size: {
16
20
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
@@ -176,6 +180,10 @@ declare const _default: import("vue").DefineComponent<{
176
180
  type: import("vue").PropType<import("./types").InputSlots>;
177
181
  default: undefined;
178
182
  };
183
+ rows: {
184
+ type: NumberConstructor;
185
+ default: undefined;
186
+ };
179
187
  id: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, undefined, boolean>;
180
188
  size: {
181
189
  readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", never>>;
@@ -299,5 +307,6 @@ declare const _default: import("vue").DefineComponent<{
299
307
  containerRole: string;
300
308
  inputStyle: import("vue").StyleValue;
301
309
  inputSlots: import("./types").InputSlots;
310
+ rows: number;
302
311
  }>;
303
312
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
2
2
  import { selectProps, selectEmits, createSelectBindProps, createSelectOnEmits } from '@vunk/form/shared/element-plus';
3
- import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps, toHandlers, createSlots, createElementBlock, Fragment, renderList, renderSlot, resolveDynamicComponent } from 'vue';
3
+ import { defineComponent, computed, ref, watch, nextTick, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, mergeProps, toHandlers, createSlots, createElementBlock, Fragment, renderList, renderSlot, resolveDynamicComponent, createCommentVNode } from 'vue';
4
4
  import { ElSelect, ElOption } from 'element-plus';
5
5
  import { isPlainObject } from '@vunk/core/shared/utils-object';
6
6
 
@@ -79,11 +79,20 @@ var script = defineComponent({
79
79
  return a;
80
80
  }, []);
81
81
  });
82
+ const reshow = ref(true);
83
+ watch(() => selectBindProps.value.multiple, () => {
84
+ emit("update:modelValue", void 0);
85
+ reshow.value = false;
86
+ nextTick(() => {
87
+ reshow.value = true;
88
+ });
89
+ });
82
90
  return {
83
91
  formItemBindProps,
84
92
  selectBindProps,
85
93
  selectOnEmits,
86
- selectOptions
94
+ selectOptions,
95
+ reshow
87
96
  };
88
97
  }
89
98
  });
@@ -94,7 +103,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
94
103
  const _component_VkfFormItem = resolveComponent("VkfFormItem");
95
104
  return openBlock(), createBlock(_component_VkfFormItem, normalizeProps(guardReactiveProps(_ctx.formItemBindProps)), {
96
105
  default: withCtx(() => [
97
- createVNode(_component_ElSelect, mergeProps(_ctx.selectBindProps, toHandlers(_ctx.selectOnEmits)), createSlots({
106
+ _ctx.reshow ? (openBlock(), createBlock(_component_ElSelect, mergeProps({ key: 0 }, _ctx.selectBindProps, toHandlers(_ctx.selectOnEmits)), createSlots({
98
107
  default: withCtx(() => [
99
108
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selectOptions, (item) => {
100
109
  return openBlock(), createBlock(_component_ElOption, mergeProps(item, {
@@ -113,7 +122,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
113
122
  ])
114
123
  };
115
124
  })
116
- ]), 1040)
125
+ ]), 1040)) : createCommentVNode("v-if", true)
117
126
  ]),
118
127
  _: 3
119
128
  }, 16);
@@ -304,6 +304,7 @@ declare const _default: import("vue").DefineComponent<{
304
304
  }>>> & {
305
305
  key: any;
306
306
  })[]>;
307
+ reshow: import("vue").Ref<boolean>;
307
308
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
308
309
  'update:modelValue': null;
309
310
  change: null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "0.0.1-alpha.10",
3
+ "version": "0.0.1-alpha.13",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {
@@ -0,0 +1,5 @@
1
+ import { NormalObject } from '@vunk/core';
2
+ export interface BasicSource {
3
+ templateIf?: ((data?: NormalObject) => boolean) | string | boolean;
4
+ templateType?: string;
5
+ }
@@ -0,0 +1 @@
1
+
@@ -1,10 +1,11 @@
1
1
  import { VueComponentPropsType } from '@vunk/core';
2
2
  import { ElCol, ElRow } from 'element-plus';
3
- export interface ElRowSource<S> extends VueComponentPropsType<typeof ElRow> {
3
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
4
+ export interface ElRowSource<S> extends VueComponentPropsType<typeof ElRow>, BasicSource {
4
5
  templateType: 'ElRow';
5
6
  templateSlots: S[];
6
7
  }
7
- export interface ElColSource<S> extends VueComponentPropsType<typeof ElCol> {
8
+ export interface ElColSource<S> extends VueComponentPropsType<typeof ElCol>, BasicSource {
8
9
  templateType: 'ElCol';
9
10
  templateSlots: S[];
10
11
  }
@@ -22,7 +23,7 @@ interface VkfFlexItem {
22
23
  basis?: string | IntrinsicSizing | GlobalValues | 'revert' | 'revert-layer' | 'content';
23
24
  overflow?: 'hidden' | 'visible' | 'scroll' | 'auto' | string;
24
25
  }
25
- export interface VkfFlexSource<S> extends VkfFlex, VkfFlexItem {
26
+ export interface VkfFlexSource<S> extends VkfFlex, VkfFlexItem, BasicSource {
26
27
  templateType: 'VkfFlex';
27
28
  templateSlots?: S[];
28
29
  [s: string]: any;
@@ -1,5 +1,7 @@
1
1
  import type { Merge } from '@vunk/core';
2
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
2
3
  export declare type ComponentSource<C = undefined> = Merge<{
3
4
  templateType: 'Component';
5
+ templateIf?: BasicSource['templateIf'];
4
6
  is: any;
5
7
  }, C>;
@@ -1,7 +1,8 @@
1
1
  import { VkfDatePicker } from '@vunk/form/components/date-picker';
2
2
  import type { Merge, VueComponentPropsType } from '@vunk/core';
3
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
3
4
  export declare type VkfDatePickerProps<T = undefined> = Merge<VueComponentPropsType<typeof VkfDatePicker>, T>;
4
- export declare type VkfDatePickerSource<P = string> = VkfDatePickerProps<{
5
+ export interface VkfDatePickerSource<P extends string = string> extends VkfDatePickerProps, BasicSource {
5
6
  prop: P;
6
7
  templateType: 'VkfDatePicker';
7
- }>;
8
+ }
@@ -10,4 +10,4 @@ export * from './input';
10
10
  export * from './select';
11
11
  export * from './switch';
12
12
  export * from './input-number';
13
- export declare type FormItemRendererSource<P = string> = VkfInputSource<P> | VkfSwitchSource<P> | VkfSelectSource<P> | VkfDatePickerSource<P> | VkfInputNumberSource<P> | ComponentSource;
13
+ export declare type FormItemRendererSource<P extends string = string> = VkfInputSource<P> | VkfSwitchSource<P> | VkfSelectSource<P> | VkfDatePickerSource<P> | VkfInputNumberSource<P> | ComponentSource;
@@ -1,7 +1,8 @@
1
1
  import { VkfInputNumber } from '@vunk/form/components/input-number';
2
2
  import type { Merge, VueComponentPropsType } from '@vunk/core';
3
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
3
4
  export declare type VkfInputNumberProps<T = undefined> = Merge<VueComponentPropsType<typeof VkfInputNumber>, T>;
4
- export declare type VkfInputNumberSource<P = string> = VkfInputNumberProps<{
5
+ export interface VkfInputNumberSource<P extends string = string> extends VkfInputNumberProps, BasicSource {
5
6
  prop: P;
6
7
  templateType: 'VkfInputNumber';
7
- }>;
8
+ }
@@ -1,7 +1,8 @@
1
1
  import { VkfInput } from '@vunk/form/components/input';
2
2
  import type { Merge, VueComponentPropsType } from '@vunk/core';
3
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
3
4
  export declare type VkfInputProps<T = undefined> = Merge<VueComponentPropsType<typeof VkfInput>, T>;
4
- export declare type VkfInputSource<P = string> = VkfInputProps<{
5
+ export interface VkfInputSource<P extends string = string> extends VkfInputProps, BasicSource {
5
6
  prop: P;
6
7
  templateType: 'VkfInput';
7
- }>;
8
+ }
@@ -1,7 +1,8 @@
1
1
  import { VkfSelect } from '@vunk/form/components/select';
2
2
  import type { Merge, VueComponentPropsType } from '@vunk/core';
3
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
3
4
  export declare type VkfSelectProps<T = undefined> = Merge<VueComponentPropsType<typeof VkfSelect>, T>;
4
- export declare type VkfSelectSource<P = string> = VkfSelectProps<{
5
+ export interface VkfSelectSource<P extends string = string> extends VkfSelectProps, BasicSource {
5
6
  prop: P;
6
7
  templateType: 'VkfSelect';
7
- }>;
8
+ }
@@ -1,7 +1,8 @@
1
1
  import { VkfSwitch } from '@vunk/form/components/switch';
2
2
  import type { Merge, VueComponentPropsType } from '@vunk/core';
3
+ import { BasicSource } from '@vunk/form/shared/types/basic-source';
3
4
  export declare type VkfSwitchProps<T = undefined> = Merge<VueComponentPropsType<typeof VkfSwitch>, T>;
4
- export declare type VkfSwitchSource<P = string> = VkfSwitchProps<{
5
+ export interface VkfSwitchSource<P extends string = string> extends VkfSwitchProps, BasicSource {
5
6
  prop: P;
6
7
  templateType: 'VkfSwitch';
7
- }>;
8
+ }