@farris/ui-vue
Version:
Farris Vue, a Farris Design based Vue3 component library.
2 lines (1 loc) • 5 kB
JavaScript
(function(t,a){typeof exports=="object"&&typeof module<"u"?a(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"],a):(t=typeof globalThis<"u"?globalThis:t||self,a(t.checkbox={},t.dynamicResolver,t.common,t.FCheckbox,t.Vue,t.designerCanvas,t.propertyPanel))})(this,function(t,a,u,f,i,x,v){"use strict";class k extends v.InputBaseProperty{constructor(e,o){super(e,o)}getEditorProperties(e){return this.getComponentConfig(e,{type:"check-box"},{placeholder:{visible:!1},disabled:{visible:!1},label:{description:"",title:"名称",type:"string"},trueValue:{description:"选中的值",title:"选中的值",type:this.getBindingDataType(e),visible:this.showCustomValue(e),refreshPanelAfterChanged:!0,editor:this.getEditor(e),$converter:this.getBooleanValueConverter()},falseValue:{description:"未选中的值",title:"未选中的值",type:this.getBindingDataType(e),visible:this.showCustomValue(e),refreshPanelAfterChanged:!0,editor:this.getEditor(e),$converter:this.getBooleanValueConverter()}})}changeBindingField(e,o,c){var d;super.changeBindingField(e,o);const s=c;if(e.editor&&((d=s==null?void 0:s.type)!=null&&d.name)){let r,l;s.type.name===u.FormSchemaEntityFieldTypeName.String&&(r="true",l="false"),s.type.name===u.FormSchemaEntityFieldTypeName.Number&&(r=1,l=0),!Object.prototype.hasOwnProperty.call(e.editor,"trueValue")&&r!==void 0&&(e.editor.trueValue=r),!Object.prototype.hasOwnProperty.call(e.editor,"falseValue")&&l!==void 0&&(e.editor.falseValue=l)}}}function C(n,e){const o=n.schema;function c(s,d){return new k(s,e).getPropertyConfig(o,d)}return{getPropsConfig:c}}const j={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:j,emits:[],setup(n,e){const o=i.ref(),c=i.ref(n.id),s=i.ref(n.indeterminate),d=i.inject("designer-host-service"),r=i.inject("design-item-context"),l=C(r,d),b=x.useDesignerComponent(o,r,l);return i.onMounted(()=>{o.value.componentInstance=b}),i.watch(()=>n.indeterminate,B=>{s.value=B}),e.expose(b.value),()=>i.createVNode("div",{ref:o,dragref:`${r.schema.id}-container`,class:"drag-container custom-control custom-checkbox"},[i.createVNode("input",{type:"checkbox",class:"custom-control-input",id:c,value:n.value,checked:!1,readonly:!0},null),i.createVNode("div",{class:"custom-control-label"},[n.label])])}}),h={$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},onChange:{description:"",type:"string"}},required:["type"],ignore:["id","appearance","binding","visible"]},g=new Map([["appearance",a.resolveAppearance]]);function y(n,e,o){return e}const V=a.createPropsResolver(f.checkboxProps,h,g,y),m=a.getPropsResolverGenerator(f.checkboxProps,h,g,y);p.register=(n,e,o,c,s)=>{n["check-box"]=f,e["check-box"]=m(s)},p.registerDesigner=(n,e,o,c)=>{n["check-box"]=p,e["check-box"]=m(c)};const P=u.withInstall(p);t.FCheckboxDesigner=p,t.checkBoxPropsResolver=V,t.default=P,t.propsResolverGenerator=m,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});