wenbobowen hace 4 años
padre
commit
910de53959
Se han modificado 12 ficheros con 623 adiciones y 74 borrados
  1. 15 3
      .babelrc
  2. 0 0
      dist/bundle.js
  3. 24 17
      package.json
  4. 16 2
      src/app.js
  5. 4 0
      src/assets/README.md
  6. 437 0
      src/assets/css/index.less
  7. 31 0
      src/assets/css/mixin.less
  8. 33 0
      src/assets/data/menuData.js
  9. 6 2
      src/index.js
  10. 36 0
      src/utils/index.js
  11. 5 11
      webpack/dev.config.js
  12. 16 39
      webpack/prod.config.js

+ 15 - 3
.babelrc

@@ -1,4 +1,16 @@
 {
-  "presets": ["@babel/preset-env", "@babel/preset-react"],
-  "plugins": ["@babel/plugin-proposal-class-properties"]
-}
+	"presets": [
+		"@babel/preset-env",
+		"@babel/preset-react"
+	],
+	"plugins": [
+		"transform-class-properties",
+		"@babel/plugin-transform-runtime",
+		[
+			"@babel/plugin-proposal-decorators",
+			{
+				"legacy": true
+			}
+		]
+	]
+}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/bundle.js


+ 24 - 17
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@didi/platformui",
-  "version": "0.1.2",
+  "version": "0.1.4",
   "description": "A platformui",
   "main": "dist/bundle.js",
   "author": "wenbobowen",
