asai-vue-host-form 0.2.14 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # asai-vue-host-form — 动态表单渲染插件
2
+
3
+ ## 包信息
4
+
5
+ | 建议 npm 名 | 入口文件 | $fn / 注入键 | 类型 |
6
+ |------------|---------|-------------|------|
7
+ | `@estun/asai-vue-host-form` | `src/components/index.ts` | —(全局组件) | Host |
8
+
9
+ ## 概述
10
+
11
+ `asai-vue-host-form` 是**动态表单渲染引擎**,根据 JSON 配置递归生成表单,支持输入、只读展示、JSON 编辑、图片上传裁剪与字段规则控制。
12
+
13
+ ## 集成方式
14
+
15
+ ```typescript
16
+ // monorepo — webclient/src/utils/index.ts
17
+ import AsaiVueHostForm from '../plugs/asai-vue-host-form/src/components/index';
18
+ // import '/node_modules/asai-vue-host-form/dist/asai-vue-host-form.css';
19
+ // npm
20
+ // import AsaiVueHostForm from '@estun/asai-vue-host-form';
21
+
22
+ app.use(AsaiVueHostForm, lib);
23
+ ```
24
+
25
+ ```vue
26
+ <AsaiFormLi :ujt="ujt" :asaidata="formConfig" :formdata="formData" :opt="{ isedit: true }" />
27
+ ```
28
+
29
+ ## 独立性约束
30
+
31
+ - **禁止** cross-import 其它 `plugs/*`。
32
+ - 图片裁剪弹窗通过 `$global.pop` 与 PopBox **运行时**集成,不 import `asai-vue-host-popbox`。
33
+
34
+ ## 主要 API / 导出
35
+
36
+ | 组件 | 说明 |
37
+ |------|------|
38
+ | `AsaiFormLi` | 表单列表递归渲染器 |
39
+ | `AsaiFormLabel` / `AsaiFormLabelArea` | 标签与区域 |
40
+ | `AsaiFormShow` | 只读展示 |
41
+ | `AsaiTextarea` / `AsaiTextJson` | 多行 / JSON 编辑 |
42
+ | `AsaiUploadImgCut` / `AsaiUploadImgCutPop` | 图片裁剪与弹窗 |
43
+
44
+ ## 性能说明
45
+
46
+ - 全局组件 **lazy** 加载(`loadvue` eager: false),首次使用表单时才拉 chunk。
47
+ - 递归渲染大对象时注意字段数量;自定义组件通过 `cmComp(key)` 按需注入。
48
+
49
+ ## peerDependencies 建议
50
+
51
+ ```json
52
+ {
53
+ "peerDependencies": {
54
+ "vue": "^3.4.0",
55
+ "@estun/asai-vue-host": "^1.0.0",
56
+ "@estun/asai-vue-host-popbox": "^1.0.0"
57
+ }
58
+ }
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 核心组件
64
+
65
+ ### AsaiFormLi
66
+
67
+ | Props | 说明 |
68
+ |-------|------|
69
+ | `ujt` | 全局上下文 |
70
+ | `asaidata` | 表单配置(rule、lang) |
71
+ | `formdata` | 表单数据(双向) |
72
+ | `opt.isedit` | 编辑 / 添加模式 |
73
+
74
+ **渲染逻辑:**
75
+
76
+ 1. `noedit`/`noadd` == 2 → 只读(AsaiFormShow)
77
+ 2. 值为对象 → 递归;基本类型 → AsaiInput
78
+ 3. `noadd`/`noedit` == 1 → 隐藏
79
+
80
+ ### asaidata 配置
81
+
82
+ | 参数 | 说明 |
83
+ |------|------|
84
+ | `rule[key].noedit/noadd` | 0=正常, 1=隐藏, 2=只读 |
85
+ | `rule[key].require` | 必填 |
86
+ | `rule[key].type` | text/number 等 |
87
+ | `lang[key]` | 字段标签 |
88
+ | `cmComp(key)` | 自定义组件钩子 |
89
+
90
+ ## 文件结构
91
+
92
+ ```
93
+ asai-vue-host-form/
94
+ ├── src/components/asui/form/
95
+ │ ├── AsaiFormLi.vue / AsaiFormShow.vue
96
+ │ └── AsaiUploadImgCut*.vue
97
+ └── README.md
98
+ ```
@@ -8,7 +8,7 @@ const A = { class: "as-form-area" }, f = /* @__PURE__ */ p({
8
8
  },
9
9
  setup(e) {
10
10
  const a = e, { $fn: s } = a.ujt, { get: r, clear: m } = s.createComponentLoader({
11
- files: /* @__PURE__ */ Object.assign({ "./AsaiFormLabel.vue": () => import("./AsaiFormLabel-BAXvUybW.mjs"), "./AsaiFormLabelArea.vue": () => import("./AsaiFormLabelArea-CmjCZFfF.mjs"), "./AsaiFormLi.vue": () => import("./AsaiFormLi-B-Po6qaB.mjs"), "./AsaiFormObject.vue": () => import("./AsaiFormObject-B8WHlNwq.mjs"), "./AsaiFormShow.vue": () => import("./AsaiFormShow-Da4NJXK7.mjs"), "./AsaiInput.vue": () => import("./AsaiInput-DahcJZqh.mjs"), "./AsaiRichEditor.vue": () => import("./AsaiRichEditor-DDOCr12f.mjs"), "./AsaiSelect.vue": () => import("./AsaiSelect-B4KZbNRO.mjs"), "./AsaiSelectCl.vue": () => import("./AsaiSelectCl-DY_5Y--8.mjs"), "./AsaiSelectLv.vue": () => import("./AsaiSelectLv-DNjfTp67.mjs"), "./AsaiTextJson.vue": () => import("./AsaiTextJson-Dr7yX0_I.mjs"), "./AsaiTextarea.vue": () => import("./AsaiTextarea-O38xA-tq.mjs"), "./AsaiUpBinary.vue": () => import("./AsaiUpBinary-DFmYr2_2.mjs"), "./AsaiUpload.vue": () => import("./AsaiUpload-D4kzZ5_G.mjs"), "./AsaiUploadImg.vue": () => import("./AsaiUploadImg-D8mMVNdc.mjs"), "./AsaiUploadImgCut.vue": () => import("./AsaiUploadImgCut-B3Y2hppn.mjs"), "./AsaiUploadImgCutPop.vue": () => import("./AsaiUploadImgCutPop-0gVLGw9m.mjs") }),
11
+ files: /* @__PURE__ */ Object.assign({ "./AsaiFormLabel.vue": () => import("./AsaiFormLabel-BAXvUybW.mjs"), "./AsaiFormLabelArea.vue": () => import("./AsaiFormLabelArea-CmjCZFfF.mjs"), "./AsaiFormLi.vue": () => import("./AsaiFormLi-B-Po6qaB.mjs"), "./AsaiFormObject.vue": () => import("./AsaiFormObject-B8WHlNwq.mjs"), "./AsaiFormShow.vue": () => import("./AsaiFormShow-Da4NJXK7.mjs"), "./AsaiInput.vue": () => import("./AsaiInput-D4BZoHDc.mjs"), "./AsaiRichEditor.vue": () => import("./AsaiRichEditor-H9WK-q7h.mjs"), "./AsaiRichEditorToolbar.vue": () => import("./AsaiRichEditorToolbar-BleVnkxV.mjs"), "./AsaiSelect.vue": () => import("./AsaiSelect-B4KZbNRO.mjs"), "./AsaiSelectCl.vue": () => import("./AsaiSelectCl-Cl6N0v40.mjs"), "./AsaiSelectLv.vue": () => import("./AsaiSelectLv-DNjfTp67.mjs"), "./AsaiTextJson.vue": () => import("./AsaiTextJson-Dr7yX0_I.mjs"), "./AsaiTextarea.vue": () => import("./AsaiTextarea-O38xA-tq.mjs"), "./AsaiUpBinary.vue": () => import("./AsaiUpBinary-CBV4sACD.mjs"), "./AsaiUpload.vue": () => import("./AsaiUpload-BQTw42KS.mjs"), "./AsaiUploadImg.vue": () => import("./AsaiUploadImg-CSQXvm8H.mjs"), "./AsaiUploadImgCut.vue": () => import("./AsaiUploadImgCut-DTWuaOl8.mjs"), "./AsaiUploadImgCutPop.vue": () => import("./AsaiUploadImgCutPop-0gVLGw9m.mjs") }),
12
12
  // 扫描当前目录下所有.vue文件
13
13
  eager: !1,
14
14
  // 异步加载(按需加载)
@@ -8,9 +8,7 @@ const V = /* @__PURE__ */ s({
8
8
  formkey: {}
9
9
  },
10
10
  setup(a) {
11
- const t = a, { $fn: e } = t.ujt, l = c(() => e.As.toArr(t.asaidata?.lang?.[t.formkey + "data"]) || e.As.toArr(
12
- t.asaidata?.rule?.[t.formkey]?.[t.formkey + "data"]
13
- ) || e.As.toArr(e.lg(t.asaidata?.rule?.[t.formkey]?.data)) || []);
11
+ const t = a, { $fn: e } = t.ujt, l = c(() => e.As.toArr(t.asaidata?.lang?.[t.formkey + "data"]) || e.As.toArr(t.asaidata?.rule?.[t.formkey]?.[t.formkey + "data"]) || e.As.toArr(e.lg(t.asaidata?.rule?.[t.formkey]?.data)) || []);
14
12
  return (j, o) => {
15
13
  const y = f("AsfCheck"), i = f("AsfInput"), k = f("AsaiFormLabel");
16
14
  return d(), r(k, {
@@ -0,0 +1,125 @@
1
+ import { defineComponent as H, defineAsyncComponent as U, ref as m, onMounted as j, onBeforeUnmount as z, createElementBlock as y, openBlock as v, normalizeStyle as g, createVNode as B, createElementVNode as x, unref as w, createCommentVNode as _, withDirectives as N, vModelText as F, nextTick as T } from "vue";
2
+ import { _ as S } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ const W = { class: "as-richtext-content" }, O = ["placeholder"], P = /* @__PURE__ */ H({
4
+ __name: "AsaiRichEditor",
5
+ props: {
6
+ ujt: {},
7
+ asaidata: {},
8
+ formdata: {},
9
+ formkey: {}
10
+ },
11
+ setup(E) {
12
+ const C = U({
13
+ loader: () => import("./AsaiRichEditorToolbar-BleVnkxV.mjs"),
14
+ delay: 120
15
+ }), t = E, { $global: L } = t.ujt, u = {
16
+ img: { maxWidth: 288, quality: 0.8 },
17
+ imgurls: {}
18
+ }, p = m(null), o = m(null), M = m(null), r = m(t.asaidata?.rule?.[t.formkey]?.editorty || 0);
19
+ let d = null, h = null, c = null;
20
+ async function s() {
21
+ return d || (h || (h = import("./useRichEditorMedia-BOIU0Dbf.mjs").then((a) => (d = a.createRichEditorMedia(u), d))), h);
22
+ }
23
+ j(() => {
24
+ k(), s();
25
+ }), z(() => {
26
+ c && clearTimeout(c);
27
+ });
28
+ function k() {
29
+ o.value && (o.value.innerHTML = t.formdata[t.formkey]);
30
+ }
31
+ function R() {
32
+ const a = window.prompt("请输入链接地址");
33
+ a && f("createLink", { target: { value: a } });
34
+ }
35
+ function b(a) {
36
+ p.value.accept = `${a}/*`, T(() => p.value?.click());
37
+ }
38
+ async function D(a) {
39
+ const e = a.target.files?.[0];
40
+ if (!e) return;
41
+ const n = await s();
42
+ let i, l = "";
43
+ e.type.startsWith("image") ? (i = await n.compressFile(e), l = `<img src="${i}" style="max-width:100%">`) : (e.size > 1024 * 1024 ? i = URL.createObjectURL(e) : i = await n.compressFile(e), l = e.type.startsWith("video") ? `<video controls src="${i}" style="max-width:100%"></video>` : `<a href="${i}" download="${e.name}">${e.name}</a>`), f("insertHTML", { target: { value: l } });
44
+ }
45
+ async function V() {
46
+ const a = await s(), e = Object.keys(u.imgurls);
47
+ for (let n = 0; n < e.length; n++) {
48
+ const i = e[n];
49
+ u.imgurls[i] === "1" && a.compressImage(i).then((l) => {
50
+ u.imgurls[i] = l, t.formdata[t.formkey] = t.formdata[t.formkey].replaceAll(i, l);
51
+ });
52
+ }
53
+ }
54
+ async function $(a) {
55
+ a.preventDefault();
56
+ const e = await s(), n = a.clipboardData?.getData("text/html") || "", i = e.sanitize(n, 1) || a.clipboardData?.getData("text/plain") || "";
57
+ f("insertHTML", { target: { value: i } });
58
+ }
59
+ function A() {
60
+ if (!o.value) return;
61
+ const a = o.value.innerHTML;
62
+ t.formdata[t.formkey] = a, c && clearTimeout(c), c = setTimeout(() => {
63
+ s().then((e) => {
64
+ o.value && (t.formdata[t.formkey] = e.sanitize(o.value.innerHTML));
65
+ });
66
+ }, 300);
67
+ }
68
+ function f(a, e = null) {
69
+ if (o.value) {
70
+ if (e?.target?.tagName === "SELECT" && e?.target?.value) {
71
+ document.execCommand(a, !1, e.target.value);
72
+ return;
73
+ }
74
+ document.execCommand(a, !1, e?.target?.value);
75
+ }
76
+ }
77
+ function I() {
78
+ r.value++, r.value > 2 && (r.value = 0), T(k);
79
+ }
80
+ return (a, e) => (v(), y("div", {
81
+ class: "as-richtext-area",
82
+ style: g(t.asaidata.rule?.[t.formkey]?.style || {})
83
+ }, [
84
+ B(w(C), {
85
+ lang: w(L).lang.richtexteditor,
86
+ onExec: f,
87
+ onMedia: b,
88
+ onLink: R,
89
+ onUploadImg: V,
90
+ onChangeView: I
91
+ }, null, 8, ["lang"]),
92
+ x("div", W, [
93
+ r.value != 1 ? (v(), y("div", {
94
+ key: 0,
95
+ style: g({ width: r.value > 1 ? "50%" : "100%" }),
96
+ ref_key: "rfRichEditor",
97
+ ref: o,
98
+ contenteditable: "true",
99
+ onPaste: $,
100
+ onInput: A
101
+ }, null, 36)) : _("", !0),
102
+ r.value > 0 ? N((v(), y("textarea", {
103
+ key: 1,
104
+ placeholder: t?.opt?.placeholder || "",
105
+ ref_key: "rfRichCode",
106
+ ref: M,
107
+ "onUpdate:modelValue": e[0] || (e[0] = (n) => t.formdata[t.formkey] = n),
108
+ style: g({ width: r.value > 1 ? "50%" : "100%" })
109
+ }, null, 12, O)), [
110
+ [F, t.formdata[t.formkey]]
111
+ ]) : _("", !0)
112
+ ]),
113
+ x("input", {
114
+ ref_key: "fileInput",
115
+ ref: p,
116
+ type: "file",
117
+ hidden: "",
118
+ onChange: D
119
+ }, null, 544)
120
+ ], 4));
121
+ }
122
+ }), J = /* @__PURE__ */ S(P, [["__scopeId", "data-v-5c6cb195"]]);
123
+ export {
124
+ J as default
125
+ };
@@ -0,0 +1,135 @@
1
+ import { defineComponent as k, createElementBlock as u, openBlock as s, createElementVNode as n, toDisplayString as l, Fragment as r, renderList as b } from "vue";
2
+ import { _ as v } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
+ const y = { class: "as-richtext-toolbar" }, C = { value: "" }, g = ["value"], p = { value: "p" }, x = ["value"], m = ["title"], f = ["title"], $ = ["title"], a = ["title"], L = ["title"], I = ["title"], j = ["title"], B = ["title"], E = /* @__PURE__ */ k({
4
+ __name: "AsaiRichEditorToolbar",
5
+ props: {
6
+ lang: {}
7
+ },
8
+ emits: ["exec", "media", "link", "uploadImg", "changeView"],
9
+ setup(i, { emit: d }) {
10
+ const o = d;
11
+ return (z, t) => (s(), u("div", y, [
12
+ n("select", {
13
+ onChange: t[0] || (t[0] = (e) => o("exec", "fontSize", e))
14
+ }, [
15
+ n("option", C, l(i.lang.fontsize), 1),
16
+ (s(), u(r, null, b(7, (e) => n("option", {
17
+ key: "size" + e,
18
+ value: e + 1
19
+ }, l((e + 1) * 2 + 6) + "px", 9, g)), 64))
20
+ ], 32),
21
+ n("select", {
22
+ onChange: t[1] || (t[1] = (e) => o("exec", "formatBlock", e))
23
+ }, [
24
+ n("option", p, l(i.lang.paragraph), 1),
25
+ (s(), u(r, null, b(6, (e) => n("option", {
26
+ key: "h" + e,
27
+ value: "h" + e
28
+ }, l(i.lang.title) + l(e), 9, x)), 64))
29
+ ], 32),
30
+ n("button", {
31
+ type: "button",
32
+ onClick: t[2] || (t[2] = (e) => o("exec", "bold")),
33
+ title: i.lang.bold
34
+ }, "B", 8, m),
35
+ n("button", {
36
+ type: "button",
37
+ onClick: t[3] || (t[3] = (e) => o("exec", "underline")),
38
+ title: i.lang.underline
39
+ }, "U", 8, f),
40
+ n("button", {
41
+ type: "button",
42
+ onClick: t[4] || (t[4] = (e) => o("exec", "italic")),
43
+ title: i.lang.italic
44
+ }, "I", 8, $),
45
+ n("button", {
46
+ type: "button",
47
+ onClick: t[5] || (t[5] = (e) => o("exec", "strikethrough")),
48
+ title: i.lang.strikethrough
49
+ }, "S", 8, a),
50
+ n("input", {
51
+ type: "color",
52
+ onInput: t[6] || (t[6] = (e) => o("exec", "foreColor", e)),
53
+ title: i.lang.foreColor
54
+ }, null, 40, L),
55
+ n("input", {
56
+ type: "color",
57
+ onInput: t[7] || (t[7] = (e) => o("exec", "backColor", e)),
58
+ title: i.lang.backColor
59
+ }, null, 40, I),
60
+ n("button", {
61
+ type: "button",
62
+ onClick: t[8] || (t[8] = (e) => o("exec", "insertOrderedList")),
63
+ title: i.lang.insertOrderedList
64
+ }, "有", 8, j),
65
+ n("button", {
66
+ type: "button",
67
+ onClick: t[9] || (t[9] = (e) => o("exec", "insertUnorderedList")),
68
+ title: i.lang.insertUnorderedList
69
+ }, "无", 8, B),
70
+ n("button", {
71
+ type: "button",
72
+ onClick: t[10] || (t[10] = (e) => o("exec", "justifyCenter")),
73
+ title: "居中"
74
+ }, "中"),
75
+ n("button", {
76
+ type: "button",
77
+ onClick: t[11] || (t[11] = (e) => o("exec", "justifyFull")),
78
+ title: "两端对齐"
79
+ }, "两"),
80
+ n("button", {
81
+ type: "button",
82
+ onClick: t[12] || (t[12] = (e) => o("exec", "justifyRight")),
83
+ title: "右对齐"
84
+ }, "右"),
85
+ n("button", {
86
+ type: "button",
87
+ onClick: t[13] || (t[13] = (e) => o("exec", "justifyLeft")),
88
+ title: "左对齐"
89
+ }, "左"),
90
+ n("button", {
91
+ type: "button",
92
+ onClick: t[14] || (t[14] = (e) => o("exec", "delete")),
93
+ title: "删除"
94
+ }, "删"),
95
+ n("button", {
96
+ type: "button",
97
+ onClick: t[15] || (t[15] = (e) => o("link")),
98
+ title: "链接"
99
+ }, "链"),
100
+ n("button", {
101
+ type: "button",
102
+ onClick: t[16] || (t[16] = (e) => o("exec", "unlink")),
103
+ title: "删除链接"
104
+ }, "除"),
105
+ n("button", {
106
+ type: "button",
107
+ onClick: t[17] || (t[17] = (e) => o("media", "image")),
108
+ title: "图片"
109
+ }, "🖼️"),
110
+ n("button", {
111
+ type: "button",
112
+ onClick: t[18] || (t[18] = (e) => o("media", "video")),
113
+ title: "视频"
114
+ }, "🎬"),
115
+ n("button", {
116
+ type: "button",
117
+ onClick: t[19] || (t[19] = (e) => o("media", "file")),
118
+ title: "文件"
119
+ }, "📎"),
120
+ n("button", {
121
+ type: "button",
122
+ onClick: t[20] || (t[20] = (e) => o("uploadImg")),
123
+ title: "上传"
124
+ }, "上"),
125
+ n("button", {
126
+ type: "button",
127
+ onClick: t[21] || (t[21] = (e) => o("changeView")),
128
+ title: "切换"
129
+ }, "HTML")
130
+ ]));
131
+ }
132
+ }), T = /* @__PURE__ */ v(E, [["__scopeId", "data-v-bf97b430"]]);
133
+ export {
134
+ T as default
135
+ };
@@ -0,0 +1,41 @@
1
+ import { defineComponent as n, computed as i, resolveComponent as m, createBlock as u, openBlock as c, withCtx as k, createVNode as y } from "vue";
2
+ const j = /* @__PURE__ */ n({
3
+ __name: "AsaiSelectCl",
4
+ props: {
5
+ ujt: {},
6
+ asaidata: {},
7
+ formdata: {},
8
+ formkey: {}
9
+ },
10
+ setup(e) {
11
+ const a = e, { $fn: r } = a.ujt, f = i(() => {
12
+ let o;
13
+ return a.asaidata?.rule?.[a.formkey]?.[a.formkey + "data"]?.nodeMap?.size > 0 ? o = [...a.asaidata.rule[a.formkey][a.formkey + "data"].nodeMap].map((t) => [t[1].id, t[1].nm, a.asaidata.rule[a.formkey][a.formkey + "data"].depthMap.get(t[0])]).filter((t) => t && t[0] !== "asai") : o = (r.As.toArr(a.asaidata?.lang?.[a.formkey + "data"]) || r.As.toArr(r.lg(a.asaidata?.rule?.[a.formkey]?.data)) || []).filter((t) => t && t[0] !== "asai"), (!a.formdata[a.formkey] || a.formdata[a.formkey] === "asai") && (a.formdata[a.formkey] = o?.[0]?.[0] || "asai"), o;
14
+ });
15
+ return (o, t) => {
16
+ const d = m("AsfSelect"), l = m("AsaiFormLabel");
17
+ return c(), u(l, {
18
+ ujt: e.ujt,
19
+ asaidata: e.asaidata,
20
+ formdata: e.formdata,
21
+ formkey: e.formkey
22
+ }, {
23
+ default: k(() => [
24
+ y(d, {
25
+ ujt: e.ujt,
26
+ opt: {
27
+ ...a.asaidata.rule?.[e.formkey]?.opt || {},
28
+ selectdata: f.value
29
+ },
30
+ modelValue: a.formdata[e.formkey],
31
+ "onUpdate:modelValue": t[0] || (t[0] = (s) => a.formdata[e.formkey] = s)
32
+ }, null, 8, ["ujt", "opt", "modelValue"])
33
+ ]),
34
+ _: 1
35
+ }, 8, ["ujt", "asaidata", "formdata", "formkey"]);
36
+ };
37
+ }
38
+ });
39
+ export {
40
+ j as default
41
+ };
@@ -81,7 +81,7 @@ const b = ["accept"], j = { key: 0 }, x = ["src", "alt", "title"], I = ["title"]
81
81
  }, 8, ["ujt", "asaidata", "formdata", "formkey"]);
