vft 0.0.415 → 0.0.417

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 (143) hide show
  1. package/attributes.json +1 -1
  2. package/dist/index.css +1 -1
  3. package/es/components/autocomplete/autocomplete.vue.d.ts +8 -8
  4. package/es/components/autocomplete/index.d.ts +24 -24
  5. package/es/components/button/button.vue.d.ts +1 -1
  6. package/es/components/button/index.d.ts +30 -30
  7. package/es/components/button/use-button.d.ts +1 -1
  8. package/es/components/carousel/use-carousel.js +1 -1
  9. package/es/components/color-picker/composables/use-alpha-slider.d.ts +2 -2
  10. package/es/components/config-provider/config-provider.vue.d.ts +2 -0
  11. package/es/components/config-provider/config-provider.vue2.js +4 -3
  12. package/es/components/config-provider/index.d.ts +9 -0
  13. package/es/components/dialog/constants.d.ts +1 -0
  14. package/es/components/dialog/constants.js +2 -1
  15. package/es/components/dialog/dialog-content.vue.d.ts +4 -1
  16. package/es/components/dialog/dialog-content.vue2.js +59 -48
  17. package/es/components/dialog/dialog.vue.d.ts +4 -19
  18. package/es/components/dialog/dialog.vue2.js +104 -89
  19. package/es/components/dialog/index.d.ts +70 -3
  20. package/es/components/dialog/index.js +5 -4
  21. package/es/components/dialog/types.d.ts +69 -0
  22. package/es/components/dialog/{hooks/use-dialog.d.ts → use-dialog.d.ts} +11 -2
  23. package/es/components/dialog/use-dialog.js +138 -0
  24. package/es/components/drawer/composables/useResizable.d.ts +7 -0
  25. package/es/components/drawer/composables/useResizable.js +53 -0
  26. package/es/components/drawer/drawer.vue.d.ts +3 -7
  27. package/es/components/drawer/drawer.vue2.js +122 -97
  28. package/es/components/drawer/index.d.ts +78 -0
  29. package/es/components/drawer/types.d.ts +13 -0
  30. package/es/components/drawer/types.js +1 -0
  31. package/es/components/dropdown/dropdown.vue.d.ts +1 -1
  32. package/es/components/dropdown/index.d.ts +15 -15
  33. package/es/components/form/index.d.ts +6 -6
  34. package/es/components/index.js +172 -171
  35. package/es/components/input/input.vue2.js +4 -4
  36. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  37. package/es/components/input-tag/input-tag.vue.d.ts +1 -1
  38. package/es/components/link/index.d.ts +3 -3
  39. package/es/components/md-code-demo/md-code-demo.js +10 -10
  40. package/es/components/modal/index.d.ts +87 -24
  41. package/es/components/modal/modal.vue.d.ts +1 -1
  42. package/es/components/modal/modal.vue2.js +24 -17
  43. package/es/components/multiple-tabs/multiple-tabs.vue2.js +82 -79
  44. package/es/components/popover/index.d.ts +0 -9
  45. package/es/components/popover/popover.vue2.js +4 -5
  46. package/es/components/popover/types.d.ts +23 -1
  47. package/es/components/search/search.vue2.js +3 -3
  48. package/es/components/select/index.d.ts +20 -20
  49. package/es/components/select/select.vue.d.ts +20 -20
  50. package/es/components/select/useSelect.d.ts +17 -17
  51. package/es/components/super-form/super-form-item.vue2.js +1 -1
  52. package/es/components/table/index.d.ts +9 -9
  53. package/es/components/time-picker/time-picker-com/panel-time-pick.vue.d.ts +1 -1
  54. package/es/components/time-picker/time-picker-com/panel-time-range.vue.d.ts +1 -1
  55. package/es/components/timeline/index.d.ts +6 -6
  56. package/es/components/tooltip/index.d.ts +3 -3
  57. package/es/components/tooltip/tooltip.vue2.js +1 -1
  58. package/es/components/tooltip/types.d.ts +81 -1
  59. package/es/hooks/use-draggable/index.d.ts +5 -1
  60. package/es/hooks/use-draggable/index.js +39 -34
  61. package/es/hooks/use-z-index/index.js +3 -3
  62. package/es/index.js +2 -2
  63. package/es/package.json.d.ts +1 -1
  64. package/es/package.json.js +1 -1
  65. package/es/utils/helper.d.ts +1 -1
  66. package/es/utils/ns-cover.d.ts +1 -1
  67. package/es/utils/vue/vnode.js +1 -1
  68. package/lib/components/autocomplete/autocomplete.vue.d.ts +8 -8
  69. package/lib/components/autocomplete/index.d.ts +24 -24
  70. package/lib/components/button/button.vue.d.ts +1 -1
  71. package/lib/components/button/index.d.ts +30 -30
  72. package/lib/components/button/use-button.d.ts +1 -1
  73. package/lib/components/color-picker/composables/use-alpha-slider.d.ts +2 -2
  74. package/lib/components/config-provider/config-provider.vue.d.ts +2 -0
  75. package/lib/components/config-provider/config-provider.vue2.cjs +1 -1
  76. package/lib/components/config-provider/index.d.ts +9 -0
  77. package/lib/components/dialog/constants.cjs +1 -1
  78. package/lib/components/dialog/constants.d.ts +1 -0
  79. package/lib/components/dialog/dialog-content.vue.d.ts +4 -1
  80. package/lib/components/dialog/dialog-content.vue2.cjs +1 -1
  81. package/lib/components/dialog/dialog.vue.d.ts +4 -19
  82. package/lib/components/dialog/dialog.vue2.cjs +1 -1
  83. package/lib/components/dialog/index.cjs +1 -1
  84. package/lib/components/dialog/index.d.ts +70 -3
  85. package/lib/components/dialog/types.d.ts +69 -0
  86. package/lib/components/dialog/use-dialog.cjs +1 -0
  87. package/lib/components/dialog/{hooks/use-dialog.d.ts → use-dialog.d.ts} +11 -2
  88. package/lib/components/drawer/composables/useResizable.cjs +1 -0
  89. package/lib/components/drawer/composables/useResizable.d.ts +7 -0
  90. package/lib/components/drawer/drawer.vue.d.ts +3 -7
  91. package/lib/components/drawer/drawer.vue2.cjs +1 -1
  92. package/lib/components/drawer/index.d.ts +78 -0
  93. package/lib/components/drawer/types.cjs +1 -0
  94. package/lib/components/drawer/types.d.ts +13 -0
  95. package/lib/components/dropdown/dropdown.vue.d.ts +1 -1
  96. package/lib/components/dropdown/index.d.ts +15 -15
  97. package/lib/components/form/index.d.ts +6 -6
  98. package/lib/components/index.cjs +1 -1
  99. package/lib/components/input/input.vue2.cjs +1 -1
  100. package/lib/components/input-tag/input-tag.vue.d.ts +1 -1
  101. package/lib/components/link/index.d.ts +3 -3
  102. package/lib/components/md-code-demo/md-code-demo.cjs +1 -1
  103. package/lib/components/modal/index.d.ts +87 -24
  104. package/lib/components/modal/modal.vue.d.ts +1 -1
  105. package/lib/components/modal/modal.vue2.cjs +1 -1
  106. package/lib/components/multiple-tabs/multiple-tabs.vue2.cjs +1 -1
  107. package/lib/components/popover/index.d.ts +0 -9
  108. package/lib/components/popover/popover.vue2.cjs +1 -1
  109. package/lib/components/popover/types.d.ts +23 -1
  110. package/lib/components/search/search.vue2.cjs +1 -1
  111. package/lib/components/select/index.d.ts +20 -20
  112. package/lib/components/select/select.vue.d.ts +20 -20
  113. package/lib/components/select/useSelect.d.ts +17 -17
  114. package/lib/components/table/index.d.ts +9 -9
  115. package/lib/components/time-picker/time-picker-com/panel-time-pick.vue.d.ts +1 -1
  116. package/lib/components/time-picker/time-picker-com/panel-time-range.vue.d.ts +1 -1
  117. package/lib/components/timeline/index.d.ts +6 -6
  118. package/lib/components/tooltip/index.d.ts +3 -3
  119. package/lib/components/tooltip/tooltip.vue2.cjs +1 -1
  120. package/lib/components/tooltip/types.d.ts +81 -1
  121. package/lib/hooks/use-draggable/index.cjs +1 -1
  122. package/lib/hooks/use-draggable/index.d.ts +5 -1
  123. package/lib/index.cjs +1 -1
  124. package/lib/package.json.cjs +1 -1
  125. package/lib/package.json.d.ts +1 -1
  126. package/lib/utils/helper.d.ts +1 -1
  127. package/lib/utils/ns-cover.d.ts +1 -1
  128. package/package.json +3 -3
  129. package/tags.json +1 -1
  130. package/theme-style/index.css +1 -1
  131. package/theme-style/src/card.scss +4 -4
  132. package/theme-style/src/dialog.scss +36 -35
  133. package/theme-style/src/drawer.scss +109 -21
  134. package/theme-style/src/md-container.scss +1 -0
  135. package/theme-style/src/tag.scss +1 -1
  136. package/theme-style/vft-card.css +1 -1
  137. package/theme-style/vft-dialog.css +1 -1
  138. package/theme-style/vft-drawer.css +1 -1
  139. package/theme-style/vft-md-container.css +1 -1
  140. package/theme-style/vft-tag.css +1 -1
  141. package/web-types.json +1 -1
  142. package/es/components/dialog/hooks/use-dialog.js +0 -106
  143. package/lib/components/dialog/hooks/use-dialog.cjs +0 -1
