vft 0.0.185 → 0.0.186

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.
Files changed (52) hide show
  1. package/es/app-components/super-form/types.d.ts +9 -0
  2. package/es/components/col/col.vue.d.ts +1 -11
  3. package/es/components/col/col.vue2.js +19 -20
  4. package/es/components/col/index.d.ts +0 -2
  5. package/es/components/col/types.d.ts +10 -0
  6. package/es/components/date-picker/date-picker-com/panel-date-range.vue2.js +2 -2
  7. package/es/components/exception/exception.vue2.js +1 -1
  8. package/es/components/link/index.d.ts +1 -0
  9. package/es/components/link/link.vue.d.ts +3 -13
  10. package/es/components/link/link.vue2.js +18 -21
  11. package/es/components/link/types.d.ts +11 -0
  12. package/es/components/link/types.js +1 -0
  13. package/es/components/modal/index.d.ts +24 -0
  14. package/es/components/modal/modal.vue.d.ts +2 -0
  15. package/es/components/modal/modal.vue2.js +24 -22
  16. package/es/components/modal/use/use-modal.d.ts +2 -1
  17. package/es/components/modal/use/use-modal.js +43 -40
  18. package/es/components/pagination/components/total.vue2.js +1 -1
  19. package/es/components/select/select.vue.js +2 -2
  20. package/es/components/super-form/super-form-item.vue2.js +24 -20
  21. package/es/components/super-form/types.d.ts +4 -1
  22. package/es/components/time-picker/time-picker-com/panel-time-range.vue2.js +2 -2
  23. package/es/components/upload/upload-list.vue2.js +1 -1
  24. package/es/package.json.d.ts +1 -1
  25. package/es/package.json.js +1 -1
  26. package/lib/app-components/super-form/types.d.ts +9 -0
  27. package/lib/components/col/col.vue.d.ts +1 -11
  28. package/lib/components/col/col.vue2.cjs +1 -1
  29. package/lib/components/col/index.d.ts +0 -2
  30. package/lib/components/col/types.d.ts +10 -0
  31. package/lib/components/date-picker/date-picker-com/panel-date-range.vue2.cjs +1 -1
  32. package/lib/components/exception/exception.vue2.cjs +1 -1
  33. package/lib/components/link/index.d.ts +1 -0
  34. package/lib/components/link/link.vue.d.ts +3 -13
  35. package/lib/components/link/link.vue2.cjs +1 -1
  36. package/lib/components/link/types.cjs +1 -0
  37. package/lib/components/link/types.d.ts +11 -0
  38. package/lib/components/modal/index.d.ts +24 -0
  39. package/lib/components/modal/modal.vue.d.ts +2 -0
  40. package/lib/components/modal/modal.vue2.cjs +1 -1
  41. package/lib/components/modal/use/use-modal.cjs +1 -1
  42. package/lib/components/modal/use/use-modal.d.ts +2 -1
  43. package/lib/components/pagination/components/total.vue2.cjs +1 -1
  44. package/lib/components/select/select.vue.cjs +1 -1
  45. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  46. package/lib/components/super-form/types.d.ts +4 -1
  47. package/lib/components/time-picker/time-picker-com/panel-time-range.vue2.cjs +1 -1
  48. package/lib/components/upload/upload-list.vue2.cjs +1 -1
  49. package/lib/package.json.cjs +1 -1
  50. package/lib/package.json.d.ts +1 -1
  51. package/package.json +5 -5
  52. package/web-types.json +1 -1
@@ -102,6 +102,15 @@ export interface SuperFormProps extends FormInnerProps {
102
102
  /** 自定义 reset 事件 */
103
103
  resetFunc?: () => Promise<void>;
104
104
  }
