@vunk/form 1.1.12 → 1.1.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.
@@ -1,32 +1,34 @@
1
1
  import { formProps, formEmits, ElForm } from 'element-plus';
2
2
  import { bindPropsFactory, onEmitsFactory } from '@vunk/core/shared/utils-vue';
3
3
  import { NOOP } from '@vunk/core/shared/utils-function';
4
- import { defineComponent, shallowRef, getCurrentInstance, provide, resolveComponent, openBlock, createBlock, mergeProps, toHandlers, withCtx, createVNode, renderSlot } from 'vue';
4
+ import { defineComponent, shallowRef, getCurrentInstance, provide, computed, resolveComponent, openBlock, createBlock, mergeProps, toHandlers, withCtx, createVNode, renderSlot } from 'vue';
5
5
  import { VkfFormItemRenderer } from '@vunk/form/components/form-item-renderer';
6
6
  import { createFormBindProps, createFormOnEmits } from '@vunk/form/shared/element-plus';
7
7
  import { getValue } from '@vunk/core/shared/helper';
8
8
  import { VkfTemplatesDefault } from '@vunk/form/components/templates-default';
9
+ import { VkfTemplatesLayout } from '@vunk/form/components/templates-layout';
10
+ import { pickObject } from '@vunk/core/shared/utils-object';
9
11
 
