feat: add workspace demo (#135)

* feat: add workspace demo

* feat: update lowcode-engine version to 1.1.10
This commit is contained in:
刘菊萍(絮黎) 2023-08-25 16:46:41 +08:00 committed by GitHub
parent 83728847a6
commit 53ddd19fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 3363 additions and 57 deletions

View File

@ -24,6 +24,9 @@
"demo-lowcode-component/index": "./demo-lowcode-component/src/index.ts",
"demo-lowcode-component/preview": "./demo-lowcode-component/src/preview.tsx",
"demo-workspace/index": "./demo-workspace/src/index.ts",
"demo-workspace/preview": "./demo-workspace/src/preview.tsx",
"demo-graph-x6/index": "./demo-graph-x6/src/index.ts"
},
"vendor": false,

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -0,0 +1,7 @@
module.exports = {
printWidth: 100,
tabWidth: 2,
semi: true,
singleQuote: true,
trailingComma: 'all',
};

35
demo-workspace/build.json Normal file
View File

@ -0,0 +1,35 @@
{
"entry": {
"preview": "./src/preview.tsx",
"index": "./src/index.ts"
},
"vendor": false,
"devServer": {
"hot": false
},
"publicPath": "/",
"externals": {
"react": "var window.React",
"react-dom": "var window.ReactDOM",
"prop-types": "var window.PropTypes",
"@alifd/next": "var window.Next",
"@alilc/lowcode-engine": "var window.AliLowCodeEngine",
"@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt",
"moment": "var window.moment",
"lodash": "var window._"
},
"plugins": [
[
"build-plugin-react-app"
],
[
"build-plugin-moment-locales",
{
"locales": [
"zh-cn"
]
}
],
"./build.plugin.js"
]
}

View File

@ -0,0 +1,57 @@
const fs = require('fs-extra');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { version } = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
module.exports = ({ onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
config.resolve.plugin('tsconfigpaths').use(TsconfigPathsPlugin, [
{
configFile: './tsconfig.json',
},
]);
config.merge({
node: {
fs: 'empty',
},
});
config
.plugin('index')
.use(HtmlWebpackPlugin, [
{
inject: false,
minify: false,
templateParameters: {
version,
},
template: require.resolve('./public/index.ejs'),
filename: 'index.html',
},
]);
config
.plugin('preview')
.use(HtmlWebpackPlugin, [
{
inject: false,
templateParameters: {
},
template: require.resolve('./public/preview.html'),
filename: 'preview.html',
},
]);
config.plugins.delete('hot');
config.devServer.hot(false);
config.module // fixes https://github.com/graphql/graphql-js/issues/1272
.rule('mjs$')
.test(/\.mjs$/)
.include
.add(/node_modules/)
.end()
.type('javascript/auto');
});
};

View File

@ -0,0 +1,60 @@
{
"name": "@alilc/lowcode-demo-general",
"version": "1.0.28",
"description": "Low-Code Engine 低代码搭建引擎 Demo 项目 - 综合场景",
"repository": "git@github.com:alibaba/lowcode-demo.git",
"license": "MIT",
"main": "index.js",
"scripts": {
"start": "build-scripts start --disable-reload --port 5556",
"build": "build-scripts build",
"prepublishOnly": "npm run build",
"pub": "node ./scripts/watchdog.js && npm pub"
},
"files": [
"build"
],
"config": {},
"dependencies": {
"@alilc/lowcode-datasource-fetch-handler": "^1.0.1",
"@alilc/lowcode-plugin-code-editor": "^1.0.3",
"@alilc/lowcode-plugin-components-pane": "^2.0.0",
"@alilc/lowcode-plugin-datasource-pane": "^1.0.9",
"@alilc/lowcode-plugin-inject": "^1.2.3",
"@alilc/lowcode-plugin-manual": "^1.0.4",
"@alilc/lowcode-plugin-resource-tabs": "^1.0.0",
"@alilc/lowcode-plugin-schema": "^1.0.2",
"@alilc/lowcode-plugin-set-ref-prop": "^1.0.1",
"@alilc/lowcode-plugin-simulator-select": "^1.0.4",
"@alilc/lowcode-plugin-undo-redo": "^1.0.0",
"@alilc/lowcode-plugin-view-manager-pane": "^1.0.0",
"@alilc/lowcode-plugin-zh-en": "^1.0.0",
"@alilc/lowcode-react-renderer": "^1.1.2",
"@alilc/lowcode-setter-behavior": "^1.0.0",
"@alilc/lowcode-setter-title": "^1.0.2",
"@alilc/lowcode-types": "latest",
"antd": "^4.21.4",
"moment": "^2.29.3",
"uuid": "^8.3.2"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"@alilc/lowcode-engine": "^1.1.2",
"@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-types": "^1.1.1",
"@types/events": "^3.0.0",
"@types/react": "^16.8.3",
"@types/react-dom": "^16.8.2",
"@types/streamsaver": "^2.0.0",
"@types/uuid": "^8.3.4",
"build-plugin-fusion": "^0.1.0",
"build-plugin-moment-locales": "^0.1.0",
"build-plugin-react-app": "^1.1.2",
"fs-extra": "^10.0.1",
"tsconfig-paths-webpack-plugin": "^3.2.0"
},
"resolutions": {
"@babel/core": "7.20.12",
"@babel/preset-env": "7.15.8"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>阿里低代码引擎 Demo</title>
<link rel="icon" href="//img.alicdn.com/imgextra/i2/O1CN01lNWGJi1xflgRfSgbk_!!6000000006471-55-tps-22-26.svg">
<!-- 低代码引擎的页面主题样式,可以替换为 theme-lowcode-dark -->
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
<link href="./css/index.css" rel="stylesheet" />
<!-- React可替换为 production 包 -->
<script src="https://g.alicdn.com/code/lib/react/16.14.0/umd/react.production.min.js"></script>
<!-- React DOM可替换为 production 包 -->
<script src="https://g.alicdn.com/code/lib/react-dom/16.14.0/umd/react-dom.production.min.js"></script>
<!-- React 向下兼容,预防物料层的依赖 -->
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js"></script>
<!-- lodash低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js"></script>
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>
console.log(
'%c AliLowCodeEngineDemo %c v<%= version %> ',
'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #b37feb; font-weight: bold;',
'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;',
);
</script>
</head>
<body>
<div id="lce-container"></div>
<script type="text/javascript" src="./js/index.js"></script>
</body>
</html>

View File

@ -0,0 +1 @@
勿删,删了有奇妙的 bug😄~

View File

@ -0,0 +1 @@
{"success":true,"content":[{"gmtModified":"2021-03-06 00:40:54","formUuid":"FORM-6X866SC1KM4O4BLF3U7879QB0EMT2Z3TGIWLKW","parentNavUuid":"NAV-SYSTEM-PARENT-UUID","hidden":"n","navUuid":"FORM-6X866SC1KM4O4BLF3U7879QB0EMT2Z3TGIWLKW","navType":"PAGE","isIndex":"n","isNew":"n","gmtCreate":"2021-03-06 00:27:26","title":{"en-US":"页面1","zh-CN":"页面1","type":"i18n"},"relateUuid":"FORM-6X866SC1KM4O4BLF3U7879QB0EMT2Z3TGIWLKW","parentId":0,"listOrder":0,"id":556103}]}

View File

@ -0,0 +1,3 @@
{
"info": "Hello AliLowCode!!"
}

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/preview.css" rel="stylesheet">
</head>
<body>
<div id="ice-container"></div>
<script>
window.g_config = {
locale: 'zh-CN',
};
</script>
<script src="https://g.alicdn.com/code/lib/react/16.14.0/umd/react.production.min.js"></script>
<script src="https://g.alicdn.com/code/lib/react-dom/16.14.0/umd/react-dom.production.min.js"></script>
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/preview.js"></script>
</body>
</html>

View File

@ -0,0 +1,15 @@
#!/usr/bin/env node
const fs = require('fs');
const { join } = require('path');
const workingDir = process.cwd();
const pkg = JSON.parse(fs.readFileSync(join(workingDir, 'package.json'), 'utf-8'));
if (pkg.private) return;
const { files } = pkg;
files.forEach(file => {
const fileDir = join(workingDir, file);
if (!fs.existsSync(fileDir)) {
throw new Error(`${fileDir} does not exist, plz run build`);
}
});

View File

@ -0,0 +1,14 @@
import { createFetchHandler } from '@alilc/lowcode-datasource-fetch-handler';
const appHelper = {
requestHandlersMap: {
fetch: createFetchHandler()
},
utils: {
demoUtil: (...params: any[]) => { console.log(`this is a demoUtil with params ${params}`)}
},
constants: {
ConstantA: 'ConstantA',
ConstantB: 'ConstantB'
}
};
export default appHelper;

View File

@ -0,0 +1,55 @@
body {
font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial, PingFang SC-Light, Microsoft YaHei;
font-size: 12px;
* {
box-sizing: border-box;
}
}
body, #lce-container {
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
box-sizing: border-box;
padding: 0;
margin: 0;
overflow: hidden;
text-rendering: optimizeLegibility;
-webkit-user-select: none;
-webkit-user-drag: none;
-webkit-text-size-adjust: none;
-webkit-touch-callout: none;
-webkit-font-smoothing: antialiased;
#engine {
width: 100%;
height: 100%;
}
}
html {
min-width: 1024px;
}
.save-sample {
width: 80px;
height: 30px;
background-color: #5584FF;
border: none;
outline: none;
border-radius: 4px;
color: white;
cursor: pointer;
}
.load-assets {
width: 100px;
height: 30px;
background-color: #5584FF;
border: none;
outline: none;
border-radius: 4px;
color: white;
cursor: pointer;
}

View File

@ -0,0 +1,18 @@
import React from "react"
export const PageIcon = () => {
return (
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="视图面板分镜" stroke="none" stroke-width="1" fill="currentColor">
<g id="画板" transform="translate(-633.000000, -208.000000)">
<g id="编组-3" transform="translate(622.000000, 194.000000)">
<g id="编组" transform="translate(11.000000, 14.000000)">
<rect id="矩形" opacity="0" x="0" y="0" width="12" height="12"></rect>
<path d="M2.43333333,0 C1.63333334,0 0.999999996,0.633333328 0.999999996,1.4 L0.999999996,10.6 C0.999999996,11.3666667 1.63333334,12 2.43333333,12 L9.6,12 C10.3666667,12 11.0333333,11.3666667 11.0333333,10.6 L11.0333333,2.83333334 L8.13333333,0 L2.43333333,0 Z M9.2,11.1666667 L2.76666667,11.1666667 C2.23333334,11.1666667 1.9,10.8666667 1.9,10.3333333 L1.9,1.7 C1.9,1.16666667 2.23333332,0.9 2.76666667,0.9 L7.83333333,0.9 L7.83333333,2.43333333 C7.83333333,2.73333333 8.1,3 8.4,3 L10.1666667,3 L10.1666667,10.3333333 C10.2,10.8666667 9.76666668,11.1666667 9.2,11.1666667 Z M7.8,8.13333333 L4.2,8.13333333 C4,8.13333333 3.83333333,7.96666666 3.83333333,7.76666667 C3.83333333,7.56666667 4,7.4 4.2,7.4 L7.76666667,7.4 C7.96666668,7.4 8.13333333,7.56666667 8.13333333,7.76666667 C8.13333333,7.96666668 7.99999999,8.13333333 7.8,8.13333333 Z M7.8,6.73333334 L4.2,6.73333334 C4,6.73333334 3.83333333,6.56666667 3.83333333,6.36666667 C3.83333333,6.16666666 4,6 4.2,6 L7.76666667,6 C7.96666668,6 8.13333333,6.16666666 8.13333333,6.36666667 C8.13333333,6.56666667 7.99999999,6.73333334 7.8,6.73333334 Z M7.8,5.3 L4.2,5.3 C4,5.3 3.83333333,5.13333334 3.83333333,4.93333334 C3.83333333,4.73333333 4,4.56666667 4.2,4.56666667 L7.76666667,4.56666667 C7.96666668,4.56666667 8.13333333,4.73333333 8.13333333,4.93333334 C8.13333333,5.13333334 7.99999999,5.3 7.8,5.3 Z" id="形状"></path>
</g>
</g>
</g>
</g>
</svg>
)
}

