@duxweb/dvha-pro 1.1.27 → 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/components/upload/file.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 +29 -20
- 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/components/upload/file.js +45 -45
- 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 +29 -20
- package/dist/types/components/designEditor/editor/hook.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createVNode as n, defineComponent as
|
|
1
|
+
import { createVNode as n, defineComponent as s, computed as l, isVNode as g } from "vue";
|
|
2
2
|
import { useI18n as f } from "@duxweb/dvha-core";
|
|
3
3
|
import { useVModel as h } from "@vueuse/core";
|
|
4
4
|
import v from "clsx";
|
|
5
|
-
import { NFormItem as
|
|
5
|
+
import { NFormItem as c, NInputNumber as a } from "naive-ui";
|
|
6
6
|
import { DuxGrid as b } from "../../layout/grid.js";
|
|
7
7
|
import "lodash-es";
|
|
8
8
|
import "vue-router";
|
|
@@ -65,10 +65,10 @@ import "../../schemaEditor/schemaEditor.js";
|
|
|
65
65
|
import "dayjs";
|
|
66
66
|
import "@tanstack/vue-query";
|
|
67
67
|
import "pinia";
|
|
68
|
-
function x(
|
|
69
|
-
return typeof
|
|
68
|
+
function x(t) {
|
|
69
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !g(t);
|
|
70
70
|
}
|
|
71
|
-
const C = /* @__PURE__ */
|
|
71
|
+
const C = /* @__PURE__ */ s({
|
|
72
72
|
name: "WidgetEditorGrid",
|
|
73
73
|
props: {
|
|
74
74
|
options: Object,
|
|
@@ -78,21 +78,21 @@ const C = /* @__PURE__ */ u({
|
|
|
78
78
|
},
|
|
79
79
|
onChildren: Function
|
|
80
80
|
},
|
|
81
|
-
setup(
|
|
82
|
-
const r =
|
|
83
|
-
const
|
|
84
|
-
for (;
|
|
85
|
-
|
|
81
|
+
setup(t) {
|
|
82
|
+
const r = l(() => t.options?.col || 2), i = l(() => {
|
|
83
|
+
const o = [...t.children || []], e = r.value;
|
|
84
|
+
for (; o.length < e; )
|
|
85
|
+
o.push([]);
|
|
86
86
|
for (let p = 0; p < e; p++)
|
|
87
|
-
Array.isArray(
|
|
88
|
-
return
|
|
87
|
+
Array.isArray(o[p]) || (o[p] = []);
|
|
88
|
+
return o;
|
|
89
89
|
});
|
|
90
90
|
return () => {
|
|
91
|
-
let
|
|
91
|
+
let o;
|
|
92
92
|
return n(b, {
|
|
93
93
|
cols: r.value,
|
|
94
|
-
spac:
|
|
95
|
-
}, x(
|
|
94
|
+
spac: t.options?.spac
|
|
95
|
+
}, x(o = i.value.map((e, p) => {
|
|
96
96
|
const m = e;
|
|
97
97
|
return n("div", {
|
|
98
98
|
key: p,
|
|
@@ -101,17 +101,17 @@ const C = /* @__PURE__ */ u({
|
|
|
101
101
|
})
|
|
102
102
|
}, [n(E, {
|
|
103
103
|
modelValue: m,
|
|
104
|
-
onUpdate: (
|
|
105
|
-
const
|
|
106
|
-
|
|
104
|
+
onUpdate: (u) => {
|
|
105
|
+
const d = [...i.value];
|
|
106
|
+
d[p] = u, t.onChildren?.(d);
|
|
107
107
|
}
|
|
108
108
|
}, null)]);
|
|
109
|
-
})) ?
|
|
110
|
-
default: () => [
|
|
109
|
+
})) ? o : {
|
|
110
|
+
default: () => [o]
|
|
111
111
|
});
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
}), G = /* @__PURE__ */
|
|
114
|
+
}), G = /* @__PURE__ */ s({
|
|
115
115
|
name: "WidgetEditorGridSetting",
|
|
116
116
|
props: {
|
|
117
117
|
value: {
|
|
@@ -122,34 +122,34 @@ const C = /* @__PURE__ */ u({
|
|
|
122
122
|
})
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
|
-
setup(
|
|
125
|
+
setup(t, {
|
|
126
126
|
emit: r
|
|
127
127
|
}) {
|
|
128
128
|
const {
|
|
129
129
|
t: i
|
|
130
|
-
} = f(),
|
|
130
|
+
} = f(), o = h(t, "value", r);
|
|
131
131
|
return () => n(y, {
|
|
132
132
|
title: i("components.designEditor.grid.title"),
|
|
133
133
|
icon: "i-tabler:grid-4x4"
|
|
134
134
|
}, {
|
|
135
|
-
default: () => [n(
|
|
135
|
+
default: () => [n(c, {
|
|
136
136
|
label: i("components.designEditor.grid.columns"),
|
|
137
137
|
path: "col"
|
|
138
138
|
}, {
|
|
139
|
-
default: () => [n(
|
|
140
|
-
value:
|
|
141
|
-
"onUpdate:value": (e) =>
|
|
139
|
+
default: () => [n(a, {
|
|
140
|
+
value: o.value.col,
|
|
141
|
+
"onUpdate:value": (e) => o.value.col = e,
|
|
142
142
|
min: 1,
|
|
143
143
|
max: 12,
|
|
144
144
|
placeholder: i("components.designEditor.grid.columnsPlaceholder")
|
|
145
145
|
}, null)]
|
|
146
|
-
}), n(
|
|
146
|
+
}), n(c, {
|
|
147
147
|
label: i("components.designEditor.grid.spacing"),
|
|
148
148
|
path: "spac"
|
|
149
149
|
}, {
|
|
150
|
-
default: () => [n(
|
|
151
|
-
value:
|
|
152
|
-
"onUpdate:value": (e) =>
|
|
150
|
+
default: () => [n(a, {
|
|
151
|
+
value: o.value.spac,
|
|
152
|
+
"onUpdate:value": (e) => o.value.spac = e,
|
|
153
153
|
min: 0,
|
|
154
154
|
max: 100,
|
|
155
155
|
placeholder: i("components.designEditor.grid.spacingPlaceholder")
|
|
@@ -158,26 +158,27 @@ const C = /* @__PURE__ */ u({
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
function j(
|
|
161
|
+
function j(t) {
|
|
162
162
|
const {
|
|
163
163
|
children: r,
|
|
164
164
|
convertToJsonSchema: i
|
|
165
|
-
} =
|
|
166
|
-
let
|
|
167
|
-
return r?.length && i && (
|
|
165
|
+
} = t || {};
|
|
166
|
+
let o = [];
|
|
167
|
+
return r?.length && i && (o = r.flatMap((e) => Array.isArray(e) ? i(e) : [])), {
|
|
168
168
|
tag: "dux-grid",
|
|
169
169
|
attrs: {
|
|
170
|
-
cols:
|
|
171
|
-
spac:
|
|
170
|
+
cols: t?.options?.col || 2,
|
|
171
|
+
spac: t?.options?.spac || 2
|
|
172
172
|
},
|
|
173
|
-
children:
|
|
173
|
+
children: o
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
function Mt(
|
|
176
|
+
function Mt(t) {
|
|
177
177
|
return {
|
|
178
178
|
name: "dux-grid",
|
|
179
179
|
icon: "i-tabler:grid-4x4",
|
|
180
|
-
label:
|
|
180
|
+
label: t("components.designEditor.grid.label"),
|
|
181
|
+
description: t("components.designEditor.grid.description") || "",
|
|
181
182
|
group: "layout",
|
|
182
183
|
nested: !0,
|
|
183
184
|
component: (r) => n(C, r, null),
|
|
@@ -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
|
};
|