10
- var __defProp = Object.defineProperty;
11
- var __defProps = Object.defineProperties;
12
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
13
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
14
- var __hasOwnProp = Object.prototype.hasOwnProperty;
15
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
16
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17
- var __spreadValues = (a, b) => {
12
+ var __defProp$1 = Object.defineProperty;
13
+ var __defProps$1 = Object.defineProperties;
14
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
15
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
16
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
17
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
18
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
+ var __spreadValues$1 = (a, b) => {
18
20
  for (var prop in b || (b = {}))
19
- if (__hasOwnProp.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- if (__getOwnPropSymbols)
22
- for (var prop of __getOwnPropSymbols(b)) {
23
- if (__propIsEnum.call(b, prop))
24
- __defNormalProp(a, prop, b[prop]);
21
+ if (__hasOwnProp$1.call(b, prop))
22
+ __defNormalProp$1(a, prop, b[prop]);
23
+ if (__getOwnPropSymbols$1)
24
+ for (var prop of __getOwnPropSymbols$1(b)) {
25
+ if (__propIsEnum$1.call(b, prop))
26
+ __defNormalProp$1(a, prop, b[prop]);
25
27
  }
26
28
  return a;
27
29
  };
28
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29
- const props = __spreadProps(__spreadValues({}, formProps), {
30
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
31
+ const props = __spreadProps$1(__spreadValues$1({}, formProps), {
30
32
  data: {
31
33
  type: Object,
32
34
  default: () => ({})
@@ -41,10 +43,22 @@ const props = __spreadProps(__spreadValues({}, formProps), {
41
43
  elRef: {
42
44
  type: Function,
43
45
  default: () => NOOP
46
+ },
47
+ layout: {
48
+ type: Boolean,
49
+ default: false
50
+ },
51
+ rowSource: {
52
+ type: Object,
53
+ default: () => ({})
54
+ },
55
+ colSource: {
56
+ type: Object,
57
+ default: () => ({})
44
58
  }
45
59
  });
46
60
  const createBindProps = bindPropsFactory(props);
47
- const emits = __spreadProps(__spreadValues({}, formEmits), {
61
+ const emits = __spreadProps$1(__spreadValues$1({}, formEmits), {
48
62
  setData: (e) => e,
49
63
  validate: null
50
64
  });
@@ -58,6 +72,58 @@ var ctx = /*#__PURE__*/Object.freeze({
58
72
  createOnEmits: createOnEmits
59
73
  });
60
74
 
75
+ var __defProp = Object.defineProperty;
76
+ var __defProps = Object.defineProperties;
77
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
78
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
79
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
80
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
81
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
82
+ var __spreadValues = (a, b) => {
83
+ for (var prop in b || (b = {}))
84
+ if (__hasOwnProp.call(b, prop))
85
+ __defNormalProp(a, prop, b[prop]);
86
+ if (__getOwnPropSymbols)
87
+ for (var prop of __getOwnPropSymbols(b)) {
88
+ if (__propIsEnum.call(b, prop))
89
+ __defNormalProp(a, prop, b[prop]);
90
+ }
91
+ return a;
92
+ };
93
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
94
+ const getRowEmptySpan = (row) => {
95
+ return 24 - row.templateSlots.reduce((a, c) => {
96
+ if (!c.span) {
97
+ throw new Error("ElColSource span is required");
98
+ }
99
+ return a + c.span;
100
+ }, 0);
101
+ };
102
+ const genColItem = (formItem, options = {}) => {
103
+ var _a;
104
+ const span = (_a = formItem.span) != null ? _a : options.span;
105
+ if (span === void 0 || span === null) {
106
+ throw new Error("genColItem ElColSource span is required");
107
+ }
108
+ return __spreadProps(__spreadValues({}, options), {
109
+ templateType: "ElCol",
110
+ span,
111
+ templateSlots: [
112
+ pickObject(formItem, {
113
+ excludes: ["span"]
114
+ })
115
+ ]
116
+ });
117
+ };
118
+ const genRowItem = (defaultItem, options = {}) => {
119
+ return __spreadProps(__spreadValues({}, options), {
120
+ templateType: "ElRow",
121
+ templateSlots: defaultItem ? [
122
+ defaultItem
123
+ ] : []
124
+ });
125
+ };
126
+
61
127
  var _export_sfc = (sfc, props) => {
62
128
  const target = sfc.__vccOpts || sfc;
63
129
  for (const [key, val] of props) {
@@ -73,7 +139,8 @@ const _sfc_main = defineComponent({
73
139
  components: {
74
140
  ElForm,
75
141
  VkfFormItemRenderer,
76
- VkfTemplatesDefault
142
+ VkfTemplatesDefault,
143
+ VkfTemplatesLayout
77
144
  },
78
145
  setup(props2, { emit }) {
79
146
  const formProps = createFormBindProps(props2, ["model"]);
@@ -86,16 +153,39 @@ const _sfc_main = defineComponent({
86
153
  formRef.value = e;
87
154
  props2.elRef(e);
88
155
  };
156
+ const rendererSource = computed(() => {
157
+ if (props2.layout) {
158
+ return props2.formItems.reduce((a, c) => {
159
+ const lastRow = a[a.length - 1];
160
+ const itemSpan = c.span ?? props2.colSource.span;
161
+ if (!itemSpan) {
162
+ a.push(c);
163
+ return a;
164
+ }
165
+ const colItem = genColItem(c, props2.colSource);
166
+ if (!lastRow || getRowEmptySpan(lastRow) < itemSpan) {
167
+ a.push(genRowItem(colItem, props2.rowSource));
168
+ } else {
169
+ lastRow.templateSlots.push(colItem);
170
+ }
171
+ return a;
172
+ }, []);
173
+ }
174
+ return props2.formItems;
175
+ });
89
176
  return {
90
177
  formProps,
91
178
  formEmits,
92
179
  getValue,
93
- getRef
180
+ getRef,
181
+ computed,
182
+ rendererSource
94
183
  };
95
184
  }
96
185
  });
97
186
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
98
187
  const _component_VkfTemplatesDefault = resolveComponent("VkfTemplatesDefault");
188
+ const _component_VkfTemplatesLayout = resolveComponent("VkfTemplatesLayout");
99
189
  const _component_VkfFormItemRenderer = resolveComponent("VkfFormItemRenderer");
100
190
  const _component_ElForm = resolveComponent("ElForm");
101
191
  return openBlock(), createBlock(_component_ElForm, mergeProps({
@@ -107,12 +197,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
107
197
  ref: _ctx.getRef
108
198
  }), {
109
199
  default: withCtx(() => [
110
- createVNode(_component_VkfFormItemRenderer, { source: _ctx.formItems }, {
200
+ createVNode(_component_VkfFormItemRenderer, { source: _ctx.rendererSource }, {
111
201
  default: withCtx(() => [
112
202
  createVNode(_component_VkfTemplatesDefault, {
113
203
  data: _ctx.data,
114
204
  onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
115
205
  }, null, 8, ["data"]),
206
+ createVNode(_component_VkfTemplatesLayout, { data: _ctx.data }, null, 8, ["data"]),
116
207
  renderSlot(_ctx.$slots, "rendererTemplate")
117
208
  ]),
118
209
  _: 3
@@ -1,5 +1,6 @@
1
1
  import { PropType } from 'vue';
2
2
  import type { SetDataEvent } from '@vunk/core';
3
+ import { ColItem, RowItem } from './types';
3
4
  export declare const props: {
4
5
  data: {
5
6
  type: PropType<Record<string, any>>;
@@ -325,6 +326,31 @@ export declare const props: {
325
326
  }> & {} & import("vue").ComponentCustomProperties & {}) => any>;
326
327
  default: () => () => void;
327
328
  };
329
+ /**
330
+ * 是否开启布局模式
331
+ */
332
+ layout: {
333
+ type: BooleanConstructor;
334
+ default: boolean;
335
+ };
336
+ /**
337
+ * itemLayout为 true 时,
338
+ * 该值生效
339
+ * el-row 添加额外属性
340
+ */
341
+ rowSource: {
342
+ type: PropType<Partial<RowItem>>;
343
+ default: () => {};
344
+ };
345
+ /**
346
+ * itemLayout为 true 时,
347
+ * 该值生效
348
+ * el-col 添加额外属性
349
+ */
350
+ colSource: {
351
+ type: PropType<Partial<ColItem>>;
352
+ default: () => ColItem;
353
+ };
328
354
  model: ObjectConstructor;
329
355
  rules: {
330
356
  readonly type: PropType<Partial<Record<string, import("element-plus/es/utils").Arrayable<import("element-plus").FormItemRule>>>>;
@@ -357,7 +383,7 @@ export declare const props: {
357
383
  };
358
384
  disabled: BooleanConstructor;
359
385
  };
360
- export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"data", keyof T2> | Extract<"disabled", keyof T2> | Extract<"model", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2>)[] | undefined>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"data", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"model", keyof T2>, KE> | Exclude<Extract<"labelPosition", keyof T2>, KE> | Exclude<Extract<"requireAsteriskPosition", keyof T2>, KE> | Exclude<Extract<"labelSuffix", keyof T2>, KE> | Exclude<Extract<"statusIcon", keyof T2>, KE> | Exclude<Extract<"validateOnRuleChange", keyof T2>, KE> | Exclude<Extract<"hideRequiredAsterisk", keyof T2>, KE> | Exclude<Extract<"scrollToError", keyof T2>, KE> | Exclude<Extract<"scrollIntoViewOptions", keyof T2>, KE> | Exclude<Extract<"formItems", keyof T2>, KE> : Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"data", keyof T2> | Extract<"disabled", keyof T2> | Extract<"model", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2>]: { [k in Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"data", keyof T2> | Extract<"disabled", keyof T2> | Extract<"model", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2>]: T2[k]; }[P]; }>;
386
+ export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"data", keyof T2> | Extract<"disabled", keyof T2> | Extract<"model", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"layout", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2>)[] | undefined>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"data", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"model", keyof T2>, KE> | Exclude<Extract<"labelPosition", keyof T2>, KE> | Exclude<Extract<"requireAsteriskPosition", keyof T2>, KE> | Exclude<Extract<"labelSuffix", keyof T2>, KE> | Exclude<Extract<"statusIcon", keyof T2>, KE> | Exclude<Extract<"validateOnRuleChange", keyof T2>, KE> | Exclude<Extract<"hideRequiredAsterisk", keyof T2>, KE> | Exclude<Extract<"scrollToError", keyof T2>, KE> | Exclude<Extract<"scrollIntoViewOptions", keyof T2>, KE> | Exclude<Extract<"formItems", keyof T2>, KE> | Exclude<Extract<"layout", keyof T2>, KE> | Exclude<Extract<"rowSource", keyof T2>, KE> | Exclude<Extract<"colSource", keyof T2>, KE> : Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"data", keyof T2> | Extract<"disabled", keyof T2> | Extract<"model", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"layout", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2>]: { [k in Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"data", keyof T2> | Extract<"disabled", keyof T2> | Extract<"model", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"layout", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2>]: T2[k]; }[P]; }>;
361
387
  export declare const emits: {
362
388
  setData: (e: SetDataEvent) => SetDataEvent<any>;
363
389
  validate: null;
@@ -36,6 +36,18 @@ const props = __spreadProps(__spreadValues({}, formProps), {
36
36
  elRef: {
37
37
  type: Function,
38
38
  default: () => NOOP
39
+ },
40
+ layout: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ rowSource: {
45
+ type: Object,
46
+ default: () => ({})
47
+ },
48
+ colSource: {
49
+ type: Object,
50
+ default: () => ({})
39
51
  }
40
52
  });
41
53
  const createBindProps = bindPropsFactory(props);
@@ -1,4 +1,5 @@
1
1
  import { ElForm } from 'element-plus';
2
+ import { RowItem } from './types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  data: {
4
5
  type: import("vue").PropType<Record<string, any>>;
@@ -324,6 +325,18 @@ declare const _default: import("vue").DefineComponent<{
324
325
  }> & {} & import("vue").ComponentCustomProperties & {}) => any>;
325
326
  default: () => () => void;
326
327
  };
328
+ layout: {
329
+ type: BooleanConstructor;
330
+ default: boolean;
331
+ };
332
+ rowSource: {
333
+ type: import("vue").PropType<Partial<RowItem>>;
334
+ default: () => {};
335
+ };
336
+ colSource: {
337
+ type: import("vue").PropType<Partial<import("./types").ColItem>>;
338
+ default: () => import("./types").ColItem;
339
+ };
327
340
  model: ObjectConstructor;
328
341
  rules: {
329
342
  readonly type: import("vue").PropType<Partial<Record<string, import("element-plus/es/utils").Arrayable<import("element-plus").FormItemRule>>>>;
@@ -378,6 +391,8 @@ declare const _default: import("vue").DefineComponent<{
378
391
  };
379
392
  getValue: (obj: any, k: any, intoUndefined?: import("@vunk/core").IntoUndefined | undefined, safe?: boolean | undefined) => any;
380
393
  getRef: (e: InstanceType<typeof ElForm>) => void;
394
+ computed: typeof import("@vue/reactivity").computed;
395
+ rendererSource: import("vue").ComputedRef<any>;
381
396
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
382
397
  setData: (e: import("@vunk/core").SetDataEvent<any>) => import("@vunk/core").SetDataEvent<any>;
383
398
  validate: null;
@@ -706,6 +721,18 @@ declare const _default: import("vue").DefineComponent<{
706
721
  }> & {} & import("vue").ComponentCustomProperties & {}) => any>;
707
722
  default: () => () => void;
708
723
  };
724
+ layout: {
725
+ type: BooleanConstructor;
726
+ default: boolean;
727
+ };
728
+ rowSource: {
729
+ type: import("vue").PropType<Partial<RowItem>>;
730
+ default: () => {};
731
+ };
732
+ colSource: {
733
+ type: import("vue").PropType<Partial<import("./types").ColItem>>;
734
+ default: () => import("./types").ColItem;
735
+ };
709
736
  model: ObjectConstructor;
710
737
  rules: {
711
738
  readonly type: import("vue").PropType<Partial<Record<string, import("element-plus/es/utils").Arrayable<import("element-plus").FormItemRule>>>>;
@@ -1066,5 +1093,8 @@ declare const _default: import("vue").DefineComponent<{
1066
1093
  hideRequiredAsterisk: boolean;
1067
1094
  scrollToError: boolean;
1068
1095
  formItems: any[];
1096
+ layout: boolean;
1097
+ rowSource: Partial<RowItem>;
1098
+ colSource: Partial<import("./types").ColItem>;
1069
1099
  }>;
1070
1100
  export default _default;
@@ -1,2 +1,12 @@
1
- import { FormItemRendererSource } from '@vunk/form/shared';
2
- export declare type FormItem<P extends string = string> = FormItemRendererSource<P>;
1
+ import { __VkfTemplatesDefault } from '@vunk/form/components/templates-default';
2
+ import { __VkfTemplatesLayout } from '@vunk/form/components/templates-layout';
3
+ export declare type FormItem<P extends string = string> = (__VkfTemplatesDefault.Source<P> | __VkfTemplatesLayout.ElRowSource<FormItem<P>> | __VkfTemplatesLayout.ElColSource<FormItem<P>> | __VkfTemplatesLayout.VkfFlexSource<FormItem<P>>) & {
4
+ /**
5
+ * 如果开启 props.itemLayout,那么
6
+ * span 将生效
7
+ * 1-24 之间的数字
8
+ */
9
+ span?: number;
10
+ };
11
+ export declare type ColItem = __VkfTemplatesLayout.ElColSource<FormItem>;
12
+ export declare type RowItem = __VkfTemplatesLayout.ElRowSource<ColItem>;
@@ -0,0 +1,15 @@
1
+ import { ColItem, FormItem, RowItem } from './types';
2
+ import { __VkfTemplatesLayout } from '@vunk/form/components/templates-layout';
3
+ /**
4
+ * 判断 Row 中有多少空位
5
+ * @param row
6
+ * @returns
7
+ */
8
+ export declare const getRowEmptySpan: (row: RowItem) => number;
9
+ /**
10
+ * 根据 formItem 当前的 span 包装出 elCol 的数据
11
+ * @param formItem
12
+ * @returns
13
+ */
14
+ export declare const genColItem: (formItem: FormItem, options?: Partial<ColItem>) => __VkfTemplatesLayout.ElColSource<FormItem<string>>;
15
+ export declare const genRowItem: (defaultItem: ColItem, options?: Partial<RowItem>) => RowItem;
@@ -0,0 +1,55 @@
1
+ import { pickObject } from '@vunk/core/shared/utils-object';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ const getRowEmptySpan = (row) => {
23
+ return 24 - row.templateSlots.reduce((a, c) => {
24
+ if (!c.span) {
25
+ throw new Error("ElColSource span is required");
26
+ }
27
+ return a + c.span;
28
+ }, 0);
29
+ };
30
+ const genColItem = (formItem, options = {}) => {
31
+ var _a;
32
+ const span = (_a = formItem.span) != null ? _a : options.span;
33
+ if (span === void 0 || span === null) {
34
+ throw new Error("genColItem ElColSource span is required");
35
+ }
36
+ return __spreadProps(__spreadValues({}, options), {
37
+ templateType: "ElCol",
38
+ span,
39
+ templateSlots: [
40
+ pickObject(formItem, {
41
+ excludes: ["span"]
42
+ })
43
+ ]
44
+ });
45
+ };
46
+ const genRowItem = (defaultItem, options = {}) => {
47
+ return __spreadProps(__spreadValues({}, options), {
48
+ templateType: "ElRow",
49
+ templateSlots: defaultItem ? [
50
+ defaultItem
51
+ ] : []
52
+ });
53
+ };
54
+
55
+ export { genColItem, genRowItem, getRowEmptySpan };
@@ -0,0 +1,85 @@
1
+
2
+ @keyframes hide {
3
+ 0% {
4
+ opacity: 1; /* 初始状态为完全显示 */
5
+ }
6
+ 100% {
7
+ opacity: 0; /* 最终状态为完全隐藏 */
8
+ display: none; /* 同时隐藏元素 */
9
+ }
10
+ }
11
+
12
+ .vkf-upload-plus{
13
+ --vkf-upload-plus-height: 34px;
14
+ }
15
+ .vkf-upload-plus-label{
16
+ position: relative;
17
+ }
18
+ .vkf-upload-plus-cube-x,
19
+ .vkf-upload-plus-msg-x
20
+ {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ bottom: 0;
25
+ right: 0;
26
+ }
27
+ .vkf-upload-plus-msg-x{
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ color: var(--el-color-success);
32
+ background: var(--el-bg-color);
33
+ animation-name: hide; /* 指定使用hide关键帧动画 */
34
+ animation-duration: 1s; /* 动画持续时间为2秒 */
35
+ animation-delay: 1s; /* 延迟2秒后开始动画 */
36
+ animation-fill-mode: forwards; /* 动画结束后保持最后一帧的状态 */
37
+ }
38
+ .vkf-upload-plus-msg{
39
+ margin-left: 2px;
40
+ }
41
+ .vkf-upload-plus-cube {
42
+ float: left;
43
+ height: 100%;
44
+ }
45
+ .vkf-upload-plus-cube.error {
46
+ background: var(--el-color-danger);
47
+ }
48
+ .vkf-upload-plus-cube .success{
49
+ background: var(--el-color-success);
50
+ }
51
+ .vkf-upload-plus-cube .uploading{
52
+ background: var(--el-color-primary);
53
+ }
54
+ .vkf-upload-plus-cube .error{
55
+ background: var(--el-color-danger);
56
+ }
57
+
58
+ .vkf-upload-plus-btng >.el-button:first-child{
59
+ border-radius: 0;
60
+ }
61
+ .vkf-upload-plus-btng >.el-button{
62
+ height: var(--vkf-upload-plus-height);
63
+ }
64
+ .vkf-upload-plus-main{
65
+ display: flex;
66
+ align-items: center;
67
+ border: var(--el-border);
68
+ border-radius: var(--el-border-radius-base);
69
+ }
70
+ .vkf-upload-plus-label{
71
+ cursor: pointer;
72
+ }
73
+ .vkf-upload-plus-label .el-input{
74
+ pointer-events: none;
75
+ --el-input-border-color: transparent;
76
+ }
77
+ .vkf-upload-plus-label .el-input.is-success .el-icon{
78
+ color: var(--el-color-success);
79
+ }
80
+ .vkf-upload-plus-label .el-input.is-error .el-icon{
81
+ color: var(--el-color-danger);
82
+ }
83
+ .vkf-upload-plus-input{
84
+ display: none;
85
+ }
@@ -0,0 +1,6 @@
1
+ import VkfUploadPlus from './src/index.vue.d';
2
+ export * as __VkfUploadPlus from './src/types';
3
+ export * as _VkfUploadPlusConst from './src/const';
4
+ export * as _VkfUploadPlusApi from './src/api';
5
+ export { VkfUploadPlus, };
6
+ export default VkfUploadPlus;