@duxweb/dvha-pro 1.1.28 → 1.1.29
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/dist/cjs/components/designEditor/components/grid.cjs +1 -1
- package/dist/cjs/components/designEditor/editor/setting.cjs +1 -1
- package/dist/cjs/components/designEditor/editor.cjs +1 -1
- package/dist/cjs/components/formEditor/editor.cjs +1 -1
- package/dist/cjs/langs/en-US.json.cjs +1 -1
- package/dist/cjs/langs/zh-CN.json.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +19 -3
- package/dist/esm/components/designEditor/components/grid.js +41 -40
- package/dist/esm/components/designEditor/editor/setting.js +73 -35
- package/dist/esm/components/designEditor/editor.js +100 -105
- package/dist/esm/components/formEditor/editor.js +78 -48
- package/dist/esm/langs/en-US.json.js +5 -5
- package/dist/esm/langs/zh-CN.json.js +1 -1
- package/dist/esm/theme/uno.css.js +19 -3
- package/dist/types/components/designEditor/editor/hook.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as s, inject as d, computed as n, createVNode as t } from "vue";
|
|
2
|
+
import { useI18n as c } from "@duxweb/dvha-core";
|
|
3
|
+
import l from "clsx";
|
|
4
|
+
import { NScrollbar as u } from "naive-ui";
|
|
2
5
|
import "@vueuse/core";
|
|
3
|
-
import "clsx";
|
|
4
|
-
import "naive-ui";
|
|
5
|
-
import "@duxweb/dvha-core";
|
|
6
6
|
import "vue-echarts";
|
|
7
7
|
import "vue-router";
|
|
8
8
|
import "@overlastic/vue";
|
|
@@ -54,7 +54,7 @@ import "vue-draggable-plus";
|
|
|
54
54
|
import "short-unique-id";
|
|
55
55
|
import "aieditor";
|
|
56
56
|
import "@vue-flow/core";
|
|
57
|
-
import { DuxFormLayout as
|
|
57
|
+
import { DuxFormLayout as g } from "../../form/formLayout.js";
|
|
58
58
|
import "lodash-es/cloneDeep";
|
|
59
59
|
import "@vue-flow/background";
|
|
60
60
|
/* empty css */
|
|
@@ -63,55 +63,93 @@ import "@iconify-json/tabler/icons.json";
|
|
|
63
63
|
import "../../posterEditor/elements/index.js";
|
|
64
64
|
import "fabric";
|
|
65
65
|
import "../../schemaEditor/schemaEditor.js";
|
|
66
|
-
|
|
66
|
+
function a({
|
|
67
|
+
icon: p,
|
|
68
|
+
iconBgClass: o = "bg-primary",
|
|
69
|
+
title: e,
|
|
70
|
+
description: i
|
|
71
|
+
}) {
|
|
72
|
+
return t("div", {
|
|
73
|
+
class: "p-4 border-b border-default"
|
|
74
|
+
}, [t("div", {
|
|
75
|
+
class: "flex gap-2 items-center"
|
|
76
|
+
}, [p && t("div", {
|
|
77
|
+
class: l(["rounded p-2 flex-shrink-0", o])
|
|
78
|
+
}, [t("div", {
|
|
79
|
+
class: l(["size-6 text-white", p])
|
|
80
|
+
}, null)]), t("div", {
|
|
81
|
+
class: "flex-1 min-w-0"
|
|
82
|
+
}, [t("h3", {
|
|
83
|
+
class: "text-base font-medium"
|
|
84
|
+
}, [e]), i && t("p", {
|
|
85
|
+
class: "text-sm text-muted mt-1"
|
|
86
|
+
}, [i])])])]);
|
|
87
|
+
}
|
|
88
|
+
const wt = /* @__PURE__ */ s({
|
|
67
89
|
name: "WidgetEditorSetting",
|
|
68
90
|
props: {
|
|
69
91
|
actionRender: Function
|
|
70
92
|
},
|
|
71
|
-
setup(
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
setup(p) {
|
|
94
|
+
const {
|
|
95
|
+
t: o
|
|
96
|
+
} = c(), e = d("editor.use"), i = n(() => e?.getData(e.selected.value)), r = n(() => e?.components.value?.find((m) => m.name === i.value?.name));
|
|
97
|
+
return () => t("div", {
|
|
98
|
+
class: "h-full w-full flex flex-col",
|
|
75
99
|
key: i.value?.key
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
|
|
100
|
+
}, [!r.value && t(a, {
|
|
101
|
+
icon: "i-tabler:settings",
|
|
102
|
+
iconBgClass: "bg-gray-500",
|
|
103
|
+
title: o("components.designEditor.properties") || "Properties",
|
|
104
|
+
description: o("components.designEditor.selectComponent") || "Select a component to configure"
|
|
105
|
+
}, null), r.value && t(a, {
|
|
106
|
+
icon: r.value.icon,
|
|
107
|
+
iconBgClass: "bg-primary",
|
|
108
|
+
title: r.value.label || r.value.name || o("components.designEditor.component") || "Component",
|
|
109
|
+
description: r.value.description || o("components.designEditor.componentSettings") || "Configure component options"
|
|
110
|
+
}, null), t(u, {
|
|
84
111
|
class: "flex-1 min-h-0"
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
112
|
+
}, {
|
|
113
|
+
default: () => [t("div", {
|
|
114
|
+
class: "p-3 pr-2"
|
|
115
|
+
}, [r.value?.setting?.({
|
|
116
|
+
value: i.value?.options,
|
|
117
|
+
"update:modelValue": (m) => {
|
|
118
|
+
i?.value && (i.value.options = m);
|
|
119
|
+
}
|
|
120
|
+
}) || t("div", {
|
|
121
|
+
class: "flex flex-col gap-3"
|
|
122
|
+
}, [t("div", null, [e?.settingPage?.component?.({
|
|
123
|
+
value: e.value.value.config,
|
|
124
|
+
"update:modelValue": (m) => {
|
|
125
|
+
e.value.value.config = m;
|
|
126
|
+
}
|
|
127
|
+
})]), p?.actionRender?.(e)])])]
|
|
128
|
+
})]);
|
|
91
129
|
}
|
|
92
|
-
}),
|
|
130
|
+
}), Dt = /* @__PURE__ */ s({
|
|
93
131
|
name: "WidgetEditorSettingCard",
|
|
94
132
|
props: {
|
|
95
133
|
title: String,
|
|
96
134
|
icon: String
|
|
97
135
|
},
|
|
98
|
-
setup(
|
|
99
|
-
slots:
|
|
136
|
+
setup(p, {
|
|
137
|
+
slots: o
|
|
100
138
|
}) {
|
|
101
|
-
return () =>
|
|
139
|
+
return () => t("div", {
|
|
102
140
|
class: "flex flex-col"
|
|
103
|
-
}, [
|
|
104
|
-
class: "bg-elevated rounded py-2 px-4 flex justify-center items-center gap-2"
|
|
105
|
-
}, [
|
|
141
|
+
}, [t("div", {
|
|
142
|
+
class: "bg-elevated border border-default rounded-md py-2 px-4 flex justify-center items-center gap-2"
|
|
143
|
+
}, [t("div", null, [p.title])]), t("div", {
|
|
106
144
|
class: "py-4 flex-1"
|
|
107
|
-
}, [
|
|
145
|
+
}, [t(g, {
|
|
108
146
|
labelPlacement: "top"
|
|
109
147
|
}, {
|
|
110
|
-
default: () => [
|
|
148
|
+
default: () => [o.default?.()]
|
|
111
149
|
})])]);
|
|
112
150
|
}
|
|
113
151
|
});
|
|
114
152
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
153
|
+
wt as WidgetEditorSetting,
|
|
154
|
+
Dt as WidgetEditorSettingCard
|
|
117
155
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import
|
|
4
|
-
import { cloneDeep as
|
|
5
|
-
import { NScrollbar as
|
|
6
|
-
import
|
|
7
|
-
import { VueDraggable as
|
|
8
|
-
import { DuxCard as
|
|
1
|
+
import { defineComponent as v, provide as x, watch as i, createVNode as t } from "vue";
|
|
2
|
+
import { useI18n as h } from "@duxweb/dvha-core";
|
|
3
|
+
import d from "clsx";
|
|
4
|
+
import { cloneDeep as s } from "lodash-es";
|
|
5
|
+
import { NScrollbar as w } from "naive-ui";
|
|
6
|
+
import y from "short-unique-id";
|
|
7
|
+
import { VueDraggable as D } from "vue-draggable-plus";
|
|
8
|
+
import { DuxCard as k } from "../card/card.js";
|
|
9
9
|
import "@vueuse/core";
|
|
10
|
-
import { duxFormEditorGrid as
|
|
11
|
-
import { useEditor as
|
|
12
|
-
import { DuxWidgetEditorPreview as
|
|
13
|
-
import { WidgetEditorSetting as
|
|
14
|
-
const
|
|
10
|
+
import { duxFormEditorGrid as E } from "./components/grid.js";
|
|
11
|
+
import { useEditor as C } from "./editor/hook.js";
|
|
12
|
+
import { DuxWidgetEditorPreview as u } from "./editor/preview.js";
|
|
13
|
+
import { WidgetEditorSetting as U } from "./editor/setting.js";
|
|
14
|
+
const O = /* @__PURE__ */ v({
|
|
15
15
|
name: "DuxDesignEditor",
|
|
16
16
|
props: {
|
|
17
17
|
data: Object,
|
|
@@ -22,86 +22,81 @@ const M = /* @__PURE__ */ f({
|
|
|
22
22
|
actionRender: Function,
|
|
23
23
|
previewWrapper: Function
|
|
24
24
|
},
|
|
25
|
-
setup(
|
|
25
|
+
setup(l) {
|
|
26
26
|
const {
|
|
27
27
|
t: o
|
|
28
|
-
} =
|
|
29
|
-
settingPage:
|
|
28
|
+
} = h(), a = C({
|
|
29
|
+
settingPage: l.settingPage
|
|
30
30
|
});
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
x("editor.use", a), i([() => l.components, () => l.groups], () => {
|
|
32
|
+
a.clearGroup(), a.clearComponent(), a.addGroup({
|
|
33
33
|
name: "layout",
|
|
34
34
|
label: o("components.designEditor.layout") || "Layout",
|
|
35
35
|
icon: "i-tabler:layout"
|
|
36
|
-
}),
|
|
37
|
-
|
|
38
|
-
}),
|
|
39
|
-
|
|
36
|
+
}), l.groups?.forEach((e) => {
|
|
37
|
+
a.addGroup(e);
|
|
38
|
+
}), a.addComponent(E(o)), l.components?.forEach((e) => {
|
|
39
|
+
a.addComponent(e);
|
|
40
40
|
});
|
|
41
41
|
}, {
|
|
42
42
|
immediate: !0,
|
|
43
43
|
deep: !0
|
|
44
44
|
});
|
|
45
|
-
const
|
|
46
|
-
randomUUID:
|
|
47
|
-
} = new
|
|
45
|
+
const {
|
|
46
|
+
randomUUID: g
|
|
47
|
+
} = new y({
|
|
48
48
|
length: 10
|
|
49
49
|
}), m = (e) => ({
|
|
50
|
-
key:
|
|
50
|
+
key: g(),
|
|
51
51
|
name: e.name,
|
|
52
|
-
options:
|
|
52
|
+
options: s(e.settingDefault)
|
|
53
53
|
});
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
i(() => l.data, (e) => {
|
|
55
|
+
const r = l.settingPage?.default || {};
|
|
56
|
+
a.value.value = {
|
|
57
57
|
config: {
|
|
58
|
-
...
|
|
59
|
-
...
|
|
58
|
+
...r,
|
|
59
|
+
...s(e?.config || {})
|
|
60
60
|
},
|
|
61
|
-
data:
|
|
61
|
+
data: s(e?.data || [])
|
|
62
62
|
};
|
|
63
63
|
}, {
|
|
64
64
|
deep: !0,
|
|
65
65
|
immediate: !0
|
|
66
|
-
}),
|
|
67
|
-
|
|
66
|
+
}), i(a.value, (e) => {
|
|
67
|
+
l.onUpdateData?.(e);
|
|
68
68
|
}, {
|
|
69
69
|
deep: !0
|
|
70
|
-
})
|
|
70
|
+
});
|
|
71
|
+
const c = ["bg-red-500", "bg-orange-500", "bg-amber-500", "bg-yellow-500", "bg-lime-500", "bg-green-500", "bg-emerald-500", "bg-teal-500", "bg-cyan-500", "bg-sky-500", "bg-blue-500", "bg-indigo-500", "bg-violet-500", "bg-purple-500", "bg-fuchsia-500", "bg-pink-500", "bg-rose-500"];
|
|
72
|
+
return () => t(k, {
|
|
71
73
|
class: "h-full",
|
|
72
74
|
shadow: !0
|
|
73
75
|
}, {
|
|
74
|
-
default: () => [
|
|
75
|
-
class: "h-full
|
|
76
|
-
}, [
|
|
77
|
-
class: "
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
icon: e.icon,
|
|
90
|
-
onClick: () => {
|
|
91
|
-
l.value = e.name;
|
|
92
|
-
}
|
|
93
|
-
}, null))]), a("div", {
|
|
94
|
-
class: "flex-none text-xs w-180px bg-default",
|
|
95
|
-
id: "comp-list"
|
|
96
|
-
}, [a(b, null, {
|
|
97
|
-
default: () => [a("div", {
|
|
98
|
-
class: "flex flex-col gap-4 p-2"
|
|
99
|
-
}, [t.tree.value?.filter((e) => l.value ? e.name === l.value : !0).map((e) => a("div", {
|
|
76
|
+
default: () => [t("div", {
|
|
77
|
+
class: "h-full w-full relative text-default bg-muted rounded-md"
|
|
78
|
+
}, [t("div", {
|
|
79
|
+
class: "absolute top-4 left-4 bottom-4 z-10"
|
|
80
|
+
}, [t("div", {
|
|
81
|
+
class: "h-full w-220px bg-default shadow rounded"
|
|
82
|
+
}, [t("div", {
|
|
83
|
+
class: "h-full flex flex-col"
|
|
84
|
+
}, [t(w, {
|
|
85
|
+
class: "flex-1 min-h-0"
|
|
86
|
+
}, {
|
|
87
|
+
default: () => [t("div", {
|
|
88
|
+
class: "p-4 space-y-4",
|
|
89
|
+
id: "comp-list"
|
|
90
|
+
}, [a.tree.value?.filter((e) => e.children && e.children.length > 0).map((e, r) => t("div", {
|
|
100
91
|
key: e.name,
|
|
101
|
-
class: "
|
|
102
|
-
}, [
|
|
103
|
-
class: "
|
|
104
|
-
}, [
|
|
92
|
+
class: "space-y-2"
|
|
93
|
+
}, [t("div", {
|
|
94
|
+
class: "flex items-center gap-2 text-sm px-1"
|
|
95
|
+
}, [t("div", {
|
|
96
|
+
class: d(["size-4", e.icon])
|
|
97
|
+
}, null), t("span", {
|
|
98
|
+
class: "truncate"
|
|
99
|
+
}, [e.label])]), t(D, {
|
|
105
100
|
modelValue: e.children || [],
|
|
106
101
|
animation: 150,
|
|
107
102
|
group: {
|
|
@@ -111,52 +106,52 @@ const M = /* @__PURE__ */ f({
|
|
|
111
106
|
},
|
|
112
107
|
sort: !1,
|
|
113
108
|
clone: m,
|
|
114
|
-
class: "
|
|
109
|
+
class: "space-y-2"
|
|
115
110
|
}, {
|
|
116
|
-
default: () => [e.children?.map((n) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
111
|
+
default: () => [e.children?.map((n, p) => {
|
|
112
|
+
const f = (r * 20 + p) % c.length, b = c[f];
|
|
113
|
+
return t("div", {
|
|
114
|
+
key: n.name,
|
|
115
|
+
class: "rounded-lg px-3 py-2 cursor-move transition-all bg-default dark:bg-muted hover:bg-elevated edit-drag flex items-center gap-3"
|
|
116
|
+
}, [t("div", {
|
|
117
|
+
class: d(["size-8 rounded-lg flex items-center justify-center flex-shrink-0", b])
|
|
118
|
+
}, [t("div", {
|
|
119
|
+
class: d(["size-4 text-white", n.icon])
|
|
120
|
+
}, null)]), t("div", {
|
|
121
|
+
class: "flex-1 min-w-0"
|
|
122
|
+
}, [t("div", {
|
|
123
|
+
class: "text-sm font-medium truncate"
|
|
124
|
+
}, [n.label]), n.description && t("div", {
|
|
125
|
+
class: "text-xs truncate opacity-80"
|
|
126
|
+
}, [n.description])])]);
|
|
127
|
+
})]
|
|
128
|
+
})])), a.tree.value?.filter((e) => e.children && e.children.length > 0).length === 0 && t("div", {
|
|
129
|
+
class: "text-xs text-muted text-center py-4"
|
|
130
|
+
}, [o("components.designEditor.empty") || "No components"])])]
|
|
131
|
+
})])])]), t("div", {
|
|
132
|
+
class: "absolute inset-0 shadow-sm flex flex-col items-center p-6 overflow-auto",
|
|
127
133
|
style: "background: linear-gradient(45deg, rgba(0,0,0, 0.1) 25%, transparent 25%), linear-gradient(-45deg, rgba(0,0,0, 0.1) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(0,0,0, 0.1) 75%), linear-gradient(-45deg, transparent 75%, rgba(0,0,0, 0.1) 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px;"
|
|
128
|
-
}, [
|
|
134
|
+
}, [t("div", {
|
|
129
135
|
class: "max-w-2xl w-full flex-1 bg-default shadow p-2",
|
|
130
136
|
onClick: () => {
|
|
131
|
-
|
|
137
|
+
a.selected.value = void 0;
|
|
132
138
|
}
|
|
133
|
-
}, [
|
|
134
|
-
modelValue:
|
|
135
|
-
onUpdate: (e) =>
|
|
136
|
-
}, null),
|
|
137
|
-
modelValue:
|
|
138
|
-
onUpdate: (e) =>
|
|
139
|
-
}, null)])]),
|
|
140
|
-
|
|
141
|
-
},
|
|
139
|
+
}, [l.previewWrapper ? l.previewWrapper(t(u, {
|
|
140
|
+
modelValue: a.value.value?.data,
|
|
141
|
+
onUpdate: (e) => a.value.value.data = e
|
|
142
|
+
}, null), a) : t(u, {
|
|
143
|
+
modelValue: a.value.value?.data,
|
|
144
|
+
onUpdate: (e) => a.value.value.data = e
|
|
145
|
+
}, null)])]), t("div", {
|
|
146
|
+
class: "absolute top-4 right-4 bottom-4 z-10"
|
|
147
|
+
}, [t("div", {
|
|
148
|
+
class: "h-full w-300px bg-default shadow rounded"
|
|
149
|
+
}, [t(U, {
|
|
150
|
+
actionRender: l.actionRender
|
|
151
|
+
}, null)])])])]
|
|
142
152
|
});
|
|
143
153
|
}
|
|
144
154
|
});
|
|
145
|
-
function s({
|
|
146
|
-
title: r,
|
|
147
|
-
icon: o,
|
|
148
|
-
active: t,
|
|
149
|
-
onClick: l
|
|
150
|
-
}) {
|
|
151
|
-
return a("div", {
|
|
152
|
-
class: u(["flex flex-col items-center px-3 py-2 hover:bg-primary/10 cursor-pointer rounded-sm", t ? "bg-primary/10 text-primary" : ""]),
|
|
153
|
-
onClick: l
|
|
154
|
-
}, [a("div", {
|
|
155
|
-
class: u(["size-4", o])
|
|
156
|
-
}, null), a("div", {
|
|
157
|
-
class: "truncate whitespace-nowrap text-default text-sm"
|
|
158
|
-
}, [r])]);
|
|
159
|
-
}
|
|
160
155
|
export {
|
|
161
|
-
|
|
156
|
+
O as DuxDesignEditor
|
|
162
157
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as f, computed as
|
|
2
|
-
import { useI18n as
|
|
3
|
-
import { NButton as
|
|
1
|
+
import { defineComponent as f, computed as c, createVNode as m, mergeProps as E, isVNode as x } from "vue";
|
|
2
|
+
import { useI18n as b } from "@duxweb/dvha-core";
|
|
3
|
+
import { NButton as s } from "naive-ui";
|
|
4
4
|
import "vue-router";
|
|
5
5
|
import "@overlastic/vue";
|
|
6
6
|
import "@vueuse/core";
|
|
@@ -48,34 +48,34 @@ import "vue-command-palette";
|
|
|
48
48
|
import "@duxweb/dvha-naiveui";
|
|
49
49
|
import "../../pages/page404.js";
|
|
50
50
|
import "vue-draggable-plus";
|
|
51
|
-
import { DuxDesignEditor as
|
|
51
|
+
import { DuxDesignEditor as a } from "../designEditor/editor.js";
|
|
52
52
|
import "short-unique-id";
|
|
53
53
|
import "aieditor";
|
|
54
54
|
import "@vue-flow/core";
|
|
55
|
-
import { DuxFormLayout as
|
|
55
|
+
import { DuxFormLayout as y } from "../form/formLayout.js";
|
|
56
56
|
import "lodash-es/cloneDeep";
|
|
57
57
|
import "@vue-flow/background";
|
|
58
58
|
/* empty css */
|
|
59
|
-
import { DuxFormEditorSettingPage as
|
|
60
|
-
import { duxFormEditorCascader as
|
|
61
|
-
import { duxFormEditorCascaderAsync as
|
|
62
|
-
import { duxFormEditorCheckbox as
|
|
63
|
-
import { duxFormEditorColor as
|
|
64
|
-
import { duxFormEditorDate as
|
|
65
|
-
import { duxFormEditorDynamicInput as
|
|
59
|
+
import { DuxFormEditorSettingPage as D } from "./base/setting.js";
|
|
60
|
+
import { duxFormEditorCascader as F } from "./components/cascader.js";
|
|
61
|
+
import { duxFormEditorCascaderAsync as g } from "./components/cascaderAsync.js";
|
|
62
|
+
import { duxFormEditorCheckbox as v } from "./components/checkbox.js";
|
|
63
|
+
import { duxFormEditorColor as S } from "./components/color.js";
|
|
64
|
+
import { duxFormEditorDate as A } from "./components/date.js";
|
|
65
|
+
import { duxFormEditorDynamicInput as h } from "./components/dynamicInput.js";
|
|
66
66
|
import { duxFormEditorDynamicTags as k } from "./components/dynamicTags.js";
|
|
67
|
-
import { duxFormEditorAIEditor as
|
|
68
|
-
import { duxFormEditorFileUpload as
|
|
69
|
-
import { duxFormEditorImageUpload as
|
|
70
|
-
import { duxFormEditorInput as
|
|
67
|
+
import { duxFormEditorAIEditor as C } from "./components/editor.js";
|
|
68
|
+
import { duxFormEditorFileUpload as P } from "./components/fileUpload.js";
|
|
69
|
+
import { duxFormEditorImageUpload as I } from "./components/imageUpload.js";
|
|
70
|
+
import { duxFormEditorInput as w } from "./components/input.js";
|
|
71
71
|
import { duxFormEditorInputNumber as T } from "./components/inputNumber.js";
|
|
72
|
-
import { duxFormEditorMentionAsync as
|
|
72
|
+
import { duxFormEditorMentionAsync as j } from "./components/mentionAsync.js";
|
|
73
73
|
import { duxFormEditorRadio as N } from "./components/radio.js";
|
|
74
74
|
import { duxFormEditorRegion as O } from "./components/region.js";
|
|
75
|
-
import { duxFormEditorSelect as
|
|
76
|
-
import { duxFormEditorSelectAsync as
|
|
77
|
-
import { duxFormEditorSider as
|
|
78
|
-
import { duxFormEditorSwitch as
|
|
75
|
+
import { duxFormEditorSelect as U } from "./components/select.js";
|
|
76
|
+
import { duxFormEditorSelectAsync as _ } from "./components/selectAsync.js";
|
|
77
|
+
import { duxFormEditorSider as R } from "./components/sider.js";
|
|
78
|
+
import { duxFormEditorSwitch as M } from "./components/switch.js";
|
|
79
79
|
import { duxFormEditorTime as V } from "./components/time.js";
|
|
80
80
|
import { duxFormEditorTransferAsync as B } from "./components/transferAsync.js";
|
|
81
81
|
import { duxFormEditorTreeSelect as L } from "./components/treeSelect.js";
|
|
@@ -89,19 +89,19 @@ import "dayjs";
|
|
|
89
89
|
import { useModal as q } from "../../hooks/modal.js";
|
|
90
90
|
import "@tanstack/vue-query";
|
|
91
91
|
import "pinia";
|
|
92
|
-
function
|
|
93
|
-
return typeof
|
|
92
|
+
function n(e) {
|
|
93
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !x(e);
|
|
94
94
|
}
|
|
95
|
-
const
|
|
95
|
+
const Pr = /* @__PURE__ */ f({
|
|
96
96
|
name: "DuxFormEditor",
|
|
97
97
|
props: {
|
|
98
98
|
onSave: Function
|
|
99
99
|
},
|
|
100
|
-
extends:
|
|
101
|
-
setup(
|
|
100
|
+
extends: a,
|
|
101
|
+
setup(e) {
|
|
102
102
|
const {
|
|
103
103
|
t: o
|
|
104
|
-
} =
|
|
104
|
+
} = b(), d = q(), l = c(() => [{
|
|
105
105
|
name: "form",
|
|
106
106
|
label: o("components.formEditor.groups.form"),
|
|
107
107
|
icon: "i-tabler:forms"
|
|
@@ -113,30 +113,60 @@ const Ir = /* @__PURE__ */ f({
|
|
|
113
113
|
name: "async",
|
|
114
114
|
label: o("components.formEditor.groups.async"),
|
|
115
115
|
icon: "i-tabler:loader"
|
|
116
|
-
}]),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
}]), u = c(() => {
|
|
117
|
+
const r = [w(o), T(o), C(o), R(o), A(o), V(o), S(o), v(o), N(o), M(o), h(o), k(o), I(o), P(o), U(o), F(o), L(o), O(o), _(o), g(o), W(o), B(o), j(o)], i = {
|
|
118
|
+
"dux-input": o("components.formEditor.toolbarDescriptions.input"),
|
|
119
|
+
"dux-input-number": o("components.formEditor.toolbarDescriptions.inputNumber"),
|
|
120
|
+
"dux-editor": o("components.formEditor.toolbarDescriptions.aiEditor"),
|
|
121
|
+
sider: o("components.formEditor.toolbarDescriptions.slider"),
|
|
122
|
+
"dux-date": o("components.formEditor.toolbarDescriptions.date"),
|
|
123
|
+
"dux-time": o("components.formEditor.toolbarDescriptions.time"),
|
|
124
|
+
"dux-color": o("components.formEditor.toolbarDescriptions.color"),
|
|
125
|
+
"dux-checkbox": o("components.formEditor.toolbarDescriptions.checkbox"),
|
|
126
|
+
"dux-radio": o("components.formEditor.toolbarDescriptions.radio"),
|
|
127
|
+
"dux-switch": o("components.formEditor.toolbarDescriptions.switch"),
|
|
128
|
+
"dux-dynamic-input": o("components.formEditor.toolbarDescriptions.dynamicInput"),
|
|
129
|
+
"dynamic-tags": o("components.formEditor.toolbarDescriptions.dynamicTags"),
|
|
130
|
+
"dux-image-upload": o("components.formEditor.toolbarDescriptions.imageUpload"),
|
|
131
|
+
"dux-file-upload": o("components.formEditor.toolbarDescriptions.fileUpload"),
|
|
132
|
+
"dux-select": o("components.formEditor.toolbarDescriptions.select"),
|
|
133
|
+
"dux-cascader": o("components.formEditor.toolbarDescriptions.cascader"),
|
|
134
|
+
"tree-select": o("components.formEditor.toolbarDescriptions.treeSelect"),
|
|
135
|
+
region: o("components.formEditor.toolbarDescriptions.region"),
|
|
136
|
+
"select-async": o("components.formEditor.toolbarDescriptions.selectAsync"),
|
|
137
|
+
"dux-cascader-async": o("components.formEditor.toolbarDescriptions.cascaderAsync"),
|
|
138
|
+
"tree-select-async": o("components.formEditor.toolbarDescriptions.treeSelectAsync"),
|
|
139
|
+
"transfer-async": o("components.formEditor.toolbarDescriptions.transferAsync"),
|
|
140
|
+
"mention-async": o("components.formEditor.toolbarDescriptions.mentionAsync")
|
|
141
|
+
};
|
|
142
|
+
return r.map((t) => ({
|
|
143
|
+
...t,
|
|
144
|
+
description: t.description || i[t.name] || ""
|
|
145
|
+
}));
|
|
146
|
+
});
|
|
147
|
+
return () => m(a, E(e, {
|
|
148
|
+
groups: l.value,
|
|
149
|
+
components: u.value,
|
|
120
150
|
settingPage: {
|
|
121
|
-
component: (r) =>
|
|
151
|
+
component: (r) => m(D, r, null),
|
|
122
152
|
default: {
|
|
123
153
|
labelPlacement: "left"
|
|
124
154
|
}
|
|
125
155
|
},
|
|
126
156
|
previewWrapper: (r, i) => {
|
|
127
|
-
const
|
|
128
|
-
return
|
|
129
|
-
labelPlacement:
|
|
157
|
+
const t = c(() => i?.value?.value?.config);
|
|
158
|
+
return m(y, {
|
|
159
|
+
labelPlacement: t.value?.labelPlacement || "left",
|
|
130
160
|
class: "h-full"
|
|
131
|
-
},
|
|
161
|
+
}, n(r) ? r : {
|
|
132
162
|
default: () => [r]
|
|
133
163
|
});
|
|
134
164
|
},
|
|
135
165
|
actionRender: (r) => {
|
|
136
|
-
let i,
|
|
137
|
-
return
|
|
166
|
+
let i, t, p;
|
|
167
|
+
return m("div", {
|
|
138
168
|
class: "flex flex-col gap-2"
|
|
139
|
-
}, [
|
|
169
|
+
}, [m(s, {
|
|
140
170
|
type: "primary",
|
|
141
171
|
secondary: !0,
|
|
142
172
|
block: !0,
|
|
@@ -149,9 +179,9 @@ const Ir = /* @__PURE__ */ f({
|
|
|
149
179
|
}
|
|
150
180
|
});
|
|
151
181
|
}
|
|
152
|
-
},
|
|
182
|
+
}, n(i = o("components.formEditor.main.actions.jsonOutput")) ? i : {
|
|
153
183
|
default: () => [i]
|
|
154
|
-
}),
|
|
184
|
+
}), m(s, {
|
|
155
185
|
type: "info",
|
|
156
186
|
secondary: !0,
|
|
157
187
|
block: !0,
|
|
@@ -165,21 +195,21 @@ const Ir = /* @__PURE__ */ f({
|
|
|
165
195
|
}
|
|
166
196
|
});
|
|
167
197
|
}
|
|
168
|
-
},
|
|
169
|
-
default: () => [
|
|
170
|
-
}),
|
|
198
|
+
}, n(t = o("common.preview")) ? t : {
|
|
199
|
+
default: () => [t]
|
|
200
|
+
}), m(s, {
|
|
171
201
|
type: "primary",
|
|
172
202
|
block: !0,
|
|
173
203
|
onClick: () => {
|
|
174
|
-
|
|
204
|
+
e.onSave?.(r?.value?.value || {});
|
|
175
205
|
}
|
|
176
|
-
}, p
|
|
177
|
-
default: () => [
|
|
206
|
+
}, n(p = o("components.formEditor.main.actions.save")) ? p : {
|
|
207
|
+
default: () => [p]
|
|
178
208
|
})]);
|
|
179
209
|
}
|
|
180
210
|
}), null);
|
|
181
211
|
}
|
|
182
212
|
});
|
|
183
213
|
export {
|
|
184
|
-
|
|
214
|
+
Pr as DuxFormEditor
|
|
185
215
|
};
|