@farris/ui-vue 1.3.4 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/index.esm.js +16 -16
- package/components/accordion/index.umd.cjs +1 -1
- package/components/avatar/index.esm.js +65 -65
- package/components/avatar/index.umd.cjs +1 -1
- package/components/button-edit/index.esm.js +13 -13
- package/components/button-edit/index.umd.cjs +1 -1
- package/components/calendar/index.esm.js +504 -490
- package/components/calendar/index.umd.cjs +1 -1
- package/components/capsule/index.esm.js +247 -233
- package/components/capsule/index.umd.cjs +1 -1
- package/components/checkbox/index.esm.js +356 -344
- package/components/checkbox/index.umd.cjs +1 -1
- package/components/color-picker/index.esm.js +159 -145
- package/components/color-picker/index.umd.cjs +2 -2
- package/components/combo-list/index.esm.js +127 -128
- package/components/combo-list/index.umd.cjs +1 -1
- package/components/combo-tree/index.esm.js +15 -15
- package/components/combo-tree/index.umd.cjs +1 -1
- package/components/component/index.esm.js +101 -87
- package/components/component/index.umd.cjs +1 -1
- package/components/condition/index.esm.js +9 -7
- package/components/condition/index.umd.cjs +1 -1
- package/components/content-container/index.esm.js +181 -167
- package/components/content-container/index.umd.cjs +1 -1
- package/components/data-grid/index.esm.js +746 -730
- package/components/data-grid/index.umd.cjs +1 -1
- package/components/data-view/index.esm.js +9 -7
- package/components/data-view/index.umd.cjs +1 -1
- package/components/date-picker/index.esm.js +789 -777
- package/components/date-picker/index.umd.cjs +1 -1
- package/components/designer-canvas/index.esm.js +3096 -3069
- package/components/designer-canvas/index.umd.cjs +1 -1
- package/components/dropdown/index.esm.js +257 -243
- package/components/dropdown/index.umd.cjs +2 -2
- package/components/dynamic-form/index.esm.js +322 -306
- package/components/dynamic-form/index.umd.cjs +1 -1
- package/components/dynamic-resolver/index.esm.js +177 -163
- package/components/dynamic-resolver/index.umd.cjs +1 -1
- package/components/event-parameter/index.esm.js +78 -82
- package/components/event-parameter/index.umd.cjs +1 -1
- package/components/events-editor/index.esm.js +501 -487
- package/components/events-editor/index.umd.cjs +1 -1
- package/components/expression-editor/index.esm.js +37 -37
- package/components/expression-editor/index.umd.cjs +1 -1
- package/components/external-container/index.esm.js +487 -472
- package/components/external-container/index.umd.cjs +1 -1
- package/components/field-selector/index.esm.js +440 -433
- package/components/field-selector/index.umd.cjs +1 -1
- package/components/filter-bar/index.esm.js +594 -587
- package/components/filter-bar/index.umd.cjs +1 -1
- package/components/flow-canvas/index.esm.js +2766 -2739
- package/components/flow-canvas/index.umd.cjs +1 -1
- package/components/image-cropper/index.esm.js +402 -388
- package/components/image-cropper/index.umd.cjs +1 -1
- package/components/input-group/index.esm.js +201 -202
- package/components/input-group/index.umd.cjs +1 -1
- package/components/layout/index.esm.js +264 -245
- package/components/layout/index.umd.cjs +1 -1
- package/components/list-nav/index.esm.js +157 -143
- package/components/list-nav/index.umd.cjs +1 -1
- package/components/list-view/index.esm.js +314 -298
- package/components/list-view/index.umd.cjs +1 -1
- package/components/lookup/index.esm.js +862 -843
- package/components/lookup/index.umd.cjs +1 -1
- package/components/mapping-editor/index.esm.js +1031 -1015
- package/components/mapping-editor/index.umd.cjs +1 -1
- package/components/nav/index.esm.js +169 -155
- package/components/nav/index.umd.cjs +2 -2
- package/components/number-range/index.esm.js +150 -137
- package/components/number-range/index.umd.cjs +1 -1
- package/components/number-spinner/index.esm.js +207 -194
- package/components/number-spinner/index.umd.cjs +1 -1
- package/components/order/index.esm.js +427 -414
- package/components/order/index.umd.cjs +1 -1
- package/components/page-footer/index.esm.js +22 -22
- package/components/page-footer/index.umd.cjs +1 -1
- package/components/page-header/index.esm.js +510 -492
- package/components/page-header/index.umd.cjs +1 -1
- package/components/pagination/index.esm.js +192 -178
- package/components/pagination/index.umd.cjs +1 -1
- package/components/progress/index.esm.js +234 -220
- package/components/progress/index.umd.cjs +3 -3
- package/components/property-editor/index.esm.js +288 -277
- package/components/property-editor/index.umd.cjs +2 -2
- package/components/property-panel/index.esm.js +62 -61
- package/components/property-panel/index.umd.cjs +1 -1
- package/components/query-solution/index.esm.js +776 -770
- package/components/query-solution/index.umd.cjs +6 -6
- package/components/radio-button/index.esm.js +64 -64
- package/components/radio-button/index.umd.cjs +1 -1
- package/components/radio-group/index.esm.js +296 -283
- package/components/radio-group/index.umd.cjs +1 -1
- package/components/rate/index.esm.js +222 -208
- package/components/rate/index.umd.cjs +1 -1
- package/components/response-layout/index.esm.js +187 -173
- package/components/response-layout/index.umd.cjs +1 -1
- package/components/response-layout-editor/index.esm.js +554 -542
- package/components/response-layout-editor/index.umd.cjs +1 -1
- package/components/response-toolbar/index.esm.js +483 -469
- package/components/response-toolbar/index.umd.cjs +1 -1
- package/components/schema-selector/index.esm.js +634 -619
- package/components/schema-selector/index.umd.cjs +2 -2
- package/components/search-box/index.esm.js +228 -214
- package/components/search-box/index.umd.cjs +1 -1
- package/components/section/index.esm.js +419 -406
- package/components/section/index.umd.cjs +1 -1
- package/components/smoke-detector/index.esm.js +162 -148
- package/components/smoke-detector/index.umd.cjs +1 -1
- package/components/splitter/index.esm.js +308 -284
- package/components/splitter/index.umd.cjs +1 -1
- package/components/step/index.esm.js +279 -265
- package/components/step/index.umd.cjs +1 -1
- package/components/switch/index.esm.js +183 -170
- package/components/switch/index.umd.cjs +1 -1
- package/components/tabs/index.esm.js +307 -294
- package/components/tabs/index.umd.cjs +1 -1
- package/components/tags/index.esm.js +320 -306
- package/components/tags/index.umd.cjs +1 -1
- package/components/text/index.esm.js +245 -231
- package/components/text/index.umd.cjs +1 -1
- package/components/textarea/index.esm.js +260 -247
- package/components/textarea/index.umd.cjs +1 -1
- package/components/time-picker/index.esm.js +409 -396
- package/components/time-picker/index.umd.cjs +1 -1
- package/components/transfer/index.esm.js +424 -410
- package/components/transfer/index.umd.cjs +1 -1
- package/components/tree-grid/index.esm.js +383 -376
- package/components/tree-grid/index.umd.cjs +1 -1
- package/components/tree-view/index.esm.js +595 -575
- package/components/tree-view/index.umd.cjs +1 -1
- package/components/uploader/index.esm.js +325 -311
- package/components/uploader/index.umd.cjs +2 -2
- package/components/verify-detail/index.esm.js +304 -290
- package/components/verify-detail/index.umd.cjs +1 -1
- package/components/video/index.esm.js +99 -85
- package/components/video/index.umd.cjs +1 -1
- package/components/weather/index.esm.js +947 -933
- package/components/weather/index.umd.cjs +4 -4
- package/farris.all.esm.js +5492 -5470
- package/farris.all.umd.cjs +13 -13
- package/index.css +1 -1
- package/package.json +1 -1
- package/types/condition/src/composition/condition-value/input-group-value.d.ts +1 -1
- package/types/entity-binding-selector/composition/use-entity-tree.d.ts +3 -0
- package/types/entity-binding-selector/composition/use-field-tree.d.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(M,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue"),require("lodash-es"),require("../designer-canvas/index.umd.js"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","../designer-canvas/index.umd.js","../common/index.umd.js"],m):(M=typeof globalThis<"u"?globalThis:M||self,m(M.switch={},M.Vue,M.LodashES,M.designerCanvas,M.common))})(this,function(M,m,E,$,O){"use strict";var pe=Object.defineProperty;var de=(M,m,E)=>m in M?pe(M,m,{enumerable:!0,configurable:!0,writable:!0,value:E}):M[m]=E;var v=(M,m,E)=>de(M,typeof m!="symbol"?m+"":m,E);const j={},q={};function N(c){const{properties:t,title:e,ignore:i}=c,n=i&&Array.isArray(i),r=Object.keys(t).reduce((s,y)=>((!n||!i.find(h=>h===y))&&(s[y]=t[y].type==="object"&&t[y].properties?N(t[y]):E.cloneDeep(t[y].default)),s),{});if(e&&(!n||!i.find(s=>s==="id"))){const s=e.toLowerCase().replace(/-/g,"_");r.id=`${s}_${Math.random().toString().slice(2,6)}`}return r}function G(c,t={},e){const i=j[c];if(i){let n=N(i);const r=q[c];return n=r?r({getSchemaByType:G},n,t,e):n,n}return null}function W(c,t){const e=N(t);return Object.keys(e).reduce((i,n)=>(i[n]&&E.isPlainObject(i[n])&&E.isPlainObject(c[n]||!c[n])?Object.assign(i[n],c[n]||{}):i[n]=c[n],i),e),e}function z(c,t){return Object.keys(c).filter(i=>c[i]!=null).reduce((i,n)=>{if(t.has(n)){const r=t.get(n);if(typeof r=="string")i[r]=c[n];else{const s=r(n,c[n],c);Object.assign(i,s)}}else i[n]=c[n];return i},{})}function X(c,t,e=new Map){const i=W(c,t);return z(i,e)}function _(c={}){function t(a,l,o,d){if(typeof o=="number")return d[a].length===o;if(typeof o=="object"){const f=Object.keys(o)[0],u=o[f];if(f==="not")return Number(d[a].length)!==Number(u);if(f==="moreThan")return Number(d[a].length)>=Number(u);if(f==="lessThan")return Number(d[a].length)<=Number(u)}return!1}function e(a,l,o,d){return d[a]&&d[a].propertyValue&&String(d[a].propertyValue.value)===String(o)}const i=new Map([["length",t],["getProperty",e]]);Object.keys(c).reduce((a,l)=>(a.set(l,c[l]),a),i);function n(a,l){const o=a;return typeof l=="number"?[{target:o,operator:"length",param:null,value:Number(l)}]:typeof l=="boolean"?[{target:o,operator:"getProperty",param:a,value:!!l}]:typeof l=="object"?Object.keys(l).map(d=>{if(d==="length")return{target:o,operator:"length",param:null,value:l[d]};const f=d,u=l[d];return{target:o,operator:"getProperty",param:f,value:u}}):[]}function r(a){return Object.keys(a).reduce((o,d)=>{const f=n(d,a[d]);return o.push(...f),o},[])}function s(a,l){if(i.has(a.operator)){const o=i.get(a.operator);return o&&o(a.target,a.param,a.value,l)||!1}return!1}function y(a,l){return r(a).reduce((f,u)=>f&&s(u,l),!0)}function h(a,l){const o=Object.keys(a),d=o.includes("allOf"),f=o.includes("anyOf"),u=d||f,C=(u?a[u?d?"allOf":"anyOf":"allOf"]:[a]).map(P=>y(P,l));return d?!C.includes(!1):C.includes(!0)}return{parseValueSchema:h}}const p={button:{type:"button",name:"按钮",icon:"Button"},"response-toolbar":{type:"response-toolbar",name:"工具栏",icon:"ButtonGroup"},"response-toolbar-item":{type:"response-toolbar-item",name:"按钮",icon:"Button"},"content-container":{type:"content-container",name:"容器",icon:"ContentContainer"},"input-group":{type:"input-group",name:"文本",icon:"TextBox"},textarea:{type:"textarea",name:"多行文本",icon:"MultiTextBox"},lookup:{type:"lookup",name:"帮助",icon:"LookupEdit"},"number-spinner":{type:"number-spinner",name:"数值",icon:"NumericBox"},"date-picker":{type:"date-picker",name:"日期",icon:"DateBox"},switch:{type:"switch",name:"开关",icon:"SwitchField"},"radio-group":{type:"radio-group",name:"单选组",icon:"RadioGroup"},"check-box":{type:"check-box",name:"复选框",icon:"CheckBox"},"check-group":{type:"check-group",name:"复选框组",icon:"CheckGroup"},"combo-list":{type:"combo-list",name:"下拉列表",icon:"EnumField"},"response-form":{type:"response-form",name:"卡片面板",icon:"Form"},"response-layout":{type:"response-layout",name:"布局容器",icon:"ResponseLayout3"},"response-layout-item":{type:"response-layout-item",name:"布局",icon:"ResponseLayout1"},"tree-grid":{type:"tree-grid",name:"树表格",icon:"TreeGrid"},"tree-grid-column":{type:"tree-grid-column",name:"树表格列"},"data-grid":{type:"data-grid",name:"表格",icon:"DataGrid"},"data-grid-column":{type:"data-grid-column",name:"表格列"},module:{type:"Module",name:"模块",icon:"Module"},component:{type:"component",name:"组件",icon:"Component"},tabs:{type:"tabs",name:"标签页",icon:"Tab"},"tab-page":{type:"tab-page",name:"标签页项",dependentParentControl:"Tab"},"tab-toolbar-item":{type:"tab-toolbar-item",name:"标签页工具栏按钮",icon:"Button"},"time-picker":{type:"time-picker",name:"时间选择",icon:"TimePicker"},section:{type:"section",name:"分组面板",icon:"Section"},"section-toolbar":{type:"section-toolbar",name:"分组面板工具栏"},"section-toolbar-item":{type:"section-toolbar-item",name:"分组面板按钮"},splitter:{type:"splitter",name:"分栏面板",icon:"Splitter"},"splitter-pane":{type:"splitter-pane",name:"分栏面板项",dependentParentControl:"Splitter"},"component-ref":{type:"component-ref",name:"组件引用节点"},uploader:{type:"uploader",name:"附件上传",icon:"FileUpload"},"page-header":{type:"page-header",name:"页头",icon:"Header"},"page-footer":{type:"page-footer",name:"页脚",icon:"ModalFooter"},"tab-toolbar":{type:"tab-toolbar",name:"标签页工具栏",icon:"TabToolbar"},fieldset:{type:"fieldset",name:"分组",icon:"fieldset"},"query-solution":{type:"query-solution",name:"筛选方案",icon:"QueryScheme"}},Q={},H={};_();function J(c,t,e=new Map,i=(s,y,h,a)=>y,n={},r=s=>s){return j[t.title]=t,q[t.title]=i,Q[t.title]=n,H[t.title]=r,(s={})=>{const y=X(s,t,e),h=Object.keys(c).reduce((a,l)=>(a[l]=c[l].default,a),{});return Object.assign(h,y)}}function Y(c,t){return{customClass:t.class,customStyle:t.style}}const Z=new Map([["appearance",Y]]),K={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/switch.schema.json",title:"switch",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for a switch",type:"string"},type:{description:"The type string of switch component",type:"string",default:"switch"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{type:"boolean",default:!1},onBackground:{description:"",type:"string",default:""},offBackground:{description:"",type:"string",default:""},onColor:{description:"",type:"string",default:""},offColor:{description:"",type:"string",default:""},onLabel:{description:"",type:"string",default:""},offLabel:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},size:{description:"",type:"enum",default:"medium"}},required:["id","type"],ignore:["id","appearance","binding"]};function R(c,t,e){return t}const D={modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},onBackground:{type:String},offBackground:{type:String},onColor:{type:String},offColor:{type:String},onLabel:{type:String},offLabel:{type:String},size:{type:String,default:"medium"},onModelValueChanged:{type:Function,default:()=>{}}},A=J(D,K,Z,R),I=m.defineComponent({name:"FSwitch",props:D,emits:["update:modelValue","modelValueChanged"],setup(c,t){const{disabled:e,size:i,onLabel:n,offLabel:r,onBackground:s,offBackground:y,onColor:h,offColor:a,readonly:l}=m.toRefs(c),o=m.ref(c.modelValue),d=m.computed(()=>({switch:!0,"f-cmp-switch":!0,checked:o.value,disabled:l.value||e.value,"switch-large":i.value==="large","switch-medium":i.value==="medium","switch-small":i.value==="small"})),f=m.computed(()=>o.value?{outline:"none",background:s.value}:{outline:"none",backgroundColor:y.value}),u=m.computed(()=>o.value?{background:h.value}:{backgroundColor:a.value}),g=m.computed(()=>(n==null?void 0:n.value)||(r==null?void 0:r.value));function k(){l.value||e.value||(o.value=!o.value,t.emit("update:modelValue",o.value))}return m.watch(o,(C,w)=>{C!==w&&t.emit("modelValueChanged",C)}),m.watch(()=>c.modelValue,(C,w)=>{C!==w&&(o.value=C)}),()=>m.createVNode("span",{tabindex:"0",role:"button",class:d.value,style:f.value,onClick:k},[g.value&&m.createVNode("span",{class:"switch-pane"},[m.createVNode("span",{class:"switch-label-checked"},[n==null?void 0:n.value]),m.createVNode("span",{class:"switch-label-unchecked"},[r==null?void 0:r.value])]),m.createVNode("small",{style:u.value},[t.slots.default&&t.slots.default()])])}});function x(c,t,e){var V;const i=e&&e.getStyles&&e.getStyles()||"",n=e&&e.getDesignerClass&&e.getDesignerClass()||"",r=m.ref();function s(){return(t==null?void 0:t.schema.componentType)==="frame"?!1:e&&e.checkCanMoveComponent?e.checkCanMoveComponent():!0}function y(){return!1}function h(){return(t==null?void 0:t.schema.componentType)==="frame"?!1:e&&e.checkCanDeleteComponent?e.checkCanDeleteComponent():!0}function a(){return(t==null?void 0:t.schema.componentType)==="frame"?!0:e&&e.hideNestedPaddingInDesginerView?e.hideNestedPaddingInDesginerView():!1}function l(b){if(!b||!b.value)return null;if(b.value.schema&&b.value.schema.type==="component")return b.value;const S=m.ref(b==null?void 0:b.value.parent),F=l(S);return F||null}function o(b=t){const{componentInstance:S,designerItemElementRef:F}=b;return!S||!S.value?null:S.value.canMove?F:o(b.parent)}function d(b){return!!e&&e.canAccepts(b)}function f(){return(t==null?void 0:t.schema.label)||(t==null?void 0:t.schema.title)||(t==null?void 0:t.schema.name)}function u(){}function g(b,S){S&&e!=null&&e.onAcceptMovedChildElement&&e.onAcceptMovedChildElement(S)}function k(b,S){const{componentType:F}=b;let T=G(F,b,S);e&&e.onResolveNewComponentSchema&&(T=e.onResolveNewComponentSchema(b,T));const U=F.toLowerCase().replace(/-/g,"_");return T&&!T.id&&T.type===F&&(T.id=`${U}_${Math.random().toString().slice(2,6)}`),T}function C(b){}function w(...b){if(e&&e.getPropsConfig)return e.getPropsConfig(...b)}function P(){e&&e.onRemoveComponent&&e.onRemoveComponent(),t!=null&&t.schema.contents&&t.schema.contents.map(b=>{var T;let S=b.id;b.type==="component-ref"&&(S=b.component);const F=c.value.querySelector(`#${S}-design-item`);(T=F==null?void 0:F.componentInstance)!=null&&T.value.onRemoveComponent&&F.componentInstance.value.onRemoveComponent()})}return r.value={canMove:s(),canSelectParent:y(),canDelete:h(),canNested:!a(),contents:t==null?void 0:t.schema.contents,elementRef:c,parent:(V=t==null?void 0:t.parent)==null?void 0:V.componentInstance,schema:t==null?void 0:t.schema,styles:i,designerClass:n,canAccepts:d,getBelongedComponentInstance:l,getDraggableDesignItemElement:o,getDraggingDisplayText:f,getPropConfig:w,getDragScopeElement:u,onAcceptMovedChildElement:g,onChildElementMovedOut:C,addNewChildComponentSchema:k,triggerBelongedComponentToMoveWhenMoved:!!e&&e.triggerBelongedComponentToMoveWhenMoved||m.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:!!e&&e.triggerBelongedComponentToDeleteWhenDeleted||m.ref(!1),onRemoveComponent:P},r}class ee{constructor(t,e){v(this,"componentId");v(this,"viewModelId");v(this,"eventsEditorUtils");v(this,"formSchemaUtils");v(this,"formMetadataConverter");v(this,"designViewModelUtils");v(this,"designViewModelField");v(this,"controlCreatorUtils");v(this,"designerHostService");v(this,"schemaService",null);v(this,"metadataService",null);v(this,"propertyConfig",{type:"object",categories:{}});var i;this.componentId=t,this.designerHostService=e,this.eventsEditorUtils=e.eventsEditorUtils,this.formSchemaUtils=e.formSchemaUtils,this.formMetadataConverter=e.formMetadataConverter,this.viewModelId=((i=this.formSchemaUtils)==null?void 0:i.getViewModelIdByComponentId(t))||"",this.designViewModelUtils=e.designViewModelUtils,this.controlCreatorUtils=e.controlCreatorUtils,this.metadataService=e.metadataService,this.schemaService=e.schemaService}getTableInfo(){var t;return(t=this.schemaService)==null?void 0:t.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(t){var i;const e=t.binding&&t.binding.type==="Form"&&t.binding.field;if(e){if(!this.designViewModelField){const n=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=n.fields.find(r=>r.id===e)}t.updateOn=(i=this.designViewModelField)==null?void 0:i.updateOn}}changeFieldEditorType(t,e){}getBasicPropConfig(t){return{description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"combo-list",textField:"name",valueField:"value",data:[{value:t.type,name:p[t.type].name}]}}}}}getAppearanceConfig(t=null){return{title:"样式",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter"}}}}updateElementByParentContainer(t,e){const i=e&&e.parent&&e.parent.schema;if(!i)return;const n=i.contents.findIndex(s=>s.id===t),r=E.cloneDeep(i.contents[n]);i.contents.splice(n,1),i.contents.splice(n,0,r)}}const B=class B{static getEditorTypesByMDataType(t){const e=B.fieldControlTypeMapping[t];return e||[{key:"",value:""}]}static getAllInputTypes(){const t=[];for(const e in B.fieldControlTypeMapping)B.fieldControlTypeMapping[e].forEach(i=>{t.find(n=>n.key===i.key&&n.value===i.value)||t.push({key:i.key,value:i.value})});return t}};v(B,"fieldControlTypeMapping",{String:[{key:p["input-group"].type,value:p["input-group"].name},{key:p.lookup.type,value:p.lookup.name},{key:p["date-picker"].type,value:p["date-picker"].name},{key:p["check-box"].type,value:p["check-box"].name},{key:p["check-group"].type,value:p["check-group"].name},{key:p["radio-group"].type,value:p["radio-group"].name},{key:p["combo-list"].type,value:p["combo-list"].name},{key:p.textarea.type,value:p.textarea.name}],Text:[{key:p.textarea.type,value:p.textarea.name},{key:p.lookup.type,value:p.lookup.name}],Decimal:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],Integer:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],Number:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],BigNumber:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],Date:[{key:p["date-picker"].type,value:p["date-picker"].name}],DateTime:[{key:p["date-picker"].type,value:p["date-picker"].name}],Boolean:[{key:p.switch.type,value:p.switch.name},{key:p["check-box"].type,value:p["check-box"].name}],Enum:[{key:p["combo-list"].type,value:p["combo-list"].name},{key:p["radio-group"].type,value:p["radio-group"].name}],Object:[{key:p.lookup.type,value:p.lookup.name},{key:p["combo-list"].type,value:p["combo-list"].name},{key:p["radio-group"].type,value:p["radio-group"].name}]});let L=B;const te=m.ref(0);class ne{constructor(){v(this,"label","");v(this,"id","");v(this,"columnInSM",12);v(this,"columnInMD",6);v(this,"columnInLG",3);v(this,"columnInEL",2);v(this,"displayWidthInSM",1);v(this,"displayWidthInMD",1);v(this,"displayWidthInLG",1);v(this,"displayWidthInEL",1);v(this,"displayColumnCountAtBreakPoint","md");v(this,"tagRow",0);v(this,"showTopBorder",0);v(this,"group",1);v(this,"isSupportedClass",!0);v(this,"fieldSetId","")}}function oe(c){let t,e;const i=new Map;let n=[];function r(l,o){const f=l.split(" ").filter(w=>w.startsWith("col-"));if(f.length===0){o.isSupportedClass=!1;return}let u=f.find(w=>/^col-([1-9]|10|11|12)$/.test(w)),g=f.find(w=>/^col-md-([1-9]|10|11|12)$/.test(w)),k=f.find(w=>/^col-xl-([1-9]|10|11|12)$/.test(w)),C=f.find(w=>/^col-el-([1-9]|10|11|12)$/.test(w));u=u||"col-12",o.columnInSM=parseInt(u.replace("col-",""),10),o.displayWidthInSM=o.columnInSM/12,o.displayWidthInSM!==1&&(o.isSupportedClass=!1),g=g||"col-md-"+o.columnInSM,o.columnInMD=parseInt(g.replace("col-md-",""),10),o.displayWidthInMD=o.columnInMD/6,[1,2].includes(o.displayWidthInMD)||(o.isSupportedClass=!1),k=k||"col-xl-"+o.columnInMD,o.columnInLG=parseInt(k.replace("col-xl-",""),10),o.displayWidthInLG=o.columnInLG/3,[1,2,3,4].includes(o.displayWidthInLG)||(o.isSupportedClass=!1),C=C||"col-el-"+o.columnInLG,o.columnInEL=parseInt(C.replace("col-el-",""),10),o.displayWidthInEL=o.columnInEL/2,[1,2,3,4,5,6].includes(o.displayWidthInEL)||(o.isSupportedClass=!1)}function s(l,o,d,f=!1){let u=!1;l.contents.forEach(g=>{if(g.type==="fieldset"){d+=1,s(g,o,d,!0),u=!0;return}u&&(d+=1,u=!1);const k=g.appearance&&g.appearance.class,C=new ne;k?r(k,C):C.isSupportedClass=!1,C.label=g.label||g.id,C.id=g.id,C.group=d,f&&(C.fieldSetId=l.id),e===g.id&&(t=d),i.set(g.id,g),o.push(C)})}function y(l){const o=c.getComponentById(l);if(!o||!o.componentType||!o.componentType.startsWith("form"))return{result:!1,message:"只可以在响应式表单组件中调整响应式布局配置"};const d=c.selectNode(o,f=>f.type===$.DgControl["response-form"].type);return!d||!d.contents||d.contents.length===0?{result:!1,message:"Form区域内没有控件,请先添加控件"}:{result:!0,message:"",formNode:d}}function h(l,o){o=o||l.id;const{result:d,message:f,formNode:u}=y(o);if(!d)return{result:d,message:f};e=l.id,n=[],i.clear();const g=u.contents[0].type===$.DgControl.fieldset.type?0:1;s(u,n,g);const k=n.find(w=>!w.isSupportedClass);return{defaultState:{defaultGroupNumber:t||1,model:k?"customize":"standard"},importData:n}}function a(l,o){o=o;const{result:d,formNode:f}=y(o);if(!d)return"";const u=[];return l.forEach(g=>{var w;const k=i.get(g.id),C=k.appearance&&k.appearance.class;if(C){const V=C.split(" ").filter(ce=>!ce.startsWith("col-")),b="col-"+g.columnInSM,S="col-md-"+g.columnInMD,F="col-xl-"+g.columnInLG,T="col-el-"+g.columnInEL,U=[b,S,F,T].concat(V);k.appearance.class=U.join(" ")}if(g.fieldSetId){const P=f.contents.find(b=>b.id===g.fieldSetId),V=u.find(b=>b.id===g.fieldSetId);V?(w=V.contents)==null||w.push(k):(u.push(P),P.contents=[k])}else u.push(k)}),f.contents=u,f.id}return{checkCanFindFormNode:y,checkCanOpenLayoutEditor:h,changeFormControlsByResponseLayoutConfig:a,getResonseFormLayoutConfig:s}}class ie extends ee{constructor(e,i){super(e,i);v(this,"responseLayoutEditorFunction");this.responseLayoutEditorFunction=oe(this.formSchemaUtils)}getPropertyConfig(e,i){return this.propertyConfig.categories.basic=this.getBasicProperties(e,i),this.propertyConfig.categories.appearance=this.getAppearanceProperties(e,i),this.propertyConfig.categories.editor=this.getEditorProperties(e),this.propertyConfig}getBasicProperties(e,i){var r;const n=this;return this.setDesignViewModelField(e),this.formSchemaUtils.getFormMetadataBasicInfo(),{description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"编辑器类型",title:"编辑器类型",type:"string",refreshPanelAfterChanged:!0,$converter:"/converter/change-editor.converter",editor:{type:"combo-list",textField:"value",valueField:"key",editable:!1,data:n.designViewModelField?L.getEditorTypesByMDataType((r=n.designViewModelField.type)==null?void 0:r.name):L.getAllInputTypes()}},label:{title:"标签",type:"string",$converter:"/converter/form-group-label.converter"},binding:{description:"绑定的表单字段",title:"绑定",editor:{type:"binding-selector",bindingType:{enable:!1},editorParams:{componentSchema:e,needSyncToViewModel:!0,viewModelId:this.viewModelId,designerHostService:this.designerHostService,disableOccupiedFields:!0},textField:"bindingField"}}},setPropertyRelates(s,y){if(s)switch(s&&s.propertyID){case"type":{n.changeControlType(e,s,i);break}case"label":{s.needRefreshControlTree=!0;break}}}}}getAppearanceProperties(e,i){const n=this;return{title:"样式",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter"},responseLayout:{description:"响应式列宽",title:"响应式列宽",type:"boolean",visible:!0,refreshPanelAfterChanged:!0,editor:{type:"response-layout-editor-setting",initialState:n.responseLayoutEditorFunction.checkCanOpenLayoutEditor(e,n.componentId)}}},setPropertyRelates(r,s){if(r)switch(r&&r.propertyID){case"responseLayout":n.responseLayoutEditorFunction.changeFormControlsByResponseLayoutConfig(r.propertyValue,n.componentId||e.id),n.updateUnifiedLayoutAfterResponseLayoutChanged(n.componentId),n.updateElementByParentContainer(e.id,i),delete e.responseLayout;break;case"class":n.updateUnifiedLayoutAfterControlChanged(r.propertyValue,e.id,this.componentId),n.updateElementByParentContainer(e.id,i);break}}}}getEditorProperties(e){return this.getComponentConfig(e)}changeControlType(e,i,n){var l,o,d,f;const r=i.propertyValue,s=n&&n.parent&&n.parent.schema;if(!s)return;const y=s.contents.findIndex(u=>u.id===e.id),h=s.contents[y];let a;this.designViewModelField&&(this.designViewModelUtils.getDgViewModel(this.viewModelId).changeField(this.designViewModelField.id,{editor:{$type:r},name:this.designViewModelField.name,require:this.designViewModelField.require,readonly:this.designViewModelField.readonly},!1),a=this.controlCreatorUtils.setFormFieldProperty(this.designViewModelField,r)),a||(a=this.controlCreatorUtils.createFormGroupWithoutField(r)),Object.assign(a,{id:h.id,appearance:h.appearance,size:h.size,label:h.label,binding:h.binding,visible:h.visible}),Object.assign(a.editor,{isTextArea:a.isTextArea&&h.isTextArea,placeholder:(l=h.editor)==null?void 0:l.placeholder,holdPlace:(o=h.editor)==null?void 0:o.holdPlace,readonly:(d=h.editor)==null?void 0:d.readonly,require:(f=h.editor)==null?void 0:f.require}),s.contents.splice(y,1),s.contents.splice(y,0,a),n.schema=Object.assign(h,a),Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(u=>u.classList.remove("dgComponentSelected")),te.value++}getComponentConfig(e,i={},n={}){const r=Object.assign({description:"编辑器",title:"编辑器",type:"input-group",$converter:"/converter/property-editor.converter"},i),s=Object.assign({readonly:{description:"",title:"只读",type:"boolean"},disabled:{description:"",title:"禁用",type:"boolean"},placeholder:{description:"空值时,输入控件内的占位文本",title:"提示文本",type:"string"}},n);return{...r,properties:{...s}}}updateUnifiedLayoutAfterControlChanged(e,i,n){const r=e.split(" ");let s=r.find(o=>/^col-([1-9]|10|11|12)$/.test(o)),y=r.find(o=>/^col-md-([1-9]|10|11|12)$/.test(o)),h=r.find(o=>/^col-xl-([1-9]|10|11|12)$/.test(o)),a=r.find(o=>/^col-el-([1-9]|10|11|12)$/.test(o));s=s||"col-12",y=y||"col-md-"+s.replace("col-",""),h=h||"col-xl-"+y.replace("col-md-",""),a=a||"col-el-"+h.replace("col-xl-","");const l={id:i,columnInSM:parseInt(s.replace("col-",""),10),columnInMD:parseInt(y.replace("col-md-",""),10),columnInLG:parseInt(h.replace("col-xl-",""),10),columnInEL:parseInt(a.replace("col-el-",""),10)};this.updateUnifiedLayoutAfterResponseLayoutChanged(n,l)}updateUnifiedLayoutAfterResponseLayoutChanged(e,i){const{formNode:n}=this.responseLayoutEditorFunction.checkCanFindFormNode(e);if(!n||!n.unifiedLayout)return;const r=[];if(this.responseLayoutEditorFunction.getResonseFormLayoutConfig(n,r,1),i){const u=r.find(g=>g.id===i.id);Object.assign(u||{},i)}const s=r.map(u=>u.columnInSM),y=r.map(u=>u.columnInMD),h=r.map(u=>u.columnInLG),a=r.map(u=>u.columnInEL),l=this.checkIsUniqueColumn(s)?s[0]:null,o=this.checkIsUniqueColumn(y)?y[0]:null,d=this.checkIsUniqueColumn(h)?h[0]:null,f=this.checkIsUniqueColumn(a)?a[0]:null;Object.assign(n.unifiedLayout,{uniqueColClassInSM:l,uniqueColClassInMD:o,uniqueColClassInLG:d,uniqueColClassInEL:f})}checkIsUniqueColumn(e){const i=new Set(e);return Array.from(i).length===1}}class re extends ie{constructor(t,e){super(t,e)}getEditorProperties(t){return this.getComponentConfig(t,{type:"switch"},{disabled:{visible:!1},placeholder:{visible:!1},onLabel:{description:"",title:"打开时标签",type:"string"},offLabel:{description:"",title:"关闭时标签",type:"string"},onBackground:{description:"",title:"打开时背景色",type:"string"},offBackground:{description:"",title:"关闭时背景色",type:"string"},size:{description:"",title:"尺寸",type:"enum",editor:{data:[{id:"small",name:"小号"},{id:"middle",name:"中号"},{id:"large",name:"大号"}]}}})}}function ae(c,t){const e=c.schema;function i(n,r){return new re(n,t).getPropertyConfig(e,r)}return{getPropsConfig:i}}const se=m.defineComponent({name:"FSwitchDesign",props:D,emits:["update:modelValue"],setup(c,t){const{size:e,onLabel:i,offLabel:n}=m.toRefs(c),r=m.ref(),s=m.inject("designer-host-service"),y=m.inject("design-item-context"),h=ae(y,s),a=x(r,y,h);m.onMounted(()=>{r.value.componentInstance=a}),t.expose(a.value);const l=m.computed(()=>({switch:!0,"f-cmp-switch":!0,checked:!1,"switch-large":e.value==="large","switch-medium":e.value==="medium","switch-small":e.value==="small"})),o=m.computed(()=>(i==null?void 0:i.value)||(n==null?void 0:n.value));return()=>m.createVNode("span",{ref:r,tabindex:"0",role:"button",class:l.value},[o.value&&m.createVNode("span",{class:"switch-pane"},[m.createVNode("span",{class:"switch-label-unchecked"},[n==null?void 0:n.value])]),m.createVNode("small",null,[t.slots.default&&t.slots.default()])])}});I.register=(c,t,e,i)=>{c.switch=I,t.switch=A},I.registerDesigner=(c,t,e)=>{c.switch=se,t.switch=A};const le=O.withInstall(I);M.FSwitch=I,M.default=le,M.propsResolver=A,M.switchProps=D,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(M,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue"),require("lodash-es"),require("../designer-canvas/index.umd.js"),require("../common/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es","../designer-canvas/index.umd.js","../common/index.umd.js"],m):(M=typeof globalThis<"u"?globalThis:M||self,m(M.switch={},M.Vue,M.LodashES,M.designerCanvas,M.common))})(this,function(M,m,T,$,O){"use strict";var de=Object.defineProperty;var ue=(M,m,T)=>m in M?de(M,m,{enumerable:!0,configurable:!0,writable:!0,value:T}):M[m]=T;var v=(M,m,T)=>ue(M,typeof m!="symbol"?m+"":m,T);const q={},j={};function A(l){const{properties:t,title:e,ignore:i}=l,n=i&&Array.isArray(i),r=Object.keys(t).reduce((s,y)=>((!n||!i.find(h=>h===y))&&(s[y]=t[y].type==="object"&&t[y].properties?A(t[y]):T.cloneDeep(t[y].default)),s),{});if(e&&(!n||!i.find(s=>s==="id"))){const s=e.toLowerCase().replace(/-/g,"_");r.id=`${s}_${Math.random().toString().slice(2,6)}`}return r}function W(l){const{properties:t,title:e,required:i}=l;if(i&&Array.isArray(i)){const n=i.reduce((r,s)=>(r[s]=t[s].type==="object"&&t[s].properties?A(t[s]):T.cloneDeep(t[s].default),r),{});if(e&&i.find(r=>r==="id")){const r=e.toLowerCase().replace(/-/g,"_");n.id=`${r}_${Math.random().toString().slice(2,6)}`}return n}return{type:e}}function G(l,t={},e){const i=q[l];if(i){let n=W(i);const r=j[l];return n=r?r({getSchemaByType:G},n,t,e):n,n}return null}function z(l,t){const e=A(t);return Object.keys(e).reduce((i,n)=>(Object.prototype.hasOwnProperty.call(l,n)&&(i[n]&&T.isPlainObject(i[n])&&T.isPlainObject(l[n]||!l[n])?Object.assign(i[n],l[n]||{}):i[n]=l[n]),i),e),e}function _(l,t){return Object.keys(l).filter(i=>l[i]!=null).reduce((i,n)=>{if(t.has(n)){const r=t.get(n);if(typeof r=="string")i[r]=l[n];else{const s=r(n,l[n],l);Object.assign(i,s)}}else i[n]=l[n];return i},{})}function X(l,t,e=new Map){const i=z(l,t);return _(i,e)}function Q(l={}){function t(a,c,o,d){if(typeof o=="number")return d[a].length===o;if(typeof o=="object"){const f=Object.keys(o)[0],u=o[f];if(f==="not")return Number(d[a].length)!==Number(u);if(f==="moreThan")return Number(d[a].length)>=Number(u);if(f==="lessThan")return Number(d[a].length)<=Number(u)}return!1}function e(a,c,o,d){return d[a]&&d[a].propertyValue&&String(d[a].propertyValue.value)===String(o)}const i=new Map([["length",t],["getProperty",e]]);Object.keys(l).reduce((a,c)=>(a.set(c,l[c]),a),i);function n(a,c){const o=a;return typeof c=="number"?[{target:o,operator:"length",param:null,value:Number(c)}]:typeof c=="boolean"?[{target:o,operator:"getProperty",param:a,value:!!c}]:typeof c=="object"?Object.keys(c).map(d=>{if(d==="length")return{target:o,operator:"length",param:null,value:c[d]};const f=d,u=c[d];return{target:o,operator:"getProperty",param:f,value:u}}):[]}function r(a){return Object.keys(a).reduce((o,d)=>{const f=n(d,a[d]);return o.push(...f),o},[])}function s(a,c){if(i.has(a.operator)){const o=i.get(a.operator);return o&&o(a.target,a.param,a.value,c)||!1}return!1}function y(a,c){return r(a).reduce((f,u)=>f&&s(u,c),!0)}function h(a,c){const o=Object.keys(a),d=o.includes("allOf"),f=o.includes("anyOf"),u=d||f,C=(u?a[u?d?"allOf":"anyOf":"allOf"]:[a]).map(E=>y(E,c));return d?!C.includes(!1):C.includes(!0)}return{parseValueSchema:h}}const p={button:{type:"button",name:"按钮",icon:"Button"},"response-toolbar":{type:"response-toolbar",name:"工具栏",icon:"ButtonGroup"},"response-toolbar-item":{type:"response-toolbar-item",name:"按钮",icon:"Button"},"content-container":{type:"content-container",name:"容器",icon:"ContentContainer"},"input-group":{type:"input-group",name:"文本",icon:"TextBox"},textarea:{type:"textarea",name:"多行文本",icon:"MultiTextBox"},lookup:{type:"lookup",name:"帮助",icon:"LookupEdit"},"number-spinner":{type:"number-spinner",name:"数值",icon:"NumericBox"},"date-picker":{type:"date-picker",name:"日期",icon:"DateBox"},switch:{type:"switch",name:"开关",icon:"SwitchField"},"radio-group":{type:"radio-group",name:"单选组",icon:"RadioGroup"},"check-box":{type:"check-box",name:"复选框",icon:"CheckBox"},"check-group":{type:"check-group",name:"复选框组",icon:"CheckGroup"},"combo-list":{type:"combo-list",name:"下拉列表",icon:"EnumField"},"response-form":{type:"response-form",name:"卡片面板",icon:"Form"},"response-layout":{type:"response-layout",name:"布局容器",icon:"ResponseLayout3"},"response-layout-item":{type:"response-layout-item",name:"布局",icon:"ResponseLayout1"},"tree-grid":{type:"tree-grid",name:"树表格",icon:"TreeGrid"},"tree-grid-column":{type:"tree-grid-column",name:"树表格列"},"data-grid":{type:"data-grid",name:"表格",icon:"DataGrid"},"data-grid-column":{type:"data-grid-column",name:"表格列"},module:{type:"Module",name:"模块",icon:"Module"},component:{type:"component",name:"组件",icon:"Component"},tabs:{type:"tabs",name:"标签页",icon:"Tab"},"tab-page":{type:"tab-page",name:"标签页项",dependentParentControl:"Tab"},"tab-toolbar-item":{type:"tab-toolbar-item",name:"标签页工具栏按钮",icon:"Button"},"time-picker":{type:"time-picker",name:"时间选择",icon:"TimePicker"},section:{type:"section",name:"分组面板",icon:"Section"},"section-toolbar":{type:"section-toolbar",name:"分组面板工具栏"},"section-toolbar-item":{type:"section-toolbar-item",name:"分组面板按钮"},splitter:{type:"splitter",name:"分栏面板",icon:"Splitter"},"splitter-pane":{type:"splitter-pane",name:"分栏面板项",dependentParentControl:"Splitter"},"component-ref":{type:"component-ref",name:"组件引用节点"},uploader:{type:"uploader",name:"附件上传",icon:"FileUpload"},"page-header":{type:"page-header",name:"页头",icon:"Header"},"page-footer":{type:"page-footer",name:"页脚",icon:"ModalFooter"},"tab-toolbar":{type:"tab-toolbar",name:"标签页工具栏",icon:"TabToolbar"},fieldset:{type:"fieldset",name:"分组",icon:"fieldset"},"query-solution":{type:"query-solution",name:"筛选方案",icon:"QueryScheme"}},H={},J={};Q();function Y(l,t,e=new Map,i=(s,y,h,a)=>y,n={},r=s=>s){return q[t.title]=t,j[t.title]=i,H[t.title]=n,J[t.title]=r,(s={})=>{const y=X(s,t,e),h=Object.keys(l).reduce((a,c)=>(a[c]=l[c].default,a),{});return Object.assign(h,y)}}function Z(l,t){return{customClass:t.class,customStyle:t.style}}const R=new Map([["appearance",Z]]),x={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/switch.schema.json",title:"switch",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for a switch",type:"string"},type:{description:"The type string of switch component",type:"string",default:"switch"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disabled:{type:"boolean",default:!1},onBackground:{description:"",type:"string",default:""},offBackground:{description:"",type:"string",default:""},onColor:{description:"",type:"string",default:""},offColor:{description:"",type:"string",default:""},onLabel:{description:"",type:"string",default:""},offLabel:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},size:{description:"",type:"enum",default:"medium"}},required:["type"],ignore:["id","appearance","binding"]};function K(l,t,e){return t}const I={modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},onBackground:{type:String},offBackground:{type:String},onColor:{type:String},offColor:{type:String},onLabel:{type:String},offLabel:{type:String},size:{type:String,default:"medium"},onModelValueChanged:{type:Function,default:()=>{}}},N=Y(I,x,R,K),D=m.defineComponent({name:"FSwitch",props:I,emits:["update:modelValue","modelValueChanged"],setup(l,t){const{disabled:e,size:i,onLabel:n,offLabel:r,onBackground:s,offBackground:y,onColor:h,offColor:a,readonly:c}=m.toRefs(l),o=m.ref(l.modelValue),d=m.computed(()=>({switch:!0,"f-cmp-switch":!0,checked:o.value,disabled:c.value||e.value,"switch-large":i.value==="large","switch-medium":i.value==="medium","switch-small":i.value==="small"})),f=m.computed(()=>o.value?{outline:"none",background:s.value}:{outline:"none",backgroundColor:y.value}),u=m.computed(()=>o.value?{background:h.value}:{backgroundColor:a.value}),g=m.computed(()=>(n==null?void 0:n.value)||(r==null?void 0:r.value));function k(){c.value||e.value||(o.value=!o.value,t.emit("update:modelValue",o.value))}return m.watch(o,(C,w)=>{C!==w&&t.emit("modelValueChanged",C)}),m.watch(()=>l.modelValue,(C,w)=>{C!==w&&(o.value=C)}),()=>m.createVNode("span",{tabindex:"0",role:"button",class:d.value,style:f.value,onClick:k},[g.value&&m.createVNode("span",{class:"switch-pane"},[m.createVNode("span",{class:"switch-label-checked"},[n==null?void 0:n.value]),m.createVNode("span",{class:"switch-label-unchecked"},[r==null?void 0:r.value])]),m.createVNode("small",{style:u.value},[t.slots.default&&t.slots.default()])])}});function ee(l,t,e){var V;const i=e&&e.getStyles&&e.getStyles()||"",n=e&&e.getDesignerClass&&e.getDesignerClass()||"",r=m.ref();function s(){return(t==null?void 0:t.schema.componentType)==="frame"?!1:e&&e.checkCanMoveComponent?e.checkCanMoveComponent():!0}function y(){return!1}function h(){return(t==null?void 0:t.schema.componentType)==="frame"?!1:e&&e.checkCanDeleteComponent?e.checkCanDeleteComponent():!0}function a(){return(t==null?void 0:t.schema.componentType)==="frame"?!0:e&&e.hideNestedPaddingInDesginerView?e.hideNestedPaddingInDesginerView():!1}function c(b){if(!b||!b.value)return null;if(b.value.schema&&b.value.schema.type==="component")return b.value;const S=m.ref(b==null?void 0:b.value.parent),F=c(S);return F||null}function o(b=t){const{componentInstance:S,designerItemElementRef:F}=b;return!S||!S.value?null:S.value.canMove?F:o(b.parent)}function d(b){return!!e&&e.canAccepts(b)}function f(){return(t==null?void 0:t.schema.label)||(t==null?void 0:t.schema.title)||(t==null?void 0:t.schema.name)}function u(){}function g(b,S){S&&e!=null&&e.onAcceptMovedChildElement&&e.onAcceptMovedChildElement(S)}function k(b,S){const{componentType:F}=b;let P=G(F,b,S);e&&e.onResolveNewComponentSchema&&(P=e.onResolveNewComponentSchema(b,P));const U=F.toLowerCase().replace(/-/g,"_");return P&&!P.id&&P.type===F&&(P.id=`${U}_${Math.random().toString().slice(2,6)}`),P}function C(b){}function w(...b){if(e&&e.getPropsConfig)return e.getPropsConfig(...b)}function E(){e&&e.onRemoveComponent&&e.onRemoveComponent(),t!=null&&t.schema.contents&&t.schema.contents.map(b=>{var P;let S=b.id;b.type==="component-ref"&&(S=b.component);const F=l.value.querySelector(`#${S}-design-item`);(P=F==null?void 0:F.componentInstance)!=null&&P.value.onRemoveComponent&&F.componentInstance.value.onRemoveComponent()})}return r.value={canMove:s(),canSelectParent:y(),canDelete:h(),canNested:!a(),contents:t==null?void 0:t.schema.contents,elementRef:l,parent:(V=t==null?void 0:t.parent)==null?void 0:V.componentInstance,schema:t==null?void 0:t.schema,styles:i,designerClass:n,canAccepts:d,getBelongedComponentInstance:c,getDraggableDesignItemElement:o,getDraggingDisplayText:f,getPropConfig:w,getDragScopeElement:u,onAcceptMovedChildElement:g,onChildElementMovedOut:C,addNewChildComponentSchema:k,triggerBelongedComponentToMoveWhenMoved:!!e&&e.triggerBelongedComponentToMoveWhenMoved||m.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:!!e&&e.triggerBelongedComponentToDeleteWhenDeleted||m.ref(!1),onRemoveComponent:E},r}class te{constructor(t,e){v(this,"componentId");v(this,"viewModelId");v(this,"eventsEditorUtils");v(this,"formSchemaUtils");v(this,"formMetadataConverter");v(this,"designViewModelUtils");v(this,"designViewModelField");v(this,"controlCreatorUtils");v(this,"designerHostService");v(this,"schemaService",null);v(this,"metadataService",null);v(this,"propertyConfig",{type:"object",categories:{}});var i;this.componentId=t,this.designerHostService=e,this.eventsEditorUtils=e.eventsEditorUtils,this.formSchemaUtils=e.formSchemaUtils,this.formMetadataConverter=e.formMetadataConverter,this.viewModelId=((i=this.formSchemaUtils)==null?void 0:i.getViewModelIdByComponentId(t))||"",this.designViewModelUtils=e.designViewModelUtils,this.controlCreatorUtils=e.controlCreatorUtils,this.metadataService=e.metadataService,this.schemaService=e.schemaService}getTableInfo(){var t;return(t=this.schemaService)==null?void 0:t.getTableInfoByViewModelId(this.viewModelId)}setDesignViewModelField(t){var i;const e=t.binding&&t.binding.type==="Form"&&t.binding.field;if(e){if(!this.designViewModelField){const n=this.designViewModelUtils.getDgViewModel(this.viewModelId);this.designViewModelField=n.fields.find(r=>r.id===e)}t.updateOn=(i=this.designViewModelField)==null?void 0:i.updateOn}}changeFieldEditorType(t,e){}getBasicPropConfig(t){return{description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"combo-list",textField:"name",valueField:"value",data:[{value:t.type,name:p[t.type].name}]}}}}}getAppearanceConfig(t=null){return{title:"样式",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter"}}}}updateElementByParentContainer(t,e){const i=e&&e.parent&&e.parent.schema;if(!i)return;const n=i.contents.findIndex(s=>s.id===t),r=T.cloneDeep(i.contents[n]);i.contents.splice(n,1),i.contents.splice(n,0,r)}}const B=class B{static getEditorTypesByMDataType(t){const e=B.fieldControlTypeMapping[t];return e||[{key:"",value:""}]}static getAllInputTypes(){const t=[];for(const e in B.fieldControlTypeMapping)B.fieldControlTypeMapping[e].forEach(i=>{t.find(n=>n.key===i.key&&n.value===i.value)||t.push({key:i.key,value:i.value})});return t}};v(B,"fieldControlTypeMapping",{String:[{key:p["input-group"].type,value:p["input-group"].name},{key:p.lookup.type,value:p.lookup.name},{key:p["date-picker"].type,value:p["date-picker"].name},{key:p["check-box"].type,value:p["check-box"].name},{key:p["check-group"].type,value:p["check-group"].name},{key:p["radio-group"].type,value:p["radio-group"].name},{key:p["combo-list"].type,value:p["combo-list"].name},{key:p.textarea.type,value:p.textarea.name}],Text:[{key:p.textarea.type,value:p.textarea.name},{key:p.lookup.type,value:p.lookup.name}],Decimal:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],Integer:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],Number:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],BigNumber:[{key:p["number-spinner"].type,value:p["number-spinner"].name}],Date:[{key:p["date-picker"].type,value:p["date-picker"].name}],DateTime:[{key:p["date-picker"].type,value:p["date-picker"].name}],Boolean:[{key:p.switch.type,value:p.switch.name},{key:p["check-box"].type,value:p["check-box"].name}],Enum:[{key:p["combo-list"].type,value:p["combo-list"].name},{key:p["radio-group"].type,value:p["radio-group"].name}],Object:[{key:p.lookup.type,value:p.lookup.name},{key:p["combo-list"].type,value:p["combo-list"].name},{key:p["radio-group"].type,value:p["radio-group"].name}]});let L=B;const ne=m.ref(0);class oe{constructor(){v(this,"label","");v(this,"id","");v(this,"columnInSM",12);v(this,"columnInMD",6);v(this,"columnInLG",3);v(this,"columnInEL",2);v(this,"displayWidthInSM",1);v(this,"displayWidthInMD",1);v(this,"displayWidthInLG",1);v(this,"displayWidthInEL",1);v(this,"displayColumnCountAtBreakPoint","md");v(this,"tagRow",0);v(this,"showTopBorder",0);v(this,"group",1);v(this,"isSupportedClass",!0);v(this,"fieldSetId","")}}function ie(l){let t,e;const i=new Map;let n=[];function r(c,o){const f=c.split(" ").filter(w=>w.startsWith("col-"));if(f.length===0){o.isSupportedClass=!1;return}let u=f.find(w=>/^col-([1-9]|10|11|12)$/.test(w)),g=f.find(w=>/^col-md-([1-9]|10|11|12)$/.test(w)),k=f.find(w=>/^col-xl-([1-9]|10|11|12)$/.test(w)),C=f.find(w=>/^col-el-([1-9]|10|11|12)$/.test(w));u=u||"col-12",o.columnInSM=parseInt(u.replace("col-",""),10),o.displayWidthInSM=o.columnInSM/12,o.displayWidthInSM!==1&&(o.isSupportedClass=!1),g=g||"col-md-"+o.columnInSM,o.columnInMD=parseInt(g.replace("col-md-",""),10),o.displayWidthInMD=o.columnInMD/6,[1,2].includes(o.displayWidthInMD)||(o.isSupportedClass=!1),k=k||"col-xl-"+o.columnInMD,o.columnInLG=parseInt(k.replace("col-xl-",""),10),o.displayWidthInLG=o.columnInLG/3,[1,2,3,4].includes(o.displayWidthInLG)||(o.isSupportedClass=!1),C=C||"col-el-"+o.columnInLG,o.columnInEL=parseInt(C.replace("col-el-",""),10),o.displayWidthInEL=o.columnInEL/2,[1,2,3,4,5,6].includes(o.displayWidthInEL)||(o.isSupportedClass=!1)}function s(c,o,d,f=!1){let u=!1;c.contents.forEach(g=>{if(g.type==="fieldset"){d+=1,s(g,o,d,!0),u=!0;return}u&&(d+=1,u=!1);const k=g.appearance&&g.appearance.class,C=new oe;k?r(k,C):C.isSupportedClass=!1,C.label=g.label||g.id,C.id=g.id,C.group=d,f&&(C.fieldSetId=c.id),e===g.id&&(t=d),i.set(g.id,g),o.push(C)})}function y(c){const o=l.getComponentById(c);if(!o||!o.componentType||!o.componentType.startsWith("form"))return{result:!1,message:"只可以在响应式表单组件中调整响应式布局配置"};const d=l.selectNode(o,f=>f.type===$.DgControl["response-form"].type);return!d||!d.contents||d.contents.length===0?{result:!1,message:"Form区域内没有控件,请先添加控件"}:{result:!0,message:"",formNode:d}}function h(c,o){o=o||c.id;const{result:d,message:f,formNode:u}=y(o);if(!d)return{result:d,message:f};e=c.id,n=[],i.clear();const g=u.contents[0].type===$.DgControl.fieldset.type?0:1;s(u,n,g);const k=n.find(w=>!w.isSupportedClass);return{defaultState:{defaultGroupNumber:t||1,model:k?"customize":"standard"},importData:n}}function a(c,o){o=o;const{result:d,formNode:f}=y(o);if(!d)return"";const u=[];return c.forEach(g=>{var w;const k=i.get(g.id),C=k.appearance&&k.appearance.class;if(C){const V=C.split(" ").filter(pe=>!pe.startsWith("col-")),b="col-"+g.columnInSM,S="col-md-"+g.columnInMD,F="col-xl-"+g.columnInLG,P="col-el-"+g.columnInEL,U=[b,S,F,P].concat(V);k.appearance.class=U.join(" ")}if(g.fieldSetId){const E=f.contents.find(b=>b.id===g.fieldSetId),V=u.find(b=>b.id===g.fieldSetId);V?(w=V.contents)==null||w.push(k):(u.push(E),E.contents=[k])}else u.push(k)}),f.contents=u,f.id}return{checkCanFindFormNode:y,checkCanOpenLayoutEditor:h,changeFormControlsByResponseLayoutConfig:a,getResonseFormLayoutConfig:s}}class re extends te{constructor(e,i){super(e,i);v(this,"responseLayoutEditorFunction");this.responseLayoutEditorFunction=ie(this.formSchemaUtils)}getPropertyConfig(e,i){return this.propertyConfig.categories.basic=this.getBasicProperties(e,i),this.propertyConfig.categories.appearance=this.getAppearanceProperties(e,i),this.propertyConfig.categories.editor=this.getEditorProperties(e),this.propertyConfig}getBasicProperties(e,i){var r;const n=this;return this.setDesignViewModelField(e),{description:"Basic Information",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"编辑器类型",title:"编辑器类型",type:"string",refreshPanelAfterChanged:!0,$converter:"/converter/change-editor.converter",editor:{type:"combo-list",textField:"value",valueField:"key",editable:!1,data:n.designViewModelField?L.getEditorTypesByMDataType((r=n.designViewModelField.type)==null?void 0:r.name):L.getAllInputTypes()}},label:{title:"标签",type:"string",$converter:"/converter/form-group-label.converter"},binding:{description:"绑定的表单字段",title:"绑定",editor:{type:"binding-selector",bindingType:{enable:!1},editorParams:{componentSchema:e,needSyncToViewModel:!0,viewModelId:this.viewModelId,designerHostService:this.designerHostService,disableOccupiedFields:!0},textField:"bindingField"}}},setPropertyRelates(s,y){if(s)switch(s&&s.propertyID){case"type":{n.changeControlType(e,s,i);break}case"label":{s.needRefreshControlTree=!0;break}}}}}getAppearanceProperties(e,i){const n=this;return{title:"样式",description:"Appearance",properties:{class:{title:"class样式",type:"string",description:"组件的CSS样式",$converter:"/converter/appearance.converter"},style:{title:"style样式",type:"string",description:"组件的样式",$converter:"/converter/appearance.converter"},responseLayout:{description:"响应式列宽",title:"响应式列宽",type:"boolean",visible:!0,refreshPanelAfterChanged:!0,editor:{type:"response-layout-editor-setting",initialState:n.responseLayoutEditorFunction.checkCanOpenLayoutEditor(e,n.componentId)}}},setPropertyRelates(r,s){if(r)switch(r&&r.propertyID){case"responseLayout":n.responseLayoutEditorFunction.changeFormControlsByResponseLayoutConfig(r.propertyValue,n.componentId||e.id),n.updateUnifiedLayoutAfterResponseLayoutChanged(n.componentId),n.updateElementByParentContainer(e.id,i),delete e.responseLayout;break;case"class":n.updateUnifiedLayoutAfterControlChanged(r.propertyValue,e.id,this.componentId),n.updateElementByParentContainer(e.id,i);break}}}}getEditorProperties(e){return this.getComponentConfig(e)}changeControlType(e,i,n){var c,o,d,f;const r=i.propertyValue,s=n&&n.parent&&n.parent.schema;if(!s)return;const y=s.contents.findIndex(u=>u.id===e.id),h=s.contents[y];let a;this.designViewModelField&&(this.designViewModelUtils.getDgViewModel(this.viewModelId).changeField(this.designViewModelField.id,{editor:{$type:r},name:this.designViewModelField.name,require:this.designViewModelField.require,readonly:this.designViewModelField.readonly},!1),a=this.controlCreatorUtils.setFormFieldProperty(this.designViewModelField,r)),a||(a=this.controlCreatorUtils.createFormGroupWithoutField(r)),Object.assign(a,{id:h.id,appearance:h.appearance,size:h.size,label:h.label,binding:h.binding,visible:h.visible}),Object.assign(a.editor,{isTextArea:a.isTextArea&&h.isTextArea,placeholder:(c=h.editor)==null?void 0:c.placeholder,holdPlace:(o=h.editor)==null?void 0:o.holdPlace,readonly:(d=h.editor)==null?void 0:d.readonly,require:(f=h.editor)==null?void 0:f.require}),s.contents.splice(y,1),s.contents.splice(y,0,a),n.schema=Object.assign(h,a),Array.from(document.getElementsByClassName("dgComponentSelected")).forEach(u=>u.classList.remove("dgComponentSelected")),ne.value++}getComponentConfig(e,i={},n={}){const r=Object.assign({description:"编辑器",title:"编辑器",type:"input-group",$converter:"/converter/property-editor.converter"},i),s=Object.assign({readonly:{description:"",title:"只读",type:"boolean"},disabled:{description:"",title:"禁用",type:"boolean"},placeholder:{description:"空值时,输入控件内的占位文本",title:"提示文本",type:"string"}},n);return{...r,properties:{...s}}}updateUnifiedLayoutAfterControlChanged(e,i,n){const r=e.split(" ");let s=r.find(o=>/^col-([1-9]|10|11|12)$/.test(o)),y=r.find(o=>/^col-md-([1-9]|10|11|12)$/.test(o)),h=r.find(o=>/^col-xl-([1-9]|10|11|12)$/.test(o)),a=r.find(o=>/^col-el-([1-9]|10|11|12)$/.test(o));s=s||"col-12",y=y||"col-md-"+s.replace("col-",""),h=h||"col-xl-"+y.replace("col-md-",""),a=a||"col-el-"+h.replace("col-xl-","");const c={id:i,columnInSM:parseInt(s.replace("col-",""),10),columnInMD:parseInt(y.replace("col-md-",""),10),columnInLG:parseInt(h.replace("col-xl-",""),10),columnInEL:parseInt(a.replace("col-el-",""),10)};this.updateUnifiedLayoutAfterResponseLayoutChanged(n,c)}updateUnifiedLayoutAfterResponseLayoutChanged(e,i){const{formNode:n}=this.responseLayoutEditorFunction.checkCanFindFormNode(e);if(!n||!n.unifiedLayout)return;const r=[];if(this.responseLayoutEditorFunction.getResonseFormLayoutConfig(n,r,1),i){const u=r.find(g=>g.id===i.id);Object.assign(u||{},i)}const s=r.map(u=>u.columnInSM),y=r.map(u=>u.columnInMD),h=r.map(u=>u.columnInLG),a=r.map(u=>u.columnInEL),c=this.checkIsUniqueColumn(s)?s[0]:null,o=this.checkIsUniqueColumn(y)?y[0]:null,d=this.checkIsUniqueColumn(h)?h[0]:null,f=this.checkIsUniqueColumn(a)?a[0]:null;Object.assign(n.unifiedLayout,{uniqueColClassInSM:c,uniqueColClassInMD:o,uniqueColClassInLG:d,uniqueColClassInEL:f})}checkIsUniqueColumn(e){const i=new Set(e);return Array.from(i).length===1}}class ae extends re{constructor(t,e){super(t,e)}getEditorProperties(t){return this.getComponentConfig(t,{type:"switch"},{disabled:{visible:!1},placeholder:{visible:!1},onLabel:{description:"",title:"打开时标签",type:"string"},offLabel:{description:"",title:"关闭时标签",type:"string"},onBackground:{description:"",title:"打开时背景色",type:"string"},offBackground:{description:"",title:"关闭时背景色",type:"string"},size:{description:"",title:"尺寸",type:"enum",editor:{data:[{id:"small",name:"小号"},{id:"middle",name:"中号"},{id:"large",name:"大号"}]}}})}}function se(l,t){const e=l.schema;function i(n,r){return new ae(n,t).getPropertyConfig(e,r)}return{getPropsConfig:i}}const le=m.defineComponent({name:"FSwitchDesign",props:I,emits:["update:modelValue"],setup(l,t){const{size:e,onLabel:i,offLabel:n}=m.toRefs(l),r=m.ref(),s=m.inject("designer-host-service"),y=m.inject("design-item-context"),h=se(y,s),a=ee(r,y,h);m.onMounted(()=>{r.value.componentInstance=a}),t.expose(a.value);const c=m.computed(()=>({switch:!0,"f-cmp-switch":!0,checked:!1,"switch-large":e.value==="large","switch-medium":e.value==="medium","switch-small":e.value==="small"})),o=m.computed(()=>(i==null?void 0:i.value)||(n==null?void 0:n.value));return()=>m.createVNode("span",{ref:r,tabindex:"0",role:"button",class:c.value},[o.value&&m.createVNode("span",{class:"switch-pane"},[m.createVNode("span",{class:"switch-label-unchecked"},[n==null?void 0:n.value])]),m.createVNode("small",null,[t.slots.default&&t.slots.default()])])}});D.register=(l,t,e,i)=>{l.switch=D,t.switch=N},D.registerDesigner=(l,t,e)=>{l.switch=le,t.switch=N};const ce=O.withInstall(D);M.FSwitch=D,M.default=ce,M.propsResolver=N,M.switchProps=I,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|