@kre-form/ant
Version:
1,128 lines • 127 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { Component, Input } from "@angular/core";
import { FormGroup, Validators } from "@angular/forms";
import * as _ from "lodash";
/**
* @record
*/
function Item() { }
if (false) {
/** @type {?} */
Item.prototype.value;
/** @type {?} */
Item.prototype.label;
/** @type {?|undefined} */
Item.prototype.parameterId;
}
var EventItemComponent = /** @class */ (function () {
function EventItemComponent() {
this.index = 0;
this.options = [];
this.fields = [];
// fieldType: "select" | "text" | "numbers" | "textarea" | "textBtn" = "select";
this.selected = [];
this.selectItem = [];
this.changeItem = [];
this.changeToItem = [];
this.changeAction = [];
this.Includes = [
{
label: "包含",
value: "includes",
},
{
label: "不包含",
value: "notIncludes",
},
];
this.minIncludes = this.Includes;
this.maxLengthIncludes = this.Includes;
this.maxIncludes = this.Includes;
this.minLengthIncludes = this.Includes;
this.typeList = [
"select",
"text",
"numbers",
"textarea",
"textBtn",
"upload",
"datetime",
];
this.nzPrecision = 0;
this.multiple = "multiple";
this.editType = [
{
label: "可编辑",
value: "edit",
},
{
label: "只读",
value: "readOnly",
},
{
label: "隐藏",
value: "hide",
},
{
label: "显示",
value: "show",
},
];
this.RequiredType = [
{
label: "必填",
value: "required",
},
{
label: "不必填",
value: "notRequired",
},
];
this.IncludesType = [
{
label: "包含",
value: "includes",
},
{
label: "不包含",
value: "notIncludes",
},
];
this.changeToValue = [];
this.selectType = "default";
this.selectItemType = "default";
this.fixedValue = {
minLength: null,
maxLength: null,
nzMax: null,
nzMin: null,
nzPrecision: 0,
maxDate: null,
minDate: null,
};
this.selectItemList = ["selectItem", "selectItems"];
this.fieldKeyList = ["fieldKey", "changeFieldType"];
this.changeActionList = ["changeAction", "changeActions"];
this.changeToItemList = ["changeToItem", "changeToItems"];
this.lengthList = [
"maxLength",
"maxLengthIncludes",
"minLength",
"minLengthIncludes",
];
this.specValueList = ["specValue"];
this.numbersList = ["maxIncludes", "max", "minIncludes", "min"];
this.limit = {
max: null,
min: null,
maxLength: null,
minLength: null,
};
}
/**
* @return {?}
*/
EventItemComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () { };
/**
* @return {?}
*/
EventItemComponent.prototype.ngOnChanges = /**
* @return {?}
*/
function () {
var _this = this;
if (this.myForm.value["selected"] === "select") {
this.selectItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).setValidators(Validators.required);
}));
}
this.selectItem = [];
this.changeToItem = [];
// console.log(this.fields);
this.fields.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (_this.field.tableType === "single") {
if ((/** @type {?} */ (((/** @type {?} */ (_this.typeList))))).includes(el.type) &&
el.key !== _this.field.key) {
(/** @type {?} */ (_this.changeItem)).push(el);
}
}
else {
if ((/** @type {?} */ (((/** @type {?} */ (_this.typeList))))).includes(el.type) &&
el.key !== _this.field.key &&
(el.tableCode === _this.field.tableCode || el.tableType === "single")) {
(/** @type {?} */ (_this.changeItem)).push(el);
}
}
if (el.key === _this.field.key) {
_this.selectItemType =
(/** @type {?} */ (el.templateOptions)).selectType === "multiple"
? "multiple"
: "default";
}
}));
if (!_.isEmpty(this.options)) {
(/** @type {?} */ (this.options)).forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (el.parameterId === (/** @type {?} */ ((/** @type {?} */ (_this.field)).templateOptions)).parameterId) {
(/** @type {?} */ (_this.selectItem)).push({
value: (/** @type {?} */ (el)).value,
label: (/** @type {?} */ (el)).label,
});
}
if (_this.myForm.value["fieldKey"]) {
if (el.parameterId ===
(/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ (_this.changeItem)).filter((/**
* @param {?} field
* @return {?}
*/
function (field) { return field.key === _this.myForm.value["fieldKey"]; }))))[0])).templateOptions)).parameterId) {
(/** @type {?} */ (_this.changeToValue)).push({
value: (/** @type {?} */ (el)).value,
label: (/** @type {?} */ (el)).label,
});
}
}
}));
}
if (!!this.myForm.value["fieldKey"]) {
this.newSelectType(this.myForm.value["fieldKey"]);
}
/** @type {?} */
var inputIsNull = [
{
value: "inputIsNull",
label: "为空",
},
];
switch (this.myForm.value["fieldType"]) {
case "select":
this.selected = [
{
value: "selected",
label: "选中选项值",
},
{
value: "selectAny",
label: "任意选项值",
},
];
/** @type {?} */
var selectIsNull = [
{
value: "selectIsNull",
label: "选项值为空",
},
];
if (this.myForm.value["required"] === false) {
this.selected = this.selected.concat(selectIsNull);
}
break;
case "upload":
this.selected = [
{
value: "inputIsFill",
label: "不为空",
},
];
if (this.myForm.value["required"] === false) {
this.selected = this.selected.concat(inputIsNull);
}
break;
case "datetime":
this.selected = [
{
value: "dateTimeIsFill",
label: "不为空",
},
{
value: "dateTimeIsSpec",
label: "特定时间",
},
];
break;
default:
this.selected = [
{
value: "inputIsFill",
label: "不为空",
},
{
value: "inputIsSpec",
label: "特定值",
},
];
if (this.myForm.value["required"] === false) {
this.selected = this.selected.concat(inputIsNull);
}
break;
}
if (!!this.myForm.value["changeFieldType"]) {
this.setChangeAction();
}
if (!!this.myForm.value["changeActions"]) {
this.changeActionChangeItem(this.myForm.value["changeActions"]);
}
};
/**
* @param {?} e
* @return {?}
*/
EventItemComponent.prototype.newSelectType = /**
* @param {?} e
* @return {?}
*/
function (e) {
if (!!(/** @type {?} */ (this.changeItem.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === e; }))[0].templateOptions)).selectType) {
this.selectType =
(/** @type {?} */ (this.changeItem.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === e; }))[0].templateOptions)).selectType === "multiple"
? "multiple"
: "default";
this.multiple = this.selectType;
if (((/** @type {?} */ (["hideState", "showState"]))).includes(this.myForm.value["changeToItems"])) {
this.multiple = this.selectType = "multiple";
}
}
else {
this.selectType = "default";
}
this.initFixedValueOne(this.changeItem.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === e; }))[0]);
};
/**
* @param {?} e
* @return {?}
*/
EventItemComponent.prototype.selectedChange = /**
* @param {?} e
* @return {?}
*/
function (e) {
var _this = this;
/** @type {?} */
var list = tslib_1.__spread(this.selectItemList, this.fieldKeyList, this.changeActionList, this.changeToItemList, this.lengthList, this.numbersList, this.specValueList);
this.setValueToNull(list);
if (this.myForm.value["selected"] === "selected") {
this.selectItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).setValidators(Validators.required);
}));
(/** @type {?} */ (((/** @type {?} */ (this.myForm))))).get("specValue").clearValidators();
(/** @type {?} */ ((/** @type {?} */ (((/** @type {?} */ (this.myForm))))).get("specValue"))).reset();
}
else {
if (this.myForm.value["selected"] === "inputIsSpec") {
(/** @type {?} */ (this.myForm.get("specValue"))).setValidators(Validators.required);
(/** @type {?} */ (this.myForm.get("specValue"))).reset();
}
else {
(/** @type {?} */ (this.myForm.get("specValue"))).clearValidators();
(/** @type {?} */ (this.myForm.get("specValue"))).reset();
}
this.selectItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).clearValidators();
(/** @type {?} */ (_this.myForm.get(el))).reset();
}));
}
};
/**
* @param {?} list
* @return {?}
*/
EventItemComponent.prototype.setValueToNull = /**
* @param {?} list
* @return {?}
*/
function (list) {
var _this = this;
if (!_.isEmpty(list)) {
list.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
_this.myForm.controls[el].setValue(null);
_this.myForm.controls[el].setErrors(null);
}));
}
this.myForm.controls["fixedValue"].setValue(null);
(/** @type {?} */ (this.myForm.get("fixedValue"))).clearValidators();
};
/**
* @param {?} e
* @return {?}
*/
EventItemComponent.prototype.selectItemChange = /**
* @param {?} e
* @return {?}
*/
function (e) {
if (!!e && e.length > 0) {
/** @type {?} */
var list_1 = [];
this.selectItem.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if ((/** @type {?} */ (e)).includes(el.value)) {
(/** @type {?} */ (list_1)).push(el);
}
}));
this.myForm.controls.selectItem.setValue(null);
this.myForm.controls.selectItem.setValue(list_1);
}
else {
this.myForm.controls.selectItem.setValue(null);
}
};
/**
* @param {?} e
* @return {?}
*/
EventItemComponent.prototype.changeToItemChange = /**
* @param {?} e
* @return {?}
*/
function (e) {
if (!!e && Array.isArray(e)) {
/** @type {?} */
var list_2 = [];
/** @type {?} */
var valueList_1 = e;
this.changeToItem.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if ((/** @type {?} */ (((/** @type {?} */ (valueList_1))))).includes(el.value)) {
(/** @type {?} */ (list_2)).push(el);
}
}));
this.myForm.controls.changeToItem.setValue(null);
this.myForm.controls.changeToItem.setValue(list_2);
}
else {
/** @type {?} */
var value_1 = (/** @type {?} */ (e));
if (!!e) {
/** @type {?} */
var list_3 = [];
this.changeToItem.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (value_1 === el.value) {
(/** @type {?} */ (list_3)).push(el);
}
}));
this.myForm.controls.changeToItem.setValue(null);
this.myForm.controls.changeToItem.setValue(list_3);
}
}
};
/**
* @param {?} e
* @return {?}
*/
EventItemComponent.prototype.fieldKeyChange = /**
* @param {?} e
* @return {?}
*/
function (e) {
var _this = this;
/** @type {?} */
var list = tslib_1.__spread(this.changeActionList, this.changeToItemList, this.lengthList, this.numbersList);
this.changeToItem = [];
this.setValueToNull(list);
if (((/** @type {?} */ (this.changeItem.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === e; }))))).length > 0) {
/** @type {?} */
var field_1 = this.changeItem.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === e; }))[0];
this.myForm.controls.changeFieldType.setValue(field_1.type);
this.myForm.controls.changeFieldName.setValue((/** @type {?} */ ((/** @type {?} */ (field_1)).templateOptions)).label);
this.nzPrecision = (/** @type {?} */ (field_1)).templateOptions.precision || 0;
this.limit.max = (/** @type {?} */ ((/** @type {?} */ (field_1)).templateOptions)).max || null;
this.limit.min = (/** @type {?} */ ((/** @type {?} */ (field_1)).templateOptions)).min || null;
this.limit.maxLength = (/** @type {?} */ ((/** @type {?} */ (field_1)).templateOptions)).maxLength || null;
this.limit.minLength = (/** @type {?} */ ((/** @type {?} */ (field_1)).templateOptions)).minLength || null;
this.initFixedValueOne(field_1);
this.newSelectType(e);
if (!_.isEmpty(this.options)) {
this.changeToValue = [];
this.options.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (el.parameterId === (/** @type {?} */ ((/** @type {?} */ (field_1)).templateOptions)).parameterId) {
(/** @type {?} */ (_this.changeToValue)).push({
value: (/** @type {?} */ (el)).value,
label: (/** @type {?} */ (el)).label,
});
}
}));
}
}
this.setChangeAction();
};
/**
* @param {?} value
* @return {?}
*/
EventItemComponent.prototype.newPrimitive = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value.primitiveProperty === null ||
value.primitiveProperty === undefined) {
value.primitiveProperty = {};
}
/** @type {?} */
var list = [
"maxLength",
"minLength",
"max",
"min",
"precision",
"maxDate",
"minDate",
];
list.forEach((/**
* @param {?} key
* @return {?}
*/
function (key) {
if (value.primitiveProperty[key] === null ||
value.primitiveProperty[key] === undefined) {
value.primitiveProperty[key] = value.templateOptions[key];
}
}));
};
/**
* @param {?} field
* @return {?}
*/
EventItemComponent.prototype.initFixedValueOne = /**
* @param {?} field
* @return {?}
*/
function (field) {
this.newPrimitive(field);
this.fixedValue.minLength =
(/** @type {?} */ (field.templateOptions)).minLength ||
(/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).minLength ||
0;
this.fixedValue.maxLength =
(/** @type {?} */ (field.templateOptions)).maxLength ||
(/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).maxLength ||
500;
this.fixedValue.nzPrecision =
(/** @type {?} */ (field.templateOptions)).precision ||
(/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).precision ||
0;
this.fixedValue.max =
(/** @type {?} */ (field.templateOptions)).max || (/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).max || 999999;
this.fixedValue.min =
(/** @type {?} */ (field.templateOptions)).min || (/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).min || -999999;
this.fixedValue.maxDate =
(/** @type {?} */ (field.templateOptions)).maxDate ||
(/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).maxDate ||
"2050-12-31";
this.fixedValue.minDate =
(/** @type {?} */ (field.templateOptions)).minDate ||
(/** @type {?} */ ((/** @type {?} */ (field)).primitiveProperty)).minDate ||
"1900-01-01";
};
/**
* @return {?}
*/
EventItemComponent.prototype.setFixedValueValidators = /**
* @return {?}
*/
function () {
if (!!this.fixedValue.min || this.fixedValue.min === 0) {
(/** @type {?} */ (this.myForm
.get("fixedValue"))).setValidators(Validators.min(this.fixedValue.min));
}
if (!!this.fixedValue.minLength) {
(/** @type {?} */ (this.myForm
.get("fixedValue"))).setValidators(Validators.minLength(this.fixedValue.minLength));
}
if (!!this.fixedValue.max) {
(/** @type {?} */ (this.myForm
.get("fixedValue"))).setValidators(Validators.max(this.fixedValue.max));
}
if (!!this.fixedValue.maxLength) {
(/** @type {?} */ (this.myForm
.get("fixedValue"))).setValidators(Validators.maxLength(this.fixedValue.maxLength));
}
};
/**
* @return {?}
*/
EventItemComponent.prototype.setChangeAction = /**
* @return {?}
*/
function () {
var _this = this;
/** @type {?} */
var requireList = [
{
value: "requireState",
label: "必填状态变更",
},
];
if (!!this.myForm.value["changeFieldType"]) {
if (this.myForm.value["changeFieldType"] === "select") {
this.changeAction = [
{
value: "valueChange",
label: "值变更",
},
{
value: "editState",
label: "编辑状态变更",
},
{
value: "hideState",
label: "隐藏选项值",
},
{
value: "showState",
label: "提供选项值",
},
];
}
else if (this.myForm.value["changeFieldType"] === "numbers") {
this.changeAction = [
{
value: "fixedValueChange",
label: "固定值变更",
},
{
value: "limitNumber",
label: "限定数值范围",
},
{
value: "editState",
label: "编辑状态变更",
},
];
}
else if (this.myForm.value["changeFieldType"] === "upload") {
this.changeAction = [
{
value: "editState",
label: "编辑状态变更",
},
];
}
else if (this.myForm.value["changeFieldType"] === "datetime") {
this.changeAction = [
{
value: "fixedValueChange",
label: "固定值变更",
},
{
value: "editState",
label: "编辑状态变更",
},
{
value: "limitDateTime",
label: "限定时间范围",
},
];
}
else {
this.changeAction = [
{
value: "fixedValueChange",
label: "固定值变更",
},
{
value: "limitLength",
label: "限定字符长度",
},
{
value: "editState",
label: "编辑状态变更",
},
];
}
}
if (!!this.myForm.value["fieldKey"] &&
!(/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ (this.changeItem)).filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === _this.myForm.value["fieldKey"]; }))))[0])).templateOptions)).required) {
this.changeAction = this.changeAction.concat(requireList);
}
};
/**
* @param {?} type
* @return {?}
*/
EventItemComponent.prototype.changeActionChange = /**
* @param {?} type
* @return {?}
*/
function (type) {
var _this = this;
/** @type {?} */
var list = tslib_1.__spread(this.changeToItemList, this.lengthList, this.numbersList);
this.setValueToNull(list);
if (!!type) {
this.myForm.controls.changeAction.setValue(this.changeAction.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.value === type; })));
}
else {
this.myForm.controls.changeAction.setValue(null);
}
this.changeActionChangeItem(type);
if (!!this.myForm.value["fieldKey"]) {
/** @type {?} */
var field = this.changeItem.filter((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.key === _this.myForm.value["fieldKey"]; }))[0];
this.initFixedValue(field);
}
};
/**
* @param {?} type
* @return {?}
*/
EventItemComponent.prototype.changeActionChangeItem = /**
* @param {?} type
* @return {?}
*/
function (type) {
var _this = this;
this.changeToItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).setValidators(Validators.required);
}));
tslib_1.__spread(this.lengthList, this.numbersList).forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).clearValidators();
}));
switch (type) {
case "valueChange":
this.changeToItem = this.changeToValue;
this.multiple = this.selectType;
break;
case "hideState":
case "showState":
this.changeToItem = this.changeToValue;
this.multiple = "multiple";
break;
case "editState":
this.changeToItem = this.editType;
this.multiple = "default";
break;
case "requireState":
this.changeToItem = this.RequiredType;
this.multiple = "default";
break;
case "limitLength":
this.changeToItem = [];
this.changeToItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).clearValidators();
}));
if (!this.myForm.value["maxLengthIncludes"]) {
(/** @type {?} */ (this.myForm.get("maxLengthIncludes"))).setValue("includes");
}
if (!this.myForm.value["minLengthIncludes"]) {
(/** @type {?} */ (this.myForm.get("minLengthIncludes"))).setValue("includes");
}
(/** @type {?} */ (this.myForm.get("maxLength"))).setValidators([Validators.required]);
(/** @type {?} */ (this.myForm.get("minLength"))).setValidators([Validators.required]);
break;
case "limitNumber":
this.changeToItem = [];
this.changeToItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).clearValidators();
}));
if (!this.myForm.value["maxIncludes"]) {
(/** @type {?} */ (this.myForm.get("maxIncludes"))).setValue("includes");
}
if (!this.myForm.value["minIncludes"]) {
(/** @type {?} */ (this.myForm.get("minIncludes"))).setValue("includes");
}
(/** @type {?} */ (this.myForm.get("max"))).setValidators([Validators.required]);
(/** @type {?} */ (this.myForm.get("min"))).setValidators([Validators.required]);
break;
case "fixedValueChange":
this.changeToItem = [];
this.changeToItemList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
(/** @type {?} */ (_this.myForm.get(el))).clearValidators();
}));
break;
default:
break;
}
};
/**
* @return {?}
*/
EventItemComponent.prototype.minNzMax = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = 999999;
if (!!(/** @type {?} */ (this.limit)).max) {
num = (/** @type {?} */ (this.limit)).max;
}
if (!!(/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).max) {
num = (/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).max;
}
return num;
};
/**
* @return {?}
*/
EventItemComponent.prototype.minNzMin = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = null;
if (!!(/** @type {?} */ (this.limit)).min) {
num = (/** @type {?} */ (this.limit)).min;
}
return num;
};
/**
* @return {?}
*/
EventItemComponent.prototype.maxNzMax = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = 999999;
if (!!(/** @type {?} */ (this.limit)).max) {
num = (/** @type {?} */ (this.limit)).max;
}
return num;
};
/**
* @return {?}
*/
EventItemComponent.prototype.maxNzMin = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = null;
if (!!(/** @type {?} */ (this.limit)).min) {
num = (/** @type {?} */ (this.limit)).min;
}
if (!!(/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).min) {
num = (/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).min;
}
return num;
};
///////////////////////////////////////////////////
///////////////////////////////////////////////////
/**
* @return {?}
*/
EventItemComponent.prototype.minLengthNzMax =
///////////////////////////////////////////////////
/**
* @return {?}
*/
function () {
/** @type {?} */
var num = 500;
if (!!(/** @type {?} */ (this.limit)).maxLength) {
num = (/** @type {?} */ (this.limit)).maxLength;
}
if (!!(/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).maxLength) {
num = (/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).maxLength;
}
return num;
};
/**
* @return {?}
*/
EventItemComponent.prototype.minLengthNzMin = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = 0;
if (!!(/** @type {?} */ (this.limit)).minLength) {
num = (/** @type {?} */ (this.limit)).minLength;
}
return num;
};
/**
* @return {?}
*/
EventItemComponent.prototype.maxLengthNzMax = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = 500;
if (!!(/** @type {?} */ (this.limit)).maxLength) {
num = (/** @type {?} */ (this.limit)).maxLength;
}
return num;
};
/**
* @return {?}
*/
EventItemComponent.prototype.maxLengthNzMin = /**
* @return {?}
*/
function () {
/** @type {?} */
var num = null;
if (!!(/** @type {?} */ (this.limit)).minLength) {
num = (/** @type {?} */ (this.limit)).minLength;
}
if (!!(/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).minLength) {
num = (/** @type {?} */ ((/** @type {?} */ (this.myForm)).value)).minLength;
}
return num;
};
// 获取限定值
// 获取限定值
/**
* @param {?} field
* @return {?}
*/
EventItemComponent.prototype.initFixedValue =
// 获取限定值
/**
* @param {?} field
* @return {?}
*/
function (field) {
var _this = this;
this.initFixedValueOne(field);
/** @type {?} */
var eventList = this.myForm.root.value["eventList"];
if (!_.isEmpty(eventList)) {
/** @type {?} */
var otherList = (/** @type {?} */ (eventList)).filter((/**
* @param {?} el
* @return {?}
*/
function (el) {
return el.code !== _this.myForm.value["code"] &&
el.fieldKey === _this.myForm.value["fieldKey"];
}));
if (!_.isEmpty(otherList)) {
/** @type {?} */
var maxList_1 = [];
/** @type {?} */
var minList_1 = [];
/** @type {?} */
var maxLengthList_1 = [];
/** @type {?} */
var minLengthList_1 = [];
/** @type {?} */
var min_1 = Math.max.apply(Math, otherList.map((/**
* @param {?} el
* @return {?}
*/
function (el) {
return el.min;
})));
/** @type {?} */
var max_1 = Math.min.apply(Math, otherList.map((/**
* @param {?} el
* @return {?}
*/
function (el) {
return el.max;
})));
/** @type {?} */
var minLength_1 = Math.max.apply(Math, otherList.map((/**
* @param {?} el
* @return {?}
*/
function (el) {
return el.minLength;
})));
/** @type {?} */
var maxLength_1 = Math.min.apply(Math, otherList.map((/**
* @param {?} el
* @return {?}
*/
function (el) {
return el.maxLength;
})));
if (!!min_1 || min_1 === 0) {
otherList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (el.min === min_1) {
minList_1.push(el);
}
}));
}
if (!!max_1 || max_1 === 0) {
otherList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (el.max === max_1) {
maxList_1.push(el);
}
}));
}
if (!!maxLength_1 || maxLength_1 === 0) {
otherList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (el.maxLength === maxLength_1) {
maxLengthList_1.push(el);
}
}));
}
if (!!minLength_1 || minLength_1 === 0) {
otherList.forEach((/**
* @param {?} el
* @return {?}
*/
function (el) {
if (el.minLength === minLength_1) {
minLengthList_1.push(el);
}
}));
}
if (!_.isEmpty(maxList_1)) {
if (maxList_1.some((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.maxIncludes === "notIncludes"; }))) {
this.fixedValue.max = Math.min(this.fixedValue.max, max_1 - 1);
}
else {
this.fixedValue.max = Math.min(this.fixedValue.max, max_1);
}
}
if (!_.isEmpty(minList_1)) {
if (minList_1.some((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.minIncludes === "notIncludes"; }))) {
this.fixedValue.min = Math.max(this.fixedValue.min, min_1 - 1);
}
else {
this.fixedValue.min = Math.max(this.fixedValue.min, min_1);
}
}
if (!_.isEmpty(minLengthList_1)) {
if (minLengthList_1.some((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.minLengthIncludes === "notIncludes"; }))) {
this.fixedValue.minLength = Math.max(this.fixedValue.minLength, minLength_1 - 1);
}
else {
this.fixedValue.minLength = Math.max(this.fixedValue.minLength, minLength_1);
}
}
if (!_.isEmpty(maxLengthList_1)) {
if (maxLengthList_1.some((/**
* @param {?} el
* @return {?}
*/
function (el) { return el.maxLengthIncludes === "notIncludes"; }))) {
this.fixedValue.maxLength = Math.min(this.fixedValue.maxLength, maxLength_1 - 1);
}
else {
this.fixedValue.maxLength = Math.min(this.fixedValue.maxLength, maxLength_1);
}
}
}
}
this.setFixedValueValidators();
};
EventItemComponent.decorators = [
{ type: Component, args: [{
selector: "demo-event-item",
template: "<ng-container [formGroup]=\"myForm\">\n <div class=\"w-100 flex-h\">\n <div class=\"w-100\">\n <nz-form-item class=\"flex-h mb-0\">\n <nz-form-control\n nz-col\n nzSpan=\"4\"\n class=\"pr-3\"\n nzErrorTip=\"\u8BF7\u9009\u62E9\u53D8\u66F4\u7C7B\u578B\"\n >\n <nz-select\n id=\"selected\"\n formControlName=\"selected\"\n nzPlaceHolder=\"\u53D8\u66F4\u7C7B\u578B\"\n nzShowSearch\n nzDropdownMatchSelectWidth=\"true\"\n (ngModelChange)=\"selectedChange($event)\"\n >\n <nz-option\n *ngFor=\"let item of selected\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.value\"\n [nzLabel]=\"item.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.label }}\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n\n <nz-form-control\n nz-col\n nzSpan=\"5\"\n class=\"pr-3\"\n nzErrorTip=\"\u8BF7\u9009\u62E9\u53D8\u66F4\u7C7B\u578B\u503C\"\n *ngIf=\"myForm.value['selected'] === 'selected'\"\n >\n <nz-select\n id=\"selectItem\"\n nzMode=\"multiple\"\n [nzMaxTagCount]=\"3\"\n formControlName=\"selectItems\"\n nzDropdownMatchSelectWidth=\"true\"\n (ngModelChange)=\"selectItemChange($event)\"\n nzPlaceHolder=\"\u53D8\u66F4\u7C7B\u578B\u503C\"\n style=\"width: 160px\"\n nzShowSearch\n >\n <nz-option\n *ngFor=\"let item of selectItem\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.value\"\n [nzLabel]=\"item.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.label }}\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n\n <nz-form-control\n nz-col\n nzSpan=\"5\"\n class=\"pr-3\"\n *ngIf=\"myForm.value['selected'] === 'inputIsSpec'\"\n nzErrorTip=\"\u8BF7\u8F93\u5165\u7279\u5B9A\u503C\"\n >\n <input nz-input placeholder=\"\u7279\u5B9A\u503C\" formControlName=\"specValue\" />\n </nz-form-control>\n\n <nz-form-control\n nz-col\n nzSpan=\"5\"\n class=\"pr-3\"\n *ngIf=\"myForm.value['selected'] === 'dateTimeIsSpec'\"\n nzErrorTip=\"\u8BF7\u8F93\u5165\u7279\u5B9A\u65F6\u95F4\"\n >\n <!-- <demo-datetime\n formControlName=\"dateTimeIsSpec\"\n [maxDate]=\"fixedValue.maxDate\"\n [minDate]=\"fixedValue.minDate\"\n >\n </demo-datetime> -->\n </nz-form-control>\n\n <nz-form-control\n nz-col\n nzSpan=\"5\"\n class=\"pr-3\"\n nzErrorTip=\"\u8BF7\u9009\u62E9\u53D8\u66F4\u5BF9\u8C61\"\n >\n <nz-select\n id=\"fieldKey\"\n formControlName=\"fieldKey\"\n nzPlaceHolder=\"\u53D8\u66F4\u5BF9\u8C61\"\n nzShowSearch\n nzDropdownMatchSelectWidth=\"true\"\n (ngModelChange)=\"fieldKeyChange($event)\"\n >\n <nz-option\n *ngFor=\"let item of changeItem\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.key\"\n [nzLabel]=\"item.templateOptions.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.templateOptions.label }}\n <span *ngIf=\"!!item?.tableName\">--{{ item?.tableName }}</span>\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n\n <nz-form-control\n nz-col\n nzSpan=\"4\"\n class=\"pr-3\"\n nzErrorTip=\"\u8BF7\u9009\u62E9\u53D8\u66F4\u52A8\u4F5C\"\n >\n <nz-select\n id=\"changeAction\"\n formControlName=\"changeActions\"\n nzPlaceHolder=\"\u53D8\u66F4\u52A8\u4F5C\"\n nzShowSearch\n nzDropdownMatchSelectWidth=\"true\"\n (ngModelChange)=\"changeActionChange($event)\"\n >\n <nz-option\n *ngFor=\"let item of changeAction\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.value\"\n [nzLabel]=\"item.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.label }}\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n <nz-form-control\n nz-col\n nzSpan=\"4\"\n class=\"\"\n nzErrorTip=\"\u8BF7\u9009\u62E9\u53D8\u66F4\u7ED3\u679C\"\n *ngIf=\"\n myForm.value['changeActions'] !== 'limitLength' &&\n myForm.value['changeActions'] !== 'limitNumber' &&\n myForm.value['changeActions'] !== 'limitDateTime' &&\n myForm.value['changeActions'] !== 'fixedValueChange'\n \"\n >\n <nz-select\n id=\"changeToItem\"\n formControlName=\"changeToItems\"\n nzPlaceHolder=\"\u53D8\u66F4\u7ED3\u679C\"\n nzShowSearch\n (ngModelChange)=\"changeToItemChange($event)\"\n [nzMode]=\"multiple\"\n [nzMaxTagCount]=\"3\"\n nzDropdownMatchSelectWidth=\"true\"\n >\n <nz-option\n *ngFor=\"let item of changeToItem\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.value\"\n [nzLabel]=\"item.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.label }}\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n\n <nz-form-control\n nz-col\n nzSpan=\"4\"\n class=\"\"\n *ngIf=\"myForm.value['changeActions'] === 'fixedValueChange'\"\n nzErrorTip=\"\u56FA\u5B9A\u503C\u586B\u5199\u6709\u8BEF\"\n >\n <ng-container *ngIf=\"myForm.value['changeFieldType'] !== 'numbers'\">\n <input\n nz-input\n id=\"fixedValue\"\n formControlName=\"fixedValue\"\n placeHolder=\"\u56FA\u5B9A\u503C\"\n [maxlength]=\"fixedValue.maxLength\"\n [minlength]=\"fixedValue.minLength\"\n />\n </ng-container>\n\n <ng-container *ngIf=\"myForm.value['changeFieldType'] === 'numbers'\">\n <nz-input-number\n style=\"width: 100%\"\n id=\"fixedValue\"\n formControlName=\"fixedValue\"\n nzPlaceHolder=\"\u56FA\u5B9A\u503C\"\n [nzMax]=\"fixedValue.max\"\n [nzMin]=\"fixedValue.min\"\n [nzPrecision]=\"fixedValue.nzPrecision\"\n ></nz-input-number>\n </ng-container>\n </nz-form-control>\n\n <div\n class=\"new-flex-1\"\n *ngIf=\"myForm.value['changeActions'] === 'limitNumber'\"\n >\n <div class=\"mb-2 flex-h\">\n <nz-form-control class=\"mb-2\" nzErrorTip=\"\u6700\u5C0F\u503C\u586B\u5199\u6709\u8BEF\">\n <nz-input-number\n id=\"min\"\n style=\"width: 100%\"\n nzPlaceHolder=\"\u6700\u5C0F\u503C\"\n formControlName=\"min\"\n [nzMax]=\"minNzMax()\"\n [nzMin]=\"minNzMin()\"\n [nzPrecision]=\"nzPrecision\"\n class=\"mr-3\"\n ></nz-input-number>\n </nz-form-control>\n <nz-form-control>\n <nz-select\n style=\"width: 80px\"\n id=\"minIncludes\"\n formControlName=\"minIncludes\"\n nzDropdownMatchSelectWidth=\"true\"\n nzPlaceHolder=\"\u662F\u5426\u5305\u542B\"\n >\n <nz-option\n *ngFor=\"let item of minIncludes\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.value\"\n [nzLabel]=\"item.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.label }}\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n </div>\n\n <div class=\"flex-h\">\n <nz-form-control nz-col nzErrorTip=\"\u6700\u5927\u503C\u586B\u5199\u6709\u8BEF\">\n <nz-input-number\n id=\"max\"\n style=\"width: 100%\"\n nzPlaceHolder=\"\u6700\u5927\u503C\"\n formControlName=\"max\"\n [nzMax]=\"maxNzMax()\"\n [nzMin]=\"maxNzMin()\"\n [nzPrecision]=\"nzPrecision\"\n class=\"mr-3\"\n ></nz-input-number>\n </nz-form-control>\n <nz-form-control>\n <nz-select\n style=\"width: 80px\"\n id=\"maxIncludes\"\n formControlName=\"maxIncludes\"\n nzPlaceHolder=\"\u662F\u5426\u5305\u542B\"\n nzDropdownMatchSelectWidth=\"true\"\n >\n <nz-option\n *ngFor=\"let item of maxIncludes\"\n nzCustomContent\n nzDropdownMatchSelectWidth=\"true\"\n [nzValue]=\"item.value\"\n [nzLabel]=\"item.label\"\n >\n <div class=\"options-item w-95\">\n {{ item.label }}\n </div>\n </nz-option>\n </nz-select>\n </nz-form-control>\n </div>\n </div>\n\n <div\n class=\"new-flex-1\"\n *ngIf=\"myForm.value['changeActions'] === 'limitLength'\"\n >\n <div class=\"mb-2 flex-h\">\n <nz-form-control nz-col nzErrorTip=\"\u6700\u5C0F\u957F\u5EA6\u586B\u5199\u6709\u8BEF\">\n <nz-input-number\n id=\"minLength\"\n style=\"width: 100%\"\n nzPlaceHolder=\"\u6700\u5C0F\u957F\u5EA6\"\n formControlName=\"minLength\"\n nzPrecision=\"0\"\n [nzMax]=\"minLengthNzMax()\"\n [nzMin]=\"minLengthNzMin()\"\n class=\"mr-3\"\n ></nz-input-number>\n </nz-form-control>\n\n <nz-form-control>\n <nz-select\n style=\"width: 80px\"\n id=\"minLengthIncludes\"\n formControlName=\"minLengthIncludes\"\n nzPlaceHolder=\"\u662F\u5426\u5305\u542B\"\n