jky-component-lib 0.0.46 → 0.0.49

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.
@@ -18,20 +18,20 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderSlot, createCommentVNode } from "vue";
21
- const _hoisted_1$5 = ["disabled"];
22
- const _hoisted_2$3 = {
21
+ const _hoisted_1 = ["disabled"];
22
+ const _hoisted_2 = {
23
23
  key: 0,
24
24
  class: "jky-button__loading"
25
25
  };
26
- const _hoisted_3$3 = {
26
+ const _hoisted_3 = {
27
27
  key: 0,
28
28
  class: "jky-button__icon"
29
29
  };
30
- const _hoisted_4$3 = {
30
+ const _hoisted_4 = {
31
31
  key: 1,
32
32
  class: "jky-button__icon"
33
33
  };
34
- const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
34
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
35
35
  name: "JkyButton"
36
36
  }), {
37
37
  __name: "Button",
@@ -64,7 +64,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
64
64
  disabled: __props.disabled || __props.loading,
65
65
  onClick: handleClick
66
66
  }, [
67
- __props.loading ? (openBlock(), createElementBlock("span", _hoisted_2$3, [..._cache[0] || (_cache[0] = [
67
+ __props.loading ? (openBlock(), createElementBlock("span", _hoisted_2, [..._cache[0] || (_cache[0] = [
68
68
  createElementVNode("svg", {
69
69
  class: "loading-spinner",
70
70
  viewBox: "0 0 50 50"
@@ -90,7 +90,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
90
90
  ])
91
91
  ], -1)
92
92
  ])])) : __props.icon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
93
- __props.iconPosition === "prefix" ? (openBlock(), createElementBlock("span", _hoisted_3$3, [
93
+ __props.iconPosition === "prefix" ? (openBlock(), createElementBlock("span", _hoisted_3, [
94
94
  renderSlot(_ctx.$slots, "icon", {}, () => [
95
95
  createElementVNode("span", {
96
96
  class: normalizeClass(__props.icon)
@@ -98,7 +98,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
98
98
  ])
99
99
  ])) : createCommentVNode("", true),
100
100
  renderSlot(_ctx.$slots, "default"),
101
- __props.iconPosition === "suffix" ? (openBlock(), createElementBlock("span", _hoisted_4$3, [
101
+ __props.iconPosition === "suffix" ? (openBlock(), createElementBlock("span", _hoisted_4, [
102
102
  renderSlot(_ctx.$slots, "icon", {}, () => [
103
103
  createElementVNode("span", {
104
104
  class: normalizeClass(__props.icon)
@@ -109,10 +109,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
109
109
  renderSlot(_ctx.$slots, "icon"),
110
110
  renderSlot(_ctx.$slots, "default")
111
111
  ], 64))
112
- ], 10, _hoisted_1$5);
112
+ ], 10, _hoisted_1);
113
113
  };
114
114
  }
115
115
  }));
116
116
  export {
117
- _sfc_main$8 as default
117
+ _sfc_main as default
118
118
  };
@@ -19,8 +19,8 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { defineComponent, inject, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, normalizeClass, normalizeStyle, createSlots, withCtx, createTextVNode, toDisplayString, createElementVNode, createVNode, createCommentVNode } from "vue";
21
21
  import { ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem } from "element-plus";
22
- const _hoisted_1$4 = { class: "jky-button-nav flex flex-wrap items-center gap-2" };
23
- const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
22
+ const _hoisted_1 = { class: "jky-button-nav flex flex-wrap items-center gap-2" };
23
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
24
24
  name: "JkyButtonNav"
25
25
  }), {
26
26
  __name: "ButtonNav",
@@ -61,7 +61,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
61
61
  }
62
62
  }
63
63
  return (_ctx, _cache) => {
64
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
64
+ return openBlock(), createElementBlock("div", _hoisted_1, [
65
65
  (openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
66
66
  return openBlock(), createBlock(unref(ElButton), {
67
67
  key: item.value,
@@ -142,5 +142,5 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
142
142
  }
143
143
  }));
144
144
  export {
145
- _sfc_main$7 as default
145
+ _sfc_main as default
146
146
  };
@@ -110,8 +110,207 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
110
110
  resetFields: typeof resetFields;
111
111
  clearValidate: typeof clearValidate;
112
112
  getFormInstance: typeof getFormInstance;
113
+ formRef: globalThis.Ref<({
114
+ $: import('vue').ComponentInternalInstance;
115
+ $data: {};
116
+ $props: {
117
+ readonly model?: Record<string, any> | undefined;
118
+ readonly rules?: import('element-plus').FormRules | undefined;
119
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
120
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
121
+ readonly labelWidth?: string | number | undefined;
122
+ readonly labelSuffix?: string | undefined;
123
+ readonly inline?: boolean | undefined;
124
+ readonly inlineMessage?: boolean | undefined;
125
+ readonly statusIcon?: boolean | undefined;
126
+ readonly showMessage?: boolean | undefined;
127
+ readonly validateOnRuleChange?: boolean | undefined;
128
+ readonly hideRequiredAsterisk?: boolean | undefined;
129
+ readonly scrollToError?: boolean | undefined;
130
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
131
+ readonly size?: import('element-plus').ComponentSize | undefined;
132
+ readonly disabled?: boolean | undefined;
133
+ readonly onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
134
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
135
+ $attrs: import('vue').Attrs;
136
+ $refs: {
137
+ [x: string]: unknown;
138
+ };
139
+ $slots: Readonly<{
140
+ [name: string]: globalThis.Slot | undefined;
141
+ }>;
142
+ $root: ComponentPublicInstance | null;
143
+ $parent: ComponentPublicInstance | null;
144
+ $host: Element | null;
145
+ $emit: (event: "validate", prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
146
+ $el: any;
147
+ $options: import('vue').ComponentOptionsBase<Readonly<import('element-plus').FormProps> & Readonly<{
148
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
149
+ }>, {
150
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
151
+ validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
152
+ resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
153
+ clearValidate: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
154
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
155
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
156
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
157
+ setInitialValues: (initModel: Record<string, any>) => void;
158
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
159
+ validate: (prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
160
+ }, string, {
161
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
162
+ labelWidth: string | number;
163
+ labelPosition: "left" | "right" | "top";
164
+ requireAsteriskPosition: "left" | "right";
165
+ labelSuffix: string;
166
+ showMessage: boolean;
167
+ validateOnRuleChange: boolean;
168
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
169
+ beforeCreate?: (() => void) | (() => void)[];
170
+ created?: (() => void) | (() => void)[];
171
+ beforeMount?: (() => void) | (() => void)[];
172
+ mounted?: (() => void) | (() => void)[];
173
+ beforeUpdate?: (() => void) | (() => void)[];
174
+ updated?: (() => void) | (() => void)[];
175
+ activated?: (() => void) | (() => void)[];
176
+ deactivated?: (() => void) | (() => void)[];
177
+ beforeDestroy?: (() => void) | (() => void)[];
178
+ beforeUnmount?: (() => void) | (() => void)[];
179
+ destroyed?: (() => void) | (() => void)[];
180
+ unmounted?: (() => void) | (() => void)[];
181
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
182
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
183
+ errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
184
+ };
185
+ $forceUpdate: () => void;
186
+ $nextTick: typeof import('vue').nextTick;
187
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
188
+ } & Readonly<{
189
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
190
+ labelWidth: string | number;
191
+ labelPosition: "left" | "right" | "top";
192
+ requireAsteriskPosition: "left" | "right";
193
+ labelSuffix: string;
194
+ showMessage: boolean;
195
+ validateOnRuleChange: boolean;
196
+ }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
197
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
198
+ }>, "labelWidth" | "labelPosition" | "showMessage" | "validate" | "clearValidate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
199
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
200
+ validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
201
+ resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
202
+ clearValidate: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
203
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
204
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
205
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
206
+ setInitialValues: (initModel: Record<string, any>) => void;
207
+ }> & {} & import('vue').ComponentCustomProperties & {} & {
208
+ $slots: {
209
+ default?: (props: {}) => any;
210
+ };
211
+ }) | undefined, ({
212
+ $: import('vue').ComponentInternalInstance;
213
+ $data: {};
214
+ $props: {
215
+ readonly model?: Record<string, any> | undefined;
216
+ readonly rules?: import('element-plus').FormRules | undefined;
217
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
218
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
219
+ readonly labelWidth?: string | number | undefined;
220
+ readonly labelSuffix?: string | undefined;
221
+ readonly inline?: boolean | undefined;
222
+ readonly inlineMessage?: boolean | undefined;
223
+ readonly statusIcon?: boolean | undefined;
224
+ readonly showMessage?: boolean | undefined;
225
+ readonly validateOnRuleChange?: boolean | undefined;
226
+ readonly hideRequiredAsterisk?: boolean | undefined;
227
+ readonly scrollToError?: boolean | undefined;
228
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
229
+ readonly size?: import('element-plus').ComponentSize | undefined;
230
+ readonly disabled?: boolean | undefined;
231
+ readonly onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
232
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
233
+ $attrs: import('vue').Attrs;
234
+ $refs: {
235
+ [x: string]: unknown;
236
+ };
237
+ $slots: Readonly<{
238
+ [name: string]: globalThis.Slot | undefined;
239
+ }>;
240
+ $root: ComponentPublicInstance | null;
241
+ $parent: ComponentPublicInstance | null;
242
+ $host: Element | null;
243
+ $emit: (event: "validate", prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
244
+ $el: any;
245
+ $options: import('vue').ComponentOptionsBase<Readonly<import('element-plus').FormProps> & Readonly<{
246
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
247
+ }>, {
248
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
249
+ validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
250
+ resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
251
+ clearValidate: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
252
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
253
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
254
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
255
+ setInitialValues: (initModel: Record<string, any>) => void;
256
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
257
+ validate: (prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => void;
258
+ }, string, {
259
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
260
+ labelWidth: string | number;
261
+ labelPosition: "left" | "right" | "top";
262
+ requireAsteriskPosition: "left" | "right";
263
+ labelSuffix: string;
264
+ showMessage: boolean;
265
+ validateOnRuleChange: boolean;
266
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
267
+ beforeCreate?: (() => void) | (() => void)[];
268
+ created?: (() => void) | (() => void)[];
269
+ beforeMount?: (() => void) | (() => void)[];
270
+ mounted?: (() => void) | (() => void)[];
271
+ beforeUpdate?: (() => void) | (() => void)[];
272
+ updated?: (() => void) | (() => void)[];
273
+ activated?: (() => void) | (() => void)[];
274
+ deactivated?: (() => void) | (() => void)[];
275
+ beforeDestroy?: (() => void) | (() => void)[];
276
+ beforeUnmount?: (() => void) | (() => void)[];
277
+ destroyed?: (() => void) | (() => void)[];
278
+ unmounted?: (() => void) | (() => void)[];
279
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
280
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
281
+ errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
282
+ };
283
+ $forceUpdate: () => void;
284
+ $nextTick: typeof import('vue').nextTick;
285
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
286
+ } & Readonly<{
287
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
288
+ labelWidth: string | number;
289
+ labelPosition: "left" | "right" | "top";
290
+ requireAsteriskPosition: "left" | "right";
291
+ labelSuffix: string;
292
+ showMessage: boolean;
293
+ validateOnRuleChange: boolean;
294
+ }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
295
+ onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
296
+ }>, "labelWidth" | "labelPosition" | "showMessage" | "validate" | "clearValidate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
297
+ validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
298
+ validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
299
+ resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
300
+ clearValidate: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
301
+ scrollToField: (prop: import('element-plus').FormItemProp) => void;
302
+ getField: (prop: import('element-plus').FormItemProp) => import('element-plus').FormItemContext | undefined;
303
+ fields: import('vue').Reactive<import('element-plus').FormItemContext[]>;
304
+ setInitialValues: (initModel: Record<string, any>) => void;
305
+ }> & {} & import('vue').ComponentCustomProperties & {} & {
306
+ $slots: {
307
+ default?: (props: {}) => any;
308
+ };
309
+ }) | undefined>;
113
310
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
114
311
  change: (value: Record<string, any>) => any;
312
+ reset: () => any;
313
+ submit: (data: Record<string, any>) => any;
115
314
  "update:modelValue": (value: Record<string, any>) => any;
116
315
  validate: (result: {
117
316
  valid: boolean;
@@ -119,6 +318,8 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
119
318
  }) => any;
120
319
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
121
320
  onChange?: ((value: Record<string, any>) => any) | undefined;
321
+ onReset?: (() => any) | undefined;
322
+ onSubmit?: ((data: Record<string, any>) => any) | undefined;
122
323
  "onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
123
324
  onValidate?: ((result: {
124
325
  valid: boolean;
@@ -128,11 +329,14 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
128
329
  size: import('element-plus').ComponentSize;
129
330
  labelWidth: string | number;
130
331
  labelPosition: "left" | "right" | "top";
332
+ showFooter: boolean;
131
333
  showTitle: boolean;
132
334
  gutter: number;
133
335
  defaultSpan: number;
134
336
  responsive: boolean;
135
337
  watchDeep: boolean;
338
+ submitText: string;
339
+ cancelText: string;
136
340
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
137
341
  formRef: ({
138
342
  $: import('vue').ComponentInternalInstance;
@@ -37,15 +37,19 @@ var __async = (__this, __arguments, generator) => {
37
37
  step((generator = generator.apply(__this, __arguments)).next());
38
38
  });
39
39
  };
40
- import { defineComponent, useModel, ref, computed, watch, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, unref, mergeProps, withCtx, createElementVNode, normalizeStyle, Fragment, renderList, createBlock, mergeModels } from "vue";
41
- import { ElForm } from "element-plus";
42
- import _sfc_main from "./FormItem.vue.js";
40
+ import { defineComponent, useModel, ref, computed, watch, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, unref, mergeProps, withCtx, Fragment, renderList, createBlock, createTextVNode, mergeModels } from "vue";
41
+ import { ElForm, ElButton } from "element-plus";
42
+ import _sfc_main$1 from "./FormItem.vue.js";
43
43
  /* empty css */
44
- const _hoisted_1$2 = {
44
+ const _hoisted_1 = {
45
45
  key: 0,
46
46
  class: "jky-form__title mb-4 text-xl font-semibold"
47
47
  };
48
- const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
48
+ const _hoisted_2 = {
49
+ key: 1,
50
+ class: "jky-form__footer mt-6 flex justify-end gap-2"
51
+ };
52
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
49
53
  name: "JkyForm"
50
54
  }), {
51
55
  __name: "Form",
@@ -61,7 +65,14 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
61
65
  readonly: { type: Boolean },
62
66
  disabled: { type: Boolean },
63
67
  watchDeep: { type: Boolean, default: true },
68
+ showFooter: { type: Boolean, default: false },
69
+ submitText: { default: "提交" },
70
+ cancelText: { default: "取消" },
71
+ submitDisabled: { type: Boolean },
72
+ cancelDisabled: { type: Boolean },
64
73
  onValidate: {},
74
+ onSubmit: {},
75
+ onReset: {},
65
76
  model: {},
66
77
  rules: {},
67
78
  labelPosition: { default: "right" },
@@ -81,7 +92,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
81
92
  "modelValue": { required: true, default: () => ({}) },
82
93
  "modelModifiers": {}
83
94
  }),
84
- emits: /* @__PURE__ */ mergeModels(["change", "validate"], ["update:modelValue"]),
95
+ emits: /* @__PURE__ */ mergeModels(["change", "validate", "submit", "reset"], ["update:modelValue"]),
85
96
  setup(__props, { expose: __expose, emit: __emit }) {
86
97
  const props = __props;
87
98
  const emit = __emit;
@@ -118,8 +129,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
118
129
  });
119
130
  }
120
131
  function resetFields() {
121
- var _a;
132
+ var _a, _b;
122
133
  (_a = formRef.value) == null ? void 0 : _a.resetFields();
134
+ emit("reset");
135
+ (_b = props.onReset) == null ? void 0 : _b.call(props);
123
136
  }
124
137
  function clearValidate(props2) {
125
138
  var _a;
@@ -128,17 +141,33 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
128
141
  function getFormInstance() {
129
142
  return formRef.value;
130
143
  }
144
+ function handleSubmit() {
145
+ return __async(this, null, function* () {
146
+ var _a, _b;
147
+ try {
148
+ yield (_a = formRef.value) == null ? void 0 : _a.validate();
149
+ emit("submit", __spreadValues({}, modelValue.value));
150
+ (_b = props.onSubmit) == null ? void 0 : _b.call(props, __spreadValues({}, modelValue.value));
151
+ } catch (error) {
152
+ emit("validate", { valid: false, fields: error.fields });
153
+ }
154
+ });
155
+ }
156
+ function handleCancel() {
157
+ resetFields();
158
+ }
131
159
  __expose({
132
160
  validate,
133
161
  resetFields,
134
162
  clearValidate,
135
- getFormInstance
163
+ getFormInstance,
164
+ formRef
136
165
  });
137
166
  return (_ctx, _cache) => {
138
167
  return openBlock(), createElementBlock("div", {
139
168
  class: normalizeClass(formClass.value)
140
169
  }, [
141
- __props.showTitle && __props.title ? (openBlock(), createElementBlock("div", _hoisted_1$2, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
170
+ __props.showTitle && __props.title ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
142
171
  createVNode(unref(ElForm), mergeProps({
143
172
  ref_key: "formRef",
144
173
  ref: formRef,
@@ -148,31 +177,45 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
148
177
  size: __props.size
149
178
  }, _ctx.$attrs), {
150
179
  default: withCtx(() => [
151
- createElementVNode("div", {
152
- class: "grid",
153
- style: normalizeStyle({
154
- gridTemplateColumns: "repeat(12, minmax(0, 1fr))",
155
- gap: `${__props.gutter}px`
156
- })
157
- }, [
158
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
159
- return openBlock(), createBlock(_sfc_main, {
160
- key: item.field,
161
- field: item.field,
162
- config: item,
163
- model: modelValue.value,
164
- readonly: __props.readonly,
165
- disabled: __props.disabled
166
- }, null, 8, ["field", "config", "model", "readonly", "disabled"]);
167
- }), 128))
168
- ], 4)
180
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
181
+ return openBlock(), createBlock(_sfc_main$1, {
182
+ key: item.field,
183
+ field: item.field,
184
+ config: item,
185
+ model: modelValue.value,
186
+ readonly: __props.readonly,
187
+ disabled: __props.disabled
188
+ }, null, 8, ["field", "config", "model", "readonly", "disabled"]);
189
+ }), 128))
169
190
  ]),
170
191
  _: 1
171
- }, 16, ["model", "label-width", "label-position", "size"])
192
+ }, 16, ["model", "label-width", "label-position", "size"]),
193
+ props.showFooter ? (openBlock(), createElementBlock("div", _hoisted_2, [
194
+ createVNode(unref(ElButton), {
195
+ disabled: __props.cancelDisabled || __props.disabled,
196
+ onClick: handleCancel
197
+ }, {
198
+ default: withCtx(() => [
199
+ createTextVNode(toDisplayString(__props.cancelText), 1)
200
+ ]),
201
+ _: 1
202
+ }, 8, ["disabled"]),
203
+ createVNode(unref(ElButton), {
204
+ type: "primary",
205
+ disabled: __props.submitDisabled || __props.disabled,
206
+ loading: false,
207
+ onClick: handleSubmit
208
+ }, {
209
+ default: withCtx(() => [
210
+ createTextVNode(toDisplayString(__props.submitText), 1)
211
+ ]),
212
+ _: 1
213
+ }, 8, ["disabled"])
214
+ ])) : createCommentVNode("", true)
172
215
  ], 2);
173
216
  };
174
217
  }
175
218
  }));
176
219
  export {
177
- _sfc_main$5 as default
220
+ _sfc_main as default
178
221
  };