@qxs-bns/components 0.0.2 → 0.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.
Files changed (31) hide show
  1. package/dist/hooks/src/use-namespace/index.cjs +1 -0
  2. package/dist/hooks/src/use-namespace/index.js +49 -0
  3. package/index.cjs +1 -1
  4. package/package.json +4 -3
  5. package/package.json.cjs +1 -1
  6. package/package.json.js +1 -1
  7. package/src/defaults.cjs +1 -1
  8. package/src/file-upload/index.cjs +1 -1
  9. package/src/file-upload/src/file-upload.vue.cjs +1 -1
  10. package/src/file-upload/src/file-upload.vue.js +33 -32
  11. package/src/file-upload/src/file-upload.vue2.cjs +1 -1
  12. package/src/fixed-action-bar/index.cjs +1 -1
  13. package/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +1 -1
  14. package/src/fixed-action-bar/src/fixed-action-bar.vue.js +41 -31
  15. package/src/fixed-action-bar/src/fixed-action-bar.vue2.cjs +1 -1
  16. package/src/image-upload/index.cjs +1 -1
  17. package/src/image-upload/src/image-upload.vue.cjs +1 -1
  18. package/src/image-upload/src/image-upload.vue.js +44 -43
  19. package/src/image-upload/src/image-upload.vue2.cjs +1 -1
  20. package/src/photo-crop-tool/index.cjs +1 -1
  21. package/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +1 -1
  22. package/src/photo-crop-tool/src/photo-crop-tool.vue.js +135 -117
  23. package/src/photo-crop-tool/src/photo-crop-tool.vue2.cjs +1 -1
  24. package/types/src/file-upload/index.d.ts +2 -2
  25. package/types/src/file-upload/src/file-upload.vue.d.ts +2 -2
  26. package/types/src/image-upload/index.d.ts +3 -3
  27. package/types/src/image-upload/src/image-upload.vue.d.ts +3 -3
  28. package/types/src/photo-crop-tool/index.d.ts +3 -3
  29. package/types/src/photo-crop-tool/src/photo-crop-tool.vue.d.ts +3 -3
  30. package/packages/hooks/src/use-namespace/index.cjs +0 -1
  31. package/packages/hooks/src/use-namespace/index.js +0 -49
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),l="qxs",$="is-";function c(u,o,r,e,t){let a=`${u}-${o}`;return r&&(a+=`-${r}`),e&&(a+=`__${e}`),t&&(a+=`--${t}`),a}const s=Symbol("namespaceContextKey");function m(u){const o=n.getCurrentInstance()?n.inject(s,n.ref(l)):n.ref(l);return n.computed(()=>n.unref(o)||l)}function i(u,o){const r=m();return{namespace:r,b:(e="")=>c(r.value,u,e,"",""),e:e=>e?c(r.value,u,"",e,""):"",m:e=>e?c(r.value,u,"","",e):"",be:(e,t)=>e&&t?c(r.value,u,e,t,""):"",em:(e,t)=>e&&t?c(r.value,u,"",e,t):"",bm:(e,t)=>e&&t?c(r.value,u,e,"",t):"",bem:(e,t,a)=>e&&t&&a?c(r.value,u,e,t,a):"",is:(e,...t)=>{const a=t.length>=1?t[0]:!0;return e&&a?`${$}${e}`:""},cssVar:e=>{const t={};for(const a in e)e[a]&&(t[`--${r.value}-${a}`]=e[a]);return t},cssVarName:e=>`--${r.value}-${e}`,cssVarBlock:e=>{const t={};for(const a in e)e[a]&&(t[`--${r.value}-${u}-${a}`]=e[a]);return t},cssVarBlockName:e=>`--${r.value}-${u}-${e}`}}exports.defaultNamespace=l;exports.namespaceContextKey=s;exports.useGetDerivedNamespace=m;exports.useNamespace=i;
@@ -0,0 +1,49 @@
1
+ import { getCurrentInstance as l, inject as m, ref as s, computed as $, unref as v } from "vue";
2
+ const o = "qxs", i = "is-";
3
+ function n(r, u, c, e, a) {
4
+ let t = `${r}-${u}`;
5
+ return c && (t += `-${c}`), e && (t += `__${e}`), a && (t += `--${a}`), t;
6
+ }
7
+ const f = Symbol("namespaceContextKey");
8
+ function p(r) {
9
+ const u = l() ? m(f, s(o)) : s(o);
10
+ return $(() => v(u) || o);
11
+ }
12
+ function N(r, u) {
13
+ const c = p();
14
+ return {
15
+ namespace: c,
16
+ b: (e = "") => n(c.value, r, e, "", ""),
17
+ e: (e) => e ? n(c.value, r, "", e, "") : "",
18
+ m: (e) => e ? n(c.value, r, "", "", e) : "",
19
+ be: (e, a) => e && a ? n(c.value, r, e, a, "") : "",
20
+ em: (e, a) => e && a ? n(c.value, r, "", e, a) : "",
21
+ bm: (e, a) => e && a ? n(c.value, r, e, "", a) : "",
22
+ bem: (e, a, t) => e && a && t ? n(c.value, r, e, a, t) : "",
23
+ is: (e, ...a) => {
24
+ const t = a.length >= 1 ? a[0] : !0;
25
+ return e && t ? `${i}${e}` : "";
26
+ },
27
+ // css
28
+ cssVar: (e) => {
29
+ const a = {};
30
+ for (const t in e)
31
+ e[t] && (a[`--${c.value}-${t}`] = e[t]);
32
+ return a;
33
+ },
34
+ cssVarName: (e) => `--${c.value}-${e}`,
35
+ cssVarBlock: (e) => {
36
+ const a = {};
37
+ for (const t in e)
38
+ e[t] && (a[`--${c.value}-${r}-${t}`] = e[t]);
39
+ return a;
40
+ },
41
+ cssVarBlockName: (e) => `--${c.value}-${r}-${e}`
42
+ };
43
+ }
44
+ export {
45
+ o as defaultNamespace,
46
+ f as namespaceContextKey,
47
+ p as useGetDerivedNamespace,
48
+ N as useNamespace
49
+ };
package/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./src/defaults.cjs"),o=require("./src/file-upload/index.cjs"),s=require("./src/fixed-action-bar/index.cjs"),i=require("./src/image-upload/index.cjs"),t=require("./src/photo-crop-tool/index.cjs"),r=e.install,l=e.version;exports.default=e;exports.QxsFileUpload=o.QxsFileUpload;exports.QxsFixedActionBar=s.QxsFixedActionBar;exports.QxsImageUpload=i.QxsImageUpload;exports.QxsPhotoCropTool=t.QxsPhotoCropTool;exports.install=r;exports.version=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./src/defaults.cjs"),o=require("./src/file-upload/index.cjs"),s=require("./src/fixed-action-bar/index.cjs"),t=require("./src/image-upload/index.cjs"),i=require("./src/photo-crop-tool/index.cjs"),l=e.default.install,r=e.default.version;exports.default=e.default;exports.QxsFileUpload=o.QxsFileUpload;exports.QxsFixedActionBar=s.QxsFixedActionBar;exports.QxsImageUpload=t.QxsImageUpload;exports.QxsPhotoCropTool=i.QxsPhotoCropTool;exports.install=l;exports.version=r;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qxs-bns/components",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Vue 3 Component Library",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -38,7 +38,8 @@
38
38
  "@element-plus/icons-vue": "^2.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@qxs-bns/hooks": "0.0.2",
42
- "@qxs-bns/utils": "0.0.2"
41
+ "@qxs-bns/hooks": "0.0.1",
42
+ "@qxs-bns/utils": "0.0.1",
43
+ "@qxs-bns/directives": "0.0.1"
43
44
  }
44
45
  }
package/package.json.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.2";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.0.4";exports.version=e;
package/package.json.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "0.0.2";
1
+ const o = "0.0.4";
2
2
  export {
3
3
  o as version
4
4
  };