View File

@ -0,0 +1,95 @@
import { init, workspace } from '@alilc/lowcode-engine';
import { createFetchHandler } from '@alilc/lowcode-datasource-fetch-handler'
import ZhEnPlugin from '@alilc/lowcode-plugin-zh-en';
import SchemaPlugin from '@alilc/lowcode-plugin-schema';
import pageResourceType from './page/resourceType';
import LogoSamplePlugin from './plugins/plugin-logo-sample';
import WorkspaceEmptyPlugin from './plugins/plugin-workspace-empty';
import pluginResourceData from './plugins/plugin-resource-data';
import InjectPlugin from '@alilc/lowcode-plugin-inject';
// 应用级顶部二级面板
import pluginResourceTabs from '@alilc/lowcode-plugin-resource-tabs';
// 应用级左侧面板
import pluginViewManagerPane from '@alilc/lowcode-plugin-view-manager-pane';
import controller from './viewController';
import SaveSamplePlugin from './plugins/plugin-save-sample';
import PreviewSamplePlugin from './plugins/plugin-preview-sample';
import SimulatorLocalePlugin from './plugins/plugin-simulator-locale';
import appHelper from './appHelper';
import './global.scss';
(async function main() {
// 注册应用级资源类型
workspace.registerResourceType(pageResourceType);
await workspace.plugins.register(InjectPlugin);
await workspace.plugins.register(LogoSamplePlugin, {
scenarioName: 'general',
displayName: '综合场景',
info: {
urls: [
{
key: '设计器',
value: 'https://github.com/alibaba/lowcode-demo/tree/main/demo-general',
},
{
key: 'fusion-ui 物料',
value: 'https://github.com/alibaba/lowcode-materials/tree/main/packages/fusion-ui',
},
{
key: 'fusion 物料',
value: 'https://github.com/alibaba/lowcode-materials/tree/main/packages/fusion-lowcode-materials',
}
],
},
});
await workspace.plugins.register(SchemaPlugin, { isProjectSchema: true });
// 注册中英文切换
await workspace.plugins.register(ZhEnPlugin);
await workspace.plugins.register(WorkspaceEmptyPlugin);
await workspace.plugins.register(pluginResourceData);
await workspace.plugins.register(SaveSamplePlugin);
await workspace.plugins.register(PreviewSamplePlugin);
// 应用级顶部二级面板
await workspace.plugins.register(pluginResourceTabs, {
appKey: 'general',
shape: 'text',
});
// 设计器区域多语言切换
await workspace.plugins.register(SimulatorLocalePlugin);
// 应用级左侧面板
await workspace.plugins.register(pluginViewManagerPane, {
onAddPage: controller.onAddPage,
init: controller.init,
onDeletePage: controller.onDeletePage,
});
init(document.getElementById('lce-container')!, {
locale: 'zh-CN',
enableWorkspaceMode: true,
enableAutoOpenFirstWindow: false,
enableCondition: true,
enableCanvasLock: true,
// 默认绑定变量
supportVariableGlobally: true,
requestHandlersMap: {
fetch: createFetchHandler(),
},
appHelper,
});
})();

View File

@ -0,0 +1,98 @@
import UndoRedoPlugin from '@alilc/lowcode-plugin-undo-redo';
import DataSourcePanePlugin from '@alilc/lowcode-plugin-datasource-pane';
import CodeEditorPlugin from "@alilc/lowcode-plugin-code-editor";
import ManualPlugin from "@alilc/lowcode-plugin-manual";
import ComponentPanelPlugin from '@alilc/lowcode-plugin-components-pane';
import DefaultSettersRegistryPlugin from '../plugins/plugin-default-setters-registry';
import LoadIncrementalAssetsWidgetPlugin from '../plugins/plugin-load-incremental-assets-widget';
import CustomSetterSamplePlugin from '../plugins/plugin-custom-setter-sample';
import SetRefPropPlugin from '@alilc/lowcode-plugin-set-ref-prop';
import SimulatorResizePlugin from '@alilc/lowcode-plugin-simulator-select';
import lowcodePlugin from '../plugins/plugin-lowcode-component';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import EditorInitPlugin from '../plugins/plugin-editor-init';
import {
saveSchema,
} from '../services/mockService';
import ResetPlugin from '../plugins/plugin-reset';
export const pageView = (ctx: IPublicModelPluginContext, options: {
slug: string;
title: string;
id: string;
}) => {
const { plugins, config } = ctx;
return {
async init() {
await plugins.register(EditorInitPlugin, {
scenarioName: 'general',
displayName: '综合场景',
info: {
urls: [
{
key: '设计器',
value: 'https://github.com/alibaba/lowcode-demo/tree/main/demo-general',
},
{
key: 'fusion-ui 物料',
value: 'https://github.com/alibaba/lowcode-materials/tree/main/packages/fusion-ui',
},
{
key: 'fusion 物料',
value: 'https://github.com/alibaba/lowcode-materials/tree/main/packages/fusion-lowcode-materials',
}
],
},
});
// 设置内置 setter 和事件绑定、插件绑定面板
await plugins.register(DefaultSettersRegistryPlugin);
await plugins.register(ComponentPanelPlugin);
await plugins.register(ManualPlugin);
// 注册回退/前进
await plugins.register(UndoRedoPlugin);
await plugins.register(SetRefPropPlugin);
await plugins.register(LoadIncrementalAssetsWidgetPlugin);
await plugins.register(SimulatorResizePlugin);
// 插件参数声明 & 传递参考https://lowcode-engine.cn/site/docs/api/plugins#%E8%AE%BE%E7%BD%AE%E6%8F%92%E4%BB%B6%E5%8F%82%E6%95%B0%E7%89%88%E6%9C%AC%E7%A4%BA%E4%BE%8B
await plugins.register(DataSourcePanePlugin, {
importPlugins: [],
dataSourceTypes: [
{
type: 'fetch',
},
{
type: 'jsonp',
}
]
});
await plugins.register(ResetPlugin)
await plugins.register(CodeEditorPlugin);
await plugins.register(CustomSetterSamplePlugin);
await plugins.register(lowcodePlugin);
},
async save() {
const scenarioName = config.get('scenarioName');
saveSchema(scenarioName, options.id, ctx);
}
};
};
pageView.viewName = 'page';

View File

@ -0,0 +1,32 @@
// @ts-ignore
import { IPublicModelPluginContext, IPublicTypeResourceType } from '@alilc/lowcode-types';
import { pageView } from './pageView';
import { PageIcon } from '../icon';
const pageResourceType: IPublicTypeResourceType = (ctx: IPublicModelPluginContext) => {
return {
category: '页面',
description: '页面',
// 默认视图类型
defaultViewName: 'page',
// defaultTitle: window.pageConfig.title,
// 当前资源视图
editorViews: [pageView],
icon: PageIcon,
async import(schema: any) {
return {
page: schema,
};
},
async save({
page,
}) {
return page;
}
}
}
pageResourceType.resourceName = 'page';
pageResourceType.resourceType = 'editor';
export default pageResourceType;

View File

@ -0,0 +1,19 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import TitleSetter from '@alilc/lowcode-setter-title';
import BehaviorSetter from './setters/behavior-setter';
import CustomSetter from './setters/custom-setter';
// 保存功能示例
const CustomSetterSamplePlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { setters } = ctx;
setters.registerSetter('TitleSetter', TitleSetter);
setters.registerSetter('BehaviorSetter', BehaviorSetter);
setters.registerSetter('CustomSetter', CustomSetter);
},
};
}
CustomSetterSamplePlugin.pluginName = 'CustomSetterSamplePlugin';
export default CustomSetterSamplePlugin;

View File

@ -0,0 +1,27 @@
import * as React from 'react';
import BehaviorSetter from '@alilc/lowcode-setter-behavior';
const defaultExtraBehaviorActions: any[] = [];
class LocalBehaviorSetter extends React.Component {
render() {
// ignore url && responseFormatter props, use default ones
const { url: propsUrl, responseFormatter: propsFormatter, extraBehaviorActions: propsExtraBehaviorActions = [], ...otherProps } = this.props;
const url = 'https://hn.algolia.com/api/v1/search?query';
const responseFormatter = (response) => response.hits.map((item) => ({
label: item.title,
value: item.author
}));
const extraBehaviorActions = propsExtraBehaviorActions.concat(defaultExtraBehaviorActions);
return (
<BehaviorSetter
{...otherProps}
url={url}
responseFormatter={responseFormatter}
extraBehaviorActions={extraBehaviorActions}
/>
);
}
}
export default LocalBehaviorSetter;

View File

@ -0,0 +1,13 @@
import React, { Component } from 'react';
// import classNames from 'classnames';
class CustomSetter extends Component<any, any> {
render() {
const { defaultValue, value, onChange } = this.props;
const { editor } = this.props.field;
return <div>hello world</div>;
}
}
export default CustomSetter;

View File

@ -0,0 +1,34 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import AliLowCodeEngineExt from '@alilc/lowcode-engine-ext';
// 设置内置 setter 和事件绑定、插件绑定面板
const DefaultSettersRegistryPlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { setterMap, pluginMap } = AliLowCodeEngineExt;
const { setters, skeleton } = ctx;
// 注册 setterMap
setters.registerSetter(setterMap);
// 注册插件
// 注册事件绑定面板
skeleton.add({
area: 'centerArea',
type: 'Widget',
content: pluginMap.EventBindDialog,
name: 'eventBindDialog',
props: {},
});
// 注册变量绑定面板
skeleton.add({
area: 'centerArea',
type: 'Widget',
content: pluginMap.VariableBindDialog,
name: 'variableBindDialog',
props: {},
});
},
};
}
DefaultSettersRegistryPlugin.pluginName = 'DefaultSettersRegistryPlugin';
export default DefaultSettersRegistryPlugin;

View File

@ -0,0 +1,23 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { injectAssets } from '@alilc/lowcode-plugin-inject';
import assets from '../../services/assets.json';
import { getProjectSchema } from '../../services/mockService';
const EditorInitPlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { material, project, config, editorWindow } = ctx;
const scenarioName = config.get('scenarioName');
// 设置物料描述
await material.setAssets(await injectAssets(assets));
const schema = await getProjectSchema(scenarioName + editorWindow.resource?.options.id);
// 加载 schema
project.importSchema(schema as any);
},
};
}
EditorInitPlugin.pluginName = 'EditorInitPlugin';
EditorInitPlugin.meta = {};
export default EditorInitPlugin;

View File

