@vunk/form 2.16.7 → 2.16.8

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.
@@ -52,6 +52,7 @@ const props = {
52
52
  slots: null,
53
53
  /**
54
54
  * @description 若 option中含有该字段内容,则渲染为 Group
55
+ * @deprecated use props.options instead
55
56
  */
56
57
  optionChildrenProp: {
57
58
  type: String,
@@ -85,6 +86,18 @@ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
85
86
  optionChildrenProp: {
86
87
  type: String,
87
88
  default: ""
89
+ },
90
+ labelProp: {
91
+ type: String,
92
+ default: "label"
93
+ },
94
+ valueProp: {
95
+ type: String,
96
+ default: "value"
97
+ },
98
+ disabledProp: {
99
+ type: String,
100
+ default: "disabled"
88
101
  }
89
102
  },
90
103
  setup(props, {
@@ -94,24 +107,24 @@ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
94
107
  let _slot;
95
108
  const isGroup = props.optionChildrenProp && Array.isArray(item[props.optionChildrenProp]) && item[props.optionChildrenProp].length > 0;
96
109
  return isGroup ? vue.createVNode(elementPlus.ElOptionGroup, {
97
- "label": item.label,
98
- "key": item.value || item.label,
99
- "disabled": item.disabled
110
+ "label": item[props.labelProp],
111
+ "key": item[props.valueProp] || item[props.labelProp],
112
+ "disabled": item[props.disabledProp]
100
113
  }, _isSlot(_slot = item[props.optionChildrenProp].map(childOption => vue.createVNode(ItemView, vue.mergeProps({
101
114
  "key": childOption.value
102
115
  }, childOption), null))) ? _slot : {
103
116
  default: () => [_slot]
104
117
  }) : vue.createVNode(elementPlus.ElOption, {
105
- "key": item.value,
106
- "value": item.value,
118
+ "key": item[props.valueProp] || item[props.labelProp],
119
+ "value": item[props.valueProp],
107
120
  "class": item.class,
108
121
  "created": item.created,
109
- "disabled": item.disabled,
110
- "label": item.label,
122
+ "disabled": item[props.disabledProp],
123
+ "label": item[props.labelProp],
111
124
  "ref": item.ref,
112
125
  "style": item.style
113
126
  }, {
114
- default: () => slots.option ? slots.option(item) : item.label
127
+ default: () => slots.option ? slots.option(item) : item[props.labelProp]
115
128
  });
116
129
  };
117
130
  return () => {
@@ -230,14 +243,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
230
243
  default: vue.withCtx(() => [
231
244
  vue.createVNode(_component_Options, {
232
245
  data: _ctx.selectOptions,
233
- "option-children-prop": _ctx.optionChildrenProp
246
+ "option-children-prop": _ctx.props.options ?? _ctx.optionChildrenProp,
247
+ "label-prop": _ctx.props.label,
248
+ "value-prop": _ctx.props.value,
249
+ "disabled-prop": _ctx.props.disabled
234
250
  }, {
235
251
  option: vue.withCtx((e) => [
236
252
  vue.renderSlot(_ctx.$slots, "option", vue.normalizeProps(vue.guardReactiveProps(e)))
237
253
  ]),
238
254
  _: 3
239
255
  /* FORWARDED */
240
- }, 8, ["data", "option-children-prop"]),
256
+ }, 8, ["data", "option-children-prop", "label-prop", "value-prop", "disabled-prop"]),
241
257
  vue.renderSlot(_ctx.$slots, "footer")
242
258
  ]),
243
259
  _: 2
@@ -48,6 +48,7 @@ const props = {
48
48
  slots: null,
49
49
  /**
50
50
  * @description 若 option中含有该字段内容,则渲染为 Group
51
+ * @deprecated use props.options instead
51
52
  */
52
53
  optionChildrenProp: {
53
54
  type: String,
@@ -81,6 +82,18 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
81
82
  optionChildrenProp: {
82
83
  type: String,
83
84
  default: ""
85
+ },
86
+ labelProp: {
87
+ type: String,
88
+ default: "label"
89
+ },
90
+ valueProp: {
91
+ type: String,
92
+ default: "value"
93
+ },
94
+ disabledProp: {
95
+ type: String,
96
+ default: "disabled"
84
97
  }
85
98
  },
86
99
  setup(props, {
@@ -90,24 +103,24 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
90
103
  let _slot;
91
104
  const isGroup = props.optionChildrenProp && Array.isArray(item[props.optionChildrenProp]) && item[props.optionChildrenProp].length > 0;
92
105
  return isGroup ? createVNode(ElOptionGroup, {
93
- "label": item.label,
94
- "key": item.value || item.label,
95
- "disabled": item.disabled
106
+ "label": item[props.labelProp],
107
+ "key": item[props.valueProp] || item[props.labelProp],
108
+ "disabled": item[props.disabledProp]
96
109
  }, _isSlot(_slot = item[props.optionChildrenProp].map(childOption => createVNode(ItemView, mergeProps({
97
110
  "key": childOption.value
98
111
  }, childOption), null))) ? _slot : {
99
112
  default: () => [_slot]
100
113
  }) : createVNode(ElOption, {
101
- "key": item.value,
102
- "value": item.value,
114
+ "key": item[props.valueProp] || item[props.labelProp],
115
+ "value": item[props.valueProp],
103
116
  "class": item.class,
104
117
  "created": item.created,
105
- "disabled": item.disabled,
106
- "label": item.label,
118
+ "disabled": item[props.disabledProp],
119
+ "label": item[props.labelProp],
107
120
  "ref": item.ref,
108
121
  "style": item.style
109
122
  }, {
110
- default: () => slots.option ? slots.option(item) : item.label
123
+ default: () => slots.option ? slots.option(item) : item[props.labelProp]
111
124
  });
112
125
  };
113
126
  return () => {
@@ -226,14 +239,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
226
239
  default: withCtx(() => [
227
240
  createVNode(_component_Options, {
228
241
  data: _ctx.selectOptions,
229
- "option-children-prop": _ctx.optionChildrenProp
242
+ "option-children-prop": _ctx.props.options ?? _ctx.optionChildrenProp,
243
+ "label-prop": _ctx.props.label,
244
+ "value-prop": _ctx.props.value,
245
+ "disabled-prop": _ctx.props.disabled
230
246
  }, {
231
247
  option: withCtx((e) => [
232
248
  renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(e)))
233
249
  ]),
234
250
  _: 3
235
251
  /* FORWARDED */
236
- }, 8, ["data", "option-children-prop"]),
252
+ }, 8, ["data", "option-children-prop", "label-prop", "value-prop", "disabled-prop"]),
237
253
  renderSlot(_ctx.$slots, "footer")
238
254
  ]),