@@ -17,37 +17,44 @@
     "dev": "webpack-dev-server"
   },
   "dependencies": {
-    "antd": "^3.10.3",
+    "antd": "^3.25.2",
     "clsx": "^1.1.1"
   },
   "devDependencies": {
-    "@babel/core": "7.4.5",
-    "@babel/plugin-proposal-class-properties": "^7.4.4",
-    "@babel/preset-env": "7.4.5",
-    "@babel/preset-react": "^7.0.0",
+    "@babel/core": "^7.7.4",
+    "@babel/plugin-proposal-class-properties": "^7.14.5",
+    "@babel/plugin-proposal-decorators": "^7.14.5",
+    "@babel/plugin-transform-runtime": "^7.11.5",
+    "@babel/preset-env": "^7.7.4",
+    "@babel/preset-react": "^7.10.4",
+    "@tinymce/tinymce-react": "^3.12.6",
+    "tinymce": "^5.8.1",
     "babel-loader": "^8.0.5",
+    "babel-plugin-import": "^1.13.3",
+    "babel-plugin-transform-class-properties": "^6.24.1",
     "axios": "^0.21.1",
     "clean-webpack-plugin": "^3.0.0",
-    "css-loader": "^2.1.1",
+    "css-loader": "^3.2.1",
     "html-webpack-plugin": "^3.2.0",
-    "node-sass": "^4.14.1",
     "react": "^16.6.0",
     "react-dom": "^16.6.0",
-    "sass-loader": "^9.0.2",
-    "style-loader": "^0.23.1",
+    "style-loader": "^1.0.1",
     "less": "^3.10.3",
-    "less-loader": "^8.0.0",
-    "url-loader": "^1.1.2",
-    "webpack": "^4.29.6",
-    "webpack-cli": "^3.2.3",
-    "webpack-dev-server": "^3.2.1",
+    "less-loader": "^5.0.0",
+    "url-loader": "^3.0.0",
+    "optimize-css-assets-webpack-plugin": "^5.0.3",
     "webpack-node-externals": "^1.7.2",
-    "uglifyjs-webpack-plugin": "^2.2.0"
+    "uglifyjs-webpack-plugin": "^2.2.0",
+    "webpack": "^4.41.2",
+    "webpack-cli": "^3.3.10",
+    "webpack-dev-server": "^3.9.0",
+    "webpack-merge": "^4.2.2",
+    "webpack-parallel-uglify-plugin": "^1.1.2"
   },
   "peerDependencies": {
     "react": ">=16.6.0",
     "react-dom": ">=16.6.0",
-    "antd": ">=3.10.3"
+    "antd": ">=3.25.2"
   },
   "browser": {
     "child_process": false

+ 16 - 2
src/app.js

@@ -2,6 +2,7 @@ import React from 'react';
 import ReactDOM from 'react-dom';
 import AgileTCEditor from './kityminderEditor';
 import { FromChooseItem } from './index'
+import { Button } from 'antd'
 
 // 本地调试DEMO
 class App extends React.Component {
@@ -23,11 +24,24 @@ class App extends React.Component {
     if (tab === 1) {
       content = <AgileTCEditor />;
     } else {
-      content = <FromChooseItem />;
+      content = <FromChooseItem 
+        renderFormList={[
+          {
+            name: '描述',
+            colSpan: 24,
+            key: 'remark',
+            type: 'textarea',
+            placeholder: '请填写描述'
+          }
+        ]}
+        valueData={{}}
+        labelWidth={'104px'}
+        onChange={(key, value) => console.log(111)}
+      />;
     }
     return (
       <div>
-        <button onClick={() => this.handleClick(1, false)}>1</button>
+        <Button onClick={() => this.handleClick(1, false)}>1</Button>
         <button onClick={() => this.handleClick(2, true)}>2</button>
         <div>{content}</div>
       </div>

+ 4 - 0
src/assets/README.md

@@ -0,0 +1,4 @@
+# 这里放公用静态图片
+
+
+

+ 437 - 0
src/assets/css/index.less

@@ -0,0 +1,437 @@
+@import '~antd/dist/antd.css';
+body {
+  padding: 0;
+  margin: 0;
+  font-family: 'MicrosoftYaHei';
+  -webkit-font-smoothing: antialiased;
+  text-rendering: optimizeLegibility;
+}
+
+:root {
+  --white-1: #fff;
+  --brand-1: #409eff;
+  --brand-2: #eef5fe;
+  --brand-3: #6AB4FF;
+  --font-1: #333;
+  --font-2: #444;
+  --font-3: #666;
+  --gray-1: #F7F8FC;
+  --gray-2: #e8e8e8;
+  --gray-3: #D1D0D0;
+  --gray-4: #fafafa;
+  --gray-5: #C1C4CB;
+  --gray-6: #F5F7FA;
+  --gray-7: #EAEAEA;
+  --gray-8: #999;
+  --grey-9: #E3E3E3;
+  --gray-10: #A7AEBC;
+  --red-1: #F56C6C;
+  --red-2: #F5222D;
+  --yellow-1: #FF8952;
+  --yellow-2: #FA541C;
+  --yellow-3: #FAAD14;
+  --green-1: #7ED321;
+  --blue-1: #ebf5ff;
+  --blue-2: #409EFF;
+  --pink-1: #D675F0;
+}
+
+.CodeMirror {
+  border: 1px solid var(--gray-3)
+}
+
+.ant-tabs-bar {
+  margin: 10px 10px 16px 0px;
+  .ant-tabs-tab {
+    padding: 12px 0px;
+  }
+}
+.ant-table-tbody > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) > td .hoverActive {
+  color: var(--brand-1);
+}
+.ant-tree li .ant-tree-node-content-wrapper.ant-tree-node-selected {
+  background: none;
+  color: var(--brand-1);
+}
+
+.ant-tree li .ant-tree-node-content-wrapper:hover {
+  background: none;
+  color: var(--brand-1);
+}
+
+.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
+  padding: 10px 16px!important;
+  word-break: break-all;
+}
+tr.ant-table-expanded-row td > .ant-table-wrapper {
+  margin: -10px -16px -10px!important;
+}
+.ant-table-content .ant-table-thead > tr > th.ant-table-selection-column:first-child {
+  padding-left: 30px!important;
+}
+
+.ant-table-content .ant-table-tbody tr td.ant-table-selection-column:first-child {
+  padding-left: 30px!important;
+}
+
+.ant-breadcrumb > span:last-child {
+  color: var(--font-1)
+}
+.ant-table-selection-column {
+  text-align: left!important;
+}
+.ant-tree li .ant-tree-node-content-wrapper {
+  word-wrap: break-word;
+  white-space: normal;
+  word-break: break-all;
+}
+
+.ant-table-body {
+  overflow-x: auto!important;
+}
+
+.flex-center-start {
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+}
+.flex-center-between {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.flex-center-end {
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+}
+
+.descTextContent {
+  display: table-cell;
+  vertical-align: middle;
+}
+
+.yellowGradientColorText {
+  background: linear-gradient(45deg, #FCD56E, #F87046);
+  -webkit-background-clip: text;
+}
+.blueGradientColorText {
+  background: linear-gradient(45deg,#1FF6FF, #1C84FD);
+  -webkit-background-clip: text;
+}
+.greenGradientColorText {
+  background: linear-gradient(45deg, #A3FC2A, #0EB400);
+  -webkit-background-clip: text;
+}
+.violetGradientColorText {
+  background: linear-gradient(45deg, #D0ADFF, #A15DFF);
+  -webkit-background-clip: text;
+}
+.page-wrap {
+  background: var(--gray-1);
+  width: 100%;
+  .page-header {
+    padding: 15px 15px 5px 15px;
+    margin-bottom: 10px;
+    background: var(--white-1);
+    border-radius: 0 0 6px 6px;
+    &.detial {
+      padding: 15px 30px;
+    }
+  }
+  .page-content {
+    background: var(--white-1);
+    border-radius: 6px;
+    &.detial, .detial {
+      padding: 5px 30px;
+    }
+  }
+}
+.tabelHeader {
+  padding-left: 31px!important;
+}
+.ant-table-pagination.ant-pagination {
+  margin: 16px 10px!important;
+}
+.ellipsis {
+  display: inline-block;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+  vertical-align: middle;
+}
+.hoverActive {
+  color: var(--font-3);
+  cursor: pointer;
+  &:hover {
+    color: var(--brand-1)!important;
+  }
+}
+
+.detialTable {
+  .ant-table-small {
+    border: none;
+    .ant-table-content .ant-table-row:last-child td {
+      border-bottom: 1px solid var(--gray-2)!important;
+    }
+  }
+}
+
+.pointer {
+  cursor: pointer;
+}
+
+.marginTop10 {
+  margin-top: 10px;
+}
+.marginTop15 {
+  margin-top: 15px;
+}
+.marginBottom10 {
+  margin-bottom: 10px;
+}
+.marginLeft {
+  margin-left: 10px;
+}
+.marginRight5 {
+  margin-right: 5px;
+}
+.spaceBetween {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.statusWidth {
+  width: 73px;
+}
+.marginBottom25 {
+  margin-bottom: 25px;
+}
+
+.red {
+  color: var(--red-2);
+}
+.green {
+  color: var(--green-1);
+}
+.yellow {
+  color: var(--yellow-1);
+}
+.gray {
+  color: var(--font-3);
+}
+.blue {
+  color: var(--brand-1);
+}
+
+.afterComma {
+  &::after {
+    content: ",";
+  }
+  &:last-child {
+    &::after {
+      content: "";
+    }
+  }
+}
+
+.tableTitleId {
+  font-size: 12px;
+  color: var(--gray-10);
+  word-break: break-all;
+}
+
+.iconBtnList {
+  .item {
+    margin-left: 10px;
+    cursor: pointer;
+    display: inline-block;
+    .iconBtn {
+      display: inline-block;
+      margin-right: 6px;
+      color: var(--font-3);
+      vertical-align: middle;
+    }
+  }
+}
+
+.textIcon {
+  display: inline-block;
+  color: var(--white-1);
+  border-radius: 100%;
+  width: 18px;
+  height: 18px;
+  text-align: center;
+  line-height: 18px;
+}
+.play {
+  .textIcon();
+  background: var(--brand-1);
+  box-shadow: 0 0 5px var(--brand-1);
+}
+
+.restart {
+  .textIcon();
+  background: var(--yellow-3);
+  box-shadow: 0 0 5px var(--yellow-3);
+}
+.successCircle {
+  .textIcon();
+  background: var(--green-1);
+  box-shadow: 0 0 5px var(--green-1);
+}
+.redCircle {
+  .textIcon();
+  background: var(--red-2);
+  box-shadow: 0 0 5px var(--red-2);
+}
+.yellowdCircle {
+  .textIcon();
+  background: var(--yellow-2);
+  box-shadow: 0 0 5px var(--yellow-2);
+}
+
+.iconfont {
+  font-family: "iconfont" !important;
+  font-size: 16px;
+  font-style: normal;
+  color: transparent;
+  -webkit-font-smoothing: antialiased;
+  -webkit-text-stroke-width: 0.2px;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.tableList {
+  margin-top: 10px;
+  .tab {
+    cursor: pointer;
+    line-height: 14px;
+    margin-bottom: 10px;
+  }
+  .name {
+    width: auto;
+    padding-right: 20px;
+    display: inline-block;
+    &.active {
+      color: var(--brand-1);
+    }
+  }
+}
+.error {
+  color: var(--red-2);
+}
+.success {
+  color: var(--green-1);
+}
+.btn {
+  color: var(--brand-1);
+  cursor: pointer;
+}
+.active {
+  color: var(--brand-1);
+}
+.tableBtnList {
+  .btn {
+    margin-right: 10px;
+    &:last-child {
+      margin-right: 0;
+    }
+  }
+}
+
+.statusSelect {
+  width: 80px;
+  &.blue {
+    color: var(--brand-3);
+    .ant-select-selection {
+      border-color: var(--brand-3);
+      .ant-select-arrow {
+        color: var(--brand-3);
+      }
+    }
+  }
+  &.green {
+    color: var(--green-1);
+    .ant-select-selection {
+      border-color: var(--green-1);
+      .ant-select-arrow {
+        color: var(--green-1);
+      }
+    }
+  }
+  &.yellow {
+    color: var(--yellow-1);
+    .ant-select-selection {
+      border-color: var(--yellow-1);
+      .ant-select-arrow {
+        color: var(--yellow-1);
+      }
+    }
+  }
+  &.pink {
+    color: var(--pink-1);
+    .ant-select-selection {
+      border-color: var(--pink-1);
+      .ant-select-arrow {
+        color: var(--pink-1);
+      }
+    }
+  }
+}
+
+.row4Ellipsis{
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 4;
+}
+
+.loadMore {
+  text-align: center;
+  height: 70px;
+  line-height: 70px;
+}
+
+.priorityTag {
+  display: inline-block;
+  // width: 38px;
+  text-align: center;
+  // line-height: 24px;
+  font-size: 14px;
+  color: #fff;
+  border-radius: 4px;
+  // margin-right: 30px;
+  padding: 2px 10px;
+}
+.breadcrumbHeader {
+  padding-top: 0px!important;
+  padding-bottom: 0px!important;
+  height: 40px;
+  .ant-breadcrumb {
+    line-height: 40px;
+  }
+}
+.detialItemTitle {
+  margin-bottom: 17px;
+}
+.detialItemContent {
+  margin-bottom: 40px;
+}
+
+// @font-face {
+//   font-family: 'iconfont';  /* project id 2402558 */
+//   src: url('//at.alicdn.com/t/font_2402558_bvnzhtpperf.eot');
+//   src: url('//at.alicdn.com/t/font_2402558_bvnzhtpperf.eot?#iefix') format('embedded-opentype'),
+//   url('//at.alicdn.com/t/font_2402558_bvnzhtpperf.woff2') format('woff2'),
+//   url('//at.alicdn.com/t/font_2402558_bvnzhtpperf.woff') format('woff'),
+//   url('//at.alicdn.com/t/font_2402558_bvnzhtpperf.ttf') format('truetype'),
+//   url('//at.alicdn.com/t/font_2402558_bvnzhtpperf.svg#iconfont') format('svg');
+// }
+@font-face {
+  font-family: 'iconfont';  /* Project id 2402558 */
+  src: url('//at.alicdn.com/t/font_2402558_btpjgym7oej.woff2?t=1625540894985') format('woff2'),
+       url('//at.alicdn.com/t/font_2402558_btpjgym7oej.woff?t=1625540894985') format('woff'),
+       url('//at.alicdn.com/t/font_2402558_btpjgym7oej.ttf?t=1625540894985') format('truetype');
+}

+ 31 - 0
src/assets/css/mixin.less

@@ -0,0 +1,31 @@
+.fromItem {
+  .colBox {
+    display: flex;
+    // margin-right: 15px;
+    .input {
+      flex: 1;
+      line-height: 32px;
+    }
+  }
+  .name {
+    display: inline-block;
+    margin-right: 14px;
+    font-size: 14px;
+    color: var(--font-3);
+    width: 88px;
+    text-align: left;
+    line-height: 32px;
+  }
+}
+
+.tools {
+  display: inline-block;
+  margin-right: 10px;
+  .icon {
+    color: var(--font-3);
+    font-size: 14px;
+  }
+  .name {
+    margin: 0px 4px;
+  }
+}

+ 33 - 0
src/assets/data/menuData.js

@@ -0,0 +1,33 @@
+const list=[{
+  'name': 'mock服务',
+  'key': 'mock',
+  'icon': '',
+  'desc': 'qwewqni你好你好qweqwewqni你好你好qwewqni你好你好qwewqni你好你好qwewqni你好你好qwewqni你好你好qwewqni你好你好wqni你好你好qwewqni你好你好qwewqni你好你好qwewqni你好你好qwewqni你好你好',
+  'brandColor': '#F98750',
+  'menu': [{
+    'name': 'dubbo mock',
+    'key': 'dubbomock'
+  },{
+    'name': 'http mock',
+    'key': 'httpmock'
+  }]
+},{
+  'name': 'MQ测试工具',
+  'key': 'MQ',
+  'icon': '',
+  'desc': 'qwewq',
+  'brandColor': '#1084FC'
+},{
+  'name': '接口管理',
+  'key': 'APi',
+  'icon': '',
+  'desc': 'qwewq',
+  'brandColor': '#1084FC'
+},{
+  'name': '线上指间',
+  'key': 'online',
+  'icon': '',
+  'desc': 'qwewq',
+  'brandColor': '#1084FC'
+}]
+export default list;

+ 6 - 2
src/index.js

@@ -1,4 +1,8 @@
 import AgileTCEditor from "./kityminderEditor";
+import FromChooseItem from "./components/fromChooseItem";
+import BaseHeader from './components/baseHeader';
 export default AgileTCEditor;
-export { FromChooseItem } from './components/fromChooseItem';
-export { BaseHeader } from './components/baseHeader';
+export {
+  FromChooseItem,
+  BaseHeader
+};

+ 36 - 0
src/utils/index.js

@@ -38,4 +38,40 @@ export function isChildOf(child, parent) {
     }
   }
   return false;
+}
+
+export function uploadImg(imgData) {
+  return new Promise((resolve, reject) => {
+    const HTTP = axios.create({
+      baseURL: '/apis', // 这是基础url
+      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+      transformRequest: [(data) => {
+        // Do whatever you want to transform the data
+        let ret = ''
+        for (const it in data) {
+          ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
+        }
+        return ret
+      }]
+    })
+    HTTP.post('//star.xiaojukeji.com/upload/img.node', {
+      'imgData': imgData,
+      'innerPublic': true
+    }).then((res) => {
+      resolve(res.data.url)
+    })
+  })
+}
+export function keepLastIndex(obj, window) {
+  if (window.getSelection) { // ie11 10 9 ff safari
+    obj.focus() // 解决ff不获取焦点无法定位问题
+    const range = window.getSelection() // 创建range
+    range.selectAllChildren(obj) // range 选择obj下所有子内容
+    range.collapseToEnd() // 光标移至最后
+  } else if (document.selection) { // ie10 9 8 7 6 5
+    const range = document.selection.createRange() // 创建选择对象
+    range.moveToElementText(obj) // range定位到obj
+    range.collapse(false) // 光标移至最后
+    range.select()
+  }
 }

+ 5 - 11
webpack/dev.config.js

@@ -12,6 +12,11 @@ module.exports = {
     fs: 'empty',
     child_process: 'empty',
   },
+  resolve: {
+    alias: {
+      '@': path.resolve(__dirname, '../src'),
+    }
+  },
   module: {
     rules: [
       {
@@ -23,17 +28,6 @@ module.exports = {
         test: /\.css$/,
         use: ['style-loader', 'css-loader'],
       },
-      {
-        test: /\.s[ac]ss$/i,
-        use: [
-          // Creates `style` nodes from JS strings
-          'style-loader',
-          // Translates CSS into CommonJS
-          'css-loader',
-          // Compiles Sass to CSS
-          'sass-loader',
-        ],
-      },
       {
         test: /\.less$/,
         exclude: /\.module\.less$/,

+ 16 - 39
webpack/prod.config.js

@@ -1,7 +1,11 @@
 const path = require('path');
-const { CleanWebpackPlugin } = require('clean-webpack-plugin');
 const nodeExternals = require('webpack-node-externals');
-const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+
+const { CleanWebpackPlugin } = require('clean-webpack-plugin')
+const TerserJSPlugin = require('terser-webpack-plugin')
+const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
+
+
 module.exports = {
   mode: 'production',
   entry: './src/kityminderEditor.js',
@@ -10,6 +14,11 @@ module.exports = {
     path: path.resolve(__dirname, '../dist'),
     libraryTarget: 'commonjs2',
   },
+  resolve: {
+    alias: {
+      '@': path.resolve(__dirname, '../src'),
+    }
+  },
   module: {
     rules: [
       {
@@ -26,7 +35,7 @@ module.exports = {
         test: /\.less$/,
         exclude: /\.module\.less$/,
         loader: [
-          MiniCssExtractPlugin.loader,  // 注意,这里不再用 style-loader
+          'style-loader',  // 注意,这里不再用 style-loader
           'css-loader', 
           'less-loader'
         ]
@@ -46,46 +55,14 @@ module.exports = {
           // 'css-loader?modules',
           'less-loader'
         ]
-      },
-      {
-        test: /\.s[ac]ss$/i,
-        use: [
-          // Creates `style` nodes from JS strings
-          'style-loader',
-          // Translates CSS into CommonJS
-          'css-loader',
-          // Compiles Sass to CSS
-          'sass-loader',
-        ],
-      },
+      }
     ],
   },
   // devtool: 'nosources-source-map',
   // devtool: 'source-map',
   devtool: 'cheap-module-source-map',
   externals: [nodeExternals()],
-  plugins: [
-    new CleanWebpackPlugin(),
-    new UglifyJsPlugin({
-      sourceMap: true,
-      parallel: true,
-      uglifyOptions: {
-        output: {
-          beautify: false, // 最紧凑的输出
-          comments: false, // remove comments
-        },
-        compress: {
-          unused: true,
-          dead_code: true, // big one--strip code that will never execute
-          drop_debugger: true,
-          conditionals: true,
-          evaluate: true,
-          drop_console: false, // strips console statements
-          sequences: true,
-          booleans: true,
-        },
-        warnings: false,
-      },
-    }),
-  ],
+  optimization: {
+    minimizer: [new TerserJSPlugin({}), new OptimizeCSSAssetsPlugin({})],
+  }
 };

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio