epic-designer-gold 0.0.48 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{attributeView-DvYRuXDB.js → attributeView-BhPj8bSe.js} +1 -1
  2. package/dist/{attributeView-CMbZBZIS.cjs → attributeView-C9gY9X-c.cjs} +1 -1
  3. package/dist/{index-WBW2xl-M.js → index-3ndHV3fl.js} +1 -1
  4. package/dist/index-B45xlt7e.js +4 -0
  5. package/dist/{index-BIfS14i1.cjs → index-BA5cmAC5.cjs} +1 -1
  6. package/dist/{index-2_PG24En.cjs → index-BmqAqj29.cjs} +1 -1
  7. package/dist/{index-CtK_8YxJ.cjs → index-C2HMY2I2.cjs} +2 -2
  8. package/dist/{index-C8eSqkwT.cjs → index-CE9DjYAW.cjs} +1 -1
  9. package/dist/{index-Bjj1uygU.js → index-CshPxldv.js} +1 -1
  10. package/dist/{index-FUj4O0Wm.cjs → index-CvF1WVts.cjs} +1 -1
  11. package/dist/{index-D0xByXxW.js → index-Cw3VVR9A.js} +1 -1
  12. package/dist/{index-SmoMBzHL.js → index-DMDLjlCJ.js} +1 -1
  13. package/dist/{index-Dy65ngnp.js → index-DNuLy9hB.js} +6 -6
  14. package/dist/{index-BsyFZeFI.cjs → index-DpitV6qp.cjs} +1 -1
  15. package/dist/{index-ijn3b5rF.js → index-DtWX93JN.js} +1 -1
  16. package/dist/{index-3oFTJubt.cjs → index-F6atymcD.cjs} +1 -1
  17. package/dist/index-G-yqaciQ.cjs +1 -0
  18. package/dist/{index-BizWKLWZ.js → index-N_JBxsiO.js} +1 -1
  19. package/dist/index-efmvTLGJ.js +194 -0
  20. package/dist/{index-zyeRTxj7.cjs → index-iQ5ZEvrv.cjs} +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/sign-BJBURbHk.js +218 -0
  24. package/dist/sign-Cn6LXVcp.cjs +1 -0
  25. package/dist/style.css +1 -1
  26. package/dist/{styleView-CF34Ddn9.cjs → styleView-Dew56dxa.cjs} +1 -1
  27. package/dist/{styleView-BbQxI-Nr.js → styleView-SPW99MRS.js} +1 -1
  28. package/dist/ui/elementPlus/index.cjs +1 -1
  29. package/dist/ui/elementPlus/index.js +42 -44
  30. package/package.json +1 -1
  31. package/dist/index-CqirvAEP.js +0 -4
  32. package/dist/index-DiYy4kUz.js +0 -228
  33. package/dist/index-YV7i1gyI.cjs +0 -1
  34. package/dist/sign-BRchUdJt.js +0 -156
  35. package/dist/sign-CnQtsTLr.cjs +0 -1
