vft 0.0.414 → 0.0.416

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 (144) 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/hooks/use-global-config.js +3 -3
  13. package/es/components/config-provider/index.d.ts +9 -0
  14. package/es/components/dialog/constants.d.ts +1 -0
  15. package/es/components/dialog/constants.js +2 -1
  16. package/es/components/dialog/dialog-content.vue.d.ts +4 -1
  17. package/es/components/dialog/dialog-content.vue2.js +60 -48
  18. package/es/components/dialog/dialog.vue.d.ts +4 -19
  19. package/es/components/dialog/dialog.vue2.js +104 -89
  20. package/es/components/dialog/index.d.ts +70 -3
  21. package/es/components/dialog/index.js +5 -4
  22. package/es/components/dialog/types.d.ts +69 -0
  23. package/es/components/dialog/{hooks/use-dialog.d.ts → use-dialog.d.ts} +11 -2
  24. package/es/components/dialog/use-dialog.js +138 -0
  25. package/es/components/drawer/composables/useResizable.d.ts +7 -0
  26. package/es/components/drawer/composables/useResizable.js +53 -0
  27. package/es/components/drawer/drawer.vue.d.ts +3 -7
  28. package/es/components/drawer/drawer.vue2.js +124 -98
  29. package/es/components/drawer/index.d.ts +78 -0
  30. package/es/components/drawer/types.d.ts +13 -0
  31. package/es/components/drawer/types.js +1 -0
  32. package/es/components/dropdown/dropdown.vue.d.ts +1 -1
  33. package/es/components/dropdown/index.d.ts +15 -15
  34. package/es/components/form/form-item.vue.d.ts +1 -1
  35. package/es/components/form/index.d.ts +36 -36
  36. package/es/components/index.js +172 -171
  37. package/es/components/input/input.vue2.js +4 -4
  38. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  39. package/es/components/input-tag/input-tag.vue.d.ts +1 -1
  40. package/es/components/link/index.d.ts +3 -3
  41. package/es/components/md-code-demo/md-code-demo.js +10 -10
  42. package/es/components/modal/index.d.ts +87 -24
  43. package/es/components/modal/modal.vue.d.ts +1 -1
  44. package/es/components/modal/modal.vue2.js +24 -17
  45. package/es/components/multiple-tabs/multiple-tabs.vue2.js +82 -79
  46. package/es/components/popover/index.d.ts +0 -9
  47. package/es/components/popover/popover.vue2.js +4 -5
  48. package/es/components/popover/types.d.ts +23 -1
  49. package/es/components/search/search.vue2.js +3 -3
  50. package/es/components/select/index.d.ts +20 -20
  51. package/es/components/select/select.vue.d.ts +20 -20
  52. package/es/components/select/useSelect.d.ts +17 -17
  53. package/es/components/super-form/super-form-item.vue2.js +1 -1
  54. package/es/components/table/index.d.ts +9 -9
  55. package/es/components/time-picker/time-picker-com/panel-time-pick.vue.d.ts +1 -1
  56. package/es/components/time-picker/time-picker-com/panel-time-range.vue.d.ts +1 -1
  57. package/es/components/timeline/index.d.ts +6 -6
  58. package/es/components/tooltip/index.d.ts +3 -3
  59. package/es/components/tooltip/tooltip.vue2.js +1 -1
  60. package/es/components/tooltip/types.d.ts +81 -1
  61. package/es/hooks/use-draggable/index.d.ts +5 -1
  62. package/es/hooks/use-draggable/index.js +39 -34
  63. package/es/hooks/use-z-index/index.js +3 -3
  64. package/es/index.js +2 -2
  65. package/es/package.json.d.ts +1 -1
  66. package/es/package.json.js +1 -1
  67. package/es/utils/helper.d.ts +1 -1
  68. package/es/utils/ns-cover.d.ts +1 -1
  69. package/es/utils/vue/vnode.js +1 -1
  70. package/lib/components/autocomplete/autocomplete.vue.d.ts +8 -8
  71. package/lib/components/autocomplete/index.d.ts +24 -24
  72. package/lib/components/button/button.vue.d.ts +1 -1
  73. package/lib/components/button/index.d.ts +30 -30
  74. package/lib/components/button/use-button.d.ts +1 -1
  75. package/lib/components/color-picker/composables/use-alpha-slider.d.ts +2 -2
  76. package/lib/components/config-provider/config-provider.vue.d.ts +2 -0
  77. package/lib/components/config-provider/config-provider.vue2.cjs +1 -1
  78. package/lib/components/config-provider/index.d.ts +9 -0
  79. package/lib/components/dialog/constants.cjs +1 -1
  80. package/lib/components/dialog/constants.d.ts +1 -0
  81. package/lib/components/dialog/dialog-content.vue.d.ts +4 -1
  82. package/lib/components/dialog/dialog-content.vue2.cjs +1 -1
  83. package/lib/components/dialog/dialog.vue.d.ts +4 -19
  84. package/lib/components/dialog/dialog.vue2.cjs +1 -1
  85. package/lib/components/dialog/index.cjs +1 -1
  86. package/lib/components/dialog/index.d.ts +70 -3
  87. package/lib/components/dialog/types.d.ts +69 -0
  88. package/lib/components/dialog/use-dialog.cjs +1 -0
  89. package/lib/components/dialog/{hooks/use-dialog.d.ts → use-dialog.d.ts} +11 -2
  90. package/lib/components/drawer/composables/useResizable.cjs +1 -0
  91. package/lib/components/drawer/composables/useResizable.d.ts +7 -0
  92. package/lib/components/drawer/drawer.vue.d.ts +3 -7
  93. package/lib/components/drawer/drawer.vue2.cjs +1 -1
  94. package/lib/components/drawer/index.d.ts +78 -0
  95. package/lib/components/drawer/types.cjs +1 -0
  96. package/lib/components/drawer/types.d.ts +13 -0
  97. package/lib/components/dropdown/dropdown.vue.d.ts +1 -1
  98. package/lib/components/dropdown/index.d.ts +15 -15
  99. package/lib/components/form/form-item.vue.d.ts +1 -1
  100. package/lib/components/form/index.d.ts +36 -36
  101. package/lib/components/index.cjs +1 -1
  102. package/lib/components/input/input.vue2.cjs +1 -1
  103. package/lib/components/input-tag/input-tag.vue.d.ts +1 -1
  104. package/lib/components/link/index.d.ts +3 -3
  105. package/lib/components/md-code-demo/md-code-demo.cjs +1 -1
  106. package/lib/components/modal/index.d.ts +87 -24
  107. package/lib/components/modal/modal.vue.d.ts +1 -1
  108. package/lib/components/modal/modal.vue2.cjs +1 -1
  109. package/lib/components/multiple-tabs/multiple-tabs.vue2.cjs +1 -1
  110. package/lib/components/popover/index.d.ts +0 -9
  111. package/lib/components/popover/popover.vue2.cjs +1 -1
  112. package/lib/components/popover/types.d.ts +23 -1
  113. package/lib/components/search/search.vue2.cjs +1 -1
  114. package/lib/components/select/index.d.ts +20 -20
  115. package/lib/components/select/select.vue.d.ts +20 -20
  116. package/lib/components/select/useSelect.d.ts +17 -17
  117. package/lib/components/table/index.d.ts +9 -9
  118. package/lib/components/time-picker/time-picker-com/panel-time-pick.vue.d.ts +1 -1
  119. package/lib/components/time-picker/time-picker-com/panel-time-range.vue.d.ts +1 -1
  120. package/lib/components/timeline/index.d.ts +6 -6
  121. package/lib/components/tooltip/index.d.ts +3 -3
  122. package/lib/components/tooltip/tooltip.vue2.cjs +1 -1
  123. package/lib/components/tooltip/types.d.ts +81 -1
  124. package/lib/hooks/use-draggable/index.cjs +1 -1
  125. package/lib/hooks/use-draggable/index.d.ts +5 -1
  126. package/lib/index.cjs +1 -1
  127. package/lib/package.json.cjs +1 -1
  128. package/lib/package.json.d.ts +1 -1
  129. package/lib/utils/helper.d.ts +1 -1
  130. package/lib/utils/ns-cover.d.ts +1 -1
  131. package/package.json +5 -5
  132. package/tags.json +1 -1
  133. package/theme-style/index.css +1 -1
  134. package/theme-style/src/dialog.scss +35 -35
  135. package/theme-style/src/drawer.scss +118 -21
  136. package/theme-style/src/md-container.scss +1 -0
  137. package/theme-style/src/tag.scss +1 -1
  138. package/theme-style/vft-dialog.css +1 -1
  139. package/theme-style/vft-drawer.css +1 -1
  140. package/theme-style/vft-md-container.css +1 -1
  141. package/theme-style/vft-tag.css +1 -1
  142. package/web-types.json +1 -1
  143. package/es/components/dialog/hooks/use-dialog.js +0 -106
  144. 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 d, createVNode as y, Transition as N, withDirectives as M, createElementVNode as w, mergeProps as g, withModifiers as P, createElementBlock as n, 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,133 +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: de,