@ -0,0 +1,170 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Button } from '@alifd/next';
import { material } from '@alilc/lowcode-engine';
import { Message } from '@alifd/next';
const loadIncrementalAssets = () => {
material?.onChangeAssets(() => {
Message.success('[MCBreadcrumb] 物料加载成功');
});
material.loadIncrementalAssets({
packages: [
{
title: 'MCBreadcrumb',
package: 'mc-breadcrumb',
version: '1.0.0',
urls: [
'https://unpkg.alibaba-inc.com/mc-breadcrumb@1.0.0/dist/MCBreadcrumb.js',
'https://unpkg.alibaba-inc.com/mc-breadcrumb@1.0.0/dist/MCBreadcrumb.css',
],
library: 'MCBreadcrumb',
},
],
components: [
{
componentName: 'MCBreadcrumb',
title: 'MCBreadcrumb',
docUrl: '',
screenshot: '',
npm: {
package: 'mc-breadcrumb',
version: '1.0.0',
exportName: 'MCBreadcrumb',
main: 'lib/index.js',
destructuring: false,
subName: '',
},
props: [
{
name: 'prefix',
propType: 'string',
description: '样式类名的品牌前缀',
defaultValue: 'next-',
},
{
name: 'title',
propType: 'string',
description: '标题',
defaultValue: 'next-',
},
{
name: 'rtl',
propType: 'bool',
},
{
name: 'children',
propType: {
type: 'instanceOf',
value: 'node',
},
description: '面包屑子节点,需传入 Breadcrumb.Item',
},
{
name: 'maxNode',
propType: {
type: 'oneOfType',
value: [
'number',
{
type: 'oneOf',
value: ['auto'],
},
],
},
description:
'面包屑最多显示个数,超出部分会被隐藏, 设置为 auto 会自动根据父元素的宽度适配。',
defaultValue: 100,
},
{
name: 'separator',
propType: {
type: 'instanceOf',
value: 'node',
},
description: '分隔符,可以是文本或 Icon',
},
{
name: 'component',
propType: {
type: 'oneOfType',
value: ['string', 'func'],
},
description: '设置标签类型',
defaultValue: 'nav',
},
{
name: 'className',
propType: 'any',
},
{
name: 'style',
propType: 'object',
},
],
configure: {
component: {
isContainer: true,
isModel: true,
rootSelector: 'div.MCBreadcrumb',
},
},
},
],
componentList: [
{
title: '常用',
icon: '',
children: [
{
componentName: 'MCBreadcrumb',
title: 'MC面包屑',
icon: '',
package: 'mc-breadcrumb',
library: 'MCBreadcrumb',
snippets: [
{
title: 'MC面包屑',
screenshot:
'https://alifd.oss-cn-hangzhou.aliyuncs.com/fusion-cool/icons/icon-light/ic_light_breadcrumb.png',
schema: {
componentName: 'MCBreadcrumb',
props: {
title: '物料中心',
prefix: 'next-',
maxNode: 100,
},
},
},
],
},
],
},
],
});
};
const LoadIncrementalAssetsWidgetPlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { skeleton } = ctx;
skeleton.add({
name: 'loadAssetsSample',
area: 'topArea',
type: 'Widget',
props: {
align: 'right',
width: 80,
},
content: (
<Button onClick={loadIncrementalAssets}>
</Button>
),
});
},
};
}
LoadIncrementalAssetsWidgetPlugin.pluginName = 'LoadIncrementalAssetsWidgetPlugin';
export default LoadIncrementalAssetsWidgetPlugin;

View File

@ -0,0 +1,25 @@
.lowcode-plugin-logo {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: flex-end;
width: 300px;
.logo {
display: block;
width: 139px;
height: 26px;
cursor: pointer;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
.scenario-name {
display: block;
margin-left: 20px;
margin-right: 5px;
font-size: 15px;
}
.info-dropdown {
display: block;
}
}

View File

@ -0,0 +1,101 @@
import React from 'react';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Dropdown, Menu } from '@alifd/next';
import './index.scss';
export interface IProps {
logo?: string;
href?: string;
scenarioInfo?: any;
scenarioDisplayName?: string;
}
const Logo: React.FC<IProps> = (props): React.ReactElement => {
const { scenarioDisplayName, scenarioInfo } = props;
const urls = scenarioInfo?.urls || [];
return (
<div className="lowcode-plugin-logo">
<a className="logo" target="blank" href={props.href || 'https://lowcode-engine.cn'} style={{ backgroundImage: `url(${props.logo})` }} />
<div className="scenario-name">{scenarioDisplayName}</div>
{
urls && (
<Dropdown
className="info-dropdown"
trigger={(
<img
style={{
height: '18px',
position: 'relative',
top: '-2px',
}}
src="https://img.alicdn.com/imgextra/i4/O1CN013upU1R1yl5wVezP8k_!!6000000006618-2-tps-512-512.png"
/>
)}
triggerType="click"
>
<Menu onItemClick={(key, item) => window.open(key, '_blank')}>
{
urls.map((url: any) => <Menu.Item key={url.value}>{url.key}</Menu.Item>)
}
</Menu>
</Dropdown>
)
}
</div>
);
};
// 示例 Logo widget
const LogoSamplePlugin = (ctx: IPublicModelPluginContext, options: any) => {
return {
async init() {
const { skeleton, config } = ctx;
const scenarioName = options['scenarioName'];
const scenarioDisplayName = options['displayName'] || scenarioName;
const scenarioInfo = options['info'] || {};
// 保存在 config 中用于引擎范围其他插件使用
config.set('scenarioName', scenarioName);
config.set('scenarioDisplayName', scenarioDisplayName);
config.set('scenarioInfo', scenarioInfo);
// 注册 logo widget
skeleton.add({
area: 'topArea',
type: 'Widget',
name: 'logo',
content: <Logo scenarioDisplayName={scenarioDisplayName} scenarioInfo={scenarioInfo} />,
contentProps: {
logo: 'https://img.alicdn.com/imgextra/i4/O1CN013w2bmQ25WAIha4Hx9_!!6000000007533-55-tps-137-26.svg',
href: 'https://lowcode-engine.cn',
},
props: {
align: 'left',
},
});
},
};
}
LogoSamplePlugin.pluginName = 'LogoSamplePlugin';
LogoSamplePlugin.meta = {
dependencies: [],
preferenceDeclaration: {
title: '保存插件配置',
properties: [
{
key: 'scenarioName',
type: 'string',
description: '用于localstorage存储key',
},
{
key: 'displayName',
type: 'string',
description: '用于显示的场景名',
},
{
key: 'info',
type: 'object',
description: '用于扩展信息',
}
],
},
};
export default LogoSamplePlugin;

View File

@ -0,0 +1,29 @@
import { IPublicModelPluginContext } from "@alilc/lowcode-types";
import lowcodeSchema from './lowcode-schema.json'
const lowcodePlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { material } = ctx;
await material.loadIncrementalAssets({
version: '',
components: [{
devMode: 'lowCode',
componentName: 'LowcodeDemo',
title: '低代码组件示例',
group: '低代码组件',
schema: lowcodeSchema as any,
snippets: [{
schema: {
componentName: 'LowcodeDemo'
},
}]
}],
})
},
};
}
lowcodePlugin.pluginName = 'lowcodePlugin';
lowcodePlugin.meta = {
};
export default lowcodePlugin;

View File

@ -0,0 +1,342 @@
{
"version": "1.0.0",
"componentsMap": [
],
"componentsTree": [
{
"componentName": "Component",
"id": "node_dockcviv8fo1",
"props": {
"ref": "outerView",
"style": {
"height": "100%"
}
},
"docId": "doclaqkk3b9",
"fileName": "/",
"dataSource": {
"list": [
{
"type": "fetch",
"isInit": true,
"options": {
"params": {},
"method": "GET",
"isCors": true,
"timeout": 5000,
"headers": {},
"uri": "mock/info.json"
},
"id": "info",
"shouldFetch": {
"type": "JSFunction",
"value": "function() { \n console.log('should fetch.....');\n return true; \n}"
}
}
]
},
"state": {
"text": {
"type": "JSExpression",
"value": "\"outer\""
},
"isShowDialog": {
"type": "JSExpression",
"value": "false"
}
},
"css": "body {\n font-size: 12px;\n}\n\n.button {\n width: 100px;\n color: #ff00ff\n}",
"lifeCycles": {
"componentDidMount": {
"type": "JSFunction",
"value": "function componentDidMount() {\n console.log('did mount');\n}"
},
"componentWillUnmount": {
"type": "JSFunction",
"value": "function componentWillUnmount() {\n console.log('will unmount');\n}"
}
},
"methods": {
"testFunc": {
"type": "JSFunction",
"value": "function testFunc() {\n console.log('test func');\n}"
},
"onClick": {
"type": "JSFunction",
"value": "function onClick() {\n this.setState({\n isShowDialog: true\n });\n}"
},
"closeDialog": {
"type": "JSFunction",
"value": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}"
},
"getHelloWorldText": {
"type": "JSFunction",
"value": "function getHelloWorldText() {\n return this.i18n('i18n-jwg27yo4');\n}"
},
"getHelloWorldText2": {
"type": "JSFunction",
"value": "function getHelloWorldText2() {\n return this.i18n('i18n-jwg27yo3', {\n name: '絮黎'\n });\n}"
},
"onTestConstantsButtonClicked": {
"type": "JSFunction",
"value": "function onTestConstantsButtonClicked() {\n console.log('constants.ConstantA:', this.constants.ConstantA);\n console.log('constants.ConstantB:', this.constants.ConstantB);\n}"
},
"onTestUtilsButtonClicked": {
"type": "JSFunction",
"value": "function onTestUtilsButtonClicked() {\n this.utils.demoUtil('param1', 'param2');\n}"
}
},
"originCode": "class LowcodeComponent extends Component {\n state = {\n \"text\": \"outer\",\n \"isShowDialog\": false\n }\n componentDidMount() {\n console.log('did mount');\n }\n componentWillUnmount() {\n console.log('will unmount');\n }\n testFunc() {\n console.log('test func');\n }\n onClick() {\n this.setState({\n isShowDialog: true\n });\n }\n closeDialog() {\n this.setState({\n isShowDialog: false\n });\n }\n getHelloWorldText() {\n return this.i18n('i18n-jwg27yo4');\n }\n getHelloWorldText2() {\n return this.i18n('i18n-jwg27yo3', {\n name: '絮黎',\n });\n }\n onTestConstantsButtonClicked() {\n console.log('constants.ConstantA:', this.constants.ConstantA);\n console.log('constants.ConstantB:', this.constants.ConstantB);\n\t}\n\tonTestUtilsButtonClicked(){\n this.utils.demoUtil('param1', 'param2');\n\t}\n}",
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextRowColContainer",
"id": "node_oclawu71ac3",
"docId": "doclawu75i0",
"props": {
"rowGap": 20,
"colGap": 20
},
"title": "行列容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextRow",
"id": "node_oclawu71ac4",
"docId": "doclawu75i0",
"props": {},
"title": "行",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextCol",
"id": "node_oclawu71ac5",
"docId": "doclawu75i0",
"props": {
"colSpan": 1
},
"title": "列",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextP",
"id": "node_oclawu71ac3n",
"docId": "doclawu71ac",
"props": {
"wrap": false,
"type": "body2",
"verAlign": "middle",
"textSpacing": true,
"align": "left",
"prefix": "",
"full": false,
"flex": false
},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "Button",
"id": "node_oclawu71ac3o",
"docId": "doclawu71ac",
"props": {
"prefix": "next-",
"type": "primary",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": "constants",
"iconSize": "xxs",
"loading": false,
"text": false,
"warning": false,
"disabled": false,
"ref": "button-4951c2d3",
"__events": {
"eventDataList": [
{
"type": "componentEvent",
"name": "onClick",
"relatedEventName": "onTestConstantsButtonClicked"
}
],
"eventList": [
{
"name": "onClick",
"description": "点击按钮的回调\n@param {Object} e Event Object",
"disabled": true
},
{
"name": "onMouseUp",
"disabled": false
}
]
},
"onClick": {
"type": "JSFunction",
"value": "function(){this.onTestConstantsButtonClicked.apply(this,Array.prototype.slice.call(arguments).concat([])) }"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "Button",
"id": "node_oclawu71ac3p",
"docId": "doclawu71ac",
"props": {
"prefix": "next-",
"type": "primary",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": "utils",
"iconSize": "xxs",
"loading": false,
"text": false,
"warning": false,
"disabled": false,
"__events": {
"eventDataList": [
{
"type": "componentEvent",
"name": "onClick",
"relatedEventName": "onTestUtilsButtonClicked"
}
],
"eventList": [
{
"name": "onClick",
"description": "点击按钮的回调\n@param {Object} e Event Object",
"disabled": true
},
{
"name": "onMouseUp",
"disabled": false
}
]
},
"onClick": {
"type": "JSFunction",
"value": "function(){this.onTestUtilsButtonClicked.apply(this,Array.prototype.slice.call(arguments).concat([])) }"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
}
]
},
{
"componentName": "NextP",
"id": "node_oclaqjdn9qv",
"docId": "doclaqjdn9q",
"props": {
"wrap": false,
"type": "body2",
"verAlign": "middle",
"textSpacing": true,
"align": "left",
"prefix": "",
"full": false,
"flex": false
},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_oclaqjdn9qw",
"docId": "doclaqjdn9q",
"props": {
"type": "h5",
"children": {
"type": "JSExpression",
"value": "this.getHelloWorldText()",
"mock": "标题标题"
},
"prefix": "",
"classname": "",
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "NextText",
"id": "node_oclarv0wja2",
"docId": "doclarv56xh",
"props": {
"type": "h5",
"children": {
"type": "JSExpression",
"value": "this.getHelloWorldText2()",
"mock": "另一个i18n"
},
"prefix": "",
"classname": "",
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
],
"i18n": {
"zh-CN": {
"i18n-jwg27yo4": "你好 ",
"i18n-jwg27yo3": "{name} 博士"
},
"en-US": {
"i18n-jwg27yo4": "Hello ",
"i18n-jwg27yo3": "Doctor {name}"
}
}
}

View File

@ -0,0 +1,37 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Button } from '@alifd/next';
// 保存功能示例
const PreviewSamplePlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { skeleton, config, workspace } = ctx;
const doPreview = () => {
const scenarioName = config.get('scenarioName');
workspace.windows.forEach(d => d.save());
setTimeout(() => {
const search = location.search ? `${location.search}&scenarioName=${scenarioName}` : `?scenarioName=${scenarioName}`;
window.open(`./preview.html${search}`);
}, 500);
};
skeleton.add({
name: 'previewSample',
area: 'topArea',
type: 'Widget',
props: {
align: 'right',
},
content: (
<Button type="primary" onClick={() => doPreview()}>
</Button>
),
});
},
};
}
PreviewSamplePlugin.pluginName = 'PreviewSamplePlugin';
PreviewSamplePlugin.meta = {
dependencies: [],
};
export default PreviewSamplePlugin;