@@ -6,12 +6,13 @@ import { withInstall as o } from "../../utils/vue/install.js";
6
6
  import "lodash-es";
7
7
  import "../form/index.js";
8
8
  import t from "./dialog.vue2.js";
9
- import { dialogInjectionKey as g } from "./constants.js";
10
- import { useDialog as d } from "./hooks/use-dialog.js";
9
+ import { DEFAULT_DIALOG_TRANSITION as D, dialogInjectionKey as _ } from "./constants.js";
10
+ import { useDialog as g } from "./use-dialog.js";
11
11
  const n = o(t);
12
12
  export {
13
+ D as DEFAULT_DIALOG_TRANSITION,
13
14
  n as VftDialog,
14
15
  n as default,
15
- g as dialogInjectionKey,
16
- d as useDialog
16
+ _ as dialogInjectionKey,
17
+ g as useDialog
17
18
  };
@@ -1,11 +1,80 @@
1
1
  import type { IconProps } from 'vft/es/components/icon';
2
+ import type { TransitionProps } from 'vue';
3
+ type DoneFn = (cancel?: boolean) => void;
4
+ export interface DialogProps extends DialogContentProps {
5
+ /** 是否将对话框挂载到 body 元素上 */
6
+ appendToBody?: boolean;
7
+ /** 指定对话框挂载的容器元素 */
8
+ appendTo?: string | HTMLElement;
9
+ /** 关闭前的回调,会暂停对话框的关闭 */
10
+ beforeClose?: (done: DoneFn) => void;
11
+ /** 关闭时销毁对话框内的元素 */
12
+ destroyOnClose?: boolean;
13
+ /** 是否可以通过点击遮罩层关闭对话框 */
14
+ closeOnClickModal?: boolean;
15
+ /** 是否可以通过按下 ESC 键关闭对话框 */
16
+ closeOnPressEscape?: boolean;
17
+ /** 是否锁定页面滚动 */
18
+ lockScroll?: boolean;
19
+ /** 是否显示遮罩层 */
20
+ modal?: boolean;
21
+ /** 对话框打开的延时时间(毫秒) */
22
+ openDelay?: number;
23
+ /** 对话框关闭的延时时间(毫秒) */
24
+ closeDelay?: number;
25
+ /** 对话框距离顶部的距离 */
26
+ top?: string;
27
+ /** 遮罩层是否可穿透 */
28
+ modalPenetrable?: boolean;
29
+ /** 对话框是否可见 */
30
+ modelValue?: boolean;
31
+ /** 遮罩层的自定义类名 */
32
+ modalClass?: string;
33
+ /** 对话框的宽度 */
34
+ width?: string | number;
35
+ /** 对话框的层级 */
36
+ zIndex?: number;
37
+ /** 是否启用焦点陷阱 */
38
+ trapFocus?: boolean;
39
+ /** 是否允许对话框内容溢出 */
40
+ overflow?: boolean;
41
+ /** 对话框的过渡动画 */
42
+ transition?: string | TransitionProps;
43
+ }
2
44
  export interface DialogContentProps {
45
+ /** 是否居中显示对话框 */
3
46
  center?: boolean;
47
+ /** 是否垂直居中显示对话框 */
4
48
  alignCenter?: boolean;
49
+ /** 关闭按钮的图标 */
5
50
  closeIcon?: string | IconProps;
51
+ /** 对话框的自定义类名 */
6
52
  customClass?: string;
53
+ /** 是否可拖拽对话框 */
7
54
  draggable?: boolean;
55
+ /** 是否全屏显示对话框 */
8
56
  fullscreen?: boolean;
57
+ /** 是否显示关闭按钮 */
9
58
  showClose?: boolean;
59
+ /** 对话框标题 */
10
60
  title?: string;
61
+ /** 是否允许对话框内容溢出 */
62
+ overflow?: boolean;
63
+ /** 对话框头部内容的自定义类名 */
64
+ headerClass?: string;
65
+ /** 对话框主体内容的自定义类名 */
66
+ bodyClass?: string;
67
+ /** 对话框底部内容的自定义类名 */
68
+ footerClass?: string;
69
+ }
70
+ export interface DialogConfigContext {
71
+ /** 是否垂直居中显示对话框 */
72
+ alignCenter?: boolean;
73
+ /** 是否可拖拽对话框 */
74
+ draggable?: boolean;
75
+ /** 是否允许对话框内容溢出 */
76
+ overflow?: boolean;
77
+ /** 对话框的过渡动画 */
78
+ transition?: string | TransitionProps;
11
79
  }
