{"version":3,"sources":["webpack:///./src/components/CustomForm/ControlEditor/common.ts","webpack:///./node_modules/uuid/dist/esm-browser/rng.js","webpack:///./node_modules/uuid/dist/esm-browser/bytesToUuid.js","webpack:///./node_modules/uuid/dist/esm-browser/v4.js","webpack:///./src/components/CustomForm/Validators/AbstractValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/EmailValidator.ts","webpack:///./src/components/CustomForm/Validators/ValidatorProperty.ts","webpack:///./src/components/CustomForm/Validators/implements/MaxLengthValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/NumberValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/MaxValueValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/MinLengthValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/MinValueValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/MobilePhoneValidator.ts","webpack:///./src/components/CustomForm/Validators/implements/RequiredValidator.ts","webpack:///./src/components/CustomForm/common.ts"],"names":["PropertyValueEditorType","newGuid","getRandomValues","crypto","bind","msCrypto","rnds8","Uint8Array","rng","Error","byteToHex","push","toString","substr","bytesToUuid","buf","offset","i","bth","toLowerCase","v4","options","rnds","random","start","expression","this","isMatch","displayName","name","value","length","test","propertyName","_valueCheckErrors","show","_propertyValue","valueEditor","Input","newValue","checkPropertyValue","result","propertyValue","propertyValueValidate","validationResult","checkResult","checkNewValue","regex","RegExp","exec","maxLengthProperty","startsWith","text","maxLength","Number","numberValidator","maxValueProperty","validate","maxValue","numberValue","numberValidateResult","isNaN","minLengthProperty","minLength","minValueProperty","minValue","Array","isArray","resolveSelectOptions","control","Promise","resolve","reject","dataSource","dataSourceType","CustomValues","chooseValues","map","id","DataDictionary","api","dataDictionary","getDataDictionaryListByKey","key","then","res","items","dictionary","Enum","enumService","getValues","typeName","enumValue","createValidator","validator","fieldNameTryAsCamelCase","field","isDynamic","fieldName"],"mappings":"gHAQA,wEAIYA,EAJZ,YAgBM,SAAUC,IACd,OAAO,kBAbT,SAAYD,GACV,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C,EAAIR,KAAI,SAAAe,GAAY,MAAO,CAACxC,KAAKwC,EAAUxC,KAAKtB,MAAM8D,EAAU9D,UAC/EyC,EAAQ9B,MAGV8B,EAAQ,QA6BV,SAAUsB,EAAgBpE,GAC9B,IAAIqE,EAEJ,GAAGrE,EAAW0B,WAAW,SACvB2C,EAAY,IAAI,EAAerE,QAC1B,GAAGA,EAAW0B,WAAW,aAC9B2C,EAAY,IAAI,EAAmBrE,QAC9B,GAAGA,EAAW0B,WAAW,YAC9B2C,EAAY,IAAI,EAAkBrE,QAC7B,GAAGA,EAAW0B,WAAW,aAC9B2C,EAAY,IAAI,EAAmBrE,QAC9B,GAAGA,EAAW0B,WAAW,YAC9B2C,EAAY,IAAI,EAAkBrE,QAC7B,GAAGA,EAAW0B,WAAW,eAC9B2C,EAAY,IAAI,EAAqBrE,QAChC,GAAGA,EAAW0B,WAAW,UAC9B2C,EAAY,IAAI,EAAgBrE,OAC3B,KAAGA,EAAW0B,WAAW,YAG9B,MAAM,IAAI1C,MAAJ,cAAiBgB,EAAjB,SAFNqE,EAAY,IAAI,EAAkBrE,GAKpC,OAAOqE,EAGH,SAAUC,EAAwBC,GACtC,IAAIvD,EAMJ,OAJEA,EADCuD,EAAMC,UACED,EAAME,UAENF,EAAME,UAAWrF,OAAO,EAAE,GAAGM,cAAgB6E,EAAME,UAAWrF,OAAO,GAEzE4B","file":"js/chunk-46756ee6.d6630514.js","sourcesContent":["import {\r\n CustomFormDataSourceType,\r\n CustomFormFieldCreateOrUpdateDto,\r\n DataDictionaryDto,\r\n SelectListItem\r\n} from \"@/api/appService\";\r\n\r\nimport api from '@/api/index'\r\nimport {v4 as uuidv4} from \"uuid\";\r\nimport ElementProperty from \"@/components/CustomForm/Design/ControlEditor/ElementProperty\";\r\n\r\n\r\nexport enum PropertyValueEditorType {\r\n 'Input'='Input',\r\n 'Dropdown'='Dropdown',\r\n 'Radio' = 'Radio',\r\n 'Group' = 'Group',\r\n 'CustomValues' = 'CustomValues',\r\n 'Switch' = 'Switch',\r\n 'Validators' = 'Validators'\r\n}\r\n\r\n\r\n\r\nexport function newGuid(){\r\n return uuidv4();\r\n}\r\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n// find the complete implementation of crypto (msCrypto) on IE11.\nvar getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n\n return getRandomValues(rnds8);\n}","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex; // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n\n return (bth[buf[i + 0]] + bth[buf[i + 1]] + bth[buf[i + 2]] + bth[buf[i + 3]] + '-' + bth[buf[i + 4]] + bth[buf[i + 5]] + '-' + bth[buf[i + 6]] + bth[buf[i + 7]] + '-' + bth[buf[i + 8]] + bth[buf[i + 9]] + '-' + bth[buf[i + 10]] + bth[buf[i + 11]] + bth[buf[i + 12]] + bth[buf[i + 13]] + bth[buf[i + 14]] + bth[buf[i + 15]]).toLowerCase();\n}\n\nexport default bytesToUuid;","import rng from './rng.js';\nimport bytesToUuid from './bytesToUuid.js';\n\nfunction v4(options, buf, offset) {\n if (typeof options === 'string') {\n buf = options === 'binary' ? new Uint8Array(16) : null;\n options = null;\n }\n\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n var start = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[start + i] = rnds[i];\n }\n\n return buf;\n }\n\n return bytesToUuid(rnds);\n}\n\nexport default v4;","import {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\n\r\nexport default abstract class AbstractValidator {\r\n\r\n\r\n\r\n\r\n\r\n constructor(expression:string) {\r\n if(expression){\r\n if(!this.isMatch(expression))\r\n throw new Error(`expression is not ${this.displayName()}`)\r\n }\r\n\r\n }\r\n\r\n abstract displayName():string;\r\n\r\n abstract isMatch(expression: string):boolean;\r\n\r\n\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\n\r\nexport default class EmailValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n constructor(expression:string) {\r\n super(expression);\r\n }\r\n\r\n displayName(): string {\r\n return \"邮箱\";\r\n }\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression === this.name());\r\n }\r\n\r\n toString(): string {\r\n return this.name();\r\n }\r\n\r\n name(): string {\r\n return \"email\";\r\n }\r\n\r\n\r\n\r\n properties(): ValidatorProperty[] {\r\n return [];\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value === 'string' && value.length){\r\n if(/^([a-zA-Z0-9]+[-_.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[-_.]?)*[a-zA-Z0-9]+\\.[a-zA-Z]{2,6}$/.test(value)){\r\n return '';\r\n } else {\r\n return '不是有效的邮箱';\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n\r\n\r\n\r\n}\r\n","import {\r\n CustomFormFieldCreateOrUpdateDto,\r\n CustomFormLayoutDetailCreateOrUpdateDto,\r\n SelectListItem\r\n} from \"@/api/appService\";\r\nimport {PropertyValueEditorType} from \"@/components/CustomForm/ControlEditor/common\";\r\n\r\ntype onValueChange = (newValue:string | undefined) => void;\r\ntype propertyValueValidate = (value:string | undefined) => string[];\r\n\r\nexport default class ValidatorProperty {\r\n\r\n private _propertyValue?:string;\r\n private _valueCheckErrors:string[]= [];\r\n\r\n\r\n propertyName!: string;\r\n show = true;\r\n valueEditor!:PropertyValueEditorType;\r\n\r\n\r\n\r\n onPropertyValueChange?:onValueChange;\r\n propertyValueValidate?:propertyValueValidate;\r\n\r\n\r\n constructor(propertyName: string,value:string) {\r\n this._propertyValue = value;\r\n this.propertyName = propertyName;\r\n this.valueEditor = PropertyValueEditorType.Input;\r\n\r\n\r\n }\r\n\r\n\r\n get valueCheckErrors():string[]{\r\n return this._valueCheckErrors;\r\n }\r\n\r\n get propertyValue(){\r\n return this._propertyValue;\r\n }\r\n\r\n\r\n\r\n set propertyValue(newValue){\r\n if(newValue!== this._propertyValue){\r\n const checkResult = this.checkNewValue(newValue);\r\n if(checkResult && checkResult.length){\r\n this._valueCheckErrors = checkResult;\r\n } else {\r\n this._valueCheckErrors = [];\r\n }\r\n }\r\n\r\n\r\n this._propertyValue = newValue;\r\n\r\n }\r\n\r\n\r\n private checkNewValue(newValue:string | undefined){\r\n return this.checkPropertyValue(newValue);\r\n }\r\n\r\n public isPropertyValueSuccess():boolean{\r\n let result = this.checkPropertyValue(this.propertyValue);\r\n return result.length === 0;\r\n }\r\n\r\n private checkPropertyValue(value:string | undefined){\r\n let result:string[] = [];\r\n if(!value){\r\n result.push('该属性值是必须的');\r\n }\r\n if(this.propertyValueValidate){\r\n let validationResult = this.propertyValueValidate(value);\r\n if(validationResult && validationResult.length){\r\n result = [...validationResult];\r\n }\r\n\r\n }\r\n\r\n return result;\r\n }\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\n\r\nexport default class MaxLengthValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n private maxLengthProperty:ValidatorProperty;\r\n\r\n\r\n constructor(expression: string) {\r\n super(expression);\r\n\r\n let propertyValue = '';\r\n let regex = new RegExp('[\\\\d]{1,10}');\r\n if(regex.test(expression)){\r\n propertyValue = regex.exec(expression)![0];\r\n }\r\n\r\n this.maxLengthProperty = new ValidatorProperty('最大长度',propertyValue);\r\n this.maxLengthProperty.propertyValueValidate = (newValue:string | undefined) =>{\r\n if(!newValue){\r\n return ['值不能为空'];\r\n } else if(/^(\\d{1,9})$/.test(newValue) === false){\r\n return ['必须是一个正整数'];\r\n } else {\r\n return [];\r\n }\r\n }\r\n }\r\n\r\n displayName(): string {\r\n return \"字符最大长度\";\r\n }\r\n\r\n name(): string {\r\n return \"maxLength\";\r\n }\r\n\r\n\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression.startsWith(this.name()));\r\n }\r\n\r\n toString(): string {\r\n return `maxLength(${this.maxLengthProperty.propertyValue})`;\r\n }\r\n\r\n properties(): ValidatorProperty[] {\r\n return [this.maxLengthProperty];\r\n }\r\n\r\n get maxLength(){\r\n return Number(this.maxLengthProperty.propertyValue);\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value === 'boolean'){\r\n return '';\r\n }\r\n if(typeof value === 'undefined' || value === null){\r\n return '';\r\n }\r\n let text = value.toString();\r\n if(text.length> this.maxLength){\r\n return `最多可以输入${this.maxLength}个字符`;\r\n }\r\n\r\n return '';\r\n\r\n\r\n }\r\n\r\n\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\n\r\nexport default class NumberValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n constructor(expression: string) {\r\n super(expression);\r\n }\r\n\r\n displayName(): string {\r\n return \"数值\";\r\n }\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression === this.name());\r\n }\r\n\r\n toString(): string {\r\n return this.name();\r\n }\r\n\r\n name(): string {\r\n return \"number\";\r\n }\r\n\r\n\r\n\r\n properties(): ValidatorProperty[] {\r\n return [];\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value === 'string' && value.length){\r\n if(/^([\\d]{1,20}(\\.\\d{1,20})?)$/.test(value)){\r\n return '';\r\n } else {\r\n return '不是有效的数值';\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n\r\n\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\nimport NumberValidator from \"@/components/CustomForm/Validators/implements/NumberValidator\";\r\n\r\nexport default class MaxValueValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n private maxValueProperty:ValidatorProperty;\r\n private numberValidator = new NumberValidator('number');\r\n\r\n\r\n constructor(expression: string) {\r\n super(expression);\r\n\r\n\r\n\r\n let propertyValue = '';\r\n let regex = new RegExp('([\\\\d]{1,20}(\\\\.\\\\d{1,20})?)');\r\n if(regex.test(expression)){\r\n propertyValue = regex.exec(expression)![0];\r\n }\r\n\r\n this.maxValueProperty = new ValidatorProperty('最大值',propertyValue);\r\n this.maxValueProperty.propertyValueValidate = (newValue:string | undefined) =>{\r\n if(!newValue){\r\n return ['值不能为空'];\r\n } else if(this.numberValidator.validate(newValue)){\r\n return ['必须是一个数值'];\r\n } else {\r\n return [];\r\n }\r\n }\r\n }\r\n\r\n displayName(): string {\r\n return \"最大值\";\r\n }\r\n\r\n name(): string {\r\n return \"maxValue\";\r\n }\r\n\r\n\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression.startsWith(this.name()));\r\n }\r\n\r\n toString(): string {\r\n return `${this.name()}(${this.maxValue})`;\r\n }\r\n\r\n properties(): ValidatorProperty[] {\r\n return [this.maxValueProperty];\r\n }\r\n\r\n get maxValue(){\r\n return Number(this.maxValueProperty.propertyValue);\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value !== 'string' && typeof value !=='number'){\r\n return '';\r\n }\r\n if(typeof value === 'string' && !value.length){\r\n return '';\r\n }\r\n\r\n\r\n let numberValue:number = 0;\r\n if(typeof value === 'number'){\r\n numberValue = value;\r\n } else {\r\n const numberValidateResult = this.numberValidator.validate(value);\r\n if(numberValidateResult){\r\n return numberValidateResult;\r\n }\r\n numberValue = Number(value);\r\n }\r\n\r\n\r\n if(isNaN(numberValue)){\r\n return '不是一个有效的数值';\r\n } else if(numberValue > this.maxValue){\r\n return `值不能大于${this.maxValue}`;\r\n } else {\r\n return '';\r\n }\r\n\r\n\r\n\r\n }\r\n\r\n\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\n\r\nexport default class MinLengthValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n private minLengthProperty:ValidatorProperty;\r\n\r\n\r\n constructor(expression: string) {\r\n super(expression);\r\n\r\n let propertyValue = '';\r\n let regex = new RegExp('[\\\\d]{1,10}');\r\n if(regex.test(expression)){\r\n propertyValue = regex.exec(expression)![0];\r\n }\r\n\r\n this.minLengthProperty = new ValidatorProperty('最小长度',propertyValue);\r\n this.minLengthProperty.propertyValueValidate = (newValue:string | undefined) =>{\r\n if(!newValue){\r\n return ['值不能为空'];\r\n } else if(/^(\\d{1,9})$/.test(newValue) === false){\r\n return ['必须是一个正整数'];\r\n } else {\r\n return [];\r\n }\r\n }\r\n }\r\n\r\n name(): string {\r\n return \"minLength\";\r\n }\r\n\r\n\r\n\r\n displayName(): string {\r\n return \"字符最短长度\";\r\n }\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression.startsWith(this.name()));\r\n }\r\n\r\n toString(): string {\r\n return `${this.name()}(${this.minLengthProperty.propertyValue})`;\r\n }\r\n\r\n properties(): ValidatorProperty[] {\r\n return [this.minLengthProperty];\r\n }\r\n\r\n get minLength(){\r\n return Number(this.minLengthProperty.propertyValue);\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value === 'boolean'){\r\n return '';\r\n }\r\n if(typeof value === 'undefined' || value === null){\r\n return '';\r\n }\r\n let text = value.toString();\r\n if(text.length < this.minLength){\r\n return `最少输入${this.minLength}个字符`;\r\n }\r\n\r\n return '';\r\n\r\n\r\n }\r\n\r\n\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\nimport NumberValidator from \"@/components/CustomForm/Validators/implements/NumberValidator\";\r\n\r\nexport default class MinValueValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n private minValueProperty:ValidatorProperty;\r\n private numberValidator = new NumberValidator('number');\r\n\r\n\r\n constructor(expression: string) {\r\n super(expression);\r\n\r\n let propertyValue = '';\r\n let regex = new RegExp('([\\\\d]{1,20}(\\\\.\\\\d{1,20})?)');\r\n if(expression && regex.test(expression)){\r\n propertyValue = regex.exec(expression)![0];\r\n }\r\n\r\n this.minValueProperty = new ValidatorProperty('最小值',propertyValue.toString());\r\n this.minValueProperty.propertyValueValidate = (newValue:string | undefined) =>{\r\n if(!newValue){\r\n return ['值不能为空'];\r\n } else if(this.numberValidator.validate(newValue)){\r\n return ['必须是一个数值'];\r\n } else {\r\n return [];\r\n }\r\n }\r\n }\r\n\r\n name(): string {\r\n return \"minValue\";\r\n }\r\n\r\n\r\n\r\n displayName(): string {\r\n return \"最小值\";\r\n }\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression.startsWith(this.name()));\r\n }\r\n\r\n toString(): string {\r\n return `${this.name()}(${this.minValue})`;\r\n }\r\n\r\n properties(): ValidatorProperty[] {\r\n return [this.minValueProperty];\r\n }\r\n\r\n get minValue(){\r\n return Number(this.minValueProperty.propertyValue);\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value !== 'string' && typeof value !=='number'){\r\n return '';\r\n }\r\n if(typeof value === 'string' && !value.length){\r\n return '';\r\n }\r\n\r\n\r\n let numberValue:number = 0;\r\n if(typeof value === 'number'){\r\n numberValue = value;\r\n } else {\r\n const numberValidateResult = this.numberValidator.validate(value);\r\n if(numberValidateResult){\r\n return numberValidateResult;\r\n }\r\n numberValue = Number(value);\r\n }\r\n\r\n\r\n if(isNaN(numberValue)){\r\n return '不是一个有效的数值';\r\n } else if(numberValue < this.minValue){\r\n return `值不能小于${this.minValue}`;\r\n } else {\r\n return '';\r\n }\r\n\r\n\r\n\r\n }\r\n\r\n\r\n\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\n\r\nexport default class MobilePhoneValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n constructor(expression: string) {\r\n super(expression);\r\n }\r\n\r\n displayName(): string {\r\n return \"手机号\";\r\n }\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression === this.name());\r\n }\r\n\r\n properties(): ValidatorProperty[] {\r\n return [];\r\n }\r\n\r\n validate(value: any): string {\r\n if(typeof value === 'string' && value.length){\r\n if(/^(1[\\d]{10})$/.test(value)){\r\n return '';\r\n } else {\r\n return '不是有效的手机号';\r\n }\r\n } else {\r\n return '';\r\n }\r\n }\r\n\r\n name(): string {\r\n return \"mobilePhone\";\r\n }\r\n\r\n\r\n\r\n\r\n toString(): string {\r\n return this.name();\r\n }\r\n}\r\n","import AbstractValidator from \"@/components/CustomForm/Validators/AbstractValidator\";\r\nimport {CustomFormFieldCreateOrUpdateDto} from \"@/api/appService\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport ValidatorProperty from \"@/components/CustomForm/Validators/ValidatorProperty\";\r\n\r\nexport default class RequiredValidator extends AbstractValidator implements IValidate{\r\n\r\n\r\n constructor(expression:string) {\r\n super(expression);\r\n }\r\n\r\n displayName(): string {\r\n return \"必填项\";\r\n }\r\n\r\n isMatch(expression: string): boolean {\r\n return (expression === this.name());\r\n }\r\n\r\n toString(): string {\r\n return this.name();\r\n }\r\n\r\n properties(): ValidatorProperty[] {\r\n return [];\r\n }\r\n\r\n name(): string {\r\n return \"required\";\r\n }\r\n\r\n\r\n\r\n validate(value: any): string {\r\n if(typeof value === 'undefined' || value === null){\r\n return '必填';\r\n }\r\n\r\n if(typeof value === 'number'){\r\n return '';\r\n }\r\n\r\n if(typeof value === 'string' && !value.length){\r\n return '必填';\r\n }\r\n\r\n if(Array.isArray(value) && value.length === 0){\r\n return '必选'\r\n }\r\n\r\n\r\n return '';\r\n }\r\n\r\n\r\n\r\n}\r\n","import {\r\n CustomFormDataSourceType,\r\n CustomFormFieldCreateOrUpdateDto, CustomFormFieldDto,\r\n CustomFormLayoutDetailCreateOrUpdateDto,\r\n SelectListItem\r\n} from \"@/api/appService\";\r\nimport api from \"@/api\";\r\nimport axiosInstance from \"@/utils/request\";\r\nimport {IValidate} from \"@/components/CustomForm/Validators/IValidate\";\r\nimport EmailValidator from \"@/components/CustomForm/Validators/implements/EmailValidator\";\r\nimport MaxLengthValidator from \"@/components/CustomForm/Validators/implements/MaxLengthValidator\";\r\nimport MaxValueValidator from \"@/components/CustomForm/Validators/implements/MaxValueValidator\";\r\nimport MinLengthValidator from \"@/components/CustomForm/Validators/implements/MinLengthValidator\";\r\nimport MinValueValidator from \"@/components/CustomForm/Validators/implements/MinValueValidator\";\r\nimport MobilePhoneValidator from \"@/components/CustomForm/Validators/implements/MobilePhoneValidator\";\r\nimport NumberValidator from \"@/components/CustomForm/Validators/implements/NumberValidator\";\r\nimport RequiredValidator from \"@/components/CustomForm/Validators/implements/RequiredValidator\";\r\n\r\nexport interface ILayoutItem {\r\n data: CustomFormLayoutDetailCreateOrUpdateDto;\r\n formControl?: CustomFormFieldCreateOrUpdateDto;\r\n children?: ILayoutItem[];\r\n}\r\n\r\n\r\n\r\n\r\n\r\nexport function resolveSelectOptions(control:CustomFormFieldCreateOrUpdateDto):Promise{\r\n return new Promise((resolve,reject)=>{\r\n if(control.dataSource!.dataSourceType === CustomFormDataSourceType.CustomValues){\r\n const result = control.chooseValues!.map(value=>{\r\n return {text:value.displayName,value:value.id} as SelectListItem;\r\n });\r\n resolve(result);\r\n } else if(control.dataSource!.dataSourceType === CustomFormDataSourceType.DataDictionary){\r\n if(control.dataSource!.dataSource){\r\n api.dataDictionary.getDataDictionaryListByKey({key:control.dataSource!.dataSource}).then(res=>{\r\n const result = res.items!.map(dictionary=>{return {text:dictionary.displayName,value:dictionary.id} as SelectListItem});\r\n resolve(result);\r\n });\r\n } else {\r\n resolve([]);\r\n }\r\n } else if (control.dataSource!.dataSourceType === CustomFormDataSourceType.Enum){\r\n if(control.dataSource!.dataSource){\r\n api.enumService.getValues({typeName:control.dataSource!.dataSource}).then(res=>{\r\n const result = res.map(enumValue=>{return {text:enumValue.text,value:enumValue.value} as SelectListItem});\r\n resolve(result);\r\n });\r\n } else {\r\n resolve([]);\r\n }\r\n\r\n }\r\n // else if(control.dataSource!.dataSourceType === CustomFormDataSourceType.Api){\r\n // if(control.dataSource!.dataSource!.startsWith('/')){\r\n // axiosInstance.get(control.dataSource!.dataSource!).then(res=>{\r\n // let result = res as any;\r\n // let items = [];\r\n // if(result.hasOwnProperty('items')){\r\n // items = result.items;\r\n // } else {\r\n // items = result.items;\r\n // }\r\n // const bindValue = control.dataSource!.bindValue!;\r\n // const bindDisplayName = control.dataSource!.bindDisplayName!;\r\n // const list = items?.map((item:any)=>{return {value:item[bindValue],text:item[bindDisplayName]} as SelectListItem});\r\n // resolve(list);\r\n // });\r\n // }\r\n // else {\r\n // resolve([]);\r\n // }\r\n // }\r\n\r\n\r\n });\r\n}\r\n\r\nexport function createValidator(expression:string):IValidate{\r\n let validator:IValidate ;\r\n\r\n if(expression.startsWith('email')){\r\n validator = new EmailValidator(expression);\r\n } else if(expression.startsWith('maxLength')){\r\n validator = new MaxLengthValidator(expression);\r\n } else if(expression.startsWith('maxValue')){\r\n validator = new MaxValueValidator(expression);\r\n } else if(expression.startsWith('minLength')){\r\n validator = new MinLengthValidator(expression);\r\n } else if(expression.startsWith('minValue')){\r\n validator = new MinValueValidator(expression);\r\n } else if(expression.startsWith('mobilePhone')){\r\n validator = new MobilePhoneValidator(expression);\r\n } else if(expression.startsWith('number')){\r\n validator = new NumberValidator(expression);\r\n } else if(expression.startsWith('required')){\r\n validator = new RequiredValidator(expression);\r\n } else {\r\n throw new Error(`没有设置${expression}的验证器`)\r\n }\r\n\r\n return validator;\r\n}\r\n\r\nexport function fieldNameTryAsCamelCase(field:CustomFormFieldDto | CustomFormFieldCreateOrUpdateDto){\r\n let result:string;\r\n if(field.isDynamic){\r\n result = field.fieldName!;\r\n } else {\r\n result = field.fieldName!.substr(0,1).toLowerCase() + field.fieldName!.substr(1);\r\n }\r\n return result;\r\n}\r\n"],"sourceRoot":""}