View File

@ -0,0 +1,34 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Button } from '@alifd/next';
import {
resetSchema,
} from '../../services/mockService';
// 保存功能示例
const ResetPlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { skeleton, hotkey, config, workspace } = ctx;
const scenarioName = config.get('scenarioName');
skeleton.add({
name: 'resetSchema',
area: 'topArea',
type: 'Widget',
props: {
align: 'right',
},
content: (
<Button onClick={() => resetSchema(scenarioName)}>
</Button>
),
});
},
};
}
ResetPlugin.pluginName = 'ResetPlugin';
ResetPlugin.meta = {
dependencies: [],
};
export default ResetPlugin;

View File

@ -0,0 +1,59 @@
import { IPublicModelPluginContext, IPublicResourceData } from '@alilc/lowcode-types';
import { getResourceListFromLocalStorage, setResourceListToLocalStorage } from '../../services/mockService';
export function pluginResourceData(ctx: IPublicModelPluginContext) {
const { workspace } = ctx;
function updateResourceList(list: {
title: string;
slug: string;
}[]) {
workspace.setResourceList([
...list.map((d) => ({
resourceName: 'page',
title: d.title,
id: d.slug,
category: '页面',
config: {
},
options: {
title: d.title,
slug: d.slug,
id: d.slug
},
} as IPublicResourceData)),
])
}
return {
exports() {
const scenarioName = ctx.config.get('scenarioName');
return {
update(list: {
title: string;
slug: string;
}[]) {
setResourceListToLocalStorage(scenarioName, list);
updateResourceList(list);
}
}
},
async init() {
const scenarioName = ctx.config.get('scenarioName');
const pageList: {
title: string;
slug: string;
id: string,
}[] = await getResourceListFromLocalStorage(scenarioName)
setResourceListToLocalStorage(scenarioName, pageList);
updateResourceList(pageList);
},
}
}
pluginResourceData.pluginName = 'pluginResourceData';
export default pluginResourceData;

View File

@ -0,0 +1,44 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Button } from '@alifd/next';
import {
resetSchema,
} from '../../services/mockService';
// 保存功能示例
const SaveSamplePlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { skeleton, hotkey, config, workspace } = ctx;
const scenarioName = config.get('scenarioName');
skeleton.add({
name: 'saveSample',
area: 'topArea',
type: 'Widget',
props: {
align: 'right',
},
content: (
<Button onClick={() => {
workspace.windows.forEach(d => {
d.save();
})
}}>
</Button>
),
});
hotkey.bind('command+s', (e) => {
e.preventDefault();
workspace.windows.forEach(d => {
d.save();
})
});
},
};
}
SaveSamplePlugin.pluginName = 'SaveSamplePlugin';
SaveSamplePlugin.meta = {
dependencies: [],
};
export default SaveSamplePlugin;

View File

@ -0,0 +1,54 @@
import React from 'react';
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Select } from '@alifd/next';
const Option = Select.Option;
export interface IProps {
currentLocale: string;
onChange: (value: string) => void;
}
const LocaleSelect: React.FC<IProps> = (props): React.ReactElement => {
const { currentLocale, onChange } = props;
const currentLocaleValue = currentLocale || 'zh-CN';
return (
<div className="lowcode-plugin-simulator-locale-select">
<Select
id="select"
onChange={onChange}
defaultValue={currentLocaleValue}
aria-label="切换画布区域 locale"
style={{marginRight: 8}}
>
<Option value="zh-CN"></Option>
<Option value="en-US">English</Option>
</Select>
</div>
);
};
// 画布区域语言切换
const SimulatorLocalePlugin = (ctx: IPublicModelPluginContext) => {
return {
async init() {
const { project, skeleton, config } = ctx;
const currentLocale = project.simulatorHost?.get('locale') || 'zh-CN';
const onLocaleChange = (value: string): void => {
config.set('locale', value);
}
skeleton.add({
area: 'topArea',
type: 'Widget',
name: 'simulatorLocale',
content: <LocaleSelect currentLocale={currentLocale} onChange={onLocaleChange} />,
props: {
align: 'center',
},
});
},
};
}
SimulatorLocalePlugin.pluginName = 'SimulatorLocalePlugin';
SimulatorLocalePlugin.meta = {
};
export default SimulatorLocalePlugin;

View File

@ -0,0 +1,19 @@
.workspace-empty {
color: #8f9aa9;
background-color: #f7f8fa;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
&-logo {
margin-bottom: 29px;
display: flex;
&-img {
display: block;
height: 100px;
}
}
}

View File

@ -0,0 +1,18 @@
import React from "react";
import { CommonIcon, ShiftIcon } from './icon';
import './empty.scss';
import { IPublicModelPluginContext } from "@alilc/lowcode-types";
export function Empty(props: {
pluginContext: IPublicModelPluginContext;
}) {
return (
<div className="workspace-empty">
<div className="workspace-empty-box">
<div className="workspace-empty-logo">
<img className="workspace-empty-logo-img" src="https://img.alicdn.com/imgextra/i4/O1CN013w2bmQ25WAIha4Hx9_!!6000000007533-55-tps-137-26.svg"></img>
</div>
</div>
</div>
)
}

View File