82
82
  };
83
83
  }
84
- }), z = /* @__PURE__ */ U($, [["__scopeId", "data-v-535f25e7"]]);
84
+ }), z = /* @__PURE__ */ U($, [["__scopeId", "data-v-e9910494"]]);
85
85
  export {
86
86
  z as default
87
87
  };
@@ -90,7 +90,7 @@ const w = { key: 0 }, x = ["src", "alt", "title"], B = ["title"], I = ["title"],
90
90
  }, 8, ["ujt", "asaidata", "formdata", "formkey"]);
91
91
  };
92
92
  }
93
- }), P = /* @__PURE__ */ U(L, [["__scopeId", "data-v-a305b28a"]]);
93
+ }), P = /* @__PURE__ */ U(L, [["__scopeId", "data-v-50ddd40b"]]);
94
94
  export {
95
95
  P as default
96
96
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as j, ref as u, onMounted as F, resolveComponent as y, createElementBlock as m, openBlock as p, Fragment as A, createVNode as k, withCtx as C, createElementVNode as c, withModifiers as I, normalizeClass as U, toDisplayString as _ } from "vue";
1
+ import { defineComponent as j, ref as f, onMounted as F, resolveComponent as y, createElementBlock as m, openBlock as p, Fragment as A, createVNode as k, withCtx as C, createElementVNode as c, withModifiers as I, normalizeClass as U, toDisplayString as _ } from "vue";
2
2
  import { _ as b } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
