@v-c/dialog 0.0.1 → 0.0.2
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.
|
@@ -5,6 +5,7 @@ let vue = require("vue");
|
|
|
5
5
|
let __v_c_util = require("@v-c/util");
|
|
6
6
|
let __v_c_util_dist_pickAttrs = require("@v-c/util/dist/pickAttrs");
|
|
7
7
|
__v_c_util_dist_pickAttrs = require_rolldown_runtime.__toESM(__v_c_util_dist_pickAttrs);
|
|
8
|
+
let __v_c_util_dist_props_util = require("@v-c/util/dist/props-util");
|
|
8
9
|
var sentinelStyle = {
|
|
9
10
|
width: 0,
|
|
10
11
|
height: 0,
|
|
@@ -35,8 +36,8 @@ var Panel = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots })
|
|
|
35
36
|
return () => {
|
|
36
37
|
const { width, height, footer, prefixCls, classNames: modalClassNames, styles: modalStyles, title, closable, closeIcon, bodyProps, bodyStyle, ariaId, style, className, forceRender, onClose, onMouseDown, onMouseUp, modalRender, animationVisible } = props;
|
|
37
38
|
const contentStyle = {};
|
|
38
|
-
if (width !== void 0) contentStyle.width = width;
|
|
39
|
-
if (height !== void 0) contentStyle.height = height;
|
|
39
|
+
if (width !== void 0) contentStyle.width = (0, __v_c_util_dist_props_util.getStylePxValue)(width);
|
|
40
|
+
if (height !== void 0) contentStyle.height = (0, __v_c_util_dist_props_util.getStylePxValue)(height);
|
|
40
41
|
const footerNode = footer ? (0, vue.createVNode)("div", {
|
|
41
42
|
"class": (0, __v_c_util.classNames)(`${prefixCls}-footer`, modalClassNames?.footer),
|
|
42
43
|
"style": { ...modalStyles?.footer }
|
|
@@ -44,7 +45,11 @@ var Panel = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots })
|
|
|
44
45
|
const headerNode = title ? (0, vue.createVNode)("div", {
|
|
45
46
|
"class": (0, __v_c_util.classNames)(`${prefixCls}-header`, modalClassNames?.header),
|
|
46
47
|
"style": { ...modalStyles?.header }
|
|
47
|
-
}, [
|
|
48
|
+
}, [(0, vue.createVNode)("div", {
|
|
49
|
+
"class": (0, __v_c_util.clsx)(`${prefixCls}-title`, modalClassNames?.title),
|
|
50
|
+
"id": ariaId,
|
|
51
|
+
"style": { ...modalStyles?.title }
|
|
52
|
+
}, [title])]) : null;
|
|
48
53
|
const closableFun = () => {
|
|
49
54
|
if (typeof closable === "object" && closable !== null) return closable;
|
|
50
55
|
if (closable) return { closeIcon: closeIcon ?? (0, vue.createVNode)("span", { "class": `${prefixCls}-close-x` }, null) };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useGetRefContext } from "../../context.js";
|
|
2
2
|
import { createVNode, defineComponent, mergeProps, shallowRef } from "vue";
|
|
3
|
-
import { classNames } from "@v-c/util";
|
|
3
|
+
import { classNames, clsx } from "@v-c/util";
|
|
4
4
|
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
5
|
+
import { getStylePxValue } from "@v-c/util/dist/props-util";
|
|
5
6
|
var sentinelStyle = {
|
|
6
7
|
width: 0,
|
|
7
8
|
height: 0,
|
|
@@ -32,8 +33,8 @@ var Panel_default = /* @__PURE__ */ defineComponent((props, { expose, slots }) =
|
|
|
32
33
|
return () => {
|
|
33
34
|
const { width, height, footer, prefixCls, classNames: modalClassNames, styles: modalStyles, title, closable, closeIcon, bodyProps, bodyStyle, ariaId, style, className, forceRender, onClose, onMouseDown, onMouseUp, modalRender, animationVisible } = props;
|
|
34
35
|
const contentStyle = {};
|
|
35
|
-
if (width !== void 0) contentStyle.width = width;
|
|
36
|
-
if (height !== void 0) contentStyle.height = height;
|
|
36
|
+
if (width !== void 0) contentStyle.width = getStylePxValue(width);
|
|
37
|
+
if (height !== void 0) contentStyle.height = getStylePxValue(height);
|
|
37
38
|
const footerNode = footer ? createVNode("div", {
|
|
38
39
|
"class": classNames(`${prefixCls}-footer`, modalClassNames?.footer),
|
|
39
40
|
"style": { ...modalStyles?.footer }
|
|
@@ -41,7 +42,11 @@ var Panel_default = /* @__PURE__ */ defineComponent((props, { expose, slots }) =
|
|
|
41
42
|
const headerNode = title ? createVNode("div", {
|
|
42
43
|
"class": classNames(`${prefixCls}-header`, modalClassNames?.header),
|
|
43
44
|
"style": { ...modalStyles?.header }
|
|
44
|
-
}, [
|
|
45
|
+
}, [createVNode("div", {
|
|
46
|
+
"class": clsx(`${prefixCls}-title`, modalClassNames?.title),
|
|
47
|
+
"id": ariaId,
|
|
48
|
+
"style": { ...modalStyles?.title }
|
|
49
|
+
}, [title])]) : null;
|
|
45
50
|
const closableFun = () => {
|
|
46
51
|
if (typeof closable === "object" && closable !== null) return closable;
|
|
47
52
|
if (closable) return { closeIcon: closeIcon ?? createVNode("span", { "class": `${prefixCls}-close-x` }, null) };
|
package/dist/Dialog/index.cjs
CHANGED
|
@@ -36,6 +36,7 @@ var Dialog = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots })
|
|
|
36
36
|
function onDialogVisibleChanged(newVisible) {
|
|
37
37
|
if (newVisible) focusDialogContent();
|
|
38
38
|
else {
|
|
39
|
+
const _animatedVisible = animatedVisible.value;
|
|
39
40
|
animatedVisible.value = false;
|
|
40
41
|
if (props.mask && lastOutSideActiveElementRef.value && props.focusTriggerAfterClose) {
|
|
41
42
|
try {
|
|
@@ -43,7 +44,7 @@ var Dialog = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, slots })
|
|
|
43
44
|
} catch (e) {}
|
|
44
45
|
lastOutSideActiveElementRef.value = null;
|
|
45
46
|
}
|
|
46
|
-
if (
|
|
47
|
+
if (_animatedVisible) props?.afterClose?.();
|
|
47
48
|
props?.afterOpenChange?.(newVisible);
|
|
48
49
|
}
|
|
49
50
|
}
|
package/dist/Dialog/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var Dialog_default = /* @__PURE__ */ defineComponent((props, { expose, slots })
|
|
|
31
31
|
function onDialogVisibleChanged(newVisible) {
|
|
32
32
|
if (newVisible) focusDialogContent();
|
|
33
33
|
else {
|
|
34
|
+
const _animatedVisible = animatedVisible.value;
|
|
34
35
|
animatedVisible.value = false;
|
|
35
36
|
if (props.mask && lastOutSideActiveElementRef.value && props.focusTriggerAfterClose) {
|
|
36
37
|
try {
|
|
@@ -38,7 +39,7 @@ var Dialog_default = /* @__PURE__ */ defineComponent((props, { expose, slots })
|
|
|
38
39
|
} catch (e) {}
|
|
39
40
|
lastOutSideActiveElementRef.value = null;
|
|
40
41
|
}
|
|
41
|
-
if (
|
|
42
|
+
if (_animatedVisible) props?.afterClose?.();
|
|
42
43
|
props?.afterOpenChange?.(newVisible);
|
|
43
44
|
}
|
|
44
45
|
}
|
package/dist/DialogWrap.cjs
CHANGED
|
@@ -16,12 +16,12 @@ var DialogWrap = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots }) =>
|
|
|
16
16
|
}, { immediate: true });
|
|
17
17
|
return () => {
|
|
18
18
|
const { visible, getContainer, forceRender, destroyOnHidden = false, afterClose } = props;
|
|
19
|
-
if (!forceRender && destroyOnHidden && !animatedVisible) return null;
|
|
19
|
+
if (!forceRender && destroyOnHidden && !animatedVisible.value) return null;
|
|
20
20
|
return (0, vue.createVNode)(__v_c_portal.default, {
|
|
21
|
-
"open":
|
|
21
|
+
"open": visible || forceRender || animatedVisible.value,
|
|
22
22
|
"autoDestroy": false,
|
|
23
23
|
"getContainer": getContainer,
|
|
24
|
-
"autoLock":
|
|
24
|
+
"autoLock": visible || animatedVisible.value
|
|
25
25
|
}, { default: () => [(0, vue.createVNode)(require_index.default, (0, vue.mergeProps)(props, {
|
|
26
26
|
"destroyOnHidden": destroyOnHidden,
|
|
27
27
|
"afterClose": () => {
|
package/dist/DialogWrap.js
CHANGED
|
@@ -13,12 +13,12 @@ var DialogWrap_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
|
13
13
|
}, { immediate: true });
|
|
14
14
|
return () => {
|
|
15
15
|
const { visible, getContainer, forceRender, destroyOnHidden = false, afterClose } = props;
|
|
16
|
-
if (!forceRender && destroyOnHidden && !animatedVisible) return null;
|
|
16
|
+
if (!forceRender && destroyOnHidden && !animatedVisible.value) return null;
|
|
17
17
|
return createVNode(Portal, {
|
|
18
|
-
"open":
|
|
18
|
+
"open": visible || forceRender || animatedVisible.value,
|
|
19
19
|
"autoDestroy": false,
|
|
20
20
|
"getContainer": getContainer,
|
|
21
|
-
"autoLock":
|
|
21
|
+
"autoLock": visible || animatedVisible.value
|
|
22
22
|
}, { default: () => [createVNode(Dialog_default, mergeProps(props, {
|
|
23
23
|
"destroyOnHidden": destroyOnHidden,
|
|
24
24
|
"afterClose": () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/dialog",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"vue": "^3.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@v-c/portal": "^1.0.
|
|
29
|
-
"@v-c/util": "^1.0.
|
|
28
|
+
"@v-c/portal": "^1.0.1",
|
|
29
|
+
"@v-c/util": "^1.0.3"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "vite build",
|