@ -0,0 +1,52 @@
export function Logo() {
return (
<svg width="81px" height="81px" viewBox="0 0 81 81" version="1.1" xmlns="http://www.w3.org/2000/svg">
<title> 2</title>
<g id="初始状态" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.530575707">
<g id="画板" transform="translate(-588.000000, -372.000000)" fill="#D3DAE3">
<g id="编组-2" transform="translate(588.388365, 372.538369)">
<path d="M25.3304335,7.82094153 L25.3304335,31.7666377 C27.2283835,29.3039443 29.289407,27.4254328 31.5135039,26.1311031 C33.7376009,24.8367734 36.1690233,24.1008728 38.8077712,23.9234012 L70.8558558,23.9234012 L50.8385469,3.99345618 C47.9069733,1.47489232 44.400095,0.145500153 40.3179118,0.00527967345 C36.3899773,-0.0950426446 32.6516653,1.23434953 29.1029758,3.99345618 L25.3304335,7.82094153 Z" id="路径-2"></path>
<path d="M8.89593439,55.6015154 L8.89593439,79.9425831 C10.7938844,77.4798897 12.8549079,75.6013782 15.0790048,74.3070485 C17.3031018,73.0127188 19.7345242,72.2768182 22.3732722,72.0993466 L54.6655619,72.0993466 L34.3380382,51.7733084 C32.7844759,50.6534991 31.5711886,49.891734 30.6981763,49.488013 C28.5630972,48.5006544 26.1059193,47.9207718 24.490615,47.8837077 C23.2945098,47.8562623 20.7832074,47.8562623 18.1510026,48.7216532 C17.2449331,49.0195419 15.7059197,49.791848 13.5339623,51.0385713 L8.89593439,55.6015154 Z" id="路径-2" transform="translate(31.780748, 63.909310) rotate(180.000000) translate(-31.780748, -63.909310) "></path>
<path d="M41.8166175,39.946852 L41.8166175,63.9288937 C43.7145675,61.4662003 45.775591,59.5876888 47.9996879,58.2933591 C50.2237849,56.9990294 52.6377725,56.3856502 55.2416507,56.4532216 L86.8278179,56.4532216 L66.488288,36.1906641 C63.0898975,33.7791074 59.614075,32.573329 56.0608208,32.573329 C52.5075665,32.573329 49.1503412,33.6718259 45.9891448,35.8688195 L41.8166175,39.946852 Z" id="路径-2" transform="translate(64.322218, 48.251111) rotate(90.000000) translate(-64.322218, -48.251111) "></path>
<path d="M-6.56860415,23.5499066 L-6.56860415,47.5803247 C-4.70917687,45.1176314 -2.68998604,43.2391198 -0.511031668,41.9447902 C1.6679227,40.6504605 4.04999448,39.9145598 6.63518366,39.7370882 L37.9201642,39.7370882 L18.8954083,20.6769658 C15.9246181,17.8318526 12.3383866,16.3513366 8.13671404,16.2354177 C3.93504143,16.1194987 0.0835010089,17.5183863 -3.41790723,20.4320804 L-6.56860415,23.5499066 Z" id="路径-2" transform="translate(15.675780, 31.904545) rotate(270.000000) translate(-15.675780, -31.904545) "></path>
</g>
</g>
</g>
</svg>
)
}
export function ShiftIcon() {
return (
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="初始状态" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="画板" transform="translate(-759.000000, -490.000000)" fill="#A5B0BF" fill-rule="nonzero">
<g id="编组-2" transform="translate(616.000000, 351.000000)">
<g id="编组" transform="translate(143.000000, 139.000000)">
<rect id="矩形" opacity="0" x="0" y="0" width="12" height="12"></rect>
<path d="M4.45071429,10.6607143 L7.54928571,10.6607143 C8.25257142,10.6607143 8.62928571,10.2488571 8.62928571,9.58585714 L8.62928571,7.33585714 L10.6733571,7.33585714 C11.0800714,7.33585714 11.4015,7.08471429 11.4015,6.70307143 C11.4015,6.46714287 11.2857857,6.29121429 11.1002143,6.11057143 L6.62035714,1.64571429 C6.42942858,1.44985714 6.2235,1.33928571 6.00257143,1.33928571 C5.7765,1.33928571 5.57571429,1.44985714 5.37964286,1.64571429 L0.9,6.11057143 C0.709285711,6.30128572 0.598714289,6.46714287 0.598714289,6.70307143 C0.598714289,7.08492858 0.920142855,7.33585714 1.332,7.33585714 L3.37092857,7.33585714 L3.37092857,9.58585714 C3.37092857,10.2488571 3.74764286,10.6607143 4.45092857,10.6607143 L4.45071429,10.6607143 Z M4.53107143,9.88221429 C4.34014287,9.88221429 4.20964287,9.7515 4.20964286,9.56592857 L4.20964286,6.74828571 C4.20964286,6.62271428 4.16442857,6.5775 4.04378571,6.5775 L1.72864286,6.5775 C1.69328571,6.5775 1.67335714,6.5625 1.67335714,6.53742857 C1.67335714,6.51728571 1.67828571,6.50228571 1.70335714,6.47721429 L5.89692857,2.30871429 C5.92224207,2.27622162 5.96138997,2.25756086 6.00257143,2.25833266 C6.03771429,2.25833266 6.06792858,2.26842858 6.108,2.30871429 L10.3015714,6.47721429 C10.3217143,6.50228572 10.3317857,6.51728572 10.3317857,6.53721429 C10.3317857,6.5625 10.3116429,6.5775 10.2765,6.5775 L7.95642857,6.5775 C7.83578571,6.5775 7.79078571,6.62271429 7.79078571,6.74828571 L7.79078571,9.56592857 C7.79078571,9.74657142 7.65514286,9.88221429 7.46935714,9.88221429 L4.53107143,9.88221429 Z" id="形状"></path>
</g>
</g>
</g>
</g>
</svg>
)
}
export function CommonIcon() {
return (
<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="初始状态" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="画板" transform="translate(-781.000000, -490.000000)" fill="#A5B0BF" fill-rule="nonzero">
<g id="编组-2" transform="translate(616.000000, 351.000000)">
<g id="编组" transform="translate(165.000000, 139.000000)">
<rect id="矩形" opacity="0" x="0" y="0" width="12" height="12"></rect>
<path d="M9,1.00008 C9.55216,1.00008 10.02352,1.19536 10.41408,1.58592 C10.80464,1.97648 10.99992,2.44784 10.99992,3 C10.99992,3.55216 10.80464,4.02352 10.41408,4.41408 C10.02352,4.80464 9.55216,4.99992 9,4.99992 L7.99992,4.99992 L7.99992,6.99984 L9,6.99984 C9.55216,6.99984 10.02352,7.19512 10.41408,7.58568 C10.80464,7.97624 10.99992,8.4476 10.99992,8.99976 C10.99992,9.55192 10.80464,10.02328 10.41408,10.41384 C10.02352,10.8044 9.55216,10.99968 9,10.99968 C8.44784,10.99968 7.97648,10.8044 7.58592,10.41384 C7.19536,10.02328 7.00008,9.55192 7.00008,8.99976 L7.00008,7.99968 L5.00016,7.99968 L5.00016,8.99976 C5.00016,9.55192 4.80488,10.02328 4.41432,10.41384 C4.02376,10.8044 3.5524,10.99968 3.00024,10.99968 C2.44808,10.99968 1.97672,10.8044 1.58616,10.41384 C1.1956,10.02328 1.00032,9.55192 1.00032,8.99976 C1.00032,8.4476 1.1956,7.97624 1.58616,7.58568 C1.97672,7.19512 2.44808,6.99984 3.00024,6.99984 L4.00032,6.99984 L4.00032,4.99992 L3.00024,4.99992 C2.44808,4.99992 1.97672,4.80464 1.58616,4.41408 C1.1956,4.02352 1.00032,3.55216 1.00032,3 C1.00032,2.44784 1.1956,1.97648 1.58616,1.58592 C1.97672,1.19536 2.44808,1.00008 3.00024,1.00008 C3.5524,1.00008 4.02376,1.19536 4.41432,1.58592 C4.80488,1.97648 5.00016,2.44784 5.00016,3 L5.00016,4.00008 L7.00008,4.00008 L7.00008,3 C7.00008,2.44784 7.19536,1.97648 7.58592,1.58592 C7.97648,1.19536 8.44784,1.00008 9,1.00008 L9,1.00008 Z M4.00008,9 L4.00008,7.99992 L3,7.99992 C2.724,7.99992 2.48832,8.0976 2.29296,8.29296 C2.0976,8.48832 1.99992,8.724 1.99992,9 C1.99992,9.276 2.0976,9.51168 2.29296,9.70704 C2.48832,9.9024 2.724,10.00008 3,10.00008 C3.276,10.00008 3.51168,9.9024 3.70704,9.70704 C3.9024,9.51168 4.00008,9.276 4.00008,9 L4.00008,9 Z M3,1.99992 C2.724,1.99992 2.48832,2.0976 2.29296,2.29296 C2.0976,2.48832 1.99992,2.724 1.99992,3 C1.99992,3.276 2.0976,3.51168 2.29296,3.70704 C2.48832,3.9024 2.724,4.00008 3,4.00008 L4.00008,4.00008 L4.00008,3 C4.00008,2.724 3.9024,2.48832 3.70704,2.29296 C3.51168,2.0976 3.276,1.99992 3,1.99992 L3,1.99992 Z M7.00008,7.00008 L7.00008,5.00016 L5.00016,5.00016 L5.00016,7.00008 L7.00008,7.00008 Z M9,7.99992 L7.99992,7.99992 L7.99992,9 C7.99992,9.276 8.0976,9.51168 8.29296,9.70704 C8.48832,9.9024 8.724,10.00008 9,10.00008 C9.276,10.00008 9.51168,9.9024 9.70704,9.70704 C9.9024,9.51168 10.00008,9.276 10.00008,9 C10.00008,8.724 9.9024,8.48832 9.70704,8.29296 C9.51168,8.0976 9.276,7.99992 9,7.99992 Z M9,1.99992 C8.724,1.99992 8.48832,2.0976 8.29296,2.29296 C8.0976,2.48832 7.99992,2.724 7.99992,3 L7.99992,4.00008 L9,4.00008 C9.276,4.00008 9.51168,3.9024 9.70704,3.70704 C9.9024,3.51168 10.00008,3.276 10.00008,3 C10.00008,2.724 9.9024,2.48832 9.70704,2.29296 C9.51168,2.0976 9.276,1.99992 9,1.99992 Z" id="形状"></path>
</g>
</g>
</g>
</g>
</svg>
)
}

View File

@ -0,0 +1,32 @@
import { IPublicModelPluginContext } from '@alilc/lowcode-types';
import { Empty } from './empty';
import React from 'react';
export interface PreviewPaneOptions {
applicationCode: string;
branchId: string;
routerMode: string;
deployConfig: Record<string, string>;
}
const plugin = (ctx: IPublicModelPluginContext, options: PreviewPaneOptions) => {
const { config, workspace } = ctx;
return {
init() {
workspace.onResourceListChange(() => {
config.set('workspaceEmptyComponent', () => <Empty pluginContext={ctx} />);
});
},
};
};
plugin.pluginName = 'workspaceEmpty';
plugin.meta = {
dependencies: [],
engines: {
lowcodeEngine: '^1.0.0', // 插件需要配合 ^1.0.0 的引擎才可运行
},
};
export default plugin;

View File

@ -0,0 +1,162 @@
import ReactDOM from 'react-dom';
import React, { useState } from 'react';
import { Loading, Shell, Search, Nav } from '@alifd/next';
import mergeWith from 'lodash/mergeWith';
import isArray from 'lodash/isArray';
import { buildComponents, assetBundle, AssetLevel, AssetLoader } from '@alilc/lowcode-utils';
import ReactRenderer from '@alilc/lowcode-react-renderer';
import { injectComponents } from '@alilc/lowcode-plugin-inject';
import appHelper from './appHelper';
import { getProjectSchemaFromLocalStorage, getPackagesFromLocalStorage, getPreviewLocale, setPreviewLocale, getResourceListFromLocalStorage } from './services/mockService';
const getScenarioName = function () {
if (location.search) {
return new URLSearchParams(location.search.slice(1)).get('scenarioName') || 'general';
}
return 'general';
}
const SamplePreview = () => {
const [data, setData] = useState({});
const [schema, setSchema] = useState()
const [activeNav, setActiveNav] = useState()
const scenarioName = getScenarioName();
async function init() {
const resourceList = await getResourceListFromLocalStorage(scenarioName);
const id = resourceList?.[0].id;
const packages = getPackagesFromLocalStorage(scenarioName, id);
const projectSchema = getProjectSchemaFromLocalStorage(scenarioName, id);
const {
componentsMap: componentsMapArray,
componentsTree,
i18n,
dataSource: projectDataSource,
} = projectSchema;
const componentsMap: any = {};
componentsMapArray.forEach((component: any) => {
componentsMap[component.componentName] = component;
});
const pageSchema = componentsTree[0];
const libraryMap = {};
const libraryAsset = [];
packages.forEach(({ package: _package, library, urls, renderUrls }) => {
libraryMap[_package] = library;
if (renderUrls) {
libraryAsset.push(renderUrls);
} else if (urls) {
libraryAsset.push(urls);
}
});
const vendors = [assetBundle(libraryAsset, AssetLevel.Library)];
// TODO asset may cause pollution
const assetLoader = new AssetLoader();
await assetLoader.load(libraryAsset);
const components = await injectComponents(buildComponents(libraryMap, componentsMap));
setSchema(pageSchema);
console.log('id', id, resourceList);
setActiveNav(id);
setData({
// schema: pageSchema,
components,
i18n,
projectDataSource,
resourceList,
});
}
const { components, i18n = {}, projectDataSource = {} } = data as any;
if (!schema || !components) {
init();
return <Loading fullScreen />;
}
const currentLocale = getPreviewLocale(getScenarioName());
if (!(window as any).setPreviewLocale) {
// for demo use only, can use this in console to switch language for i18n test
// 在控制台 window.setPreviewLocale('en-US') 或 window.setPreviewLocale('zh-CN') 查看切换效果
(window as any).setPreviewLocale = (locale:string) => setPreviewLocale(getScenarioName(), locale);
}
function customizer(objValue: [], srcValue: []) {
if (isArray(objValue)) {
return objValue.concat(srcValue || []);
}
}
console.log('activeNav', activeNav);
return (
<div className="lowcode-plugin-sample-preview">
<Shell
className={"iframe-hack"}
device="desktop"
style={{ border: "1px solid #eee" }}
>
<Shell.Branding>
<div className="rectangular"></div>
<span style={{ marginLeft: 10 }}>App Name</span>
</Shell.Branding>
<Shell.Navigation direction="hoz">
<Search
key="2"
shape="simple"
type="dark"
palceholder="Search"
style={{ width: "200px" }}
/>
</Shell.Navigation>
<Shell.Navigation>
<Nav
embeddable
aria-label="global navigation"
defaultSelectedKeys={[activeNav]}
>
{
data?.resourceList?.map((d) => (
<Nav.Item
key={d.id}
onClick={() => {
const projectSchema = getProjectSchemaFromLocalStorage(scenarioName, d.id);
console.log('setSchema', d.id, projectSchema?.componentsTree[0]);
setSchema(projectSchema?.componentsTree[0])
}}
icon="account"
>{d.title}</Nav.Item>
))
}
</Nav>
</Shell.Navigation>
<Shell.Content>
<div style={{ minHeight: 1200, background: "#fff" }}>
<ReactRenderer
className="lowcode-plugin-sample-preview-content"
schema={{
...schema,
dataSource: mergeWith(schema.dataSource, projectDataSource, customizer),
}}
components={components}
locale={currentLocale}
messages={i18n}
appHelper={appHelper}
/>
</div>
</Shell.Content>
</Shell>
</div>
);
};
ReactDOM.render(<SamplePreview />, document.getElementById('ice-container'));