239
255
  _: 2
@@ -1558,6 +1558,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1558
1558
  type: StringConstructor;
1559
1559
  default: string;
1560
1560
  };
1561
+ labelProp: {
1562
+ type: StringConstructor;
1563
+ default: string;
1564
+ };
1565
+ valueProp: {
1566
+ type: StringConstructor;
1567
+ default: string;
1568
+ };
1569
+ disabledProp: {
1570
+ type: StringConstructor;
1571
+ default: string;
1572
+ };
1561
1573
  }>, () => JSX.Element[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
1562
1574
  data: {
1563
1575
  type: import("vue").PropType<import("@vunk/shared").NormalObject[]>;
@@ -1567,8 +1579,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1567
1579
  type: StringConstructor;
1568
1580
  default: string;
1569
1581
  };
1582
+ labelProp: {
1583
+ type: StringConstructor;
1584
+ default: string;
1585
+ };
1586
+ valueProp: {
1587
+ type: StringConstructor;
1588
+ default: string;
1589
+ };
1590
+ disabledProp: {
1591
+ type: StringConstructor;
1592
+ default: string;
1593
+ };
1570
1594
  }>> & Readonly<{}>, {
1571
1595
  optionChildrenProp: string;
1596
+ labelProp: string;
1597
+ valueProp: string;
1598
+ disabledProp: string;
1572
1599
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1573
1600
  }, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1574
1601
  export default _default;
@@ -45,6 +45,7 @@ export declare const props: {
45
45
  slots: any;
46
46
  /**
47
47
  * @description 若 option中含有该字段内容,则渲染为 Group
48
+ * @deprecated use props.options instead
48
49
  */
49
50
  optionChildrenProp: {
50
51
  type: StringConstructor;
@@ -9,6 +9,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
9
9
  type: StringConstructor;
10
10
  default: string;
11
11
  };
12
+ labelProp: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ valueProp: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ disabledProp: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
12
24
  }>, () => JSX.Element[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
25
  data: {
14
26
  type: PropType<NormalObject[]>;
@@ -18,7 +30,22 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
18
30
  type: StringConstructor;
19
31
  default: string;
20
32
  };
33
+ labelProp: {
34
+ type: StringConstructor;
35
+ default: string;
36
+ };
37
+ valueProp: {
38
+ type: StringConstructor;
39
+ default: string;
40
+ };
41
+ disabledProp: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
21
45
  }>> & Readonly<{}>, {
22
46
  optionChildrenProp: string;
47
+ labelProp: string;
48
+ valueProp: string;
49
+ disabledProp: string;
23
50
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
24
51
  export default _default;
@@ -11,3 +11,9 @@ export interface Source<P = string> extends VueComponentPropsType<typeof VkfSele
11
11
  prop: P;
12
12
  templateType: 'VkfSelect';
13
13
  }
14
+ export interface Props {
15
+ label?: string;
16
+ value?: string;
17
+ disabled?: string;
18
+ options?: string;
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/form",
3
- "version": "2.16.7",
3
+ "version": "2.16.8",
4
4
  "description": "",
5
5
  "main": "index.esm.js",
6
6
  "scripts": {