From 390b31a68bdcf45a60b26fcd1a3d227d5dbaea8b Mon Sep 17 00:00:00 2001
From: haixin <1875934025@qq.com>
Date: Fri, 22 Mar 2024 10:39:42 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=AE=9A=E4=B9=89json=E5=90=8E?=
=?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=A4=B1=E6=95=88=20#8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/editor/package.json | 2 +-
packages/editor/src/components/NavList.vue | 25 +++++++++++++++++++---
packages/editor/src/main.ts | 6 +++++-
packages/editor/src/starfish-editor.vue | 11 +++++++---
packages/editor/src/styles/nav-list.scss | 7 ++++++
playground/package.json | 2 +-
6 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/packages/editor/package.json b/packages/editor/package.json
index 0b51791..5c41ba4 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -1,6 +1,6 @@
{
"name": "starfish-editor",
- "version": "1.1.17",
+ "version": "1.1.18",
"main": "dist/starfish-editor.umd.js",
"style": "dist/style.css",
"module": "dist/starfish-editor.es.js",
diff --git a/packages/editor/src/components/NavList.vue b/packages/editor/src/components/NavList.vue
index 3a1dcd1..ea88a55 100644
--- a/packages/editor/src/components/NavList.vue
+++ b/packages/editor/src/components/NavList.vue
@@ -194,7 +194,24 @@
:filter-node-method="filterNode"
@node-click="myClick"
style="margin-top: 20px"
- />
+ >
+
+
+
+ {{ node.label }}
+
+
+
+
@@ -301,11 +318,12 @@ export default defineComponent({
return [];
}
};
- function toTree(item: any): Tree {
+ function toTree(item: any): any {
if (!item.layout) {
return {
id: item.id,
label: item.nameCn,
+ icon: item.icon,
};
} else {
let children;
@@ -467,7 +485,7 @@ export default defineComponent({
element.msRequestFullscreen();
}
} else {
- const doc:any = document;
+ const doc: any = document;
if (doc.exitFullscreen) {
doc.exitFullscreen();
} else if (doc.mozCancelFullScreen) {
@@ -535,6 +553,7 @@ export default defineComponent({
});
}
},
+ // remove(node, data) {},
};
},
});
diff --git a/packages/editor/src/main.ts b/packages/editor/src/main.ts
index fc96361..38195b0 100644
--- a/packages/editor/src/main.ts
+++ b/packages/editor/src/main.ts
@@ -7,6 +7,7 @@ import vm from "./utils/vm";
import flex from "./utils/_";
import "starfish-form/dist/style.css";
import StarfishEditor from "./starfish-editor.vue";
+import Loading from "@/common/Loading.vue";
export default {
install: (app: App) => {
app.config.globalProperties.$EventBus = vm;
@@ -36,7 +37,10 @@ export default {
);
app.component(
"draggable",
- defineAsyncComponent(() => import("vuedraggable"))
+ defineAsyncComponent({
+ loader: () => import("vuedraggable"),
+ loadingComponent: Loading,
+ })
);
app.component(
"Shape",
diff --git a/packages/editor/src/starfish-editor.vue b/packages/editor/src/starfish-editor.vue
index 1f3c1ff..b3c985b 100644
--- a/packages/editor/src/starfish-editor.vue
+++ b/packages/editor/src/starfish-editor.vue
@@ -16,7 +16,11 @@
-
+
@@ -103,8 +107,8 @@ export default defineComponent({
// 右侧配置属性tab
panel: {
type: Array,
- default: () => (["form", "json", "global"])
- }
+ default: () => ["form", "json", "global"],
+ },
},
setup(props: any, { emit }) {
const workspace = ref();
@@ -155,6 +159,7 @@ export default defineComponent({
return window.VApp.$Flex.jsonToForm(json);
});
formStore.updateAllFormList(newJson);
+ formStore?.set("save", true);
},
};
},
diff --git a/packages/editor/src/styles/nav-list.scss b/packages/editor/src/styles/nav-list.scss
index 8dda387..773524f 100644
--- a/packages/editor/src/styles/nav-list.scss
+++ b/packages/editor/src/styles/nav-list.scss
@@ -50,3 +50,10 @@
}
}
}
+.custom-tree-node {
+ display: flex;
+ align-items: center;
+ span:last-child {
+ justify-content: flex-end;
+ }
+}
diff --git a/playground/package.json b/playground/package.json
index 1010152..01918ef 100644
--- a/playground/package.json
+++ b/playground/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@element-plus/icons-vue": "^2.0.8",
"element-plus": "^2.2.12",
- "starfish-editor": "^1.1.17",
+ "starfish-editor": "^1.1.18",
"starfish-form": "^1.2.9",
"vite": "^4.5.2",
"vue": "^3.2.37",