@v-c/trigger 0.0.10 → 0.0.12

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.
@@ -1 +1,91 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),x=require("@v-c/util"),P=n.defineComponent({props:{prefixCls:{type:String,required:!0,default:void 0},align:{type:Object,required:!0,default:void 0},arrow:{type:Object,required:!0,default:void 0},arrowPos:{type:Object,required:!0,default:void 0}},name:"Arrow",setup(u,{expose:a}){const s=n.shallowRef();return a({arrowRef:s}),()=>{const{prefixCls:p,align:t,arrow:c,arrowPos:f}=u,{className:d,content:w,style:g}=c||{},{x:y=0,y:b=0}=f;if(!t||!t.points)return null;const e={position:"absolute"};if(t.autoArrow!==!1){const i=t.points[0],l=t.points[1],r=i[0],o=i[1],m=l[0],q=l[1];r===m||!["t","b"].includes(r)?e.top=`${b}px`:r==="t"?e.top=0:e.bottom=0,o===q||!["l","r"].includes(o)?e.left=`${y}px`:o==="l"?e.left=0:e.right=0}return n.createVNode("div",{ref:s,class:x.classNames(`${p}-arrow`,d),style:{...e,...g}},[w])}}});exports.Arrow=P;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const vue = require("vue");
4
+ const util = require("@v-c/util");
5
+ const Arrow = /* @__PURE__ */ vue.defineComponent({
6
+ props: {
7
+ prefixCls: {
8
+ type: String,
9
+ required: true,
10
+ default: void 0
11
+ },
12
+ align: {
13
+ type: Object,
14
+ required: true,
15
+ default: void 0
16
+ },
17
+ arrow: {
18
+ type: Object,
19
+ required: true,
20
+ default: void 0
21
+ },
22
+ arrowPos: {
23
+ type: Object,
24
+ required: true,
25
+ default: void 0
26
+ }
27
+ },
28
+ name: "Arrow",
29
+ setup(props, {
30
+ expose
31
+ }) {
32
+ const arrowRef = vue.shallowRef();
33
+ expose({
34
+ arrowRef
35
+ });
36
+ return () => {
37
+ const {
38
+ prefixCls,
39
+ align,
40
+ arrow,
41
+ arrowPos
42
+ } = props;
43
+ const {
44
+ className,
45
+ content,
46
+ style
47
+ } = arrow || {};
48
+ const {
49
+ x = 0,
50
+ y = 0
51
+ } = arrowPos;
52
+ if (!align || !align.points) {
53
+ return null;
54
+ }
55
+ const alignStyle = {
56
+ position: "absolute"
57
+ };
58
+ if (align.autoArrow !== false) {
59
+ const popupPoints = align.points[0];
60
+ const targetPoints = align.points[1];
61
+ const popupTB = popupPoints[0];
62
+ const popupLR = popupPoints[1];
63
+ const targetTB = targetPoints[0];
64
+ const targetLR = targetPoints[1];
65
+ if (popupTB === targetTB || !["t", "b"].includes(popupTB)) {
66
+ alignStyle.top = `${y}px`;
67
+ } else if (popupTB === "t") {
68
+ alignStyle.top = 0;
69
+ } else {
70
+ alignStyle.bottom = 0;
71
+ }
72
+ if (popupLR === targetLR || !["l", "r"].includes(popupLR)) {
73
+ alignStyle.left = `${x}px`;
74
+ } else if (popupLR === "l") {
75
+ alignStyle.left = 0;
76
+ } else {
77
+ alignStyle.right = 0;
78
+ }
79
+ }
80
+ return vue.createVNode("div", {
81
+ "ref": arrowRef,
82
+ "class": util.classNames(`${prefixCls}-arrow`, className),
83
+ "style": {
84
+ ...alignStyle,
85
+ ...style
86
+ }
87
+ }, [content]);
88
+ };
89
+ }
90
+ });
91
+ exports.Arrow = Arrow;
@@ -1,69 +1,91 @@
1
- import { defineComponent as x, shallowRef as q, createVNode as P } from "vue";
2
- import { classNames as R } from "@v-c/util";
3
- const C = /* @__PURE__ */ x({
1
+ import { defineComponent, shallowRef, createVNode } from "vue";
2
+ import { classNames } from "@v-c/util";
3
+ const Arrow = /* @__PURE__ */ defineComponent({
4
4
  props: {
5
5
  prefixCls: {
6
6
  type: String,
7
- required: !0,
7
+ required: true,
8
8
  default: void 0
9
9
  },
10
10
  align: {
11
11
  type: Object,
12
- required: !0,
12
+ required: true,
13
13
  default: void 0
14
14
  },
15
15
  arrow: {
16
16
  type: Object,
17
- required: !0,
17
+ required: true,
18
18
  default: void 0
19
19
  },
20
20
  arrowPos: {
21
21
  type: Object,
22
- required: !0,
22
+ required: true,
23
23
  default: void 0
24
24
  }
25
25
  },
26
26
  name: "Arrow",
27
- setup(l, {
28
- expose: p
27
+ setup(props, {
28
+ expose
29
29
  }) {
30
- const n = q();
31
- return p({
32
- arrowRef: n
33
- }), () => {
30
+ const arrowRef = shallowRef();
31
+ expose({
32
+ arrowRef
33
+ });
34
+ return () => {
34
35
  const {
35
- prefixCls: u,
36
- align: t,
37
- arrow: a,
38
- arrowPos: f
39
- } = l, {
40
- className: c,
41
- content: d,
42
- style: w
43
- } = a || {}, {
44
- x: m = 0,
45
- y: g = 0
46
- } = f;
47
- if (!t || !t.points)
36
+ prefixCls,
37
+ align,
38
+ arrow,
39
+ arrowPos
40
+ } = props;
41
+ const {
42
+ className,
43
+ content,
44
+ style
45
+ } = arrow || {};
46
+ const {
47
+ x = 0,
48
+ y = 0
49
+ } = arrowPos;
50
+ if (!align || !align.points) {
48
51
  return null;
49
- const e = {
52
+ }
53
+ const alignStyle = {
50
54
  position: "absolute"
51
55
  };
52
- if (t.autoArrow !== !1) {
53
- const s = t.points[0], i = t.points[1], r = s[0], o = s[1], y = i[0], b = i[1];
54
- r === y || !["t", "b"].includes(r) ? e.top = `${g}px` : r === "t" ? e.top = 0 : e.bottom = 0, o === b || !["l", "r"].includes(o) ? e.left = `${m}px` : o === "l" ? e.left = 0 : e.right = 0;
56
+ if (align.autoArrow !== false) {
57
+ const popupPoints = align.points[0];
58
+ const targetPoints = align.points[1];
59
+ const popupTB = popupPoints[0];
60
+ const popupLR = popupPoints[1];
61
+ const targetTB = targetPoints[0];
62
+ const targetLR = targetPoints[1];
63
+ if (popupTB === targetTB || !["t", "b"].includes(popupTB)) {
64
+ alignStyle.top = `${y}px`;
65
+ } else if (popupTB === "t") {
66
+ alignStyle.top = 0;
67
+ } else {
68
+ alignStyle.bottom = 0;
69
+ }
70
+ if (popupLR === targetLR || !["l", "r"].includes(popupLR)) {
71
+ alignStyle.left = `${x}px`;
72
+ } else if (popupLR === "l") {
73
+ alignStyle.left = 0;
74
+ } else {
75
+ alignStyle.right = 0;
76
+ }
55
77
  }
56
- return P("div", {
57
- ref: n,
58
- class: R(`${u}-arrow`, c),
59
- style: {
60
- ...e,
61
- ...w
78
+ return createVNode("div", {
79
+ "ref": arrowRef,
80
+ "class": classNames(`${prefixCls}-arrow`, className),
81
+ "style": {
82
+ ...alignStyle,
83
+ ...style
62
84
  }
63
- }, [d]);
85
+ }, [content]);
64
86
  };
65
87
  }
66
88
  });
67
89
  export {
68
- C as Arrow
90
+ Arrow
69
91
  };
@@ -1 +1,66 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("@v-c/util/dist/utils/transition"),f=e.defineComponent((r,{attrs:i})=>()=>{const{prefixCls:n,open:u,zIndex:o,mask:a,motion:t,mobile:l}=r;if(!a)return null;const s=d.getTransitionProps(t?.name,t);return e.createVNode(e.Transition,s,{default:()=>[u?e.createVNode("div",{style:{zIndex:o},class:[`${n}-mask`,l&&`${n}-mask-mobile`,i.class]},null):null]})},{props:{prefixCls:{type:String,required:!0,default:void 0},open:{type:Boolean,required:!1,default:void 0},zIndex:{type:Number,required:!1,default:void 0},mask:{type:Boolean,required:!1,default:void 0},motion:{type:Object,required:!1,default:void 0},mobile:{type:Boolean,required:!1,default:void 0}},inheritAttrs:!1,name:"PopupMask"});exports.default=f;
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const transition = require("@v-c/util/dist/utils/transition");
5
+ const Mask = /* @__PURE__ */ vue.defineComponent((props, {
6
+ attrs
7
+ }) => {
8
+ return () => {
9
+ const {
10
+ prefixCls,
11
+ open,
12
+ zIndex,
13
+ mask,
14
+ motion,
15
+ mobile
16
+ } = props;
17
+ if (!mask) {
18
+ return null;
19
+ }
20
+ const transitionProps = transition.getTransitionProps(motion?.name, motion);
21
+ return vue.createVNode(vue.Transition, transitionProps, {
22
+ default: () => [open ? vue.createVNode("div", {
23
+ "style": {
24
+ zIndex
25
+ },
26
+ "class": [`${prefixCls}-mask`, mobile && `${prefixCls}-mask-mobile`, attrs.class]
27
+ }, null) : null]
28
+ });
29
+ };
30
+ }, {
31
+ props: {
32
+ prefixCls: {
33
+ type: String,
34
+ required: true,
35
+ default: void 0
36
+ },
37
+ open: {
38
+ type: Boolean,
39
+ required: false,
40
+ default: void 0
41
+ },
42
+ zIndex: {
43
+ type: Number,
44
+ required: false,
45
+ default: void 0
46
+ },
47
+ mask: {
48
+ type: Boolean,
49
+ required: false,
50
+ default: void 0
51
+ },
52
+ motion: {
53
+ type: Object,
54
+ required: false,
55
+ default: void 0
56
+ },
57
+ mobile: {
58
+ type: Boolean,
59
+ required: false,
60
+ default: void 0
61
+ }
62
+ },
63
+ inheritAttrs: false,
64
+ name: "PopupMask"
65
+ });
66
+ exports.default = Mask;
@@ -1,63 +1,66 @@
1
- import { defineComponent as u, createVNode as t, Transition as f } from "vue";
2
- import { getTransitionProps as p } from "@v-c/util/dist/utils/transition";
3
- const y = /* @__PURE__ */ u((r, {
4
- attrs: i
5
- }) => () => {
6
- const {
7
- prefixCls: e,
8
- open: o,
9
- zIndex: a,
10
- mask: d,
11
- motion: n,
12
- mobile: l
13
- } = r;
14
- if (!d)
15
- return null;
16
- const s = p(n?.name, n);
17
- return t(f, s, {
18
- default: () => [o ? t("div", {
19
- style: {
20
- zIndex: a
21
- },
22
- class: [`${e}-mask`, l && `${e}-mask-mobile`, i.class]
23
- }, null) : null]
24
- });
1
+ import { defineComponent, createVNode, Transition } from "vue";
2
+ import { getTransitionProps } from "@v-c/util/dist/utils/transition";
3
+ const Mask = /* @__PURE__ */ defineComponent((props, {
4
+ attrs
5
+ }) => {
6
+ return () => {
7
+ const {
8
+ prefixCls,
9
+ open,
10
+ zIndex,
11
+ mask,
12
+ motion,
13
+ mobile
14
+ } = props;
15
+ if (!mask) {
16
+ return null;
17
+ }
18
+ const transitionProps = getTransitionProps(motion?.name, motion);
19
+ return createVNode(Transition, transitionProps, {
20
+ default: () => [open ? createVNode("div", {
21
+ "style": {
22
+ zIndex
23
+ },
24
+ "class": [`${prefixCls}-mask`, mobile && `${prefixCls}-mask-mobile`, attrs.class]
25
+ }, null) : null]
26
+ });
27
+ };
25
28
  }, {
26
29
  props: {
27
30
  prefixCls: {
28
31
  type: String,
29
- required: !0,
32
+ required: true,
30
33
  default: void 0
31
34
  },
32
35
  open: {
33
36
  type: Boolean,
34
- required: !1,
37
+ required: false,
35
38
  default: void 0
36
39
  },
37
40
  zIndex: {
38
41
  type: Number,
39
- required: !1,
42
+ required: false,
40
43
  default: void 0
41
44
  },
42
45
  mask: {
43
46
  type: Boolean,
44
- required: !1,
47
+ required: false,
45
48
  default: void 0
46
49
  },
47
50
  motion: {
48
51
  type: Object,
49
- required: !1,
52
+ required: false,
50
53
  default: void 0
51
54
  },
52
55
  mobile: {
53
56
  type: Boolean,
54
- required: !1,
57
+ required: false,
55
58
  default: void 0
56
59
  }
57
60
  },
58
- inheritAttrs: !1,
61
+ inheritAttrs: false,
59
62
  name: "PopupMask"
60
63
  });
61
64
  export {
62
- y as default
65
+ Mask as default
63
66
  };
@@ -1 +1,29 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("vue"),l=u.defineComponent((n,{slots:o})=>{const e=u.shallowRef();return()=>{const t=o?.default?.();return n.cache?(e.value||(e.value=t),e.value):(e.value=t,t)}},{props:{cache:{type:Boolean,required:!1,default:void 0}},name:"PopupContext"});exports.default=l;
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const PopupContent = /* @__PURE__ */ vue.defineComponent((props, {
5
+ slots
6
+ }) => {
7
+ const cachedChildren = vue.shallowRef();
8
+ return () => {
9
+ const children = slots?.default?.();
10
+ if (!props.cache) {
11
+ cachedChildren.value = children;
12
+ return children;
13
+ }
14
+ if (!cachedChildren.value) {
15
+ cachedChildren.value = children;
16
+ }
17
+ return cachedChildren.value;
18
+ };
19
+ }, {
20
+ props: {
21
+ cache: {
22
+ type: Boolean,
23
+ required: false,
24
+ default: void 0
25
+ }
26
+ },
27
+ name: "PopupContext"
28
+ });
29
+ exports.default = PopupContent;
@@ -1,22 +1,29 @@
1
- import { defineComponent as a, shallowRef as r } from "vue";
2
- const l = /* @__PURE__ */ a((t, {
3
- slots: o
1
+ import { defineComponent, shallowRef } from "vue";
2
+ const PopupContent = /* @__PURE__ */ defineComponent((props, {
3
+ slots
4
4
  }) => {
5
- const e = r();
5
+ const cachedChildren = shallowRef();
6
6
  return () => {
7
- const n = o?.default?.();
8
- return t.cache ? (e.value || (e.value = n), e.value) : (e.value = n, n);
7
+ const children = slots?.default?.();
8
+ if (!props.cache) {
9
+ cachedChildren.value = children;
10
+ return children;
11
+ }
12
+ if (!cachedChildren.value) {
13
+ cachedChildren.value = children;
14
+ }
15
+ return cachedChildren.value;
9
16
  };
10
17
  }, {
11
18
  props: {
12
19
  cache: {
13
20
  type: Boolean,
14
- required: !1,
21
+ required: false,
15
22
  default: void 0
16
23
  }
17
24
  },
18
25
  name: "PopupContext"
19
26
  });
20
27
  export {
21
- l as default
28
+ PopupContent as default
22
29
  };