80
+ export {};
@@ -1,5 +1,5 @@
1
- import type { CSSProperties, Ref } from 'vue';
2
- import type { DialogProps } from '../dialog.vue';
1
+ import type { CSSProperties, Ref, TransitionProps } from 'vue';
2
+ import type { DialogProps } from './types';
3
3
  export declare const useDialog: (props: DialogProps, targetRef: Ref<HTMLElement | undefined>) => {
4
4
  afterEnter: () => void;
5
5
  afterLeave: () => void;
@@ -20,4 +20,13 @@ export declare const useDialog: (props: DialogProps, targetRef: Ref<HTMLElement
20
20
  rendered: Ref<boolean, boolean>;
21
21
  visible: Ref<boolean, boolean>;
22
22
  zIndex: Ref<number, number>;
23
+ transitionConfig: import("vue").ComputedRef<TransitionProps | {
24
+ name: string | TransitionProps;
25
+ onAfterEnter: () => void;
26
+ onBeforeLeave: () => void;
27
+ onAfterLeave: () => void;
28
+ }>;
29
+ _draggable: import("vue").ComputedRef<boolean>;
30
+ _alignCenter: import("vue").ComputedRef<boolean>;
31
+ _overflow: import("vue").ComputedRef<boolean>;
23
32
  };
@@ -0,0 +1,138 @@
1
+ import { DEFAULT_DIALOG_TRANSITION as P } from "./constants.js";
2
+ import "../config-provider/index.js";
3
+ import { UPDATE_MODEL_EVENT as Y } from "../../constants/event.js";
4
+ import { useTimeoutFn as M, isClient as H } from "@vueuse/core";
5
+ import { isObject as R, isArray as p, isFunction as N } from "@vft/utils";
6
+ import { addUnit as ee } from "../../utils/helper.js";
7
+ import { getCurrentInstance as ne, ref as r, computed as l, watch as x, nextTick as oe, onMounted as te } from "vue";
8
+ import "lodash-es";
9
+ import "../form/index.js";
10
+ import { useId as k } from "../../hooks/use-id/index.js";
11
+ import { useLockscreen as le } from "../../hooks/use-lockscreen/index.js";
12
+ import "../../hooks/use-model-toggle/index.js";
13
+ import { defaultNamespace as ie } from "../../hooks/use-namespace/index.js";
14
+ import "@popperjs/core";
15
+ import { useZIndex as ae } from "../../hooks/use-z-index/index.js";
16
+ import { useGlobalConfig as fe } from "../config-provider/hooks/use-global-config.js";
17
+ const Te = (e, t) => {
18
+ const i = ne().emit, { nextZIndex: m } = ae();
19
+ let T = "";
20
+ const B = k(), S = k(), a = r(!1), v = r(!1), c = r(!1), d = r(e.zIndex ?? m());
21
+ let C, g;
22
+ const O = fe(), U = l(() => O.value?.namespace ?? ie), s = l(() => O.value?.dialog), V = l(() => {
23
+ const n = {}, f = `--${U.value}-dialog`;
24
+ return e.fullscreen || (e.top && (n[`${f}-margin-top`] = e.top), e.width && (n[`${f}-width`] = ee(e.width))), n;
25
+ }), $ = l(
26
+ () => (e.draggable ?? s.value?.draggable ?? !1) && !e.fullscreen
27
+ ), F = l(
28
+ () => e.alignCenter ?? s.value?.alignCenter ?? !1
29
+ ), G = l(
30
+ () => e.overflow ?? s.value?.overflow ?? !1
31
+ ), Z = l(() => F.value ? { display: "flex" } : {}), j = l(() => {
32
+ const n = e.transition ?? s.value?.transition ?? P, f = {
33
+ name: n,
34
+ onAfterEnter: y,
35
+ onBeforeLeave: I,
36
+ onAfterLeave: A
37
+ };
38
+ if (R(n)) {
39
+ const o = { ...n }, b = (u, X) => (w) => {
40
+ p(u) ? u.forEach((z) => {
41
+ N(z) && z(w);
42
+ }) : N(u) && u(w), X();
43
+ };
44
+ return o.onAfterEnter = b(o.onAfterEnter, y), o.onBeforeLeave = b(o.onBeforeLeave, I), o.onAfterLeave = b(o.onAfterLeave, A), o.name || (o.name = P), o;
45
+ }
46
+ return f;
47
+ });
48
+ function y() {
49
+ i("opened");
50
+ }
51
+ function A() {
52
+ i("closed"), i(Y, !1), e.destroyOnClose && (c.value = !1);
53
+ }
54
+ function I() {
55
+ i("close");
56
+ }
57
+ function _() {
58
+ g?.(), C?.(), e.openDelay && e.openDelay > 0 ? { stop: C } = M(() => h(), e.openDelay) : h();
59
+ }
60
+ function D() {
61
+ C?.(), g?.(), e.closeDelay && e.closeDelay > 0 ? { stop: g } = M(() => L(), e.closeDelay) : L();
62
+ }
63
+ function E() {
64
+ function n(f) {
65
+ f || (v.value = !0, a.value = !1);
66
+ }
67
+ console.log(111), e.beforeClose ? e.beforeClose(n) : D();
68
+ }
69
+ function q() {
70
+ e.closeOnClickModal && E();
71
+ }
72
+ function h() {
73
+ H && (a.value = !0);
74
+ }
75
+ function L() {
76
+ a.value = !1;
77
+ }
78
+ function J() {
79
+ i("openAutoFocus");
80
+ }
81
+ function K() {
82
+ i("closeAutoFocus");
83
+ }
84
+ function Q(n) {
85
+ n.detail?.focusReason === "pointer" && n.preventDefault();
86
+ }
87
+ e.lockScroll && le(a);
88
+ function W() {
89
+ e.closeOnPressEscape && E();
90
+ }
91
+ return x(
92
+ () => e.zIndex,
93
+ () => {
94
+ d.value = e.zIndex ?? m();
95
+ }
96
+ ), x(
97
+ () => e.modelValue,
98
+ (n) => {
99
+ n ? (v.value = !1, _(), c.value = !0, d.value = e.zIndex ?? m(), oe(() => {
100
+ i("open"), t.value && (t.value.parentElement.scrollTop = 0, t.value.parentElement.scrollLeft = 0, t.value.scrollTop = 0);
101
+ })) : a.value && D();
102
+ }
103
+ ), x(
104
+ () => e.fullscreen,
105
+ (n) => {
106
+ t.value && (n ? (T = t.value.style.transform, t.value.style.transform = "") : t.value.style.transform = T);
107
+ }
108
+ ), te(() => {
109
+ e.modelValue && (a.value = !0, c.value = !0, _());
110
+ }), {
111
+ afterEnter: y,
112
+ afterLeave: A,
113
+ beforeLeave: I,
114
+ handleClose: E,
115
+ onModalClick: q,
116
+ close: D,
117
+ doClose: L,
118
+ onOpenAutoFocus: J,
119
+ onCloseAutoFocus: K,
120
+ onCloseRequested: W,
121
+ onFocusoutPrevented: Q,
122
+ titleId: B,
123
+ bodyId: S,
124
+ closed: v,
125
+ style: V,
126
+ overlayDialogStyle: Z,
127
+ rendered: c,
128
+ visible: a,
129
+ zIndex: d,
130
+ transitionConfig: j,
131
+ _draggable: $,
132
+ _alignCenter: F,
133
+ _overflow: G
134
+ };
135
+ };
136
+ export {
137
+ Te as useDialog
138
+ };
@@ -0,0 +1,7 @@
1
+ import type { DrawerProps } from '../types';
2
+ import type { Ref } from 'vue';
3
+ export declare function useResizable(props: DrawerProps, target: Ref<HTMLElement | undefined>): {
4
+ size: import("vue").ComputedRef<string>;
5
+ isResizing: Ref<boolean, boolean>;
6
+ isHorizontal: import("vue").ComputedRef<boolean>;
7
+ };
@@ -0,0 +1,53 @@
1
+ import { computed as o, ref as i, watch as x, onBeforeUnmount as H } from "vue";
2
+ import { useWindowSize as R, clamp as W, useEventListener as f } from "@vueuse/core";
3
+ import "@vft/utils";
4
+ import { addUnit as A } from "../../../utils/helper.js";
5
+ import "lodash-es";
6
+ import "../../form/index.js";
7
+ function k(t, d) {
8
+ const { width: z, height: g } = R(), s = o(
9
+ () => ["ltr", "rtl"].includes(t.direction)
10
+ ), w = o(
11
+ () => ["ltr", "ttb"].includes(t.direction) ? 1 : -1
12
+ ), h = o(
13
+ () => s.value ? z.value : g.value
14
+ ), m = o(() => W(
15
+ u.value + w.value * a.value,
16
+ 4,
17
+ h.value
18
+ )), u = i(0), a = i(0), r = i(!1), n = i(!1);
19
+ let l = [], c = [];
20
+ const p = () => {
21
+ const e = d.value?.closest(
22
+ '[aria-modal="true"]'
23
+ );
24
+ return e ? s.value ? e.offsetWidth : e.offsetHeight : 100;
25
+ };
26
+ x(
27
+ () => [t.size, t.resizable],
28
+ () => {
29
+ n.value = !1, u.value = 0, a.value = 0, v();
30
+ }
31
+ );
32
+ const S = (e) => {
33
+ t.resizable && (n.value || (u.value = p(), n.value = !0), l = [e.pageX, e.pageY], r.value = !0, c.push(
34
+ f(window, "mouseup", v),
35
+ f(window, "mousemove", b)
36
+ ));
37
+ }, b = (e) => {
38
+ const { pageX: E, pageY: U } = e, X = E - l[0], Y = U - l[1];
39
+ a.value = s.value ? X : Y;
40
+ }, v = () => {
41
+ l = [], u.value = m.value, a.value = 0, r.value = !1, c.forEach((e) => e?.()), c = [];
42
+ }, M = f(d, "mousedown", S);
43
+ return H(() => {
44
+ M(), v();
45
+ }), {
46
+ size: o(() => n.value ? `${m.value}px` : A(t.size)),
47
+ isResizing: r,
48
+ isHorizontal: s
49
+ };
50
+ }
51
+ export {
52
+ k as useResizable
53
+ };
@@ -1,10 +1,4 @@
1
- import { type DialogProps } from 'vft/es/components/dialog';
2
- export interface DrawerProps extends DialogProps {
3
- direction?: 'ltr' | 'rtl' | 'ttb' | 'btt';
4
- size?: string | number;
5
- withHeader?: boolean;
6
- modalFade?: boolean;
7
- }
1
+ import type { DrawerProps } from './types';
8
2
  declare function __VLS_template(): {
9
3
  header?(_: {
10
4
  close: () => void;
@@ -17,6 +11,8 @@ declare function __VLS_template(): {
17
11
  };
18
12
  declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DrawerProps>>, {
19
13
  close: () => void;
14
+ afterEnter: () => void;
15
+ afterLeave: () => void;
20
16
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
17
  "update:modelValue": (value: boolean) => void;
22
18
  close: () => void;
@@ -1,31 +1,35 @@
1
- import { defineComponent as A, getCurrentInstance as O, ref as k, computed as m, createBlock as h, openBlock as a, unref as e, withCtx as n, createVNode as y, Transition as N, withDirectives as M, createElementVNode as w, mergeProps as g, withModifiers as P, createElementBlock as d, createCommentVNode as s, normalizeClass as r, renderSlot as i, toDisplayString as q, vShow as H } from "vue";
2
- import { isBoolean as U, singleAttrToObj as j } from "@vft/utils";
1
+ import { defineComponent as F, getCurrentInstance as q, ref as m, computed as H, createBlock as A, openBlock as l, unref as e, withCtx as r, createVNode as y, Transition as j, withDirectives as U, createElementVNode as b, mergeProps as R, withModifiers as _, createElementBlock as n, createCommentVNode as s, normalizeClass as a, renderSlot as d, toDisplayString as G, normalizeStyle as J, vShow as K } from "vue";
3
2
  import "../dialog/index.js";
4
- import G from "../focus-trap/focus-trap.vue.js";
3
+ import Q from "../focus-trap/focus-trap.vue.js";
5
4
  import "../focus-trap/utils.js";
6
- import { VftIcon as J } from "../icon/index.js";
7
- import { VftOverlay as K } from "../overlay/index.js";
8
- import { UPDATE_MODEL_EVENT as Q } from "../../constants/event.js";
5
+ import { VftIcon as W } from "../icon/index.js";
6
+ import { VftOverlay as X } from "../overlay/index.js";
7
+ import { VftTeleport as Y } from "../teleport/index.js";
8
+ import { UPDATE_MODEL_EVENT as Z } from "../../constants/event.js";
9
9
  import "@vueuse/core";
10
- import { addUnit as W } from "../../utils/helper.js";
10
+ import { isBoolean as x, singleAttrToObj as ee } from "@vft/utils";
11
+ import "../config-provider/hooks/use-global-config.js";
11
12
  import "lodash-es";
12
13
  import "../form/index.js";
13
- import { useNamespace as X } from "../../hooks/use-namespace/index.js";
14
+ import { useNamespace as oe } from "../../hooks/use-namespace/index.js";
14
15
  import "../../hooks/use-model-toggle/index.js";
15
16
  import "@popperjs/core";
16
17
  import "../../hooks/use-z-index/index.js";
17
- import { VftTeleport as Y } from "../teleport/index.js";
18
- import { useDialog as Z } from "../dialog/hooks/use-dialog.js";
19
- const _ = ["aria-label", "aria-labelledby", "aria-describedby"], x = ["id"], ee = ["id"], oe = A({
20
- name: "vft-drawer"
21
- }), Re = /* @__PURE__ */ A({
22
- ...oe,
18
+ import { useResizable as te } from "./composables/useResizable.js";
19
+ import { useDialog as le } from "../dialog/use-dialog.js";
20
+ const ae = ["aria-label", "aria-labelledby", "aria-describedby"], se = ["id"], re = ["id"], ne = F({
21
+ name: "vft-drawer",
22
+ inheritAttrs: !1
23
+ }), Fe = /* @__PURE__ */ F({
24
+ ...ne,
23
25
  props: {
24
26
  direction: { default: "rtl" },
25
27
  size: { default: "30%" },
26
28
  withHeader: { type: Boolean, default: !0 },
27
29
  modalFade: { type: Boolean, default: !0 },
30
+ resizable: { type: Boolean, default: !1 },
28
31
  appendToBody: { type: Boolean, default: !1 },
32
+ appendTo: { default: "body" },
29
33
  beforeClose: {},
30
34
  destroyOnClose: { type: Boolean, default: !1 },
31
35
  closeOnClickModal: { type: Boolean, default: !0 },
@@ -35,11 +39,14 @@ const _ = ["aria-label", "aria-labelledby", "aria-describedby"], x = ["id"], ee
35
39
  openDelay: { default: 0 },
36
40
  closeDelay: { default: 0 },
37
41
  top: {},
42
+ modalPenetrable: { type: Boolean },
38
43
  modelValue: { type: Boolean, default: !1 },
39
44
  modalClass: {},
40
45
  width: {},
41
46
  zIndex: {},
42
47
  trapFocus: { type: Boolean, default: !1 },
48
+ overflow: { type: Boolean },
49
+ transition: {},
43
50
  center: { type: Boolean, default: !1 },
44
51
  alignCenter: { type: Boolean, default: !1 },
45
52
  closeIcon: {},
@@ -47,10 +54,13 @@ const _ = ["aria-label", "aria-labelledby", "aria-describedby"], x = ["id"], ee
47
54
  draggable: { type: Boolean, default: !1 },
48
55
  fullscreen: { type: Boolean, default: !1 },
49
56
  showClose: { type: Boolean, default: !0 },
50
- title: { default: "" }
57
+ title: { default: "" },
58
+ headerClass: {},
59
+ bodyClass: {},
60
+ footerClass: {}
51
61
  },
52
62
  emits: {
53
- [Q]: (l) => U(l),
63
+ [Z]: (i) => x(i),
54
64
  open: () => !0,
55
65
  opened: () => !0,
56
66
  close: () => !0,
@@ -58,134 +68,149 @@ const _ = ["aria-label", "aria-labelledby", "aria-describedby"], x = ["id"], ee
58
68
  openAutoFocus: () => !0,
59
69
  closeAutoFocus: () => !0
60
70
  },
61
- setup(l, { expose: E }) {
62
- const t = X("drawer"), I = O(), u = k(), {
63
- afterEnter: z,
64
- afterLeave: R,
65
- beforeLeave: V,
66
- handleClose: f,
67
- onModalClick: D,
68
- close: te,
69
- doClose: le,
70
- onOpenAutoFocus: ae,
71
- onCloseAutoFocus: se,
72
- onCloseRequested: F,
73
- onFocusoutPrevented: re,
74
- titleId: c,
75
- bodyId: v,
76
- closed: ne,
77
- style: de,
78
- overlayDialogStyle: ie,
79
- rendered: S,
80
- visible: p,
81
- zIndex: T
82
- } = Z(I.props, u), C = k(), $ = m(() => l.direction === "rtl" || l.direction === "ltr"), b = m(() => W(l.size)), L = m(() => j(l.closeIcon, "icon", {
71
+ setup(i, { expose: T }) {
72
+ const C = q(), f = m(), v = m(), B = m(), t = oe("drawer"), {
73
+ afterEnter: k,
74
+ afterLeave: h,
75
+ beforeLeave: I,
76
+ visible: u,
77
+ rendered: E,
78
+ titleId: p,
79
+ bodyId: g,
80
+ zIndex: w,
81
+ onModalClick: V,
82
+ onOpenAutoFocus: D,
83
+ onCloseAutoFocus: L,
84
+ onFocusoutPrevented: O,
85
+ onCloseRequested: P,
86
+ handleClose: c
87
+ } = le(C.props, f), {
88
+ isHorizontal: S,
89
+ size: $,
90
+ isResizing: N
91
+ } = te(C.props, B), M = H(() => ee(i.closeIcon, "icon", {
83
92
  icon: "icon-close",
84
93
  pointer: !0
85
94
  }));
86
- return E({
87
- close: f
88
- }), (o, B) => (a(), h(e(Y), {
89
- to: "body",
90
- disabled: !o.appendToBody
95
+ return T({
96
+ close: c,
97
+ afterEnter: k,
98
+ afterLeave: h
99
+ }), (o, z) => (l(), A(e(Y), {
100
+ to: o.appendTo,
101
+ disabled: o.appendTo !== "body" ? !1 : !o.appendToBody
91
102
  }, {
92
- default: n(() => [
93
- y(N, {
103
+ default: r(() => [
104
+ y(j, {
94
105
  name: e(t).b("fade"),
95
- onAfterEnter: e(z),
96
- onAfterLeave: e(R),
97
- onBeforeLeave: e(V)
106
+ onAfterEnter: e(k),
107
+ onAfterLeave: e(h),
108
+ onBeforeLeave: e(I)
98
109
  }, {
99
- default: n(() => [
100
- M(y(e(K), {
110
+ default: r(() => [
111
+ U(y(e(X), {
101
112
  mask: o.modal,
102
- "overlay-class": o.modalClass,
103
- "z-index": e(T),
104
- onClick: e(D)
113
+ "overlay-class": [e(t).is("drawer"), o.modalClass ?? ""],
114
+ "z-index": e(w),
115
+ onClick: e(V)
105
116
  }, {
106
- default: n(() => [
107
- y(e(G), {
117
+ default: r(() => [
118
+ y(e(Q), {
108
119
  loop: "",
109
- trapped: e(p),
110
- "focus-trap-el": u.value,
111
- "focus-start-el": C.value,
112
- onReleaseRequested: e(F)
120
+ trapped: e(u),
121
+ "focus-trap-el": f.value,
122
+ "focus-start-el": v.value,
123
+ onFocusAfterTrapped: e(D),
124
+ onFocusAfterReleased: e(L),
125
+ onFocusoutPrevented: e(O),
126
+ onReleaseRequested: e(P)
113
127
  }, {
114
- default: n(() => [
115
- w("div", g({
128
+ default: r(() => [
129
+ b("div", R({
116
130
  ref_key: "drawerRef",
117
- ref: u,
131
+ ref: f,
118
132
  "aria-modal": "true",
119
133
  "aria-label": o.title || void 0,
120
- "aria-labelledby": o.title ? void 0 : e(c),
121
- "aria-describedby": e(v)
134
+ "aria-labelledby": o.title ? void 0 : e(p),
135
+ "aria-describedby": e(g)
122
136
  }, o.$attrs, {
123
- class: [e(t).b(), o.direction, e(p) && "open", o.customClass],
124
- style: $.value ? "width: " + b.value : "height: " + b.value,
137
+ class: [
138
+ e(t).b(),
139
+ o.direction,
140
+ e(u) && "open",
141
+ e(t).is("dragging", e(N))
142
+ ],
143
+ style: { [e(S) ? "width" : "height"]: e($) },
125
144
  role: "dialog",
126
- onClick: B[0] || (B[0] = P(() => {
145
+ onClick: z[0] || (z[0] = _(() => {
127
146
  }, ["stop"]))
128
147
  }), [
129
- w("span", {
148
+ b("span", {
130
149
  ref_key: "focusStartRef",
131
- ref: C,
132
- class: r(e(t).e("sr-focus")),
150
+ ref: v,
151
+ class: a(e(t).e("sr-focus")),
133
152
  tabindex: "-1"
134
153
  }, null, 2),
135
- o.withHeader ? (a(), d("header", {
154
+ o.withHeader ? (l(), n("header", {
136
155
  key: 0,
137
- class: r(e(t).e("header"))
156
+ class: a([e(t).e("header"), o.headerClass])
138
157
  }, [
139
- o.$slots.title ? i(o.$slots, "title", { key: 1 }) : i(o.$slots, "header", {
158
+ o.$slots.title ? d(o.$slots, "title", { key: 1 }) : d(o.$slots, "header", {
140
159
  key: 0,
141
- close: e(f),
142
- titleId: e(c),
160
+ close: e(c),
161
+ titleId: e(p),
143
162
  titleClass: e(t).e("title")
144
163
  }, () => [
145
- o.$slots.title ? s("", !0) : (a(), d("span", {
146
- key: 0,
147
- id: e(c),
164
+ b("span", {
165
+ id: e(p),
148
166
  role: "heading",
149
- class: r(e(t).e("title"))
150
- }, q(o.title), 11, x))
167
+ class: a(e(t).e("title"))
168
+ }, G(o.title), 11, se)
151
169
  ]),
152
- o.showClose ? (a(), h(e(J), g({
170
+ o.showClose ? (l(), A(e(W), R({
153
171
  key: 2,
154
- onClick: e(f)
155
- }, L.value, {
172
+ onClick: e(c)
173
+ }, M.value, {
156
174
  class: e(t).e("close")
157
175
  }), null, 16, ["onClick", "class"])) : s("", !0)
158
176
  ], 2)) : s("", !0),
159
- e(S) ? (a(), d("div", {
177
+ e(E) ? (l(), n("div", {
160
178
  key: 1,
161
- id: e(v),
162
- class: r(e(t).e("body"))
179
+ id: e(g),
180
+ class: a([e(t).e("body"), o.bodyClass])
163
181
  }, [
164
- i(o.$slots, "default")
165
- ], 10, ee)) : s("", !0),
166
- o.$slots.footer ? (a(), d("div", {
182
+ d(o.$slots, "default")
183
+ ], 10, re)) : s("", !0),
184
+ o.$slots.footer ? (l(), n("div", {
167
185
  key: 2,
168
- class: r(e(t).e("footer"))
186
+ class: a([e(t).e("footer"), o.footerClass])
169
187
  }, [
170
- i(o.$slots, "footer")
171
- ], 2)) : s("", !0)
172
- ], 16, _)
188
+ d(o.$slots, "footer")
189
+ ], 2)) : s("", !0),
190
+ o.resizable ? (l(), n("div", {
191
+ key: 3,
192
+ ref_key: "draggerRef",
193
+ ref: B,
194
+ style: J({ zIndex: e(w) }),
195
+ class: a(e(t).e("dragger"))
196
+ }, null, 6)) : s("", !0)
197
+ ], 16, ae)
173
198
  ]),
174
199
  _: 3
175
- }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
200
+ }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
176
201
  ]),
177
202
  _: 3
178
203
  }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
179
- [H, e(p)]
204
+ [K, e(u)]
180
205
  ])
181
206
  ]),
182
207
  _: 3
183
208
  }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
184
209
  ]),
185
210
  _: 3
186
- }, 8, ["disabled"]));
211
+ }, 8, ["to", "disabled"]));
187
212
  }
188
213
  });
189
214
  export {
190
- Re as default
215
+ Fe as default
191
216
  };