View File

@ -0,0 +1,140 @@
{
"packages": [
{
"package": "moment",
"version": "2.24.0",
"urls": [
"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"
],
"library": "moment"
},
{
"package": "lodash",
"library": "_",
"urls": [
"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js"
]
},
{
"title": "fusion组件库",
"package": "@alifd/next",
"version": "1.26.4",
"urls": [
"https://g.alicdn.com/code/lib/alifd__next/1.26.4/next.min.css",
"https://g.alicdn.com/code/lib/alifd__next/1.26.4/next-with-locales.min.js"
],
"library": "Next"
},
{
"title": "NextTable",
"package": "NextTable",
"version": "1.0.1",
"urls": [
"https://g.alicdn.com/fusion-platform/pro-table/1.0.1/next-table.js",
"https://g.alicdn.com/fusion-platform/pro-table/1.0.1/next-table.css"
],
"library": "NextTable"
},
{
"package": "@alilc/lowcode-materials",
"version": "1.0.7",
"library": "AlilcLowcodeMaterials",
"urls": [
"https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/dist/AlilcLowcodeMaterials.js",
"https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/dist/AlilcLowcodeMaterials.css"
],
"editUrls": [
"https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/build/lowcode/view.js",
"https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/build/lowcode/view.css"
]
},
{
"package": "@alifd/layout",
"version": "2.0.12",
"library": "AlifdLayout",
"urls": [
"https://alifd.alicdn.com/npm/@alifd/layout@2.0.12/dist/AlifdLayout.js",
"https://alifd.alicdn.com/npm/@alifd/layout@2.0.12/dist/AlifdLayout.css"
],
"editUrls": [
"https://alifd.alicdn.com/npm/@alifd/layout@2.0.12/build/lowcode/view.js",
"https://alifd.alicdn.com/npm/@alifd/layout@2.0.12/build/lowcode/view.css"
]
},
{
"package": "@alifd/fusion-ui",
"version": "2.0.2",
"library": "AlifdFusionUi",
"urls": [
"https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/dist/AlifdFusionUi.js",
"https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/dist/AlifdFusionUi.css"
],
"editUrls": [
"https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/build/lowcode/view.js",
"https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/build/lowcode/view.css"
]
}
],
"components": [
{
"exportName": "AlilcLowcodeMaterialsMeta",
"npm": {
"package": "@alilc/lowcode-materials"
},
"url": "https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/build/lowcode/meta.js",
"urls": {
"default": "https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/build/lowcode/meta.js",
"design": "https://alifd.alicdn.com/npm/@alilc/lowcode-materials@1.0.7/build/lowcode/meta.design.js"
}
},
{
"exportName": "AlifdLayoutMeta",
"npm": {
"package": "@alifd/layout",
"version": "2.0.12"
},
"url": "https://alifd.alicdn.com/npm/@alifd/layout@2.0.12/build/lowcode/meta.js",
"urls": {
"default": "https://alifd.alicdn.com/npm/@alifd/layout@2.0.12/build/lowcode/meta.js"
}
},
{
"exportName": "AlifdFusionUiMeta",
"npm": {
"package": "@alifd/fusion-ui"
},
"url": "https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/build/lowcode/meta.js",
"urls": {
"default": "https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/build/lowcode/meta.js",
"design": "https://alifd.alicdn.com/npm/@alifd/fusion-ui@2.0.2/build/lowcode/meta.design.js"
}
}
],
"sort": {
"groupList": [
"精选组件",
"原子组件",
"低代码组件"
],
"categoryList": [
"基础元素",
"布局容器类",
"表格类",
"表单详情类",
"帮助类",
"对话框类",
"业务类",
"通用",
"引导",
"信息输入",
"信息展示",
"信息反馈"
]
},
"groupList": [
"精选组件",
"原子组件",
"低代码组件"
],
"ignoreComponents": {}
}

View File

@ -0,0 +1,10 @@
{
"zh-CN": {
"i18n-jwg27yo4": "你好 ",
"i18n-jwg27yo3": "{name} 博士"
},
"en-US": {
"i18n-jwg27yo4": "Hello ",
"i18n-jwg27yo3": "Doctor {name}"
}
}

View File

