@vunk/form 2.14.14 → 2.14.15

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.
@@ -42,13 +42,6 @@ const props = {
42
42
  type: Object,
43
43
  default: () => ({})
44
44
  },
45
- /**
46
- * @description 保留最后一个不被删除
47
- */
48
- keepLast: {
49
- type: Boolean,
50
- default: false
51
- },
52
45
  /**
53
46
  * @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
54
47
  */
@@ -63,6 +56,13 @@ const props = {
63
56
  type: Object,
64
57
  default: () => ({})
65
58
  },
59
+ /**
60
+ * @description 保留最后一个不被删除
61
+ */
62
+ keepLast: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
66
  /**
67
67
  * @description 是否开启顶部的添加按钮
68
68
  */
@@ -85,7 +85,6 @@ const emits = {
85
85
 
86
86
  var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
87
87
  ...{
88
- name: "VkfCardInputCollection",
89
88
  inheritAttrs: false
90
89
  },
91
90
  __name: "core",
@@ -323,6 +322,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
323
322
  var Core = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/card-input-collection/src/core.vue"]]);
324
323
 
325
324
  var _sfc_main = vue.defineComponent({
325
+ name: "VkfCardInputCollection",
326
326
  props,
327
327
  emits,
328
328
  setup(props2, { slots, emit }) {
@@ -38,13 +38,6 @@ const props = {
38
38
  type: Object,
39
39
  default: () => ({})
40
40
  },
41
- /**
42
- * @description 保留最后一个不被删除
43
- */
44
- keepLast: {
45
- type: Boolean,
46
- default: false
47
- },
48
41
  /**
49
42
  * @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
50
43
  */
@@ -59,6 +52,13 @@ const props = {
59
52
  type: Object,
60
53
  default: () => ({})
61
54
  },
55
+ /**
56
+ * @description 保留最后一个不被删除
57
+ */
58
+ keepLast: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
62
  /**
63
63
  * @description 是否开启顶部的添加按钮
64
64
  */
@@ -81,7 +81,6 @@ const emits = {
81
81
 
82
82
  var _sfc_main$1 = /* @__PURE__ */ defineComponent({
83
83
  ...{
84
- name: "VkfCardInputCollection",
85
84
  inheritAttrs: false
86
85
  },
87
86
  __name: "core",
@@ -319,6 +318,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
319
318
  var Core = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/card-input-collection/src/core.vue"]]);
320
319
 
321
320
  var _sfc_main = defineComponent({
321
+ name: "VkfCardInputCollection",
322
322
  props,
323
323
  emits,
324
324
  setup(props2, { slots, emit }) {
@@ -21,10 +21,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
21
21
  type: import("vue").PropType<import("./types").Slots>;
22
22
  default: () => {};
23
23
  };
24
- keepLast: {
25
- type: BooleanConstructor;
26
- default: boolean;
27
- };
28
24
  labelActions: {
29
25
  type: BooleanConstructor;
30
26
  default: boolean;
@@ -33,6 +29,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
33
29
  type: import("vue").PropType<NormalObject>;
34
30
  default: () => {};
35
31
  };
32
+ keepLast: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
36
  topSplicable: {
37
37
  type: BooleanConstructor;
38
38
  default: boolean;
@@ -148,10 +148,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
148
148
  type: import("vue").PropType<import("./types").Slots>;
149
149
  default: () => {};
150
150
  };
151
- keepLast: {
152
- type: BooleanConstructor;
153
- default: boolean;
154
- };
155
151
  labelActions: {
156
152
  type: BooleanConstructor;
157
153
  default: boolean;
@@ -160,6 +156,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
160
156
  type: import("vue").PropType<NormalObject>;
161
157
  default: () => {};
162
158
  };
159
+ keepLast: {
160
+ type: BooleanConstructor;
161
+ default: boolean;
162
+ };
163
163
  topSplicable: {
164
164
  type: BooleanConstructor;
165
165
  default: boolean;
@@ -965,10 +965,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
965
965
  type: import("vue").PropType<import("./types").Slots>;
966
966
  default: () => {};
967
967
  };
968
- keepLast: {
969
- type: BooleanConstructor;
970
- default: boolean;
971
- };
972
968
  labelActions: {
973
969
  type: BooleanConstructor;
974
970
  default: boolean;
@@ -977,6 +973,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
977
973
  type: import("vue").PropType<NormalObject>;
978
974
  default: () => {};
979
975
  };
976
+ keepLast: {
977
+ type: BooleanConstructor;
978
+ default: boolean;
979
+ };
980
980
  topSplicable: {
981
981
  type: BooleanConstructor;
982
982
  default: boolean;
@@ -1092,8 +1092,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1092
1092
  columns: any[];
1093
1093
  labelActions: boolean;
1094
1094
  splicable: boolean;
1095
- keepLast: boolean;
1096
1095
  defaultItemValue: NormalObject;
1096
+ keepLast: boolean;
1097
1097
  topSplicable: boolean;
1098
1098
  cardProps: Partial<import("element-plus").CardProps>;
1099
1099
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -26,13 +26,6 @@ export declare const props: {
26
26
  type: PropType<Slots>;
27
27
  default: () => {};
28
28
  };
29
- /**
30
- * @description 保留最后一个不被删除
31
- */
32
- keepLast: {
33
- type: BooleanConstructor;
34
- default: boolean;
35
- };
36
29
  /**
37
30
  * @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
38
31
  */
@@ -47,6 +40,13 @@ export declare const props: {
47
40
  type: PropType<NormalObject>;
48
41
  default: () => {};
49
42
  };
43
+ /**
44
+ * @description 保留最后一个不被删除
45
+ */
46
+ keepLast: {
47
+ type: BooleanConstructor;
48
+ default: boolean;
49
+ };
50
50
  /**
51
51
  * @description 是否开启顶部的添加按钮
52
52
  */
@@ -19,10 +19,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
19
19
  type: import("vue").PropType<import("./types").Slots>;
20
20
  default: () => {};
21
21
  };
22
- keepLast: {
23
- type: BooleanConstructor;
24
- default: boolean;
25
- };
26
22
  labelActions: {
27
23
  type: BooleanConstructor;
28
24
  default: boolean;
@@ -31,6 +27,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
31
27
  type: import("vue").PropType<import("@vunk/shared").NormalObject>;
32
28
  default: () => {};
33
29
  };
30
+ keepLast: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
34
  topSplicable: {
35
35
  type: BooleanConstructor;
36
36
  default: boolean;
@@ -149,10 +149,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
149
149
  type: import("vue").PropType<import("./types").Slots>;
150
150
  default: () => {};
151
151
  };
152
- keepLast: {
153
- type: BooleanConstructor;
154
- default: boolean;
155
- };
156
152
  labelActions: {
157
153
  type: BooleanConstructor;
158
154
  default: boolean;
@@ -161,6 +157,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
161
157
  type: import("vue").PropType<import("@vunk/shared").NormalObject>;
162
158
  default: () => {};
163
159
  };
160
+ keepLast: {
161
+ type: BooleanConstructor;
162
+ default: boolean;
163
+ };
164
164
  topSplicable: {
165
165
  type: BooleanConstructor;
166
166
  default: boolean;
@@ -276,8 +276,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
276
276
  columns: any[];
277
277
  labelActions: boolean;
278
278
  splicable: boolean;
279
- keepLast: boolean;
280
279
  defaultItemValue: import("@vunk/shared").NormalObject;
280
+ keepLast: boolean;
281
281
  topSplicable: boolean;
282
282
  cardProps: Partial<import("element-plus").CardProps>;
283
283
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -60,6 +60,24 @@ const props = {
60
60
  defaultItemValue: {
61
61
  type: Object,
62
62
  default: () => ({})
63
+ },
64
+ /**
65
+ * @description 保留最后一个不被删除
66
+ */
67
+ keepLast: {
68
+ type: Boolean,
69
+ default: false
70
+ },
71
+ /**
72
+ * @description 是否开启顶部的添加按钮
73
+ */
74
+ topSplicable: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ slots: {
79
+ type: Object,
80
+ default: () => ({})
63
81
  }
64
82
  };
65
83
  const emits = {
@@ -67,12 +85,11 @@ const emits = {
67
85
  };
68
86
 
69
87
  const ROW_KEY = "_row_key";
70
- var _sfc_main = /* @__PURE__ */vue.defineComponent({
88
+ var _sfc_main$1 = /* @__PURE__ */vue.defineComponent({
71
89
  ...{
72
- name: "VkfInputCollection",
73
90
  inheritAttrs: false
74
91
  },
75
- __name: "index",
92
+ __name: "core",
76
93
  props: props,
77
94
  emits,
78
95
  setup(__props, {
@@ -178,6 +195,7 @@ var _sfc_main = /* @__PURE__ */vue.defineComponent({
178
195
  "type": "primary",
179
196
  "link": true,
180
197
  "circle": true,
198
+ "disabled": props.modelValue.length <= 1 && props.keepLast,
181
199
  "onClick": () => handleMinus($index)
182
200
  }, null)])
183
201
  }));
@@ -195,6 +213,9 @@ var _sfc_main = /* @__PURE__ */vue.defineComponent({
195
213
  setExpandRowKeys([]);
196
214
  }
197
215
  function handleMinus(index) {
216
+ if (props.keepLast && props.modelValue.length <= 1) {
217
+ return;
218
+ }
198
219
  const data = cloneDeep.cloneDeep(props.modelValue);
199
220
  data.splice(index, 1);
200
221
  emit("update:modelValue", data);
@@ -321,7 +342,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
321
342
  })),
322
343
  vue.createSlots({
323
344
  default: vue.withCtx(() => [
324
- !$setup.readonly && _ctx.splicable && !_ctx.labelActions ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
345
+ !$setup.readonly && _ctx.splicable && !_ctx.labelActions && _ctx.topSplicable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
325
346
  vue.createVNode($setup["ElButton"], {
326
347
  type: "primary",
327
348
  onClick: $setup.addToFirst
@@ -351,11 +372,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
351
372
  _: 2
352
373
  /* DYNAMIC */
353
374
  }, [
354
- !$setup.readonly && _ctx.splicable && _ctx.labelActions ? {
375
+ _ctx.labelActions ? {
355
376
  name: "labelActions",
356
377
  fn: vue.withCtx(() => [
357
378
  vue.renderSlot(_ctx.$slots, "labelActions"),
358
- vue.createVNode($setup["ElButton"], {
379
+ !$setup.readonly && _ctx.splicable && _ctx.topSplicable ? (vue.openBlock(), vue.createBlock($setup["ElButton"], {
380
+ key: 0,
359
381
  size: "small",
360
382
  icon: $setup.Plus,
361
383
  onClick: $setup.addToFirst
@@ -365,7 +387,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
365
387
  ])),
366
388
  _: 1,
367
389
  __: [0]
368
- }, 8, ["icon"])
390
+ }, 8, ["icon"])) : vue.createCommentVNode("v-if", true)
369
391
  ]),
370
392
  key: "0"
371
393
  } : void 0
@@ -383,7 +405,24 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
383
405
  /* FORWARDED */
384
406
  });
385
407
  }
386
- var VkfInputCollection = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/index.vue"]]);
408
+ var Core = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/core.vue"]]);
409
+
410
+ var _sfc_main = vue.defineComponent({
411
+ name: "VkfInputCollection",
412
+ props,
413
+ emits,
414
+ setup(props2, { emit, slots }) {
415
+ return () => vue.h(Core, {
416
+ ...props2,
417
+ "onUpdate:modelValue": (v) => emit("update:modelValue", v)
418
+ }, {
419
+ ...props2.slots,
420
+ ...slots
421
+ });
422
+ }
423
+ });
424
+
425
+ var VkfInputCollection = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/index.vue"]]);
387
426
 
388
427
  var types = /*#__PURE__*/Object.freeze({
389
428
  __proto__: null
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, createVNode, Fragment, ref, openBlock, createBlock, withCtx, normalizeProps, guardReactiveProps, createSlots, createElementBlock, createTextVNode, createCommentVNode, renderSlot } from 'vue';
1
+ import { defineComponent, computed, createVNode, Fragment, ref, openBlock, createBlock, withCtx, normalizeProps, guardReactiveProps, createSlots, createElementBlock, createTextVNode, createCommentVNode, renderSlot, h } from 'vue';
2
2
  import { p as plus_default, g as minus_default } from '../index.mjs';
3
3
  import { ensetData, getValue } from '@vunk/core';
4
4
  import { VkfFieldset } from '@vunk/form/components/fieldset';
@@ -56,6 +56,24 @@ const props = {
56
56
  defaultItemValue: {
57
57
  type: Object,
58
58
  default: () => ({})
59
+ },
60
+ /**
61
+ * @description 保留最后一个不被删除
62
+ */
63
+ keepLast: {
64
+ type: Boolean,
65
+ default: false
66
+ },
67
+ /**
68
+ * @description 是否开启顶部的添加按钮
69
+ */
70
+ topSplicable: {
71
+ type: Boolean,
72
+ default: true
73
+ },
74
+ slots: {
75
+ type: Object,
76
+ default: () => ({})
59
77
  }
60
78
  };
61
79
  const emits = {
@@ -63,12 +81,11 @@ const emits = {
63
81
  };
64
82
 
65
83
  const ROW_KEY = "_row_key";
66
- var _sfc_main = /* @__PURE__ */defineComponent({
84
+ var _sfc_main$1 = /* @__PURE__ */defineComponent({
67
85
  ...{
68
- name: "VkfInputCollection",
69
86
  inheritAttrs: false
70
87
  },
71
- __name: "index",
88
+ __name: "core",
72
89
  props: props,
73
90
  emits,
74
91
  setup(__props, {
@@ -174,6 +191,7 @@ var _sfc_main = /* @__PURE__ */defineComponent({
174
191
  "type": "primary",
175
192
  "link": true,
176
193
  "circle": true,
194
+ "disabled": props.modelValue.length <= 1 && props.keepLast,
177
195
  "onClick": () => handleMinus($index)
178
196
  }, null)])
179
197
  }));
@@ -191,6 +209,9 @@ var _sfc_main = /* @__PURE__ */defineComponent({
191
209
  setExpandRowKeys([]);
192
210
  }
193
211
  function handleMinus(index) {
212
+ if (props.keepLast && props.modelValue.length <= 1) {
213
+ return;
214
+ }
194
215
  const data = cloneDeep(props.modelValue);
195
216
  data.splice(index, 1);
196
217
  emit("update:modelValue", data);
@@ -317,7 +338,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
317
338
  })),
318
339
  createSlots({
319
340
  default: withCtx(() => [
320
- !$setup.readonly && _ctx.splicable && !_ctx.labelActions ? (openBlock(), createElementBlock("div", _hoisted_1, [
341
+ !$setup.readonly && _ctx.splicable && !_ctx.labelActions && _ctx.topSplicable ? (openBlock(), createElementBlock("div", _hoisted_1, [
321
342
  createVNode($setup["ElButton"], {
322
343
  type: "primary",
323
344
  onClick: $setup.addToFirst
@@ -347,11 +368,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
347
368
  _: 2
348
369
  /* DYNAMIC */
349
370
  }, [
350
- !$setup.readonly && _ctx.splicable && _ctx.labelActions ? {
371
+ _ctx.labelActions ? {
351
372
  name: "labelActions",
352
373
  fn: withCtx(() => [
353
374
  renderSlot(_ctx.$slots, "labelActions"),
354
- createVNode($setup["ElButton"], {
375
+ !$setup.readonly && _ctx.splicable && _ctx.topSplicable ? (openBlock(), createBlock($setup["ElButton"], {
376
+ key: 0,
355
377
  size: "small",
356
378
  icon: $setup.Plus,
357
379
  onClick: $setup.addToFirst
@@ -361,7 +383,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
361
383
  ])),
362
384
  _: 1,
363
385
  __: [0]
364
- }, 8, ["icon"])
386
+ }, 8, ["icon"])) : createCommentVNode("v-if", true)
365
387
  ]),
366
388
  key: "0"
367
389
  } : void 0
@@ -379,7 +401,24 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
379
401
  /* FORWARDED */
380
402
  });
381
403
  }
382
- var VkfInputCollection = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/index.vue"]]);
404
+ var Core = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/core.vue"]]);
405
+
406
+ var _sfc_main = defineComponent({
407
+ name: "VkfInputCollection",
408
+ props,
409
+ emits,
410
+ setup(props2, { emit, slots }) {
411
+ return () => h(Core, {
412
+ ...props2,
413
+ "onUpdate:modelValue": (v) => emit("update:modelValue", v)
414
+ }, {
415
+ ...props2.slots,
416
+ ...slots
417
+ });
418
+ }
419
+ });
420
+
421
+ var VkfInputCollection = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/input-collection/src/index.vue"]]);
383
422
 
384
423
  var types = /*#__PURE__*/Object.freeze({
385
424
  __proto__: null