105
+ export interface SuperFormItemProps {
106
+ schema: FormSchema;
107
+ formProps: SuperFormProps;
108
+ allDefaultValues?: Record<string, any>;
109
+ formModel: Record<string, any>;
110
+ setFormModel: (key: string, value: any, schema: FormSchema) => void;
111
+ updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
112
+ formActionType?: Partial<FormActionType>;
113
+ }
105
114
  export interface FormSchema {
106
115
  /** 字段 key */
107
116
  field: string;
@@ -1,14 +1,4 @@
1
- import type { ColSize, ColSizeObject } from './types';
2
- export interface ColProps extends ColSizeObject {
3
- /** 自定义元素标签 */
4
- tag?: string;
5
- /** 以下为响应式栅格数或者栅格属性对象 pc 使用 */
6
- xs?: ColSize;
7
- sm?: ColSize;
8
- md?: ColSize;
9
- lg?: ColSize;
10
- xl?: ColSize;
11
- }
1
+ import type { ColProps } from './types';
12
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ColProps>, {
13
3
  tag: string;
14
4
  span: number;
@@ -1,20 +1,17 @@
1
- import { defineComponent as c, inject as d, computed as n, openBlock as h, createBlock as $, resolveDynamicComponent as b, normalizeClass as g, normalizeStyle as v, withCtx as x, renderSlot as y } from "vue";
2
- import { isNumber as u, isObject as _ } from "@vft/utils";
1
+ import { defineComponent as c, inject as h, computed as n, openBlock as $, createBlock as g, resolveDynamicComponent as b, normalizeClass as v, normalizeStyle as x, withCtx as y, renderSlot as _ } from "vue";
3
2
  import "../row/index.js";
4
3
  import "@vueuse/core";
4
+ import { isNumber as u, isObject as C } from "@vft/utils";
5
5
  import "../../utils/ns-cover.js";
6
6
  import "lodash";
7
- import { useNamespace as C } from "../../hooks/use-namespace/index.js";
7
+ import { useNamespace as j } from "../../hooks/use-namespace/index.js";
8
8
  import "@popperjs/core";
9
9
  import "../../hooks/use-z-index/index.js";
10
- import { rowContextKey as j } from "../row/constants.js";
11
- const e = (
12
- /* hoist-static*/
13
- C("col")
14
- ), E = c({
15
- name: e.b()
16
- }), A = /* @__PURE__ */ c({
17
- ...E,
10
+ import { rowContextKey as E } from "../row/constants.js";
11
+ const k = c({
12
+ name: "vft-col"
13
+ }), F = /* @__PURE__ */ c({
14
+ ...k,
18
15
  props: {
19
16
  tag: { default: "div" },
20
17
  xs: {},
@@ -27,8 +24,10 @@ const e = (
27
24
  pull: { default: 0 },
28
25
  push: { default: 0 }
29
26
  },
30
- setup(f) {
31
- const o = f, { gutter: a } = d(j, { gutter: n(() => 0) }), i = n(() => {
27
+ setup(p) {
28
+ const e = j("col"), o = p, f = useAttrs();
29
+ console.log(f, "propspropsprops");
30
+ const { gutter: a } = h(E, { gutter: n(() => 0) }), i = n(() => {
32
31
  const t = {};
33
32
  return a.value && (t.paddingLeft = t.paddingRight = `${a.value / 2}px`), t;
34
33
  }), m = n(() => {
@@ -37,7 +36,7 @@ const e = (
37
36
  const l = o[s];
38
37
  u(l) && (s === "span" ? t.push(e.b(`${o[s]}`)) : l > 0 && t.push(e.b(`${s}-${o[s]}`)));
39
38
  }), ["xs", "sm", "md", "lg", "xl"].forEach((s) => {
40
- u(o[s]) ? t.push(e.b(`${s}-${o[s]}`)) : _(o[s]) && Object.entries(o[s]).forEach(
39
+ u(o[s]) ? t.push(e.b(`${s}-${o[s]}`)) : C(o[s]) && Object.entries(o[s]).forEach(
41
40
  ([l, r]) => {
42
41
  t.push(
43
42
  l !== "span" ? e.b(`${s}-${l}-${r}`) : e.b(`${s}-${r}`)
@@ -46,17 +45,17 @@ const e = (
46
45
  );
47
46
  }), a.value && t.push(e.is("guttered")), [e.b(), t];
48
47
  });
49
- return (t, p) => (h(), $(b(t.tag), {
50
- class: g(m.value),
51
- style: v(i.value)
48
+ return (t, d) => ($(), g(b(t.tag), {
49
+ class: v(m.value),
50
+ style: x(i.value)
52
51
  }, {
53
- default: x(() => [
54
- y(t.$slots, "default")
52
+ default: y(() => [
53
+ _(t.$slots, "default")
55
54
  ]),
56
55
  _: 3
57
56
  }, 8, ["class", "style"]));
58
57
  }
59
58
  });
60
59
  export {
61
- A as default
60
+ F as default
62
61
  };
@@ -1,4 +1,3 @@
1
- import { type ColProps } from './col.vue';
2
1
  export declare const VftCol: import("vft/es/utils").SFCWithInstall<{
3
2
  new (...args: any[]): import("vue").CreateComponentPublicInstance<Readonly<globalThis.ExtractPropTypes<{
4
3
  push: {
@@ -179,5 +178,4 @@ export declare const VftCol: import("vft/es/utils").SFCWithInstall<{
179
178
  };
180
179
  })> & Record<string, any>;
181
180
  export * from './types';
182
- export { type ColProps };
183
181
  export default VftCol;
@@ -1,3 +1,13 @@
1
+ export interface ColProps extends ColSizeObject {
2
+ /** 自定义元素标签 */
3
+ tag?: string;
4
+ /** 以下为响应式栅格数或者栅格属性对象 pc 使用 */
5
+ xs?: ColSize;
6
+ sm?: ColSize;
7
+ md?: ColSize;
8
+ lg?: ColSize;
9
+ xl?: ColSize;
10
+ }
1
11
  export type ColSizeObject = {
2
12
  /** 栅格占据的列数 */
3
13
  span?: number;
@@ -376,7 +376,7 @@ const la = ["onClick"], ta = ["disabled"], na = ["disabled"], oa = ["disabled"],
376
376
  onClick: se
377
377
  }, {
378
378
  default: ve(() => [
379
- ce("清除")
379
+ ce(" 清除 ")
380
380
  ]),
381
381
  _: 1
382
382
  }, 8, ["class"])) : C("", !0),
@@ -388,7 +388,7 @@ const la = ["onClick"], ta = ["disabled"], na = ["disabled"], oa = ["disabled"],
388
388
  onClick: a[10] || (a[10] = (t) => e(W)(!1))
389
389
  }, {
390
390
  default: ve(() => [
391
- ce("确认")
391
+ ce(" 确认 ")
392
392
  ]),
393
393
  _: 1
394
394
  }, 8, ["class", "disabled"])
@@ -41,7 +41,7 @@ const N = /* @__PURE__ */ f({
41
41
  type: "primary",
42
42
  onClick: t[1] || (t[1] = //@ts-ignore
43
43
  (...r) => e(s) && e(s)(...r))
44
- }, "刷新页面")) : m("", !0)
44
+ }, " 刷新页面 ")) : m("", !0)
45
45
  ]),
46
46
  _: 1
47
47
  }, 8, ["title", "icon"]));
@@ -104,3 +104,4 @@ export declare const VftLink: import("vft/es/utils").SFCWithInstall<{
104
104
  };
105
105
  })> & Record<string, any>;
106
106
  export default VftLink;
107
+ export * from './types';
@@ -1,17 +1,7 @@
1
- import { type WinOpenType } from '@vft/router';
2
- import { type IconProps } from 'vft/es/components/icon';
3
- import { type RouteLocationRaw } from 'vue-router';
4
- interface Props {
5
- type?: 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'default';
6
- underline?: boolean;
7
- disabled?: boolean;
8
- route?: WinOpenType | RouteLocationRaw;
9
- isReplace?: boolean;
10
- icon?: IconProps;
11
- }
12
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
1
+ import type { LinkProps } from './types';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<LinkProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
3
  click: (...args: any[]) => void;
14
- }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>> & {
4
+ }, string, import("vue").PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToRuntimeProps<LinkProps>>> & {
15
5
  onClick?: ((...args: any[]) => any) | undefined;
16
6
  }, {}, {}>, {
17
7
  default?(_: {}): any;
@@ -1,18 +1,15 @@
1
- import { defineComponent as u, getCurrentInstance as b, computed as y, openBlock as r, createElementBlock as a, normalizeClass as s, unref as t, createBlock as C, normalizeProps as g, mergeProps as B, createCommentVNode as c, renderSlot as P } from "vue";
2
- import { useRouterHelper as R } from "@vft/router";
3
- import { singleAttrToObj as $ } from "@vft/utils";
4
- import { VftIcon as h } from "../icon/index.js";
1
+ import { defineComponent as u, getCurrentInstance as b, computed as y, openBlock as r, createElementBlock as a, normalizeClass as s, unref as t, createBlock as C, normalizeProps as g, mergeProps as B, createCommentVNode as c, renderSlot as v } from "vue";
2
+ import { VftIcon as P } from "../icon/index.js";
5
3
  import "@vueuse/core";
4
+ import { singleAttrToObj as R } from "@vft/utils";
6
5
  import "../../utils/ns-cover.js";
7
6
  import "lodash";
8
- import { useNamespace as v } from "../../hooks/use-namespace/index.js";
7
+ import { useNamespace as $ } from "../../hooks/use-namespace/index.js";
9
8
  import "@popperjs/core";
10
9
  import "../../hooks/use-z-index/index.js";
11
- const o = (
12
- /* hoist-static*/
13
- v("link")
14
- ), z = u({
15
- name: o.b()
10
+ import { useRouterHelper as h } from "@vft/router";
11
+ const z = u({
12
+ name: "vft-link"
16
13
  }), D = /* @__PURE__ */ u({
17
14
  ...z,
18
15
  props: {
@@ -24,29 +21,29 @@ const o = (
24
21
  icon: {}
25
22
  },
26
23
  emits: ["click"],
27
- setup(n, { emit: m }) {
28
- const d = m, p = b().appContext.config.globalProperties.$router, { go: f } = R(p);
24
+ setup(o, { emit: m }) {
25
+ const n = $("link"), d = m, p = b().appContext.config.globalProperties.$router, { go: f } = h(p);
29
26
  function k(e) {
30
- n.route && f(n.route, n.isReplace), n.disabled || d("click", e);
27
+ o.route && f(o.route, o.isReplace), o.disabled || d("click", e);
31
28
  }
32
- const i = y(() => $(n.icon, "icon"));
29
+ const i = y(() => R(o.icon, "icon"));
33
30
  return (e, N) => {
34
31
  var l;
35
32
  return r(), a("span", {
36
33
  class: s([
37
- t(o).b(),
38
- t(o).m(e.type),
39
- t(o).is("disabled", e.disabled),
40
- t(o).is("underline", e.underline && !e.disabled)
34
+ t(n).b(),
35
+ t(n).m(e.type),
36
+ t(n).is("disabled", e.disabled),
37
+ t(n).is("underline", e.underline && !e.disabled)
41
38
  ]),
42
39
  onClick: k
43
40
  }, [
44
- (l = i.value) != null && l.icon ? (r(), C(t(h), g(B({ key: 0 }, i.value)), null, 16)) : c("", !0),
41
+ (l = i.value) != null && l.icon ? (r(), C(t(P), g(B({ key: 0 }, i.value)), null, 16)) : c("", !0),
45
42
  e.$slots.default ? (r(), a("span", {
46
43
  key: 1,
47
- class: s(t(o).e("inner"))
44
+ class: s(t(n).e("inner"))
48
45
  }, [
49
- P(e.$slots, "default")
46
+ v(e.$slots, "default")
50
47
  ], 2)) : c("", !0)
51
48
  ], 2);
52
49
  };
@@ -0,0 +1,11 @@
1
+ import type { WinOpenType } from '@vft/router';
2
+ import type { RouteLocationRaw } from 'vue-router';
3
+ import type { IconProps } from '../icon';
4
+ export interface LinkProps {
5
+ type?: 'primary' | 'success' | 'warning' | 'info' | 'danger' | 'default';
6
+ underline?: boolean;
7
+ disabled?: boolean;
8
+ route?: WinOpenType | RouteLocationRaw;
9
+ isReplace?: boolean;
10
+ icon?: IconProps;
11
+ }
@@ -0,0 +1 @@
1
+
@@ -30,6 +30,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
30
30
  type: globalThis.PropType<boolean>;
31
31
  default: boolean;
32
32
  };
33
+ loading: {
34
+ type: globalThis.PropType<boolean>;
35
+ };
33
36
  trapFocus: {
34
37
  type: globalThis.PropType<boolean>;
35
38
  default: boolean;
@@ -111,6 +114,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
111
114
  closeFunc: {
112
115
  type: globalThis.PropType<() => Promise<any>>;
113
116
  };
117
+ confirmLoading: {
118
+ type: globalThis.PropType<boolean>;
119
+ };
114
120
  }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
115
121
  [x: string]: (...args: any[]) => void;
116
122
  }, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<globalThis.ExtractPropTypes<{
@@ -143,6 +149,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
143
149
  type: globalThis.PropType<boolean>;
144
150
  default: boolean;
145
151
  };
152
+ loading: {
153
+ type: globalThis.PropType<boolean>;
154
+ };
146
155
  trapFocus: {
147
156
  type: globalThis.PropType<boolean>;
148
157
  default: boolean;
@@ -224,6 +233,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
224
233
  closeFunc: {
225
234
  type: globalThis.PropType<() => Promise<any>>;
226
235
  };
236
+ confirmLoading: {
237
+ type: globalThis.PropType<boolean>;
238
+ };
227
239
  }>>, {
228
240
  title: string;
229
241
  center: boolean;
@@ -282,6 +294,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
282
294
  type: globalThis.PropType<boolean>;
283
295
  default: boolean;
284
296
  };
297
+ loading: {
298
+ type: globalThis.PropType<boolean>;
299
+ };
285
300
  trapFocus: {
286
301
  type: globalThis.PropType<boolean>;
287
302
  default: boolean;
@@ -363,6 +378,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
363
378
  closeFunc: {
364
379
  type: globalThis.PropType<() => Promise<any>>;
365
380
  };
381
+ confirmLoading: {
382
+ type: globalThis.PropType<boolean>;
383
+ };
366
384
  }>>, {}, {}, {}, {}, {
367
385
  title: string;
368
386
  center: boolean;
@@ -418,6 +436,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
418
436
  type: globalThis.PropType<boolean>;
419
437
  default: boolean;
420
438
  };
439
+ loading: {
440
+ type: globalThis.PropType<boolean>;
441
+ };
421
442
  trapFocus: {
422
443
  type: globalThis.PropType<boolean>;
423
444
  default: boolean;
@@ -499,6 +520,9 @@ export declare const VftModal: import("vft/es/utils").SFCWithInstall<{
499
520
  closeFunc: {
500
521
  type: globalThis.PropType<() => Promise<any>>;
501
522
  };
523
+ confirmLoading: {
524
+ type: globalThis.PropType<boolean>;
525
+ };
502
526
  }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
503
527
  [x: string]: (...args: any[]) => void;
504
528
  }, string, {
@@ -3,6 +3,8 @@ import type { ModalActionProps } from './types';
3
3
  export interface ModalProps extends DialogProps {
4
4
  closeFunc?: () => Promise<any>;
5
5
  showActionButtonGroup?: boolean;
6
+ confirmLoading?: boolean;
7
+ loading?: boolean;
6
8
  }
7
9
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ModalProps & ModalActionProps>, {
8
10
  center: boolean;
@@ -1,12 +1,14 @@
1
- import { defineComponent as O, useAttrs as M, ref as c, getCurrentInstance as F, computed as u, unref as t, watchEffect as P, watch as R, nextTick as r, openBlock as m, createBlock as B, mergeProps as S, createSlots as _, withCtx as b, renderSlot as A, createCommentVNode as T } from "vue";
1
+ import { defineComponent as O, useAttrs as M, ref as c, getCurrentInstance as F, computed as u, unref as o, watchEffect as P, watch as R, nextTick as r, openBlock as m, createBlock as B, mergeProps as S, createSlots as _, withCtx as b, renderSlot as A, createCommentVNode as T } from "vue";
2
2
  import { isFunction as D, deepMerge as G } from "@vft/utils";
3
3
  import { VftDialog as I } from "../dialog/index.js";
4
4
  import $ from "./modal-footer-action.vue2.js";
5
- const W = /* @__PURE__ */ O({
5
+ const N = /* @__PURE__ */ O({
6
6
  __name: "modal",
7
7
  props: {
8
8
  closeFunc: {},
9
9
  showActionButtonGroup: { type: Boolean, default: !1 },
10
+ confirmLoading: { type: Boolean },
11
+ loading: { type: Boolean },
10
12
  appendToBody: { type: Boolean, default: !1 },
11
13
  beforeClose: {},
12
14
  destroyOnClose: { type: Boolean, default: !1 },
@@ -44,34 +46,34 @@ const W = /* @__PURE__ */ O({
44
46
  "update:modelValue": [],
45
47
  submit: []
46
48
  },
47
- setup(h, { emit: y }) {
48
- const o = h, n = y, w = M(), i = c(null), l = c(!1), a = c(null), f = {
49
+ setup(y, { emit: h }) {
50
+ const t = y, n = h, g = M(), i = c(null), l = c(!1), a = c(null), f = {
49
51
  setModalProps: V,
50
52
  emitVisible: void 0,
51
53
  redoModalHeight: () => {
52
54
  r(() => {
53
- t(a) && t(a).setModalHeight();
55
+ o(a) && o(a).setModalHeight();
54
56
  });
55
57
  }
56
58
  }, s = F();
57
59
  s && n("register", f, s.uid);
58
- const C = u(() => ({
59
- ...o,
60
- ...t(i)
61
- })), g = u(() => ({
62
- ...w,
63
- ...t(C),
64
- modelValue: t(l)
60
+ const w = u(() => ({
61
+ ...t,
62
+ ...o(i)
63
+ })), C = u(() => ({
64
+ ...g,
65
+ ...o(w),
66
+ modelValue: o(l)
65
67
  }));
66
68
  P(() => {
67
- l.value = !!o.modelValue;
69
+ l.value = !!t.modelValue;
68
70
  }), R(
69
- () => t(l),
71
+ () => o(l),
70
72
  (e) => {
71
73
  n("visible-change", e), n("update:modelValue", e), s && r(() => {
72
74
  f.emitVisible(e, s.uid);
73
75
  }), r(() => {
74
- o.scrollTop && e && t(a) && t(a).scrollTop();
76
+ t.scrollTop && e && o(a) && o(a).scrollTop();
75
77
  });
76
78
  },
77
79
  {
@@ -79,24 +81,24 @@ const W = /* @__PURE__ */ O({
79
81
  }
80
82
  );
81
83
  async function d(e) {
82
- if (e == null || e.stopPropagation(), o.closeFunc && D(o.closeFunc)) {
83
- const p = await o.closeFunc();
84
+ if (e == null || e.stopPropagation(), t.closeFunc && D(t.closeFunc)) {
85
+ const p = await t.closeFunc();
84
86
  l.value = !p;
85
87
  return;
86
88
  }
87
89
  l.value = !1, n("close", e);
88
90
  }
89
91
  function V(e) {
90
- i.value = G(t(i) || {}, e), Reflect.has(e, "modelValue") && (l.value = !!e.modelValue);
92
+ i.value = G(o(i) || {}, e), Reflect.has(e, "modelValue") && (l.value = !!e.modelValue);
91
93
  }
92
94
  const k = u(() => ({
93
95
  onClick: (e) => d(e),
94
- ...o.cancelButtonOptions
96
+ ...t.cancelButtonOptions
95
97
  })), v = u(() => ({
96
98
  onClick: () => n("submit"),
97
- ...o.submitButtonOptions
99
+ ...t.submitButtonOptions
98
100
  }));
99
- return (e, p) => (m(), B(t(I), S(g.value, { onClose: d }), _({
101
+ return (e, p) => (m(), B(o(I), S(C.value, { onClose: d }), _({
100
102
  default: b(() => [
101
103
  A(e.$slots, "default")
102
104
  ]),
@@ -119,5 +121,5 @@ const W = /* @__PURE__ */ O({
119
121
  }
120
122
  });
121
123
  export {
122
- W as default
124
+ N as default
123
125
  };
@@ -1,6 +1,7 @@
1
+ import type { Fn } from '../../types';
1
2
  import type { UseModalInnerReturnType, UseModalReturnType } from '../types';
2
3
  /**
3
4
  * @description: Applicable to independent modal and call outside
4
5
  */
5
6
  export declare function useModal(): UseModalReturnType;
6
- export declare const useModalInner: (callbackFn?: any) => UseModalInnerReturnType;
7
+ export declare const useModalInner: (callbackFn?: Fn) => UseModalInnerReturnType;
@@ -1,91 +1,94 @@
1
- import { onBeforeUnMountedOrDeactivated as m } from "@vft/use";
2
- import { isFunction as V } from "@vft/utils";
3
- import { isEqual as w } from "lodash";
4
- import { reactive as v, ref as d, computed as P, unref as n, toRaw as c, getCurrentInstance as h, watchEffect as H, nextTick as I } from "vue";
5
- const i = v({}), p = v({});
1
+ import { isFunction as w } from "@vft/utils";
2
+ import { isEqual as H } from "lodash";
3
+ import { reactive as m, ref as d, computed as v, unref as t, toRaw as c, getCurrentInstance as P, watchEffect as I, nextTick as R, onBeforeUnmount as h, onDeactivated as V } from "vue";
4
+ const a = m({}), g = m({});
6
5
  function x() {
7
- const r = d(null), l = d(!1), s = d("");
8
- function u(e, o) {
9
- if (!h())
6
+ const s = d(null), r = d(!1), l = d("");
7
+ function i(e, o) {
8
+ if (!P())
10
9
  throw new Error(
11
10
  "useModal() can only be used inside setup() or functional components!"
12
11
  );
13
- s.value = o, m(() => {
14
- r.value = null, l.value = !1, i[n(s)] = null;
15
- }), !(n(l) && e === n(r)) && (r.value = e, l.value = !0, e.emitVisible = (M, a) => {
16
- p[a] = M;
12
+ l.value = o, h(() => {
13
+ s.value = null, r.value = !1, a[t(l)] = null;
14
+ }), V(() => {
15
+ s.value = null, r.value = !1, a[t(l)] = null;
16
+ }), !(t(r) && e === t(s)) && (s.value = e, r.value = !0, e.emitVisible = (M, u) => {
17
+ g[u] = M;
17
18
  });
18
19
  }
19
- const t = () => {
20
- const e = n(r);
20
+ const n = () => {
21
+ const e = t(s);
21
22
  return e || console.error("useModal instance is undefined!"), e;
22
23
  }, f = {
23
24
  setModalProps: (e) => {
24
25
  var o;
25
- (o = t()) == null || o.setModalProps(e);
26
+ (o = n()) == null || o.setModalProps(e);
26
27
  },
27
- getVisible: P(() => p[~~n(s)]),
28
+ getVisible: v(() => g[~~t(l)]),
28
29
  redoModalHeight: () => {
29
30
  var e, o;
30
- (o = (e = t()) == null ? void 0 : e.redoModalHeight) == null || o.call(e);
31
+ (o = (e = n()) == null ? void 0 : e.redoModalHeight) == null || o.call(e);
31
32
  },
32
33
  openModal: (e = !0, o, M = !0) => {
33
- var g;
34
- if ((g = t()) == null || g.setModalProps({
34
+ var p;
35
+ if ((p = n()) == null || p.setModalProps({
35
36
  modelValue: e
36
37
  }), !o)
37
38
  return;
38
- const a = n(s);
39
+ const u = t(l);
39
40
  if (M) {
40
- i[a] = null, i[a] = c(o);
41
+ a[u] = null, a[u] = c(o);
41
42
  return;
42
43
  }
43
- w(c(i[a]), c(o)) || (i[a] = c(o));
44
+ H(c(a[u]), c(o)) || (a[u] = c(o));
44
45
  },
45
46
  closeModal: () => {
46
47
  var e;
47
- (e = t()) == null || e.setModalProps({ modelValue: !1 });
48
+ (e = n()) == null || e.setModalProps({ modelValue: !1 });
48
49
  }
49
50
  };
50
- return [u, f];
51
+ return [i, f];
51
52
  }
52
- const D = (r) => {
53
- const l = d(null), s = h(), u = d(""), t = () => {
54
- const e = n(l);
53
+ const D = (s) => {
54
+ const r = d(null), l = P(), i = d(""), n = () => {
55
+ const e = t(r);
55
56
  return e || console.error("useModalInner instance is undefined!"), e;
56
57
  }, f = (e, o) => {
57
- m(() => {
58
- l.value = null;
59
- }), u.value = o, l.value = e, s == null || s.emit("register", e, o);
58
+ h(() => {
59
+ r.value = null;
60
+ }), V(() => {
61
+ r.value = null;
62
+ }), i.value = o, r.value = e, l == null || l.emit("register", e, o);
60
63
  };
61
- return H(() => {
62
- const e = i[n(u)];
63
- e && (!r || !V(r) || I(() => {
64
- r(e);
64
+ return I(() => {
65
+ const e = a[t(i)];
66
+ e && (!s || !w(s) || R(() => {
67
+ s(e);
65
68
  }));
66
69
  }), [
67
70
  f,
68
71
  {
69
72
  changeLoading: (e = !0) => {
70
73
  var o;
71
- (o = t()) == null || o.setModalProps({ loading: e });
74
+ (o = n()) == null || o.setModalProps({ loading: e });
72
75
  },
73
- getVisible: P(() => p[~~n(u)]),
76
+ getVisible: v(() => g[~~t(i)]),
74
77
  changeOkLoading: (e = !0) => {
75
78
  var o;
76
- (o = t()) == null || o.setModalProps({ confirmLoading: e });
79
+ (o = n()) == null || o.setModalProps({ confirmLoading: e });
77
80
  },
78
81
  closeModal: () => {
79
82
  var e;
80
- (e = t()) == null || e.setModalProps({ modelValue: !1 });
83
+ (e = n()) == null || e.setModalProps({ modelValue: !1 });
81
84
  },
82
85
  setModalProps: (e) => {
83
86
  var o;
84
- (o = t()) == null || o.setModalProps(e);
87
+ (o = n()) == null || o.setModalProps(e);
85
88
  },
86
89
  redoModalHeight: () => {
87
90
  var o;
88
- const e = (o = t()) == null ? void 0 : o.redoModalHeight;
91
+ const e = (o = n()) == null ? void 0 : o.redoModalHeight;
89
92
  e && e();
90
93
  }
91
94
  }
@@ -17,7 +17,7 @@ const c = ["disabled"], y = /* @__PURE__ */ r({
17
17
  return (a, _) => (s(), i("span", {
18
18
  class: n(t(o).e("total")),
19
19
  disabled: t(e)
20
- }, " 共 " + p(a.total) + " 条 ", 11, c));
20
+ }, "共 " + p(a.total) + " 条", 11, c));
21
21
  }
22
22
  });
23
23
  export {
@@ -95,7 +95,7 @@ function L(e, o, O, H, P, A) {
95
95
  style: m({
96
96
  maxWidth: `${e.tagMaxWidth}px`
97
97
  })
98
- }, "+ " + d(e.modelValue.length - e.maxCollapseTags), 7)
98
+ }, " + " + d(e.modelValue.length - e.maxCollapseTags), 7)
99
99
  ]),
100
100
  content: p(() => [
101
101
  t("div", {
@@ -133,7 +133,7 @@ function L(e, o, O, H, P, A) {
133
133
  style: m({
134
134
  maxWidth: `${e.tagMaxWidth}px`
135
135
  })
136
- }, "+ " + d(e.modelValue.length - e.maxCollapseTags), 7))
136
+ }, " + " + d(e.modelValue.length - e.maxCollapseTags), 7))
137
137
  ]),
138
138
  _: 1
139
139
  }, 8, ["size"])) : u("", !0)