@ -0,0 +1,580 @@
{
"componentName": "Page",
"id": "node_dockcviv8fo1",
"props": {
"ref": "outerView",
"style": {
"height": "100%"
}
},
"docId": "doclaqkk3b9",
"fileName": "/",
"dataSource": {
"list": [
{
"type": "fetch",
"isInit": true,
"options": {
"params": {},
"method": "GET",
"isCors": true,
"timeout": 5000,
"headers": {},
"uri": "mock/info.json"
},
"id": "info",
"shouldFetch": {
"type": "JSFunction",
"value": "function() { \n console.log('should fetch.....');\n return true; \n}"
}
}
]
},
"state": {
"text": {
"type": "JSExpression",
"value": "\"outer\""
},
"isShowDialog": {
"type": "JSExpression",
"value": "false"
}
},
"css": "body {\n font-size: 12px;\n}\n\n.button {\n width: 100px;\n color: #ff00ff\n}",
"lifeCycles": {
"componentDidMount": {
"type": "JSFunction",
"value": "function componentDidMount() {\n console.log('did mount');\n}"
},
"componentWillUnmount": {
"type": "JSFunction",
"value": "function componentWillUnmount() {\n console.log('will unmount');\n}"
}
},
"methods": {
"testFunc": {
"type": "JSFunction",
"value": "function testFunc() {\n console.log('test func');\n}"
},
"onClick": {
"type": "JSFunction",
"value": "function onClick() {\n this.setState({\n isShowDialog: true\n });\n}"
},
"closeDialog": {
"type": "JSFunction",
"value": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}"
},
"getHelloWorldText": {
"type": "JSFunction",
"value": "function getHelloWorldText() {\n return this.i18n('i18n-jwg27yo4');\n}"
},
"getHelloWorldText2": {
"type": "JSFunction",
"value": "function getHelloWorldText2() {\n return this.i18n('i18n-jwg27yo3', {\n name: '絮黎'\n });\n}"
},
"onTestConstantsButtonClicked": {
"type": "JSFunction",
"value": "function onTestConstantsButtonClicked() {\n console.log('constants.ConstantA:', this.constants.ConstantA);\n console.log('constants.ConstantB:', this.constants.ConstantB);\n}"
},
"onTestUtilsButtonClicked": {
"type": "JSFunction",
"value": "function onTestUtilsButtonClicked() {\n this.utils.demoUtil('param1', 'param2');\n}"
}
},
"originCode": "class LowcodeComponent extends Component {\n state = {\n \"text\": \"outer\",\n \"isShowDialog\": false\n }\n componentDidMount() {\n console.log('did mount');\n }\n componentWillUnmount() {\n console.log('will unmount');\n }\n testFunc() {\n console.log('test func');\n }\n onClick() {\n this.setState({\n isShowDialog: true\n });\n }\n closeDialog() {\n this.setState({\n isShowDialog: false\n });\n }\n getHelloWorldText() {\n return this.i18n('i18n-jwg27yo4');\n }\n getHelloWorldText2() {\n return this.i18n('i18n-jwg27yo3', {\n name: '絮黎',\n });\n }\n onTestConstantsButtonClicked() {\n console.log('constants.ConstantA:', this.constants.ConstantA);\n console.log('constants.ConstantB:', this.constants.ConstantB);\n\t}\n\tonTestUtilsButtonClicked(){\n this.utils.demoUtil('param1', 'param2');\n\t}\n}",
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDPage",
"id": "node_oclfjpfqjy5",
"props": {
"contentProps": {
"style": {
"background": "rgba(255,255,255,0)"
}
},
"ref": "fdpage-bb43fbb0"
},
"title": "页面",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDSection",
"id": "node_oclfjpfqjy6",
"props": {
"style": {
"backgroundColor": "rgba(255,255,255,1)",
"minHeight": ""
}
},
"title": "区域",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDBlock",
"id": "node_oclfjpfqjy7",
"props": {
"mode": "transparent",
"span": 12
},
"title": "区块",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDCell",
"id": "node_oclfjpfqjy8",
"props": {
"align": "left",
"verAlign": "top",
"style": {
"backgroundColor": "rgba(255,255,255,1)"
},
"width": ""
},
"title": "容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDP",
"id": "node_oclfjpfqjy10",
"props": {},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_oclfjpfqjyz",
"props": {
"type": "h1",
"children": "Home",
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": "",
"style": {
"fontSize": "25px"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
},
{
"componentName": "FDBlock",
"id": "node_oclfjpfqjy9",
"props": {
"mode": "transparent",
"span": 12,
"style": {
"backgroundColor": "rgba(255,255,255,1)",
"minHeight": ""
}
},
"title": "区块",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDRow",
"id": "node_oclfjpfqjy11",
"props": {
"style": {
"backgroundColor": "rgba(255,255,255,1)"
}
},
"title": "行容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDCell",
"id": "node_oclfjpfqjya",
"props": {
"align": "left",
"verAlign": "top",
"style": {
"backgroundColor": "rgba(255,255,255,1)"
},
"width": ""
},
"title": "容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDP",
"id": "node_oclfjqcdwn14",
"props": {},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_oclfjqcdwn13",
"props": {
"type": "h5",
"children": "多语言展示",
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": "",
"style": {
"fontSize": "18px"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
},
{
"componentName": "FDP",
"id": "node_oclfjqcdwn2k",
"props": {},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_oclfjqcdwn2j",
"props": {
"type": "inherit",
"children": {
"type": "JSExpression",
"value": "this.getHelloWorldText()",
"mock": ""
},
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": ""
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "NextText",
"id": "node_oclfjqcf7z15",
"props": {
"type": "inherit",
"children": {
"type": "JSExpression",
"value": "this.getHelloWorldText2()",
"mock": "基于 Ali-Lowcode-Engine 快速打造高生产力的低代码研发平台, 基于自然布局体系快速搭建页面"
},
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": ""
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
},
{
"componentName": "FDCell",
"id": "node_oclfjpfqjy12",
"props": {
"align": "left",
"verAlign": "top",
"style": {
"backgroundColor": "rgba(255,255,255,1)"
}
},
"title": "容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDP",
"id": "node_oclfjqcf7z2h",
"props": {},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_oclfjqcf7z2g",
"props": {
"type": "h5",
"children": "交互展示",
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": "",
"style": {
"fontSize": "18px"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
},
{
"componentName": "FDP",
"id": "node_oclfjqcf7z2l",
"props": {},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "Button",
"id": "node_oclfjqcf7z2k",
"props": {
"prefix": "next-",
"type": "primary",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": "constants",
"iconSize": "xxs",
"loading": false,
"text": false,
"warning": false,
"disabled": false,
"ref": "button-4951c2d3",
"__events": {
"eventDataList": [
{
"type": "componentEvent",
"name": "onClick",
"relatedEventName": "onTestConstantsButtonClicked"
}
],
"eventList": [
{
"name": "onClick",
"description": "点击按钮的回调\n@param {Object} e Event Object",
"disabled": true
},
{
"name": "onMouseUp",
"disabled": false
}
]
},
"onClick": {
"type": "JSFunction",
"value": "function(){this.onTestConstantsButtonClicked.apply(this,Array.prototype.slice.call(arguments).concat([])) }"
}
},
"docId": "doclawu71ac",
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "Button",
"id": "node_oclfjqcf7z2o",
"props": {
"prefix": "next-",
"type": "primary",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": "utils",
"iconSize": "xxs",
"loading": false,
"text": false,
"warning": false,
"disabled": false,
"__events": {
"eventDataList": [
{
"type": "componentEvent",
"name": "onClick",
"relatedEventName": "onTestUtilsButtonClicked"
}
],
"eventList": [
{
"name": "onClick",
"description": "点击按钮的回调\n@param {Object} e Event Object",
"disabled": true
},
{
"name": "onMouseUp",
"disabled": false
}
]
},
"onClick": {
"type": "JSFunction",
"value": "function(){this.onTestUtilsButtonClicked.apply(this,Array.prototype.slice.call(arguments).concat([])) }"
}
},
"docId": "doclawu71ac",
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
}
]
},
{
"componentName": "FDBlock",
"id": "node_oclfjqcf7z3g",
"props": {
"mode": "transparent",
"span": 12,
"style": {
"backgroundColor": "rgba(255,255,255,1)",
"minHeight": ""
}
},
"title": "区块",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDCell",
"id": "node_oclfjqcf7z3h",
"props": {
"align": "left",
"verAlign": "top",
"style": {
"backgroundColor": "rgba(255,255,255,1)"
}
},
"title": "容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "FDP",
"id": "node_oclfjqcf7z43",
"props": {},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_oclfjqcf7z42",
"props": {
"type": "inherit",
"children": "Powered By Lowcode Engine",
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": "",
"style": {
"height": "30px",
"lineHeight": "30px",
"fontSize": "20px"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
}
]
}
]
}
]
}

View File

@ -0,0 +1,140 @@
import { material, project } from '@alilc/lowcode-engine';
import { filterPackages } from '@alilc/lowcode-plugin-inject'
import { Message, Dialog } from '@alifd/next';
import { IPublicTypeProjectSchema, IPublicEnumTransformStage, IPublicModelPluginContext } from '@alilc/lowcode-types';
import DefaultPageSchema from './defaultPageSchema.json';
import DefaultI18nSchema from './defaultI18nSchema.json';
const generateProjectSchema = (pageSchema: any, i18nSchema: any): IPublicTypeProjectSchema => {
return {
componentsTree: [pageSchema],
componentsMap: material.componentsMap as any,
version: '1.0.0',
i18n: i18nSchema,
};
}
export const saveSchema = async (scenarioName: string = 'unknown', id: string, ctx: IPublicModelPluginContext) => {
setProjectSchemaToLocalStorage(scenarioName, id, ctx);
await setPackagesToLocalStorage(scenarioName, id, ctx);
Message.success('成功保存到本地');
};
export const resetSchema = async (scenarioName: string = 'unknown') => {
try {
await new Promise<void>((resolve, reject) => {
Dialog.confirm({
content: '确定要重置吗?您所有的修改都将消失!',
onOk: () => {
resolve();
},
onCancel: () => {
reject()
},
})
})
} catch(err) {
return;
}
const defaultSchema = generateProjectSchema(DefaultPageSchema, DefaultI18nSchema);
project.importSchema(defaultSchema as any);
project.simulatorHost?.rerender();
setProjectSchemaToLocalStorage(scenarioName);
await setPackagesToLocalStorage(scenarioName);
Message.success('成功重置页面');
}
const getLSName = (scenarioName: string, id: string, ns: string = 'projectSchema') => `${scenarioName}:${id}:${ns}`;
const getResourceName = (scenarioName: string, ns: string = 'resourceList') => `${scenarioName}:${ns}`;
export const setResourceListToLocalStorage = async (scenarioName: string, list: any) => {
if (!scenarioName) {
console.error('scenarioName is required!');
return;
}
window.localStorage.setItem(
getResourceName(scenarioName),
JSON.stringify(list)
);
}
export const getResourceListFromLocalStorage = async (scenarioName: string) => {
if (!scenarioName) {
console.error('scenarioName is required!');
return;
}
return JSON.parse(window.localStorage.getItem(getResourceName(scenarioName)) || '[{"title":"首页","slug":"index","id": "index"}]');
}
export const getProjectSchemaFromLocalStorage = (scenarioName: string, id: string) => {
if (!scenarioName) {
console.error('scenarioName is required!');
return;
}
const localValue = window.localStorage.getItem(getLSName(scenarioName, id));
if (localValue) {
return JSON.parse(localValue);
}
return undefined;
}
const setProjectSchemaToLocalStorage = (scenarioName: string, id: string, ctx: IPublicModelPluginContext) => {
if (!scenarioName) {
console.error('scenarioName is required!');
return;
}
window.localStorage.setItem(
getLSName(scenarioName, id),
JSON.stringify(ctx.project.exportSchema(IPublicEnumTransformStage.Save))
);
}
const setPackagesToLocalStorage = async (scenarioName: string, id: string, ctx: IPublicModelPluginContext) => {
if (!scenarioName) {
console.error('scenarioName is required!');
return;
}
const packages = await filterPackages(ctx.material.getAssets().packages);
window.localStorage.setItem(
getLSName(scenarioName, id, 'packages'),
JSON.stringify(packages),
);
}
export const getPackagesFromLocalStorage = (scenarioName: string, id: string) => {
if (!scenarioName) {
console.error('scenarioName is required!');
return;
}
return JSON.parse(window.localStorage.getItem(getLSName(scenarioName, id, 'packages')) || '{}');
}
export const getProjectSchema = async (scenarioName: string = 'unknown') : Promise<IPublicTypeProjectSchema> => {
const pageSchema = await getPageSchema(scenarioName);
return generateProjectSchema(pageSchema, DefaultI18nSchema);
};
export const getPageSchema = async (scenarioName: string = 'unknown', id: string) => {
const pageSchema = getProjectSchemaFromLocalStorage(scenarioName, id)?.componentsTree?.[0];
if (pageSchema) {
return pageSchema;
}
return DefaultPageSchema;
};
export const getPreviewLocale = (scenarioName: string) => {
const key = getLSName(scenarioName, 'previewLocale');
return window.localStorage.getItem(key) || 'zh-CN';
}
export const setPreviewLocale = (scenarioName: string, locale: string) => {
const key = getLSName(scenarioName, 'previewLocale');
window.localStorage.setItem(key, locale || 'zh-CN');
window.location.reload();
}

View File

@ -0,0 +1,445 @@
{
"componentName": "Page",
"id": "node_dockcviv8fo1",
"docId": "doclaqkk3b9",
"props": {
"ref": "outerView",
"style": {
"height": "100%"
}
},
"fileName": "/",
"dataSource": {
"list": [
{
"type": "fetch",
"isInit": true,
"options": {
"params": {},
"method": "GET",
"isCors": true,
"timeout": 5000,
"headers": {},
"uri": "mock/info.json"
},
"id": "info",
"shouldFetch": {
"type": "JSFunction",
"value": "function() { \n console.log('should fetch.....');\n return true; \n}"
}
}
]
},
"state": {
"text": {
"type": "JSExpression",
"value": "\"outer\""
},
"isShowDialog": {
"type": "JSExpression",
"value": "false"
}
},
"css": "body {\n font-size: 12px;\n}\n\n.button {\n width: 100px;\n color: #ff00ff\n}",
"lifeCycles": {
"componentDidMount": {
"type": "JSFunction",
"value": "function componentDidMount() {\n console.log('did mount');\n}"
},
"componentWillUnmount": {
"type": "JSFunction",
"value": "function componentWillUnmount() {\n console.log('will unmount');\n}"
}
},
"methods": {
"testFunc": {
"type": "JSFunction",
"value": "function testFunc() {\n console.log('test func');\n}"
},
"onClick": {
"type": "JSFunction",
"value": "function onClick() {\n this.setState({\n isShowDialog: true\n });\n}"
},
"closeDialog": {
"type": "JSFunction",
"value": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}"
},
"onClickTestConstants": {
"type": "JSFunction",
"value": "function onClickTestConstants() {\n console.log('this.constants.ConstantA', this.constants.ConstantA);\n console.log('this.constants.ConstantB', this.constants.ConstantB);\n}"
},
"onClickTestUtils": {
"type": "JSFunction",
"value": "function onClickTestUtils() {\n this.utils.demoUtil('a', 'b');\n}"
}
},
"originCode": "class LowcodeComponent extends Component {\n state = {\n \"text\": \"outer\",\n \"isShowDialog\": false\n }\n componentDidMount() {\n console.log('did mount');\n }\n componentWillUnmount() {\n console.log('will unmount');\n }\n testFunc() {\n console.log('test func');\n }\n onClick() {\n this.setState({\n isShowDialog: true\n })\n }\n closeDialog() {\n this.setState({\n isShowDialog: false\n })\n }\n\tonClickTestConstants(){\n console.log('this.constants.ConstantA', this.constants.ConstantA);\n console.log('this.constants.ConstantB', this.constants.ConstantB);\n }\n onClickTestUtils() {\n this.utils.demoUtil('a', 'b');\n }\n}",
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextPage",
"id": "node_ockzs2vw431",
"docId": "doclaqkk3b9",
"props": {
"headerDivider": true,
"minHeight": "100vh",
"presetNav": true,
"presetAside": true,
"footer": false,
"nav": false,
"aside": false,
"placeholderStyle": {
"gridRowEnd": "span 1",
"gridColumnEnd": "span 12"
},
"headerProps": {
"background": "surface"
},
"header": {
"type": "JSSlot",
"value": {
"componentName": "NextPageHeader",
"id": "node_ockzs2vw433",
"docId": "doclaqkk3b9",
"props": {},
"title": "页面头部",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextRowColContainer",
"id": "node_ockzs2vw434",
"docId": "doclaqkk3b9",
"props": {
"rowGap": 20,
"colGap": 20
},
"title": "行列容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextRow",
"id": "node_ockzs2vw435",
"docId": "doclaqkk3b9",
"props": {},
"title": "行",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextCol",
"id": "node_ockzs2vw436",
"docId": "doclaqkk3b9",
"props": {
"colSpan": 1
},
"title": "列",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextP",
"id": "node_ockzvfoetv17",
"docId": "dockzvfoetv",
"props": {
"wrap": false,
"type": "body2",
"verAlign": "middle",
"textSpacing": true,
"align": "left"
},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextText",
"id": "node_ockzvfoetv18",
"docId": "dockzvfoetv",
"props": {
"type": "h5",
"children": {
"type": "JSExpression",
"value": "this.state.info?.info",
"mock": "标题标题"
},
"mark": false,
"code": false,
"delete": false,
"underline": false,
"strong": false,
"prefix": "",
"classname": "",
"ref": "nexttext-3a39ea8b"
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
}
]
}
]
}
},
"isTab": false,
"contentAlignCenter": false,
"contentProps": {
"style": {
"background": "rgba(255,255,255,0)"
}
},
"navProps": {
"width": 200
},
"asideProps": {
"width": 200
},
"background": "lining",
"ref": "nextpage-3cc814e7"
},
"title": "页面",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextBlock",
"id": "node_oclat5fpb6ga",
"docId": "doclat87b8r",
"props": {
"placeholderStyle": {
"height": "100%"
},
"noPadding": false,
"noBorder": false,
"title": "区域标题",
"rowGap": 20,
"colGap": 20,
"background": "surface",
"layoutmode": "O",
"strict": true,
"colSpan": 12,
"rowSpan": 1,
"mode": "transparent",
"childTotalColumns": 12
},
"title": "区域",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextBlockCell",
"id": "node_oclat5fpb6gb",
"docId": "doclat87b8r",
"props": {
"colSpan": 12,
"rowSpan": 1,
"mode": "procard",
"isAutoContainer": true,
"title": "区块标题",
"hasDivider": true,
"loading": false,
"hasCollapse": false,
"text": true,
"isFillContainer": true,
"operations": []
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextRowColContainer",
"id": "node_oclat5fpb6gc",
"docId": "doclat87b8r",
"props": {
"rowGap": 20,
"colGap": 20
},
"title": "行列容器",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextRow",
"id": "node_oclat5fpb6gd",
"docId": "doclat87b8r",
"props": {},
"title": "行",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextCol",
"id": "node_oclat5fpb6ge",
"docId": "doclat87b8r",
"props": {
"colSpan": 1
},
"title": "列",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "NextP",
"id": "node_oclat5fpb6gf",
"docId": "doclat87b8r",
"props": {
"wrap": false,
"type": "body2",
"verAlign": "middle",
"textSpacing": true,
"align": "left"
},
"title": "段落",
"hidden": false,
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "Button",
"id": "node_oclat5fpb6gg",
"docId": "doclat5fpb6",
"props": {
"prefix": "next-",
"type": "primary",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": "测试constants",
"iconSize": "xxs",
"loading": false,
"text": false,
"warning": false,
"disabled": false,
"__events": {
"eventDataList": [
{
"type": "componentEvent",
"name": "onClick",
"relatedEventName": "onClickTestConstants"
}
],
"eventList": [
{
"name": "onClick",
"description": "点击按钮的回调\n@param {Object} e Event Object",
"disabled": true
},
{
"name": "onMouseUp",
"disabled": false
}
]
},
"onClick": {
"type": "JSFunction",
"value": "function(){this.onClickTestConstants.apply(this,Array.prototype.slice.call(arguments).concat([])) }"
},
"ghost": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "Button",
"id": "node_oclat5fpb6gh",
"docId": "doclat5fpb6",
"props": {
"prefix": "next-",
"type": "primary",
"size": "medium",
"htmlType": "button",
"component": "button",
"children": "测试utils",
"iconSize": "xxs",
"loading": false,
"text": false,
"warning": false,
"disabled": false,
"ref": "button-0d20c188",
"__events": {
"eventDataList": [
{
"type": "componentEvent",
"name": "onClick",
"relatedEventName": "onClickTestUtils"
}
],
"eventList": [
{
"name": "onClick",
"description": "点击按钮的回调\n@param {Object} e Event Object",
"disabled": true
},
{
"name": "onMouseUp",
"disabled": false
}
]
},
"onClick": {
"type": "JSFunction",
"value": "function(){this.onClickTestUtils.apply(this,Array.prototype.slice.call(arguments).concat([])) }"
}
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}

View File

@ -0,0 +1,80 @@
import React from 'react';
import { Dialog, Form, Input, Button } from '@alifd/next';
import { IPublicModelPluginContext, IPublicModelResource } from '@alilc/lowcode-types';
class Controller {
pluginContext?: IPublicModelPluginContext;
init = (ctx: IPublicModelPluginContext) => {
this.pluginContext = ctx;
}
onAddPage = () => {
const dialog = Dialog.show({
v2: true,
title: "新增页面",
content: (
<Form style={{ width: "500px" }} colon>
<Form.Item
name="title"
label="页面名称"
required
>
<Input />
</Form.Item>
<Form.Item
name="slug"
label="页面标识"
required
>
<Input />
</Form.Item>
<Form.Item label="" colon={false}>
<Form.Submit
type="primary"
validate
onClick={(values, errors) => {
const list = this.pluginContext?.workspace.resourceList.map(d => d.options);
list?.push({
slug: values.slug,
title: values.title,
id: values.slug,
});
this.pluginContext?.plugins.pluginResourceData.update(list);
const resource = this.pluginContext?.workspace.resourceList.filter(d => d.id === values.slug)?.[0];
this.pluginContext?.workspace.openEditorWindow(resource);
dialog.hide();
}}
style={{ marginRight: 8 }}
>
</Form.Submit>
<Button onClick={() => {
dialog.hide()
}}></Button>
</Form.Item>
</Form>
),
footerActions: [],
})
}
onDeletePage = async (resource: IPublicModelResource) => {
Dialog.show({
v2: true,
title: "删除页面",
content: `删除页面后无法恢复,是否确定删除页面 ${resource.options.title}.`,
onOk: () => {
this.pluginContext?.workspace.removeEditorWindow(resource.name!, resource.options.id);
const list = this.pluginContext?.workspace.resourceList.map(d => d.options);
const newList = list?.filter(d => d.id !== resource.options.id)
console.log('newList', newList);
this.pluginContext?.plugins.pluginResourceData.update(newList);
},
})
}
}
export default new Controller();

View File

@ -0,0 +1,44 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"lib": ["es2015", "dom"],
// Target latest version of ECMAScript.
"target": "esnext",
// Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
"module": "esnext",
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": true,
// Report errors in .js files.
"checkJs": false,
// Don't emit; allow Babel to transform files.
// "noEmit": true,
// Enable strictest settings like strictNullChecks & noImplicitAny.
"strict": true,
// Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
"allowSyntheticDefaultImports": true,
// Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'.
"esModuleInterop": true,
// Specify JSX code generation: 'preserve', 'react-native', or 'react'.
"jsx": "preserve",
// Import emit helpers (e.g. __extends, __rest, etc..) from tslib
"importHelpers": true,
// Enables experimental support for ES7 decorators.
"experimentalDecorators": true,
// Generates corresponding .map file.
"sourceMap": true,
// Disallow inconsistently-cased references to the same file.
"forceConsistentCasingInFileNames": true,
// Allow json import
"resolveJsonModule": true,
// skip type checking of declaration files
"skipLibCheck": true,
"outDir": "lib"
},
"include": [
"./src/"
],
"exclude": ["**/test", "**/lib", "**/es", "node_modules"]
}

