修复:移除错误的引用

This commit is contained in:
ChenX 2020-11-12 11:31:42 +08:00
parent e60b70b2b1
commit cc42238333

View File

@ -526,9 +526,6 @@ var StoreageKeys;
/**扣除封边是否相连和连接共用精度 */
const LINK_FUZZ = 1e-3;
function isNum(s) {
return !isNaN(safeEval(s));
}
function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
@ -16334,6 +16331,20 @@ function FixIndex$1(index, arr) {
return index;
}
var Intent;
(function (Intent) {
Intent["NONE"] = "none";
Intent["PRIMARY"] = "primary";
Intent["SUCCESS"] = "success";
Intent["WARNING"] = "warning";
Intent["DANGER"] = "danger";
})(Intent || (Intent = {}));
const ToasterInjectFunctions = [];
function Toaster(option) {
for (let f of ToasterInjectFunctions)
f(option);
}
var CylinderHole_1;
var GangDrillType;
(function (GangDrillType) {
@ -17280,20 +17291,6 @@ HardwareTopline = __decorate([
Factory
], HardwareTopline);
var Intent;
(function (Intent) {
Intent["NONE"] = "none";
Intent["PRIMARY"] = "primary";
Intent["SUCCESS"] = "success";
Intent["WARNING"] = "warning";
Intent["DANGER"] = "danger";
})(Intent || (Intent = {}));
const ToasterInjectFunctions = [];
function Toaster(option) {
for (let f of ToasterInjectFunctions)
f(option);
}
class LookOverBoardInfosTool {
constructor() {
this.drillTypeMap = new Map();
@ -18233,590 +18230,6 @@ var Production;
Production.Data2Polyline = Data2Polyline;
})(Production || (Production = {}));
var CheckObjectType;
(function (CheckObjectType) {
CheckObjectType["BR"] = "board";
CheckObjectType["DR"] = "drill";
CheckObjectType["AR"] = "array";
CheckObjectType["Do"] = "door";
CheckObjectType["RC"] = "referenceCutting";
CheckObjectType["WR"] = "winerack";
CheckObjectType["Lat"] = "lattice";
CheckObjectType["RLB"] = "rotateLayerBoard";
CheckObjectType["BBC"] = "boardbatchcurtail";
CheckObjectType["BBS"] = "lookoverboardinfos";
CheckObjectType["R2B"] = "rec2br";
CheckObjectType["OnlyNumber"] = "onlyNum";
CheckObjectType["None"] = "none";
CheckObjectType["SmoothEdge"] = "smoothEdge";
/**大于0的数字 */
CheckObjectType["GT0Num"] = "gt0num";
})(CheckObjectType || (CheckObjectType = {}));
var CheckoutValid;
(function (CheckoutValid) {
function HasInvailValue(obj, objType) {
switch (objType) {
case CheckObjectType.BR:
return !Object.keys(obj).every(k => CheckoutBoardOption(k, obj[k]) === "");
case CheckObjectType.AR:
return !Object.keys(obj).every(k => CheckoutArrayOption(k, obj[k]) === "");
case CheckObjectType.Do:
return !Object.keys(obj).every(k => CheckoutDoorOption(k, obj[k]) === "");
case CheckObjectType.RC:
return !Object.keys(obj).every(k => CheckOutReferenceCuttingOption(k, obj[k]) === "");
case CheckObjectType.WR:
return !Object.keys(obj).every(k => CheckoutWineRackOption(k, obj[k]) === "");
case CheckObjectType.Lat:
return !Object.keys(obj).every(k => CheckoutLatticeOption(k, obj[k]) === "");
case CheckObjectType.RLB:
return !Object.keys(obj).every(k => CheckoutRotateLayerBoardOption(k, obj[k]) === "");
case CheckObjectType.BBC:
return !Object.keys(obj).every(k => CheckBoardBatchCurtail(k, obj[k]) === "");
case CheckObjectType.BBS:
return !Object.keys(obj).every(k => CheckLookOverBoardInfos(k, obj[k]) === "");
case CheckObjectType.DR:
return !Object.keys(obj).every(k => CheckoutDrillOption(k, obj[k]) === "");
case CheckObjectType.R2B:
return !Object.keys(obj).every(k => CheckoutRec2BrOption(k, obj[k]) === "");
default:
return true;
}
}
CheckoutValid.HasInvailValue = HasInvailValue;
function CheckOption(type, k, v) {
switch (type) {
case CheckObjectType.BR:
return CheckoutBoardOption(k, v);
case CheckObjectType.DR:
return CheckoutDrillOption(k, v);
case CheckObjectType.AR:
return CheckoutArrayOption(k, v);
case CheckObjectType.Do:
return CheckoutDoorOption(k, v);
case CheckObjectType.RC:
return CheckOutReferenceCuttingOption(k, v);
case CheckObjectType.WR:
return CheckoutWineRackOption(k, v);
case CheckObjectType.Lat:
return CheckoutLatticeOption(k, v);
case CheckObjectType.RLB:
return CheckoutRotateLayerBoardOption(k, v);
case CheckObjectType.BBC:
return CheckBoardBatchCurtail(k, v);
case CheckObjectType.BBS:
return CheckLookOverBoardInfos(k, v);
case CheckObjectType.R2B:
return CheckoutRec2BrOption(k, v);
case CheckObjectType.OnlyNumber:
if (!isNum(v))
return "数值不能为空且必须为数字";
return "";
case CheckObjectType.GT0Num:
if (!isNum(v))
return "数值不能为空且必须为数字";
if (safeEval(v) <= 0)
return "数值必须大于0";
return "";
case CheckObjectType.SmoothEdge:
if (!isNum(v))
return "数值不能为空且必须为数字";
let val = safeEval(v);
if (val < 0)
return "数值不能小于0";
default:
return "";
}
}
CheckoutValid.CheckOption = CheckOption;
function CheckoutBoardOption(k, v) {
let val = safeEval(v);
switch (k) {
case "calcHeight":
case "calcWidth":
case "calcSpaceSize":
case "calcFrontShrink":
case "calcBottomShrink":
case "calcLeftShrink":
case "calcRightShrink":
case "calcMoveDist":
if (isNaN(safeEval(v, { L: 1, H: 1, W: 1 })))
return "表达式错误";
return "";
case "sealedUp":
case "sealedDown":
case "sealedLeft":
case "sealedRight":
case "divCount":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (!(val >= 0))
return "数值必须大于等于0";
return "";
case "spliteHeight":
case "spliteWidth":
case "spliteThickness":
if (v !== "" && isNaN(safeEval(v, { L: 1, H: 1, W: 1 }))) {
return "表达式错误";
}
return "";
case "height":
case "width":
case "count":
case "thickness":
case "footThickness":
case "knifeRadius":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (!(val > 0))
return "数值必须大于0";
return "";
case "leftExt":
case "rightExt":
case "topExt":
case "bottomExt":
case "moveDist":
case "spaceSize":
case "frontShrink":
case "rightShrink":
case "leftShrink":
case "bottomShrink":
case "addCount":
case "dist":
case "front":
case "behind":
case "left":
case "right":
case "rad":
case "length":
case "depth":
case "frontDist":
case "behindDistance":
case "leftExt":
case "rightExt":
case "offset":
case "footBehindShrink":
case "footerOffset":
case "rotateX":
case "rotateY":
case "rotateZ":
case "grooveAddLength":
case "grooveAddDepth":
case "grooveAddWidth":
case "back":
if (isNaN(val))
return "数值不能为空且必须为数字";
default:
return "";
}
}
CheckoutValid.CheckoutBoardOption = CheckoutBoardOption;
function CheckoutDrillOption(k, v) {
if (typeof v === 'boolean')
return "";
switch (k) {
case "ljgPos":
case "woodPinPos":
if (isNaN(safeEval(v, { L: 1, H: 1, W: 1 })))
return "表达式错误";
return "";
case "name":
case "spacing":
case "tempId":
case "tempDirId":
return "";
case "pxlOffset":
case "collsionDist":
case "tHoleOffset":
case "notGangDist":
if (v === "")
return "不能为空";
if (!(isNum(v)))
return "数值不能为空且必须为数字";
return "";
case "count":
case "pxlRad":
case "startDist":
case "endDist":
case "wbHoleRad":
case "startDist":
case "endDist":
if (!(isNum(v)))
return "数值不能为空且必须为数字";
else if ((safeEval(v) < 0))
return "数值不能小于0";
else
return "";
case "pxlDepth":
case "ljgRad":
case "ljgLength":
case "ymjRad":
case "ymjDepth":
case "wbHoleDepth":
case "wsHoleLength":
case "wdepth":
case "originDist":
case "retDist":
default:
if (!(isNum(v)))
return "数值不能为空且必须为数字";
else if (!(safeEval(v) > 0))
return "数值必须大于0";
}
return "";
}
CheckoutValid.CheckoutDrillOption = CheckoutDrillOption;
function CheckoutRec2BrOption(k, v) {
let val = safeEval(v);
switch (k) {
case "sealedUp":
case "sealedDown":
case "sealedLeft":
case "sealedRight":
case "knifeRadius":
case "cabinetDeep":
case "cabinetBrThick":
case "backBrThick":
case "maxThickness":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (!(val >= 0))
return "数值必须大于等于0";
return "";
case "cabinetCurtail":
case "backBrBiggerThanHeight":
case "backBrBiggerThanWidth":
case "backBrFrontMove":
case "backBrLeftExtend":
case "backBrRightExtend":
case "backBrUpExtend":
case "backBrDownExtend":
case "verticalBrShrink":
case "layerBrShrink":
case "bottomBrShrink":
case "topBrShrink":
case "groundLineBrShrink":
case "grooveAddLength":
case "grooveAddDepth":
case "grooveAddWidth":
if (isNaN(val))
return "数值不能为空且必须为数字";
default:
return "";
}
}
CheckoutValid.CheckoutRec2BrOption = CheckoutRec2BrOption;
function CheckoutArrayOption(k, v) {
switch (k) {
case "type":
case "method":
case "isCorrect":
return "";
}
let val = safeEval(v);
if (isNaN(val))
return "数值不能为空且必须为数字";
switch (k) {
case "row":
case "col":
if (val > 32767 || val < 1 || val % 1 !== 0)
return "请输入1-32767间的整数";
break;
case "itemTotal":
if (val > 32767 || val < 2 || val % 1 !== 0)
return "请输入2-32767间整数";
break;
case "betweenAngle":
case "fillAngle":
if (val <= 0)
return "数值不可小于或等于0";
break;
case "arrayAngle":
if (Math.abs(val) > 360)
return "角度不可大于360";
break;
}
return ""; //ok
}
CheckoutValid.CheckoutArrayOption = CheckoutArrayOption;
function CheckoutDoorOption(k, v) {
let val = safeEval(v);
switch (k) {
case "drawerTotalDepth":
if (isNaN(safeEval(v, { L: 1, H: 1, W: 1 })))
return "表达式错误";
return "";
case "row":
case "col":
if (isNaN(val))
return "数值不能为空,并且必须为数字";
if (!isNaN(val) && val !== Math.floor(val) || val <= 0 || val > 20)
return "数值必须1~20整数";
return "";
case "upOffsetExpr":
case "downOffsetExpr":
val = safeEval(v, { L: 1, H: 1, W: 1, D: 1 });
if (isNaN(val))
return "表达式不正确,仅支持LHWD相关运算";
return "";
case "topOffset":
case "bottomOffset":
case "hindeTopDist":
case "hindeBottomDist":
case "handleAngle":
case "topSpace":
case "bottomSpace":
case "leftSpace":
case "rightSpace":
case "midSpace":
case "horSpacing":
case "veSpacing":
if (isNaN(val))
return "数值不能为空,并且必须为数字";
return "";
case "doorThickness":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (!(val > 0))
return "数值必须大于0";
return "";
case "topBrSeal":
case "bottomBrSeal":
case "leftBrSeal":
case "rightBrSeal":
case "topDoorSeal":
case "bottomDoorSeal":
case "leftDoorSeal":
case "rightDoorSeal":
if (isNaN(val))
return "数值不能为空且必须为数字";
if (!(val >= 0))
return "数值必须大于等于0";
return "";
default:
return CheckoutBoardOption(k, v);
}
}
CheckoutValid.CheckoutDoorOption = CheckoutDoorOption;
function CheckoutRotateLayerBoardOption(k, v) {
switch (k) {
case "angle":
let angle = safeEval(v);
if (!(Math.abs(angle) <= 45))
return "数值必须为±45间的整数";
case "length":
case "frontDist":
case "backDist":
default:
if (!isNum(v))
return "数值不能为空且必须为数字";
return "";
}
}
CheckoutValid.CheckoutRotateLayerBoardOption = CheckoutRotateLayerBoardOption;
function CheckBoardBatchCurtail(k, v) {
switch (k) {
case "front":
case "back":
case "left":
case "right":
default:
if (!isNum(v))
return "数值不能为空且必须为数字";
return "";
}
}
CheckoutValid.CheckBoardBatchCurtail = CheckBoardBatchCurtail;
function CheckLookOverBoardInfos(k, v) {
switch (k) {
case EBoardKeyList.Height:
case EBoardKeyList.Width:
case EBoardKeyList.Thick:
case EBoardKeyList.UpSealed:
case EBoardKeyList.DownSealed:
case EBoardKeyList.LeftSealed:
case EBoardKeyList.RightSealed:
if (!isNum(v))
return "数值不能为空且必须为数字";
default:
return "";
}
}
CheckoutValid.CheckLookOverBoardInfos = CheckLookOverBoardInfos;
function CheckOutReferenceCuttingOption(k, v) {
switch (k) {
case "offset":
if (!isNum(v))
return "数值不能为空且必须为数字";
default:
return "";
}
}
CheckoutValid.CheckOutReferenceCuttingOption = CheckOutReferenceCuttingOption;
function CheckoutWineRackOption(k, v) {
switch (k) {
case "calcDepth":
if (isNaN(safeEval(v, { L: 1, H: 1, W: 1 })))
return "表达式错误";
return "";
case "leftEdge":
case "rightEdge":
case "topEdge":
case "bottomEdge":
if (!isNum(v))
return "数值不能为空且必须为数字";
if ((safeEval(v) < 0))
return "数值不能小于0";
return "";
case "heightCount":
case "widthCount":
case "boardThick":
case "brThick2":
case "gripWidth":
if (!(safeEval(v) > 0))
return "数值必须大于0";
default:
if (!isNum(v)) {
return "数值不能为空且必须为数字";
}
return "";
}
}
CheckoutValid.CheckoutWineRackOption = CheckoutWineRackOption;
function CheckoutLatticeOption(k, v) {
switch (k) {
case "thickness":
case "gripWidth":
case "gripDepth":
if (safeEval(v) <= 0)
return "数值必须大于0";
case "arcLen":
case "widthCount":
case "depthCount":
case "upSealed":
case "downSealed":
case "leftSealed":
case "rightSealed":
case "knifeRad":
case "upCut":
case "downCut":
if (safeEval(v) < 0)
return "数值不能小于0";
default:
if (!(isNum(v))) {
return "数值不能为空且必须为数字";
}
return "";
}
}
CheckoutValid.CheckoutLatticeOption = CheckoutLatticeOption;
})(CheckoutValid || (CheckoutValid = {}));
const AppToaster = Toaster$1.create({
className: "recipe-toaster",
position: Position.TOP,
canEscapeKeyClear: false,
});
/**
* 参数option为属性对象
*/
let ToasterInput = class ToasterInput extends Component {
constructor() {
super(...arguments);
this.errorMsg = "";
this.hideErrorMsg = true;
this.getErrorMsg = (v) => {
this.errorMsg = CheckoutValid.CheckOption(this.props.type, this.props.optKey, v);
if (this.props.callback) {
let err = this.props.callback(this.props.optKey, v);
if (err)
this.errorMsg = err;
}
this.hideErrorMsg = this.errorMsg === "";
};
this.handleChange = (e) => {
let oldValue = this.props.option[this.props.optKey];
let newVal = e.target.value;
if (this.props.isUpper)
newVal = newVal.toUpperCase();
this.getErrorMsg(newVal);
if (!this.hideErrorMsg) {
e.target.classList.add("bp3-intent-danger");
}
else {
e.target.classList.remove("bp3-intent-danger");
}
if (typeof this.showData[this.props.optKey] === "number") {
let val = safeEval(newVal);
if (!isNaN(val))
this.showData[this.props.optKey] = val;
}
else
this.showData[this.props.optKey] = newVal;
if (this.hideErrorMsg && typeof this.props.option[this.props.optKey] === 'number') {
//值有效并且属性值为number
this.props.option[this.props.optKey] = safeEval(newVal);
}
else if (this.hideErrorMsg) {
//未传入ui属性直接赋值
this.props.option[this.props.optKey] = newVal;
}
else ;
//值有效才运行change函数
if (this.hideErrorMsg && this.props.onChange)
this.props.onChange(e, oldValue, this.props.optKey);
};
this.handleClick = e => {
this.getErrorMsg(e.target.value);
if (this.props.onClick)
this.props.onClick(e);
};
this.handleBlur = e => {
this.hideErrorMsg = true;
if (this.props.onBlur) {
this.props.onBlur(e, this.errorMsg !== "");
this.getErrorMsg(this.showData[this.props.optKey]);
}
};
}
UNSAFE_componentWillMount() {
const props = this.props;
this.showData = props.uiOption ? props.uiOption : props.option;
if (!props.option.hasOwnProperty(props.optKey))
AppToaster.show({
message: `传入key:${this.props.optKey}不存在`,
timeout: 0,
intent: Intent$1.DANGER,
});
}
componentDidMount() {
this.getErrorMsg(this.showData[this.props.optKey]);
}
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.type === CheckObjectType.BBS)
this.showData = nextProps.uiOption ? nextProps.uiOption : nextProps.option;
if (this.errorMsg)
this.getErrorMsg(this.showData[this.props.optKey]);
}
render() {
var _a;
const props = this.props;
return (createElement(Tooltip, { usePortal: false, content: this.errorMsg, isOpen: !this.hideErrorMsg, position: Position.TOP, intent: Intent$1.WARNING },
createElement("input", { "data-key": this.props.optKey, ref: el => this.props.inputRef && this.props.inputRef(el), "data-isNum": !Boolean(props.uiOption) ? "1" : "", className: (_a = (this.errorMsg === "" ? "bp3-input " : "bp3-input bp3-intent-danger ") + props.inputClassName) !== null && _a !== void 0 ? _a : "", value: this.showData[props.optKey], disabled: props.isDisabled, placeholder: props.placeHolder, onChange: this.handleChange, onClick: this.handleClick, onBlur: this.handleBlur, maxLength: props.maxLength })));
}
};
ToasterInput.defaultProps = {
isUpper: false
};
__decorate([
observable
], ToasterInput.prototype, "errorMsg", void 0);
__decorate([
observable
], ToasterInput.prototype, "hideErrorMsg", void 0);
ToasterInput = __decorate([
observer
], ToasterInput);
/**
*曲线列表分段
* @l-arc-l,l-arc-arc-l,l-arc-l-arc-l....
@ -19013,10 +18426,10 @@ function GetBoardSealingCurves(br, isOffset = false) {
let cus = [];
cu = Production.GetSpliteOutline(br, false);
if (!cu) {
AppToaster.show({
Toaster({
message: "获取封边错误",
timeout: 3000,
intent: Intent$1.DANGER
intent: Intent.DANGER
});
return [];
}