77
- style: ne,
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", {
83
- icon: "icon-close"
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", {
92
+ icon: "icon-close",
93
+ pointer: !0
84
94
  }));
85
- return E({
86
- close: f
87
- }), (o, B) => (a(), h(e(Y), {
88
- to: "body",
89
- 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
90
102
  }, {
91
- default: d(() => [
92
- y(N, {
103
+ default: r(() => [
104
+ y(j, {
93
105
  name: e(t).b("fade"),
94
- onAfterEnter: e(z),
95
- onAfterLeave: e(R),
96
- onBeforeLeave: e(V)
106
+ onAfterEnter: e(k),
107
+ onAfterLeave: e(h),
108
+ onBeforeLeave: e(I)
97
109
  }, {
98
- default: d(() => [
99
- M(y(e(K), {
110
+ default: r(() => [
111
+ U(y(e(X), {
100
112
  mask: o.modal,
101
- "overlay-class": o.modalClass,
102
- "z-index": e(T),
103
- onClick: e(D)
113
+ "overlay-class": [e(t).is("drawer"), o.modalClass ?? ""],
114
+ "z-index": e(w),
115
+ onClick: e(V)
104
116
  }, {
105
- default: d(() => [
106
- y(e(G), {
117
+ default: r(() => [
118
+ y(e(Q), {
107
119
  loop: "",
108
- trapped: e(p),
109
- "focus-trap-el": u.value,
110
- "focus-start-el": C.value,
111
- 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)
112
127
  }, {
113
- default: d(() => [
114
- w("div", g({
128
+ default: r(() => [
129
+ b("div", R({
115
130
  ref_key: "drawerRef",
116
- ref: u,
131
+ ref: f,
117
132
  "aria-modal": "true",
118
133
  "aria-label": o.title || void 0,
119
- "aria-labelledby": o.title ? void 0 : e(c),
120
- "aria-describedby": e(v)
134
+ "aria-labelledby": o.title ? void 0 : e(p),
135
+ "aria-describedby": e(g)
121
136
  }, o.$attrs, {
122
- class: [e(t).b(), o.direction, e(p) && "open", o.customClass],
123
- 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($) },
124
144
  role: "dialog",
125
- onClick: B[0] || (B[0] = P(() => {
145
+ onClick: z[0] || (z[0] = _(() => {
126
146
  }, ["stop"]))
127
147
  }), [
128
- w("span", {
148
+ b("span", {
129
149
  ref_key: "focusStartRef",
130
- ref: C,
131
- class: r(e(t).e("sr-focus")),
150
+ ref: v,
151
+ class: a(e(t).e("sr-focus")),
132
152
  tabindex: "-1"
133
153
  }, null, 2),
134
- o.withHeader ? (a(), n("header", {
154
+ o.withHeader ? (l(), n("header", {
135
155
  key: 0,
136
- class: r(e(t).e("header"))
156
+ class: a([e(t).e("header"), o.headerClass])
137
157
  }, [
138
- 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", {
139
159
  key: 0,
140
- close: e(f),
141
- titleId: e(c),
160
+ close: e(c),
161
+ titleId: e(p),
142
162
  titleClass: e(t).e("title")
143
163
  }, () => [
144
- o.$slots.title ? s("", !0) : (a(), n("span", {
145
- key: 0,
146
- id: e(c),
164
+ b("span", {
165
+ id: e(p),
147
166
  role: "heading",
148
- class: r(e(t).e("title"))
149
- }, q(o.title), 11, x))
167
+ class: a(e(t).e("title"))
168
+ }, G(o.title), 11, se)
150
169
  ]),
151
- o.showClose ? (a(), h(e(J), g({
170
+ o.showClose ? (l(), A(e(W), R({
152
171
  key: 2,
153
- onClick: e(f)
154
- }, L.value, {
172
+ onClick: e(c)
173
+ }, M.value, {
155
174
  class: e(t).e("close")
156
175
  }), null, 16, ["onClick", "class"])) : s("", !0)
157
176
  ], 2)) : s("", !0),
158
- e(S) ? (a(), n("div", {
177
+ e(E) ? (l(), n("div", {
159
178
  key: 1,
160
- id: e(v),
161
- class: r(e(t).e("body"))
179
+ id: e(g),
180
+ class: a([e(t).e("body"), o.bodyClass])
162
181
  }, [
163
- i(o.$slots, "default")
164
- ], 10, ee)) : s("", !0),
165
- o.$slots.footer ? (a(), n("div", {
182
+ d(o.$slots, "default")
183
+ ], 10, re)) : s("", !0),
184
+ o.$slots.footer ? (l(), n("div", {
166
185
  key: 2,
167
- class: r(e(t).e("footer"))
186
+ class: a([e(t).e("footer"), o.footerClass])
168
187
  }, [
169
- i(o.$slots, "footer")
170
- ], 2)) : s("", !0)
171
- ], 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)
172
198
  ]),
173
199
  _: 3
174
- }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
200
+ }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
175
201
  ]),
176
202
  _: 3
177
203
  }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
178
- [H, e(p)]
204
+ [K, e(u)]
179
205
  ])
180
206
  ]),
181
207
  _: 3
182
208
  }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
183
209
  ]),
184
210
  _: 3
185
- }, 8, ["disabled"]));
211
+ }, 8, ["to", "disabled"]));
186
212
  }
187
213
  });
188
214
  export {
189
- Re as default
215
+ Fe as default
190
216
  };