Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
146 lines
5.9 KiB
TypeScript
146 lines
5.9 KiB
TypeScript
// Module ID: 8416
|
|
// Function ID: 8417
|
|
// Name: validateComponent
|
|
// Dependencies: [1978, 5012, 1115, 38, 2]
|
|
// Exports: default
|
|
|
|
// Module 8416 (validateComponent)
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import Server from "Server" /* 1978 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const result = size.fileFinishedImporting("modules/interaction_components/validateComponent.tsx");
|
|
|
|
export default function validateComponent(type, arg1, modal) {
|
|
values = arg1;
|
|
if (null != arg1) {
|
|
_modDef38(values.type === type.type, "component type matches state");
|
|
}
|
|
type = type.type;
|
|
if (Server.ComponentType.BUTTON === type) {
|
|
return null;
|
|
} else {
|
|
if (tmp4(1978).ComponentType.STRING_SELECT !== type) {
|
|
if (tmp4(1978).ComponentType.USER_SELECT !== type) {
|
|
if (tmp4(1978).ComponentType.ROLE_SELECT !== type) {
|
|
if (tmp4(1978).ComponentType.MENTIONABLE_SELECT !== type) {
|
|
if (tmp4(1978).ComponentType.CHANNEL_SELECT !== type) {
|
|
if (tmp4(1978).ComponentType.TEXT_INPUT === type) {
|
|
({ minLength, maxLength, required } = type);
|
|
if (null != values) {
|
|
if (0 !== values.value.length) {
|
|
if (values.value.length < minLength) {
|
|
const intl8 = tmp4(1115).intl;
|
|
const range = { min: minLength, max: maxLength };
|
|
let formatToPlainStringResult = intl8.formatToPlainString(tmp4(1115).t.ONSqYd, range);
|
|
} else {
|
|
formatToPlainStringResult = null;
|
|
}
|
|
}
|
|
return formatToPlainStringResult;
|
|
}
|
|
let stringResult = null;
|
|
if (required) {
|
|
const intl9 = tmp4(1115).intl;
|
|
stringResult = intl9.string(tmp4(1115).t.eJEUvD);
|
|
}
|
|
formatToPlainStringResult = stringResult;
|
|
} else if (tmp4(1978).ComponentType.FILE_UPLOAD === type) {
|
|
({ minValues: minValues2, maxValues: maxValues2 } = type);
|
|
let num3;
|
|
if (values != null) {
|
|
num3 = values.uploadIds.length;
|
|
}
|
|
if (num3 == null) {
|
|
num3 = 0;
|
|
}
|
|
if (0 === num3) {
|
|
let stringResult1 = null;
|
|
if (type.required) {
|
|
const intl7 = tmp4(1115).intl;
|
|
stringResult1 = intl7.string(tmp4(1115).t.eJEUvD);
|
|
}
|
|
let formatToPlainStringResult1 = stringResult1;
|
|
} else if (num3 < minValues2) {
|
|
const intl6 = tmp4(1115).intl;
|
|
const obj2 = { minValues: minValues2 };
|
|
formatToPlainStringResult1 = intl6.formatToPlainString(tmp4(1115).t.pmAt62, obj2);
|
|
} else {
|
|
formatToPlainStringResult1 = null;
|
|
if (num3 > maxValues2) {
|
|
const intl5 = tmp4(1115).intl;
|
|
const obj3 = { maxValues: maxValues2 };
|
|
formatToPlainStringResult1 = intl5.formatToPlainString(tmp4(1115).t.dy6viJ, obj3);
|
|
}
|
|
}
|
|
return formatToPlainStringResult1;
|
|
} else if (tmp4(1978).ComponentType.RADIO_GROUP === type) {
|
|
if (null == values) {
|
|
let stringResult2 = null;
|
|
if (tmp10) {
|
|
const intl4 = tmp4(1115).intl;
|
|
stringResult2 = intl4.string(tmp4(1115).t.eJEUvD);
|
|
}
|
|
} else {
|
|
stringResult2 = null;
|
|
}
|
|
return stringResult2;
|
|
} else if (tmp4(1978).ComponentType.CHECKBOX_GROUP === type) {
|
|
({ minValues, maxValues } = type);
|
|
let num;
|
|
if (values != null) {
|
|
num = values.values.length;
|
|
}
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
if (0 === num) {
|
|
let stringResult3 = null;
|
|
if (type.required) {
|
|
const intl3 = tmp4(1115).intl;
|
|
stringResult3 = intl3.string(tmp4(1115).t.eJEUvD);
|
|
}
|
|
let formatToPlainStringResult2 = stringResult3;
|
|
} else if (num < minValues) {
|
|
const intl2 = tmp4(1115).intl;
|
|
const obj4 = { count: minValues };
|
|
formatToPlainStringResult2 = intl2.formatToPlainString(tmp4(1115).t.Jmwzdx, obj4);
|
|
} else {
|
|
formatToPlainStringResult2 = null;
|
|
if (num > maxValues) {
|
|
const intl = tmp4(1115).intl;
|
|
const obj = { count: maxValues };
|
|
formatToPlainStringResult2 = intl.formatToPlainString(tmp4(1115).t.LDvfRP, obj);
|
|
}
|
|
}
|
|
return formatToPlainStringResult2;
|
|
} else if (tmp4(1978).ComponentType.CHECKBOX === type) {
|
|
return null;
|
|
} else {
|
|
_modDef38(false, "missing validator for this component");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
({ minValues: minValues3, maxValues: maxValues3 } = type);
|
|
if (null == values) {
|
|
{
|
|
const obj5 = { minValues: minValues3, required: tmp16 };
|
|
let stringResult4 = null;
|
|
if (!tmp4Result.canSelectBeEmpty(obj5, modal)) {
|
|
const intl10 = tmp4(1115).intl;
|
|
stringResult4 = intl10.string(tmp4(1115).t.eJEUvD);
|
|
}
|
|
const tmp18 = stringResult4;
|
|
tmp4Result = tmp4(5012);
|
|
}
|
|
return tmp18;
|
|
} else if (values.type === tmp4(1978).ComponentType.STRING_SELECT) {
|
|
({ values, length } = values);
|
|
} else {
|
|
length = values.selectedOptions.length;
|
|
}
|
|
}
|
|
};
|