3
  const w = { key: 0 }, x = ["src"], L = ["title"], D = /* @__PURE__ */ j({
4
4
  __name: "AsaiUploadImg",
@@ -9,14 +9,14 @@ const w = { key: 0 }, x = ["src"], L = ["title"], D = /* @__PURE__ */ j({
9
9
  formkey: {}
10
10
  },
11
11
  setup(e) {
12
- const a = e, { $fn: d, $global: o } = a.ujt, r = u(null), f = u(null), n = u("+");
12
+ const a = e, { $fn: d, $global: o } = a.ujt, r = f(null), u = f(null), n = f("+");
13
13
  F(() => {
14
14
  const l = "popupload" + a.formkey;
15
15
  o.pop[l] || (o.pop[l] = { stat: 0, full: 0, tit: "", params: {} });
16
16
  });
17
17
  const v = async (l) => {
18
18
  if (r.value.value) {
19
- if (f.value = l.target.files[0], r.value.value = "", !f.value) {
19
+ if (u.value = l.target.files[0], r.value.value = "", !u.value) {
20
20
  n.value = d.lg("asai.fail");
21
21
  return;
22
22
  }
@@ -37,7 +37,7 @@ const w = { key: 0 }, x = ["src"], L = ["title"], D = /* @__PURE__ */ j({
37
37
  } catch (s) {
38
38
  n.value = d.lg("asai.fail") + " " + s.message;
39
39
  }
40
- }, t.readAsDataURL(f.value);
40
+ }, t.readAsDataURL(u.value);
41
41
  }
42
42
  };
43
43
  function g() {
@@ -89,7 +89,7 @@ const w = { key: 0 }, x = ["src"], L = ["title"], D = /* @__PURE__ */ j({
89
89
  ], 64);
90
90
  };
91
91
  }
92
- }), B = /* @__PURE__ */ b(D, [["__scopeId", "data-v-0bfdd149"]]);
92
+ }), B = /* @__PURE__ */ b(D, [["__scopeId", "data-v-36b7ec3b"]]);
93
93
  export {
94
94
  B as default
95
95
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as B, ref as x, computed as Y, createElementBlock as M, openBlock as f, createElementVNode as h, withDirectives as S, withModifiers as d, normalizeStyle as D, vShow as U, Fragment as j, nextTick as A } from "vue";
1
+ import { defineComponent as B, ref as x, computed as Y, createElementBlock as M, openBlock as f, createElementVNode as h, withDirectives as S, withModifiers as c, normalizeStyle as D, vShow as U, Fragment as j, nextTick as A } from "vue";
2
2
  import { _ as R } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
