@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.19 kB
JavaScript
import{copy as e}from"../../../../i18n/copy.mjs";import t from"../../utils/zod-safe-parse.mjs";import n from"../../custom-field.mjs";import r from"../../utils/key-to-title.mjs";import{numberFieldConfig as i}from"./config.mjs";import a from"zod";var o=class extends n{type=i.type;config;key;props;constructor(t,n){super(),this.key=t,this.props=n,this.config={key:this.key,type:this.type,details:{label:this.props?.details?.label??e(`admin:fields.${this.type}.${this.key}.label`,{defaultMessage:r(this.key)}),summary:this.props?.details?.summary,placeholder:this.props?.details?.placeholder},localized:this.props?.localized??!1,default:this.props?.default,index:this.props?.index,ui:{hidden:this.props?.ui?.hidden,disabled:this.props?.ui?.disabled,condition:this.props?.ui?.condition,width:this.props?.ui?.width},validation:this.props?.validation}}getSchemaDefinition(e){return{data:{columns:[{name:this.key,type:e.db.getDataType(`integer`),nullable:!0,default:this.config.default}]},error:void 0}}formatResponseValue(e){return e??this.config.default??null}uniqueValidation(e){let n=t(e,a.number());return n.valid?{valid:!0}:n}};export{o as default};
//# sourceMappingURL=custom-field.mjs.map