mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-17 15:23:00 +00:00
merge
This commit is contained in:
commit
63f0d991f8
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ packages/*/dist/
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
deploy-space/packages
|
deploy-space/packages
|
||||||
|
deploy-space/.env
|
||||||
|
|
||||||
|
|
||||||
# IDE
|
# IDE
|
||||||
|
|||||||
@ -11,11 +11,12 @@
|
|||||||
#### 跑起来:
|
#### 跑起来:
|
||||||
|
|
||||||
- `npm run setup`
|
- `npm run setup`
|
||||||
|
- `npm start`
|
||||||
|
|
||||||
#### 开发提交:
|
#### 开发提交:
|
||||||
|
|
||||||
- `git add <your-files>`
|
- `git add <your-files>`
|
||||||
- `npm run commit`
|
- `npm run commit` # 在根目录
|
||||||
|
|
||||||
## 发布
|
## 发布
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
|
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>LowCodeEngine DEMO</title>
|
<title>LowCodeEngine Editor DEMO</title>
|
||||||
<link rel="shortcut icon" href="./favicon.png" />
|
<link rel="shortcut icon" href="./favicon.png" />
|
||||||
<script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
|
<script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
|
||||||
<script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
|
<script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<!-- lowcode engine globals -->
|
<!-- lowcode engine globals -->
|
||||||
<link rel="stylesheet" href="./globals.css" />
|
<link rel="stylesheet" href="./globals.css" />
|
||||||
<!-- lowcode engine app -->
|
<!-- lowcode engine app -->
|
||||||
<link rel="stylesheet" href="./lowcode-demo.css" />
|
<link rel="stylesheet" href="./lowcode-editor.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -24,6 +24,6 @@
|
|||||||
<!-- lowcode engine globals -->
|
<!-- lowcode engine globals -->
|
||||||
<script src="./globals.js"></script>
|
<script src="./globals.js"></script>
|
||||||
<!-- lowcode engine app -->
|
<!-- lowcode engine app -->
|
||||||
<script src="./lowcode-demo.js"></script>
|
<script src="./lowcode-editor.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
|
<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<title>LowCodeEngine DEMO</title>
|
<title>LowCodeEngine Preview DEMO</title>
|
||||||
<script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
|
<script src="https://g.alicdn.com/code/lib/react/16.9.0/umd/react.development.js"></script>
|
||||||
<script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.js"></script>
|
<script src="https://g.alicdn.com/code/lib/react-dom/16.9.0/umd/react-dom.development.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/code/lib/prop-types/15.7.2/prop-types.js"></script>
|
||||||
@ -13,9 +13,10 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="https://alifd.alicdn.com/npm/@alifd/next/1.11.6/next.min.css">
|
<link rel="stylesheet" href="https://alifd.alicdn.com/npm/@alifd/next/1.11.6/next.min.css">
|
||||||
<script src="https://unpkg.alibaba-inc.com/@alifd/next@1.18.17/dist/next.min.js"></script>
|
<script src="https://unpkg.alibaba-inc.com/@alifd/next@1.18.17/dist/next.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="./lowcode-preview.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="lce-container"></div>
|
<script src="./lowcode-preview.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
|
||||||
"tslib": "^1.9.3",
|
|
||||||
"typescript": "^3.2.2"
|
|
||||||
},
|
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
@ -13,5 +9,8 @@
|
|||||||
"**/@alife/theme-lowcode-*"
|
"**/@alife/theme-lowcode-*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines" : { "node" : "^10" }
|
"dependencies": {
|
||||||
|
"tslib": "^1.11.1",
|
||||||
|
"typescript": "^3.8.3"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@
|
|||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
// Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
|
// Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
|
// Search under node_modules for non-relative imports.
|
||||||
|
"moduleResolution": "node",
|
||||||
// Process & infer types from .js files.
|
// Process & infer types from .js files.
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
// Report errors in .js files.
|
// Report errors in .js files.
|
||||||
@ -32,6 +34,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
// skip type checking of declaration files
|
// skip type checking of declaration files
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
|
"outDir": "lib"
|
||||||
},
|
},
|
||||||
"exclude": ["**/test", "**/lib", "**/es", "node_modules"]
|
"exclude": ["**/test", "**/lib", "**/es", "node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,13 +10,13 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "lerna run build",
|
"build": "lerna run build --stream",
|
||||||
"clean": "rm -rf ./packages/*/lib ./packages/*/es ./packages/*/dist ./packages/*/build",
|
"clean": "rm -rf ./packages/*/lib ./packages/*/es ./packages/*/dist ./packages/*/build",
|
||||||
"commit": "git-cz",
|
"commit": "git-cz",
|
||||||
"pub": "lerna publish",
|
"pub": "lerna publish",
|
||||||
"setup": "./scripts/setup.sh",
|
"setup": "./scripts/setup.sh",
|
||||||
"start": "./scripts/start.sh",
|
"start": "./scripts/start.sh",
|
||||||
"test": "lerna run test",
|
"test": "lerna run test --stream",
|
||||||
"test:snapshot": "lerna run test:snapshot"
|
"test:snapshot": "lerna run test:snapshot"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|||||||
14
packages/code-generator/CHANGELOG.md
Normal file
14
packages/code-generator/CHANGELOG.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* code generator main process ([021d6e0](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/021d6e0fe9fb29a8b6c1c5d5f4d06ec71896faa5))
|
||||||
|
* demo schema & complex children type ([a5ee6bd](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a5ee6bd55806fc9aea695096ccd4c7f50b8e31c4))
|
||||||
|
* fix gaps ([32af3d3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/32af3d3a3ca4d5aca15be25e05c840c8ea0cb6ae))
|
||||||
|
* project builder fix & publish demo to disk ([26983b3](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/26983b38c2b0f1d39d79964eb54d8ce60250dd82))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-engine-code-generator",
|
"name": "@ali/lowcode-code-generator",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "出码引擎 for LowCode Engine",
|
"description": "出码引擎 for LowCode Engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
12
packages/demo/CHANGELOG.md
Normal file
12
packages/demo/CHANGELOG.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* complet preview ([56c16ff](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/56c16ffa5c39c2d01abd9cfa90fea49a4539da1d))
|
||||||
|
* double outline & ZH_EN support ([b379bd7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b379bd7c0c488ef24f825760750a13d3fa083c96))
|
||||||
@ -1,28 +1,30 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-demo",
|
"name": "@ali/lowcode-demo",
|
||||||
"version": "0.8.0",
|
"private": true,
|
||||||
|
"version": "0.8.1",
|
||||||
"description": "低代码引擎 DEMO",
|
"description": "低代码引擎 DEMO",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "build-scripts start",
|
"start": "build-scripts start",
|
||||||
"cloud-build": "build-scripts build --config cloud-build.json"
|
"cloud-build": "build-scripts build --config cloud-build.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-editor-core": "^0.8",
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@ali/lowcode-editor-skeleton": "^0.8.0",
|
"@ali/lowcode-editor-skeleton": "^0.8.1",
|
||||||
"@ali/lowcode-plugin-designer": "^0.8.0",
|
"@ali/lowcode-plugin-components-pane": "^0.8.1",
|
||||||
"@ali/lowcode-setters": "^0.8.0",
|
"@ali/lowcode-plugin-designer": "^0.8.1",
|
||||||
"@ali/lowcode-plugin-components-pane": "^0.8.0",
|
"@ali/lowcode-plugin-event-bind-dialog": "^0.8.2",
|
||||||
"@ali/lowcode-plugin-settings-pane": "^0.8.0",
|
"@ali/lowcode-plugin-outline-pane": "^0.8.2",
|
||||||
"@ali/lowcode-plugin-outline-pane": "^0.8.0",
|
"@ali/lowcode-plugin-sample-logo": "^0.8.1",
|
||||||
"@ali/lowcode-plugin-undo-redo": "^0.8.0",
|
"@ali/lowcode-plugin-sample-preview": "^0.8.1",
|
||||||
"@ali/lowcode-plugin-zh-en": "^0.8.0",
|
"@ali/lowcode-plugin-settings-pane": "^0.8.3",
|
||||||
"@ali/lowcode-plugin-sample-logo": "^0.8.0",
|
"@ali/lowcode-plugin-undo-redo": "^0.8.1",
|
||||||
"@ali/lowcode-plugin-sample-preview": "^0.8.0",
|
"@ali/lowcode-plugin-zh-en": "^0.8.1",
|
||||||
"@ali/lowcode-runtime": "^0.8.0",
|
"@ali/lowcode-react-renderer": "^0.8.2",
|
||||||
"@ali/lowcode-react-renderer": "^0.8.0",
|
"@ali/lowcode-runtime": "^0.0.3",
|
||||||
|
"@ali/lowcode-setters": "^0.8.1",
|
||||||
|
"@alifd/next": "^1.19.21",
|
||||||
"@alife/theme-lowcode-dark": "^0.1.0",
|
"@alife/theme-lowcode-dark": "^0.1.0",
|
||||||
"@alife/theme-lowcode-light": "^0.1.0",
|
"@alife/theme-lowcode-light": "^0.1.0",
|
||||||
"@alifd/next": "^1.19.21",
|
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
13
packages/designer/CHANGELOG.md
Normal file
13
packages/designer/CHANGELOG.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.2 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* 🎸 merge material-parser ([b40c286](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b40c2869a0bc901d855279735fe86b84dabaa04d))
|
||||||
|
* history log ([fbb3577](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/fbb3577bd434c0ac77cc907abc36e3efe110fe8c))
|
||||||
|
* import react-docgen to parse propTypes ([6e66168](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6e661686e4693e69279c496f3be1dd173703c55e))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-designer",
|
"name": "@ali/lowcode-designer",
|
||||||
"version": "0.8.1",
|
"version": "0.8.2",
|
||||||
"description": "Designer for Ali LowCode Engine",
|
"description": "Designer for Ali LowCode Engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -15,18 +15,18 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ali/lowcode-globals": "^0.8.1",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0"
|
||||||
"@ali/lowcode-globals": "^0.8"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/medium-editor": "^5.0.3",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
|
"@types/medium-editor": "^5.0.3",
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^13.7.1",
|
||||||
"@types/react": "^16",
|
"@types/react": "^16",
|
||||||
"@types/react-dom": "^16",
|
"@types/react-dom": "^16",
|
||||||
"@alib/build-scripts": "^0.1.18",
|
|
||||||
"build-plugin-component": "^0.2.10"
|
"build-plugin-component": "^0.2.10"
|
||||||
},
|
},
|
||||||
"ava": {
|
"ava": {
|
||||||
|
|||||||
@ -4,23 +4,31 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
z-index: 12;
|
z-index: 12;
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
background-color: var(--color-brand-light);
|
background-color: white;
|
||||||
height: 3px;
|
height: 5px;
|
||||||
|
border: 2px solid var(--color-brand-light);
|
||||||
|
border-radius: 2px;
|
||||||
|
&.invalid {
|
||||||
|
border-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
&.cover {
|
&.cover {
|
||||||
top: 0;
|
top: 0;
|
||||||
height: auto;
|
height: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
background-color: var(--color-brand-light);
|
||||||
|
border: none;
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
|
border-radius: 0;
|
||||||
|
&.invalid {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.vertical {
|
&.vertical {
|
||||||
top: 0;
|
top: 0;
|
||||||
left: -1.5px;
|
left: -1.5px;
|
||||||
width: 3px;
|
width: 5px;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
&.invalid {
|
|
||||||
background-color: red;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -786,6 +786,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
const inline = el ? isChildInline(el) : false;
|
const inline = el ? isChildInline(el) : false;
|
||||||
const row = el ? isRowContainer(el.parentElement!) : false;
|
const row = el ? isRowContainer(el.parentElement!) : false;
|
||||||
const vertical = inline || row;
|
const vertical = inline || row;
|
||||||
|
|
||||||
// TODO: fix type
|
// TODO: fix type
|
||||||
const near: any = {
|
const near: any = {
|
||||||
node: nearNode,
|
node: nearNode,
|
||||||
|
|||||||
@ -427,8 +427,9 @@ export class Dragon {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const sourceSensor = getSourceSensor(dragObject);
|
const sourceSensor = getSourceSensor(dragObject);
|
||||||
const sensors: ISensor[] = (masterSensors as ISensor[]).concat(this.sensors);
|
|
||||||
const chooseSensor = (e: LocateEvent) => {
|
const chooseSensor = (e: LocateEvent) => {
|
||||||
|
// this.sensors will change on dragstart
|
||||||
|
const sensors: ISensor[] = (masterSensors as ISensor[]).concat(this.sensors);
|
||||||
let sensor = e.sensor && e.sensor.isEnter(e) ? e.sensor : sensors.find((s) => s.sensorAvailable && s.isEnter(e));
|
let sensor = e.sensor && e.sensor.isEnter(e) ? e.sensor : sensors.find((s) => s.sensorAvailable && s.isEnter(e));
|
||||||
if (!sensor) {
|
if (!sensor) {
|
||||||
// TODO: enter some area like componentspanel cancel
|
// TODO: enter some area like componentspanel cancel
|
||||||
|
|||||||
@ -86,7 +86,7 @@ export function isChildInline(child: Element | Text, win?: Window) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const style = (win || getWindow(child)).getComputedStyle(child);
|
const style = (win || getWindow(child)).getComputedStyle(child);
|
||||||
return /^inline/.test(style.getPropertyValue('display'));
|
return /^inline/.test(style.getPropertyValue('display')) || /^(left|right)$/.test(style.getPropertyValue('float'));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRectTarget(rect: Rect | null) {
|
export function getRectTarget(rect: Rect | null) {
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/editor-core/CHANGELOG.md
Normal file
8
packages/editor-core/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-editor-core
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-editor-core",
|
"name": "@ali/lowcode-editor-core",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor core",
|
"description": "alibaba lowcode editor core",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -20,15 +20,15 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@alifd/next": "1.x",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"events": "^3.1.0",
|
"events": "^3.1.0",
|
||||||
"intl-messageformat": "^8.3.1",
|
"intl-messageformat": "^8.3.1",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"prop-types": "^15.5.8",
|
"prop-types": "^15.5.8",
|
||||||
"store": "^2.0.12",
|
|
||||||
"whatwg-fetch": "^3.0.0",
|
|
||||||
"react": "^16.8.0",
|
"react": "^16.8.0",
|
||||||
"@alifd/next": "1.x"
|
"store": "^2.0.12",
|
||||||
|
"whatwg-fetch": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.3",
|
"@alib/build-scripts": "^0.1.3",
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
11
packages/editor-skeleton/CHANGELOG.md
Normal file
11
packages/editor-skeleton/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* 🎸 merge material-parser ([b40c286](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b40c2869a0bc901d855279735fe86b84dabaa04d))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-editor-skeleton",
|
"name": "@ali/lowcode-editor-skeleton",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor skeleton",
|
"description": "alibaba lowcode editor skeleton",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-editor-core": "^0.8.0",
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@alifd/next": "^1.x",
|
"@alifd/next": "^1.x",
|
||||||
"prop-types": "^15.5.8",
|
"prop-types": "^15.5.8",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
11
packages/globals/CHANGELOG.md
Normal file
11
packages/globals/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* double outline & ZH_EN support ([b379bd7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b379bd7c0c488ef24f825760750a13d3fa083c96))
|
||||||
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-globals",
|
"name": "@ali/lowcode-globals",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "Globals api for Ali lowCode engine",
|
"description": "Globals api for Ali lowCode engine",
|
||||||
|
"license": "MIT",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
@ -14,6 +15,16 @@
|
|||||||
"test": "ava",
|
"test": "ava",
|
||||||
"test:snapshot": "ava --update-snapshots"
|
"test:snapshot": "ava --update-snapshots"
|
||||||
},
|
},
|
||||||
|
"ava": {
|
||||||
|
"compileEnhancements": false,
|
||||||
|
"extensions": [
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
|
"require": [
|
||||||
|
"ts-node/register"
|
||||||
|
],
|
||||||
|
"snapshotDir": "test/fixtures/__snapshots__"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@recore/obx": "^1.0.8",
|
"@recore/obx": "^1.0.8",
|
||||||
@ -23,26 +34,15 @@
|
|||||||
"react-dom": "^16.7.0"
|
"react-dom": "^16.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^13.7.1",
|
||||||
"@types/react": "^16",
|
"@types/react": "^16",
|
||||||
"@types/react-dom": "^16",
|
"@types/react-dom": "^16",
|
||||||
"@alib/build-scripts": "^0.1.18",
|
|
||||||
"build-plugin-component": "^0.2.11",
|
"build-plugin-component": "^0.2.11",
|
||||||
"build-plugin-fusion": "^0.1.0",
|
"build-plugin-fusion": "^0.1.0",
|
||||||
"build-plugin-moment-locales": "^0.1.0"
|
"build-plugin-moment-locales": "^0.1.0"
|
||||||
},
|
},
|
||||||
"ava": {
|
|
||||||
"compileEnhancements": false,
|
|
||||||
"snapshotDir": "test/fixtures/__snapshots__",
|
|
||||||
"extensions": [
|
|
||||||
"ts"
|
|
||||||
],
|
|
||||||
"require": [
|
|
||||||
"ts-node/register"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npm.alibaba-inc.com"
|
"registry": "https://registry.npm.alibaba-inc.com"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,6 @@ export default class EmbedTip extends Component<TipConfig> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
saveTips(this.id, this.props);
|
saveTips(this.id, this.props);
|
||||||
console.info(this.props);
|
|
||||||
return <meta data-role="tip" data-tip-id={this.id} />;
|
return <meta data-role="tip" data-tip-id={this.id} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": ["./src/"],
|
"include": ["./src/"],
|
||||||
}
|
}
|
||||||
|
|||||||
32
packages/material-parser/CHANGELOG.md
Normal file
32
packages/material-parser/CHANGELOG.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 🐛 fix bug of transforming type ([ebbe58d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/ebbe58df70f047f4b5fe367ac4b4a08de8a65e5d))
|
||||||
|
* 🐛 fix bug of validate schema ([3f97523](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3f975232c7cd551bc9c74962095dcc9b127af489))
|
||||||
|
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
|
||||||
|
* 💡 refactor with react-docgen ([64c9daa](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/64c9daa1f451fdfeab2777e4beefc5d5e1890ba1))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* complete component protocol json schema & validate method ([3df360d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/3df360de85d425b2926ea50ff26a8df27ec36a78))
|
||||||
|
* immigrate aimake materialin ([44ac85f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/44ac85f8a6a35bcd50f2e2b74a022e3cebe3cdef))
|
||||||
|
* import react-docgen to parse propTypes ([6e66168](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6e661686e4693e69279c496f3be1dd173703c55e))
|
||||||
|
* remove -p tslint.json for test ([6d013e1](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/6d013e18f93bad5647cb9ea0a497336f64e1459a))
|
||||||
|
* remove useless codes & modify generator ([dcd1b33](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/dcd1b33d3bf8bdf5577dcc980608d9eac8d99372))
|
||||||
|
* support multiple exported components ([db1b6de](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/db1b6deaca256b0d107fe607de6cd0fc90517a9c))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* 🧨 use react-docgen to replace parser
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-material-parser",
|
"name": "@ali/lowcode-material-parser",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "material parser for Ali lowCode engine",
|
"description": "material parser for Ali lowCode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
8
packages/plugin-components-pane/CHANGELOG.md
Normal file
8
packages/plugin-components-pane/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-components-pane
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-components-pane",
|
"name": "@ali/lowcode-plugin-components-pane",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor component-list plugin",
|
"description": "alibaba lowcode editor component-list plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es/",
|
"es/",
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/plugin-designer/CHANGELOG.md
Normal file
8
packages/plugin-designer/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-designer
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-designer",
|
"name": "@ali/lowcode-plugin-designer",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor designer plugin",
|
"description": "alibaba lowcode editor designer plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -20,15 +20,15 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ali/lowcode-designer": "^0.8.2",
|
||||||
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1",
|
"react-dom": "^16.8.1"
|
||||||
"@ali/lowcode-designer": "0.8",
|
|
||||||
"@ali/lowcode-editor-core": "0.8"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.3",
|
||||||
"@types/react": "^16.9.13",
|
"@types/react": "^16.9.13",
|
||||||
"@types/react-dom": "^16.9.4",
|
"@types/react-dom": "^16.9.4",
|
||||||
"@alib/build-scripts": "^0.1.3",
|
|
||||||
"build-plugin-component": "^0.2.7-1"
|
"build-plugin-component": "^0.2.7-1"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
"include": ["src/*.ts", "src/*.tsx"],
|
"outDir": "lib"
|
||||||
"exclude": ["node_modules", "build", "public"]
|
},
|
||||||
|
"include": [
|
||||||
|
"./src/"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
8
packages/plugin-event-bind-dialog/CHANGELOG.md
Normal file
8
packages/plugin-event-bind-dialog/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.2 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-event-bind-dialog
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-event-bind-dialog",
|
"name": "@ali/lowcode-plugin-event-bind-dialog",
|
||||||
"version": "0.8.0",
|
"version": "0.8.2",
|
||||||
"description": "alibaba lowcode editor event bind dialog plugin",
|
"description": "alibaba lowcode editor event bind dialog plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -19,8 +19,8 @@
|
|||||||
],
|
],
|
||||||
"author": "zude.hzd",
|
"author": "zude.hzd",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"@ali/lowcode-editor-core": "^0.8.0",
|
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
11
packages/plugin-outline-pane/CHANGELOG.md
Normal file
11
packages/plugin-outline-pane/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.2 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* double outline & ZH_EN support ([b379bd7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b379bd7c0c488ef24f825760750a13d3fa083c96))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-outline-pane",
|
"name": "@ali/lowcode-plugin-outline-pane",
|
||||||
"version": "0.8.1",
|
"version": "0.8.2",
|
||||||
"description": "Outline pane for Ali lowCode engine",
|
"description": "Outline pane for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -14,12 +14,12 @@
|
|||||||
"test:snapshot": "ava --update-snapshots"
|
"test:snapshot": "ava --update-snapshots"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ali/lowcode-designer": "^0.8.2",
|
||||||
|
"@ali/lowcode-globals": "^0.8.1",
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16",
|
"react": "^16",
|
||||||
"react-dom": "^16.7.0",
|
"react-dom": "^16.7.0"
|
||||||
"@ali/lowcode-designer": "^0.8.0",
|
|
||||||
"@ali/lowcode-globals": "^0.8.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export default class DwellTimer {
|
|||||||
private previous?: NodeParent;
|
private previous?: NodeParent;
|
||||||
private event?: LocateEvent;
|
private event?: LocateEvent;
|
||||||
|
|
||||||
constructor(private decide: (node: NodeParent, event: LocateEvent) => void, private timeout: number = 800) {}
|
constructor(private decide: (node: NodeParent, event: LocateEvent) => void, private timeout: number = 500) {}
|
||||||
|
|
||||||
focus(node: NodeParent, event: LocateEvent) {
|
focus(node: NodeParent, event: LocateEvent) {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
|
|||||||
@ -146,6 +146,7 @@ export class OutlineMain implements ISensor, IScrollBoard, IScrollable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: dirty connect to others
|
||||||
if (at === '__IN_SETTINGS__') {
|
if (at === '__IN_SETTINGS__') {
|
||||||
setup();
|
setup();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/plugin-sample-logo/CHANGELOG.md
Normal file
8
packages/plugin-sample-logo/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-sample-logo
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-sample-logo",
|
"name": "@ali/lowcode-plugin-sample-logo",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor logo plugin",
|
"description": "alibaba lowcode editor logo plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es/",
|
"es/",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-editor-core": "^0.8",
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"react": "^16.8.1"
|
"react": "^16.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/plugin-sample-preview/CHANGELOG.md
Normal file
8
packages/plugin-sample-preview/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-sample-preview
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-sample-preview",
|
"name": "@ali/lowcode-plugin-sample-preview",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor sample preview plugin",
|
"description": "alibaba lowcode editor sample preview plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -18,10 +18,10 @@
|
|||||||
"editor"
|
"editor"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ali/lowcode-designer": "^0.8.2",
|
||||||
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@alifd/next": "^1.x",
|
"@alifd/next": "^1.x",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1"
|
||||||
"@ali/lowcode-editor-core": "^0.8.0",
|
|
||||||
"@ali/lowcode-designer": "^0.8.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.3",
|
"@alib/build-scripts": "^0.1.3",
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/plugin-sample-save/CHANGELOG.md
Normal file
8
packages/plugin-sample-save/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-sample-save
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-sample-save",
|
"name": "@ali/lowcode-plugin-sample-save",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor sample save plugin",
|
"description": "alibaba lowcode editor sample save plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -19,9 +19,9 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@alifd/next": "^1.x",
|
"@alifd/next": "^1.x",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1"
|
||||||
"@ali/lowcode-editor-core": "^0.8.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alib/build-scripts": "^0.1.3",
|
"@alib/build-scripts": "^0.1.3",
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
13
packages/plugin-settings-pane/CHANGELOG.md
Normal file
13
packages/plugin-settings-pane/CHANGELOG.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.3 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add color-setter ([a149921](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/a14992174b65b1241e7bb82561c7efdfd6589606))
|
||||||
|
* double outline & ZH_EN support ([b379bd7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b379bd7c0c488ef24f825760750a13d3fa083c96))
|
||||||
|
* 增加color-setter,json-setter ([93e76ce](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/93e76ce3606603ee926ad83b21b29ffe28dc0682))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-settings-pane",
|
"name": "@ali/lowcode-plugin-settings-pane",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"description": "Settings pane for Ali lowCode engine",
|
"description": "Settings pane for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -14,10 +14,10 @@
|
|||||||
"test:snapshot": "ava --update-snapshots"
|
"test:snapshot": "ava --update-snapshots"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-editor-core": "^0.8.0",
|
"@ali/lowcode-designer": "^0.8.2",
|
||||||
"@ali/lowcode-designer": "^0.8.0",
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@ali/lowcode-globals": "^0.8.0",
|
"@ali/lowcode-globals": "^0.8.1",
|
||||||
"@ali/lowcode-plugin-outline-pane": "^0.8.0",
|
"@ali/lowcode-plugin-outline-pane": "^0.8.2",
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"react": "^16"
|
"react": "^16"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/plugin-undo-redo/CHANGELOG.md
Normal file
8
packages/plugin-undo-redo/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-plugin-undo-redo
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-undo-redo",
|
"name": "@ali/lowcode-plugin-undo-redo",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor undo redo plugin",
|
"description": "alibaba lowcode editor undo redo plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -19,8 +19,8 @@
|
|||||||
],
|
],
|
||||||
"author": "xiayang.xy",
|
"author": "xiayang.xy",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-editor-skeleton": "^0.8.0",
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@ali/lowcode-editor-core": "^0.8.0",
|
"@ali/lowcode-editor-skeleton": "^0.8.1",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
11
packages/plugin-zh-en/CHANGELOG.md
Normal file
11
packages/plugin-zh-en/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* double outline & ZH_EN support ([b379bd7](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/b379bd7c0c488ef24f825760750a13d3fa083c96))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-plugin-zh-en",
|
"name": "@ali/lowcode-plugin-zh-en",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "alibaba lowcode editor zhong english plugin",
|
"description": "alibaba lowcode editor zhong english plugin",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -14,8 +14,8 @@
|
|||||||
"test:snapshot": "ava --update-snapshots"
|
"test:snapshot": "ava --update-snapshots"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-globals": "^0.8.0",
|
"@ali/lowcode-editor-core": "^0.8.1",
|
||||||
"@ali/lowcode-editor-core": "^0.8.0",
|
"@ali/lowcode-globals": "^0.8.1",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
8
packages/react-renderer/CHANGELOG.md
Normal file
8
packages/react-renderer/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.2 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-react-renderer
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-react-renderer",
|
"name": "@ali/lowcode-react-renderer",
|
||||||
"version": "0.8.1",
|
"version": "0.8.2",
|
||||||
"description": "react renderer for ali lowcode engine",
|
"description": "react renderer for ali lowcode engine",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
|
|||||||
8
packages/react-simulator-renderer/CHANGELOG.md
Normal file
8
packages/react-simulator-renderer/CHANGELOG.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @ali/lowcode-react-simulator-renderer
|
||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
"private": true,
|
||||||
"name": "@ali/lowcode-react-simulator-renderer",
|
"name": "@ali/lowcode-react-simulator-renderer",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "react simulator renderer for alibaba lowcode designer",
|
"description": "react simulator renderer for alibaba lowcode designer",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
@ -12,9 +13,9 @@
|
|||||||
"test:snapshot": "ava --update-snapshots"
|
"test:snapshot": "ava --update-snapshots"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-globals": "^0.8",
|
"@ali/lowcode-designer": "^0.8.2",
|
||||||
"@ali/lowcode-designer": "^0.8",
|
"@ali/lowcode-globals": "^0.8.1",
|
||||||
"@ali/lowcode-react-renderer": "^0.8.0",
|
"@ali/lowcode-react-renderer": "^0.8.2",
|
||||||
"@recore/obx": "^1.0.8",
|
"@recore/obx": "^1.0.8",
|
||||||
"@recore/obx-react": "^1.0.7",
|
"@recore/obx-react": "^1.0.7",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
@ -22,12 +23,12 @@
|
|||||||
"react-dom": "^16.7.0"
|
"react-dom": "^16.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react-dom": "^16",
|
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"build-plugin-component": "^0.2.11",
|
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^13.7.1",
|
||||||
"@types/react": "^16"
|
"@types/react": "^16",
|
||||||
|
"@types/react-dom": "^16",
|
||||||
|
"build-plugin-component": "^0.2.11"
|
||||||
},
|
},
|
||||||
"ava": {
|
"ava": {
|
||||||
"compileEnhancements": false,
|
"compileEnhancements": false,
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
16
packages/runtime/CHANGELOG.md
Normal file
16
packages/runtime/CHANGELOG.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove abstract identifer ([2e45266](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2e4526667d563dccb85b9e3c60d862500f308915))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* complet preview ([56c16ff](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/56c16ffa5c39c2d01abd9cfa90fea49a4539da1d))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-runtime",
|
"name": "@ali/lowcode-runtime",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "Runtime for Ali lowCode engine",
|
"description": "Runtime for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -28,11 +28,11 @@
|
|||||||
"@ali/recore": "^1.6.9"
|
"@ali/recore": "^1.6.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react-dom": "^16",
|
|
||||||
"@alib/build-scripts": "^0.1.18",
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"build-plugin-component": "^0.2.11",
|
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^13.7.1",
|
||||||
"@types/react": "^16"
|
"@types/react": "^16",
|
||||||
|
"@types/react-dom": "^16",
|
||||||
|
"build-plugin-component": "^0.2.11"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://registry.npm.alibaba-inc.com"
|
"registry": "https://registry.npm.alibaba-inc.com"
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
11
packages/setters/CHANGELOG.md
Normal file
11
packages/setters/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## 0.8.1 (2020-03-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ts type ([1732e7d](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/1732e7db5fccb6e185cfa12e197ae698932fe127))
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ali/lowcode-setters",
|
"name": "@ali/lowcode-setters",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "Builtin setters for Ali lowCode engine",
|
"description": "Builtin setters for Ali lowCode engine",
|
||||||
"files": [
|
"files": [
|
||||||
"es",
|
"es",
|
||||||
@ -14,7 +14,6 @@
|
|||||||
"test:snapshot": "ava --update-snapshots"
|
"test:snapshot": "ava --update-snapshots"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ali/lowcode-globals": "^0.8",
|
|
||||||
"@ali/iceluna-comp-expression": "^1.0.6",
|
"@ali/iceluna-comp-expression": "^1.0.6",
|
||||||
"@ali/iceluna-comp-form": "^1.0.20",
|
"@ali/iceluna-comp-form": "^1.0.20",
|
||||||
"@ali/iceluna-comp-list": "^1.0.26",
|
"@ali/iceluna-comp-list": "^1.0.26",
|
||||||
@ -23,6 +22,7 @@
|
|||||||
"@ali/iceluna-comp-react-node": "^1.0.5",
|
"@ali/iceluna-comp-react-node": "^1.0.5",
|
||||||
"@ali/iceluna-sdk": "^1.0.5-beta.24",
|
"@ali/iceluna-sdk": "^1.0.5-beta.24",
|
||||||
"@ali/lc-style-setter": "^0.0.1",
|
"@ali/lc-style-setter": "^0.0.1",
|
||||||
|
"@ali/lowcode-globals": "^0.8.1",
|
||||||
"@alifd/next": "^1.19.16",
|
"@alifd/next": "^1.19.16",
|
||||||
"acorn": "^6.4.1",
|
"acorn": "^6.4.1",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
@ -34,11 +34,11 @@
|
|||||||
"react-monaco-editor": "^0.34.0"
|
"react-monaco-editor": "^0.34.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.18",
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
"@types/node": "^13.7.1",
|
"@types/node": "^13.7.1",
|
||||||
"@types/react": "^16",
|
"@types/react": "^16",
|
||||||
"@types/react-dom": "^16",
|
"@types/react-dom": "^16",
|
||||||
"@alib/build-scripts": "^0.1.18",
|
|
||||||
"build-plugin-component": "^0.2.10",
|
"build-plugin-component": "^0.2.10",
|
||||||
"build-plugin-fusion": "^0.1.0",
|
"build-plugin-fusion": "^0.1.0",
|
||||||
"build-plugin-moment-locales": "^0.1.0"
|
"build-plugin-moment-locales": "^0.1.0"
|
||||||
|
|||||||
35
packages/setters/src/color-setter/index.scss
Normal file
35
packages/setters/src/color-setter/index.scss
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// color-setter
|
||||||
|
.lowcode-color-box {
|
||||||
|
margin-right: -5px;
|
||||||
|
padding: 3px 0 3px 3px;
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
display: inline-block;
|
||||||
|
div {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.next-balloon-normal.lowcode-color-content {
|
||||||
|
padding: 0;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 0;
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
&:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.sketch-picker {
|
||||||
|
border-radius: 0 !important;
|
||||||
|
border: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
.flexbox-fix {
|
||||||
|
input {
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
99
packages/setters/src/color-setter/index.tsx
Normal file
99
packages/setters/src/color-setter/index.tsx
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { SketchPicker } from 'react-color';
|
||||||
|
import { Input, Balloon } from '@alife/next';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
interface Color {
|
||||||
|
rgb: any;
|
||||||
|
onChange: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginProps {
|
||||||
|
value: string;
|
||||||
|
onChange: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class ColorPickerView extends PureComponent<PluginProps> {
|
||||||
|
static display = 'ColorPicker';
|
||||||
|
static propTypes = {
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
value: PropTypes.string
|
||||||
|
};
|
||||||
|
static defaultProps = {
|
||||||
|
onChange: () => {},
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
|
constructor(props: Readonly<{value: string; defaultValue: string}>) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
value: props.value || props.defaultValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
static getDerivedStateFromProps(props: { value: string; }, state: { preValue: string; }) {
|
||||||
|
if (props.value != state.preValue) {
|
||||||
|
return {
|
||||||
|
preValue: props.value,
|
||||||
|
value: props.value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
onChangeComplete = (color: Color): void => {
|
||||||
|
let value;
|
||||||
|
if (color.rgb.a < 1) {
|
||||||
|
let rgb = color.rgb;
|
||||||
|
let rgba = [rgb.r, rgb.g, rgb.b, rgb.a];
|
||||||
|
value = `rgba(${rgba.join(',')})`;
|
||||||
|
} else {
|
||||||
|
value = color.hex;
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
value
|
||||||
|
});
|
||||||
|
this.props.onChange && this.props.onChange(value);
|
||||||
|
}
|
||||||
|
onInputChange = (value: string): void => {
|
||||||
|
if (/^[0-9a-zA-Z]{6}$/.test(value)) value = '#' + value;
|
||||||
|
this.setState({
|
||||||
|
value
|
||||||
|
});
|
||||||
|
this.props.onChange && this.props.onChange(value);
|
||||||
|
}
|
||||||
|
render(): React.ReactNode {
|
||||||
|
const { value, onChange, ...restProps } = this.props;
|
||||||
|
let boxStyle = {
|
||||||
|
backgroundColor: this.state.value
|
||||||
|
};
|
||||||
|
let triggerNode = (
|
||||||
|
<div className="lowcode-color-box">
|
||||||
|
<div style={boxStyle} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
let InnerBeforeNode = (
|
||||||
|
<Balloon
|
||||||
|
className={'lowcode-color-content'}
|
||||||
|
trigger={triggerNode}
|
||||||
|
needAdjust={true}
|
||||||
|
triggerType="click"
|
||||||
|
closable={false}
|
||||||
|
alignEdge="edge"
|
||||||
|
offset={[-3, -6]}
|
||||||
|
>
|
||||||
|
<SketchPicker
|
||||||
|
onChangeComplete={this.onChangeComplete}
|
||||||
|
color={this.state.value}
|
||||||
|
arrowPointAtCenter={true}
|
||||||
|
/>
|
||||||
|
</Balloon>
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<Input
|
||||||
|
{...restProps}
|
||||||
|
innerBefore={InnerBeforeNode}
|
||||||
|
onChange={this.onInputChange}
|
||||||
|
value={this.state.value}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
130
packages/setters/src/expression-setter/index.scss
Normal file
130
packages/setters/src/expression-setter/index.scss
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
// mixin
|
||||||
|
.lowcode-setter-mixin > * {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.lowcode-setter-mixin {
|
||||||
|
width: 86%;
|
||||||
|
}
|
||||||
|
.lowcode-setter-mixin .next-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.lowcode-setter-mixin .next-select-trigger {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
// json-setter
|
||||||
|
// :global {
|
||||||
|
.nrs-monaco-form {
|
||||||
|
.next-form-item:last-child {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.monaco-editor-wrap {
|
||||||
|
.luna-monaco-button .next-icon-first {
|
||||||
|
height: 26px;
|
||||||
|
}
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
position: absolute;
|
||||||
|
line-height: 1;
|
||||||
|
z-index: 7;
|
||||||
|
color: #ddd;
|
||||||
|
&:hover {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btns-eare {
|
||||||
|
text-align: left;
|
||||||
|
line-height: initial;
|
||||||
|
margin-top: 5px;
|
||||||
|
// button{
|
||||||
|
// margin-right: 10px;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
&.monaco-nofullscreen {
|
||||||
|
position: relative !important;
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
line-height: 1;
|
||||||
|
z-index: 7;
|
||||||
|
i:before {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.monaco-fullscreen {
|
||||||
|
position: fixed !important;
|
||||||
|
height: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1001;
|
||||||
|
overflow: hidden;
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
i:before {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.luna-monaco-button button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.luna-monaco-button-dialog {
|
||||||
|
.next-dialog-body {
|
||||||
|
padding: 0;
|
||||||
|
.next-form-item {
|
||||||
|
height: 100%;
|
||||||
|
margin-bottom: 0;
|
||||||
|
.next-form-item-control,
|
||||||
|
.next-form-item-control > div {
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
.next-form-item-help {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
// color-setter
|
||||||
|
.lowcode-color-box {
|
||||||
|
margin-right: -5px;
|
||||||
|
padding: 3px 0 3px 3px;
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
display: inline-block;
|
||||||
|
div {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.next-balloon-normal.lowcode-color-content {
|
||||||
|
padding: 0;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 0;
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
&:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.sketch-picker {
|
||||||
|
border-radius: 0 !important;
|
||||||
|
border: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
.flexbox-fix {
|
||||||
|
input {
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
377
packages/setters/src/expression-setter/index.tsx
Normal file
377
packages/setters/src/expression-setter/index.tsx
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { Select, Balloon } from '@alife/next';
|
||||||
|
import * as acorn from 'acorn';
|
||||||
|
|
||||||
|
import { isJSExpression, generateI18n } from './locale/utils';
|
||||||
|
import zhCN from './locale/zh-CN';
|
||||||
|
|
||||||
|
const { Option, AutoComplete } = Select;
|
||||||
|
const { Tooltip } = Balloon;
|
||||||
|
const helpMap = {
|
||||||
|
this: '容器上下文对象',
|
||||||
|
'this.state': '容器的state',
|
||||||
|
'this.props': '容器的props',
|
||||||
|
'this.context': '容器的context',
|
||||||
|
'this.page': '页面上下文对象',
|
||||||
|
'this.component': '组件上下文对象',
|
||||||
|
'this.constants': '应用常量对象',
|
||||||
|
'this.utils': '应用工具对象',
|
||||||
|
'this.dataSourceMap': '容器数据源Map',
|
||||||
|
'this.field': '表单Field对象'
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class ExpressionView extends PureComponent {
|
||||||
|
static displayName = 'Expression';
|
||||||
|
static propTypes = {
|
||||||
|
context: PropTypes.object,
|
||||||
|
dataSource: PropTypes.array,
|
||||||
|
locale: PropTypes.string,
|
||||||
|
messages: PropTypes.object,
|
||||||
|
onChange: PropTypes.func,
|
||||||
|
placeholder: PropTypes.string,
|
||||||
|
value: PropTypes.string
|
||||||
|
};
|
||||||
|
static defaultProps = {
|
||||||
|
context: {},
|
||||||
|
dataSource: [],
|
||||||
|
locale: 'zh-CN',
|
||||||
|
messages: zhCN,
|
||||||
|
onChange: () => {},
|
||||||
|
placeholder: '',
|
||||||
|
value: ''
|
||||||
|
};
|
||||||
|
expression: React.RefObject<unknown>;
|
||||||
|
i18n: any;
|
||||||
|
t: void;
|
||||||
|
$input: any;
|
||||||
|
listenerFun: (event: any) => void;
|
||||||
|
|
||||||
|
static getInitValue(val: { value: any; match: (arg0: RegExp) => any; }) {
|
||||||
|
if (isJSExpression(val)) {
|
||||||
|
if (typeof val === 'object') {
|
||||||
|
return val.value;
|
||||||
|
} else if (typeof val === 'string') {
|
||||||
|
let arr = val.match(/^\{\{(.*?)\}\}$/);
|
||||||
|
if (arr) return arr[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
constructor(props: Readonly<{}>) {
|
||||||
|
super(props);
|
||||||
|
this.expression = React.createRef();
|
||||||
|
this.i18n = generateI18n(props.locale, props.messages);
|
||||||
|
this.state = {
|
||||||
|
value: ExpressionView.getInitValue(props.value),
|
||||||
|
context: props.context || {},
|
||||||
|
dataSource: props.dataSource || []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
static getDerivedStateFromProps(props: { value: any; }, state: { preValue: any; }) {
|
||||||
|
let curValue = ExpressionView.getInitValue(props.value);
|
||||||
|
if (curValue !== state.preValue) {
|
||||||
|
return {
|
||||||
|
preValue: curValue,
|
||||||
|
value: curValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
onChange(value: string, actionType: string) {
|
||||||
|
let realInputValue = value;
|
||||||
|
let realDataSource = null;
|
||||||
|
const cursorIndex = this.getInputCursorPosition();
|
||||||
|
let nextCursorIndex: number;
|
||||||
|
//更新值
|
||||||
|
if (actionType === 'itemClick' || actionType === 'enter') {
|
||||||
|
let curValue = this.state.value;
|
||||||
|
if (curValue) {
|
||||||
|
//如果是非.结束,则替换当前这个变量;
|
||||||
|
let preStr = curValue.substr(0, cursorIndex);
|
||||||
|
let nextStr = curValue.substr(cursorIndex);
|
||||||
|
let preArr = preStr.split('.');
|
||||||
|
let preArrLen = preArr.length;
|
||||||
|
let tarPreStr = '';
|
||||||
|
if (!preArr[preArrLen - 1]) {
|
||||||
|
//如果是.结束,则增加到.后面
|
||||||
|
if (preArr[preArrLen - 2] === 'this') {
|
||||||
|
preArr = preArr.slice(0, preArrLen - 2);
|
||||||
|
preArr.push(value);
|
||||||
|
tarPreStr = preArr.join('.');
|
||||||
|
} else {
|
||||||
|
tarPreStr = preStr + value;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (preArr[preArrLen - 2] === 'this') {
|
||||||
|
preArr = preArr.slice(0, preArrLen - 2);
|
||||||
|
} else {
|
||||||
|
preArr = preArr.slice(0, preArrLen - 1);
|
||||||
|
}
|
||||||
|
preArr.push(value);
|
||||||
|
tarPreStr = preArr.join('.');
|
||||||
|
}
|
||||||
|
realInputValue = tarPreStr + nextStr;
|
||||||
|
realDataSource = this.getDataSource(tarPreStr + '.') || [];
|
||||||
|
nextCursorIndex = tarPreStr.length;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let tarPreStr = value.substr(0, cursorIndex);
|
||||||
|
if (tarPreStr) {
|
||||||
|
let lastChar = tarPreStr.charAt(tarPreStr.length - 1);
|
||||||
|
if (lastChar === '.') {
|
||||||
|
realDataSource = this.getDataSource(tarPreStr) || [];
|
||||||
|
} else {
|
||||||
|
realDataSource = this.getDataSource(tarPreStr + '.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
realDataSource = this.getDataSource('this.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//更新数据源
|
||||||
|
let newState = {
|
||||||
|
value: realInputValue
|
||||||
|
};
|
||||||
|
if (realDataSource !== null) newState.dataSource = realDataSource;
|
||||||
|
this.setState(newState, () => {
|
||||||
|
nextCursorIndex && this.setInputCursorPosition(nextCursorIndex);
|
||||||
|
});
|
||||||
|
//默认加上变量表达式
|
||||||
|
this.t && clearTimeout(this.t);
|
||||||
|
this.t = setTimeout(() => {
|
||||||
|
const { onChange } = this.props;
|
||||||
|
// realInputValue = realInputValue ? `{{${realInputValue}}}` : undefined;
|
||||||
|
onChange && onChange({
|
||||||
|
type: 'JSExpression',
|
||||||
|
value: realInputValue
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取AutoComplete数据源
|
||||||
|
* @param {String}
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
getDataSource(tempStr: string): Array<any> {
|
||||||
|
if (tempStr === '' || /[^\w\.]$/.test(tempStr)) {
|
||||||
|
return this.getDataSource('this.') || [];
|
||||||
|
} else if (/\w\.$/.test(tempStr)) {
|
||||||
|
let currentField = this.getCurrentFiled(tempStr);
|
||||||
|
if (!currentField) return null;
|
||||||
|
let tempKeys = this.getObjectKeys(currentField.str);
|
||||||
|
tempKeys = this.getContextKeys(tempKeys);
|
||||||
|
if (!tempKeys) return null;
|
||||||
|
//给默认情况增加this
|
||||||
|
if (tempStr === 'this.') {
|
||||||
|
tempKeys = tempKeys.map((item: string) => {
|
||||||
|
return 'this.' + item;
|
||||||
|
});
|
||||||
|
tempKeys.unshift('this');
|
||||||
|
}
|
||||||
|
return tempKeys;
|
||||||
|
} else if (/\.$/.test(tempStr)) {
|
||||||
|
return [];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取光标前的对象字符串,语法解析获取对象字符串
|
||||||
|
* @param {String} str 模板字符串
|
||||||
|
* @return {String} 光标前的对象字符串
|
||||||
|
*/
|
||||||
|
getCurrentFiled(str: string | any[]) {
|
||||||
|
str += 'x'; //.后面加一个x字符,便于acorn解析
|
||||||
|
try {
|
||||||
|
let astTree = acorn.parse(str);
|
||||||
|
let right = astTree.body[0].expression.right || astTree.body[0].expression;
|
||||||
|
if (right.type === 'MemberExpression') {
|
||||||
|
let { start, end } = right;
|
||||||
|
str = str.slice(start, end);
|
||||||
|
return { str, start, end };
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取输入的上下文信息
|
||||||
|
* @param {Array}
|
||||||
|
* @return {Array}
|
||||||
|
*/
|
||||||
|
getContextKeys(keys: any) {
|
||||||
|
// let context = {};
|
||||||
|
// const { appHelper } = this.context;
|
||||||
|
// const activeKey = appHelper && appHelper.activeKey;
|
||||||
|
// if (!activeKey) return;
|
||||||
|
// const activeCtx = appHelper.schemaHelper.compCtxMap && appHelper.schemaHelper.compCtxMap[activeKey];
|
||||||
|
// if (!activeCtx) return null;
|
||||||
|
// let __self = activeCtx;
|
||||||
|
// if (keys && keys.length > 1) {
|
||||||
|
// keys.shift(0);
|
||||||
|
// let path = '/' + keys.join('/');
|
||||||
|
// path = path.replace(/[\[\]]/g, '/');
|
||||||
|
// context = jsonuri.get(__self, path);
|
||||||
|
// if (context && typeof context === 'object') {
|
||||||
|
// return this.filterKey(context);
|
||||||
|
// }
|
||||||
|
// } else if (keys && keys[0] === 'this') {
|
||||||
|
// return this.filterKey(__self);
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
return [
|
||||||
|
"page",
|
||||||
|
"component"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/*过滤key */
|
||||||
|
filterKey(obj: any) {
|
||||||
|
let filterKeys = [
|
||||||
|
'reloadDataSource',
|
||||||
|
'REACT_HOT_LOADER_RENDERED_GENERATION',
|
||||||
|
'refs',
|
||||||
|
'updater',
|
||||||
|
'appHelper',
|
||||||
|
'isReactComponent',
|
||||||
|
'forceUpdate',
|
||||||
|
'setState',
|
||||||
|
'isPureReactComponent'
|
||||||
|
];
|
||||||
|
let result = [];
|
||||||
|
for (let key in obj) {
|
||||||
|
if (key.indexOf('_') !== 0 && filterKeys.indexOf(key) === -1) {
|
||||||
|
result.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据输入项进行筛选
|
||||||
|
* @param {String}
|
||||||
|
* @param {String}
|
||||||
|
* @return {Boolen}
|
||||||
|
*/
|
||||||
|
filterOption(inputValue: string, item: { value: string | any[]; }) {
|
||||||
|
const cursorIndex = this.getInputCursorPosition();
|
||||||
|
let preStr = inputValue.substr(0, cursorIndex);
|
||||||
|
let lastKey = preStr.split('.').slice(-1);
|
||||||
|
if (!lastKey) return true;
|
||||||
|
if (item.value.indexOf(lastKey) > -1) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { value, dataSource } = this.state;
|
||||||
|
const { placeholder } = this.props;
|
||||||
|
const isValObject = !!(value == '[object Object]');
|
||||||
|
let title = isValObject
|
||||||
|
? this.i18n('valueIllegal')
|
||||||
|
: (value || placeholder || this.i18n('jsExpression')).toString();
|
||||||
|
const cursorIndex = this.getInputCursorPosition();
|
||||||
|
let childNode = cursorIndex ? (
|
||||||
|
<div className="cursor-blink">
|
||||||
|
{title.substr(0, cursorIndex)}
|
||||||
|
<b>|</b>
|
||||||
|
{title.substr(cursorIndex)}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
title
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={this.expression} style={{ width: '100%', display: 'inline-block' }}>
|
||||||
|
<Tooltip
|
||||||
|
triggerType={isValObject ? ['click'] : ['focus']}
|
||||||
|
align="tl"
|
||||||
|
popupClassName="code-input-overlay"
|
||||||
|
trigger={
|
||||||
|
isValObject ? (
|
||||||
|
value
|
||||||
|
) : (
|
||||||
|
<AutoComplete
|
||||||
|
{...this.props}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
dataSource={dataSource}
|
||||||
|
placeholder={placeholder || this.i18n('jsExpression')}
|
||||||
|
value={value}
|
||||||
|
disabled={isValObject}
|
||||||
|
innerBefore={<span style={{ color: '#999', marginLeft: 4 }}>{'{{'}</span>}
|
||||||
|
innerAfter={<span style={{ color: '#999', marginRight: 4 }}>{'}}'}</span>}
|
||||||
|
itemRender={({ value }) => {
|
||||||
|
return (
|
||||||
|
<Option key={value} text={value} value={value}>
|
||||||
|
<div className="code-input-value">{value}</div>
|
||||||
|
<div className="code-input-help">{helpMap[value]}</div>
|
||||||
|
</Option>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
onChange={this.onChange.bind(this)}
|
||||||
|
filter={this.filterOption.bind(this)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{childNode}
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.$input = this.findInputElement();
|
||||||
|
if (this.$input) {
|
||||||
|
this.listenerFun = event => {
|
||||||
|
let isMoveKey = !!(event.type == 'keyup' && ~[37, 38, 39, 91].indexOf(event.keyCode));
|
||||||
|
let isMouseup = event.type == 'mouseup';
|
||||||
|
if (isMoveKey || isMouseup) {
|
||||||
|
let dataSource = this.getDataSource(this.state.value) || [];
|
||||||
|
this.setState({
|
||||||
|
dataSource
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.$input.addEventListener('keyup', this.listenerFun, false);
|
||||||
|
this.$input.addEventListener('mouseup', this.listenerFun, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.listenerFun && this.$input) {
|
||||||
|
this.$input.removeEventListener('keyup', this.listenerFun, false);
|
||||||
|
this.$input.removeEventListener('mouseup', this.listenerFun, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取Input输入框DOM节点
|
||||||
|
*/
|
||||||
|
findInputElement() {
|
||||||
|
return this.expression.current.children[0].getElementsByTagName('input')[0];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取光标位置
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
getInputCursorPosition() {
|
||||||
|
if (!this.$input) return;
|
||||||
|
return this.$input.selectionStart;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 字符串取得对象keys
|
||||||
|
*/
|
||||||
|
getObjectKeys(str: string) {
|
||||||
|
let keys = [];
|
||||||
|
if (str) keys = str.split('.');
|
||||||
|
return keys.slice(0, keys.length - 1);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 设置input组件光标位置在闭合}前
|
||||||
|
*/
|
||||||
|
setInputCursorPosition(idx: number) {
|
||||||
|
this.$input.setSelectionRange(idx, idx);
|
||||||
|
this.forceUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
83
packages/setters/src/json-setter/index.scss
Normal file
83
packages/setters/src/json-setter/index.scss
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
|
||||||
|
// json-setter
|
||||||
|
// :global {
|
||||||
|
.nrs-monaco-form {
|
||||||
|
.next-form-item:last-child {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.monaco-editor-wrap {
|
||||||
|
.luna-monaco-button .next-icon-first {
|
||||||
|
height: 26px;
|
||||||
|
}
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
position: absolute;
|
||||||
|
line-height: 1;
|
||||||
|
z-index: 7;
|
||||||
|
color: #ddd;
|
||||||
|
&:hover {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btns-eare {
|
||||||
|
text-align: left;
|
||||||
|
line-height: initial;
|
||||||
|
margin-top: 5px;
|
||||||
|
// button{
|
||||||
|
// margin-right: 10px;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
&.monaco-nofullscreen {
|
||||||
|
position: relative !important;
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
line-height: 1;
|
||||||
|
z-index: 7;
|
||||||
|
i:before {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.monaco-fullscreen {
|
||||||
|
position: fixed !important;
|
||||||
|
height: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1001;
|
||||||
|
overflow: hidden;
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
i:before {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.luna-monaco-button button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.luna-monaco-button-dialog {
|
||||||
|
.next-dialog-body {
|
||||||
|
padding: 0;
|
||||||
|
.next-form-item {
|
||||||
|
height: 100%;
|
||||||
|
margin-bottom: 0;
|
||||||
|
.next-form-item-control,
|
||||||
|
.next-form-item-control > div {
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
.next-form-item-help {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
573
packages/setters/src/json-setter/index.tsx
Normal file
573
packages/setters/src/json-setter/index.tsx
Normal file
@ -0,0 +1,573 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { js_beautify, css_beautify } from 'js-beautify';
|
||||||
|
import MonacoEditor from 'react-monaco-editor';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import { Icon, Message } from '@alife/next';
|
||||||
|
import ObjectButton from '@ali/iceluna-comp-object-button';
|
||||||
|
import FormItem from '@ali/iceluna-comp-form/lib/item';
|
||||||
|
import { serialize, jsonuri, generateI18n } from '@ali/iceluna-sdk/lib/utils';
|
||||||
|
import localeConfig from '@ali/iceluna-sdk/lib/hoc/localeConfig';
|
||||||
|
|
||||||
|
import Snippets from './locale/snippets';
|
||||||
|
import zhCN from './locale/zh-CN';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
let registerApiAndSnippetStatus = false; //判断注册api机制
|
||||||
|
|
||||||
|
window.bt = js_beautify;
|
||||||
|
class MonacoEditorView extends PureComponent {
|
||||||
|
static displayName = 'MonacoEditor';
|
||||||
|
render() {
|
||||||
|
const { type, ...restProps } = this.props;
|
||||||
|
let Node = type == 'button' ? MonacoEditorButtonView : MonacoEditorDefaultView;
|
||||||
|
return <Node {...restProps} registerApi={apis => Object.assign(this, apis)} />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
localeConfig('MonacoEditor', MonacoEditorView);
|
||||||
|
|
||||||
|
//monaco编辑器存在3种主题:vs、vs-dark、hc-black
|
||||||
|
class MonacoEditorDefaultView extends PureComponent {
|
||||||
|
static displayName = 'MonacoEditorDefault';
|
||||||
|
static propTypes = {
|
||||||
|
locale: PropTypes.string,
|
||||||
|
messages: PropTypes.object
|
||||||
|
};
|
||||||
|
static defaultProps = {
|
||||||
|
locale: 'zh-CN',
|
||||||
|
messages: zhCN,
|
||||||
|
width: '100%',
|
||||||
|
height: '300px',
|
||||||
|
language: 'javascript',
|
||||||
|
autoFocus: false, //自动获得焦点
|
||||||
|
autoSubmit: true, //自动提交
|
||||||
|
placeholder: '', //默认占位内容
|
||||||
|
btnText: '提交',
|
||||||
|
btnSize: 'small',
|
||||||
|
rules: [], //校验规则
|
||||||
|
options: {
|
||||||
|
readOnly: false,
|
||||||
|
automaticLayout: true,
|
||||||
|
folding: true, //默认开启折叠代码功能
|
||||||
|
lineNumbers: 'on',
|
||||||
|
wordWrap: 'off',
|
||||||
|
formatOnPaste: true,
|
||||||
|
fontSize: 12,
|
||||||
|
tabSize: 2,
|
||||||
|
scrollBeyondLastLine: false,
|
||||||
|
fixedOverflowWidgets: false,
|
||||||
|
snippetSuggestions: 'top',
|
||||||
|
minimap: {
|
||||||
|
enabled: true
|
||||||
|
},
|
||||||
|
scrollbar: {
|
||||||
|
vertical: 'hidden',
|
||||||
|
horizontal: 'hidden',
|
||||||
|
verticalScrollbarSize: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
strValue: string;
|
||||||
|
i18n: any;
|
||||||
|
editorRef: React.RefObject<unknown>;
|
||||||
|
options: any;
|
||||||
|
fullScreenOptions: any;
|
||||||
|
position: any;
|
||||||
|
editor: any;
|
||||||
|
editorNode: unknown;
|
||||||
|
editorParentNode: any;
|
||||||
|
constructor(props: Readonly<{}>) {
|
||||||
|
super(props);
|
||||||
|
this.strValue = '';
|
||||||
|
this.i18n = generateI18n(props.locale, props.messages);
|
||||||
|
this.editorRef = React.createRef();
|
||||||
|
this.options = Object.assign({}, MonacoEditorDefaultView.defaultProps.options, props.options);
|
||||||
|
this.fullScreenOptions = {
|
||||||
|
...this.options,
|
||||||
|
lineNumbers: 'on',
|
||||||
|
folding: true,
|
||||||
|
scrollBeyondLastLine: true,
|
||||||
|
minimap: {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.state = {
|
||||||
|
isFullScreen: false
|
||||||
|
};
|
||||||
|
this.onChange = this.onChange.bind(this);
|
||||||
|
this.onSubmit = this.onSubmit.bind(this);
|
||||||
|
this.fullScreen = this.fullScreen.bind(this);
|
||||||
|
this.format = this.format.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
//如果是全屏操作,获得焦点,光标保留在原来位置;
|
||||||
|
if (this.position) {
|
||||||
|
this.editor.focus();
|
||||||
|
this.editor.setPosition(this.position);
|
||||||
|
delete this.position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
this.editorNode = this.editorRef.current; //记录当前dom节点;
|
||||||
|
this.editorParentNode = this.editorNode.parentNode; //记录父节点;
|
||||||
|
//自动获得焦点, 格式化需要时间
|
||||||
|
if (this.props.autoFocus) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.editor.setPosition({
|
||||||
|
column: 4,
|
||||||
|
lineNumber: 2
|
||||||
|
});
|
||||||
|
this.editor.focus();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
//快捷键编码
|
||||||
|
let CtrlCmd = 2048;
|
||||||
|
let KEY_S = 49;
|
||||||
|
let Shift = 1024;
|
||||||
|
let KEY_F = 36;
|
||||||
|
let KEY_B = 32;
|
||||||
|
let Escape = 9;
|
||||||
|
|
||||||
|
this.editor.addCommand(CtrlCmd | KEY_S, () => {
|
||||||
|
this.onSubmit(); //保存快捷键
|
||||||
|
});
|
||||||
|
this.editor.addCommand(CtrlCmd | Shift | KEY_F, () => {
|
||||||
|
this.fullScreen(); //全屏快捷键
|
||||||
|
});
|
||||||
|
this.editor.addCommand(CtrlCmd | KEY_B, () => {
|
||||||
|
this.format(); //美化快捷键
|
||||||
|
});
|
||||||
|
this.editor.addCommand(Escape, () => {
|
||||||
|
this.props.onEscape && this.props.onEscape();
|
||||||
|
});
|
||||||
|
//注册api
|
||||||
|
this.editor.submit = this.onSubmit;
|
||||||
|
this.editor.format = this.format;
|
||||||
|
this.editor.fullScreen = this.fullScreen;
|
||||||
|
this.editor.toJson = this.toJson;
|
||||||
|
this.editor.toObject = this.toObject;
|
||||||
|
this.editor.toFunction = this.toFunction;
|
||||||
|
//针对object情况,改写setValue和getValue api
|
||||||
|
if (this.props.language === 'object') {
|
||||||
|
let getValue = this.editor.getValue;
|
||||||
|
let setValue = this.editor.setValue;
|
||||||
|
this.editor.getValue = () => {
|
||||||
|
return getValue.call(this.editor).substring(this.valuePrefix.length);
|
||||||
|
};
|
||||||
|
this.editor.setValue = value => {
|
||||||
|
return setValue.call(this.editor, [this.valuePrefix + value]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
value,
|
||||||
|
placeholder,
|
||||||
|
style,
|
||||||
|
className,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
language,
|
||||||
|
theme,
|
||||||
|
editorWillMount,
|
||||||
|
editorDidMount,
|
||||||
|
registerApi
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
const { isFullScreen } = this.state;
|
||||||
|
this.valuePrefix = ''; //值前缀
|
||||||
|
if (language === 'object') this.valuePrefix = 'export default ';
|
||||||
|
if (!this.isFullScreenAction) {
|
||||||
|
//将值转换成目标值
|
||||||
|
let nowValue = this.valueHandler(value || placeholder, language);
|
||||||
|
let curValue = this.valueHandler(this.strValue, language);
|
||||||
|
if (nowValue !== curValue) this.strValue = nowValue;
|
||||||
|
if (language === 'object') this.strValue = this.strValue || placeholder || '{\n\t\n}'; //设置初始化值
|
||||||
|
if (language === 'json' && this.strValue === '{}') this.strValue = '{\n\t\n}';
|
||||||
|
}
|
||||||
|
this.isFullScreenAction = false;
|
||||||
|
//真实高亮语言
|
||||||
|
let tarLanguage = language;
|
||||||
|
if (language === 'object' || language === 'function') {
|
||||||
|
tarLanguage = 'javascript';
|
||||||
|
}
|
||||||
|
let classes = classNames('monaco-editor-wrap', {
|
||||||
|
['monaco-fullscreen']: !!isFullScreen,
|
||||||
|
['monaco-nofullscreen']: !isFullScreen
|
||||||
|
});
|
||||||
|
let tarStyle = Object.assign({ minHeight: 60, width, height }, style);
|
||||||
|
return (
|
||||||
|
<div className={className} style={tarStyle}>
|
||||||
|
<div ref={this.editorRef} style={{ height: '100%' }} className={classes}>
|
||||||
|
<MonacoEditor
|
||||||
|
value={this.valuePrefix + this.strValue}
|
||||||
|
width="100%"
|
||||||
|
height="300"
|
||||||
|
language={tarLanguage}
|
||||||
|
theme={theme || window.__monacoTheme || 'vs-dark'}
|
||||||
|
options={isFullScreen ? this.fullScreenOptions : this.options}
|
||||||
|
onChange={this.onChange}
|
||||||
|
editorWillMount={editorWillMount}
|
||||||
|
editorDidMount={(editor, monaco) => {
|
||||||
|
this.editor = editor;
|
||||||
|
registerApi({ editor });
|
||||||
|
this.registerApiAndSnippet(monaco);
|
||||||
|
editorDidMount && editorDidMount.call(this, arguments);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<a
|
||||||
|
onClick={this.fullScreen}
|
||||||
|
className="monaco_fullscreen_icon"
|
||||||
|
title={
|
||||||
|
isFullScreen ? `${this.i18n('cancelFullScreen')} cmd+shift+f` : `${this.i18n('fullScreen')} cmd+shift+f`
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon type={isFullScreen ? 'quxiaoquanping' : 'quanping'} />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//值变化
|
||||||
|
onChange(curValue) {
|
||||||
|
if (curValue === this.valuePrefix + this.strValue) return;
|
||||||
|
const { onAfterChange, language, autoSubmit, onChange } = this.props;
|
||||||
|
this.strValue = curValue; //记录当前格式
|
||||||
|
if (this.ct) clearTimeout(this.ct);
|
||||||
|
this.ct = setTimeout(() => {
|
||||||
|
this.position = this.editor.getPosition();
|
||||||
|
let ret = this.resultHandler(curValue, language);
|
||||||
|
if (autoSubmit) onChange && onChange(ret.value);
|
||||||
|
onAfterChange && onAfterChange(ret.value, ret.error, this.editor);
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
//提交动作
|
||||||
|
onSubmit() {
|
||||||
|
const { onSubmit, onChange, language } = this.props;
|
||||||
|
let curValue = this.editor.getValue();
|
||||||
|
let ret = this.resultHandler(curValue, language);
|
||||||
|
if (!ret.error) onChange && onChange(ret.value);
|
||||||
|
onSubmit && onSubmit(ret.value, ret.error, this.editor);
|
||||||
|
}
|
||||||
|
|
||||||
|
//值类型转换处理
|
||||||
|
valueHandler(value, language) {
|
||||||
|
let tarValue = value || '';
|
||||||
|
if (language === 'json') {
|
||||||
|
if (value && typeof value === 'object') {
|
||||||
|
tarValue = JSON.stringify(value, null, 2);
|
||||||
|
} else if (value && typeof value === 'string') {
|
||||||
|
try {
|
||||||
|
let ret = this.toJson(value);
|
||||||
|
if (!ret.error) tarValue = JSON.stringify(ret.value, null, 2);
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
} else if (language === 'function') {
|
||||||
|
if (typeof value === 'function') {
|
||||||
|
tarValue = value.toString();
|
||||||
|
}
|
||||||
|
if (tarValue && typeof tarValue === 'string') {
|
||||||
|
tarValue = js_beautify(tarValue, { indent_size: 2, indent_empty_lines: true });
|
||||||
|
}
|
||||||
|
} else if (language === 'object') {
|
||||||
|
//先转成对象,在进行序列化和格式化;
|
||||||
|
value = value || {};
|
||||||
|
if (value && typeof value === 'object') {
|
||||||
|
try {
|
||||||
|
tarValue = serialize(value, { unsafe: true });
|
||||||
|
tarValue = js_beautify(tarValue, { indent_size: 2, indent_empty_lines: true });
|
||||||
|
} catch (err) {}
|
||||||
|
} else if (typeof value === 'string') {
|
||||||
|
try {
|
||||||
|
let ret = this.resultHandler(value, 'object');
|
||||||
|
tarValue = ret.error ? ret.value : serialize(ret.value, { unsafe: true });
|
||||||
|
tarValue = js_beautify(tarValue, { indent_size: 2, indent_empty_lines: true });
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tarValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//结果处理
|
||||||
|
resultHandler(value, language) {
|
||||||
|
let ret = { value };
|
||||||
|
if (language === 'json') {
|
||||||
|
ret = this.toJson(value);
|
||||||
|
} else if (language === 'object') {
|
||||||
|
ret = this.toObject(value);
|
||||||
|
} else if (language === 'function') {
|
||||||
|
ret = this.toFunction(value);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置全屏时的动作
|
||||||
|
fullScreen() {
|
||||||
|
if (!this.editorRef) return;
|
||||||
|
//还原到原来位置;
|
||||||
|
this.position = this.editor.getPosition();
|
||||||
|
if (this.state.isFullScreen) {
|
||||||
|
if (this.editorParentNode) {
|
||||||
|
if (this.editorParentNode.firstChild) {
|
||||||
|
this.editorParentNode.insertBefore(this.editorNode, this.editorParentNode.firstChild);
|
||||||
|
} else {
|
||||||
|
this.editorParentNode.appendChild(this.editorNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document.body.appendChild(this.editorNode);
|
||||||
|
}
|
||||||
|
let nextFs = !this.state.isFullScreen;
|
||||||
|
this.isFullScreenAction = true; //记录是全屏幕操作
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
isFullScreen: nextFs
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.editor.updateOptions(nextFs ? this.fullScreenOptions : this.options);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//美化代码
|
||||||
|
format() {
|
||||||
|
if (!this.editor) return;
|
||||||
|
if (/^\$_obj?\{.*?\}$/m.test(this.editor.getValue())) return;
|
||||||
|
if (this.props.language === 'json' || this.props.language === 'object' || this.props.language === 'function') {
|
||||||
|
let tarValue = js_beautify(this.editor.getValue(), { indent_size: 2 });
|
||||||
|
this.editor.setValue(tarValue);
|
||||||
|
} else if (this.props.language === 'less' || this.props.language === 'css' || this.props.language === 'scss') {
|
||||||
|
let tarValue = css_beautify(this.editor.getValue(), { indent_size: 2 });
|
||||||
|
this.editor.setValue(tarValue);
|
||||||
|
} else {
|
||||||
|
this.editor.getAction('editor.action.formatDocument').run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//校验是否是json
|
||||||
|
toJson(value) {
|
||||||
|
try {
|
||||||
|
let obj = new Function(`'use strict'; return ${value.replace(/[\r\n\t]/g, '')}`)();
|
||||||
|
if (typeof obj === 'object' && obj) {
|
||||||
|
let tarValue = new Function(`'use strict'; return ${value}`)();
|
||||||
|
return { value: JSON.parse(JSON.stringify(tarValue)) };
|
||||||
|
}
|
||||||
|
return { error: this.i18n('jsonIllegal'), value };
|
||||||
|
} catch (err) {
|
||||||
|
return { error: err, value };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//校验是否为object对象
|
||||||
|
toObject(value) {
|
||||||
|
try {
|
||||||
|
let obj = new Function(`'use strict';return ${value}`)();
|
||||||
|
if (obj && typeof obj === 'object') {
|
||||||
|
if (jsonuri.isCircular(obj)) return { error: this.i18n('circularRef'), value };
|
||||||
|
return { value: obj };
|
||||||
|
} else {
|
||||||
|
return { error: this.i18n('objectIllegal'), value };
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
return { error: err, value };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//校验是否为function
|
||||||
|
toFunction(value) {
|
||||||
|
try {
|
||||||
|
let fun = new Function(`'use strict';return ${value}`)();
|
||||||
|
if (fun && typeof fun === 'function') {
|
||||||
|
return { value: fun };
|
||||||
|
} else {
|
||||||
|
return { error: this.i18n('functionIllegal'), value };
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
return { error: err, value };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//注册api和代码片段
|
||||||
|
registerApiAndSnippet(monaco) {
|
||||||
|
if (registerApiAndSnippetStatus) return;
|
||||||
|
registerApiAndSnippetStatus = true;
|
||||||
|
//注册this.提示的方法;
|
||||||
|
let thisSuggestions = [];
|
||||||
|
Snippets.map(item => {
|
||||||
|
if (!item.label || !item.kind || !item.insertText) return;
|
||||||
|
let tarItem = Object.assign(item, {
|
||||||
|
label: item.label,
|
||||||
|
kind: monaco.languages.CompletionItemKind[item.kind],
|
||||||
|
insertText: item.insertText
|
||||||
|
});
|
||||||
|
if (item.insertTextRules)
|
||||||
|
tarItem.insertTextRules = monaco.languages.CompletionItemInsertTextRule[item.insertTextRules];
|
||||||
|
thisSuggestions.push(tarItem);
|
||||||
|
});
|
||||||
|
monaco.languages.registerCompletionItemProvider('javascript', {
|
||||||
|
provideCompletionItems: (model, position) => {
|
||||||
|
let textUntilPosition = model.getValueInRange({
|
||||||
|
startLineNumber: position.lineNumber,
|
||||||
|
startColumn: 1,
|
||||||
|
endLineNumber: position.lineNumber,
|
||||||
|
endColumn: position.column
|
||||||
|
});
|
||||||
|
let match = textUntilPosition.match(/(^this\.)|(\sthis\.)/);
|
||||||
|
let suggestions = match ? thisSuggestions : [];
|
||||||
|
return { suggestions: suggestions };
|
||||||
|
},
|
||||||
|
triggerCharacters: ['.']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const prefix = 'data:text/javascript;charset=utf-8,';
|
||||||
|
const baseUrl = 'https://g.alicdn.com/iceluna/iceluna-vendor/0.0.1/';
|
||||||
|
window.MonacoEnvironment = {
|
||||||
|
getWorkerUrl: function(label: string) {
|
||||||
|
if (label === 'json') {
|
||||||
|
return `${prefix}${encodeURIComponent(`
|
||||||
|
importScripts('${baseUrl}json.worker.js');`)}`;
|
||||||
|
}
|
||||||
|
if (['css', 'less', 'scss'].includes(label)) {
|
||||||
|
return `${prefix}${encodeURIComponent(`
|
||||||
|
importScripts('${baseUrl}css.worker.js');`)}`;
|
||||||
|
}
|
||||||
|
if (label === 'html') {
|
||||||
|
return `${prefix}${encodeURIComponent(`
|
||||||
|
importScripts('${baseUrl}html.worker.js');`)}`;
|
||||||
|
}
|
||||||
|
if (['typescript', 'javascript'].includes(label)) {
|
||||||
|
return `${prefix}${encodeURIComponent(`
|
||||||
|
importScripts('${baseUrl}typescript.worker.js');`)}`;
|
||||||
|
}
|
||||||
|
return `${prefix}${encodeURIComponent(`
|
||||||
|
importScripts('${baseUrl}editor.worker.js');`)}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class MonacoEditorButtonView extends PureComponent {
|
||||||
|
static displayName = 'MonacoEditorButton';
|
||||||
|
static propTypes = {
|
||||||
|
locale: PropTypes.string,
|
||||||
|
messages: PropTypes.object
|
||||||
|
};
|
||||||
|
static defaultProps = {
|
||||||
|
locale: 'zh-CN',
|
||||||
|
messages: zhCN
|
||||||
|
};
|
||||||
|
i18n: any;
|
||||||
|
objectButtonRef: React.RefObject<unknown>;
|
||||||
|
constructor(props: Readonly<{}>) {
|
||||||
|
super(props);
|
||||||
|
this.i18n = generateI18n(props.locale, props.messages);
|
||||||
|
this.objectButtonRef = React.createRef();
|
||||||
|
// 兼容代码,待去除
|
||||||
|
window.__ctx.appHelper.constants = window.__ctx.appHelper.constants || {};
|
||||||
|
}
|
||||||
|
afterHandler(value: { nrs_temp_field: any; }) {
|
||||||
|
if (!value) return;
|
||||||
|
return value.nrs_temp_field;
|
||||||
|
}
|
||||||
|
beforeHandler(value: any) {
|
||||||
|
if (!value) return;
|
||||||
|
return { nrs_temp_field: value };
|
||||||
|
}
|
||||||
|
message(type: string, title: any, dom: Element | null) {
|
||||||
|
Message.show({
|
||||||
|
type,
|
||||||
|
title,
|
||||||
|
duration: 1000,
|
||||||
|
align: 'cc cc',
|
||||||
|
overlayProps: {
|
||||||
|
target: dom
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
componentDidMount() {
|
||||||
|
const { registerApi } = this.props;
|
||||||
|
let objectButtonThis = this.objectButtonRef;
|
||||||
|
registerApi &&
|
||||||
|
registerApi({
|
||||||
|
show: objectButtonThis.showModal,
|
||||||
|
hide: objectButtonThis.hideModal,
|
||||||
|
submit: objectButtonThis.submitHandler,
|
||||||
|
setValues: objectButtonThis.setValues
|
||||||
|
});
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
const self = this;
|
||||||
|
const { locale, messages, value, onChange, field, ...restProps } = this.props;
|
||||||
|
const { id } = field;
|
||||||
|
let tarRestProps = { ...restProps };
|
||||||
|
tarRestProps.autoSubmit = true;
|
||||||
|
tarRestProps.autoFocus = true;
|
||||||
|
let tarOnSubmit = tarRestProps.onSubmit;
|
||||||
|
//确保monaco快捷键保存,能出发最外层的保存
|
||||||
|
tarRestProps.onSubmit = (value, error) => {
|
||||||
|
let msgDom = document.querySelector('.object-button-overlay .next-dialog-body');
|
||||||
|
if (error) return this.message('error', this.i18n('formatError'), msgDom);
|
||||||
|
this.objectButtonRef &&
|
||||||
|
this.objectButtonRef.current &&
|
||||||
|
this.objectButtonRef.current.submitHandler(() => {
|
||||||
|
this.message('success', this.i18n('saved'), msgDom);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
let tarObjProps = { };
|
||||||
|
tarObjProps.className = 'luna-monaco-button';
|
||||||
|
if (tarRestProps['data-meta']) {
|
||||||
|
delete tarRestProps['data-meta'];
|
||||||
|
tarObjProps['data-meta'] = 'Field';
|
||||||
|
}
|
||||||
|
tarObjProps.id = id;
|
||||||
|
tarObjProps.value = value || '';
|
||||||
|
tarObjProps.onChange = onChange;
|
||||||
|
let tarRule = [];
|
||||||
|
//判断,如果是json,function, object等类型,自动追加校验规则;
|
||||||
|
if (tarRestProps.language && ['json', 'function', 'object'].includes(tarRestProps.language)) {
|
||||||
|
if (['json', 'object'].includes(tarRestProps.language)) {
|
||||||
|
tarRule.push({
|
||||||
|
validator: function(value: any, callback: (arg0: undefined) => void) {
|
||||||
|
if (typeof value !== 'object') {
|
||||||
|
callback(self.i18n('formatError'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
tarRule.push({
|
||||||
|
validator: function(value: any, callback: (arg0: undefined) => void) {
|
||||||
|
if (typeof value !== 'function') {
|
||||||
|
callback(self.i18n('formatError'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ObjectButton
|
||||||
|
locale={locale}
|
||||||
|
messages={messages}
|
||||||
|
{...tarObjProps}
|
||||||
|
ref={this.objectButtonRef}
|
||||||
|
beforeHandler={this.beforeHandler.bind(this)}
|
||||||
|
afterHandler={this.afterHandler.bind(this)}
|
||||||
|
onSubmit={tarOnSubmit}
|
||||||
|
>
|
||||||
|
<FormItem name="nrs_temp_field" rules={tarRule}>
|
||||||
|
<MonacoEditorDefaultView {...tarRestProps} registerApi={(apis: any) => Object.assign(this, apis)} />
|
||||||
|
</FormItem>
|
||||||
|
</ObjectButton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
242
packages/setters/src/json-setter/locale/snippets.js
Normal file
242
packages/setters/src/json-setter/locale/snippets.js
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
label: 'constants',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'constants',
|
||||||
|
detail: '应用全局常量',
|
||||||
|
documentation: '应用范围定义的通用常量'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'utils',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'utils',
|
||||||
|
detail: '应用全局公共函数',
|
||||||
|
documentation: '应用范围扩展的公共函数'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'state',
|
||||||
|
kind: 'Enum',
|
||||||
|
insertText: 'state',
|
||||||
|
detail: '当前所在容器组件内部状态',
|
||||||
|
documentation: 'React Class内部状态state'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'setState',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'setState({\n\t$0\n})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '设置当前所在容器组件的state数据',
|
||||||
|
documentation: '原生React方法,会自动更新组件视图'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'reloadDataSource',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'reloadDataSource(${1:${2:namespace}, ${3:false}, ${4:callback}})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '刷新当前所在的容器组件',
|
||||||
|
documentation: '触发当前所在的容器组件,重新发送异步请求,并用最新数据更新视图'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'location',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'location',
|
||||||
|
detail: '路由解析对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'location.query',
|
||||||
|
kind: 'Value',
|
||||||
|
insertText: 'location.query.${1:xxxx}',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '从路由解析对象中获取参数信息'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'history',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'history',
|
||||||
|
detail: '路由历史对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'React',
|
||||||
|
kind: 'Keyword',
|
||||||
|
insertText: 'React',
|
||||||
|
detail: 'React对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'ReactDOM',
|
||||||
|
kind: 'Keyword',
|
||||||
|
insertText: 'ReactDOM',
|
||||||
|
detail: 'ReactDom对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'ReactDOM.findDOMNode',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'ReactDOM.findDOMNode(${1:this.refs.xxxx})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'ReactDom查找真实dom node'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dialog.alert',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Dialog.alert({',
|
||||||
|
"\tcontent: '${1:Alert content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'alert弹框 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dialog.confirm',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Dialog.confirm({',
|
||||||
|
"\tcontent: '${1:Confirm content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '确认弹出框 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.success',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.success(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '成功反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.error',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.error(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '错误反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.help',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.help(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '帮助反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.loading',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.loading(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'loading反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.notice',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.notice(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '注意反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.waining',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.waining(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '警告反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.confirm',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.confirm({',
|
||||||
|
"\tcontent: '${1:Confirm content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '确认弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.info',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.info({',
|
||||||
|
"\tcontent: '${1:Info content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '信息弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.success',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.success({',
|
||||||
|
"\tcontent: '${1:Success content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '成功弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.error',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.error({',
|
||||||
|
"\tcontent: '${1:Error content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '错误弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.warning',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.warning({',
|
||||||
|
"\tcontent: '${1:Warning content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '警告弹出框 By Antd'
|
||||||
|
}
|
||||||
|
];
|
||||||
21
packages/setters/src/json-setter/locale/utils.js
Normal file
21
packages/setters/src/json-setter/locale/utils.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import IntlMessageFormat from 'intl-messageformat';
|
||||||
|
|
||||||
|
export const isJSExpression = (obj = '') => {
|
||||||
|
if(obj && typeof obj === 'object' && obj.type === 'JSExpression') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于构造国际化字符串处理函数
|
||||||
|
* @param {*} locale 国际化标识,例如 zh-CN、en-US
|
||||||
|
* @param {*} messages 国际化语言包
|
||||||
|
*/
|
||||||
|
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
|
||||||
|
return function (key, values = {}) {
|
||||||
|
if (!messages || !messages[key]) return '';
|
||||||
|
const formater = new IntlMessageFormat(messages[key], locale);
|
||||||
|
return formater.format(values);
|
||||||
|
};
|
||||||
|
}
|
||||||
36
packages/setters/src/json-setter/locale/zh-CN.js
Normal file
36
packages/setters/src/json-setter/locale/zh-CN.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
export default {
|
||||||
|
// function
|
||||||
|
setting: '点击设置',
|
||||||
|
edit: '编辑',
|
||||||
|
submitConfirm: '确认提交 cmd+s',
|
||||||
|
close: '关闭 esc',
|
||||||
|
fullScreen: '全屏',
|
||||||
|
cancelFullScreen: '取消全屏',
|
||||||
|
jsonIllegal: '非json格式',
|
||||||
|
functionIllegal: '非function格式',
|
||||||
|
objectIllegal: '非object格式',
|
||||||
|
circularRef: '对象中出现循环引用的对象',
|
||||||
|
formatError: '格式错误',
|
||||||
|
saved: '已保存',
|
||||||
|
// expression
|
||||||
|
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
|
||||||
|
jsExpression: '请输入JS表达式',
|
||||||
|
// Mixin
|
||||||
|
input: '字符串Input',
|
||||||
|
textarea: '多行字符串Textarea',
|
||||||
|
expression: '变量控件Expression',
|
||||||
|
monacoEditor: '编辑器MonacoEditor',
|
||||||
|
numberPicker: '数字NumberPicker',
|
||||||
|
bool: '布尔Switch',
|
||||||
|
datePicker: '日期选择DatePicker',
|
||||||
|
select: '下拉选择Select',
|
||||||
|
radio: '单项选择RadioGroup',
|
||||||
|
date: '日期选择DatePicker',
|
||||||
|
dateYear: '年选择DatePicker',
|
||||||
|
dateMonth: '月选择DatePicker',
|
||||||
|
dateRange: '日期区间选择DatePicker',
|
||||||
|
list: '数组List',
|
||||||
|
object: '对象ObjectButton',
|
||||||
|
reactNode: '节点类型ReactNode',
|
||||||
|
typeError: 'Minix组件属性Types配置错误,存在不支持类型[{type}],请检查组件属性配置',
|
||||||
|
};
|
||||||
242
packages/setters/src/locale/snippets copy.js
Normal file
242
packages/setters/src/locale/snippets copy.js
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
label: 'constants',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'constants',
|
||||||
|
detail: '应用全局常量',
|
||||||
|
documentation: '应用范围定义的通用常量'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'utils',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'utils',
|
||||||
|
detail: '应用全局公共函数',
|
||||||
|
documentation: '应用范围扩展的公共函数'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'state',
|
||||||
|
kind: 'Enum',
|
||||||
|
insertText: 'state',
|
||||||
|
detail: '当前所在容器组件内部状态',
|
||||||
|
documentation: 'React Class内部状态state'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'setState',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'setState({\n\t$0\n})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '设置当前所在容器组件的state数据',
|
||||||
|
documentation: '原生React方法,会自动更新组件视图'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'reloadDataSource',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'reloadDataSource(${1:${2:namespace}, ${3:false}, ${4:callback}})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '刷新当前所在的容器组件',
|
||||||
|
documentation: '触发当前所在的容器组件,重新发送异步请求,并用最新数据更新视图'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'location',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'location',
|
||||||
|
detail: '路由解析对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'location.query',
|
||||||
|
kind: 'Value',
|
||||||
|
insertText: 'location.query.${1:xxxx}',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '从路由解析对象中获取参数信息'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'history',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'history',
|
||||||
|
detail: '路由历史对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'React',
|
||||||
|
kind: 'Keyword',
|
||||||
|
insertText: 'React',
|
||||||
|
detail: 'React对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'ReactDOM',
|
||||||
|
kind: 'Keyword',
|
||||||
|
insertText: 'ReactDOM',
|
||||||
|
detail: 'ReactDom对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'ReactDOM.findDOMNode',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'ReactDOM.findDOMNode(${1:this.refs.xxxx})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'ReactDom查找真实dom node'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dialog.alert',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Dialog.alert({',
|
||||||
|
"\tcontent: '${1:Alert content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'alert弹框 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dialog.confirm',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Dialog.confirm({',
|
||||||
|
"\tcontent: '${1:Confirm content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '确认弹出框 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.success',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.success(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '成功反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.error',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.error(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '错误反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.help',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.help(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '帮助反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.loading',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.loading(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'loading反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.notice',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.notice(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '注意反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.waining',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.waining(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '警告反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.confirm',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.confirm({',
|
||||||
|
"\tcontent: '${1:Confirm content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '确认弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.info',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.info({',
|
||||||
|
"\tcontent: '${1:Info content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '信息弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.success',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.success({',
|
||||||
|
"\tcontent: '${1:Success content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '成功弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.error',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.error({',
|
||||||
|
"\tcontent: '${1:Error content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '错误弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.warning',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.warning({',
|
||||||
|
"\tcontent: '${1:Warning content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '警告弹出框 By Antd'
|
||||||
|
}
|
||||||
|
];
|
||||||
21
packages/setters/src/locale/utils copy.js
Normal file
21
packages/setters/src/locale/utils copy.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import IntlMessageFormat from 'intl-messageformat';
|
||||||
|
|
||||||
|
export const isJSExpression = (obj = '') => {
|
||||||
|
if(obj && typeof obj === 'object' && obj.type === 'JSExpression') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于构造国际化字符串处理函数
|
||||||
|
* @param {*} locale 国际化标识,例如 zh-CN、en-US
|
||||||
|
* @param {*} messages 国际化语言包
|
||||||
|
*/
|
||||||
|
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
|
||||||
|
return function (key, values = {}) {
|
||||||
|
if (!messages || !messages[key]) return '';
|
||||||
|
const formater = new IntlMessageFormat(messages[key], locale);
|
||||||
|
return formater.format(values);
|
||||||
|
};
|
||||||
|
}
|
||||||
36
packages/setters/src/locale/zh-CN copy.js
Normal file
36
packages/setters/src/locale/zh-CN copy.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
export default {
|
||||||
|
// function
|
||||||
|
setting: '点击设置',
|
||||||
|
edit: '编辑',
|
||||||
|
submitConfirm: '确认提交 cmd+s',
|
||||||
|
close: '关闭 esc',
|
||||||
|
fullScreen: '全屏',
|
||||||
|
cancelFullScreen: '取消全屏',
|
||||||
|
jsonIllegal: '非json格式',
|
||||||
|
functionIllegal: '非function格式',
|
||||||
|
objectIllegal: '非object格式',
|
||||||
|
circularRef: '对象中出现循环引用的对象',
|
||||||
|
formatError: '格式错误',
|
||||||
|
saved: '已保存',
|
||||||
|
// expression
|
||||||
|
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
|
||||||
|
jsExpression: '请输入JS表达式',
|
||||||
|
// Mixin
|
||||||
|
input: '字符串Input',
|
||||||
|
textarea: '多行字符串Textarea',
|
||||||
|
expression: '变量控件Expression',
|
||||||
|
monacoEditor: '编辑器MonacoEditor',
|
||||||
|
numberPicker: '数字NumberPicker',
|
||||||
|
bool: '布尔Switch',
|
||||||
|
datePicker: '日期选择DatePicker',
|
||||||
|
select: '下拉选择Select',
|
||||||
|
radio: '单项选择RadioGroup',
|
||||||
|
date: '日期选择DatePicker',
|
||||||
|
dateYear: '年选择DatePicker',
|
||||||
|
dateMonth: '月选择DatePicker',
|
||||||
|
dateRange: '日期区间选择DatePicker',
|
||||||
|
list: '数组List',
|
||||||
|
object: '对象ObjectButton',
|
||||||
|
reactNode: '节点类型ReactNode',
|
||||||
|
typeError: 'Minix组件属性Types配置错误,存在不支持类型[{type}],请检查组件属性配置',
|
||||||
|
};
|
||||||
130
packages/setters/src/mixin-setter/index.scss
Normal file
130
packages/setters/src/mixin-setter/index.scss
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
// mixin
|
||||||
|
.lowcode-setter-mixin > * {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.lowcode-setter-mixin {
|
||||||
|
width: 86%;
|
||||||
|
}
|
||||||
|
.lowcode-setter-mixin .next-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.lowcode-setter-mixin .next-select-trigger {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
// json-setter
|
||||||
|
// :global {
|
||||||
|
.nrs-monaco-form {
|
||||||
|
.next-form-item:last-child {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.monaco-editor-wrap {
|
||||||
|
.luna-monaco-button .next-icon-first {
|
||||||
|
height: 26px;
|
||||||
|
}
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
position: absolute;
|
||||||
|
line-height: 1;
|
||||||
|
z-index: 7;
|
||||||
|
color: #ddd;
|
||||||
|
&:hover {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btns-eare {
|
||||||
|
text-align: left;
|
||||||
|
line-height: initial;
|
||||||
|
margin-top: 5px;
|
||||||
|
// button{
|
||||||
|
// margin-right: 10px;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
&.monaco-nofullscreen {
|
||||||
|
position: relative !important;
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
line-height: 1;
|
||||||
|
z-index: 7;
|
||||||
|
i:before {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.monaco-fullscreen {
|
||||||
|
position: fixed !important;
|
||||||
|
height: 100% !important;
|
||||||
|
width: 100% !important;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1001;
|
||||||
|
overflow: hidden;
|
||||||
|
.monaco_fullscreen_icon {
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
i:before {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.luna-monaco-button button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.luna-monaco-button-dialog {
|
||||||
|
.next-dialog-body {
|
||||||
|
padding: 0;
|
||||||
|
.next-form-item {
|
||||||
|
height: 100%;
|
||||||
|
margin-bottom: 0;
|
||||||
|
.next-form-item-control,
|
||||||
|
.next-form-item-control > div {
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
.next-form-item-help {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
// color-setter
|
||||||
|
.lowcode-color-box {
|
||||||
|
margin-right: -5px;
|
||||||
|
padding: 3px 0 3px 3px;
|
||||||
|
width: 26px;
|
||||||
|
height: 26px;
|
||||||
|
display: inline-block;
|
||||||
|
div {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.next-balloon-normal.lowcode-color-content {
|
||||||
|
padding: 0;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 0;
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
&:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.sketch-picker {
|
||||||
|
border-radius: 0 !important;
|
||||||
|
border: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
.flexbox-fix {
|
||||||
|
input {
|
||||||
|
width: 100% !important;
|
||||||
|
min-width: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
302
packages/setters/src/mixin-setter/index.tsx
Normal file
302
packages/setters/src/mixin-setter/index.tsx
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
import React, { PureComponent } from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import { Dropdown, Button, Menu, Icon, Input, NumberPicker, Switch, Select, Radio, DatePicker } from '@alifd/next';
|
||||||
|
import MonacoEditor from '@ali/iceluna-comp-monaco-editor';
|
||||||
|
|
||||||
|
import { isJSExpression, generateI18n } from './locale/utils';
|
||||||
|
import Expression from '../expression-setter';
|
||||||
|
import zhCN from './locale/zh-CN';
|
||||||
|
import './index.scss';
|
||||||
|
|
||||||
|
const { Group: RadioGroup } = Radio;
|
||||||
|
// const isJSExpression = (obj) => {
|
||||||
|
// if(typeof obj === 'object' && obj.type === 'JSExpression') {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
export default class Mixin extends PureComponent {
|
||||||
|
static displayName = 'Mixin';
|
||||||
|
static propTypes = {
|
||||||
|
locale: PropTypes.string,
|
||||||
|
messages: PropTypes.object,
|
||||||
|
defaultType: PropTypes.string,
|
||||||
|
types: PropTypes.arrayOf(PropTypes.string),
|
||||||
|
onlyChangeType: PropTypes.bool,
|
||||||
|
inputProps: PropTypes.object,
|
||||||
|
expressionProps: PropTypes.object,
|
||||||
|
monacoEditorProps: PropTypes.object,
|
||||||
|
switchProps: PropTypes.object,
|
||||||
|
selectProps: PropTypes.object,
|
||||||
|
radioGroupProps: PropTypes.object,
|
||||||
|
};
|
||||||
|
static defaultProps = {
|
||||||
|
locale: 'zh-CN',
|
||||||
|
messages: zhCN,
|
||||||
|
types: ['StringSetter', 'ExpressionSetter', 'NumberSetter', 'BoolSetter', 'SelectSetter', 'RadioGroupSetter'],
|
||||||
|
};
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
let type = judgeTypeHandler(props, {});
|
||||||
|
this.i18n = generateI18n(props.locale, props.messages);
|
||||||
|
this.state = {
|
||||||
|
preType: type,
|
||||||
|
type
|
||||||
|
};
|
||||||
|
}
|
||||||
|
static getDerivedStateFromProps(props, state) {
|
||||||
|
if ('value' in props) {
|
||||||
|
let curType = judgeTypeHandler(props, state);
|
||||||
|
if (curType !== state.preType) {
|
||||||
|
return {
|
||||||
|
type: curType
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
changeType(type) {
|
||||||
|
if (typeof type === 'object' || type === this.state.type) return;
|
||||||
|
let { onlyChangeType, value, onChange } = this.props;
|
||||||
|
if (onlyChangeType) {
|
||||||
|
this.setState({ type });
|
||||||
|
onChange && onChange(value);
|
||||||
|
} else {
|
||||||
|
let newValue = undefined;
|
||||||
|
if (this.typeMap[type]['props']) {
|
||||||
|
if (this.typeMap[type]['props']['value'] !== undefined) {
|
||||||
|
newValue = this.typeMap[type]['props']['value'];
|
||||||
|
} else if (this.typeMap[type]['props']['defaultValue'] !== undefined) {
|
||||||
|
newValue = this.typeMap[type]['props']['defaultValue'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (type === 'BoolSetter' && newValue === undefined) {
|
||||||
|
newValue = false; //给切换到switch默认值为false
|
||||||
|
}
|
||||||
|
this.setState({ type });
|
||||||
|
onChange && onChange(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
style = {},
|
||||||
|
className,
|
||||||
|
locale,
|
||||||
|
messages,
|
||||||
|
types = [],
|
||||||
|
defaultType,
|
||||||
|
// inputProps,
|
||||||
|
// expressionProps,
|
||||||
|
// monacoEditorProps,
|
||||||
|
// numberPickerProps,
|
||||||
|
// switchProps,
|
||||||
|
// selectProps,
|
||||||
|
// radioGroupProps,
|
||||||
|
...restProps
|
||||||
|
} = this.props;
|
||||||
|
this.typeMap = {
|
||||||
|
StringSetter: {
|
||||||
|
label: this.i18n('input'),
|
||||||
|
component: Input,
|
||||||
|
// props: inputProps
|
||||||
|
},
|
||||||
|
ExpressionSetter: {
|
||||||
|
label: this.i18n('expression'),
|
||||||
|
component: Expression,
|
||||||
|
// props: expressionProps
|
||||||
|
},
|
||||||
|
// MonacoEditor: {
|
||||||
|
// label: this.i18n('monacoEditor'),
|
||||||
|
// component: MonacoEditor,
|
||||||
|
// props: monacoEditorProps
|
||||||
|
// },
|
||||||
|
NumberSetter: {
|
||||||
|
label: this.i18n('numberPicker'),
|
||||||
|
component: NumberPicker,
|
||||||
|
},
|
||||||
|
BoolSetter: {
|
||||||
|
label: this.i18n('bool'),
|
||||||
|
component: Switch,
|
||||||
|
},
|
||||||
|
SelectSetter: {
|
||||||
|
label: this.i18n('select'),
|
||||||
|
component: Select,
|
||||||
|
},
|
||||||
|
RadioGroupSetter: {
|
||||||
|
label: this.i18n('radio'),
|
||||||
|
component: RadioGroup,
|
||||||
|
},
|
||||||
|
TextAreaSetter: {
|
||||||
|
label: this.i18n('textarea'),
|
||||||
|
component: Input.TextArea,
|
||||||
|
},
|
||||||
|
DateSetter: {
|
||||||
|
label: this.i18n('date'),
|
||||||
|
component: DatePicker,
|
||||||
|
},
|
||||||
|
DateYearSetter: {
|
||||||
|
label: this.i18n('dateYear'),
|
||||||
|
component: DatePicker,
|
||||||
|
},
|
||||||
|
DateMonthSetter: {
|
||||||
|
label: this.i18n('dateMonth'),
|
||||||
|
component: DatePicker,
|
||||||
|
},
|
||||||
|
DateRangeSetter: {
|
||||||
|
label: this.i18n('dateRange'),
|
||||||
|
component: DatePicker,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let realTypes = [];
|
||||||
|
types.forEach( el => {
|
||||||
|
const { name, props } = el;
|
||||||
|
if (this.typeMap[name]) {
|
||||||
|
this.typeMap[name].props = props;
|
||||||
|
realTypes.push(name);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let moreBtnNode = null;
|
||||||
|
//如果只有2种,且有变量表达式,则直接展示变量按钮
|
||||||
|
if (realTypes.length > 1) {
|
||||||
|
let isTwoType = !!(realTypes.length === 2 && ~realTypes.indexOf('ExpressionSetter'));
|
||||||
|
let btnProps = {
|
||||||
|
size: 'small',
|
||||||
|
text: true,
|
||||||
|
style: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: '100%',
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
margin: 'auto 0 auto 8px',
|
||||||
|
padding: 0,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
lineHeight: '16px',
|
||||||
|
textAlign: 'center'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (isTwoType) {
|
||||||
|
btnProps.onClick = this.changeType.bind(this, realTypes.indexOf(this.state.type) ? realTypes[0] : realTypes[1]);
|
||||||
|
}
|
||||||
|
let triggerNode = (
|
||||||
|
<Button {...btnProps} size={isTwoType ? 'large' : 'small'}>
|
||||||
|
<Icon type={isTwoType ? 'edit' : 'ellipsis'} />
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
if (isTwoType) {
|
||||||
|
moreBtnNode = triggerNode;
|
||||||
|
} else {
|
||||||
|
let MenuItems = [];
|
||||||
|
realTypes.map(type => {
|
||||||
|
if (this.typeMap[type]) {
|
||||||
|
MenuItems.push(<Menu.Item key={type}>{this.typeMap[type]['label']}</Menu.Item>);
|
||||||
|
} else {
|
||||||
|
console.error(
|
||||||
|
this.i18n('typeError', {
|
||||||
|
type
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let MenuNode = (
|
||||||
|
<Menu
|
||||||
|
selectMode="single"
|
||||||
|
hasSelectedIcon={false}
|
||||||
|
selectedKeys={this.state.type}
|
||||||
|
onItemClick={this.changeType.bind(this)}
|
||||||
|
>
|
||||||
|
{MenuItems}
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
|
moreBtnNode = (
|
||||||
|
<Dropdown trigger={triggerNode} triggerType="click">
|
||||||
|
{MenuNode}
|
||||||
|
</Dropdown>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let TargetNode = this.typeMap[this.state.type] ? this.typeMap[this.state.type]['component'] : 'div';
|
||||||
|
let targetProps = this.typeMap[this.state.type] ? this.typeMap[this.state.type]['props'] : {};
|
||||||
|
|
||||||
|
// 特殊处理Switch的值
|
||||||
|
if (['BoolSetter', 'RadioGroupSetter'].includes(this.state.type)) {
|
||||||
|
restProps.checked = this.props.checked !== undefined ? this.props.checked : this.props.value;
|
||||||
|
}
|
||||||
|
//判断如果Mixin内部有设置onChange, 则同时触发2处onChange
|
||||||
|
if (targetProps && targetProps.onChange && typeof targetProps.onChange === 'function') {
|
||||||
|
let tarOnChange = targetProps.onChange;
|
||||||
|
targetProps.onChange = function() {
|
||||||
|
tarOnChange.apply(null, arguments);
|
||||||
|
restProps.onChange && restProps.onChange.apply(null, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
let tarStyle = { position: 'relative', ...style };
|
||||||
|
let classes = classNames(className, 'lowcode-setter-mixin');
|
||||||
|
return (
|
||||||
|
<div style={tarStyle} className={classes}>
|
||||||
|
<TargetNode {...restProps} {...targetProps} />
|
||||||
|
{moreBtnNode}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断值类型
|
||||||
|
function judgeTypeHandler(props, state) {
|
||||||
|
let { defaultType, types, value } = props;
|
||||||
|
let selectProps: { dataSource: any[]; };
|
||||||
|
let radioGroupProps: { dataSource: any[]; };
|
||||||
|
let typeKeys: any[] = [];
|
||||||
|
types.forEach( el => {
|
||||||
|
typeKeys.push(el.name);
|
||||||
|
})
|
||||||
|
|
||||||
|
types.forEach((el: { name: string; props: {}; }) => {
|
||||||
|
if (el.name === 'SelectSetter') {selectProps === el.props;}
|
||||||
|
if (el.name === 'RadioGroupSetter') {radioGroupProps === el.props;}
|
||||||
|
})
|
||||||
|
if (!defaultType || !typeKeys) return;
|
||||||
|
// 如果defaultType不在typeKeys列表中,默认返回typeKeys的第一项
|
||||||
|
if (!typeKeys.includes(defaultType)) return typeKeys[0];
|
||||||
|
if (isJSExpression(value)) return 'ExpressionSetter';
|
||||||
|
if (value && typeof value === 'string') {
|
||||||
|
if (~typeKeys.indexOf('SelectSetter') && selectProps && selectProps.dataSource) {
|
||||||
|
let hasOption = selectProps.dataSource.some(item => {
|
||||||
|
if (typeof item === 'string' && item === value) return true;
|
||||||
|
if (typeof item === 'object' && item.value === value) return true;
|
||||||
|
});
|
||||||
|
if (hasOption) return 'SelectSetter';
|
||||||
|
}
|
||||||
|
if (~typeKeys.indexOf('RadioGroupSetter') && radioGroupProps && radioGroupProps.dataSource) {
|
||||||
|
let hasOption = radioGroupProps.dataSource.some(item => {
|
||||||
|
if (typeof item === 'object' && item.value === value) return true;
|
||||||
|
});
|
||||||
|
if (hasOption) return 'RadioGroupSetter';
|
||||||
|
}
|
||||||
|
if (~typeKeys.indexOf('StringSetter')) return 'StringSetter';
|
||||||
|
}
|
||||||
|
if (typeof value === 'number') {
|
||||||
|
if (~typeKeys.indexOf('SelectSetter') && selectProps && selectProps.dataSource) {
|
||||||
|
let hasOption = selectProps.dataSource.some(item => {
|
||||||
|
if (typeof item === 'object' && item.value === value) return true;
|
||||||
|
});
|
||||||
|
if (hasOption) return 'Select';
|
||||||
|
}
|
||||||
|
if (~typeKeys.indexOf('RadioGroupSetter') && radioGroupProps && radioGroupProps.dataSource) {
|
||||||
|
let hasOption = radioGroupProps.dataSource.some(item => {
|
||||||
|
if (typeof item === 'object' && item.value === value) return true;
|
||||||
|
});
|
||||||
|
if (hasOption) return 'RadioGroupSetter';
|
||||||
|
}
|
||||||
|
if (~typeKeys.indexOf('NumberSetter')) return 'NumberSetter';
|
||||||
|
}
|
||||||
|
if (~typeKeys.indexOf('NumberSetter') && typeof value === 'number') return 'NumberSetter';
|
||||||
|
if (~typeKeys.indexOf('BoolSetter') && (value === false || value === true)) return 'BoolSetter';
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
if (~typeKeys.indexOf('SelectSetter') && typeof value[0] === 'string') return 'SelectSetter';
|
||||||
|
}
|
||||||
|
return state.type || defaultType;
|
||||||
|
}
|
||||||
242
packages/setters/src/mixin-setter/locale/snippets.js
Normal file
242
packages/setters/src/mixin-setter/locale/snippets.js
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
label: 'constants',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'constants',
|
||||||
|
detail: '应用全局常量',
|
||||||
|
documentation: '应用范围定义的通用常量'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'utils',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'utils',
|
||||||
|
detail: '应用全局公共函数',
|
||||||
|
documentation: '应用范围扩展的公共函数'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'state',
|
||||||
|
kind: 'Enum',
|
||||||
|
insertText: 'state',
|
||||||
|
detail: '当前所在容器组件内部状态',
|
||||||
|
documentation: 'React Class内部状态state'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'setState',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'setState({\n\t$0\n})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '设置当前所在容器组件的state数据',
|
||||||
|
documentation: '原生React方法,会自动更新组件视图'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'reloadDataSource',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'reloadDataSource(${1:${2:namespace}, ${3:false}, ${4:callback}})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '刷新当前所在的容器组件',
|
||||||
|
documentation: '触发当前所在的容器组件,重新发送异步请求,并用最新数据更新视图'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'location',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'location',
|
||||||
|
detail: '路由解析对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'location.query',
|
||||||
|
kind: 'Value',
|
||||||
|
insertText: 'location.query.${1:xxxx}',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '从路由解析对象中获取参数信息'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'history',
|
||||||
|
kind: 'Class',
|
||||||
|
insertText: 'history',
|
||||||
|
detail: '路由历史对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'React',
|
||||||
|
kind: 'Keyword',
|
||||||
|
insertText: 'React',
|
||||||
|
detail: 'React对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'ReactDOM',
|
||||||
|
kind: 'Keyword',
|
||||||
|
insertText: 'ReactDOM',
|
||||||
|
detail: 'ReactDom对象'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'ReactDOM.findDOMNode',
|
||||||
|
kind: 'Function',
|
||||||
|
insertText: 'ReactDOM.findDOMNode(${1:this.refs.xxxx})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'ReactDom查找真实dom node'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dialog.alert',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Dialog.alert({',
|
||||||
|
"\tcontent: '${1:Alert content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'alert弹框 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Dialog.confirm',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Dialog.confirm({',
|
||||||
|
"\tcontent: '${1:Confirm content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '确认弹出框 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.success',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.success(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '成功反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.error',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.error(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '错误反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.help',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.help(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '帮助反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.loading',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.loading(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: 'loading反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.notice',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.notice(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '注意反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Message.waining',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: 'Message.waining(${1:content})',
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '警告反馈提示 By Fusion'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.confirm',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.confirm({',
|
||||||
|
"\tcontent: '${1:Confirm content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '确认弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.info',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.info({',
|
||||||
|
"\tcontent: '${1:Info content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '信息弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.success',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.success({',
|
||||||
|
"\tcontent: '${1:Success content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '成功弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.error',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.error({',
|
||||||
|
"\tcontent: '${1:Error content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '错误弹出框 By Antd'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Modal.warning',
|
||||||
|
kind: 'Method',
|
||||||
|
insertText: [
|
||||||
|
'Modal.warning({',
|
||||||
|
"\tcontent: '${1:Warning content}',",
|
||||||
|
"\ttitle: '${2:Title}',",
|
||||||
|
'\tonOk: () => {',
|
||||||
|
'\t\t$3',
|
||||||
|
'\t},',
|
||||||
|
'\tonCancel: () => {',
|
||||||
|
'\t\t$4',
|
||||||
|
'\t}',
|
||||||
|
'})'
|
||||||
|
].join('\n'),
|
||||||
|
insertTextRules: 'InsertAsSnippet',
|
||||||
|
detail: '警告弹出框 By Antd'
|
||||||
|
}
|
||||||
|
];
|
||||||
21
packages/setters/src/mixin-setter/locale/utils.js
Normal file
21
packages/setters/src/mixin-setter/locale/utils.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import IntlMessageFormat from 'intl-messageformat';
|
||||||
|
|
||||||
|
export const isJSExpression = (obj = '') => {
|
||||||
|
if(obj && typeof obj === 'object' && obj.type === 'JSExpression') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于构造国际化字符串处理函数
|
||||||
|
* @param {*} locale 国际化标识,例如 zh-CN、en-US
|
||||||
|
* @param {*} messages 国际化语言包
|
||||||
|
*/
|
||||||
|
export const generateI18n = (locale = 'zh-CN', messages = {}) => {
|
||||||
|
return function (key, values = {}) {
|
||||||
|
if (!messages || !messages[key]) return '';
|
||||||
|
const formater = new IntlMessageFormat(messages[key], locale);
|
||||||
|
return formater.format(values);
|
||||||
|
};
|
||||||
|
}
|
||||||
36
packages/setters/src/mixin-setter/locale/zh-CN.js
Normal file
36
packages/setters/src/mixin-setter/locale/zh-CN.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
export default {
|
||||||
|
// function
|
||||||
|
setting: '点击设置',
|
||||||
|
edit: '编辑',
|
||||||
|
submitConfirm: '确认提交 cmd+s',
|
||||||
|
close: '关闭 esc',
|
||||||
|
fullScreen: '全屏',
|
||||||
|
cancelFullScreen: '取消全屏',
|
||||||
|
jsonIllegal: '非json格式',
|
||||||
|
functionIllegal: '非function格式',
|
||||||
|
objectIllegal: '非object格式',
|
||||||
|
circularRef: '对象中出现循环引用的对象',
|
||||||
|
formatError: '格式错误',
|
||||||
|
saved: '已保存',
|
||||||
|
// expression
|
||||||
|
valueIllegal: '值类型为对象类型,与当前组件属性设置的控件类型不匹配,请在属性“代码编辑模式”下进行编辑',
|
||||||
|
jsExpression: '请输入JS表达式',
|
||||||
|
// Mixin
|
||||||
|
input: '字符串Input',
|
||||||
|
textarea: '多行字符串Textarea',
|
||||||
|
expression: '变量控件Expression',
|
||||||
|
monacoEditor: '编辑器MonacoEditor',
|
||||||
|
numberPicker: '数字NumberPicker',
|
||||||
|
bool: '布尔Switch',
|
||||||
|
datePicker: '日期选择DatePicker',
|
||||||
|
select: '下拉选择Select',
|
||||||
|
radio: '单项选择RadioGroup',
|
||||||
|
date: '日期选择DatePicker',
|
||||||
|
dateYear: '年选择DatePicker',
|
||||||
|
dateMonth: '月选择DatePicker',
|
||||||
|
dateRange: '日期区间选择DatePicker',
|
||||||
|
list: '数组List',
|
||||||
|
object: '对象ObjectButton',
|
||||||
|
reactNode: '节点类型ReactNode',
|
||||||
|
typeError: 'Minix组件属性Types配置错误,存在不支持类型[{type}],请检查组件属性配置',
|
||||||
|
};
|
||||||
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {},
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./src/"
|
"./src/"
|
||||||
]
|
]
|
||||||
|
|||||||
70
scripts/addowner.js
Executable file
70
scripts/addowner.js
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const process = require('process');
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
|
||||||
|
let [ owner, pkg ] = process.argv.slice(2);
|
||||||
|
|
||||||
|
const packages_dir = path.join(__dirname, '..', 'packages');
|
||||||
|
function getPackageNames() {
|
||||||
|
const ls = fs.readdirSync(packages_dir, 'utf-8');
|
||||||
|
const packageNames = [];
|
||||||
|
ls.forEach((item) => {
|
||||||
|
if (item.charAt(0) === '.') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const packageJsonFile = path.join(packages_dir, item, 'package.json');
|
||||||
|
|
||||||
|
if (fs.existsSync(packageJsonFile)) {
|
||||||
|
const json = require(packageJsonFile);
|
||||||
|
if (!json.private && json.name) {
|
||||||
|
packageNames.push(json.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return packageNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
const owners_file = path.join(__dirname, './owners.json');
|
||||||
|
const owners = require(owners_file);
|
||||||
|
function addPackageOwners(packageName) {
|
||||||
|
owners.forEach(owner => addOwner(packageName, owner));
|
||||||
|
}
|
||||||
|
|
||||||
|
function addOwner(packageName, owner) {
|
||||||
|
console.info(`addowner "${owner}" for "${packageName}"`);
|
||||||
|
try {
|
||||||
|
execSync(`tnpm owner add ${owner} ${packageName}`, {
|
||||||
|
encoding: 'utf-8'
|
||||||
|
});
|
||||||
|
console.info('OK');
|
||||||
|
} catch (e) {
|
||||||
|
console.info(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg) {
|
||||||
|
const packageJsonFile = path.join(packages_dir, item, 'package.json');
|
||||||
|
|
||||||
|
if (fs.existsSync(packageJsonFile)) {
|
||||||
|
const json = require(packageJsonFile);
|
||||||
|
if (!json.private && json.name) {
|
||||||
|
pkg = json.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (owner === '*') {
|
||||||
|
addPackageOwners(pkg);
|
||||||
|
} else {
|
||||||
|
addOwner(pkg, owner);
|
||||||
|
}
|
||||||
|
} else if (owner) {
|
||||||
|
getPackageNames().forEach(packageName => {
|
||||||
|
addOwner(packageName, owner);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const pkgs = getPackageNames();
|
||||||
|
pkgs.forEach(packageName => {
|
||||||
|
addPackageOwners(packageName);
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -7,9 +7,9 @@ echo "Deploy ${PWD} -> ${BUILD_DEST} ..."
|
|||||||
|
|
||||||
cd deploy-space
|
cd deploy-space
|
||||||
# basic environment preparing
|
# basic environment preparing
|
||||||
tnpm install yarn lerna --install-node=10
|
tnpm install @ali/tyarn lerna --install-node=10
|
||||||
mv node_modules env
|
mv node_modules .env
|
||||||
export PATH=$WORK_DIR/deploy-space/env/.bin:$PATH
|
export PATH=$WORK_DIR/deploy-space/.env/.bin:$PATH
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Use node version:"
|
echo "Use node version:"
|
||||||
@ -17,7 +17,7 @@ node -v
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# set source
|
# set source
|
||||||
yarn config set registry https://registry.npm.alibaba-inc.com
|
# yarn config set registry https://registry.npm.alibaba-inc.com
|
||||||
|
|
||||||
# work
|
# work
|
||||||
mkdir packages
|
mkdir packages
|
||||||
|
|||||||
13
scripts/owners.json
Normal file
13
scripts/owners.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[
|
||||||
|
"bingbing.yb",
|
||||||
|
"wuyue.xht",
|
||||||
|
"xiayang.xy",
|
||||||
|
"jianhui.fjh",
|
||||||
|
"armslave.yy",
|
||||||
|
"gengyang.gy",
|
||||||
|
"alex.mm",
|
||||||
|
"jianfang.rjf",
|
||||||
|
"zude.hzd",
|
||||||
|
"qianshan.wengqs",
|
||||||
|
"mario.gk"
|
||||||
|
]
|
||||||
@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
tnpm i -g lerna @ali/tyarn
|
||||||
|
|
||||||
rm -rf node_modules package-lock.json yarn.lock
|
rm -rf node_modules package-lock.json yarn.lock
|
||||||
lerna clean -y
|
lerna clean -y
|
||||||
find ./packages -type f -name "package-lock.json" -exec rm -f {} \;
|
find ./packages -type f -name "package-lock.json" -exec rm -f {} \;
|
||||||
|
|
||||||
yarn install --registry=http://registry.npm.alibaba-inc.com
|
|
||||||
lerna bootstrap
|
lerna bootstrap
|
||||||
|
|||||||
@ -37,7 +37,8 @@
|
|||||||
"baseUrl": "./packages",
|
"baseUrl": "./packages",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@ali/lowcode-*": ["./*/src"]
|
"@ali/lowcode-*": ["./*/src"]
|
||||||
}
|
},
|
||||||
|
"outDir": "lib"
|
||||||
},
|
},
|
||||||
"exclude": ["**/test", "**/lib", "**/es", "node_modules"]
|
"exclude": ["**/test", "**/lib", "**/es", "node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user