3
3
  const F = { class: "as-img-area" }, O = {
4
4
  key: 0,
@@ -13,7 +13,7 @@ const F = { class: "as-img-area" }, O = {
13
13
  params: {}
14
14
  },
15
15
  setup(E) {
16
- const g = E, w = x(""), b = x(null), I = x(null), X = x(null), m = g.params.min || 1, i = x({
16
+ const g = E, w = x(""), k = x(null), I = x(null), X = x(null), m = g.params.min || 1, i = x({
17
17
  x: 0,
18
18
  y: 0,
19
19
  width: 0,
@@ -36,7 +36,7 @@ const F = { class: "as-img-area" }, O = {
36
36
  })), z = Y(
37
37
  () => i.value.width > 0 && i.value.height > 0
38
38
  ), L = () => {
39
- const n = b.value, t = X.value;
39
+ const n = k.value, t = X.value;
40
40
  if (!n || !t) {
41
41
  console.error("Image or container element not found.");
42
42
  return;
@@ -77,22 +77,22 @@ const F = { class: "as-img-area" }, O = {
77
77
  e.value.originalX + o,
78
78
  i.value.maxWidth - i.value.width
79
79
  )
80
- ), c = Math.max(
80
+ ), d = Math.max(
81
81
  0,
82
82
  Math.min(
83
83
  e.value.originalY + s,
84
84
  i.value.maxHeight - i.value.height
85
85
  )
86
86
  );
87
- Object.assign(i.value, { x: r, y: c });
87
+ Object.assign(i.value, { x: r, y: d });
88
88
  }, W = (n) => {
89
89
  const t = window.event || n, a = t.touches ? t.touches[0] : t;
90
90
  if (e.value.type !== "resize") return;
91
91
  const o = a.clientX - e.value.startX, s = a.clientY - e.value.startY, r = e.value.direction;
92
- let c = e.value.originalWidth, l = e.value.originalHeight, u = e.value.originalX, p = e.value.originalY;
92
+ let d = e.value.originalWidth, l = e.value.originalHeight, u = e.value.originalX, p = e.value.originalY;
93
93
  switch (r) {
94
94
  case "tr":
95
- c = Math.max(
95
+ d = Math.max(
96
96
  m,
97
97
  Math.min(
98
98
  e.value.originalWidth + o,
@@ -101,25 +101,25 @@ const F = { class: "as-img-area" }, O = {
101
101
  ), l = Math.max(m, e.value.originalHeight - s), p = Math.max(0, e.value.originalY + s);
102
102
  break;
103
103
  case "tl":
104
- c = Math.max(m, e.value.originalWidth - o), l = Math.max(m, e.value.originalHeight - s), u = Math.max(0, e.value.originalX + o), p = Math.max(0, e.value.originalY + s);
104
+ d = Math.max(m, e.value.originalWidth - o), l = Math.max(m, e.value.originalHeight - s), u = Math.max(0, e.value.originalX + o), p = Math.max(0, e.value.originalY + s);
105
105
  break;
106
106
  case "br":
107
- c = Math.max(m, e.value.originalWidth + o), l = Math.max(m, e.value.originalHeight + s);
107
+ d = Math.max(m, e.value.originalWidth + o), l = Math.max(m, e.value.originalHeight + s);
108
108
  break;
109
109
  case "bl":
110
- c = Math.max(m, e.value.originalWidth - o), l = Math.max(m, e.value.originalHeight + s), u = Math.max(0, e.value.originalX + o);
110
+ d = Math.max(m, e.value.originalWidth - o), l = Math.max(m, e.value.originalHeight + s), u = Math.max(0, e.value.originalX + o);
111
111
  break;
112
112
  }
113
- c = Math.min(c, i.value.maxWidth - u), l = Math.min(l, i.value.maxHeight - p), Object.assign(i.value, {
113
+ d = Math.min(d, i.value.maxWidth - u), l = Math.min(l, i.value.maxHeight - p), Object.assign(i.value, {
114
114
  x: u,
115
115
  y: p,
116
- width: c,
116
+ width: d,
117
117
  height: l
118
118
  });
119
119
  }, y = () => {
120
120
  e.value.type = null, window.removeEventListener("mousemove", H), window.removeEventListener("touchmove", H), window.removeEventListener("mousemove", W), window.removeEventListener("touchmove", W), window.removeEventListener("mouseup", y), window.removeEventListener("touchend", y);
121
121
  }, C = () => {
122
- const n = b.value, t = n.naturalWidth / n.width, a = n.naturalHeight / n.height, o = Math.min(
122
+ const n = k.value, t = n.naturalWidth / n.width, a = n.naturalHeight / n.height, o = Math.min(
123
123
  i.value.width * t,
124
124
  n.naturalWidth
125
125
  ), s = Math.min(
@@ -140,8 +140,8 @@ const F = { class: "as-img-area" }, O = {
140
140
  let l = g.params.asaidata.rule[g.params.formkey].data, u = {};
141
141
  if (l.width < o || l.height < s) {
142
142
  l.height / s > l.width / o ? (u.width = l.width, u.height = s * l.width / o) : (u.width = o * l.height / s, u.height = l.height);
143
- const p = I.value, k = document.createElement("canvas");
144
- k.width = u.width, k.height = u.height, k.getContext("2d").drawImage(p, 0, 0, u.width, u.height), w.value = k.toDataURL("image/png", 0.9);
143
+ const p = I.value, b = document.createElement("canvas");
144
+ b.width = u.width, b.height = u.height, b.getContext("2d").drawImage(p, 0, 0, u.width, u.height), w.value = b.toDataURL("image/png", 0.9);
145
145
  }
146
146
  });
147
147
  }, T = () => {
@@ -165,35 +165,35 @@ const F = { class: "as-img-area" }, O = {
165
165
  }, [
166
166
  h("img", {
167
167
  ref_key: "previewImage",
168
- ref: b,
168
+ ref: k,
169
169
  src: g.params.base64Data,
170
170
  onLoad: L
171
171
  }, null, 40, P),
172
172
  S(h("div", {
173
173
  class: "as-img-crop-box",
174
174
  style: D($.value),
175
- onMousedown: t[8] || (t[8] = d((a) => v("move"), ["prevent"])),
176
- onTouchstart: t[9] || (t[9] = d((a) => v("move"), ["prevent"]))
175
+ onMousedown: t[8] || (t[8] = c((a) => v("move"), ["prevent"])),
176
+ onTouchstart: t[9] || (t[9] = c((a) => v("move"), ["prevent"]))
177
177
  }, [
178
178
  h("div", {
179
179
  class: "as-img-crop-handle top-left",
180
- onMousedown: t[0] || (t[0] = d((a) => v("resize", "tl"), ["stop"])),
181
- onTouchstart: t[1] || (t[1] = d((a) => v("resize", "tl"), ["stop"]))
180
+ onMousedown: t[0] || (t[0] = c((a) => v("resize", "tl"), ["stop"])),
181
+ onTouchstart: t[1] || (t[1] = c((a) => v("resize", "tl"), ["stop"]))
182
182
  }, null, 32),
183
183
  h("div", {
184
184
  class: "as-img-crop-handle top-right",
185
- onMousedown: t[2] || (t[2] = d((a) => v("resize", "tr"), ["stop"])),
186
- onTouchstart: t[3] || (t[3] = d((a) => v("resize", "tr"), ["stop"]))
185
+ onMousedown: t[2] || (t[2] = c((a) => v("resize", "tr"), ["stop"])),
186
+ onTouchstart: t[3] || (t[3] = c((a) => v("resize", "tr"), ["stop"]))
187
187
  }, null, 32),
188
188
  h("div", {
189
189
  class: "as-img-crop-handle bottom-left",
190
- onMousedown: t[4] || (t[4] = d((a) => v("resize", "bl"), ["stop"])),
191
- onTouchstart: t[5] || (t[5] = d((a) => v("resize", "bl"), ["stop"]))
190
+ onMousedown: t[4] || (t[4] = c((a) => v("resize", "bl"), ["stop"])),
191
+ onTouchstart: t[5] || (t[5] = c((a) => v("resize", "bl"), ["stop"]))
192
192
  }, null, 32),
193
193
  h("div", {
194
194
  class: "as-img-crop-handle bottom-right",
195
- onMousedown: t[6] || (t[6] = d((a) => v("resize", "br"), ["stop"])),
196
- onTouchstart: t[7] || (t[7] = d((a) => v("resize", "br"), ["stop"]))
195
+ onMousedown: t[6] || (t[6] = c((a) => v("resize", "br"), ["stop"])),
196
+ onTouchstart: t[7] || (t[7] = c((a) => v("resize", "br"), ["stop"]))
197
197
  }, null, 32)
198
198
  ], 36), [
199
199
  [U, z.value]
@@ -211,7 +211,7 @@ const F = { class: "as-img-area" }, O = {
211
211
  ])
212
212
  ]));
213
213
  }
214
- }), Z = /* @__PURE__ */ R(G, [["__scopeId", "data-v-24cc1149"]]);
214
+ }), Z = /* @__PURE__ */ R(G, [["__scopeId", "data-v-f328eb1d"]]);
215
215
  export {
216
216
  Z as default
217
217
  };