YaolongHan 4 years ago
parent
commit
060cd3ab38
32 changed files with 390 additions and 70 deletions
  1. 9 0
      persagy-web-big-edit/.editorconfig
  2. 58 0
      persagy-web-big-edit/.eslintrc.js
  3. 13 0
      persagy-web-big-edit/.npmignore
  4. 37 0
      persagy-web-big-edit/README.md
  5. 38 0
      persagy-web-big-edit/jest.config.js
  6. 46 0
      persagy-web-big-edit/package.json
  7. 58 0
      persagy-web-big-edit/publish.js
  8. 1 1
      persagy-web-big-edit/src/BigEditFactory.ts
  9. 14 12
      persagy-web-big-edit/src/SBaseEditScene.ts
  10. 2 2
      persagy-web-big-edit/src/items/SBaseArrow.ts
  11. 2 4
      persagy-web-big-edit/src/items/SBaseEquipment.ts
  12. 2 2
      persagy-web-big-edit/src/items/SBaseExpainEdit.ts
  13. 2 2
      persagy-web-big-edit/src/items/SBasePipe.ts
  14. 14 14
      persagy-web-big-edit/src/items/SBasePipeUninTool.ts
  15. 1 1
      persagy-web-big-edit/src/types/Anchor.ts
  16. 2 2
      persagy-web-big-edit/src/types/Legend.ts
  17. 1 1
      persagy-web-big-edit/src/types/Marker.ts
  18. 1 1
      persagy-web-big-edit/src/types/Relation.ts
  19. 1 11
      persagy-web-big-edit/src/until.ts
  20. 16 0
      persagy-web-big-edit/tsconfig.json
  21. 6 0
      persagy-web-big-edit/typedoc.json
  22. 6 6
      persagy-web-edit/package.json
  23. 14 0
      persagy-web-edit/src/SGraphEdit.ts
  24. 0 2
      persagy-web-edit/src/items/SBaseIconTextEdit.ts
  25. 2 2
      persagy-web-edit/src/items/SBaseImageEdit.ts
  26. 2 2
      persagy-web-edit/src/items/SBasePolygonEdit.ts
  27. 1 1
      persagy-web-edit/src/items/SBaseTextEdit.ts
  28. 1 1
      persagy-web-edit/src/type/Anchor.ts
  29. 1 1
      persagy-web-edit/src/type/Legend.ts
  30. 37 0
      persagy-web-edit/src/type/Point.ts
  31. 1 1
      persagy-web-edit/src/type/Relation.ts
  32. 1 1
      persagy-web-edit/tsconfig.json

+ 9 - 0
persagy-web-big-edit/.editorconfig

@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 4
+end_of_line =lf
+insert_final_newline = true
+trim_trailing_whitespace = true

+ 58 - 0
persagy-web-big-edit/.eslintrc.js

@@ -0,0 +1,58 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2016-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+module.exports = {
+    root: true,
+    parser: '@typescript-eslint/parser',
+    extends: [
+        'plugin:@typescript-eslint/recommended',
+        // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
+        'prettier/@typescript-eslint',
+        // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
+        // 此行必须在最后
+        'plugin:prettier/recommended'
+    ],
+    env: {
+        es6: true,
+        node: true
+    },
+    parserOptions: {
+        // 支持最新 JavaScript
+        ecmaVersion: 2018,
+        sourceType: 'module'
+    },
+    rules: {
+        // 缩进
+        'indent': ['error', 4, { SwitchCase: 1 }],      // 缩进控制4空格
+        'max-len': ['error', 120],                      // 每行字符不超过120
+        'no-mixed-spaces-and-tabs': 'error',            // 禁止使用空格和tab混合缩进
+        // 语句
+        'curly': ["error", "multi-line"],               // if、else if、else、for、while强制使用大括号,但允许在单行中省略大括号。
+        'semi': ['error', 'always'],                    //不得省略语句结束的分号
+        '@typescript-eslint/no-unused-vars': 'off',     // 取消未使用变量检查
+        '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }]       // public访问不需加访问修饰符
+    }
+};

+ 13 - 0
persagy-web-big-edit/.npmignore

@@ -0,0 +1,13 @@
+# 发布时排除
+api/
+docs/
+src/
+.editorconfig
+.eslintrc.js
+*.iml
+coverage
+jest.config.js
+tsconfig.json
+typedoc.json
+publish.js
+package-lock.json

+ 37 - 0
persagy-web-big-edit/README.md

