@vunk/form 2.14.13 → 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.
@@ -13,5 +13,5 @@ export type Column<R extends NormalObject = NormalObject, SourceType extends Nor
13
13
  }, formItemProps: SourceType) => Partial<SourceType>;
14
14
  };
15
15
  export interface Slots {
16
- options: AnyFunc;
16
+ labelActions?: AnyFunc;
17
17
  }
@@ -1774,9 +1774,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
1774
1774
  visible: boolean;
1775
1775
  modelValue: Record<string, any>;
1776
1776
  formItems: unknown[];
1777
+ title: string;
1777
1778
  dialogFormProps: Record<string, any>;
1778
1779
  validateCatch: AnyFunc;
1779
- title: string;
1780
1780
  openReset: boolean;
1781
1781
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1782
1782
  export default _default;
@@ -2860,9 +2860,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
2860
2860
  visible: boolean;
2861
2861
  modelValue: Record<string, any>;
2862
2862
  formItems: unknown[];
2863
+ title: string;
2863
2864
  dialogFormProps: Record<string, any>;
2864
2865
  validateCatch: import("@vunk/shared").AnyFunc;
2865
- title: string;
2866
2866
  openReset: boolean;
2867
2867
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2868
2868
  TemplatesLayout: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
@@ -95,7 +95,10 @@ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
95
95
  }
96
96
  });
97
97
 
98
- const _hoisted_1 = { key: 0 };
98
+ const _hoisted_1 = {
99
+ key: 0,
100
+ class: "vkf-form-item-label__span"
101
+ };
99
102
  const _hoisted_2 = {
100
103
  key: 2,
101
104
  class: "vkf-form-item-label__actions"
@@ -1,3 +1,6 @@
1
+ .vkf-form-item-label__span{
2
+ vertical-align: middle;
3
+ }
1
4
  .vkf-form-item-label-tip-button:hover .el-icon {
2
5
  color: var(--el-color-primary);
3
6
  }
@@ -91,7 +91,10 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
91
91
  }
92
92
  });
93
93
 
94
- const _hoisted_1 = { key: 0 };
94
+ const _hoisted_1 = {
95
+ key: 0,
96
+ class: "vkf-form-item-label__span"
97
+ };
95
98
  const _hoisted_2 = {
96
99
  key: 2,
97
100
  class: "vkf-form-item-label__actions"
@@ -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