

<script>
/* eslint-disable */
// sd-skip-auto-import
import{getUserInfo}from"@/common/store-mixin";import axios from"@/common/services/axios-instance";import moment from"moment";import components from"./_import-components/sd-text-import";export const metaInfo={caption:"文本框",component:"a-input",icon:"italic",order:100,category:"basic"};export const fieldProps={dataType:"string",attr:{regexMessage:"格式有误"}};export function updateOnPreview(e){e.attr.defaultValue=e.attr?.defaultValue?.replace(/\${CREATOR_NAME}/g,getUserInfo().name)?.replace(/\${CREATION_TIME}/g,moment().format("YYYY-MM-DD"))}var _render=function e(){var t=this,n=t._self._c;return n("div",[!t.component.readonly?n("a-form-model-item",{attrs:{label:"格式校验"}},[n("a-select",{attrs:{"allow-clear":"",options:t.regexes},on:{change:e=>{t.component.attr.regexMessage=e?`请输入正确的 ${t.regexes.find((t=>t.value===e)).label} 格式`:"";t.component.attr.regex=e?t.regexes.find((t=>t.value===e)).regex:""}},model:{value:t.component.attr.regexId,callback:function(e){t.$set(t.component.attr,"regexId",e)},expression:"component.attr.regexId"}})],1):t._e(),!t.noDefaultValue?n("a-form-model-item",{attrs:{label:"默认值"}},["title"===t.component.dataType?n("sd-default-value",{model:{value:t.component.attr.defaultValue,callback:function(e){t.$set(t.component.attr,"defaultValue",e)},expression:"component.attr.defaultValue"}}):n("a-input",{model:{value:t.component.attr.defaultValue,callback:function(e){t.$set(t.component.attr,"defaultValue",e)},expression:"component.attr.defaultValue"}})],1):t._e(),![2,3].includes(t.formProps.attrFD.type)?n("a-form-model-item",[n("sd-ugly-checkbox",{attrs:{slot:"label"},slot:"label",model:{value:t.component.attr.unique,callback:function(e){t.$set(t.component.attr,"unique",e)},expression:"component.attr.unique"}},[t._v("唯一校验")])],1):t._e(),!t.component.readonly?n("a-form-model-item",{attrs:{label:"字符长度范围"}},[n("sd-range-input",{attrs:{max:t.component.attr.maxLength,min:t.component.attr.minLength,"disable-negative":"","max-max":2e3},on:{"update:max":function(e){return t.$set(t.component.attr,"maxLength",e)},"update:min":function(e){return t.$set(t.component.attr,"minLength",e)}}})],1):t._e(),n("sd-placeholder-editor",{attrs:{component:t.component}})],1)};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdText",components:components,data(){return{regexes:[]}},created(){axios.get("api/framework/v1/str-valid-rule/builder/selector").then((e=>{this.regexes=e.data.map((e=>({value:e.id+"",label:e.regexName,regex:e.regex})))}))},methods:{},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