@@ -1,228 +0,0 @@
1
- import { defineComponent as D, inject as j, resolveComponent as J, openBlock as v, createBlock as I, unref as r, isRef as E, withCtx as z, createElementVNode as p, normalizeClass as M, createVNode as m, createCommentVNode as A, createElementBlock as g, ref as K, reactive as B, onMounted as L, watch as P, provide as R, Fragment as F, renderList as q, toDisplayString as G, withDirectives as H, vShow as Q, createTextVNode as W } from "vue";
2
- import { d as X } from "./vuedraggable.umd-D2S7Eo7p.js";
3
- import { p as f, E as $, a as Y, b as w } from "./js.cookie-oHpRFPCO.js";
4
- import { _ as S } from "./icon.vue_vue_type_script_setup_true_lang-D3QdcReY.js";
5
- import { n as N } from "./index-Dy65ngnp.js";
6
- import { ElMessage as Z } from "element-plus";
7
- import { _ as ee } from "./_plugin-vue_export-helper-CHgC5LLL.js";
8
- const le = {
9
- key: 0,
10
- class: "pl-4"
11
- }, te = /* @__PURE__ */ D({
12
- name: "EOptionItem",
13
- __name: "optionItem",
14
- props: {
15
- modelValue: {}
16
- },
17
- emits: ["update:modelValue"],
18
- setup(y, { emit: k }) {
19
- const C = y, b = f.getComponent("input"), c = j("tree", !1), s = N(C, "modelValue", k);
20
- function x(t) {
21
- const d = {
22
- label: "",
23
- value: ""
24
- };
25
- t.children ? t.children.push(d) : t.children = [d];
26
- }
27
- function o(t) {
28
- s.value = s.value.filter((d, V) => V !== t);
29
- }
30
- return (t, d) => {
31
- const V = J("EOptionItem");
32
- return v(), I(r(X), {
33
- modelValue: r(s),
34
- "onUpdate:modelValue": d[0] || (d[0] = (n) => E(s) ? s.value = n : null),
35
- "item-key": "id",
36
- "component-data": {
37
- type: "transition-group"
38
- },
39
- group: "option-list",
40
- handle: ".handle",
41
- animation: 200
42
- }, {
43
- item: z(({ element: n, index: _ }) => [
44
- p("div", null, [
45
- p("div", {
46
- class: M([r(c) ? "grid-cols-[16px_auto_auto_16px_16px]" : "grid-cols-[16px_auto_auto_16px]", "option-item text-16px grid text-$epic-text-secondary gap-2 items-center mb-2"])
47
- }, [
48
- m(r(S), {
49
- class: "mr-2 cursor-move handle",
50
- name: "icon--epic--drag"
51
- }),
52
- m(r(b), {
53
- modelValue: n.label,
54
- "onUpdate:modelValue": (i) => n.label = i,
55
- value: n.label,
56
- "onUpdate:value": (i) => n.label = i,
57
- placeholder: "label"
58
- }, null, 8, ["modelValue", "onUpdate:modelValue", "value", "onUpdate:value"]),
59
- m(r(b), {
60
- modelValue: n.value,
61
- "onUpdate:modelValue": (i) => n.value = i,
62
- value: n.value,
63
- "onUpdate:value": (i) => n.value = i,
64
- placeholder: "value"
65
- }, null, 8, ["modelValue", "onUpdate:modelValue", "value", "onUpdate:value"]),
66
- r(c) ? (v(), I(r(S), {
67
- key: 0,
68
- class: "cursor-pointer text-lg!",
69
- name: "icon--epic--add-rounded",
70
- onClick: (i) => x(n)
71
- }, null, 8, ["onClick"])) : A("", !0),
72
- m(r(S), {
73
- class: "hover:text-red cursor-pointer",
74
- name: "icon--epic--delete-outline-rounded",
75
- onClick: (i) => o(_)
76
- }, null, 8, ["onClick"])
77
- ], 2),
78
- n.children ? (v(), g("div", le, [
79
- m(V, {
80
- modelValue: n.children,
81
- "onUpdate:modelValue": (i) => n.children = i
82
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
83
- ])) : A("", !0)
84
- ])
85
- ]),
86
- _: 1
87
- }, 8, ["modelValue"]);
88
- };
89
- }
90
- }), ae = { class: "" }, ne = { class: "epic-tabs-box" }, oe = ["title", "onClick"], re = { key: 0 }, ie = { class: "py-4 my-2 text-center text-gray-400 bg-white" }, ue = { key: 1 }, se = /* @__PURE__ */ D({
91
- __name: "index",
92
- props: {
93
- tree: { type: Boolean },
94
- modelValue: {},
95
- dynamicId: {},
96
- type: {}
97
- },
98
- emits: ["update:modelValue", "update:EOptionsEditor"],
99
- setup(y, { emit: k }) {
100
- const C = f.getComponent("button"), b = f.getComponent("select"), c = K([]), h = B({
101
- title: "静态"
102
- }), s = y, x = k;
103
- $.on("deleteSourceData", (l) => {
104
- t.value === l && (t.value = "", o.value = []);
105
- }), $.on("updateSource", (l) => {
106
- c.value = f.sourceData.map((e) => ({
107
- ...e,
108
- label: e.apiName,
109
- value: e.id
110
- })), _(t.value);
111
- }), L(() => {
112
- c.value = f.sourceData.map((l) => ({
113
- ...l,
114
- label: l.apiName,
115
- value: l.id
116
- })), _(t.value);
117
- });
118
- const o = N(s, "modelValue", x), t = N(s, "dynamicId", x);
119
- function d(l, e, u) {
120
- return l && Object.prototype.toString.call(l) === "[object Array]" ? l.map((a) => a.children && a.children.length ? {
121
- label: a[e],
122
- value: a[u] + "",
123
- children: d(a.children, e, u)
124
- } : {
125
- label: a[e],
126
- value: a[u] + ""
127
- }) : (Z.info("请检查数据位置是否配置准确"), []);
128
- }
129
- P(
130
- () => t.value,
131
- async () => {
132
- t.value ? h.title = "动态" : h.title = "静态";
133
- },
134
- {
135
- immediate: !0
136
- }
137
- );
138
- const V = [
139
- {
140
- title: "静态"
141
- },
142
- {
143
- title: "动态"
144
- }
145
- ];
146
- async function n(l) {
147
- h.title = l.title, l.title === "静态" ? (o.value = [], t.value = "") : (o.value = [], c.value = f.sourceData.map((e) => ({
148
- ...e,
149
- label: e.apiName,
150
- value: e.id
151
- })));
152
- }
153
- async function _(l) {
154
- const e = c.value.find((u) => u.id === l);
155
- if (e && e.url) {
156
- let u = await Y({
157
- method: (e == null ? void 0 : e.method) || "get",
158
- url: e.url,
159
- // url: "http://localhost:3333/users",
160
- params: e != null && e.params ? JSON.parse(e == null ? void 0 : e.params) : {},
161
- data: e != null && e.data ? JSON.parse(e == null ? void 0 : e.data) : {},
162
- headers: e != null && e.header ? {
163
- ...JSON.parse(e == null ? void 0 : e.header),
164
- Authorization: "Bearer " + w.get("Admin-Token")
165
- } : {
166
- Authorization: "Bearer " + w.get("Admin-Token")
167
- }
168
- });
169
- if (e && (e != null && e.dataPath)) {
170
- const U = e.dataPath.split(".").reduce((O, T) => O[T], u.data);
171
- o.value = d(U, e.dataKey, e.dataValue);
172
- } else
173
- o.value = d(u.data, e.dataKey, e.dataValue);
174
- }
175
- }
176
- s.modelValue, R("tree", s.tree);
177
- function i() {
178
- const l = B({
179
- label: "",
180
- value: ""
181
- });
182
- o.value.length ? o.value = [...o.value, l] : o.value = [l];
183
- }
184
- return (l, e) => {
185
- var u;
186
- return v(), g("div", ae, [
187
- p("div", null, [
188
- p("div", ne, [
189
- (v(), g(F, null, q(V, (a, U) => p("div", {
190
- class: M(["epic-tab cursor-pointer truncate", { checked: h.title === a.title }]),
191
- key: U,
192
- title: a.title,
193
- onClick: (O) => n(a)
194
- }, G(a.title), 11, oe)), 64))
195
- ]),
196
- h.title === "静态" ? (v(), g("div", re, [
197
- H(p("div", ie, "暂无选项", 512), [
198
- [Q, !((u = r(o)) != null && u.length)]
199
- ]),
200
- m(te, {
201
- modelValue: r(o),
202
- "onUpdate:modelValue": e[0] || (e[0] = (a) => E(o) ? o.value = a : null)
203
- }, null, 8, ["modelValue"]),
204
- m(r(C), { onClick: i }, {
205
- default: z(() => e[2] || (e[2] = [
206
- W("添加选项")
207
- ])),
208
- _: 1
209
- })
210
- ])) : (v(), g("div", ue, [
211
- e[3] || (e[3] = p("span", { style: { "font-size": "12px", "margin-bottom": "8px", display: "inline-block" } }, "数据源", -1)),
212
- m(r(b), {
213
- modelValue: r(t),
214
- "onUpdate:modelValue": e[1] || (e[1] = (a) => E(t) ? t.value = a : null),
215
- placeholder: "请选择数据源",
216
- clearable: "",
217
- options: c.value,
218
- onChange: _
219
- }, null, 8, ["modelValue", "options"])
220
- ]))
221
- ])
222
- ]);
223
- };
224
- }
225
- }), Ve = /* @__PURE__ */ ee(se, [["__scopeId", "data-v-5a353824"]]);
226
- export {
227
- Ve as default
228
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),B=require("./vuedraggable.umd-BqhSJIAi.cjs"),c=require("./js.cookie-BH1G_HRi.cjs"),b=require("./icon.vue_vue_type_script_setup_true_lang-DJbUD5AQ.cjs"),x=require("./index-CtK_8YxJ.cjs"),E=require("element-plus"),S=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),U={key:0,class:"pl-4"},M=e.defineComponent({name:"EOptionItem",__name:"optionItem",props:{modelValue:{}},emits:["update:modelValue"],setup(h,{emit:g}){const k=h,f=c.pluginManager.getComponent("input"),p=e.inject("tree",!1),m=g,d=x.useVModel(k,"modelValue",m);function _(n){const s={label:"",value:""};n.children?n.children.push(s):n.children=[s]}function r(n){d.value=d.value.filter((s,v)=>v!==n)}return(n,s)=>{const v=e.resolveComponent("EOptionItem");return e.openBlock(),e.createBlock(e.unref(B.draggable),{modelValue:e.unref(d),"onUpdate:modelValue":s[0]||(s[0]=o=>e.isRef(d)?d.value=o:null),"item-key":"id","component-data":{type:"transition-group"},group:"option-list",handle:".handle",animation:200},{item:e.withCtx(({element:o,index:V})=>[e.createElementVNode("div",null,[e.createElementVNode("div",{class:e.normalizeClass([e.unref(p)?"grid-cols-[16px_auto_auto_16px_16px]":"grid-cols-[16px_auto_auto_16px]","option-item text-16px grid text-$epic-text-secondary gap-2 items-center mb-2"])},[e.createVNode(e.unref(b._sfc_main),{class:"mr-2 cursor-move handle",name:"icon--epic--drag"}),e.createVNode(e.unref(f),{modelValue:o.label,"onUpdate:modelValue":u=>o.label=u,value:o.label,"onUpdate:value":u=>o.label=u,placeholder:"label"},null,8,["modelValue","onUpdate:modelValue","value","onUpdate:value"]),e.createVNode(e.unref(f),{modelValue:o.value,"onUpdate:modelValue":u=>o.value=u,value:o.value,"onUpdate:value":u=>o.value=u,placeholder:"value"},null,8,["modelValue","onUpdate:modelValue","value","onUpdate:value"]),e.unref(p)?(e.openBlock(),e.createBlock(e.unref(b._sfc_main),{key:0,class:"cursor-pointer text-lg!",name:"icon--epic--add-rounded",onClick:u=>_(o)},null,8,["onClick"])):e.createCommentVNode("",!0),e.createVNode(e.unref(b._sfc_main),{class:"hover:text-red cursor-pointer",name:"icon--epic--delete-outline-rounded",onClick:u=>r(V)},null,8,["onClick"])],2),o.children?(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(v,{modelValue:o.children,"onUpdate:modelValue":u=>o.children=u},null,8,["modelValue","onUpdate:modelValue"])])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue"])}}}),O={class:""},I={class:"epic-tabs-box"},A=["title","onClick"],q={key:0},w={class:"py-4 my-2 text-center text-gray-400 bg-white"},$={key:1},D=e.defineComponent({__name:"index",props:{tree:{type:Boolean},modelValue:{},dynamicId:{},type:{}},emits:["update:modelValue","update:EOptionsEditor"],setup(h,{emit:g}){const k=c.pluginManager.getComponent("button"),f=c.pluginManager.getComponent("select"),p=e.ref([]),m=e.reactive({title:"静态"}),d=h,_=g;c.EventBus.on("deleteSourceData",t=>{n.value===t&&(n.value="",r.value=[])}),c.EventBus.on("updateSource",t=>{p.value=c.pluginManager.sourceData.map(l=>({...l,label:l.apiName,value:l.id})),V(n.value)}),e.onMounted(()=>{p.value=c.pluginManager.sourceData.map(t=>({...t,label:t.apiName,value:t.id})),V(n.value)});const r=x.useVModel(d,"modelValue",_),n=x.useVModel(d,"dynamicId",_);function s(t,l,i){return t&&Object.prototype.toString.call(t)==="[object Array]"?t.map(a=>a.children&&a.children.length?{label:a[l],value:a[i]+"",children:s(a.children,l,i)}:{label:a[l],value:a[i]+""}):(E.ElMessage.info("请检查数据位置是否配置准确"),[])}e.watch(()=>n.value,async()=>{n.value?m.title="动态":m.title="静态"},{immediate:!0});const v=[{title:"静态"},{title:"动态"}];async function o(t){m.title=t.title,t.title==="静态"?(r.value=[],n.value=""):(r.value=[],p.value=c.pluginManager.sourceData.map(l=>({...l,label:l.apiName,value:l.id})))}async function V(t){const l=p.value.find(i=>i.id===t);if(l&&l.url){let i=await c.axios({method:(l==null?void 0:l.method)||"get",url:l.url,params:l!=null&&l.params?JSON.parse(l==null?void 0:l.params):{},data:l!=null&&l.data?JSON.parse(l==null?void 0:l.data):{},headers:l!=null&&l.header?{...JSON.parse(l==null?void 0:l.header),Authorization:"Bearer "+c.api.get("Admin-Token")}:{Authorization:"Bearer "+c.api.get("Admin-Token")}});if(l&&(l!=null&&l.dataPath)){const y=l.dataPath.split(".").reduce((N,C)=>N[C],i.data);r.value=s(y,l.dataKey,l.dataValue)}else r.value=s(i.data,l.dataKey,l.dataValue)}}d.modelValue,e.provide("tree",d.tree);function u(){const t=e.reactive({label:"",value:""});r.value.length?r.value=[...r.value,t]:r.value=[t]}return(t,l)=>{var i;return e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",null,[e.createElementVNode("div",I,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(v,(a,y)=>e.createElementVNode("div",{class:e.normalizeClass(["epic-tab cursor-pointer truncate",{checked:m.title===a.title}]),key:y,title:a.title,onClick:N=>o(a)},e.toDisplayString(a.title),11,A)),64))]),m.title==="静态"?(e.openBlock(),e.createElementBlock("div",q,[e.withDirectives(e.createElementVNode("div",w,"暂无选项",512),[[e.vShow,!((i=e.unref(r))!=null&&i.length)]]),e.createVNode(M,{modelValue:e.unref(r),"onUpdate:modelValue":l[0]||(l[0]=a=>e.isRef(r)?r.value=a:null)},null,8,["modelValue"]),e.createVNode(e.unref(k),{onClick:u},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加选项")])),_:1})])):(e.openBlock(),e.createElementBlock("div",$,[l[3]||(l[3]=e.createElementVNode("span",{style:{"font-size":"12px","margin-bottom":"8px",display:"inline-block"}},"数据源",-1)),e.createVNode(e.unref(f),{modelValue:e.unref(n),"onUpdate:modelValue":l[1]||(l[1]=a=>e.isRef(n)?n.value=a:null),placeholder:"请选择数据源",clearable:"",options:p.value,onChange:V},null,8,["modelValue","options"])]))])])}}}),j=S._export_sfc(D,[["__scopeId","data-v-5a353824"]]);exports.default=j;
@@ -1,156 +0,0 @@
1
- import { inject as Y, watch as O, nextTick as U, ref as a, onMounted as H, onUnmounted as I, openBlock as N, createElementBlock as E, normalizeStyle as F, createElementVNode as r, createVNode as S, unref as v, withCtx as x, createTextVNode as w } from "vue";
2
- import { p as q, a as L, b as G } from "./js.cookie-oHpRFPCO.js";
3
- import { _ as J } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
- const K = { class: "btn" }, Q = { class: "btns" }, Z = {
5
- __name: "sign",
6
- props: {
7
- componentSchema: {
8
- type: Object,
9
- require: !0,
10
- default: () => ({})
11
- },
12
- modelValue: {
13
- type: String,
14
- default: ""
15
- }
16
- },
17
- emits: ["update:modelValue"],
18
- setup(k, { expose: _, emit: T }) {
19
- const g = q.getComponent("button"), C = T, n = k, i = Y("disabled", { value: !1 });
20
- O(
21
- () => n.componentSchema,
22
- () => {
23
- U(() => {
24
- f();
25
- });
26
- },
27
- { deep: !0, immediate: !0 }
28
- );
29
- const D = new ResizeObserver((t) => {
30
- for (const e of t)
31
- e.target && e.target.clientWidth && e.target.clientHeight && f();
32
- }), l = a(null), s = a(null), o = a(), V = a("");
33
- function f() {
34
- var t, e;
35
- if (s.value && ((t = s.value) != null && t.clientHeight) && ((e = s.value) != null && e.clientWidth)) {
36
- if (l.value.height = s.value.clientHeight, l.value.width = s.value.clientWidth, o.value = l.value.getContext("2d"), n.modelValue) {
37
- let c = new Image();
38
- c.src = n.modelValue, c.setAttribute("crossOrigin", "anonymous"), c.onload = () => {
39
- o.value.fillStyle = o.value.createPattern(c, "repeat"), o.value.fillRect(0, 0, 1e3, 550);
40
- };
41
- }
42
- o.value.lineWidth = n.componentSchema.componentProps.lineWidth || 4, n.componentSchema && n.componentSchema.componentProps && n.componentSchema.componentProps.style && n.componentSchema.componentProps.style.color && (o.value.strokeStyle = n.componentSchema.componentProps.style.color), V.value = l.value.getBoundingClientRect();
43
- }
44
- }
45
- const p = a(""), m = a(""), B = a(""), W = a(""), u = a([]), h = a(!1);
46
- function z(t) {
47
- if (i.value || n.componentSchema.componentProps.readonly || n.componentSchema.componentProps.disabled)
48
- return;
49
- t = t || event, t.preventDefault();
50
- let e = {
51
- x: t.offsetX,
52
- y: t.offsetY
53
- };
54
- p.value = e.x, m.value = e.y, o.value.beginPath(), o.value.moveTo(e.x, e.y), o.value.lineTo(e.x, e.y), o.value.stroke(), o.value.closePath(), u.value.push(e), h.value = !0;
55
- }
56
- function A(t) {
57
- if (!(i.value || n.componentSchema.componentProps.readonly || n.componentSchema.componentProps.disabled) && (t = t || event, t.preventDefault(), h.value)) {
58
- let e = {
59
- x: t.offsetX,
60
- y: t.offsetY
61
- };
62
- B.value = e.x, W.value = e.y, o.value.beginPath(), o.value.moveTo(p.value, m.value), o.value.lineTo(e.x, e.y), o.value.stroke(), o.value.closePath(), p.value = e.x, m.value = e.y, u.value.push(e);
63
- }
64
- }
65
- function M(t) {
66
- if (i.value || n.componentSchema.componentProps.readonly || n.componentSchema.componentProps.disabled)
67
- return;
68
- t = t || event, t.preventDefault();
69
- let e = {
70
- x: t.offsetX,
71
- y: t.offsetY
72
- };
73
- o.value.beginPath(), o.value.moveTo(p.value, m.value), o.value.lineTo(e.x, e.y), o.value.stroke(), o.value.closePath(), u.value.push(e), u.value.push({ x: -1, y: -1 }), h.value = !1;
74
- }
75
- function b() {
76
- o.value.clearRect(0, 0, l.value.width, l.value.height), u.value = [];
77
- }
78
- async function y() {
79
- let t = await j(l.value.toDataURL("image/png"));
80
- C("update:modelValue", t);
81
- }
82
- async function j(t) {
83
- let e = atob(t.split(",")[1]), c = new ArrayBuffer(e.length), R = new Uint8Array(c);
84
- for (let d = 0; d < e.length; d++)
85
- R[d] = e.charCodeAt(d);
86
- let X = new Blob([c], { type: "image/png" }), P = new FormData();
87
- return P.append("file", X, Date.now() + "png"), (await L({
88
- method: "post",
89
- url: "https://ess-ds.com/prod-api/center-file/file/upload",
90
- data: P,
91
- headers: {
92
- "Content-Type": "multipart/form-data",
93
- Authorization: "Bearer " + G.get("Admin-Token")
94
- }
95
- })).data.data.url;
96
- }
97
- return H(() => {
98
- f(), D.observe(s.value);
99
- }), I(() => {
100
- }), _({
101
- surewrite: y
102
- }), (t, e) => (N(), E("div", {
103
- class: "sign",
104
- style: F({
105
- height: n.componentSchema.componentProps.style.height,
106
- width: n.componentSchema.componentProps.style.width || "100%"
107
- })
108
- }, [
109
- r("div", {
110
- class: "canvas",
111
- ref_key: "canvasWrap",
112
- ref: s
113
- }, [
114
- r("canvas", {
115
- ref_key: "canvas",
116
- ref: l,
117
- onMousedown: z,
118
- onMousemove: A,
119
- onMouseup: M
120
- }, null, 544)
121
- ], 512),
122
- r("div", K, [
123
- e[2] || (e[2] = r("div", { class: "remark" }, null, -1)),
124
- r("div", Q, [
125
- S(v(g), {
126
- disabled: v(i) || n.componentSchema.componentProps.readonly || n.componentSchema.componentProps.disabled,
127
- type: "info",
128
- size: "mini",
129
- onClick: b,
130
- onTouch: b
131
- }, {
132
- default: x(() => e[0] || (e[0] = [
133
- w("重写")
134
- ])),
135
- _: 1
136
- }, 8, ["disabled"]),
137
- S(v(g), {
138
- disabled: v(i) || n.componentSchema.componentProps.readonly || n.componentSchema.componentProps.disabled,
139
- type: "primary",
140
- size: "mini",
141
- onClick: y,
142
- onTouch: y
143
- }, {
144
- default: x(() => e[1] || (e[1] = [
145
- w("确定")
146
- ])),
147
- _: 1
148
- }, 8, ["disabled"])
149
- ])
150
- ])
151
- ], 4));
152
- }
153
- }, ne = /* @__PURE__ */ J(Z, [["__scopeId", "data-v-ee5237db"]]);
154
- export {
155
- ne as default
156
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),h=require("./js.cookie-BH1G_HRi.cjs"),W=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),z={class:"btn"},A={class:"btns"},E={__name:"sign",props:{componentSchema:{type:Object,require:!0,default:()=>({})},modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(S,{expose:P,emit:x}){const y=h.pluginManager.getComponent("button"),w=x,a=S,c=t.inject("disabled",{value:!1});t.watch(()=>a.componentSchema,()=>{t.nextTick(()=>{d()})},{deep:!0,immediate:!0});const V=new ResizeObserver(o=>{for(const e of o)e.target&&e.target.clientWidth&&e.target.clientHeight&&d()}),l=t.ref(null),s=t.ref(null),n=t.ref(),_=t.ref("");function d(){var o,e;if(s.value&&((o=s.value)!=null&&o.clientHeight)&&((e=s.value)!=null&&e.clientWidth)){if(l.value.height=s.value.clientHeight,l.value.width=s.value.clientWidth,n.value=l.value.getContext("2d"),a.modelValue){let r=new Image;r.src=a.modelValue,r.setAttribute("crossOrigin","anonymous"),r.onload=()=>{n.value.fillStyle=n.value.createPattern(r,"repeat"),n.value.fillRect(0,0,1e3,550)}}n.value.lineWidth=a.componentSchema.componentProps.lineWidth||4,a.componentSchema&&a.componentSchema.componentProps&&a.componentSchema.componentProps.style&&a.componentSchema.componentProps.style.color&&(n.value.strokeStyle=a.componentSchema.componentProps.style.color),_.value=l.value.getBoundingClientRect()}}const i=t.ref(""),p=t.ref(""),k=t.ref(""),T=t.ref(""),u=t.ref([]),v=t.ref(!1);function C(o){if(c.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled)return;o=o||event,o.preventDefault();let e={x:o.offsetX,y:o.offsetY};i.value=e.x,p.value=e.y,n.value.beginPath(),n.value.moveTo(e.x,e.y),n.value.lineTo(e.x,e.y),n.value.stroke(),n.value.closePath(),u.value.push(e),v.value=!0}function N(o){if(!(c.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled)&&(o=o||event,o.preventDefault(),v.value)){let e={x:o.offsetX,y:o.offsetY};k.value=e.x,T.value=e.y,n.value.beginPath(),n.value.moveTo(i.value,p.value),n.value.lineTo(e.x,e.y),n.value.stroke(),n.value.closePath(),i.value=e.x,p.value=e.y,u.value.push(e)}}function D(o){if(c.value||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled)return;o=o||event,o.preventDefault();let e={x:o.offsetX,y:o.offsetY};n.value.beginPath(),n.value.moveTo(i.value,p.value),n.value.lineTo(e.x,e.y),n.value.stroke(),n.value.closePath(),u.value.push(e),u.value.push({x:-1,y:-1}),v.value=!1}function g(){n.value.clearRect(0,0,l.value.width,l.value.height),u.value=[]}async function f(){let o=await j(l.value.toDataURL("image/png"));w("update:modelValue",o)}async function j(o){let e=atob(o.split(",")[1]),r=new ArrayBuffer(e.length),B=new Uint8Array(r);for(let m=0;m<e.length;m++)B[m]=e.charCodeAt(m);let M=new Blob([r],{type:"image/png"}),b=new FormData;return b.append("file",M,Date.now()+"png"),(await h.axios({method:"post",url:"https://ess-ds.com/prod-api/center-file/file/upload",data:b,headers:{"Content-Type":"multipart/form-data",Authorization:"Bearer "+h.api.get("Admin-Token")}})).data.data.url}return t.onMounted(()=>{d(),V.observe(s.value)}),t.onUnmounted(()=>{}),P({surewrite:f}),(o,e)=>(t.openBlock(),t.createElementBlock("div",{class:"sign",style:t.normalizeStyle({height:a.componentSchema.componentProps.style.height,width:a.componentSchema.componentProps.style.width||"100%"})},[t.createElementVNode("div",{class:"canvas",ref_key:"canvasWrap",ref:s},[t.createElementVNode("canvas",{ref_key:"canvas",ref:l,onMousedown:C,onMousemove:N,onMouseup:D},null,544)],512),t.createElementVNode("div",z,[e[2]||(e[2]=t.createElementVNode("div",{class:"remark"},null,-1)),t.createElementVNode("div",A,[t.createVNode(t.unref(y),{disabled:t.unref(c)||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled,type:"info",size:"mini",onClick:g,onTouch:g},{default:t.withCtx(()=>e[0]||(e[0]=[t.createTextVNode("重写")])),_:1},8,["disabled"]),t.createVNode(t.unref(y),{disabled:t.unref(c)||a.componentSchema.componentProps.readonly||a.componentSchema.componentProps.disabled,type:"primary",size:"mini",onClick:f,onTouch:f},{default:t.withCtx(()=>e[1]||(e[1]=[t.createTextVNode("确定")])),_:1},8,["disabled"])])])],4))}},O=W._export_sfc(E,[["__scopeId","data-v-ee5237db"]]);exports.default=O;