@@ -0,0 +1,37 @@
+# 博锐尚格二维图形编辑器
+## 安装
+安装有三种方式: 全局安装,现有项目安装,package.json 方式。
+* 注:安装前需要在安装其他包完成后,修改npm 源;因为该包为公司私有包。
+```
+npm config set registry http://dev.dp.sagacloud.cn:8082/repository/npm-saga/
+```
+
+### 全局安装
+```
+# persagy-web-edit 全局安装
+npm install -g @persagy-web/edit
+```
+### 现有项目
+如果你想在一个现有项目中使用 @persagy-web/edit,则应该将 @persagy-web/edit 安装为本地依赖。
+```
+# 将 @persagy-web/edit 作为一个本地依赖安装
+npm install -D @persagy-web/edit
+```
+### package.json
+```
+  "dependencies": {
+        "@persagy-web/graph": "2.2.1",
+        "@persagy-web/big": "2.2.1",
+        "@types/uuid": "^8.0.0"
+    }
+```
+在项目文件夹执行如下命令安装项目依赖。
+```
+npm install
+```
+## 参考
+### 开发文档
+* [http://adm.sagacloud.cn:8080/doc/web/guides/edit/](http://adm.sagacloud.cn:8080/doc/web/guides/edit/)
+
+### api 参考
+* [http://adm.sagacloud.cn:8080/api/web/edit/](http://adm.sagacloud.cn:8080/api/web/edit/)

+ 38 - 0
persagy-web-big-edit/jest.config.js

@@ -0,0 +1,38 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2016-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+module.exports = {
+    preset: "ts-jest",
+    moduleFileExtensions: ["js", "ts"],
+    transform: {
+        "^.+\\.tsx?$": "ts-jest"
+    },
+    transformIgnorePatterns: ["/node_modules/"],
+    moduleNameMapper: {
+        "^@/(.*)$": "<rootDir>/src/$1"
+    },
+    collectCoverage: true
+};

+ 46 - 0
persagy-web-big-edit/package.json

@@ -0,0 +1,46 @@
+{
+    "name": "@persagy-web/bigedit",
+    "version": "2.2.1",
+    "description": "博锐尚格二维图形编辑器。",
+    "main": "lib/index.js",
+    "types": "lib/index.d.js",
+    "remote": {
+        "host": "47.93.22.124",
+        "path": "/opt/web/doc/api/web/bigedit",
+        "user": "doc",
+        "password": "saga2020(^cloud==",
+        "local": "api"
+    },
+    "scripts": {
+        "build": "tsc",
+        "publish": "npm publish",
+        "lint": "eslint src/**/*.{js,ts,tsx}",
+        "test": "echo \"Error: no test specified\" && exit 1",
+        "typedoc": "typedoc --out api --hideGenerator src",
+        "publish-api": "node publish.js"
+    },
+    "keywords": [
+        "graph-big-edit"
+    ],
+    "author": "韩耀龙 <han_yao_long@163.com> ",
+    "license": "ISC",
+    "publishConfig": {
+        "registry": "http://dev.dp.sagacloud.cn:8082/repository/npm-hosted/"
+    },
+    "devDependencies": {
+        "@typescript-eslint/eslint-plugin": "^1.12.0",
+        "@typescript-eslint/parser": "^1.12.0",
+        "eslint": "^6.0.1",
+        "eslint-config-prettier": "^6.0.0",
+        "eslint-plugin-prettier": "^3.1.0",
+        "node-ssh": "^6.0.0",
+        "prettier": "^1.18.2",
+        "ts-jest": "^24.0.2",
+        "typedoc": "^0.17.4",
+        "typescript": "^3.5.3"
+    },
+    "dependencies": {
+        "@persagy-web/graph": "2.2.22",
+        "@types/uuid": "^8.0.0"
+    }
+}

+ 58 - 0
persagy-web-big-edit/publish.js

@@ -0,0 +1,58 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2016-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+const Client = require("node-ssh");
+const ssh = new Client();
+
+ssh.connect({
+    host: process.env.npm_package_remote_host,
+    port: "22",
+    username: process.env.npm_package_remote_user,
+    password: process.env.npm_package_remote_password
+}).then(() => {
+    const failedList = [];
+    ssh.putDirectory(
+        process.env.npm_package_remote_local,
+        process.env.npm_package_remote_path,
+        {
+            recursive: true,
+            concurrency: 1,
+            tick: function(localPath, remotePath, error) {
+                if (error) {
+                    failedList.push(localPath);
+                }
+            }
+        }
+    ).then(status => {
+        if (failedList.length > 0) {
+            console.log("发布失败");
+            console.log("failed transfers", failedList.join(", "));
+        } else {
+            console.log(status ? "发布成功" : "发布失败");
+        }
+        ssh.dispose();
+    });
+});

+ 1 - 1
persagy-web-big-edit/src/BigEditFactory.ts

@@ -31,7 +31,7 @@ import {
     SBasePolygonEdit,
     SBaseRectEdit,
     SBaseTextEdit
-} from "./../edit";
+} from "@persagy-web/edit/lib/";
 import {Marker, SBaseArrow, SBaseExpainEdit} from "./"
 import {SItemFactory} from "@persagy-web/big"
 

+ 14 - 12
persagy-web-big-edit/src/SBaseEditScene.ts

@@ -24,13 +24,14 @@
  * *********************************************************************************************************************
  */
 
-import {SGraphAddCommand, SGraphEditScene} from "../edit"
-import {SMouseEvent} from "@persagy-web/base/lib";
-import {SArrowStyleType, SPoint, SRect} from '@persagy-web/draw/lib';
-import {SItemStatus, SRectSelectItem} from '@persagy-web/big/lib';
-import {SGraphItem, SGraphSelectContainer} from "@persagy-web/graph/";
-import {uuid} from "./until";
-import {SBaseArrow, SBaseEquipment, SBaseExpainEdit, SBasePipeUninTool} from "./"
+import { SGraphAddCommand, SGraphEditScene, SGraphEdit } from "@persagy-web/edit/lib"
+import { SMouseEvent } from "@persagy-web/base/lib";
+import { SArrowStyleType, SPoint, SRect } from '@persagy-web/draw';
+import { SItemStatus, SRectSelectItem } from '@persagy-web/big/lib';
+import { SGraphItem, SGraphSelectContainer } from "@persagy-web/graph/lib/";
+import { uuid } from "./until";
+import { SBaseArrow, SBaseEquipment, SBaseExpainEdit, SBasePipeUninTool, SBasePipe } from "./"
+
 
 /**
  * big-edit 场景
@@ -46,6 +47,7 @@ export class SBaseEditScene extends SGraphEditScene {
     Relations: any = [];
     /** 复制的对象 */
     copyString: any[] = [];
+    grabItem: null | SGraphEdit | SGraphItem  = null
 
     /**
      * 构造函数
@@ -105,7 +107,7 @@ export class SBaseEditScene extends SGraphEditScene {
                 type: "BaseArrow",
             },
             style: {
-                outLine: [{x: event.x, y: event.y}],
+                outLine: [{ x: event.x, y: event.y }],
                 begin: SArrowStyleType.None,  //开端箭头样式
                 end: SArrowStyleType.None,    //结尾箭头样式
                 isMove: true,                 //是否可以移动
@@ -148,7 +150,7 @@ export class SBaseEditScene extends SGraphEditScene {
             style: {
                 default: {
                     strokecolor: "#c0ccda",
-                    url: require('./../../../assets/images/equip/' + legendObj.url),
+                    // url: require('./../../../assets/images/equip/' + legendObj.url),
                 }
             }
         }
@@ -246,7 +248,7 @@ export class SBaseEditScene extends SGraphEditScene {
      * 重做
      */
     redo(): void {
-        if (this.grabItem && this.grabItem.redo) {
+        if (this.grabItem && this.grabItem instanceof SGraphEdit) {
             this.grabItem.redo()
         } else {
             this.undoStack.redo();
@@ -257,7 +259,7 @@ export class SBaseEditScene extends SGraphEditScene {
      * 撤销
      */
     undo(): void {
-        if (this.grabItem && this.grabItem.undo) {
+        if (this.grabItem && this.grabItem instanceof SGraphEdit) {
             this.grabItem.undo()
         } else {
             this.undoStack.undo();
@@ -370,7 +372,7 @@ export class SBaseEditScene extends SGraphEditScene {
     /**
      * 复制
      */
-    copy():void {
+    copy(): void {
         const itemList = this.selectContainer.itemList
         if (itemList.length) {
             itemList.forEach(t => {

+ 2 - 2
persagy-web-big-edit/src/items/SBaseArrow.ts

@@ -25,8 +25,8 @@
  */
 
 import { SColor, SFont, SPainter, SArrowStyleType } from "@persagy-web/draw/";
-import { SBasePolylineEdit } from './../../edit';
-import { SGraphItem, SLineStyle } from "@persagy-web/graph";
+import { SBasePolylineEdit } from '@persagy-web/edit/lib';
+import { SGraphItem, SLineStyle } from "@persagy-web/graph/lib";
 import { Marker } from "./../types/Marker";
 import { SMouseEvent } from "@persagy-web/base/lib";
 import { ItemOrder } from '@persagy-web/big/lib';

+ 2 - 4
persagy-web-big-edit/src/items/SBaseEquipment.ts

@@ -24,11 +24,9 @@
  * *********************************************************************************************************************
  */
 
-import { SColor, SLine, SPainter, SPoint, SRect } from "@persagy-web/draw/";
-import { SGraphItem, SGraphSvg } from "@persagy-web/graph";
-import { SGraphEdit } from '../../edit/';
+import { SGraphItem } from "@persagy-web/graph/lib";
 import { Marker } from "./../types/Marker";
-import { SBaseImageEdit } from './../../edit';
+import { SBaseImageEdit } from '@persagy-web/edit/lib';
 
 /**
  * 编辑基础设备类

+ 2 - 2
persagy-web-big-edit/src/items/SBaseExpainEdit.ts

@@ -24,8 +24,8 @@
 * *********************************************************************************************************************
 */
 
-import {SBaseTextEdit} from './../../edit';
-import {SGraphItem} from "@persagy-web/graph";
+import {SBaseTextEdit} from '@persagy-web/edit/lib';
+import {SGraphItem} from "@persagy-web/graph/lib";
 import {Marker} from "./../types/Marker";
 import {SMouseEvent} from "@persagy-web/base/lib";
 

+ 2 - 2
persagy-web-big-edit/src/items/SBasePipe.ts

@@ -24,8 +24,8 @@
  * *********************************************************************************************************************
  */
 
-import {SBasePolylineEdit} from './../../edit';
-import {SGraphItem} from "@persagy-web/graph";
+import {SBasePolylineEdit} from '@persagy-web/edit/lib';
+import {SGraphItem} from "@persagy-web/graph/lib/";
 import {Marker} from "./../types/Marker";
 import {SMouseEvent} from "@persagy-web/base/lib";
 

+ 14 - 14
persagy-web-big-edit/src/items/SBasePipeUninTool.ts

@@ -24,8 +24,8 @@
  * *********************************************************************************************************************
  */
 
-import {SBaseImageEdit} from './../../edit';
-import {SGraphItem} from "@persagy-web/graph";
+import {SBaseImageEdit} from '@persagy-web/edit/lib';
+import {SGraphItem} from "@persagy-web/graph/lib";
 import {Marker} from "./../types/Marker";
 import {SMouseEvent} from "@persagy-web/base/lib";
 
@@ -47,18 +47,18 @@ export class SBasePipeUninTool extends SBaseImageEdit {
         super(parent, data);
         if (data && data.style) {
             switch (data.style.uninToolType) {
-                case 2:
-                    this.url = require('./../../../../assets/images/leftImgs/wantou.png');
-                    break;
-                case 3:
-                    this.url = require('./../../../../assets/images/leftImgs/santong.png');
-                    break;
-                case 4:
-                    this.url = require('./../../../../assets/images/leftImgs/sitong.png');
-                    break;
-                default:
-                    this.url = require('./../../../../assets/images/leftImgs/wantou.png');
-                    break;
+                // case 2:
+                //     this.url = require('./../../../../assets/images/leftImgs/wantou.png');
+                //     break;
+                // case 3:
+                //     this.url = require('./../../../../assets/images/leftImgs/santong.png');
+                //     break;
+                // case 4:
+                //     this.url = require('./../../../../assets/images/leftImgs/sitong.png');
+                //     break;
+                // default:
+                //     this.url = require('./../../../../assets/images/leftImgs/wantou.png');
+                //     break;
             }
         }
     } // Constructor

+ 1 - 1
persagy-web-big-edit/src/types/Anchor.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "@persagy-web/big/lib/types/Point";
+import { Point } from "@persagy-web/edit/lib/type/Point";
 
 /**
  * 锚点 item 接口

+ 2 - 2
persagy-web-big-edit/src/types/Legend.ts

@@ -25,9 +25,9 @@
  */
 
 import { Anchor } from "./Anchor";
-import { Point } from "@persagy-web/big/lib/types/Point";
+import { Point } from "@persagy-web/edit/lib/type/Point";
 import { Size } from "@persagy-web/big/lib/types/Size";
-import { SPoint } from '@persagy-web/draw/lib';
+import { SPoint } from '@persagy-web/draw/';
 
 /**
  * 图例节点接口

+ 1 - 1
persagy-web-big-edit/src/types/Marker.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "@persagy-web/graph/lib/types/Point";
+import { Point } from "@persagy-web/edit/lib/type/Point";
 import { Size } from "@persagy-web/big/lib/types/Size";
 
 /**

+ 1 - 1
persagy-web-big-edit/src/types/Relation.ts

@@ -25,7 +25,7 @@
  */
 
 import { SRelationDir } from "@persagy-web/big/lib/enums/SRelationDir";
-import { Point } from "@persagy-web/big/lib/types/Point";
+import { Point } from "@persagy-web/edit/lib/type/Point";
 
 /**
  * 管线对象关系接口

+ 1 - 11
persagy-web-big-edit/src/until.ts

@@ -1,16 +1,6 @@
 //  生成uuid
 export function uuid() {
-    const s = [];
-    const hexDigits = "0123456789abcdef";
-    for (let i = 0; i < 36; i++) {
-        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
-    }
-    s[14] = "4";
-    s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
-    s[8] = s[13] = s[18] = s[23] = "-";
-
-    const uuid = s.join("");
-    return `${uuid}-${new Date().getTime()}`;
+  // do nothing
 }
 
 export function rgbaNum(rgba: string) {

+ 16 - 0
persagy-web-big-edit/tsconfig.json

@@ -0,0 +1,16 @@
+{
+    "compilerOptions": {
+        "target": "es6",                            // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'.
+        "module": "commonjs",                       // Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'.
+        "outDir": "./lib",                          // 编译后生成的文件目录
+        "strict": true,                             // 开启严格的类型检测
+        "declaration": true,                        // 生成 `.d.ts` 文件
+        "experimentalDecorators": true,             // 开启装饰器
+        "removeComments": true,                     // 去除注释
+        "noImplicitAny": false,                      // 在表达式和声明上有隐含的 any类型时报错。
+        "esModuleInterop": true,                    // 支持别名导入
+        "moduleResolution": "node"                  // 此处设置为node,才能解析import xx from 'xx'
+    },
+    "include": ["./src"],
+    "exclude": ["node_modules"]
+}

+ 6 - 0
persagy-web-big-edit/typedoc.json

@@ -0,0 +1,6 @@
+{
+    "name": "博锐尚格绘制引擎",
+    "mode": "file",
+    "out": "doc",
+    "exclude": ["**/*+(index|.test).ts"]
+}

+ 6 - 6
persagy-web-edit/package.json

@@ -5,10 +5,10 @@
     "main": "lib/index.js",
     "types": "lib/index.d.js",
     "remote": {
-        "host": "47.94.89.44",
-        "path": "/opt/tomcat9/webapps/api/web/edit",
-        "user": "user1",
-        "password": "@)!^sagacloud",
+        "host": "47.93.22.124",
+        "path": "/opt/web/doc/api/web/edit",
+        "user": "doc",
+        "password": "saga2020(^cloud==",
         "local": "api"
     },
     "scripts": {
@@ -40,7 +40,7 @@
         "typescript": "^3.5.3"
     },
     "dependencies": {
-        "@persagy-web/big": "2.2.13",
+        "@persagy-web/graph": "2.2.22",
         "@types/uuid": "^8.0.0"
     }
-}
+}

+ 14 - 0
persagy-web-edit/src/SGraphEdit.ts

@@ -67,6 +67,20 @@ export class SGraphEdit extends SGraphItem {
     } // Constructor
 
     /**
+     * 重做
+     */
+    redo(): void {
+        // do nothing
+    } // Function redo()
+
+    /**
+     * 撤销
+     */
+    undo(): void {
+        // do nothing
+    } // Function undo()
+
+    /**
      * 将类中得数据转换为方便存储格式的方法
      *
      * @return 针对 item 类型保持相应的格式

+ 0 - 2
persagy-web-edit/src/items/SBaseIconTextEdit.ts

@@ -25,7 +25,6 @@
  */
 
 import {
-    SObjectItem,
     SImageItem,
     STextItem,
     SAnchorItem,
@@ -33,7 +32,6 @@ import {
 
 } from "@persagy-web/graph";
 import { SItemStatus, ItemOrder, } from "@persagy-web/big";
-import { Anchor } from "@persagy-web/big/lib/types/topology/Anchor";
 import { SMouseEvent } from "@persagy-web/base";
 import {
     SSize,

+ 2 - 2
persagy-web-edit/src/items/SBaseImageEdit.ts

@@ -117,7 +117,6 @@ export class SBaseImageEdit extends SGraphEdit {
         this._url = v;
         this.img = new Image();
         this.img.onload = (e): void => {
-            // @ts-ignore
             const isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
             if (isiOS) {
                 this.isLoadOver = true;
@@ -125,6 +124,7 @@ export class SBaseImageEdit extends SGraphEdit {
                 this.$emit("imgLoadOver");
                 this.update();
             } else {
+                // @ts-ignore
                 const imgSrc = e.path[0].src;
                 if (this.isUrlIdentical(imgSrc)) {
                     this.isLoadOver = true;
@@ -325,7 +325,7 @@ export class SBaseImageEdit extends SGraphEdit {
             this.imgWidth = width;
             this.imgHeight = height;
             // 设置原点位置(默认左上角)
-            if (this.originPosition == STextOrigin.Centrum) {
+            if (this.originPosition == STextOrigin.Center) {
                 this.origin = new SPoint(this.width / 2, this.height / 2);
             }
 

+ 2 - 2
persagy-web-edit/src/items/SBasePolygonEdit.ts

@@ -255,7 +255,7 @@ export class SBasePolygonEdit extends SGraphEdit {
      * @return   索引不在数组范围则返回 null
      */
     deletePoint(i: number | null = null): SPoint | null {
-        let point = null;
+        let point;
         if (i != null) {
             if (i >= this.pointList.length || i < 0) {
                 point = null;
@@ -287,7 +287,7 @@ export class SBasePolygonEdit extends SGraphEdit {
      * @return    移动对应得点。如果索引无法找到移动顶点,则返回 null
      */
     movePoint(x: number, y: number, i: number): SPoint | null {
-        let point = null;
+        let point
         if (i >= this.pointList.length || i < 0) {
             return null;
         }

+ 1 - 1
persagy-web-edit/src/items/SBaseTextEdit.ts

@@ -321,7 +321,7 @@ export class SBaseTextEdit extends SGraphEdit {
             this.width = textMaxWidth;
             this.height = fontSize * 1.25 * this._textArr.length + fontSize / 8;
             // 设置原点位置(默认左上角)
-            if (this.originPosition == STextOrigin.entrum) {
+            if (this.originPosition == STextOrigin.Center) {
                 this.origin = new SPoint(this.width / 2, this.height / 2);
             }
 

+ 1 - 1
persagy-web-edit/src/type/Anchor.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "@persagy-web/big/lib/types/Point";
+import { Point } from "./Point";
 
 /**
  * 锚点 item 接口

+ 1 - 1
persagy-web-edit/src/type/Legend.ts

@@ -25,7 +25,7 @@
  */
 
 import { Anchor } from "./Anchor";
-import { Point } from "@persagy-web/big/lib/types/Point";
+import { Point } from "./Point";
 import { Size } from "@persagy-web/big/lib/types/Size";
 import { SPoint } from '@persagy-web/draw/lib';
 

+ 37 - 0
persagy-web-edit/src/type/Point.ts

@@ -0,0 +1,37 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2016-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+
+/**
+ * 坐标接口
+ *
+ * @author 韩耀龙 <han_yao_long@163.com>
+ */
+export interface Point {
+    /** x 坐标 */
+    x: number;
+    /** y 坐标 */
+    y: number;
+} // Interface Point

+ 1 - 1
persagy-web-edit/src/type/Relation.ts

@@ -25,7 +25,7 @@
  */
 
 import { SRelationDir } from "@persagy-web/big/lib/enums/SRelationDir";
-import { Point } from "@persagy-web/big/lib/types/Point";
+import { Point } from "./Point";
 
 /**
  * 管线对象关系接口

+ 1 - 1
persagy-web-edit/tsconfig.json

@@ -7,7 +7,7 @@
         "declaration": true,                        // 生成 `.d.ts` 文件
         "experimentalDecorators": true,             // 开启装饰器
         "removeComments": true,                     // 去除注释
-        "noImplicitAny": true,                      // 在表达式和声明上有隐含的 any类型时报错。
+        "noImplicitAny": false,                      // 在表达式和声明上有隐含的 any类型时报错。
         "esModuleInterop": true,                    // 支持别名导入
         "moduleResolution": "node"                  // 此处设置为node,才能解析import xx from 'xx'
     },