View File

@ -8,7 +8,6 @@
"scripts": {
"start": "build-scripts start --disable-reload --port 5556",
"build": "build-scripts build",
"prepublishOnly": "npm run build",
"pub": "node ./scripts/watchdog.js && npm pub",
"sync": "tnpm sync @alilc/lowcode-demo",
"syncOss": "node ./scripts/sync-oss.js"
@ -16,19 +15,30 @@
"files": [
"build"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"config": {},
"dependencies": {
"@alilc/lce-graph-core": "^1.0.6",
"@alilc/lce-graph-materials-pane": "^1.0.10",
"@alilc/lce-graph-tools": "^1.0.6",
"@alilc/lce-graph-x6-designer": "^1.0.6",
"@alilc/lce-graph-x6-stencil": "^1.0.6",
"@alilc/lowcode-datasource-fetch-handler": "^1.0.1",
"@alilc/lowcode-plugin-code-editor": "^1.0.3",
"@alilc/lowcode-plugin-code-generator": "^1.0.4",
"@alilc/lowcode-plugin-code-generator": "^1.0.6",
"@alilc/lowcode-plugin-components-pane": "^2.0.2",
"@alilc/lowcode-plugin-datasource-pane": "^1.0.9",
"@alilc/lowcode-plugin-inject": "^1.2.1",
"@alilc/lowcode-plugin-inject": "^1.2.3",
"@alilc/lowcode-plugin-manual": "^1.0.4",
"@alilc/lowcode-plugin-resource-tabs": "^1.0.0",
"@alilc/lowcode-plugin-schema": "^1.0.2",
"@alilc/lowcode-plugin-set-ref-prop": "^1.0.1",
"@alilc/lowcode-plugin-simulator-select": "^1.0.2",
"@alilc/lowcode-plugin-simulator-select": "^1.0.4",
"@alilc/lowcode-plugin-undo-redo": "^1.0.0",
"@alilc/lowcode-plugin-view-manager-pane": "^1.0.0",
"@alilc/lowcode-plugin-zh-en": "^1.0.0",
"@alilc/lowcode-react-renderer": "^1.1.2",
"@alilc/lowcode-setter-behavior": "^1.0.0",
@ -37,11 +47,6 @@
"@formily/core": "2.2.15",
"@formily/react": "2.2.15",
"@seada/antd-plugins": "^1.0.0-rc.27",
"@alilc/lce-graph-core": "^1.0.6",
"@alilc/lce-graph-tools": "^1.0.6",
"@alilc/lce-graph-x6-designer": "^1.0.6",
"@alilc/lce-graph-x6-stencil": "^1.0.6",
"@alilc/lce-graph-materials-pane": "^1.0.10",
"antd": "^4.21.4",
"moment": "^2.29.3",
"uuid": "^8.3.2"

View File

@ -11,7 +11,7 @@
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css" rel="stylesheet" />
<link href="https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css" rel="stylesheet" />
<!-- 低代码引擎的页面框架样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/css/engine-core.css" />
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/css/engine-core.css" />
<!-- 低代码引擎官方扩展的样式 -->
<link rel="stylesheet" href="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css" />
@ -27,9 +27,9 @@
<!-- 日期处理包Fusion Next 的依赖 -->
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<!-- Fusion Next 的主包,低代码编辑器的依赖 -->
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<!-- 低代码引擎的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10-beta.12/dist/js/engine-core.js"></script>
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.1.10/dist/js/engine-core.js"></script>
<!-- 低代码引擎官方扩展的主包 -->
<script crossorigin="anonymous" src="https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js"></script>
<script>

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>阿里低代码引擎 Demo - 预览页</title>
<link href="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.css" rel="stylesheet">
<link href="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css" rel="stylesheet">
<link href="./css/<%= scenarioName %>/preview.css" rel="stylesheet">
</head>
<body>
@ -19,7 +19,7 @@
<script src="https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js"></script>
<script src="https://g.alicdn.com/platform/c/??react15-polyfill/0.0.1/dist/index.js,lodash/4.6.1/lodash.min.js"></script>
<script src="https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js"></script>
<script src="https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.js"></script>
<script type="text/javascript" src="./js/<%= scenarioName %>/preview.js"></script>
</body>
</html>