UNPKG

@farris/ui-vue

Version:

Farris Vue, a Farris Design based Vue3 component library.

2 lines (1 loc) 4.97 kB
(function(n,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("../../components/dynamic-resolver/index.umd.js"),require("../../components/common/index.umd.js"),require("../../components/checkbox/index.umd.js"),require("vue"),require("../../components/designer-canvas/index.umd.js"),require("../../components/property-panel/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","../../components/dynamic-resolver/index.umd.js","../../components/common/index.umd.js","../../components/checkbox/index.umd.js","vue","../../components/designer-canvas/index.umd.js","../../components/property-panel/index.umd.js"],c):(n=typeof globalThis<"u"?globalThis:n||self,c(n.checkbox={},n.dynamicResolver,n.common,n.FCheckbox,n.Vue,n.designerCanvas,n.propertyPanel))})(this,function(n,c,u,m,i,y,g){"use strict";class b extends g.InputBaseProperty{constructor(e,t){super(e,t)}getEditorProperties(e){var t,s;return this.getComponentConfig(e,{type:"check-box"},{placeholder:{visible:!1},disabled:{visible:!1},label:{description:"",title:"名称",type:"string"},trueValue:{description:"选中的值",title:"选中的值",type:this.getBindingDataType(),visible:((t=this.designViewModelField)==null?void 0:t.type.name)!=="Boolean",refreshPanelAfterChanged:!0,editor:this.getEditor(),$converter:this.getBooleanValueConverter()},falseValue:{description:"未选中的值",title:"未选中的值",type:this.getBindingDataType(),visible:((s=this.designViewModelField)==null?void 0:s.type.name)!=="Boolean",refreshPanelAfterChanged:!0,editor:this.getEditor(),$converter:this.getBooleanValueConverter()}})}changeBindingField(e,t,s){var d;super.changeBindingField(e,t);const r=s;if(e.editor&&((d=r==null?void 0:r.type)!=null&&d.name)){let a,l;r.type.name===u.FormSchemaEntityFieldTypeName.String&&(a="true",l="false"),r.type.name===u.FormSchemaEntityFieldTypeName.Number&&(a=1,l=0),!Object.prototype.hasOwnProperty.call(e.editor,"trueValue")&&a!==void 0&&(e.editor.trueValue=a),!Object.prototype.hasOwnProperty.call(e.editor,"falseValue")&&l!==void 0&&(e.editor.falseValue=l)}}}function x(o,e){const t=o.schema;function s(r,d){return new b(r,e).getPropertyConfig(t,d)}return{getPropsConfig:s}}const v={id:{Type:String,default:""},customClass:{Type:String,default:""},disabled:{Type:Boolean,default:!1},readonly:{type:Boolean,default:!1},indeterminate:{Type:Boolean,default:!1},modelValue:{Type:Boolean,default:!1},focusOnCreated:{type:Boolean,default:!1},value:{type:String,default:""},name:{type:String,default:""},checked:{type:Boolean,default:!1},label:{type:String,default:""},trueValue:{type:[String,Number,Boolean],default:!0},falseValue:{type:[String,Number,Boolean],default:!1}},p=i.defineComponent({name:"FCheckBoxDesign",props:v,emits:[],setup(o,e){const t=i.ref(),s=i.ref(o.id),r=i.ref(o.indeterminate),d=i.inject("designer-host-service"),a=i.inject("design-item-context"),l=x(a,d),h=y.useDesignerComponent(t,a,l);return i.onMounted(()=>{t.value.componentInstance=h}),i.watch(()=>o.indeterminate,V=>{r.value=V}),e.expose(h.value),()=>i.createVNode("div",{ref:t,dragref:`${a.schema.id}-container`,class:"drag-container custom-control custom-checkbox"},[i.createVNode("input",{type:"checkbox",class:"custom-control-input",id:s,value:o.value,checked:!1,readonly:!0},null),i.createVNode("div",{class:"custom-control-label"},[o.label])])}}),k={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/check-box.schema.json",title:"check-box",description:"A Farris Input Component",type:"object",properties:{id:{description:"The unique identifier for a check box",type:"string"},type:{description:"The type string of check box component",type:"string",default:"check-box"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{type:"string",default:!1},editable:{description:"",type:"boolean",default:!0},placeholder:{description:"",type:"string",default:""},text:{description:"",type:"string",default:""},value:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0},required:{description:"",type:"boolean",default:!1},label:{description:"",type:"string",default:""},trueValue:{description:"",type:"boolean",default:!0},falseValue:{description:"",type:"boolean",default:!1}},required:["type"],ignore:["id","appearance","binding","visible"]},j=new Map([["appearance",c.resolveAppearance]]);function B(o,e,t){return e}const f=c.createPropsResolver(m.checkboxProps,k,j,B);p.register=(o,e,t,s)=>{o["check-box"]=m,e["check-box"]=f},p.registerDesigner=(o,e,t)=>{o["check-box"]=p,e["check-box"]=f};const C=u.withInstall(p);n.FCheckboxDesigner=p,n.checkBoxPropsResolver=f,n.default=C,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});