@scienjoy/sj-ai-plus 1.0.2 → 1.0.4
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/package.json +5 -1
- package/ui/es/node_modules/.pnpm/element-plus@2.13.1_vue@3.5.27_typescript@5.9.3_/node_modules/element-plus/es/components/config-provider/src/hooks/use-global-config.ts +14 -14
- package/ui/es/packages/components/src/directives/directives.ts +104 -0
- package/ui/es/packages/components/src/index.ts +7 -5
- package/ui/lib/packages/components/src/directives/directives.ts +1 -0
- package/ui/lib/packages/components/src/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scienjoy/sj-ai-plus",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/lib/packages/components/index.ts",
|
|
7
7
|
"module": "./ui/es/packages/components/index.ts",
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"src/directives/**/*.ts",
|
|
10
|
+
"dist/**/*.js"
|
|
11
|
+
],
|
|
8
12
|
"files": [
|
|
9
13
|
"ui"
|
|
10
14
|
],
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCurrentInstance as d, computed as o, unref as c, inject as g, provide as C, ref as x } from "vue";
|
|
2
2
|
import { configProviderContextKey as m } from "../constants.ts";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { namespaceContextKey as y, useNamespace as I, defaultNamespace as z } from "../../../../hooks/use-namespace/index.ts";
|
|
4
|
+
import { zIndexContextKey as b, useZIndex as _, defaultInitialZIndex as K } from "../../../../hooks/use-z-index/index.ts";
|
|
5
|
+
import { localeContextKey as G, useLocale as k } from "../../../../hooks/use-locale/index.ts";
|
|
6
6
|
import { SIZE_INJECTION_KEY as N } from "../../../../hooks/use-size/index.ts";
|
|
7
7
|
import { emptyValuesContextKey as O } from "../../../../hooks/use-empty-values/index.ts";
|
|
8
8
|
import { debugWarn as S } from "../../../../utils/error.ts";
|
|
9
9
|
import { keysOf as f } from "../../../../utils/objects.ts";
|
|
10
|
-
const s =
|
|
10
|
+
const s = x();
|
|
11
11
|
function p(a, r = void 0) {
|
|
12
12
|
return d() ? g(m, s) : s;
|
|
13
13
|
}
|
|
14
14
|
function Y(a, r) {
|
|
15
|
-
const n = p(), u =
|
|
15
|
+
const n = p(), u = I(
|
|
16
16
|
a,
|
|
17
17
|
o(() => {
|
|
18
18
|
var e;
|
|
19
|
-
return ((e = n.value) == null ? void 0 : e.namespace) ||
|
|
19
|
+
return ((e = n.value) == null ? void 0 : e.namespace) || z;
|
|
20
20
|
})
|
|
21
|
-
), t =
|
|
21
|
+
), t = k(o(() => {
|
|
22
22
|
var e;
|
|
23
23
|
return (e = n.value) == null ? void 0 : e.locale;
|
|
24
|
-
})), i =
|
|
24
|
+
})), i = _(
|
|
25
25
|
o(() => {
|
|
26
26
|
var e;
|
|
27
|
-
return ((e = n.value) == null ? void 0 : e.zIndex) ||
|
|
27
|
+
return ((e = n.value) == null ? void 0 : e.zIndex) || K;
|
|
28
28
|
})
|
|
29
29
|
), l = o(() => {
|
|
30
30
|
var e;
|
|
@@ -39,7 +39,7 @@ function Y(a, r) {
|
|
|
39
39
|
}
|
|
40
40
|
const V = (a, r, n = !1) => {
|
|
41
41
|
var u;
|
|
42
|
-
const t = !!d(), i = t ? p() : void 0, l = (u = void 0) != null ? u : t ?
|
|
42
|
+
const t = !!d(), i = t ? p() : void 0, l = (u = void 0) != null ? u : t ? C : void 0;
|
|
43
43
|
if (!l) {
|
|
44
44
|
S(
|
|
45
45
|
"provideGlobalConfig",
|
|
@@ -52,13 +52,13 @@ const V = (a, r, n = !1) => {
|
|
|
52
52
|
return i?.value ? E(i.value, v) : v;
|
|
53
53
|
});
|
|
54
54
|
return l(m, e), l(
|
|
55
|
-
|
|
55
|
+
G,
|
|
56
56
|
o(() => e.value.locale)
|
|
57
57
|
), l(
|
|
58
|
-
|
|
58
|
+
y,
|
|
59
59
|
o(() => e.value.namespace)
|
|
60
60
|
), l(
|
|
61
|
-
|
|
61
|
+
b,
|
|
62
62
|
o(() => e.value.zIndex)
|
|
63
63
|
), l(N, {
|
|
64
64
|
size: o(() => e.value.size || "")
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import v from "../utils/utils.ts";
|
|
2
|
+
const y = {
|
|
3
|
+
install(c) {
|
|
4
|
+
c.directive("debounce", {
|
|
5
|
+
beforeMount(e, i) {
|
|
6
|
+
const [t, u, a = "click", l = 500, n = !0] = i.value;
|
|
7
|
+
let r;
|
|
8
|
+
e.$type = a, e.$handle = () => {
|
|
9
|
+
r && clearTimeout(r), r = setTimeout(() => t(u), l);
|
|
10
|
+
}, e.addEventListener(e.$type, e.$handle, n);
|
|
11
|
+
},
|
|
12
|
+
unmounted(e) {
|
|
13
|
+
e.removeEventListener(e.$type, e.$handle);
|
|
14
|
+
}
|
|
15
|
+
}), c.directive("throttle", {
|
|
16
|
+
beforeMount(e, i) {
|
|
17
|
+
const [t, u, a = "click", l = 500, n = !0] = i.value;
|
|
18
|
+
let r, m;
|
|
19
|
+
e.$type = a, e.$handle = () => {
|
|
20
|
+
if (r)
|
|
21
|
+
return clearTimeout(m), m = setTimeout(() => t(u), l);
|
|
22
|
+
t(u), r = setTimeout(() => null, l);
|
|
23
|
+
}, e.addEventListener(e.$type, e.$handle, n);
|
|
24
|
+
},
|
|
25
|
+
unmounted(e) {
|
|
26
|
+
e.removeEventListener(e.$type, e.$handle);
|
|
27
|
+
}
|
|
28
|
+
}), c.directive("drag", {
|
|
29
|
+
beforeMount(e, i) {
|
|
30
|
+
let t = "", u = null, a = null, l = !1;
|
|
31
|
+
if (i && i?.value && v.funcIsArray(i.value) && i.value.length > 0) {
|
|
32
|
+
const n = i.value;
|
|
33
|
+
n[0] && (t = n[0]), u = n.length > 1 ? n[1] : null, a = n.length > 2 ? n[2] : null;
|
|
34
|
+
}
|
|
35
|
+
e.onmousedown = (n) => {
|
|
36
|
+
if (t) {
|
|
37
|
+
if (typeof t == "string" && n.target.className !== t && !n.target.classList.contains(t))
|
|
38
|
+
return;
|
|
39
|
+
if (v.funcIsArray(t)) {
|
|
40
|
+
if (t.length === 0)
|
|
41
|
+
return;
|
|
42
|
+
let s = 0;
|
|
43
|
+
for (s = 0; s < t.length; s++) {
|
|
44
|
+
const p = t[s];
|
|
45
|
+
if (n.target.className === p || n.target.classList.contains(p))
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
if (s === t.length)
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const r = n.pageX - e.offsetLeft, m = n.pageY - e.offsetTop, f = document.body.clientWidth - n.currentTarget.clientWidth, d = document.body.clientHeight - n.currentTarget.clientHeight;
|
|
53
|
+
let o = 0, g = 0;
|
|
54
|
+
document.onmousemove = (s) => {
|
|
55
|
+
l = !0, o = s.pageX - r, g = s.pageY - m, o < 0 ? o = 0 : o > f && (o = f), g < 0 ? g = 0 : g > d && (g = d), e.style.left = o + "px", e.style.top = g + "px";
|
|
56
|
+
}, document.onmouseup = () => {
|
|
57
|
+
document.onmousemove = document.onmouseup = null, !l && typeof u == "function" && u(a), l = !1;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}), c.directive("posterDrag", {
|
|
62
|
+
beforeMount(e) {
|
|
63
|
+
const i = e;
|
|
64
|
+
let t = 0, u = 0;
|
|
65
|
+
e.onmousedown = (a) => {
|
|
66
|
+
const l = a.pageX - e.offsetLeft, n = a.pageY - e.offsetTop, r = document.body.clientWidth - 120, m = document.body.clientHeight - 220;
|
|
67
|
+
let f = 0, d = 0;
|
|
68
|
+
i.setAttribute("ele-flag", !1), t = (/* @__PURE__ */ new Date()).getTime(), document.onmousemove = (o) => {
|
|
69
|
+
f = o.pageX - l, d = o.pageY - n, !(f < 0 || d < 0 || f > r || d > m) && (e.style.left = f + "px", e.style.top = d + "px", e.style.pointerEvents = "none");
|
|
70
|
+
}, document.onmouseup = (o) => {
|
|
71
|
+
document.onmousemove = document.onmouseup = null, e.style.pointerEvents = null, u = (/* @__PURE__ */ new Date()).getTime(), u - t > 500 && (i.setAttribute("ele-flag", !0), o.stopPropagation());
|
|
72
|
+
}, document.ondragstart = function(o) {
|
|
73
|
+
o.preventDefault();
|
|
74
|
+
}, document.ondragend = function(o) {
|
|
75
|
+
o.preventDefault();
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}), c.directive("trim", {
|
|
80
|
+
beforeMount(e) {
|
|
81
|
+
e.oninput = () => {
|
|
82
|
+
e.value = e.value.replace(/\s+/g, "");
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}), c.directive("inputFilter", {
|
|
86
|
+
beforeMount(e, i) {
|
|
87
|
+
const [t] = i.value;
|
|
88
|
+
e.oninput = () => {
|
|
89
|
+
t === "integer" ? e.value = e.value.replace(/[^0-9]/g, "") : t === "float" ? e.value = e.value.replace(/[^0-9.]/g, "") : t === "chinese" && (e.value = e.value.replace(/^[\u4e00-\u9fa5·]/g, ""));
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}), c.directive("scrollBottom", {
|
|
93
|
+
updated(e) {
|
|
94
|
+
e.getAttribute("isScroll") === "true" && e.scrollTo({
|
|
95
|
+
top: e.scrollHeight,
|
|
96
|
+
behavior: "smooth"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
y as default
|
|
104
|
+
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import t from "./
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import t from "./directives/directives.ts";
|
|
2
|
+
import o from "./sjDigitalHumanAssistant/index.ts";
|
|
3
|
+
const m = [
|
|
4
|
+
t,
|
|
5
|
+
o
|
|
4
6
|
];
|
|
5
7
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
o as SjDigitalHumanAssistant,
|
|
9
|
+
m as default
|
|
8
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("../utils/utils.ts"),h={install(c){c.directive("debounce",{beforeMount(e,i){const[t,u,a="click",l=500,n=!0]=i.value;let r;e.$type=a,e.$handle=()=>{r&&clearTimeout(r),r=setTimeout(()=>t(u),l)},e.addEventListener(e.$type,e.$handle,n)},unmounted(e){e.removeEventListener(e.$type,e.$handle)}}),c.directive("throttle",{beforeMount(e,i){const[t,u,a="click",l=500,n=!0]=i.value;let r,m;e.$type=a,e.$handle=()=>{if(r)return clearTimeout(m),m=setTimeout(()=>t(u),l);t(u),r=setTimeout(()=>null,l)},e.addEventListener(e.$type,e.$handle,n)},unmounted(e){e.removeEventListener(e.$type,e.$handle)}}),c.directive("drag",{beforeMount(e,i){let t="",u=null,a=null,l=!1;if(i&&i?.value&&p.default.funcIsArray(i.value)&&i.value.length>0){const n=i.value;n[0]&&(t=n[0]),u=n.length>1?n[1]:null,a=n.length>2?n[2]:null}e.onmousedown=n=>{if(t){if(typeof t=="string"&&n.target.className!==t&&!n.target.classList.contains(t))return;if(p.default.funcIsArray(t)){if(t.length===0)return;let s=0;for(s=0;s<t.length;s++){const v=t[s];if(n.target.className===v||n.target.classList.contains(v))break}if(s===t.length)return}}const r=n.pageX-e.offsetLeft,m=n.pageY-e.offsetTop,d=document.body.clientWidth-n.currentTarget.clientWidth,f=document.body.clientHeight-n.currentTarget.clientHeight;let o=0,g=0;document.onmousemove=s=>{l=!0,o=s.pageX-r,g=s.pageY-m,o<0?o=0:o>d&&(o=d),g<0?g=0:g>f&&(g=f),e.style.left=o+"px",e.style.top=g+"px"},document.onmouseup=()=>{document.onmousemove=document.onmouseup=null,!l&&typeof u=="function"&&u(a),l=!1}}}}),c.directive("posterDrag",{beforeMount(e){const i=e;let t=0,u=0;e.onmousedown=a=>{const l=a.pageX-e.offsetLeft,n=a.pageY-e.offsetTop,r=document.body.clientWidth-120,m=document.body.clientHeight-220;let d=0,f=0;i.setAttribute("ele-flag",!1),t=new Date().getTime(),document.onmousemove=o=>{d=o.pageX-l,f=o.pageY-n,!(d<0||f<0||d>r||f>m)&&(e.style.left=d+"px",e.style.top=f+"px",e.style.pointerEvents="none")},document.onmouseup=o=>{document.onmousemove=document.onmouseup=null,e.style.pointerEvents=null,u=new Date().getTime(),u-t>500&&(i.setAttribute("ele-flag",!0),o.stopPropagation())},document.ondragstart=function(o){o.preventDefault()},document.ondragend=function(o){o.preventDefault()}}}}),c.directive("trim",{beforeMount(e){e.oninput=()=>{e.value=e.value.replace(/\s+/g,"")}}}),c.directive("inputFilter",{beforeMount(e,i){const[t]=i.value;e.oninput=()=>{t==="integer"?e.value=e.value.replace(/[^0-9]/g,""):t==="float"?e.value=e.value.replace(/[^0-9.]/g,""):t==="chinese"&&(e.value=e.value.replace(/^[\u4e00-\u9fa5·]/g,""))}}}),c.directive("scrollBottom",{updated(e){e.getAttribute("isScroll")==="true"&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}})}};exports.default=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./sjDigitalHumanAssistant/index.ts"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./directives/directives.ts"),e=require("./sjDigitalHumanAssistant/index.ts"),u=[t.default,e.default];exports.SjDigitalHumanAssistant=e.default;exports.default=u;
|