@v-c/dialog 1.0.3 → 1.1.0
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.
- package/dist/Dialog/Content/Panel.js +6 -6
- package/dist/Dialog/Content/index.js +8 -8
- package/dist/Dialog/Mask.js +6 -6
- package/dist/Dialog/index.js +8 -6
- package/dist/DialogWrap.js +6 -4
- package/dist/context.js +4 -2
- package/dist/index.js +6 -4
- package/dist/util.js +2 -0
- package/package.json +1 -1
|
@@ -5,7 +5,8 @@ import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
|
5
5
|
import { useLockFocus } from "@v-c/util/dist/Dom/focus";
|
|
6
6
|
import { useFocusBoundaryProvider } from "@v-c/util/dist/Dom/focusBoundary";
|
|
7
7
|
import { getStylePxValue } from "@v-c/util/dist/props-util";
|
|
8
|
-
|
|
8
|
+
//#region src/Dialog/Content/Panel.tsx
|
|
9
|
+
var Panel = /* @__PURE__ */ defineComponent((props, { expose, slots }) => {
|
|
9
10
|
const { setPanel } = useGetRefContext();
|
|
10
11
|
const internalRef = shallowRef();
|
|
11
12
|
const mergeRefFun = (el) => {
|
|
@@ -91,8 +92,7 @@ var Panel_default = /* @__PURE__ */ defineComponent((props, { expose, slots }) =
|
|
|
91
92
|
props: {
|
|
92
93
|
prefixCls: {
|
|
93
94
|
type: String,
|
|
94
|
-
required: true
|
|
95
|
-
default: void 0
|
|
95
|
+
required: true
|
|
96
96
|
},
|
|
97
97
|
ariaId: {
|
|
98
98
|
type: String,
|
|
@@ -352,11 +352,11 @@ var Panel_default = /* @__PURE__ */ defineComponent((props, { expose, slots }) =
|
|
|
352
352
|
},
|
|
353
353
|
animationVisible: {
|
|
354
354
|
type: Boolean,
|
|
355
|
-
required: true
|
|
356
|
-
default: void 0
|
|
355
|
+
required: true
|
|
357
356
|
}
|
|
358
357
|
},
|
|
359
358
|
name: "Panel",
|
|
360
359
|
inheritAttrs: false
|
|
361
360
|
});
|
|
362
|
-
|
|
361
|
+
//#endregion
|
|
362
|
+
export { Panel as default };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { offset } from "../../util.js";
|
|
2
|
-
import
|
|
2
|
+
import Panel from "./Panel.js";
|
|
3
3
|
import { Transition, createVNode, defineComponent, mergeProps, nextTick, shallowRef, vShow, watch, withDirectives } from "vue";
|
|
4
4
|
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
5
|
-
|
|
5
|
+
//#region src/Dialog/Content/index.tsx
|
|
6
|
+
var Content = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
6
7
|
const dialogRef = shallowRef();
|
|
7
8
|
const transformOrigin = shallowRef("");
|
|
8
9
|
function onPrepare() {
|
|
@@ -29,7 +30,7 @@ var Content_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
29
30
|
onVisibleChanged?.(false);
|
|
30
31
|
animationVisible.value = false;
|
|
31
32
|
}
|
|
32
|
-
}), { default: () => [visible || !destroyOnHidden ? withDirectives(createVNode(
|
|
33
|
+
}), { default: () => [visible || !destroyOnHidden ? withDirectives(createVNode(Panel, mergeProps(props, {
|
|
33
34
|
"animationVisible": animationVisible.value,
|
|
34
35
|
"title": title,
|
|
35
36
|
"ariaId": ariaId,
|
|
@@ -58,13 +59,11 @@ var Content_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
58
59
|
},
|
|
59
60
|
onVisibleChanged: {
|
|
60
61
|
type: Function,
|
|
61
|
-
required: true
|
|
62
|
-
default: void 0
|
|
62
|
+
required: true
|
|
63
63
|
},
|
|
64
64
|
prefixCls: {
|
|
65
65
|
type: String,
|
|
66
|
-
required: true
|
|
67
|
-
default: void 0
|
|
66
|
+
required: true
|
|
68
67
|
},
|
|
69
68
|
onMouseDown: {
|
|
70
69
|
type: Function,
|
|
@@ -320,4 +319,5 @@ var Content_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
320
319
|
},
|
|
321
320
|
name: "Content"
|
|
322
321
|
});
|
|
323
|
-
|
|
322
|
+
//#endregion
|
|
323
|
+
export { Content as default };
|
package/dist/Dialog/Mask.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Transition, createVNode, defineComponent, mergeProps } from "vue";
|
|
2
2
|
import { classNames } from "@v-c/util";
|
|
3
3
|
import { getTransitionProps } from "@v-c/util/dist/utils/transition";
|
|
4
|
-
|
|
4
|
+
//#region src/Dialog/Mask.tsx
|
|
5
|
+
var Mask = /* @__PURE__ */ defineComponent((props) => {
|
|
5
6
|
return () => {
|
|
6
7
|
const { maskProps, prefixCls, className, style, visible, motionName } = props;
|
|
7
8
|
return createVNode(Transition, mergeProps(getTransitionProps(motionName), { "key": "mask" }), { default: () => [visible && createVNode("div", mergeProps({
|
|
@@ -13,13 +14,11 @@ var Mask_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
13
14
|
props: {
|
|
14
15
|
prefixCls: {
|
|
15
16
|
type: String,
|
|
16
|
-
required: true
|
|
17
|
-
default: void 0
|
|
17
|
+
required: true
|
|
18
18
|
},
|
|
19
19
|
visible: {
|
|
20
20
|
type: Boolean,
|
|
21
|
-
required: true
|
|
22
|
-
default: void 0
|
|
21
|
+
required: true
|
|
23
22
|
},
|
|
24
23
|
motionName: {
|
|
25
24
|
type: String,
|
|
@@ -44,4 +43,5 @@ var Mask_default = /* @__PURE__ */ defineComponent((props) => {
|
|
|
44
43
|
},
|
|
45
44
|
name: "Mask"
|
|
46
45
|
});
|
|
47
|
-
|
|
46
|
+
//#endregion
|
|
47
|
+
export { Mask as default };
|
package/dist/Dialog/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { getMotionName } from "../util.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import Content from "./Content/index.js";
|
|
3
|
+
import Mask from "./Mask.js";
|
|
4
4
|
import { createVNode, defineComponent, mergeDefaults, mergeProps, nextTick, shallowRef, useId, watch } from "vue";
|
|
5
5
|
import { warning } from "@v-c/util";
|
|
6
6
|
import contains from "@v-c/util/dist/Dom/contains";
|
|
7
7
|
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
8
|
-
|
|
8
|
+
//#region src/Dialog/index.tsx
|
|
9
|
+
var Dialog = /* @__PURE__ */ defineComponent((props, { expose, slots }) => {
|
|
9
10
|
if (process.env.NODE_ENV !== "production") {
|
|
10
11
|
[
|
|
11
12
|
"wrapStyle",
|
|
@@ -83,7 +84,7 @@ var Dialog_default = /* @__PURE__ */ defineComponent((props, { expose, slots })
|
|
|
83
84
|
return createVNode("div", mergeProps({
|
|
84
85
|
"class": [`${prefixCls}-root`, rootClassName],
|
|
85
86
|
"style": rootStyle
|
|
86
|
-
}, pickAttrs(props, { data: true })), [createVNode(
|
|
87
|
+
}, pickAttrs(props, { data: true })), [createVNode(Mask, {
|
|
87
88
|
"prefixCls": prefixCls,
|
|
88
89
|
"visible": !!(mask && visible),
|
|
89
90
|
"motionName": getMotionName(prefixCls, maskTransitionName, maskAnimation),
|
|
@@ -104,7 +105,7 @@ var Dialog_default = /* @__PURE__ */ defineComponent((props, { expose, slots })
|
|
|
104
105
|
"onClick": onWrapperClick,
|
|
105
106
|
"onMousedown": onWrapperMouseDown,
|
|
106
107
|
"style": mergedStyle
|
|
107
|
-
}, wrapProps), [createVNode(
|
|
108
|
+
}, wrapProps), [createVNode(Content, mergeProps({
|
|
108
109
|
...props,
|
|
109
110
|
onClose: onInternalClose,
|
|
110
111
|
onVisibleChanged: onDialogVisibleChanged
|
|
@@ -367,4 +368,5 @@ var Dialog_default = /* @__PURE__ */ defineComponent((props, { expose, slots })
|
|
|
367
368
|
}),
|
|
368
369
|
name: "Dialog"
|
|
369
370
|
});
|
|
370
|
-
|
|
371
|
+
//#endregion
|
|
372
|
+
export { Dialog as default };
|
package/dist/DialogWrap.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useRefProvide } from "./context.js";
|
|
2
|
-
import
|
|
2
|
+
import Dialog from "./Dialog/index.js";
|
|
3
3
|
import { createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef, watch } from "vue";
|
|
4
4
|
import Portal from "@v-c/portal";
|
|
5
|
-
|
|
5
|
+
//#region src/DialogWrap.tsx
|
|
6
|
+
var DialogWrap = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
6
7
|
const animatedVisible = shallowRef(false);
|
|
7
8
|
useRefProvide(props);
|
|
8
9
|
const onEsc = ({ top, event }) => {
|
|
@@ -24,7 +25,7 @@ var DialogWrap_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
24
25
|
"onEsc": onEsc,
|
|
25
26
|
"getContainer": getContainer,
|
|
26
27
|
"autoLock": visible || animatedVisible.value
|
|
27
|
-
}, { default: () => [createVNode(
|
|
28
|
+
}, { default: () => [createVNode(Dialog, mergeProps(props, {
|
|
28
29
|
"destroyOnHidden": destroyOnHidden,
|
|
29
30
|
"afterClose": () => {
|
|
30
31
|
(props.closable && typeof props.closable === "object" ? props.closable : {}).afterClose?.();
|
|
@@ -285,4 +286,5 @@ var DialogWrap_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
285
286
|
}),
|
|
286
287
|
name: "Dialog"
|
|
287
288
|
});
|
|
288
|
-
|
|
289
|
+
//#endregion
|
|
290
|
+
export { DialogWrap as default };
|
package/dist/context.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inject, provide, shallowRef } from "vue";
|
|
2
|
+
//#region src/context.ts
|
|
2
3
|
var RefContext = Symbol("RefContext");
|
|
3
4
|
function useRefProvide(props) {
|
|
4
5
|
const panel = shallowRef();
|
|
@@ -8,8 +9,8 @@ function useRefProvide(props) {
|
|
|
8
9
|
};
|
|
9
10
|
provide(RefContext, {
|
|
10
11
|
panel,
|
|
11
|
-
setPanel(panel
|
|
12
|
-
setPanelRef(panel
|
|
12
|
+
setPanel(panel) {
|
|
13
|
+
setPanelRef(panel);
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
16
|
return {
|
|
@@ -20,4 +21,5 @@ function useRefProvide(props) {
|
|
|
20
21
|
function useGetRefContext() {
|
|
21
22
|
return inject(RefContext, {});
|
|
22
23
|
}
|
|
24
|
+
//#endregion
|
|
23
25
|
export { useGetRefContext, useRefProvide };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import Panel from "./Dialog/Content/Panel.js";
|
|
2
|
+
import DialogWrap from "./DialogWrap.js";
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
var src_default = DialogWrap;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Panel, src_default as default };
|
package/dist/util.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/util.ts
|
|
1
2
|
function getMotionName(prefixCls, transitionName, animationName) {
|
|
2
3
|
let motionName = transitionName;
|
|
3
4
|
if (!motionName && animationName) motionName = `${prefixCls}-${animationName}`;
|
|
@@ -27,4 +28,5 @@ function offset(el) {
|
|
|
27
28
|
}
|
|
28
29
|
return pos;
|
|
29
30
|
}
|
|
31
|
+
//#endregion
|
|
30
32
|
export { getMotionName, offset };
|