wetrade-design
Version:
一款多语言支持Vue3的UI框架
193 lines (169 loc) • 6.68 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Node = exports.Meta = exports.Link = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _index = require("./index");
/**
* 额外数据模型 在link中meta只作为前端使用、在node中meta内容中除extParam外都是对服务端有意义的
*/
var Meta = /*#__PURE__*/(0, _createClass2.default)(
// 大小于(工具的符号)
// 配置key
// 配置key的名称
// 扩展字段
// 配置标识(后端用)
// 反弹回撤价差(买卖节点用)
// 市场(主模型开始节点)
// 股票范围(主模型开始节点)
// 节点值(条件、工具的值)
// 选中的买卖点(起始节点用)- Array
// 前置节点(买入卖出节点用)- Array - 废弃
// 选择的买入卖出类型: 1: 买入卖出 2:子模型(买卖节点用)
// 选择的买入卖出方式: 1-涨势/跌势交易;2-反弹/回撤交易
// 子节点(塞的是子节点)
// 节点类型(条件分类/条件/工具)
// 后续订单是否需要校验行情 0-不需要 1-需要
// 利润回撤比例配置
function Meta(_ref) {
var _ref$compare = _ref.compare,
compare = _ref$compare === void 0 ? null : _ref$compare,
_ref$configKey = _ref.configKey,
configKey = _ref$configKey === void 0 ? null : _ref$configKey,
_ref$configName = _ref.configName,
configName = _ref$configName === void 0 ? null : _ref$configName,
_ref$extParam = _ref.extParam,
extParam = _ref$extParam === void 0 ? null : _ref$extParam,
_ref$processorPrefix = _ref.processorPrefix,
processorPrefix = _ref$processorPrefix === void 0 ? null : _ref$processorPrefix,
_ref$reboundRetreatPr = _ref.reboundRetreatPriceDiff,
reboundRetreatPriceDiff = _ref$reboundRetreatPr === void 0 ? null : _ref$reboundRetreatPr,
_ref$regionType = _ref.regionType,
regionType = _ref$regionType === void 0 ? null : _ref$regionType,
_ref$stockRange = _ref.stockRange,
stockRange = _ref$stockRange === void 0 ? null : _ref$stockRange,
_ref$type = _ref.type,
type = _ref$type === void 0 ? null : _ref$type,
_ref$values = _ref.values,
values = _ref$values === void 0 ? null : _ref$values,
_ref$strategyPoints = _ref.strategyPoints,
strategyPoints = _ref$strategyPoints === void 0 ? [] : _ref$strategyPoints,
_ref$buyAndSellType = _ref.buyAndSellType,
buyAndSellType = _ref$buyAndSellType === void 0 ? null : _ref$buyAndSellType,
_ref$tradeType = _ref.tradeType,
tradeType = _ref$tradeType === void 0 ? null : _ref$tradeType,
_ref$preNode = _ref.preNode,
preNode = _ref$preNode === void 0 ? [] : _ref$preNode,
_ref$children = _ref.children,
children = _ref$children === void 0 ? [] : _ref$children,
_ref$needCheckBeforeR = _ref.needCheckBeforeReleaseOrder,
needCheckBeforeReleaseOrder = _ref$needCheckBeforeR === void 0 ? null : _ref$needCheckBeforeR,
_ref$ratioConfig = _ref.ratioConfig,
ratioConfig = _ref$ratioConfig === void 0 ? null : _ref$ratioConfig;
(0, _classCallCheck2.default)(this, Meta);
this.compare = compare;
this.configKey = configKey;
this.configName = configName;
this.extParam = (0, _extends2.default)({
// 展示增加按钮(合并节点的父节点不展示-属性处理里处理)
canInsert: true,
// 工具和条件是否有强关系 1.3.132迭代去除了强关联不展示【+】的逻辑
// toolAndConditionHasStrongRel: false,
// 是否高亮
isHighLight: false,
// 是否为合并的特殊节点
isMergeNode: false,
// 是否展开
isOpen: true,
// 工具配置信息 (投管业务在用)
configParams: null,
// 是否在拖拽中
isDragging: false,
// 工具是否校验通过
verifyStatus: false,
// 工具是否是编辑态
toolsIsEdit: false,
// 收起数量
shrinkNum: 0,
// 是否为拖拽占位元素
isDragElement: false,
// 是否在合并链路上
inMerge: false,
// 收起节点是否禁用
shrinkDisabled: false
}, extParam);
this.processorPrefix = processorPrefix;
this.reboundRetreatPriceDiff = reboundRetreatPriceDiff;
this.regionType = regionType;
this.stockRange = stockRange;
this.type = type;
this.values = values;
this.strategyPoints = strategyPoints;
this.buyAndSellType = buyAndSellType;
this.tradeType = tradeType;
this.preNode = preNode;
this.children = children;
this.type = type;
this.needCheckBeforeReleaseOrder = needCheckBeforeReleaseOrder;
this.ratioConfig = ratioConfig;
});
/**
* 节点数据结构
*/
exports.Meta = Meta;
var Node = /*#__PURE__*/(0, _createClass2.default)(
// 宽度
// 高度
// 坐标
// meta
function Node(_ref2) {
var _ref2$width = _ref2.width,
width = _ref2$width === void 0 ? 240 : _ref2$width,
_ref2$height = _ref2.height,
height = _ref2$height === void 0 ? 68 : _ref2$height,
_ref2$coordinate = _ref2.coordinate,
coordinate = _ref2$coordinate === void 0 ? [0, 0] : _ref2$coordinate,
_ref2$meta = _ref2.meta,
meta = _ref2$meta === void 0 ? new Meta({}) : _ref2$meta;
(0, _classCallCheck2.default)(this, Node);
(0, _defineProperty2.default)(this, "id", (0, _index.uuid)());
this.width = width;
this.height = height;
this.coordinate = coordinate;
this.meta = new Meta(meta);
});
/**
* 连线数据结构
*/
exports.Node = Node;
var Link = /*#__PURE__*/(0, _createClass2.default)(
// 画线用
// 画线用
function Link(_ref3) {
var startId = _ref3.startId,
endId = _ref3.endId,
_ref3$startAt = _ref3.startAt,
startAt = _ref3$startAt === void 0 ? [240, 50] : _ref3$startAt,
_ref3$endAt = _ref3.endAt,
endAt = _ref3$endAt === void 0 ? [0, 50] : _ref3$endAt,
_ref3$meta = _ref3.meta,
meta = _ref3$meta === void 0 ? null : _ref3$meta;
(0, _classCallCheck2.default)(this, Link);
(0, _defineProperty2.default)(this, "id", (0, _index.uuid)());
this.startId = startId;
this.endId = endId;
this.startAt = startAt;
this.endAt = endAt;
this.meta = (0, _extends2.default)({
// 合并线路点击同时高亮标记id 默认为-1
activeId: -1,
// 是否高亮 默认为false
isHighLight: false
}, meta);
});
exports.Link = Link;