package/src/defaults.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("./components.cjs"),s=require("./make-installer.cjs"),t=s.makeInstaller(e);module.exports=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./components.cjs"),t=require("./make-installer.cjs"),l=t.makeInstaller(e);exports.default=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../withInstall.cjs"),l=require("./src/file-upload.vue.cjs"),e=t.withInstall(l);exports.QxsFileUpload=e;exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../withInstall.cjs"),l=require("./src/file-upload.vue.cjs"),e=t.withInstall(l.default);exports.QxsFileUpload=e;exports.default=e;
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),N=require("@element-plus/icons-vue"),v=require("../../../packages/hooks/src/use-namespace/index.cjs"),c=require("element-plus"),h={class:"slot"},E={key:0,class:"el-upload__tip"},V={style:{display:"inline-block"}},C=e.defineComponent({name:"QxsFileUpload",__name:"file-upload",props:{action:{},headers:{},data:{},name:{default:"file"},size:{default:20},max:{default:3},accept:{default:"zip,rar"},files:{default:()=>[]},notip:{type:Boolean,default:!1},ext:{}},emits:["onSuccess"],setup(r,{emit:d}){const a=r,p=d,u=v.useNamespace("file-upload"),i=e.computed(()=>a.accept.split(",").map(t=>t.split("/").pop())),m=t=>{const s=t.name.split(".").at(-1)??"",l=i.value.includes(s),n=t.size/1024/1024<a.size;return l||c.ElMessage.error(`上传文件只支持 ${i.value.join(" / ")} 格式!`),n||c.ElMessage.error(`上传文件大小不能超过 ${a.size}MB!`),l&&n},f=()=>{c.ElMessage.warning("文件上传超过限制")},_=(t,o,s)=>{p("onSuccess",t,o,s)};return(t,o)=>{const s=e.resolveComponent("el-icon"),l=e.resolveComponent("el-alert"),n=e.resolveComponent("el-upload");return e.openBlock(),e.createBlock(n,{headers:t.headers,action:t.action,data:t.data,name:t.name,"before-upload":m,"on-exceed":f,"on-success":_,"file-list":t.files,limit:t.max,drag:"",class:e.normalizeClass(e.unref(u).e("control"))},{tip:e.withCtx(()=>[t.notip?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",E,[e.createElementVNode("div",V,[e.createVNode(l,{title:`上传文件支持 ${i.value.join(" / ")} 格式,单个文件大小不超过 ${t.size}MB,且文件数量不超过 ${t.max} 个`,type:"info","show-icon":"",closable:!1},null,8,["title"])])]))]),default:e.withCtx(()=>[e.createElementVNode("div",h,[e.createVNode(s,{class:"el-icon--upload"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.UploadFilled))]),_:1}),o[0]||(o[0]=e.createElementVNode("div",{class:"el-upload__text"},[e.createTextVNode(" 将文件拖到此处,或"),e.createElementVNode("em",null,"点击上传")],-1))])]),_:1},8,["headers","action","data","name","file-list","limit","class"])}}});module.exports=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),N=require("../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.12_typescript@5.6.3_/node_modules/@element-plus/icons-vue/dist/index.cjs"),h=require("../../../dist/hooks/src/use-namespace/index.cjs"),c=require("../../../node_modules/.pnpm/element-plus@2.8.7_vue@3.5.12_typescript@5.6.3_/node_modules/element-plus/es/components/message/index.cjs"),E={class:"slot"},x={key:0,class:"el-upload__tip"},C={style:{display:"inline-block"}},V=e.defineComponent({name:"QxsFileUpload",__name:"file-upload",props:{action:{},headers:{},data:{},name:{default:"file"},size:{default:20},max:{default:3},accept:{default:"zip,rar"},files:{default:()=>[]},notip:{type:Boolean,default:!1},ext:{}},emits:["onSuccess"],setup(d,{emit:u}){const a=d,p=u,m=h.useNamespace("file-upload"),i=e.computed(()=>a.accept.split(",").map(t=>t.split("/").pop())),f=t=>{var r;const l=(r=t.name.split(".").at(-1))!=null?r:"",s=i.value.includes(l),n=t.size/1024/1024<a.size;return s||c.ElMessage.error(`上传文件只支持 ${i.value.join(" / ")} 格式!`),n||c.ElMessage.error(`上传文件大小不能超过 ${a.size}MB!`),s&&n},_=()=>{c.ElMessage.warning("文件上传超过限制")},v=(t,o,l)=>{p("onSuccess",t,o,l)};return(t,o)=>{const l=e.resolveComponent("el-icon"),s=e.resolveComponent("el-alert"),n=e.resolveComponent("el-upload");return e.openBlock(),e.createBlock(n,{headers:t.headers,action:t.action,data:t.data,name:t.name,"before-upload":f,"on-exceed":_,"on-success":v,"file-list":t.files,limit:t.max,drag:"",class:e.normalizeClass(e.unref(m).e("control"))},{tip:e.withCtx(()=>[t.notip?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",C,[e.createVNode(s,{title:`上传文件支持 ${i.value.join(" / ")} 格式,单个文件大小不超过 ${t.size}MB,且文件数量不超过 ${t.max} 个`,type:"info","show-icon":"",closable:!1},null,8,["title"])])]))]),default:e.withCtx(()=>[e.createElementVNode("div",E,[e.createVNode(l,{class:"el-icon--upload"},{default:e.withCtx(()=>[e.createVNode(e.unref(N.UploadFilled))]),_:1}),o[0]||(o[0]=e.createElementVNode("div",{class:"el-upload__text"},[e.createTextVNode(" 将文件拖到此处,或"),e.createElementVNode("em",null,"点击上传")],-1))])]),_:1},8,["headers","action","data","name","file-list","limit","class"])}}});exports.default=V;
@@ -1,11 +1,11 @@
1
- import { defineComponent as y, computed as B, resolveComponent as c, openBlock as m, createBlock as x, normalizeClass as C, unref as u, withCtx as r, createElementBlock as E, createElementVNode as a, createVNode as d, createCommentVNode as $, createTextVNode as b } from "vue";
2
- import { UploadFilled as S } from "@element-plus/icons-vue";
3
- import { useNamespace as V } from "../../../packages/hooks/src/use-namespace/index.js";
4
- import { ElMessage as p } from "element-plus";
5
- const g = { class: "slot" }, w = {
1
+ import { defineComponent as B, computed as x, resolveComponent as c, openBlock as u, createBlock as C, normalizeClass as E, unref as f, withCtx as d, createElementBlock as $, createElementVNode as s, createVNode as r, createCommentVNode as b, createTextVNode as S } from "vue";
2
+ import { UploadFilled as V } from "../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.12_typescript@5.6.3_/node_modules/@element-plus/icons-vue/dist/index.js";
3
+ import { useNamespace as g } from "../../../dist/hooks/src/use-namespace/index.js";
4
+ import { ElMessage as p } from "../../../node_modules/.pnpm/element-plus@2.8.7_vue@3.5.12_typescript@5.6.3_/node_modules/element-plus/es/components/message/index.js";
5
+ const w = { class: "slot" }, M = {
6
6
  key: 0,
7
7
  class: "el-upload__tip"
8
- }, M = { style: { display: "inline-block" } }, T = /* @__PURE__ */ y({
8
+ }, U = { style: { display: "inline-block" } }, I = /* @__PURE__ */ B({
9
9
  name: "QxsFileUpload",
10
10
  __name: "file-upload",
11
11
  props: {
@@ -21,34 +21,35 @@ const g = { class: "slot" }, w = {
21
21
  ext: {}
22
22
  },
23
23
  emits: ["onSuccess"],
24
- setup(f, { emit: _ }) {
25
- const n = f, h = _, v = V("file-upload"), i = B(() => n.accept.split(",").map((e) => e.split("/").pop())), z = (e) => {
26
- const t = e.name.split(".").at(-1) ?? "", l = i.value.includes(t), s = e.size / 1024 / 1024 < n.size;
27
- return l || p.error(`上传文件只支持 ${i.value.join(" / ")} 格式!`), s || p.error(`上传文件大小不能超过 ${n.size}MB!`), l && s;
28
- }, k = () => {
24
+ setup(_, { emit: h }) {
25
+ const n = _, v = h, z = g("file-upload"), i = x(() => n.accept.split(",").map((e) => e.split("/").pop())), k = (e) => {
26
+ var m;
27
+ const t = (m = e.name.split(".").at(-1)) != null ? m : "", l = i.value.includes(t), a = e.size / 1024 / 1024 < n.size;
28
+ return l || p.error(`上传文件只支持 ${i.value.join(" / ")} 格式!`), a || p.error(`上传文件大小不能超过 ${n.size}MB!`), l && a;
29
+ }, N = () => {
29
30
  p.warning("文件上传超过限制");
30
- }, N = (e, o, t) => {
31
- h("onSuccess", e, o, t);
31
+ }, y = (e, o, t) => {
32
+ v("onSuccess", e, o, t);
32
33
  };
33
34
  return (e, o) => {
34
- const t = c("el-icon"), l = c("el-alert"), s = c("el-upload");
35
- return m(), x(s, {
35
+ const t = c("el-icon"), l = c("el-alert"), a = c("el-upload");
36
+ return u(), C(a, {
36
37
  headers: e.headers,
37
38
  action: e.action,
38
39
  data: e.data,
39
40
  name: e.name,
40
- "before-upload": z,
41
- "on-exceed": k,
42
- "on-success": N,
41
+ "before-upload": k,
42
+ "on-exceed": N,
43
+ "on-success": y,
43
44
  "file-list": e.files,
44
45
  limit: e.max,
45
46
  drag: "",
46
- class: C(u(v).e("control"))
47
+ class: E(f(z).e("control"))
47
48
  }, {
48
- tip: r(() => [
49
- e.notip ? $("", !0) : (m(), E("div", w, [
50
- a("div", M, [
51
- d(l, {
49
+ tip: d(() => [
50
+ e.notip ? b("", !0) : (u(), $("div", M, [
51
+ s("div", U, [
52
+ r(l, {
52
53
  title: `上传文件支持 ${i.value.join(" / ")} 格式,单个文件大小不超过 ${e.size}MB,且文件数量不超过 ${e.max} 个`,
53
54
  type: "info",
54
55
  "show-icon": "",
@@ -57,17 +58,17 @@ const g = { class: "slot" }, w = {
57
58
  ])
58
59
  ]))
59
60
  ]),
60
- default: r(() => [
61
- a("div", g, [
62
- d(t, { class: "el-icon--upload" }, {
63
- default: r(() => [
64
- d(u(S))
61
+ default: d(() => [
62
+ s("div", w, [
63
+ r(t, { class: "el-icon--upload" }, {
64
+ default: d(() => [
65
+ r(f(V))
65
66
  ]),
66
67
  _: 1
67
68
  }),
68
- o[0] || (o[0] = a("div", { class: "el-upload__text" }, [
69
- b(" 将文件拖到此处,或"),
70
- a("em", null, "点击上传")
69
+ o[0] || (o[0] = s("div", { class: "el-upload__text" }, [
70
+ S(" 将文件拖到此处,或"),
71
+ s("em", null, "点击上传")
71
72
  ], -1))
72
73
  ])
73
74
  ]),
@@ -77,5 +78,5 @@ const g = { class: "slot" }, w = {
77
78
  }
78
79
  });
79
80
  export {
80
- T as default
81
+ I as default
81
82
  };
@@ -1 +1 @@
1
- "use strict";const e=require("./file-upload.vue.cjs");module.exports=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./file-upload.vue.cjs");exports.default=e.default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../withInstall.cjs"),i=require("./src/fixed-action-bar.vue.cjs"),e=t.withInstall(i);exports.QxsFixedActionBar=e;exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../withInstall.cjs"),i=require("./src/fixed-action-bar.vue.cjs"),e=t.withInstall(i.default);exports.QxsFixedActionBar=e;exports.default=e;
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),b=require("../../../packages/hooks/src/use-namespace/index.cjs"),t=require("../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.cjs"),g=e.defineComponent({name:"QxsFixedActionBar",inheritAttrs:!1,__name:"fixed-action-bar",props:{padding:{type:String,default:"8px"}},setup(u){const m=u,n=b.useNamespace("fixed-action-bar"),p=e.useAttrs(),r=e.ref(!1),c=e.ref(null),s=e.ref(null),a=t.useParentElement(s),{height:f}=t.useElementSize(c,void 0,{box:"border-box"}),{left:h}=t.useElementBounding(a),{width:x}=t.useElementSize(a,void 0,{box:"border-box"});function o(){const l=window.scrollY||document.documentElement.scrollTop,d=window.innerHeight||document.documentElement.clientHeight,w=document.documentElement.scrollHeight;r.value=Math.ceil(l+d)>=w}e.onMounted(()=>{o(),window.addEventListener("scroll",o)}),e.onUnmounted(()=>{window.removeEventListener("scroll",o)});const i=e.computed(()=>({width:`${x||0}px`,left:`${h}px`,class:`${r.value?"":n.is("shadow")} ${p.class||""}`,...n.cssVarBlock({"actionbar-padding":`${m.padding}`})}));return(l,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"placeholderRef",ref:s,style:e.normalizeStyle(`width: 100%; height: ${e.unref(f)}px`)},null,4),e.createElementVNode("div",{ref_key:"actionbar",ref:c,style:e.normalizeStyle(i.value),class:e.normalizeClass([i.value.class,e.unref(n).e("actionbar")]),"data-fixed-calc-width":""},[e.renderSlot(l.$slots,"default")],6)],64))}});module.exports=g;
1
+ "use strict";var E=Object.defineProperty;var f=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var p=(o,n,t)=>n in o?E(o,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[n]=t,h=(o,n)=>{for(var t in n||(n={}))S.call(n,t)&&p(o,t,n[t]);if(f)for(var t of f(n))y.call(n,t)&&p(o,t,n[t]);return o};Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("../../../dist/hooks/src/use-namespace/index.cjs"),l=require("../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.cjs"),$=e.defineComponent({name:"QxsFixedActionBar",inheritAttrs:!1,__name:"fixed-action-bar",props:{padding:{type:String,default:"8px"}},setup(o){const n=o,t=_.useNamespace("fixed-action-bar"),b=e.useAttrs(),s=e.ref(!1),a=e.ref(null),i=e.ref(null),d=l.useParentElement(i),{height:g}=l.useElementSize(a,void 0,{box:"border-box"}),{left:w}=l.useElementBounding(d),{width:x}=l.useElementSize(d,void 0,{box:"border-box"});function r(){const c=window.scrollY||document.documentElement.scrollTop,m=window.innerHeight||document.documentElement.clientHeight,v=document.documentElement.scrollHeight;s.value=Math.ceil(c+m)>=v}e.onMounted(()=>{r(),window.addEventListener("scroll",r)}),e.onUnmounted(()=>{window.removeEventListener("scroll",r)});const u=e.computed(()=>h({width:`${x||0}px`,left:`${w}px`,class:`${s.value?"":t.is("shadow")} ${b.class||""}`},t.cssVarBlock({"actionbar-padding":`${n.padding}`})));return(c,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"placeholderRef",ref:i,style:e.normalizeStyle(`width: 100%; height: ${e.unref(g)}px`)},null,4),e.createElementVNode("div",{ref_key:"actionbar",ref:a,style:e.normalizeStyle(u.value),class:e.normalizeClass([u.value.class,e.unref(t).e("actionbar")]),"data-fixed-calc-width":""},[e.renderSlot(c.$slots,"default")],6)],64))}});exports.default=$;
@@ -1,7 +1,18 @@
1
- import { defineComponent as E, useAttrs as y, ref as n, onMounted as _, onUnmounted as $, computed as B, openBlock as S, createElementBlock as k, Fragment as H, createElementVNode as d, normalizeStyle as m, unref as u, normalizeClass as z, renderSlot as A } from "vue";
2
- import { useNamespace as L } from "../../../packages/hooks/src/use-namespace/index.js";
3
- import { useParentElement as C, useElementSize as p, useElementBounding as F } from "../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.js";
4
- const R = /* @__PURE__ */ E({
1
+ var $ = Object.defineProperty;
2
+ var u = Object.getOwnPropertySymbols;
3
+ var B = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
4
+ var p = (o, t, e) => t in o ? $(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, f = (o, t) => {
5
+ for (var e in t || (t = {}))
6
+ B.call(t, e) && p(o, e, t[e]);
7
+ if (u)
8
+ for (var e of u(t))
9
+ S.call(t, e) && p(o, e, t[e]);
10
+ return o;
11
+ };
12
+ import { defineComponent as k, useAttrs as H, ref as a, onMounted as z, onUnmounted as A, computed as L, openBlock as C, createElementBlock as F, Fragment as M, createElementVNode as h, normalizeStyle as w, unref as x, normalizeClass as N, renderSlot as P } from "vue";
13
+ import { useNamespace as R } from "../../../dist/hooks/src/use-namespace/index.js";
14
+ import { useParentElement as T, useElementSize as b, useElementBounding as V } from "../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.js";
15
+ const W = /* @__PURE__ */ k({
5
16
  name: "QxsFixedActionBar",
6
17
  inheritAttrs: !1,
7
18
  __name: "fixed-action-bar",
@@ -11,43 +22,42 @@ const R = /* @__PURE__ */ E({
11
22
  default: "8px"
12
23
  }
13
24
  },
14
- setup(f) {
15
- const h = f, e = L("fixed-action-bar"), w = y(), l = n(!1), c = n(null), r = n(null), a = C(r), { height: x } = p(c, void 0, { box: "border-box" }), { left: b } = F(a), { width: g } = p(a, void 0, { box: "border-box" });
16
- function t() {
17
- const o = window.scrollY || document.documentElement.scrollTop, i = window.innerHeight || document.documentElement.clientHeight, v = document.documentElement.scrollHeight;
18
- l.value = Math.ceil(o + i) >= v;
25
+ setup(o) {
26
+ const t = o, e = R("fixed-action-bar"), g = H(), c = a(!1), r = a(null), s = a(null), i = T(s), { height: v } = b(r, void 0, { box: "border-box" }), { left: E } = V(i), { width: y } = b(i, void 0, { box: "border-box" });
27
+ function n() {
28
+ const l = window.scrollY || document.documentElement.scrollTop, m = window.innerHeight || document.documentElement.clientHeight, _ = document.documentElement.scrollHeight;
29
+ c.value = Math.ceil(l + m) >= _;
19
30
  }
20
- _(() => {
21
- t(), window.addEventListener("scroll", t);
22
- }), $(() => {
23
- window.removeEventListener("scroll", t);
31
+ z(() => {
32
+ n(), window.addEventListener("scroll", n);
33
+ }), A(() => {
34
+ window.removeEventListener("scroll", n);
24
35
  });
25
- const s = B(() => ({
26
- width: `${g || 0}px`,
27
- left: `${b}px`,
28
- class: `${l.value ? "" : e.is("shadow")} ${w.class || ""}`,
29
- ...e.cssVarBlock({
30
- "actionbar-padding": `${h.padding}`
31
- })
32
- }));
33
- return (o, i) => (S(), k(H, null, [
34
- d("div", {
36
+ const d = L(() => f({
37
+ width: `${y || 0}px`,
38
+ left: `${E}px`,
39
+ class: `${c.value ? "" : e.is("shadow")} ${g.class || ""}`
40
+ }, e.cssVarBlock({
41
+ "actionbar-padding": `${t.padding}`
42
+ })));
43
+ return (l, m) => (C(), F(M, null, [
44
+ h("div", {
35
45
  ref_key: "placeholderRef",
36
- ref: r,
37
- style: m(`width: 100%; height: ${u(x)}px`)
46
+ ref: s,
47
+ style: w(`width: 100%; height: ${x(v)}px`)
38
48
  }, null, 4),
39
- d("div", {
49
+ h("div", {
40
50
  ref_key: "actionbar",
41
- ref: c,
42
- style: m(s.value),
43
- class: z([s.value.class, u(e).e("actionbar")]),
51
+ ref: r,
52
+ style: w(d.value),
53
+ class: N([d.value.class, x(e).e("actionbar")]),
44
54
  "data-fixed-calc-width": ""
45
55
  }, [
46
- A(o.$slots, "default")
56
+ P(l.$slots, "default")
47
57
  ], 6)
48
58
  ], 64));
49
59
  }
50
60
  });
51
61
  export {
52
- R as default
62
+ W as default
53
63
  };
@@ -1 +1 @@
1
- "use strict";const e=require("./fixed-action-bar.vue.cjs");module.exports=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./fixed-action-bar.vue.cjs");exports.default=e.default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../withInstall.cjs"),l=require("./src/image-upload.vue.cjs"),e=t.withInstall(l);exports.QxsImageUpload=e;exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../withInstall.cjs"),l=require("./src/image-upload.vue.cjs"),e=t.withInstall(l.default);exports.QxsImageUpload=e;exports.default=e;
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),n=require("@element-plus/icons-vue"),C=require("../../../packages/hooks/src/use-namespace/index.cjs"),d=require("element-plus"),$={key:1,class:"image"},B={class:"mask"},E={class:"actions"},z={key:0,class:"el-upload__tip-text"},S={style:{display:"inline-block"}},b=e.defineComponent({name:"QxsImageUpload",__name:"image-upload",props:{action:{},headers:{},data:{},name:{default:"file"},url:{default:""},size:{default:20},width:{default:160},accept:{default:"image/jpeg,image/jpg,image/png,image/gif"},height:{default:90},placeholder:{default:"点击上传图片"},notip:{type:Boolean,default:!1},tipText:{},beforeUpload:{}},emits:["update:url","onSuccess"],setup(u,{emit:m}){const s=u,p=m,c=C.useNamespace("image-upload"),o=e.ref({imageViewerVisible:!1,progress:{preview:"",percent:0}}),r=e.computed(()=>s.accept.split(",").map(t=>t.split("/").pop()));function h(){o.value.imageViewerVisible=!0}function g(){o.value.imageViewerVisible=!1}function f(){p("update:url","")}const v=t=>{const i=t.name.split(".").at(-1)??"",l=r.value.includes(i),a=t.size/1024/1024<s.size;return l?a?o.value.progress.preview=URL.createObjectURL(t):d.ElMessage.error(`上传图片大小不能超过 ${s.size}MB!`):d.ElMessage.error(`上传图片只支持${r.value.join(" / ")}格式!`),l&&a&&(!s.beforeUpload||s.beforeUpload(t))},w=t=>{o.value.progress.percent=~~t.percent},V=(...t)=>{o.value.progress.preview="",o.value.progress.percent=0,p("onSuccess",...t)};return(t,y)=>{const i=e.resolveComponent("el-icon"),l=e.resolveComponent("el-image"),a=e.resolveComponent("el-progress"),N=e.resolveComponent("el-upload"),k=e.resolveComponent("el-image-viewer");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(c).e("upload-container"))},[e.createVNode(N,{"show-file-list":!1,headers:t.headers,action:t.action,data:t.data,name:t.name,"before-upload":v,"on-progress":w,"on-success":V,drag:"",accept:t.accept,class:e.normalizeClass(e.unref(c).e("image-upload"))},{default:e.withCtx(()=>[t.url===""?(e.openBlock(),e.createBlock(l,{key:0,src:t.url===""?t.placeholder:t.url,style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`),fit:"fill"},{error:e.withCtx(()=>[e.createElementVNode("div",{class:"image-slot",style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`)},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.Plus))]),_:1}),e.createElementVNode("p",null,e.toDisplayString(t.placeholder),1)],4)]),_:1},8,["src","style"])):(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(l,{src:t.url,style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`),fit:"fill"},null,8,["src","style"]),e.createElementVNode("div",B,[e.createElementVNode("div",E,[e.createElementVNode("span",{title:"预览",onClick:e.withModifiers(h,["stop"])},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.ZoomIn))]),_:1})]),e.createElementVNode("span",{title:"移除",onClick:e.withModifiers(f,["stop"])},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.Delete))]),_:1})])])])])),e.withDirectives(e.createElementVNode("div",{class:"progress",style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`)},[e.createVNode(l,{src:o.value.progress.preview,style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`),fit:"fill"},null,8,["src","style"]),e.createVNode(a,{type:"circle",width:Math.min(t.width,t.height)*.8,percentage:o.value.progress.percent},null,8,["width","percentage"])],4),[[e.vShow,t.url===""&&o.value.progress.percent]])]),_:1},8,["headers","action","data","name","accept","class"]),t.notip?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",S,e.toDisplayString(t.tipText||`上传图片支持 ${r.value.join(" / ")} 格式,且图片大小不超过 ${t.size}MB,建议图片尺寸为 ${t.width}*${t.height}`),1)])),o.value.imageViewerVisible?(e.openBlock(),e.createBlock(k,{key:1,"url-list":[t.url],teleported:"",onClose:g},null,8,["url-list"])):e.createCommentVNode("",!0)],2)}}});module.exports=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.12_typescript@5.6.3_/node_modules/@element-plus/icons-vue/dist/index.cjs"),C=require("../../../dist/hooks/src/use-namespace/index.cjs"),u=require("../../../node_modules/.pnpm/element-plus@2.8.7_vue@3.5.12_typescript@5.6.3_/node_modules/element-plus/es/components/message/index.cjs"),$={key:1,class:"image"},B={class:"mask"},E={class:"actions"},S={key:0,class:"el-upload__tip-text"},z={style:{display:"inline-block"}},b=e.defineComponent({name:"QxsImageUpload",__name:"image-upload",props:{action:{},headers:{},data:{},name:{default:"file"},url:{default:""},size:{default:20},width:{default:160},accept:{default:"image/jpeg,image/jpg,image/png,image/gif"},height:{default:90},placeholder:{default:"点击上传图片"},notip:{type:Boolean,default:!1},tipText:{},beforeUpload:{}},emits:["update:url","onSuccess"],setup(m,{emit:h}){const s=m,c=h,d=C.useNamespace("image-upload"),l=e.ref({imageViewerVisible:!1,progress:{preview:"",percent:0}}),n=e.computed(()=>s.accept.split(",").map(t=>t.split("/").pop()));function g(){l.value.imageViewerVisible=!0}function f(){l.value.imageViewerVisible=!1}function v(){c("update:url","")}const w=t=>{var r;const i=(r=t.name.split(".").at(-1))!=null?r:"",o=n.value.includes(i),a=t.size/1024/1024<s.size;return o?a?l.value.progress.preview=URL.createObjectURL(t):u.ElMessage.error(`上传图片大小不能超过 ${s.size}MB!`):u.ElMessage.error(`上传图片只支持${n.value.join(" / ")}格式!`),o&&a&&(!s.beforeUpload||s.beforeUpload(t))},V=t=>{l.value.progress.percent=~~t.percent},y=(...t)=>{l.value.progress.preview="",l.value.progress.percent=0,c("onSuccess",...t)};return(t,N)=>{const i=e.resolveComponent("el-icon"),o=e.resolveComponent("el-image"),a=e.resolveComponent("el-progress"),r=e.resolveComponent("el-upload"),k=e.resolveComponent("el-image-viewer");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(d).e("upload-container"))},[e.createVNode(r,{"show-file-list":!1,headers:t.headers,action:t.action,data:t.data,name:t.name,"before-upload":w,"on-progress":V,"on-success":y,drag:"",accept:t.accept,class:e.normalizeClass(e.unref(d).e("image-upload"))},{default:e.withCtx(()=>[t.url===""?(e.openBlock(),e.createBlock(o,{key:0,src:t.url===""?t.placeholder:t.url,style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`),fit:"fill"},{error:e.withCtx(()=>[e.createElementVNode("div",{class:"image-slot",style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`)},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.Plus))]),_:1}),e.createElementVNode("p",null,e.toDisplayString(t.placeholder),1)],4)]),_:1},8,["src","style"])):(e.openBlock(),e.createElementBlock("div",$,[e.createVNode(o,{src:t.url,style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`),fit:"fill"},null,8,["src","style"]),e.createElementVNode("div",B,[e.createElementVNode("div",E,[e.createElementVNode("span",{title:"预览",onClick:e.withModifiers(g,["stop"])},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.ZoomIn))]),_:1})]),e.createElementVNode("span",{title:"移除",onClick:e.withModifiers(v,["stop"])},[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.Delete))]),_:1})])])])])),e.withDirectives(e.createElementVNode("div",{class:"progress",style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`)},[e.createVNode(o,{src:l.value.progress.preview,style:e.normalizeStyle(`width:${t.width}px;height:${t.height}px;`),fit:"fill"},null,8,["src","style"]),e.createVNode(a,{type:"circle",width:Math.min(t.width,t.height)*.8,percentage:l.value.progress.percent},null,8,["width","percentage"])],4),[[e.vShow,t.url===""&&l.value.progress.percent]])]),_:1},8,["headers","action","data","name","accept","class"]),t.notip?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",S,[e.createElementVNode("div",z,e.toDisplayString(t.tipText||`上传图片支持 ${n.value.join(" / ")} 格式,且图片大小不超过 ${t.size}MB,建议图片尺寸为 ${t.width}*${t.height}`),1)])),l.value.imageViewerVisible?(e.openBlock(),e.createBlock(k,{key:1,"url-list":[t.url],teleported:"",onClose:f},null,8,["url-list"])):e.createCommentVNode("",!0)],2)}}});exports.default=b;
@@ -1,7 +1,7 @@
1
- import { defineComponent as E, ref as O, computed as T, resolveComponent as r, openBlock as n, createElementBlock as m, normalizeClass as v, unref as p, createVNode as l, withCtx as d, createBlock as w, normalizeStyle as c, createElementVNode as t, toDisplayString as y, withModifiers as $, withDirectives as I, vShow as L, createCommentVNode as k } from "vue";
2
- import { Plus as P, ZoomIn as R, Delete as Q } from "@element-plus/icons-vue";
3
- import { useNamespace as Z } from "../../../packages/hooks/src/use-namespace/index.js";
4
- import { ElMessage as V } from "element-plus";
1
+ import { defineComponent as E, ref as I, computed as O, resolveComponent as r, openBlock as n, createElementBlock as g, normalizeClass as w, unref as p, createVNode as l, withCtx as d, createBlock as y, normalizeStyle as u, createElementVNode as t, toDisplayString as $, withModifiers as k, withDirectives as T, vShow as L, createCommentVNode as _ } from "vue";
2
+ import { Plus as P, ZoomIn as R, Delete as Q } from "../../../node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.12_typescript@5.6.3_/node_modules/@element-plus/icons-vue/dist/index.js";
3
+ import { useNamespace as Z } from "../../../dist/hooks/src/use-namespace/index.js";
4
+ import { ElMessage as V } from "../../../node_modules/.pnpm/element-plus@2.8.7_vue@3.5.12_typescript@5.6.3_/node_modules/element-plus/es/components/message/index.js";
5
5
  const q = {
6
6
  key: 1,
7
7
  class: "image"
@@ -27,60 +27,61 @@ const q = {
27
27
  beforeUpload: {}
28
28
  },
29
29
  emits: ["update:url", "onSuccess"],
30
- setup(b, { emit: C }) {
31
- const o = b, g = C, f = Z("image-upload"), s = O({
30
+ setup(b, { emit: z }) {
31
+ const o = b, f = z, v = Z("image-upload"), s = I({
32
32
  imageViewerVisible: !1,
33
33
  progress: {
34
34
  preview: "",
35
35
  percent: 0
36
36
  }
37
- }), h = T(() => o.accept.split(",").map((e) => e.split("/").pop()));
38
- function _() {
37
+ }), m = O(() => o.accept.split(",").map((e) => e.split("/").pop()));
38
+ function C() {
39
39
  s.value.imageViewerVisible = !0;
40
40
  }
41
- function z() {
41
+ function B() {
42
42
  s.value.imageViewerVisible = !1;
43
43
  }
44
- function B() {
45
- g("update:url", "");
44
+ function S() {
45
+ f("update:url", "");
46
46
  }
47
- const S = (e) => {
48
- const a = e.name.split(".").at(-1) ?? "", i = h.value.includes(a), u = e.size / 1024 / 1024 < o.size;
49
- return i ? u ? s.value.progress.preview = URL.createObjectURL(e) : V.error(`上传图片大小不能超过 ${o.size}MB!`) : V.error(`上传图片只支持${h.value.join(" / ")}格式!`), i && u && (!o.beforeUpload || o.beforeUpload(e));
50
- }, U = (e) => {
47
+ const U = (e) => {
48
+ var h;
49
+ const a = (h = e.name.split(".").at(-1)) != null ? h : "", i = m.value.includes(a), c = e.size / 1024 / 1024 < o.size;
50
+ return i ? c ? s.value.progress.preview = URL.createObjectURL(e) : V.error(`上传图片大小不能超过 ${o.size}MB!`) : V.error(`上传图片只支持${m.value.join(" / ")}格式!`), i && c && (!o.beforeUpload || o.beforeUpload(e));
51
+ }, N = (e) => {
51
52
  s.value.progress.percent = ~~e.percent;
52
- }, N = (...e) => {
53
- s.value.progress.preview = "", s.value.progress.percent = 0, g("onSuccess", ...e);
53
+ }, j = (...e) => {
54
+ s.value.progress.preview = "", s.value.progress.percent = 0, f("onSuccess", ...e);
54
55
  };
55
- return (e, j) => {
56
- const a = r("el-icon"), i = r("el-image"), u = r("el-progress"), M = r("el-upload"), D = r("el-image-viewer");
57
- return n(), m("div", {
58
- class: v(p(f).e("upload-container"))
56
+ return (e, M) => {
57
+ const a = r("el-icon"), i = r("el-image"), c = r("el-progress"), h = r("el-upload"), D = r("el-image-viewer");
58
+ return n(), g("div", {
59
+ class: w(p(v).e("upload-container"))
59
60
  }, [
60
- l(M, {
61
+ l(h, {
61
62
  "show-file-list": !1,
62
63
  headers: e.headers,
63
64
  action: e.action,
64
65
  data: e.data,
65
66
  name: e.name,
66
- "before-upload": S,
67
- "on-progress": U,
68
- "on-success": N,
67
+ "before-upload": U,
68
+ "on-progress": N,
69
+ "on-success": j,
69
70
  drag: "",
70
71
  accept: e.accept,
71
- class: v(p(f).e("image-upload"))
72
+ class: w(p(v).e("image-upload"))
72
73
  }, {
73
74
  default: d(() => [
74
- e.url === "" ? (n(), w(i, {
75
+ e.url === "" ? (n(), y(i, {
75
76
  key: 0,
76
77
  src: e.url === "" ? e.placeholder : e.url,
77
- style: c(`width:${e.width}px;height:${e.height}px;`),
78
+ style: u(`width:${e.width}px;height:${e.height}px;`),
78
79
  fit: "fill"
79
80
  }, {
80
81
  error: d(() => [
81
82
  t("div", {
82
83
  class: "image-slot",
83
- style: c(`width:${e.width}px;height:${e.height}px;`)
84
+ style: u(`width:${e.width}px;height:${e.height}px;`)
84
85
  }, [
85
86
  l(a, null, {
86
87
  default: d(() => [
@@ -88,21 +89,21 @@ const q = {
88
89
  ]),
89
90
  _: 1
90
91
  }),
91
- t("p", null, y(e.placeholder), 1)
92
+ t("p", null, $(e.placeholder), 1)
92
93
  ], 4)
93
94
  ]),
94
95
  _: 1
95
- }, 8, ["src", "style"])) : (n(), m("div", q, [
96
+ }, 8, ["src", "style"])) : (n(), g("div", q, [
96
97
  l(i, {
97
98
  src: e.url,
98
- style: c(`width:${e.width}px;height:${e.height}px;`),
99
+ style: u(`width:${e.width}px;height:${e.height}px;`),
99
100
  fit: "fill"
100
101
  }, null, 8, ["src", "style"]),
101
102
  t("div", A, [
102
103
  t("div", F, [
103
104
  t("span", {
104
105
  title: "预览",
105
- onClick: $(_, ["stop"])
106
+ onClick: k(C, ["stop"])
106
107
  }, [
107
108
  l(a, null, {
108
109
  default: d(() => [
@@ -113,7 +114,7 @@ const q = {
113
114
  ]),
114
115
  t("span", {
115
116
  title: "移除",
116
- onClick: $(B, ["stop"])
117
+ onClick: k(S, ["stop"])
117
118
  }, [
118
119
  l(a, null, {
119
120
  default: d(() => [
@@ -125,16 +126,16 @@ const q = {
125
126
  ])
126
127
  ])
127
128
  ])),
128
- I(t("div", {
129
+ T(t("div", {
129
130
  class: "progress",
130
- style: c(`width:${e.width}px;height:${e.height}px;`)
131
+ style: u(`width:${e.width}px;height:${e.height}px;`)
131
132
  }, [
132
133
  l(i, {
133
134
  src: s.value.progress.preview,
134
- style: c(`width:${e.width}px;height:${e.height}px;`),
135
+ style: u(`width:${e.width}px;height:${e.height}px;`),
135
136
  fit: "fill"
136
137
  }, null, 8, ["src", "style"]),
137
- l(u, {
138
+ l(c, {
138
139
  type: "circle",
139
140
  width: Math.min(e.width, e.height) * 0.8,
140
141
  percentage: s.value.progress.percent
@@ -145,15 +146,15 @@ const q = {
145
146
  ]),
146
147
  _: 1
147
148
  }, 8, ["headers", "action", "data", "name", "accept", "class"]),
148
- e.notip ? k("", !0) : (n(), m("div", G, [
149
- t("div", H, y(e.tipText || `上传图片支持 ${h.value.join(" / ")} 格式,且图片大小不超过 ${e.size}MB,建议图片尺寸为 ${e.width}*${e.height}`), 1)
149
+ e.notip ? _("", !0) : (n(), g("div", G, [
150
+ t("div", H, $(e.tipText || `上传图片支持 ${m.value.join(" / ")} 格式,且图片大小不超过 ${e.size}MB,建议图片尺寸为 ${e.width}*${e.height}`), 1)
150
151
  ])),
151
- s.value.imageViewerVisible ? (n(), w(D, {
152
+ s.value.imageViewerVisible ? (n(), y(D, {
152
153
  key: 1,
153
154
  "url-list": [e.url],
154
155
  teleported: "",
155
- onClose: z
156
- }, null, 8, ["url-list"])) : k("", !0)
156
+ onClose: B
157
+ }, null, 8, ["url-list"])) : _("", !0)
157
158
  ], 2);
158
159
  };
159
160
  }
@@ -1 +1 @@
1
- "use strict";const e=require("./image-upload.vue.cjs");module.exports=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./image-upload.vue.cjs");exports.default=e.default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../withInstall.cjs"),t=require("./src/photo-crop-tool.vue.cjs"),o=e.withInstall(t);exports.QxsPhotoCropTool=o;exports.default=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../withInstall.cjs"),t=require("./src/photo-crop-tool.vue.cjs"),e=o.withInstall(t.default);exports.QxsPhotoCropTool=e;exports.default=e;
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),G=require("../../../packages/hooks/src/use-namespace/index.cjs"),M=require("../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.cjs"),J=require("./composables.cjs"),K=["src"],Z=e.defineComponent({name:"QxsPhotoCropTool",__name:"photo-crop-tool",props:{imgFile:{type:Object,default:()=>null},aspectRatio:{type:String,default:()=>"16 / 9"},defaultWidth:{type:Number,default:()=>320},defaultHeight:{type:Number,default:()=>180},zoomType:{type:String,default:()=>"fixed"}},setup(Y,{expose:j}){const a=Y;let L=0,S=0,f=0,R=0;const d=G.useNamespace("photo-crop-tool"),W=e.ref(null),s=e.ref(null),C=e.ref(null),T=e.ref(""),h=e.ref(""),F=e.ref({x:0,y:0}),t=e.ref({width:a.defaultWidth,height:a.defaultHeight,x:0,y:0}),{width:H,height:E}=M.useElementSize(W),{width:D}=M.useElementSize(C),{x:p,y:m,style:O}=M.useDraggable(W,{containerElement:s,draggingElement:W,disabled:e.computed(()=>!!h.value),exact:!0,initialValue:F}),I=e.computed(()=>a.imgFile?URL.createObjectURL(a.imgFile):"");e.watch(()=>a.imgFile,l=>{l&&!l.type.startsWith("image/")?T.value="文件类型错误":T.value=""});const P=e.computed(()=>{var l;return(((l=C.value)==null?void 0:l.naturalWidth)||0)/D.value}),c=e.computed(()=>{const l={left:0,top:0};return h.value==="bottom-right"?(l.left=t.value.x,l.top=t.value.y):h.value==="top-left"?(l.left=t.value.x-H.value,l.top=t.value.y-E.value):h.value==="top-right"?(l.top=t.value.y-E.value,l.left=t.value.x):h.value==="bottom-left"&&(l.left=t.value.x-H.value,l.top=t.value.y),l}),_=e.computed(()=>{const{aspectRatio:l}=a,i={width:`${t.value.width||a.defaultWidth}`,height:`${t.value.height||a.defaultHeight}`,"aspect-ratio":l,top:`${c.value.top}px`,left:`${c.value.left}px`};return a.zoomType==="free"?delete i["aspect-ratio"]:a.zoomType==="fixed"&&delete i.height,d.cssVarBlock(i)});function g(l){return l*P.value}async function Q(l=C.value){var k,N;let i="transparent";s.value&&(i=window.getComputedStyle(s.value).backgroundColor);const u=document.createElement("canvas");u.width=g(((k=s.value)==null?void 0:k.clientWidth)||0),u.height=g(((N=s.value)==null?void 0:N.clientHeight)||0);const{drawImage:z,cropCanvas:y,drawColor:x}=J.useCanvas(u);return x(0,0,u.width,u.height,i),z(l,g(l.offsetLeft),g(l.offsetTop),l.naturalWidth,l.naturalHeight),await y(g(p.value),g(m.value),g(H.value),g(E.value))}function w(l,i){var y,x;const u=((y=s.value)==null?void 0:y.clientWidth)||1/0,z=((x=s.value)==null?void 0:x.clientHeight)||1/0;return{width:Math.min(Math.max(l,0),u),height:Math.min(Math.max(i,0),z)}}function V(l){var z,y,x,k,N,U,q,X;const i=l.clientX-L,u=l.clientY-S;if(h.value==="bottom-right"){if(a.zoomType==="free"){const{width:n,height:o}=w(f+i,R+u);t.value.width=n,t.value.height=o}else if(a.zoomType==="fixed"){const n=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f+i,r=o/n;const{width:b,height:v}=w(o,r);v>(((z=s.value)==null?void 0:z.clientHeight)||1/0)&&(r=((y=s.value)==null?void 0:y.clientHeight)||1/0,o=r*n),t.value.width=b,t.value.height=v}}else if(h.value==="top-left"){if(a.zoomType==="free"){const{width:n,height:o}=w(f-i,R-u);t.value.width=n,t.value.height=o}else if(a.zoomType==="fixed"){const n=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f-i,r=o/n;const{width:b,height:v}=w(o,r);v>(((x=s.value)==null?void 0:x.clientHeight)||1/0)&&(r=((k=s.value)==null?void 0:k.clientHeight)||1/0,o=r*n),t.value.width=b,t.value.height=v}p.value=c.value.left,m.value=c.value.top}else if(h.value==="top-right"){if(a.zoomType==="free"){const{width:n,height:o}=w(f+i,R-u);t.value.width=n,t.value.height=o}else if(a.zoomType==="fixed"){const n=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f+i,r=o/n;const{width:b,height:v}=w(o,r);v>(((N=s.value)==null?void 0:N.clientHeight)||1/0)&&(r=((U=s.value)==null?void 0:U.clientHeight)||1/0,o=r*n),t.value.width=b,t.value.height=v}p.value=c.value.left,m.value=c.value.top}else if(h.value==="bottom-left"){if(a.zoomType==="free"){const{width:n,height:o}=w(f-i,R+u);t.value.width=n,t.value.height=o}else if(a.zoomType==="fixed"){const n=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f-i,r=o/n;const{width:b,height:v}=w(o,r);v>(((q=s.value)==null?void 0:q.clientHeight)||1/0)&&(r=((X=s.value)==null?void 0:X.clientHeight)||1/0,o=r*n),t.value.width=b,t.value.height=v}p.value=c.value.left,m.value=c.value.top}l.preventDefault(),l.stopPropagation()}function B(l,i){h.value=i,L=l.clientX,S=l.clientY,f=t.value.width,R=t.value.height,i==="bottom-right"?(t.value.x=p.value,t.value.y=m.value):i==="top-left"?(t.value.x=p.value+H.value,t.value.y=m.value+E.value):i==="top-right"?(t.value.x=p.value,t.value.y=m.value+E.value):i==="bottom-left"&&(t.value.x=p.value+H.value,t.value.y=m.value)}function $(){h.value=""}function A(){t.value.width=a.defaultWidth,t.value.height=a.defaultHeight,p.value=0,m.value=0}return document.addEventListener("mouseup",$),document.addEventListener("mousemove",V),e.onMounted(()=>{e.nextTick(()=>{var l,i;F.value.x=(((l=s.value)==null?void 0:l.offsetWidth)||0)/2-t.value.width/2,F.value.y=(((i=s.value)==null?void 0:i.offsetHeight)||0)/2-t.value.height/2})}),e.onUnmounted(()=>{I.value&&URL.revokeObjectURL(I.value),document.removeEventListener("mouseup",$),document.removeEventListener("mousemove",V)}),j({crop:Q,resize:A}),(l,i)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerBoxRef",ref:s,class:e.normalizeClass([e.unref(d).e("img-box")])},[T.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(d).e("error-message")])},e.toDisplayString(T.value),3)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("img",{ref_key:"imgRef",ref:C,class:e.normalizeClass([e.unref(d).e("image")]),src:I.value},null,10,K),e.createElementVNode("div",{ref_key:"cropBoxRef",ref:W,class:e.normalizeClass([e.unref(d).e("crop-tool-box")]),style:e.normalizeStyle([_.value,h.value?`left: ${c.value.left}px;top: ${c.value.top}px`:e.unref(O)])},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(d).e("top-left")]),onMousedown:i[0]||(i[0]=u=>B(u,"top-left"))},null,34),e.createElementVNode("div",{class:e.normalizeClass([e.unref(d).e("top-right")]),onMousedown:i[1]||(i[1]=u=>B(u,"top-right"))},null,34),e.createElementVNode("div",{class:e.normalizeClass([e.unref(d).e("bottom-right")]),onMousedown:i[2]||(i[2]=u=>B(u,"bottom-right"))},null,34),e.createElementVNode("div",{class:e.normalizeClass([e.unref(d).e("bottom-left")]),onMousedown:i[3]||(i[3]=u=>B(u,"bottom-left"))},null,34)],6)],64))],2))}});module.exports=Z;
1
+ "use strict";var P=(M,S,a)=>new Promise((T,E)=>{var f=v=>{try{h(a.next(v))}catch(u){E(u)}},x=v=>{try{h(a.throw(v))}catch(u){E(u)}},h=v=>v.done?T(v.value):Promise.resolve(v.value).then(f,x);h((a=a.apply(M,S)).next())});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),J=require("../../../dist/hooks/src/use-namespace/index.cjs"),$=require("../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.cjs"),K=require("./composables.cjs"),Z=["src"],ee=e.defineComponent({name:"QxsPhotoCropTool",__name:"photo-crop-tool",props:{imgFile:{type:Object,default:()=>null},aspectRatio:{type:String,default:()=>"16 / 9"},defaultWidth:{type:Number,default:()=>320},defaultHeight:{type:Number,default:()=>180},zoomType:{type:String,default:()=>"fixed"}},setup(M,{expose:S}){const a=M;let T=0,E=0,f=0,x=0;const h=J.useNamespace("photo-crop-tool"),v=e.ref(null),u=e.ref(null),B=e.ref(null),F=e.ref(""),c=e.ref(""),L=e.ref({x:0,y:0}),t=e.ref({width:a.defaultWidth,height:a.defaultHeight,x:0,y:0}),{width:k,height:N}=$.useElementSize(v),{width:X}=$.useElementSize(B),{x:m,y:g,style:Y}=$.useDraggable(v,{containerElement:u,draggingElement:v,disabled:e.computed(()=>!!c.value),exact:!0,initialValue:L}),V=e.computed(()=>a.imgFile?URL.createObjectURL(a.imgFile):"");e.watch(()=>a.imgFile,l=>{l&&!l.type.startsWith("image/")?F.value="文件类型错误":F.value=""});const D=e.computed(()=>{var l;return(((l=B.value)==null?void 0:l.naturalWidth)||0)/X.value}),p=e.computed(()=>{const l={left:0,top:0};return c.value==="bottom-right"?(l.left=t.value.x,l.top=t.value.y):c.value==="top-left"?(l.left=t.value.x-k.value,l.top=t.value.y-N.value):c.value==="top-right"?(l.top=t.value.y-N.value,l.left=t.value.x):c.value==="bottom-left"&&(l.left=t.value.x-k.value,l.top=t.value.y),l}),Q=e.computed(()=>{const{aspectRatio:l}=a,i={width:`${t.value.width||a.defaultWidth}`,height:`${t.value.height||a.defaultHeight}`,"aspect-ratio":l,top:`${p.value.top}px`,left:`${p.value.left}px`};return a.zoomType==="free"?delete i["aspect-ratio"]:a.zoomType==="fixed"&&delete i.height,h.cssVarBlock(i)});function y(l){return l*D.value}function A(){return P(this,arguments,function*(l=B.value){var W,C;let i="transparent";u.value&&(i=window.getComputedStyle(u.value).backgroundColor);const n=document.createElement("canvas");n.width=y(((W=u.value)==null?void 0:W.clientWidth)||0),n.height=y(((C=u.value)==null?void 0:C.clientHeight)||0);const{drawImage:H,cropCanvas:b,drawColor:z}=K.useCanvas(n);return z(0,0,n.width,n.height,i),H(l,y(l.offsetLeft),y(l.offsetTop),l.naturalWidth,l.naturalHeight),yield b(y(m.value),y(g.value),y(k.value),y(N.value))})}function w(l,i){var b,z;const n=((b=u.value)==null?void 0:b.clientWidth)||1/0,H=((z=u.value)==null?void 0:z.clientHeight)||1/0;return{width:Math.min(Math.max(l,0),n),height:Math.min(Math.max(i,0),H)}}function U(l){var H,b,z,W,C,j,q,O;const i=l.clientX-T,n=l.clientY-E;if(c.value==="bottom-right"){if(a.zoomType==="free"){const{width:s,height:o}=w(f+i,x+n);t.value.width=s,t.value.height=o}else if(a.zoomType==="fixed"){const s=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f+i,r=o/s;const{width:R,height:d}=w(o,r);d>(((H=u.value)==null?void 0:H.clientHeight)||1/0)&&(r=((b=u.value)==null?void 0:b.clientHeight)||1/0,o=r*s),t.value.width=R,t.value.height=d}}else if(c.value==="top-left"){if(a.zoomType==="free"){const{width:s,height:o}=w(f-i,x-n);t.value.width=s,t.value.height=o}else if(a.zoomType==="fixed"){const s=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f-i,r=o/s;const{width:R,height:d}=w(o,r);d>(((z=u.value)==null?void 0:z.clientHeight)||1/0)&&(r=((W=u.value)==null?void 0:W.clientHeight)||1/0,o=r*s),t.value.width=R,t.value.height=d}m.value=p.value.left,g.value=p.value.top}else if(c.value==="top-right"){if(a.zoomType==="free"){const{width:s,height:o}=w(f+i,x-n);t.value.width=s,t.value.height=o}else if(a.zoomType==="fixed"){const s=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f+i,r=o/s;const{width:R,height:d}=w(o,r);d>(((C=u.value)==null?void 0:C.clientHeight)||1/0)&&(r=((j=u.value)==null?void 0:j.clientHeight)||1/0,o=r*s),t.value.width=R,t.value.height=d}m.value=p.value.left,g.value=p.value.top}else if(c.value==="bottom-left"){if(a.zoomType==="free"){const{width:s,height:o}=w(f-i,x+n);t.value.width=s,t.value.height=o}else if(a.zoomType==="fixed"){const s=Number.parseFloat(a.aspectRatio.split(" / ")[0])/Number.parseFloat(a.aspectRatio.split(" / ")[1]);let o=f-i,r=o/s;const{width:R,height:d}=w(o,r);d>(((q=u.value)==null?void 0:q.clientHeight)||1/0)&&(r=((O=u.value)==null?void 0:O.clientHeight)||1/0,o=r*s),t.value.width=R,t.value.height=d}m.value=p.value.left,g.value=p.value.top}l.preventDefault(),l.stopPropagation()}function I(l,i){c.value=i,T=l.clientX,E=l.clientY,f=t.value.width,x=t.value.height,i==="bottom-right"?(t.value.x=m.value,t.value.y=g.value):i==="top-left"?(t.value.x=m.value+k.value,t.value.y=g.value+N.value):i==="top-right"?(t.value.x=m.value,t.value.y=g.value+N.value):i==="bottom-left"&&(t.value.x=m.value+k.value,t.value.y=g.value)}function _(){c.value=""}function G(){t.value.width=a.defaultWidth,t.value.height=a.defaultHeight,m.value=0,g.value=0}return document.addEventListener("mouseup",_),document.addEventListener("mousemove",U),e.onMounted(()=>{e.nextTick(()=>{var l,i;L.value.x=(((l=u.value)==null?void 0:l.offsetWidth)||0)/2-t.value.width/2,L.value.y=(((i=u.value)==null?void 0:i.offsetHeight)||0)/2-t.value.height/2})}),e.onUnmounted(()=>{V.value&&URL.revokeObjectURL(V.value),document.removeEventListener("mouseup",_),document.removeEventListener("mousemove",U)}),S({crop:A,resize:G}),(l,i)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerBoxRef",ref:u,class:e.normalizeClass([e.unref(h).e("img-box")])},[F.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(h).e("error-message")])},e.toDisplayString(F.value),3)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("img",{ref_key:"imgRef",ref:B,class:e.normalizeClass([e.unref(h).e("image")]),src:V.value},null,10,Z),e.createElementVNode("div",{ref_key:"cropBoxRef",ref:v,class:e.normalizeClass([e.unref(h).e("crop-tool-box")]),style:e.normalizeStyle([Q.value,c.value?`left: ${p.value.left}px;top: ${p.value.top}px`:e.unref(Y)])},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(h).e("top-left")]),onMousedown:i[0]||(i[0]=n=>I(n,"top-left"))},null,34),e.createElementVNode("div",{class:e.normalizeClass([e.unref(h).e("top-right")]),onMousedown:i[1]||(i[1]=n=>I(n,"top-right"))},null,34),e.createElementVNode("div",{class:e.normalizeClass([e.unref(h).e("bottom-right")]),onMousedown:i[2]||(i[2]=n=>I(n,"bottom-right"))},null,34),e.createElementVNode("div",{class:e.normalizeClass([e.unref(h).e("bottom-left")]),onMousedown:i[3]||(i[3]=n=>I(n,"bottom-left"))},null,34)],6)],64))],2))}});exports.default=ee;
@@ -1,8 +1,24 @@
1
- import { defineComponent as le, ref as H, computed as E, watch as ie, onMounted as ae, nextTick as oe, onUnmounted as ue, openBlock as $, createElementBlock as X, normalizeClass as y, unref as g, toDisplayString as ne, Fragment as se, createElementVNode as W, normalizeStyle as he } from "vue";
2
- import { useNamespace as ve } from "../../../packages/hooks/src/use-namespace/index.js";
3
- import { useElementSize as Q, useDraggable as re } from "../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.js";
4
- import { useCanvas as fe } from "./composables.js";
5
- const ce = ["src"], we = /* @__PURE__ */ le({
1
+ var A = ($, X, i) => new Promise((L, I) => {
2
+ var f = (v) => {
3
+ try {
4
+ h(i.next(v));
5
+ } catch (o) {
6
+ I(o);
7
+ }
8
+ }, b = (v) => {
9
+ try {
10
+ h(i.throw(v));
11
+ } catch (o) {
12
+ I(o);
13
+ }
14
+ }, h = (v) => v.done ? L(v.value) : Promise.resolve(v.value).then(f, b);
15
+ h((i = i.apply($, X)).next());
16
+ });
17
+ import { defineComponent as ie, ref as W, computed as C, watch as ae, onMounted as oe, nextTick as ue, onUnmounted as ne, openBlock as D, createElementBlock as O, normalizeClass as x, unref as m, toDisplayString as se, Fragment as he, createElementVNode as k, normalizeStyle as ve } from "vue";
18
+ import { useNamespace as re } from "../../../dist/hooks/src/use-namespace/index.js";
19
+ import { useElementSize as G, useDraggable as fe } from "../../../node_modules/.pnpm/@vueuse_core@10.11.1_vue@3.5.12_typescript@5.6.3_/node_modules/@vueuse/core/index.js";
20
+ import { useCanvas as ce } from "./composables.js";
21
+ const de = ["src"], xe = /* @__PURE__ */ ie({
6
22
  name: "QxsPhotoCropTool",
7
23
  __name: "photo-crop-tool",
8
24
  props: {
@@ -31,170 +47,172 @@ const ce = ["src"], we = /* @__PURE__ */ le({
31
47
  default: () => "fixed"
32
48
  }
33
49
  },
34
- setup(q, { expose: A }) {
35
- const i = q;
36
- let Y = 0, j = 0, f = 0, T = 0;
37
- const c = ve("photo-crop-tool"), M = H(null), n = H(null), C = H(null), L = H(""), h = H(""), S = H({
50
+ setup($, { expose: X }) {
51
+ const i = $;
52
+ let L = 0, I = 0, f = 0, b = 0;
53
+ const h = re("photo-crop-tool"), v = W(null), o = W(null), B = W(null), S = W(""), r = W(""), Y = W({
38
54
  x: 0,
39
55
  y: 0
40
- }), e = H({
56
+ }), e = W({
41
57
  width: i.defaultWidth,
42
58
  height: i.defaultHeight,
43
59
  x: 0,
44
60
  y: 0
45
- }), { width: k, height: F } = Q(M), { width: G } = Q(C), { x: d, y: p, style: J } = re(M, {
46
- containerElement: n,
47
- draggingElement: M,
48
- disabled: E(() => !!h.value),
61
+ }), { width: F, height: N } = G(v), { width: J } = G(B), { x: p, y: g, style: K } = fe(v, {
62
+ containerElement: o,
63
+ draggingElement: v,
64
+ disabled: C(() => !!r.value),
49
65
  exact: !0,
50
- initialValue: S
51
- }), U = E(() => i.imgFile ? URL.createObjectURL(i.imgFile) : "");
52
- ie(() => i.imgFile, (t) => {
53
- t && !t.type.startsWith("image/") ? L.value = "文件类型错误" : L.value = "";
66
+ initialValue: Y
67
+ }), j = C(() => i.imgFile ? URL.createObjectURL(i.imgFile) : "");
68
+ ae(() => i.imgFile, (t) => {
69
+ t && !t.type.startsWith("image/") ? S.value = "文件类型错误" : S.value = "";
54
70
  });
55
- const K = E(() => {
71
+ const Z = C(() => {
56
72
  var t;
57
- return (((t = C.value) == null ? void 0 : t.naturalWidth) || 0) / G.value;
58
- }), r = E(() => {
73
+ return (((t = B.value) == null ? void 0 : t.naturalWidth) || 0) / J.value;
74
+ }), d = C(() => {
59
75
  const t = {
60
76
  left: 0,
61
77
  top: 0
62
78
  };
63
- return h.value === "bottom-right" ? (t.left = e.value.x, t.top = e.value.y) : h.value === "top-left" ? (t.left = e.value.x - k.value, t.top = e.value.y - F.value) : h.value === "top-right" ? (t.top = e.value.y - F.value, t.left = e.value.x) : h.value === "bottom-left" && (t.left = e.value.x - k.value, t.top = e.value.y), t;
64
- }), Z = E(() => {
79
+ return r.value === "bottom-right" ? (t.left = e.value.x, t.top = e.value.y) : r.value === "top-left" ? (t.left = e.value.x - F.value, t.top = e.value.y - N.value) : r.value === "top-right" ? (t.top = e.value.y - N.value, t.left = e.value.x) : r.value === "bottom-left" && (t.left = e.value.x - F.value, t.top = e.value.y), t;
80
+ }), ee = C(() => {
65
81
  const { aspectRatio: t } = i, l = {
66
82
  width: `${e.value.width || i.defaultWidth}`,
67
83
  height: `${e.value.height || i.defaultHeight}`,
68
84
  "aspect-ratio": t,
69
- top: `${r.value.top}px`,
70
- left: `${r.value.left}px`
85
+ top: `${d.value.top}px`,
86
+ left: `${d.value.left}px`
71
87
  };
72
- return i.zoomType === "free" ? delete l["aspect-ratio"] : i.zoomType === "fixed" && delete l.height, c.cssVarBlock(l);
88
+ return i.zoomType === "free" ? delete l["aspect-ratio"] : i.zoomType === "fixed" && delete l.height, h.cssVarBlock(l);
73
89
  });
74
- function m(t) {
75
- return t * K.value;
90
+ function w(t) {
91
+ return t * Z.value;
76
92
  }
77
- async function ee(t = C.value) {
78
- var I, N;
79
- let l = "transparent";
80
- n.value && (l = window.getComputedStyle(n.value).backgroundColor);
81
- const o = document.createElement("canvas");
82
- o.width = m(((I = n.value) == null ? void 0 : I.clientWidth) || 0), o.height = m(((N = n.value) == null ? void 0 : N.clientHeight) || 0);
83
- const { drawImage: z, cropCanvas: x, drawColor: b } = fe(o);
84
- return b(0, 0, o.width, o.height, l), z(t, m(t.offsetLeft), m(t.offsetTop), t.naturalWidth, t.naturalHeight), await x(m(d.value), m(p.value), m(k.value), m(F.value));
93
+ function te() {
94
+ return A(this, arguments, function* (t = B.value) {
95
+ var E, M;
96
+ let l = "transparent";
97
+ o.value && (l = window.getComputedStyle(o.value).backgroundColor);
98
+ const u = document.createElement("canvas");
99
+ u.width = w(((E = o.value) == null ? void 0 : E.clientWidth) || 0), u.height = w(((M = o.value) == null ? void 0 : M.clientHeight) || 0);
100
+ const { drawImage: T, cropCanvas: R, drawColor: H } = ce(u);
101
+ return H(0, 0, u.width, u.height, l), T(t, w(t.offsetLeft), w(t.offsetTop), t.naturalWidth, t.naturalHeight), yield R(w(p.value), w(g.value), w(F.value), w(N.value));
102
+ });
85
103
  }
86
- function w(t, l) {
87
- var x, b;
88
- const o = ((x = n.value) == null ? void 0 : x.clientWidth) || 1 / 0, z = ((b = n.value) == null ? void 0 : b.clientHeight) || 1 / 0;
104
+ function y(t, l) {
105
+ var R, H;
106
+ const u = ((R = o.value) == null ? void 0 : R.clientWidth) || 1 / 0, T = ((H = o.value) == null ? void 0 : H.clientHeight) || 1 / 0;
89
107
  return {
90
- width: Math.min(Math.max(t, 0), o),
91
- height: Math.min(Math.max(l, 0), z)
108
+ width: Math.min(Math.max(t, 0), u),
109
+ height: Math.min(Math.max(l, 0), T)
92
110
  };
93
111
  }
94
- function D(t) {
95
- var z, x, b, I, N, P, V, _;
96
- const l = t.clientX - Y, o = t.clientY - j;
97
- if (h.value === "bottom-right") {
112
+ function P(t) {
113
+ var T, R, H, E, M, _, Q, q;
114
+ const l = t.clientX - L, u = t.clientY - I;
115
+ if (r.value === "bottom-right") {
98
116
  if (i.zoomType === "free") {
99
- const { width: u, height: a } = w(f + l, T + o);
100
- e.value.width = u, e.value.height = a;
117
+ const { width: n, height: a } = y(f + l, b + u);
118
+ e.value.width = n, e.value.height = a;
101
119
  } else if (i.zoomType === "fixed") {
102
- const u = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
103
- let a = f + l, s = a / u;
104
- const { width: R, height: v } = w(a, s);
105
- v > (((z = n.value) == null ? void 0 : z.clientHeight) || 1 / 0) && (s = ((x = n.value) == null ? void 0 : x.clientHeight) || 1 / 0, a = s * u), e.value.width = R, e.value.height = v;
120
+ const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
121
+ let a = f + l, s = a / n;
122
+ const { width: z, height: c } = y(a, s);
123
+ c > (((T = o.value) == null ? void 0 : T.clientHeight) || 1 / 0) && (s = ((R = o.value) == null ? void 0 : R.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
106
124
  }
107
- } else if (h.value === "top-left") {
125
+ } else if (r.value === "top-left") {
108
126
  if (i.zoomType === "free") {
109
- const { width: u, height: a } = w(f - l, T - o);
110
- e.value.width = u, e.value.height = a;
127
+ const { width: n, height: a } = y(f - l, b - u);
128
+ e.value.width = n, e.value.height = a;
111
129
  } else if (i.zoomType === "fixed") {
112
- const u = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
113
- let a = f - l, s = a / u;
114
- const { width: R, height: v } = w(a, s);
115
- v > (((b = n.value) == null ? void 0 : b.clientHeight) || 1 / 0) && (s = ((I = n.value) == null ? void 0 : I.clientHeight) || 1 / 0, a = s * u), e.value.width = R, e.value.height = v;
130
+ const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
131
+ let a = f - l, s = a / n;
132
+ const { width: z, height: c } = y(a, s);
133
+ c > (((H = o.value) == null ? void 0 : H.clientHeight) || 1 / 0) && (s = ((E = o.value) == null ? void 0 : E.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
116
134
  }
117
- d.value = r.value.left, p.value = r.value.top;
118
- } else if (h.value === "top-right") {
135
+ p.value = d.value.left, g.value = d.value.top;
136
+ } else if (r.value === "top-right") {
119
137
  if (i.zoomType === "free") {
120
- const { width: u, height: a } = w(f + l, T - o);
121
- e.value.width = u, e.value.height = a;
138
+ const { width: n, height: a } = y(f + l, b - u);
139
+ e.value.width = n, e.value.height = a;
122
140
  } else if (i.zoomType === "fixed") {
123
- const u = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
124
- let a = f + l, s = a / u;
125
- const { width: R, height: v } = w(a, s);
126
- v > (((N = n.value) == null ? void 0 : N.clientHeight) || 1 / 0) && (s = ((P = n.value) == null ? void 0 : P.clientHeight) || 1 / 0, a = s * u), e.value.width = R, e.value.height = v;
141
+ const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
142
+ let a = f + l, s = a / n;
143
+ const { width: z, height: c } = y(a, s);
144
+ c > (((M = o.value) == null ? void 0 : M.clientHeight) || 1 / 0) && (s = ((_ = o.value) == null ? void 0 : _.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
127
145
  }
128
- d.value = r.value.left, p.value = r.value.top;
129
- } else if (h.value === "bottom-left") {
146
+ p.value = d.value.left, g.value = d.value.top;
147
+ } else if (r.value === "bottom-left") {
130
148
  if (i.zoomType === "free") {
131
- const { width: u, height: a } = w(f - l, T + o);
132
- e.value.width = u, e.value.height = a;
149
+ const { width: n, height: a } = y(f - l, b + u);
150
+ e.value.width = n, e.value.height = a;
133
151
  } else if (i.zoomType === "fixed") {
134
- const u = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
135
- let a = f - l, s = a / u;
136
- const { width: R, height: v } = w(a, s);
137
- v > (((V = n.value) == null ? void 0 : V.clientHeight) || 1 / 0) && (s = ((_ = n.value) == null ? void 0 : _.clientHeight) || 1 / 0, a = s * u), e.value.width = R, e.value.height = v;
152
+ const n = Number.parseFloat(i.aspectRatio.split(" / ")[0]) / Number.parseFloat(i.aspectRatio.split(" / ")[1]);
153
+ let a = f - l, s = a / n;
154
+ const { width: z, height: c } = y(a, s);
155
+ c > (((Q = o.value) == null ? void 0 : Q.clientHeight) || 1 / 0) && (s = ((q = o.value) == null ? void 0 : q.clientHeight) || 1 / 0, a = s * n), e.value.width = z, e.value.height = c;
138
156
  }
139
- d.value = r.value.left, p.value = r.value.top;
157
+ p.value = d.value.left, g.value = d.value.top;
140
158
  }
141
159
  t.preventDefault(), t.stopPropagation();
142
160
  }
143
- function B(t, l) {
144
- h.value = l, Y = t.clientX, j = t.clientY, f = e.value.width, T = e.value.height, l === "bottom-right" ? (e.value.x = d.value, e.value.y = p.value) : l === "top-left" ? (e.value.x = d.value + k.value, e.value.y = p.value + F.value) : l === "top-right" ? (e.value.x = d.value, e.value.y = p.value + F.value) : l === "bottom-left" && (e.value.x = d.value + k.value, e.value.y = p.value);
161
+ function U(t, l) {
162
+ r.value = l, L = t.clientX, I = t.clientY, f = e.value.width, b = e.value.height, l === "bottom-right" ? (e.value.x = p.value, e.value.y = g.value) : l === "top-left" ? (e.value.x = p.value + F.value, e.value.y = g.value + N.value) : l === "top-right" ? (e.value.x = p.value, e.value.y = g.value + N.value) : l === "bottom-left" && (e.value.x = p.value + F.value, e.value.y = g.value);
145
163
  }
146
- function O() {
147
- h.value = "";
164
+ function V() {
165
+ r.value = "";
148
166
  }
149
- function te() {
150
- e.value.width = i.defaultWidth, e.value.height = i.defaultHeight, d.value = 0, p.value = 0;
167
+ function le() {
168
+ e.value.width = i.defaultWidth, e.value.height = i.defaultHeight, p.value = 0, g.value = 0;
151
169
  }
152
- return document.addEventListener("mouseup", O), document.addEventListener("mousemove", D), ae(() => {
153
- oe(() => {
170
+ return document.addEventListener("mouseup", V), document.addEventListener("mousemove", P), oe(() => {
171
+ ue(() => {
154
172
  var t, l;
155
- S.value.x = (((t = n.value) == null ? void 0 : t.offsetWidth) || 0) / 2 - e.value.width / 2, S.value.y = (((l = n.value) == null ? void 0 : l.offsetHeight) || 0) / 2 - e.value.height / 2;
173
+ Y.value.x = (((t = o.value) == null ? void 0 : t.offsetWidth) || 0) / 2 - e.value.width / 2, Y.value.y = (((l = o.value) == null ? void 0 : l.offsetHeight) || 0) / 2 - e.value.height / 2;
156
174
  });
157
- }), ue(() => {
158
- U.value && URL.revokeObjectURL(U.value), document.removeEventListener("mouseup", O), document.removeEventListener("mousemove", D);
159
- }), A({
160
- crop: ee,
161
- resize: te
162
- }), (t, l) => ($(), X("div", {
175
+ }), ne(() => {
176
+ j.value && URL.revokeObjectURL(j.value), document.removeEventListener("mouseup", V), document.removeEventListener("mousemove", P);
177
+ }), X({
178
+ crop: te,
179
+ resize: le
180
+ }), (t, l) => (D(), O("div", {
163
181
  ref_key: "containerBoxRef",
164
- ref: n,
165
- class: y([g(c).e("img-box")])
182
+ ref: o,
183
+ class: x([m(h).e("img-box")])
166
184
  }, [
167
- L.value ? ($(), X("div", {
185
+ S.value ? (D(), O("div", {
168
186
  key: 0,
169
- class: y([g(c).e("error-message")])
170
- }, ne(L.value), 3)) : ($(), X(se, { key: 1 }, [
171
- W("img", {
187
+ class: x([m(h).e("error-message")])
188
+ }, se(S.value), 3)) : (D(), O(he, { key: 1 }, [
189
+ k("img", {
172
190
  ref_key: "imgRef",
173
- ref: C,
174
- class: y([g(c).e("image")]),
175
- src: U.value
176
- }, null, 10, ce),
177
- W("div", {
191
+ ref: B,
192
+ class: x([m(h).e("image")]),
193
+ src: j.value
194
+ }, null, 10, de),
195
+ k("div", {
178
196
  ref_key: "cropBoxRef",
179
- ref: M,
180
- class: y([g(c).e("crop-tool-box")]),
181
- style: he([Z.value, h.value ? `left: ${r.value.left}px;top: ${r.value.top}px` : g(J)])
197
+ ref: v,
198
+ class: x([m(h).e("crop-tool-box")]),
199
+ style: ve([ee.value, r.value ? `left: ${d.value.left}px;top: ${d.value.top}px` : m(K)])
182
200
  }, [
183
- W("div", {
184
- class: y([g(c).e("top-left")]),
185
- onMousedown: l[0] || (l[0] = (o) => B(o, "top-left"))
201
+ k("div", {
202
+ class: x([m(h).e("top-left")]),
203
+ onMousedown: l[0] || (l[0] = (u) => U(u, "top-left"))
186
204
  }, null, 34),
187
- W("div", {
188
- class: y([g(c).e("top-right")]),
189
- onMousedown: l[1] || (l[1] = (o) => B(o, "top-right"))
205
+ k("div", {
206
+ class: x([m(h).e("top-right")]),
207
+ onMousedown: l[1] || (l[1] = (u) => U(u, "top-right"))
190
208
  }, null, 34),
191
- W("div", {
192
- class: y([g(c).e("bottom-right")]),
193
- onMousedown: l[2] || (l[2] = (o) => B(o, "bottom-right"))
209
+ k("div", {
210
+ class: x([m(h).e("bottom-right")]),
211
+ onMousedown: l[2] || (l[2] = (u) => U(u, "bottom-right"))
194
212
  }, null, 34),
195
- W("div", {
196
- class: y([g(c).e("bottom-left")]),
197
- onMousedown: l[3] || (l[3] = (o) => B(o, "bottom-left"))
213
+ k("div", {
214
+ class: x([m(h).e("bottom-left")]),
215
+ onMousedown: l[3] || (l[3] = (u) => U(u, "bottom-left"))
198
216
  }, null, 34)
199
217
  ], 6)
200
218
  ], 64))
@@ -202,5 +220,5 @@ const ce = ["src"], we = /* @__PURE__ */ le({
202
220
  }
203
221
  });
204
222
  export {
205
- we as default
223
+ xe as default
206
224
  };
@@ -1 +1 @@
1
- "use strict";const e=require("./photo-crop-tool.vue.cjs");module.exports=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./photo-crop-tool.vue.cjs");exports.default=e.default;
@@ -23,11 +23,11 @@ declare const QxsFileUpload: import('../withInstall').SFCWithInstall<import('vue
23
23
  notip?: boolean;
24
24
  ext?: string[];
25
25
  }> & Readonly<{
26
- onOnSuccess?: ((...args: any[]) => any) | undefined;
26
+ onOnSuccess?: (...args: any[]) => any;
27
27
  }>, {
28
+ size: number;
28
29
  name: import('element-plus').UploadProps["name"];
29
30
  accept: string;
30
- size: number;
31
31
  max: number;
32
32
  files: import('element-plus').UploadUserFile[];
33
33
  notip: boolean;
@@ -25,11 +25,11 @@ declare const _default: import('vue').DefineComponent<{
25
25
  notip?: boolean;
26
26
  ext?: string[];
27
27
  }> & Readonly<{
28
- onOnSuccess?: ((...args: any[]) => any) | undefined;
28
+ onOnSuccess?: (...args: any[]) => any;
29
29
  }>, {
30
+ size: number;
30
31
  name: UploadProps["name"];
31
32
  accept: string;
32
- size: number;
33
33
  max: number;
34
34
  files: UploadUserFile[];
35
35
  notip: boolean;
@@ -30,12 +30,12 @@ declare const QxsImageUpload: import('../withInstall').SFCWithInstall<import('vu
30
30
  tipText?: string;
31
31
  beforeUpload?: import('element-plus').UploadProps["beforeUpload"];
32
32
  }> & Readonly<{
33
- onOnSuccess?: ((res: any, uploadFile: import('element-plus').UploadFile, uploadFiles: import('element-plus').UploadFiles) => any) | undefined;
34
- "onUpdate:url"?: ((url: string) => any) | undefined;
33
+ onOnSuccess?: (res: any, uploadFile: import('element-plus').UploadFile, uploadFiles: import('element-plus').UploadFiles) => any;
34
+ "onUpdate:url"?: (url: string) => any;
35
35
  }>, {
36
+ size: number;
36
37
  name: import('element-plus').UploadProps["name"];
37
38
  accept: string;
38
- size: number;
39
39
  url: string;
40
40
  notip: boolean;
41
41
  height: number;
@@ -32,12 +32,12 @@ declare const _default: import('vue').DefineComponent<{
32
32
  tipText?: string;
33
33
  beforeUpload?: UploadProps["beforeUpload"];
34
34
  }> & Readonly<{
35
- onOnSuccess?: ((res: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => any) | undefined;
36
- "onUpdate:url"?: ((url: string) => any) | undefined;
35
+ onOnSuccess?: (res: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => any;
36
+ "onUpdate:url"?: (url: string) => any;
37
37
  }>, {
38
+ size: number;
38
39
  name: UploadProps["name"];
39
40
  accept: string;
40
- size: number;
41
41
  url: string;
42
42
  notip: boolean;
43
43
  height: number;
@@ -1,7 +1,7 @@
1
1
  declare const QxsPhotoCropTool: import('../withInstall').SFCWithInstall<import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
2
  imgFile: {
3
3
  type: import('vue').PropType<File>;
4
- default: () => null;
4
+ default: () => any;
5
5
  };
6
6
  aspectRatio: {
7
7
  type: StringConstructor;
@@ -20,12 +20,12 @@ declare const QxsPhotoCropTool: import('../withInstall').SFCWithInstall<import('
20
20
  default: () => string;
21
21
  };
22
22
  }>, {
23
- crop: (img?: HTMLImageElement) => Promise<File | null>;
23
+ crop: (img?: HTMLImageElement) => Promise<File>;
24
24
  resize: () => void;
25
25
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
26
26
  imgFile: {
27
27
  type: import('vue').PropType<File>;
28
- default: () => null;
28
+ default: () => any;
29
29
  };
30
30
  aspectRatio: {
31
31
  type: StringConstructor;
@@ -1,11 +1,11 @@
1
1
  import { PropType } from 'vue';
2
2
 
3
- declare function crop(img?: HTMLImageElement): Promise<File | null>;
3
+ declare function crop(img?: HTMLImageElement): Promise<File>;
4
4
  declare function resize(): void;
5
5
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
6
6
  imgFile: {
7
7
  type: PropType<File>;
8
- default: () => null;
8
+ default: () => any;
9
9
  };
10
10
  aspectRatio: {
11
11
  type: StringConstructor;
@@ -33,7 +33,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
33
33
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
34
34
  imgFile: {
35
35
  type: PropType<File>;
36
- default: () => null;
36
+ default: () => any;
37
37
  };
38
38
  aspectRatio: {
39
39
  type: StringConstructor;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),m="qxs",i="is-";function c(t,o,a,v,p){let u=`${t}-${o}`;return a&&(u+=`-${a}`),v&&(u+=`__${v}`),p&&(u+=`--${p}`),u}const $=Symbol("namespaceContextKey");function N(t){const o=r.getCurrentInstance()?r.inject($,r.ref(m)):r.ref(m);return r.computed(()=>r.unref(o)||m)}function y(t,o){const a=N();return{namespace:a,b:(e="")=>c(a.value,t,e,"",""),e:e=>e?c(a.value,t,"",e,""):"",m:e=>e?c(a.value,t,"","",e):"",be:(e,s)=>e&&s?c(a.value,t,e,s,""):"",em:(e,s)=>e&&s?c(a.value,t,"",e,s):"",bm:(e,s)=>e&&s?c(a.value,t,e,"",s):"",bem:(e,s,n)=>e&&s&&n?c(a.value,t,e,s,n):"",is:(e,...s)=>{const n=s.length>=1?s[0]:!0;return e&&n?`${i}${e}`:""},cssVar:e=>{const s={};for(const n in e)e[n]&&(s[`--${a.value}-${n}`]=e[n]);return s},cssVarName:e=>`--${a.value}-${e}`,cssVarBlock:e=>{const s={};for(const n in e)e[n]&&(s[`--${a.value}-${t}-${n}`]=e[n]);return s},cssVarBlockName:e=>`--${a.value}-${t}-${e}`}}exports.defaultNamespace=m;exports.namespaceContextKey=$;exports.useGetDerivedNamespace=N;exports.useNamespace=y;
@@ -1,49 +0,0 @@
1
- import { getCurrentInstance as p, inject as N, ref as v, computed as V, unref as y } from "vue";
2
- const $ = "qxs", i = "is-";
3
- function c(n, u, a, o, m) {
4
- let r = `${n}-${u}`;
5
- return a && (r += `-${a}`), o && (r += `__${o}`), m && (r += `--${m}`), r;
6
- }
7
- const l = Symbol("namespaceContextKey");
8
- function B(n) {
9
- const u = p() ? N(l, v($)) : v($);
10
- return V(() => y(u) || $);
11
- }
12
- function D(n, u) {
13
- const a = B();
14
- return {
15
- namespace: a,
16
- b: (s = "") => c(a.value, n, s, "", ""),
17
- e: (s) => s ? c(a.value, n, "", s, "") : "",
18
- m: (s) => s ? c(a.value, n, "", "", s) : "",
19
- be: (s, e) => s && e ? c(a.value, n, s, e, "") : "",
20
- em: (s, e) => s && e ? c(a.value, n, "", s, e) : "",
21
- bm: (s, e) => s && e ? c(a.value, n, s, "", e) : "",
22
- bem: (s, e, t) => s && e && t ? c(a.value, n, s, e, t) : "",
23
- is: (s, ...e) => {
24
- const t = e.length >= 1 ? e[0] : !0;
25
- return s && t ? `${i}${s}` : "";
26
- },
27
- // css
28
- cssVar: (s) => {
29
- const e = {};
30
- for (const t in s)
31
- s[t] && (e[`--${a.value}-${t}`] = s[t]);
32
- return e;
33
- },
34
- cssVarName: (s) => `--${a.value}-${s}`,
35
- cssVarBlock: (s) => {
36
- const e = {};
37
- for (const t in s)
38
- s[t] && (e[`--${a.value}-${n}-${t}`] = s[t]);
39
- return e;
40
- },
41
- cssVarBlockName: (s) => `--${a.value}-${n}-${s}`
42
- };
43
- }
44
- export {
45
- $ as defaultNamespace,
46
- l as namespaceContextKey,
47
- B as useGetDerivedNamespace,
48
- D as useNamespace
49
- };