@longhongguo/form-create-ant-design-vue 3.2.71 → 3.2.72

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/auto-import.js CHANGED
@@ -24,7 +24,8 @@ import {
24
24
  Flex,
25
25
  Space,
26
26
  Spin,
27
- Transfer
27
+ Transfer,
28
+ Image
28
29
  } from 'ant-design-vue'
29
30
 
30
31
  export default function install(formCreate) {
@@ -57,5 +58,6 @@ export default function install(formCreate) {
57
58
  app.component(Popover.name) || app.use(Popover)
58
59
  app.component(Modal.name) || app.use(Modal)
59
60
  app.component(Transfer.name) || app.use(Transfer)
61
+ app.component(Image.name) || app.use(Image)
60
62
  })
61
63
  }
@@ -501,48 +501,6 @@
501
501
  .ant-flex._fc-flex-vertical > .ant-form-item {
502
502
  width: var(--fc-child-width, 100%) !important;
503
503
  }
504
-
505
- /* Spin 容器自适应子组件尺寸 - 让整个布局链自适应 */
506
- /* 通过 form-item 的 class 控制整个布局 */
507
- .ant-form-item._fc-spin-wrap-fit {
508
- width: fit-content !important;
509
- display: inline-block !important;
510
- }
511
-
512
- .ant-form-item._fc-spin-wrap-fit .ant-form-item-control {
513
- width: fit-content !important;
514
- flex: none !important;
515
- }
516
-
517
- .ant-form-item._fc-spin-wrap-fit .ant-form-item-control-input {
518
- width: fit-content !important;
519
- }
520
-
521
- .ant-form-item._fc-spin-wrap-fit .ant-form-item-control-input-content {
522
- width: fit-content !important;
523
- display: inline-block !important;
524
- }
525
-
526
- /* col 自适应 */
527
- .ant-form-item._fc-spin-wrap-fit .ant-col._fc-spin-col-fit {
528
- width: fit-content !important;
529
- flex: 0 0 auto !important;
530
- max-width: 100% !important;
531
- }
532
-
533
- /* Spin 组件自适应 */
534
- .ant-form-item._fc-spin-wrap-fit .ant-spin._fc-spin-container {
535
- display: inline-block !important;
536
- width: fit-content !important;
537
- height: fit-content !important;
538
- }
539
-
540
- /* 确保 Spin 容器内的内容决定容器大小 */
541
- .ant-form-item._fc-spin-wrap-fit .ant-spin._fc-spin-container .ant-spin-container {
542
- display: inline-block !important;
543
- width: fit-content !important;
544
- height: fit-content !important;
545
- }
546
504
 
547
505
  @font-face {
548
506
  font-family: "fc-icon";
@@ -501,48 +501,6 @@
501
501
  .ant-flex._fc-flex-vertical > .ant-form-item {
502
502
  width: var(--fc-child-width, 100%) !important;
503
503
  }
504
-
505
- /* Spin 容器自适应子组件尺寸 - 让整个布局链自适应 */
506
- /* 通过 form-item 的 class 控制整个布局 */
507
- .ant-form-item._fc-spin-wrap-fit {
508
- width: fit-content !important;
509
- display: inline-block !important;
510
- }
511
-
512
- .ant-form-item._fc-spin-wrap-fit .ant-form-item-control {
513
- width: fit-content !important;
514
- flex: none !important;
515
- }
516
-
517
- .ant-form-item._fc-spin-wrap-fit .ant-form-item-control-input {
518
- width: fit-content !important;
519
- }
520
-
521
- .ant-form-item._fc-spin-wrap-fit .ant-form-item-control-input-content {
522
- width: fit-content !important;
523
- display: inline-block !important;
524
- }
525
-
526
- /* col 自适应 */
527
- .ant-form-item._fc-spin-wrap-fit .ant-col._fc-spin-col-fit {
528
- width: fit-content !important;
529
- flex: 0 0 auto !important;
530
- max-width: 100% !important;
531
- }
532
-
533
- /* Spin 组件自适应 */
534
- .ant-form-item._fc-spin-wrap-fit .ant-spin._fc-spin-container {
535
- display: inline-block !important;
536
- width: fit-content !important;
537
- height: fit-content !important;
538
- }
539
-
540
- /* 确保 Spin 容器内的内容决定容器大小 */
541
- .ant-form-item._fc-spin-wrap-fit .ant-spin._fc-spin-container .ant-spin-container {
542
- display: inline-block !important;
543
- width: fit-content !important;
544
- height: fit-content !important;
545
- }
546
504
 
547
505
  @font-face {
548
506
  font-family: "fc-icon";
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @longhongguo/form-create-ant-design-vue v3.2.71
2
+ * @longhongguo/form-create-ant-design-vue v3.2.72
3
3
  * (c) 2018-2025 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
6
6
  */
7
- import e from"@form-create/component-antdv-upload/src/index";import t from"@form-create/component-antdv-frame/src/index";import l from"@form-create/component-antdv-group/src/index";import r from"@form-create/component-subform/src/index";import{openBlock as a,createElementBlock as o,createElementVNode as s,defineComponent as i,Fragment as n,createCommentVNode as c,normalizeClass as p,normalizeStyle as d,toDisplayString as u,renderList as h,resolveComponent as f,createVNode as m,reactive as y,markRaw as v,createBlock as g,resolveDynamicComponent as b,withCtx as w,createTextVNode as C,renderSlot as x,toRef as k,watch as S,nextTick as $}from"vue";import V,{hasProperty as F}from"@form-create/utils/lib/type";import{parseFn as I}from"@form-create/utils/lib/json";import A from"@form-create/utils/lib/deepset";import j,{creatorFactory as P}from"@longhongguo/form-create-core/src/index";import O from"@form-create/utils/lib/mergeprops";import T from"@form-create/utils/lib/extend";import{invoke as E}from"@longhongguo/form-create-core/src/frame/util";import B from"@form-create/utils/lib/toarray";var R={name:"QuestionCircleOutlined"};const D={class:"anticon"};R.render=function(e,t,l,r,i,n){return a(),o("span",D,[...t[0]||(t[0]=[s("svg",{height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[s("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",fill:"currentColor"}),s("path",{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7c-21.2 8.1-39.2 22.3-52.1 40.9c-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5c.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1 0 80 0a40 40 0 1 0-80 0z",fill:"currentColor"})],-1)])])};var K=i({name:"CusSelect",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},sourceItems:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},maxTagCount:{type:Number,default:void 0},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},style:{type:[String,Object],default:()=>({width:"100%"})},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},allowClear:{type:Boolean,default:!1},bordered:{type:Boolean,default:!0}},emits:["update:modelValue","update:sourceItems","change"],computed:{currentValue:{get(){return Array.isArray(this.modelValue)?this.modelValue.map(e=>"object"!=typeof e||null===e||void 0===e.value&&void 0===e[this.valueKey]?{[this.valueKey]:e,[this.labelKey]:this.getLabel(e)}:e):null===this.modelValue||void 0===this.modelValue||""===this.modelValue?[]:"object"==typeof this.modelValue?[this.modelValue]:[{value:this.modelValue,label:this.getLabel(this.modelValue)}]},set(e){let t=[];null!=e&&(t=Array.isArray(e)?e.map(e=>"object"!=typeof e||null===e||void 0===e.value&&void 0===e[this.valueKey]?{[this.valueKey]:e,[this.labelKey]:this.getLabel(e)}:e):"object"==typeof e&&null!==e?[e]:[{[this.valueKey]:e,[this.labelKey]:this.getLabel(e)}]),this.$emit("update:modelValue",t),this.$emit("change",t)}},hasValue(){const e=this.currentValue;return Array.isArray(e)&&e.length>0},displayValue(){return this.hasValue?this.currentValue[0]:null},displayLabel(){if(!this.displayValue)return"";const e=this.displayValue;return"object"==typeof e&&null!==e?e[this.labelKey]||e.label||String(e[this.valueKey]||e.value||""):this.getLabel(e)},allSelectedItems(){const e=this.currentValue;return Array.isArray(e)&&0!==e.length?e.map(e=>"object"==typeof e&&null!==e?{value:e[this.valueKey]||e.value,label:e[this.labelKey]||e.label||String(e[this.valueKey]||e.value||"")}:{value:e,label:this.getLabel(e)}):[]},displayItems(){const e=this.allSelectedItems;return void 0===this.maxTagCount||null===this.maxTagCount?e:e.slice(0,this.maxTagCount)},remainingCount(){if(void 0===this.maxTagCount||null===this.maxTagCount)return 0;const e=this.allSelectedItems.length;return Math.max(0,e-this.maxTagCount)},showClear(){return this.allowClear&&this.hasValue&&!this.disabled}},methods:{findOptionByValue(e){return this.options&&0!==this.options.length?this.options.find(t=>{const l="object"==typeof t?t[this.valueKey]:t;return l===e||String(l)===String(e)}):null},getLabel(e){const t=this.findOptionByValue(e);return t?"object"==typeof t?t[this.labelKey]:t:String(e)},removeItem(e,t){if(this.disabled)return;t.stopPropagation();const l=this.currentValue;if(Array.isArray(l)){const t=l.filter(t=>{if("object"==typeof t&&null!==t){return(t[this.valueKey]||t.value)!==e}return t!==e}),r=this.sourceItems.filter(e=>!t.some(t=>t[this.valueKey]===e[this.valueKey]));this.$emit("update:sourceItems",r),this.currentValue=t}},clearValue(e){if(this.disabled)return;e.stopPropagation(),this.currentValue=[];const t=this.sourceItems.filter(e=>!this.currentValue.some(t=>t[this.valueKey]===e[this.valueKey]));this.$emit("update:sourceItems",t)}}});const _=["tabindex"],M=["title"],L={key:1,class:"fc-cus-select-selection-placeholder"},N={key:3,class:"fc-cus-select-arrow"},z=["tabindex"],U={class:"fc-cus-select-selection-overflow"},Y=["title"],q={class:"fc-cus-select-selection-item-content"},Q=["onClick"],W={key:0,class:"fc-cus-select-selection-overflow-item",style:{opacity:"1"}},J={class:"fc-cus-select-selection-item"},H={class:"fc-cus-select-selection-item-content"},G={key:1,class:"fc-cus-select-selection-placeholder"},X={key:1,class:"fc-cus-select-arrow"};K.render=function(e,t,l,r,i,f){return a(),o(n,null,[c(" 单个展示模式 "),e.multiple?(a(),o(n,{key:1},[c(" 多个展示模式 "),s("div",{class:p(["fc-cus-select fc-cus-select-multiple",{"fc-cus-select-disabled":e.disabled}]),style:d(e.style),tabindex:e.disabled?-1:0},[s("div",{class:p(["fc-cus-select-selector",{"fc-cus-select-selector-borderless":!e.bordered}])},[s("div",U,[c(" 显示的 tags "),(a(!0),o(n,null,h(e.displayItems,(l,r)=>(a(),o("div",{key:r,class:"fc-cus-select-selection-overflow-item",style:{opacity:"1"}},[s("span",{class:"fc-cus-select-selection-item",title:l.label},[s("span",q,u(l.label),1),s("span",{class:"fc-cus-select-selection-item-remove",onClick:t=>e.removeItem(l.value,t)},[...t[4]||(t[4]=[s("span",{role:"img","aria-label":"close",class:"anticon anticon-close"},[s("svg",{focusable:"false","data-icon":"close",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true","fill-rule":"evenodd",viewBox:"64 64 896 896"},[s("path",{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"})])],-1)])],8,Q)],8,Y)]))),128)),c(" 折叠提示 "),e.remainingCount>0?(a(),o("div",W,[s("span",J,[s("span",H," +"+u(e.remainingCount),1)])])):c("v-if",!0),c(" 空值占位符 "),e.hasValue?c("v-if",!0):(a(),o("span",G,u(e.placeholder||"请选择"),1))]),e.showClear?(a(),o("span",{key:0,class:"fc-cus-select-clear",onClick:t[1]||(t[1]=(...t)=>e.clearValue&&e.clearValue(...t))},[...t[5]||(t[5]=[s("span",{role:"img","aria-label":"close-circle",class:"anticon anticon-close-circle"},[s("svg",{focusable:"false","data-icon":"close-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true","fill-rule":"evenodd",viewBox:"64 64 896 896"},[s("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})])],-1)])])):(a(),o("span",X,[...t[6]||(t[6]=[s("span",{role:"img","aria-label":"down",class:"anticon anticon-down"},[s("svg",{focusable:"false","data-icon":"down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"64 64 896 896"},[s("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"})])],-1)])]))],2)],14,z)],2112)):(a(),o("div",{key:0,class:p(["fc-cus-select fc-cus-select-single",{"fc-cus-select-disabled":e.disabled}]),style:d(e.style),tabindex:e.disabled?-1:0},[s("div",{class:p(["fc-cus-select-selector",{"fc-cus-select-selector-borderless":!e.bordered}])},[e.displayValue?(a(),o("span",{key:0,class:"fc-cus-select-selection-item",title:e.displayLabel},u(e.displayLabel),9,M)):(a(),o("span",L,u(e.placeholder||"请选择"),1)),e.showClear?(a(),o("span",{key:2,class:"fc-cus-select-clear",onClick:t[0]||(t[0]=(...t)=>e.clearValue&&e.clearValue(...t))},[...t[2]||(t[2]=[s("span",{role:"img","aria-label":"close-circle",class:"anticon anticon-close-circle"},[s("svg",{focusable:"false","data-icon":"close-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true","fill-rule":"evenodd",viewBox:"64 64 896 896"},[s("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})])],-1)])])):(a(),o("span",N,[...t[3]||(t[3]=[s("span",{role:"img","aria-label":"down",class:"anticon anticon-down"},[s("svg",{focusable:"false","data-icon":"down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"64 64 896 896"},[s("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"})])],-1)])]))],2)],14,_))],2112)};var Z=i({name:"CusStoreSelect",components:{CusSelect:K},props:{formCreateInject:{type:Object,default:null},modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},maxTagCount:{type:Number,default:void 0},placeholder:{type:String,default:"请选择"},disabled:{type:Boolean,default:!1},style:{type:[String,Object],default:()=>({width:"100%"})},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},allowClear:{type:Boolean,default:!1},field:{type:String,default:""},bordered:{type:Boolean,default:!0},extraQuery:{type:Object,default:()=>({})},extraQueryFn:{type:Function,default:()=>{}}},emits:["update:modelValue","change"],data:()=>({messageId:0,pendingCallbacks:{},internalOptions:[],sourceItems:[]}),computed:{mergedOptions(){if(this.internalOptions.length>0){const e=new Map;return this.options.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),this.internalOptions.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),Array.from(e.values())}return this.options}},watch:{options:{immediate:!0,handler(e){0===this.internalOptions.length&&Array.isArray(e)&&e.length>0&&(this.internalOptions=[...e])}}},mounted(){window.addEventListener("message",this.handleMessage)},beforeUnmount(){window.removeEventListener("message",this.handleMessage)},methods:{serializeForPostMessage(e){if(null==e)return e;try{return JSON.parse(JSON.stringify(e))}catch(t){if(console.warn("CusStoreSelect: 数据序列化失败,尝试递归处理",t),Array.isArray(e))return 0===e.length?[]:e.map(e=>this.serializeForPostMessage(e));if("object"==typeof e){const t={};for(const l in e)if(Object.prototype.hasOwnProperty.call(e,l))try{t[l]=this.serializeForPostMessage(e[l])}catch(e){console.warn("CusStoreSelect: 跳过无法序列化的属性: "+l,e)}return t}return e}},handleClick(){if(this.disabled)return;const e=`store-select-${this.field||"default"}-${Date.now()}-${++this.messageId}`,t=Array.isArray(this.modelValue)?this.modelValue:[];let l=null;t.length>0&&(l=t);const r=null==l?null:this.serializeForPostMessage(l),a={...this.extraQuery};this.extraQueryFn&&Object.assign(a,this.extraQueryFn());const o={type:"OPEN_STORE_SELECT",field:this.field||"",multiple:this.multiple,currentValue:r,valueKey:this.valueKey,labelKey:this.labelKey,extraQuery:a,messageId:e};if(window.parent&&window.parent!==window)try{window.parent.postMessage(o,"*")}catch(e){console.error("CusStoreSelect: 发送消息失败",e)}else console.warn("CusStoreSelect: 当前不在 iframe 环境中,无法向父窗口发送消息");this.pendingCallbacks[e]=(e,t)=>{t&&Array.isArray(t)&&t.length>0&&this.mergeOptions(t),this.sourceItems=t,this.handleUpdate(e),this.handleChange(e)}},handleMessage(e){const t=e.data;if(t&&"STORE_SELECT_RESULT"===t.type){const{field:e,value:l,sourceItems:r,messageId:a}=t;if(e!==this.field)return;const o=this.pendingCallbacks[a];o&&(o(l,r),delete this.pendingCallbacks[a])}},mergeOptions(e){if(!Array.isArray(e)||0===e.length)return;const t=new Map;this.internalOptions.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),e.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),this.internalOptions=Array.from(t.values())},handleUpdate(e){this.$emit("update:modelValue",e),this.triggerValidate()},handleChange(e){this.$emit("change",e,this.sourceItems&&this.sourceItems.length>0?this.multiple?this.sourceItems:this.sourceItems[0]:this.multiple?[]:null)},triggerValidate(){this.$nextTick(()=>{this.$nextTick(()=>{try{if(this.formCreateInject&&this.formCreateInject.api&&this.field)return void this.formCreateInject.api.validateField(this.field).catch(()=>{});let e=this.$parent;for(;e;){if(e.$options&&"FormCreate"===e.$options.name&&e.fapi){this.field&&e.fapi.validateField&&e.fapi.validateField(this.field).catch(()=>{});break}e=e.$parent}}catch(e){console.warn("CusStoreSelect: 触发校验失败",e)}})})}}});Z.render=function(e,t,l,r,s,i){const n=f("CusSelect");return a(),o("div",{onClick:t[1]||(t[1]=(...t)=>e.handleClick&&e.handleClick(...t))},[m(n,{"model-value":e.modelValue,options:e.mergedOptions,"source-items":e.sourceItems,"onUpdate:sourceItems":t[0]||(t[0]=t=>e.sourceItems=t),multiple:e.multiple,"max-tag-count":e.maxTagCount,placeholder:e.placeholder,disabled:e.disabled,style:d(e.style),valueKey:e.valueKey,labelKey:e.labelKey,allowClear:e.allowClear,bordered:e.bordered,"onUpdate:modelValue":e.handleUpdate,onChange:e.handleChange},null,8,["model-value","options","source-items","multiple","max-tag-count","placeholder","disabled","style","valueKey","labelKey","allowClear","bordered","onUpdate:modelValue","onChange"])])};var ee=i({name:"CusUserSelect",components:{CusSelect:K},props:{formCreateInject:{type:Object,default:null},modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},maxTagCount:{type:Number,default:void 0},placeholder:{type:String,default:"请选择"},disabled:{type:Boolean,default:!1},style:{type:[String,Object],default:()=>({width:"100%"})},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},allowClear:{type:Boolean,default:!1},field:{type:String,default:""},bordered:{type:Boolean,default:!0},selectType:{type:[String,Number],default:null},extraQuery:{type:Object,default:()=>({})},extraQueryFn:{type:Function,default:()=>{}}},emits:["update:modelValue","change"],data:()=>({messageId:0,pendingCallbacks:{},internalOptions:[],sourceItems:[]}),computed:{mergedOptions(){if(this.internalOptions.length>0){const e=new Map;return this.options.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),this.internalOptions.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),Array.from(e.values())}return this.options}},watch:{options:{immediate:!0,handler(e){0===this.internalOptions.length&&Array.isArray(e)&&e.length>0&&(this.internalOptions=[...e])}}},mounted(){window.addEventListener("message",this.handleMessage)},beforeUnmount(){window.removeEventListener("message",this.handleMessage)},methods:{serializeForPostMessage(e){if(null==e)return e;try{return JSON.parse(JSON.stringify(e))}catch(t){if(console.warn("CusUserSelect: 数据序列化失败,尝试递归处理",t),Array.isArray(e))return 0===e.length?[]:e.map(e=>this.serializeForPostMessage(e));if("object"==typeof e){const t={};for(const l in e)if(Object.prototype.hasOwnProperty.call(e,l))try{t[l]=this.serializeForPostMessage(e[l])}catch(e){console.warn("CusUserSelect: 跳过无法序列化的属性: "+l,e)}return t}return e}},handleClick(){if(this.disabled)return;const e=`user-select-${this.field||"default"}-${Date.now()}-${++this.messageId}`,t=Array.isArray(this.modelValue)?this.modelValue:[];let l=null;t.length>0&&(l=t);const r=null==l?null:this.serializeForPostMessage(l),a={...this.extraQuery};this.extraQueryFn&&Object.assign(a,this.extraQueryFn());const o={type:"OPEN_USER_SELECT",field:this.field||"",multiple:this.multiple,currentValue:r,valueKey:this.valueKey,labelKey:this.labelKey,selectType:this.selectType,extraQuery:a,messageId:e};if(window.parent&&window.parent!==window)try{window.parent.postMessage(o,"*")}catch(e){console.error("CusUserSelect: 发送消息失败",e)}else console.warn("CusUserSelect: 当前不在 iframe 环境中,无法向父窗口发送消息");this.pendingCallbacks[e]=(e,t)=>{t&&Array.isArray(t)&&t.length>0&&this.mergeOptions(t),this.sourceItems=t,this.handleUpdate(e),this.handleChange(e)}},handleMessage(e){const t=e.data;if(t&&"USER_SELECT_RESULT"===t.type){const{field:e,value:l,sourceItems:r,messageId:a}=t;if(e!==this.field)return;const o=this.pendingCallbacks[a];o&&(o(l,r),delete this.pendingCallbacks[a])}},mergeOptions(e){if(!Array.isArray(e)||0===e.length)return;const t=new Map;this.internalOptions.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),e.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),this.internalOptions=Array.from(t.values())},handleUpdate(e){this.$emit("update:modelValue",e),this.triggerValidate()},handleChange(e){this.$emit("change",e,this.sourceItems&&this.sourceItems.length>0?this.multiple?this.sourceItems:this.sourceItems[0]:this.multiple?[]:null)},triggerValidate(){this.$nextTick(()=>{this.$nextTick(()=>{try{if(this.formCreateInject&&this.formCreateInject.api&&this.field)return void this.formCreateInject.api.validateField(this.field).catch(()=>{});let e=this.$parent;for(;e;){if(e.$options&&"FormCreate"===e.$options.name&&e.fapi){this.field&&e.fapi.validateField&&e.fapi.validateField(this.field).catch(()=>{});break}e=e.$parent}}catch(e){console.warn("CusUserSelect: 触发校验失败",e)}})})}}});ee.render=function(e,t,l,r,s,i){const n=f("CusSelect");return a(),o("div",{onClick:t[1]||(t[1]=(...t)=>e.handleClick&&e.handleClick(...t))},[m(n,{"model-value":e.modelValue,options:e.mergedOptions,"source-items":e.sourceItems,"onUpdate:sourceItems":t[0]||(t[0]=t=>e.sourceItems=t),multiple:e.multiple,"max-tag-count":e.maxTagCount,placeholder:e.placeholder,disabled:e.disabled,style:d(e.style),valueKey:e.valueKey,labelKey:e.labelKey,allowClear:e.allowClear,bordered:e.bordered,"onUpdate:modelValue":e.handleUpdate,onChange:e.handleChange},null,8,["model-value","options","source-items","multiple","max-tag-count","placeholder","disabled","style","valueKey","labelKey","allowClear","bordered","onUpdate:modelValue","onChange"])])};var te={name:"TableForm",emits:["change","add","delete","update:modelValue"],props:{formCreateInject:Object,modelValue:{type:Array,default:()=>[]},columns:{type:Array,required:!0,default:()=>[]},filterEmptyColumn:{type:Boolean,default:!0},deletable:{type:Boolean,default:!0},addable:{type:Boolean,default:!0},options:{type:Object,default:()=>y({submitBtn:!1,resetBtn:!1})},min:Number,max:Number,disabled:Boolean},watch:{modelValue:{handler(){this.updateTable()},deep:!0},"formCreateInject.preview":function(e){this.emptyRule.children[0].props.colspan=this.columns.length+(e?1:2)}},data(){return{rule:[],trs:[],fapi:{},Form:v(this.formCreateInject.form.$form()),copyTrs:"",oldValue:"",emptyRule:{type:"tr",_isEmpty:!0,native:!0,subRule:!0,children:[{type:"td",style:{textAlign:"center"},native:!0,subRule:!0,props:{colspan:this.columns.length+(this.formCreateInject.preview?1:2)},children:[this.formCreateInject.t("dataEmpty")||"暂无数据"]}]}}},methods:{formChange(){this.updateValue()},updateValue(){const e=this.trs.map((e,t)=>({...this.modelValue[t]||{},...this.fapi.getChildrenFormData(e)})).filter(e=>{if(!this.filterEmptyColumn)return!0;if(null==e)return!1;let t=!1;return Object.keys(e).forEach(l=>{t=t||void 0!==e[l]&&""!==e[l]&&null!==e[l]}),t}),t=JSON.stringify(e);t!==this.oldValue&&(this.oldValue=t,this.$emit("update:modelValue",e),this.$emit("change",e))},setRawData(e,t){const l=this.trs[e];this.fapi.setChildrenFormData(l,t,!0)},updateTable(){const e=JSON.stringify(this.modelValue);this.oldValue!==e&&(this.oldValue=e,this.trs=this.trs.splice(0,this.modelValue.length),this.modelValue.length?this.clearEmpty():this.addEmpty(),this.modelValue.forEach((e,t)=>{this.trs[t]||this.addRaw(),this.setRawData(t,e||{})}),this.rule[0].children[1].children=this.trs)},addEmpty(){this.trs.length&&this.trs.splice(0,this.trs.length),this.trs.push(this.emptyRule)},clearEmpty(){this.trs[0]&&this.trs[0]._isEmpty&&this.trs.splice(0,1)},delRaw(e){this.disabled||!this.deletable||this.min>0&&this.trs.length<=this.min||(this.trs.splice(e,1),this.updateValue(),this.trs.length?this.trs.forEach(e=>this.updateRaw(e)):this.addEmpty(),this.$emit("delete",e))},addRaw(e){if(e&&this.disabled)return;const t=this.formCreateInject.form.parseJson(this.copyTrs)[0];1===this.trs.length&&this.trs[0]._isEmpty&&this.trs.splice(0,1),this.trs.push(t),this.updateRaw(t),e&&(this.$emit("add",this.trs.length),this.updateValue())},updateRaw(e){const t=this.trs.indexOf(e);e.children[0].props.innerText=t+1,e.children[e.children.length-1].children[0].props.onClick=()=>{this.delRaw(t)}},loadRule(){const e=[{type:"th",native:!0,class:"_fc-tf-head-idx",props:{innerText:"#"}}];let t=[{type:"td",class:"_fc-tf-idx",native:!0,props:{innerText:"0"}}];this.columns.forEach(l=>{e.push({type:"th",native:!0,style:{...l.style||{},textAlign:l.align||"center"},class:l.required?"_fc-tf-head-required":"",props:{innerText:l.label||""}}),t.push({type:"td",native:!0,children:[...l.rule||[]]})}),e.push({type:"th",native:!0,class:"_fc-tf-edit fc-clock",props:{innerText:this.formCreateInject.t("operation")||"操作"}}),t.push({type:"td",native:!0,class:"_fc-tf-btn fc-clock",children:[{type:"i",native:!0,class:"fc-icon icon-delete",props:{}}]}),this.copyTrs=this.formCreateInject.form.toJson([{type:"tr",native:!0,subRule:!0,children:t}]),this.rule=[{type:"table",native:!0,class:"_fc-tf-table",props:{border:"1",cellspacing:"0",cellpadding:"0"},children:[{type:"thead",native:!0,children:[{type:"tr",native:!0,children:e}]},{type:"tbody",native:!0,children:this.trs}]}]}},created(){this.loadRule()},mounted(){this.updateTable()}};te.render=function(e,t,l,r,i,n){const d=f("a-button");return a(),o("div",{class:p(["_fc-table-form",{"_fc-disabled":l.disabled}])},[(a(),g(b(i.Form),{option:l.options,rule:i.rule,extendOption:!0,disabled:l.disabled,onChange:n.formChange,api:i.fapi,"onUpdate:api":t[0]||(t[0]=e=>i.fapi=e),onEmitEvent:e.$emit},null,40,["option","rule","disabled","onChange","api","onEmitEvent"])),l.addable&&(!l.max||l.max>this.trs.length)?(a(),g(d,{key:0,type:"link",class:"fc-clock",onClick:t[1]||(t[1]=e=>n.addRaw(!0)),disabled:l.disabled},{default:w(()=>[t[2]||(t[2]=s("i",{class:"fc-icon icon-add-circle",style:{"font-weight":"700"}},null,-1)),C(" "+u(l.formCreateInject.t("add")||"添加"),1)]),_:1},8,["disabled"])):c("v-if",!0)],2)};var le=i({name:"TableFormView",data:()=>({})});const re={class:"_fd-table-form"},ae={key:0,class:"_fd-tf-wrap"},oe={key:1,class:"_fc-child-empty"};le.render=function(e,t,l,r,s,i){return a(),o("div",re,[e.$slots.default?(a(),o("div",ae,[x(e.$slots,"default")])):(a(),o("div",oe))])};var se=i({name:"TableFormColumnView",props:{label:String,align:String,width:[Number,String],color:String,required:Boolean},computed:{colStyle(){const e=this.width,t={width:V.Number(e)?e+"px":e&&"auto"!==e?e:"180px"};return this.color&&(t.color=this.color),t}},data:()=>({})});const ie={key:0,class:"_fd-tf-required"},ne={class:"_fd-tf-con"};se.render=function(e,t,l,r,i,n){return a(),o("div",{class:"_fd-tf-col",style:d(e.colStyle)},[s("div",{class:"_fd-tf-title",style:d({textAlign:e.align||"center"})},[e.required?(a(),o("span",ie,"*")):c("v-if",!0),C(u(e.label||""),1)],4),s("div",ne,[x(e.$slots,"default")])],4)};var ce=[e,t,l,r,R,K,Z,ee,te,le,se],pe={name:"checkbox",modelField:"value",mergeProp(e){const t=e.prop.props;F(t,"options")||(t.options=e.prop.options||[])}},de={...pe,name:"radio"},ue={...pe,name:"select",mergeProp(e){const t=e.prop.props;F(t,"options")||(t.options=e.prop.options||[]);const l=e.effectData("fetch");l&&!0===l.loading&&(t.disabled=!0,t.loading=!0)},render(e,t){const l=t.effectData("fetch");if(l&&!0===l.loading&&e.loading){const l={...e};return l.notFoundContent=e.loading,t.$render.defaultRender(t,l)}return t.$render.defaultRender(t,e)}},he={name:"cascader",mergeProp(e){const t=e.prop.props;F(t,"options")||(t.options=e.prop.options||[]);const l=e.effectData("fetch");if(l&&!0===l.loading&&(t.disabled=!0,t.loading=!0),t.loadData){var r;const l=null===(r=e.$handle)||void 0===r?void 0:r.api,a=e.rule,o=e;let s=V.String(t.loadData)?I(t.loadData):t.loadData;if(!V.Function(s)&&V.String(t.loadData))try{const e=t.loadData.trim();e.startsWith("function")||e.startsWith("[[FORM-CREATE-PREFIX-function")||e.startsWith("$FNX:")||(s=new Function("selectedOptions","options","updateOptions","api","rule",e))}catch(e){console.error("Failed to parse loadData:",e)}V.Function(s)&&(t.loadData=function(e){if(!e||0===e.length)return;const r=e[e.length-1];if(!0===(null==r?void 0:r.isLeaf))return;const i=t.options||[],n=()=>{var e,s;const i=t.options||[];let n=-1;r&&(n=i.findIndex(e=>e.value===r.value||e.id===r.id||e===r));const c=i.map((e,t)=>{if(t===n&&r){return{...r}}return{...e}}),p=o.effectData("fetch");p&&A(p,"props.options",c),t.options=c,null!==(e=o.prop)&&void 0!==e&&e.props&&(o.prop.props.options=c),null!==(s=o.rule)&&void 0!==s&&s.props&&(o.rule.props.options=c),l&&a&&l.sync(a),o.$handle&&o.$handle.refresh()};r&&(r.loading=!0,n());const c=s.call(this,e,i,n,l,a);return c&&"function"==typeof c.then?c.finally(()=>{n()}):c})}},render(e,t){const l=t.effectData("fetch");if(l&&!0===l.loading&&e.loading){const l={...e};return l.notFoundContent=e.loading,t.$render.defaultRender(t,l)}return t.$render.defaultRender(t,e)}};const fe={date:"YYYY-MM-DD",month:"YYYY-MM",week:"YYYY-wo",quarter:"YYYY-qQ",year:"YYYY"},me="datePicker";var ye={name:me,maker:["date","month","week"].reduce((e,t)=>(e[t]=P(me,{type:t}),e),{dateRange:P(me,{type:"range"}),datetimeRange:P(me,e=>e.props({type:"range",showTime:!0}))}),modelField:"value",mergeProp(e){const t=e.prop.props,l=t.type||t.picker;t.valueFormat||(t.valueFormat=(fe[l]||fe.date)+(!t.showTime||l&&"date"!==l?"":" HH:mm:ss"))},render:(e,t)=>t.$render.vNode[(!0===t.prop.props.range?"range":"date")+"Picker"](t.prop,e)};var ve={name:"hidden",maker:{hidden:(e,t)=>P("hidden")("",e,t)},render:()=>[]},ge={name:"text",loadChildren:!1,mounted(e){var t,l;const r=e.rule.props||{},a=e.rule.bindField||r.bindField||(null===(t=e.prop.props)||void 0===t?void 0:t.bindField),o=e.rule.template||r.template||(null===(l=e.prop.props)||void 0===l?void 0:l.template);(o||a)&&setTimeout(()=>{if(e.$handle&&e.$handle.api)try{let t="";if(o){const l=e.$handle.api.formData();t=e.$handle.loadStrVar(o,t=>{const r=e.$handle.api.getValue(t);return void 0===r&&l&&void 0!==l[t]?l[t]:r},null)}else a&&(t=e.$handle.api.getValue(a)||"");null!=t&&(e.rule.children||(e.rule.children=[]),e.rule.children[0]=String(t),e.$handle.api.sync(e.rule),e.$handle.refresh())}catch(e){}},500)},renderChildren:(e,t)=>({default:()=>{var l;let r=null===(l=t.rule)||void 0===l?void 0:l.children;r||(r=e);return(Array.isArray(r)?r:[r]).filter(e=>null!=e).map(e=>V.String(e)?e:String(e)).join("")||""}}),mergeProp(e){var t,l,r;const a=e.rule.props||{},o=e.rule.bindField||a.bindField||(null===(t=e.prop.props)||void 0===t?void 0:t.bindField),s=e.rule.template||a.template||(null===(l=e.prop.props)||void 0===l?void 0:l.template);let i=e.rule.bindMode||a.bindMode||(null===(r=e.prop.props)||void 0===r?void 0:r.bindMode);if(i||(i=s?"template":o?"field":"static"),"field"===i&&o){const t={attr:o,to:"child",modify:!0,wait:300,watch:!0};e.rule.effect||(e.rule.effect={}),e.rule.effect.loadData||(e.rule.effect.loadData=[]);e.rule.effect.loadData.some(e=>e.attr===o&&"child"===e.to)||(e.rule.effect.loadData.push(t),e.$handle&&e.$handle.effect&&e.$handle.effect(e,"loaded"))}else if("template"===i&&s){const t={template:s,to:"child",modify:!0,wait:300,watch:!0};e.rule.effect||(e.rule.effect={}),e.rule.effect.loadData||(e.rule.effect.loadData=[]);if(!e.rule.effect.loadData.some(e=>e.template===s&&"child"===e.to)&&(e.rule.effect.loadData.push(t),e.$handle&&e.$handle.effect&&(e.$handle.effect(e,"loaded"),!e._textLoadDataWatched))){e._textLoadDataWatched=!0;const t=k(e.rule.effect,"loadData");e.watch.push(S(t,(t,l)=>{e.$handle.effect(e,"watch",{loadData:t})},{deep:!0}))}}null==e.rule.formCreateChild||e.rule.children||(e.rule.children=[e.rule.formCreateChild]),e.rule.children||(e.rule.children=[]),("field"===i&&o||"template"===i&&s)&&(!e.rule.children||Array.isArray(e.rule.children)&&0===e.rule.children.length)&&(e.rule.children="template"===i?[""]:[" "])},render(e,t){let l="";if(e&&"function"==typeof e.default)try{l=e.default()||""}catch(e){l=""}l=null==l||void 0===l?"":String(l);const r={...t.prop};r.props||(r.props={}),"text"===r.type&&(r.type="div"),delete r.props.innerHTML;return t.vNode.make("div",r,[l])}};var be={name:"input",maker:["password","url","email","text","textarea","search"].reduce((e,t)=>(e[t]=P("input",{type:t}),e),{idate:P("input",{type:"date"})}),modelField:"value",render(e,t){let l=t.prop.props.type;return-1===["textarea","search","password"].indexOf(l)&&(l="input"),l={textarea:"aTextarea",search:"aInputSearch",password:"aInputPassword"}[l]||"aInput",t.$render.vNode.make(l,t.prop,e)}},we={name:"timePicker",modelField:"value",mergeProp(e){const t=e.prop.props;t.valueFormat||(t.valueFormat="HH:mm:ss")},render:(e,t)=>t.$render.vNode["time"+(!0===t.prop.props.range?"Range":"")+"Picker"](t.prop,e)},Ce={name:"tree",modelField:"checkedKeys",mergeProp(e){const t=e.prop.props;t.fieldNames?t.fieldNames.key||(t.fieldNames.key="id"):t.fieldNames={key:"id"},t.checkedKeys=e.rule.value,t.checkable=!0}},xe={name:"FcRow",render:(e,t)=>t.vNode.col({props:{span:24}},{default:()=>[t.vNode.row(t.prop,e)]})};var ke=[pe,ye,{...ye,name:"rangePicker",maker:{},render:(e,t)=>t.$render.vNode.rangePicker(t.prop,e)},ve,ge,be,we,{...we,name:"timeRangePicker",render:(e,t)=>t.$render.vNode.timeRangePicker(t.prop,e)},Ce,de,ue,he,xe,{name:"cusStoreSelect",modelField:"modelValue",toFormValue:(e,t)=>null==e||""===e?[]:Array.isArray(e)?e.map(e=>("object"!=typeof e||null===e||void 0===e.value&&e.label,e)):[e],toValue:(e,t)=>e,mergeProp(e){const t=e.prop.props;if(F(t,"options")||(t.options=e.prop.options||[]),F(t,"field")||(t.field=e.rule.field||""),void 0!==e.rule.value){const t=e.rule.value;null==t||""===t?e.rule.value=[]:Array.isArray(t)||(e.rule.value=[t])}},render(e,t){const l=t.$render.defaultRender(t,e);if(l&&l.props&&l.props.on){const e=l.props.on["update:modelValue"],r=()=>{$(()=>{$(()=>{try{const e=t.rule.field;if(e)return void t.$handle.api.validateField(e).catch(()=>{});const l=t.$handle.getFieldCtx(t.rule.field);l&&l.id&&t.$handle.$manager.validateField(l.id).catch(()=>{})}catch(e){console.warn("CusStoreSelect: 触发校验失败",e)}})})};l.props.on["update:modelValue"]=(...t)=>{e&&e(...t),r()};const a=l.props.on.change;l.props.on.change=a?(...e)=>{a(...e),r()}:r}return l}},{name:"cusUserSelect",modelField:"modelValue",toFormValue:(e,t)=>null==e||""===e?[]:Array.isArray(e)?e.map(e=>("object"!=typeof e||null===e||void 0===e.value&&e.label,e)):[e],toValue:(e,t)=>e,mergeProp(e){const t=e.prop.props;if(F(t,"options")||(t.options=e.prop.options||[]),F(t,"field")||(t.field=e.rule.field||""),F(t,"formCreateInject")||(t.formCreateInject=e.inject),void 0!==e.rule.value){const t=e.rule.value;null==t||""===t?e.rule.value=[]:Array.isArray(t)||(e.rule.value=[t])}},render(e,t){const l=t.$render.defaultRender(t,e);if(l&&l.props&&l.props.on){const e=l.props.on["update:modelValue"],r=()=>{$(()=>{$(()=>{try{const e=t.rule.field;if(e)return void t.$handle.api.validateField(e).catch(()=>{});const l=t.$handle.getFieldCtx(t.rule.field);l&&l.id&&t.$handle.$manager.validateField(l.id).catch(()=>{})}catch(e){console.warn("CusUserSelect: 触发校验失败",e)}})})};l.props.on["update:modelValue"]=(...t)=>{e&&e(...t),r()};const a=l.props.on.change;l.props.on.change=a?(...e)=>{a(...e),r()}:r}return l}},{name:"flex",mergeProp(e){var t;const l=e.rule.props||{},r=l.flexDirection||e.rule.flexDirection||"row",a=l.flexWrap||e.rule.flexWrap||"nowrap",o=l.justifyContent||e.rule.justifyContent||"flex-start",s=l.alignItems||e.rule.alignItems||"flex-start",i=l.alignContent||e.rule.alignContent||"flex-start",n="column"===r||"column-reverse"===r,c={"flex-start":"start","flex-end":"end",center:"center","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"}[o]||"start",p={"flex-start":"start","flex-end":"end",center:"center",baseline:"baseline",stretch:"stretch"}[s]||"start";e.prop.props||(e.prop.props={}),e.prop.props.vertical=n,e.prop.props.justify=c,e.prop.props.align=p,void 0!==l.gap&&(e.prop.props.gap=l.gap);const d=e.rule.style||{},{display:u,flexDirection:h,flexWrap:f,justifyContent:m,alignItems:y,alignContent:v,...g}=d,b={display:u||"flex",flexWrap:a,...g};i&&"flex-start"!==i&&(b.alignContent=i);const w=e.prop.style||{},C=(null===(t=e.prop.props)||void 0===t?void 0:t.style)||{};e.prop.style={...w,...b},e.prop.props||(e.prop.props={}),e.prop.props.style={...C,...b},e.rule.children||(e.rule.children=[]),e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.forEach(e=>{e&&"object"==typeof e&&"DragTool"===!e.type&&"DragBox"===!e.type&&(void 0===e.col||null===e.col?e.col=!1:e.col&&"object"==typeof e.col&&!1!==e.col.show&&(e.col.show=!1))})},render(e,t){var l,r;const a={...t.prop};"flex"===a.type&&(a.type="a-flex");const o=(t.rule.props||{}).flexDirection||t.rule.flexDirection||"row",s="column"===o||"column-reverse"===o;a.props||(a.props={});const i=()=>{a.class||(a.class=[]),Array.isArray(a.class)||(a.class=[a.class])},n=null!==(l=null===(r=t.rule.props)||void 0===r?void 0:r.childFlex)&&void 0!==l?l:t.rule.childFlex;if(null!=n&&""!==n){i(),a.class.includes("_fc-flex-container")||a.class.push("_fc-flex-container");const e=String(n).trim();a.props.style||(a.props.style={}),a.props.style["--fc-child-flex"]=e,a.style||(a.style={}),a.style["--fc-child-flex"]=e}if(s){var c,p,d;const e=null!==(c=null!==(p=null===(d=t.rule.props)||void 0===d?void 0:d.childWidth)&&void 0!==p?p:t.rule.childWidth)&&void 0!==c?c:"100%";i(),a.class.includes("_fc-flex-container")||a.class.push("_fc-flex-container"),a.class.includes("_fc-flex-vertical")||a.class.push("_fc-flex-vertical");const l=String(e).trim();a.props.style||(a.props.style={}),a.props.style["--fc-child-width"]=l,a.style||(a.style={}),a.style["--fc-child-width"]=l}const u=e||[];return t.vNode.col({props:{span:24}},{default:()=>[t.vNode.make("a-flex",a,u)]})}},{name:"space",mergeProp(e){const t=e.rule.props||{},l=t.direction||e.rule.direction||"horizontal",r=t.size||e.rule.size||"small",a=t.align||e.rule.align,o=t.wrap||e.rule.wrap||!1;e.prop.props||(e.prop.props={}),e.prop.props.direction=l,e.prop.props.size=r,null!=a&&""!==a&&(e.prop.props.align=a),e.prop.props.wrap=o;const s={width:"100%",...e.rule.style||{}};e.prop.style||(e.prop.style={}),e.prop.style={...e.prop.style,...s},e.prop.props.style||(e.prop.props.style={}),e.prop.props.style={...e.prop.props.style,...s},e.rule.children||(e.rule.children=[]),e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.forEach(e=>{e&&"object"==typeof e&&"DragTool"!==e.type&&"DragBox"!==e.type&&(void 0===e.col||null===e.col?e.col=!1:e.col&&"object"==typeof e.col&&!1!==e.col.show&&(e.col.show=!1))})},render(e,t){const l={...t.prop};(t.rule.props||{}).compact||t.rule.compact||!1?l.type="a-space-compact":"space"===l.type&&(l.type="a-space");const r=e||[];return t.vNode.col({props:{span:24}},{default:()=>[t.vNode.make(l.type,l,r)]})}},{name:"spin",mergeProp(e){var t,l,r,a,o,s,i,n,c;e.rule.wrap||(e.rule.wrap={}),e.rule.wrap.title=!1;const p=e.prop.props||{},d=null===(t=null!==(l=null!==(r=e.rule.containerMode)&&void 0!==r?r:null===(a=e.rule.props)||void 0===a?void 0:a.containerMode)&&void 0!==l?l:null===(o=e.prop.props)||void 0===o?void 0:o.containerMode)||void 0===t||t;var u,h,f,m;(d||(e.rule.children=[]),F(p,"spinning"))||(p.spinning=null!==(u=null!==(h=null===(f=e.prop.props)||void 0===f?void 0:f.spinning)&&void 0!==h?h:null===(m=e.rule.props)||void 0===m?void 0:m.spinning)&&void 0!==u&&u);const y=e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.length>0;!d&&!y&&p.spinning;const v=e.rule.bindField||(null===(s=e.rule.props)||void 0===s?void 0:s.bindField)||(null===(i=e.prop.props)||void 0===i?void 0:i.bindField);let g=e.rule.bindMode||(null===(n=e.rule.props)||void 0===n?void 0:n.bindMode)||(null===(c=e.prop.props)||void 0===c?void 0:c.bindMode);if(g||(g=v?"field":"static"),"field"===g&&v){const t={attr:v,to:"props.spinning",modify:!0,wait:300,watch:!0};e.rule.effect||(e.rule.effect={}),e.rule.effect.loadData||(e.rule.effect.loadData=[]);e.rule.effect.loadData.some(e=>e.attr===v&&"props.spinning"===e.to)||(e.rule.effect.loadData.push(t),e.$handle&&e.$handle.effect&&e.$handle.effect(e,"loaded"))}if(d){e.rule.children||(e.rule.children=[]);if(e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.some(e=>!(!e||"object"!=typeof e)&&("DragTool"!==e.type&&"DragBox"!==e.type))){e.rule.wrap.class||(e.rule.wrap.class="");const t="string"==typeof e.rule.wrap.class?e.rule.wrap.class.split(" ").filter(Boolean):Array.isArray(e.rule.wrap.class)?e.rule.wrap.class:[];t.includes("_fc-spin-wrap-fit")||(t.push("_fc-spin-wrap-fit"),e.rule.wrap.class=t.join(" ")),e.rule.wrap.style||(e.rule.wrap.style={}),e.rule.wrap.style.width="fit-content",e.rule.wrap.style.display="inline-block"}e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.forEach(e=>{e&&"object"==typeof e&&"DragTool"!==e.type&&"DragBox"!==e.type&&(void 0===e.col||null===e.col?e.col=!1:e.col&&"object"==typeof e.col&&!1!==e.col.show&&(e.col.show=!1))})}},render(e,t){var l,r,a,o,s,i,n,c,p,d,u;const h=(t.prop.props||{}).spinning||!1;t.prop.props||(t.prop.props={}),t.prop.props.spinning=h;const f=t.rule.tip||(null===(l=t.rule.props)||void 0===l?void 0:l.tip)||(null===(r=t.prop.props)||void 0===r?void 0:r.tip);f&&(t.prop.props.tip=f);const m=t.rule.delay||(null===(a=t.rule.props)||void 0===a?void 0:a.delay)||(null===(o=t.prop.props)||void 0===o?void 0:o.delay);null!=m&&(t.prop.props.delay=m);const y=t.rule.size||(null===(s=t.rule.props)||void 0===s?void 0:s.size)||(null===(i=t.prop.props)||void 0===i?void 0:i.size);y&&(t.prop.props.size=y),"spin"===t.prop.type&&(t.prop.type="a-spin");if(!(null===(n=null!==(c=null!==(p=t.rule.containerMode)&&void 0!==p?p:null===(d=t.rule.props)||void 0===d?void 0:d.containerMode)&&void 0!==c?c:null===(u=t.prop.props)||void 0===u?void 0:u.containerMode)||void 0===n||n))return t.$render.defaultRender(t,void 0);const v=e&&Array.isArray(e)?e:e||[],g=v&&Array.isArray(v)&&v.some(e=>{var t;if(!e||"object"!=typeof e)return!1;const l=(null===(t=e.type)||void 0===t?void 0:t.name)||e.type;return"DragTool"!==l&&"DragBox"!==l});return g&&(t.prop.class||(t.prop.class=[]),Array.isArray(t.prop.class)||(t.prop.class=[t.prop.class]),t.prop.class.includes("_fc-spin-container")||t.prop.class.push("_fc-spin-container")),t.vNode.col({props:{span:24},class:g?"_fc-spin-col-fit":""},{default:()=>[t.vNode.make("a-spin",t.prop,v)]})}}];var Se={tooltip:"aTooltip",popover:"aPopover",button:"aButton",icon:"aIcon",slider:"aSlider",rate:"aRate",upload:"fcUpload",cascader:"aCascader",timePicker:"aTimePicker",timeRangePicker:"aTimeRangePicker",datePicker:"aDatePicker",rangePicker:"aRangePicker",switch:"aSwitch",select:"aSelect",checkbox:"aCheckboxGroup",radio:"aRadioGroup",input:"aInput",inputNumber:"aInputNumber",treeSelect:"aTreeSelect",search:"aInputSearch",inputPassword:"aInputPassword",textarea:"aTextarea",formItem:"aFormItem",form:"aForm",frame:"fcFrame",col:"aCol",row:"aRow",flex:"aFlex",space:"aSpace","space-compact":"aSpaceCompact",spin:"aSpin",tree:"aTree",autoComplete:"aAutoComplete",transfer:"aTransfer",group:"fcGroup",array:"fcGroup",subForm:"fcSubForm",object:"fcSubForm"};function $e(e,t){F(e,t)&&V.String(e[t])&&(e[t]={[t]:e[t],show:!0})}function Ve(e){return!1===e}function Fe(e){const t={...e};return delete t.children,t}var Ie={validate(){const e=this.form();return e?e.validate():new Promise(e=>e())},validateField(e){const t=this.form();return t?t.validateFields(e):new Promise(e=>e())},clearValidateState(e){const t=this.vm.refs[e.wrapRef];t&&t.clearValidate()},tidyOptions:e=>(["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(t=>{!function(e,t){F(e,t)&&!V.Object(e[t])&&(e[t]={show:!!e[t]})}(e,t)}),e),tidyRule:({prop:e})=>($e(e,"title"),$e(e,"info"),e),mergeProp(e){const t={info:{type:"popover",placement:"topLeft",icon:"QuestionCircleOutlined"},title:{},col:{span:24},wrap:{}};if(["info","wrap","col","title"].forEach(l=>{e.prop[l]=O([this.options[l]||{},e.prop[l]||{}],t[l])}),e.parent&&e.parent.rule){const t=e.parent.rule.type,l=e.parent.rule._menu;"flex"!==t&&"a-flex"!==t&&"flex"!==(null==l?void 0:l.name)&&"space"!==t&&"a-space"!==t&&"space"!==(null==l?void 0:l.name)||(e.prop.col=!1,e.rule&&(e.rule.col=!1))}if("upload"!==e.rule.type||e.prop.props.onPreview){if("upload"===e.rule.type&&e.prop.props.onPreview){const t=e.prop.props.onPreview,l=function(e){window.parent&&window.parent!==window&&window.parent.postMessage({type:"upload-preview",file:{url:e.url,name:e.name,uid:e.uid,size:e.size,type:e.type},timestamp:Date.now()},"*")};e.prop.props.onPreview=function(e){l(e),t&&"function"==typeof t&&t.apply(this,arguments)}}}else{const t=function(e){window.parent&&window.parent!==window&&window.parent.postMessage({type:"upload-preview",file:{url:e.url,name:e.name,uid:e.uid,size:e.size,type:e.type},timestamp:Date.now()},"*")};e.prop.props.onPreview=function(e){t(e)}}},getDefaultOptions:()=>({form:{hideRequiredMark:!1,layout:"horizontal",labelAlign:"right",labelCol:{span:3},wrapperCol:{span:21},validateOnRuleChange:!0},row:{gutter:0},submitBtn:{disabled:!1,loading:!1,type:"primary",innerText:"",show:!1,col:void 0,click:void 0},resetBtn:{disabled:!1,loading:!1,type:"default",innerText:"",show:!1,col:void 0,click:void 0}}),adapterValidate:(e,t)=>(e.validator=(e,l)=>new Promise((e,r)=>t(l,t=>{t?r(t):e()})),e),update(){const e=this.options.form;this.rule={props:{...e},on:{submit:e=>{e.preventDefault()}},style:e.style,type:"form"}},beforeRender(){const{key:e,ref:t,$handle:l}=this,r=this.options.form;T(this.rule,{key:e,ref:t,class:[r.className,r.class,"form-create",this.$handle.preview?"is-preview":""]}),T(this.rule.props,{model:l.formData})},render(e){return e.slotLen()&&!this.$handle.preview&&e.setSlot(void 0,()=>this.makeFormBtn()),this.$r(this.rule,Ve(this.options.row.show)?e.getSlots():[this.makeRow(e)])},makeWrap(e,t){const l=e.prop,r=`${this.key}${e.key}`,a=l.col,o=this.isTitle(l)&&!1!==l.wrap.title,{layout:s,col:i}=this.rule.props,n=l.wrap.class;delete l.wrap.class,delete l.wrap.title;let c=!1;if(e.parent&&e.parent.rule){const t=e.parent.rule.type,l=e.parent.rule._menu;"flex"!==t&&"a-flex"!==t&&"flex"!==(null==l?void 0:l.name)&&"space"!==t&&"a-space"!==t&&"space"!==(null==l?void 0:l.name)||(c=!0)}const p=Ve(l.wrap.show)?t:this.$r(O([l.wrap,{props:{...Fe(l.wrap||{}),hasFeedback:l.hasFeedback||!1,name:e.id,rules:e.injectValidate(),..."horizontal"!==s?{labelCol:{},wrapperCol:{}}:{}},class:this.$render.mergeClass(n||l.className,"fc-form-item"),key:r+"fi",ref:e.wrapRef,type:"formItem"}]),{default:()=>t,...o?{label:()=>this.makeInfo(l,r,e)}:{}});return"inline"===s||Ve(i)||Ve(a.show)||c?p:this.makeCol(l,r,[p])},isTitle(e){if(!1===this.options.form.title)return!1;const t=e.title;return!(!t.title&&!t.native||Ve(t.show))},makeInfo(e,t,l){var r,a;const o={...e.title},s={...e.info};if(!1===this.options.form.title)return!1;if(!o.title&&!o.native||Ve(o.show))return;const i="tooltip"===s.type;const n=this.getSlot("title"),c=[n?n({title:null===(r=l.refRule)||void 0===r||null===(r=r.__$title)||void 0===r?void 0:r.value,rule:l.rule,options:this.options}):null===(a=l.refRule)||void 0===a||null===(a=a.__$title)||void 0===a?void 0:a.value];if(!Ve(s.show)&&(s.info||s.native)&&!Ve(s.icon)){const e={type:s.type||"popover",props:Fe(s),key:t+"pop"};delete e.props.icon,delete e.props.show,delete e.props.info,delete e.props.align,delete e.props.native;const r=i?"title":"content";var p;if(s.info&&!F(e.props,r))e.props[r]=null===(p=l.refRule)||void 0===p||null===(p=p.__$info)||void 0===p?void 0:p.value;c["left"!==s.align?"unshift":"push"](this.$r(O([s,e]),{[o.slot||"default"]:()=>this.$r({type:!0===s.icon?"QuestionCircleOutlined":s.icon||"",props:{type:!0===s.icon?"QuestionCircleOutlined":s.icon},key:t+"i"})}))}const d=O([o,{props:Fe(o),key:t+"tit",class:"fc-form-title",type:o.type||"span"}]);return delete d.props.show,delete d.props.title,delete d.props.native,this.$r(d,c)},makeCol(e,t,l){const r=e.col;return this.$r({class:this.$render.mergeClass(r.class,"fc-form-col"),type:"col",props:r||{span:24},key:t+"col"},l)},makeRow(e){const t=this.options.row||{};return this.$r({type:"row",props:t,class:this.$render.mergeClass(t.class,"fc-form-row"),key:this.key+"row"},e)},makeFormBtn(){let e=[];if(Ve(this.options.submitBtn.show)||e.push(this.makeSubmitBtn()),Ve(this.options.resetBtn.show)||e.push(this.makeResetBtn()),!e.length)return;let{labelCol:t,wrapperCol:l,layout:r}=this.rule.props;"horizontal"!==r&&(t=l={});const a=this.$r({type:"formItem",class:"fc-form-item fc-form-footer",key:this.key+"fb",props:{labelCol:t,wrapperCol:l,label:" ",colon:!1}},e);return"inline"===r?a:this.$r({type:"col",class:"fc-form-col",props:{span:24},key:this.key+"fc"},[a])},makeResetBtn(){const e={...this.options.resetBtn},t=e.innerText||this.$handle.api.t("reset")||"重置";return delete e.innerText,delete e.click,delete e.col,delete e.show,this.$r({type:"button",props:e,class:"fc-reset-btn",style:{width:e.width,marginLeft:"10px"},on:{click:()=>{const e=this.$handle.api;this.options.resetBtn.click?this.options.resetBtn.click(e):e.resetFields()}},key:this.key+"b2"},[t])},makeSubmitBtn(){const e={...this.options.submitBtn},t=e.innerText||this.$handle.api.t("submit")||"提交";return delete e.innerText,delete e.click,delete e.col,delete e.show,this.$r({type:"button",props:e,class:"fc-submit-btn",style:{width:e.width},on:{click:()=>{const e=this.$handle.api;this.options.submitBtn.click?this.options.submitBtn.click(e):e.submit().catch(()=>{})}},key:this.key+"b1"},[t])}};const Ae={};var je;function Pe(e,t){return V.Boolean(e)?e={show:e}:V.Undef(e)||V.Object(e)||(e={show:t}),e}function Oe(e,t){return{formEl:()=>t.$manager.form(),wrapEl(e){const l=t.getFieldCtx(e);if(l)return t.vm.refs[l.wrapRef]},validate:l=>new Promise((r,a)=>{const o=e.children,s=[t.$manager.validate()];o.filter(e=>!e.isScope).forEach(e=>{s.push(e.validate())}),Promise.all(s).then(()=>{r(!0),l&&l(!0)}).catch(r=>{a(r),l&&l(r),t.vm.emit("validate-fail",r,{api:e}),t.emitEvent("validate-fail",r,{api:e})})}),validateField:(l,r)=>new Promise((a,o)=>{const s=t.getFieldCtx(l);if(!s)return;const i=t.subForm[s.id],n=[t.$manager.validateField(s.id)];B(i).filter(e=>!e.isScope).forEach(e=>{n.push(e.validate())}),Promise.all(n).then(()=>{a(null),r&&r(null)}).catch(a=>{o(a),r&&r(a),t.vm.emit("validate-field-fail",a,{field:l,api:e})})}),clearValidateState(l,r=!0){e.helper.tidyFields(l).forEach(e=>{r&&this.clearSubValidateState(e),t.getCtxs(e).forEach(e=>{t.$manager.clearValidateState(e)})})},clearSubValidateState(l){e.helper.tidyFields(l).forEach(e=>{t.getCtxs(e).forEach(e=>{const l=t.subForm[e.id];l&&(Array.isArray(l)?l.forEach(e=>{e.clearValidateState()}):l&&l.clearValidateState())})})},btn:{loading:(t=!0)=>{e.submitBtnProps({loading:!!t})},disabled:(t=!0)=>{e.submitBtnProps({disabled:!!t})},show:(t=!0)=>{e.submitBtnProps({show:!!t})}},resetBtn:{loading:(t=!0)=>{e.resetBtnProps({loading:!!t})},disabled:(t=!0)=>{e.resetBtnProps({disabled:!!t})},show:(t=!0)=>{e.resetBtnProps({show:!!t})}},submitBtnProps:(l={})=>{let r=Pe(t.options.submitBtn,!0);T(r,l),t.options.submitBtn=r,e.refreshOptions()},resetBtnProps:(l={})=>{let r=Pe(t.options.resetBtn,!1);T(r,l),t.options.resetBtn=r,e.refreshOptions()},submit:(l,r)=>new Promise((a,o)=>{(!1===t.options.validateOnSubmit?Promise.resolve():e.validate()).then(()=>{let r=e.formData();t.beforeSubmit(r).then(()=>{V.Function(l)&&E(()=>l(r,e)),V.Function(t.options.onSubmit)&&E(()=>t.options.onSubmit(r,e)),t.vm.emit("submit",r,e),a(r)}).catch(e=>{})}).catch((...t)=>{V.Function(r)&&E(()=>r(e,...t)),o(...t)})}),request:t=>("string"==typeof t&&(t={action:t}),e.fetch(t)),throttle(e,t){let l=0;return function(...r){const a=this,o=Date.now();o-l>=(t||0)&&(l=o,e.call(a,...r))}},debounce(e,t){let l=null;return function(...r){const a=this;null!==l&&clearTimeout(l),l=setTimeout(()=>{e.call(a,...r)},t||0)}}}}!function(e){["treeSelect","upload","frame","autoComplete","cascader","datePicker","frame","inputNumber","inputPassword","radio","rate","switch","rate","slider","timePicker"].reduce((e,t)=>(e[t]=P(t),e),e),e.auto=e.autoComplete,e.number=e.inputNumber,e.time=e.timePicker,e.password=e.inputPassword}(Ae),function(e){e.sliderRange=P("slider",{range:!0})}(Ae),function(e){const t={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};Object.keys(t).reduce((e,l)=>(e[l]=P("frame",e=>e.props({type:t[l][0],maxLength:t[l][1]})),e),e),e.frameInput=e.frameInputs,e.frameFile=e.frameFiles,e.frameImage=e.frameImages}(Ae),function(e){const t={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]};Object.keys(t).reduce((e,l)=>(e[l]=P("upload",e=>e.props({uploadType:t[l][0],maxLength:t[l][1]})),e),e),e.uploadImage=e.image,e.uploadFile=e.file}(Ae),(je=Ae).selectMultiple=P("select",{mode:"multiple"}),je.selectTags=P("select",{mode:"tags"}),je.selectCombobox=P("select",{mode:"combobox"}),function(e){e.cusStoreSelect=P("cusStoreSelect"),e.storeSelect=e.cusStoreSelect}(Ae),function(e){e.cusUserSelect=P("cusUserSelect"),e.userSelect=e.cusUserSelect}(Ae),function(e){e.text=P("text")}(Ae),function(e){e.flex=P("flex")}(Ae),function(e){e.space=P("space")}(Ae),function(e){e.spin=P("spin")}(Ae);var Te={autoComplete:"value",cascader:"value",inputNumber:"value",inputPassword:"value",textarea:"value",rate:"value",slider:"value",treeSelect:"value",switch:"checked",cusStoreSelect:"modelValue",cusUserSelect:"modelValue"};const Ee={name:"required",load(e,t,l){const r=function(e){return V.Boolean(e)?{required:e}:V.String(e)?{message:e}:V.Undef(e)?{required:!1}:V.Function(e)?{validator:e}:V.Object(e)?e:{}}(e.getValue());if(!1===r.required)e.clearProp(),l.clearValidateState([t.field]);else{var a;const o={required:!0,validator:(e,t)=>new Promise((e,l)=>{V.empty(t)?l(o.message):e()}),...r},s=null===(a=t.__fc__.refRule)||void 0===a||null===(a=a.__$title)||void 0===a?void 0:a.value;if(o.message){const e=o.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);e&&(o.message=l.t(e[1],{title:s}))}else o.message=l.t("required",{title:s})||s+("en"===l.getLocale()?" is required":"不能为空");e.getProp().validate=[o]}l.sync(t)},watch(...e){Ee.load(...e)}};function Be(e){e.componentAlias(Se),Object.keys(Te).forEach(t=>{e.setModelField(t,Te[t])}),ce.forEach(t=>{e.component(t.name,t)}),e.register(Ee),ke.forEach(t=>{e.parser(t)}),Object.keys(Ae).forEach(t=>{e.maker[t]=Ae[t]}),"undefined"!=typeof window&&window.antd&&e.useApp((e,t)=>{t.use(window.antd)})}const Re=j({ui:'"ant-design-vue"',version:'"3.2.71"',manager:Ie,install:Be,extendApi:Oe,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}});"undefined"!=typeof window&&(window.formCreate=Re);const De=Re.maker;export{Re as default,De as maker};
7
+ import e from"@form-create/component-antdv-upload/src/index";import t from"@form-create/component-antdv-frame/src/index";import l from"@form-create/component-antdv-group/src/index";import r from"@form-create/component-subform/src/index";import{openBlock as a,createElementBlock as o,createElementVNode as i,defineComponent as s,Fragment as n,createCommentVNode as p,normalizeClass as c,normalizeStyle as d,toDisplayString as u,renderList as h,resolveComponent as f,createVNode as m,reactive as y,markRaw as v,createBlock as g,resolveDynamicComponent as b,withCtx as w,createTextVNode as C,renderSlot as x,toRef as k,watch as S,nextTick as $}from"vue";import V,{hasProperty as F}from"@form-create/utils/lib/type";import{parseFn as I}from"@form-create/utils/lib/json";import P from"@form-create/utils/lib/deepset";import A,{creatorFactory as O}from"@longhongguo/form-create-core/src/index";import j from"@form-create/utils/lib/mergeprops";import E from"@form-create/utils/lib/extend";import{invoke as T}from"@longhongguo/form-create-core/src/frame/util";import B from"@form-create/utils/lib/toarray";var R={name:"QuestionCircleOutlined"};const D={class:"anticon"};R.render=function(e,t,l,r,s,n){return a(),o("span",D,[...t[0]||(t[0]=[i("svg",{height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[i("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",fill:"currentColor"}),i("path",{d:"M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7c-21.2 8.1-39.2 22.3-52.1 40.9c-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5c.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1 0 80 0a40 40 0 1 0-80 0z",fill:"currentColor"})],-1)])])};var K=s({name:"CusSelect",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},sourceItems:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},maxTagCount:{type:Number,default:void 0},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},style:{type:[String,Object],default:()=>({width:"100%"})},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},allowClear:{type:Boolean,default:!1},bordered:{type:Boolean,default:!0}},emits:["update:modelValue","update:sourceItems","change"],computed:{currentValue:{get(){return Array.isArray(this.modelValue)?this.modelValue.map(e=>"object"!=typeof e||null===e||void 0===e.value&&void 0===e[this.valueKey]?{[this.valueKey]:e,[this.labelKey]:this.getLabel(e)}:e):null===this.modelValue||void 0===this.modelValue||""===this.modelValue?[]:"object"==typeof this.modelValue?[this.modelValue]:[{value:this.modelValue,label:this.getLabel(this.modelValue)}]},set(e){let t=[];null!=e&&(t=Array.isArray(e)?e.map(e=>"object"!=typeof e||null===e||void 0===e.value&&void 0===e[this.valueKey]?{[this.valueKey]:e,[this.labelKey]:this.getLabel(e)}:e):"object"==typeof e&&null!==e?[e]:[{[this.valueKey]:e,[this.labelKey]:this.getLabel(e)}]),this.$emit("update:modelValue",t),this.$emit("change",t)}},hasValue(){const e=this.currentValue;return Array.isArray(e)&&e.length>0},displayValue(){return this.hasValue?this.currentValue[0]:null},displayLabel(){if(!this.displayValue)return"";const e=this.displayValue;return"object"==typeof e&&null!==e?e[this.labelKey]||e.label||String(e[this.valueKey]||e.value||""):this.getLabel(e)},allSelectedItems(){const e=this.currentValue;return Array.isArray(e)&&0!==e.length?e.map(e=>"object"==typeof e&&null!==e?{value:e[this.valueKey]||e.value,label:e[this.labelKey]||e.label||String(e[this.valueKey]||e.value||"")}:{value:e,label:this.getLabel(e)}):[]},displayItems(){const e=this.allSelectedItems;return void 0===this.maxTagCount||null===this.maxTagCount?e:e.slice(0,this.maxTagCount)},remainingCount(){if(void 0===this.maxTagCount||null===this.maxTagCount)return 0;const e=this.allSelectedItems.length;return Math.max(0,e-this.maxTagCount)},showClear(){return this.allowClear&&this.hasValue&&!this.disabled}},methods:{findOptionByValue(e){return this.options&&0!==this.options.length?this.options.find(t=>{const l="object"==typeof t?t[this.valueKey]:t;return l===e||String(l)===String(e)}):null},getLabel(e){const t=this.findOptionByValue(e);return t?"object"==typeof t?t[this.labelKey]:t:String(e)},removeItem(e,t){if(this.disabled)return;t.stopPropagation();const l=this.currentValue;if(Array.isArray(l)){const t=l.filter(t=>{if("object"==typeof t&&null!==t){return(t[this.valueKey]||t.value)!==e}return t!==e}),r=this.sourceItems.filter(e=>!t.some(t=>t[this.valueKey]===e[this.valueKey]));this.$emit("update:sourceItems",r),this.currentValue=t}},clearValue(e){if(this.disabled)return;e.stopPropagation(),this.currentValue=[];const t=this.sourceItems.filter(e=>!this.currentValue.some(t=>t[this.valueKey]===e[this.valueKey]));this.$emit("update:sourceItems",t)}}});const M=["tabindex"],_=["title"],L={key:1,class:"fc-cus-select-selection-placeholder"},N={key:3,class:"fc-cus-select-arrow"},z=["tabindex"],U={class:"fc-cus-select-selection-overflow"},Y=["title"],q={class:"fc-cus-select-selection-item-content"},Q=["onClick"],W={key:0,class:"fc-cus-select-selection-overflow-item",style:{opacity:"1"}},J={class:"fc-cus-select-selection-item"},H={class:"fc-cus-select-selection-item-content"},G={key:1,class:"fc-cus-select-selection-placeholder"},X={key:1,class:"fc-cus-select-arrow"};K.render=function(e,t,l,r,s,f){return a(),o(n,null,[p(" 单个展示模式 "),e.multiple?(a(),o(n,{key:1},[p(" 多个展示模式 "),i("div",{class:c(["fc-cus-select fc-cus-select-multiple",{"fc-cus-select-disabled":e.disabled}]),style:d(e.style),tabindex:e.disabled?-1:0},[i("div",{class:c(["fc-cus-select-selector",{"fc-cus-select-selector-borderless":!e.bordered}])},[i("div",U,[p(" 显示的 tags "),(a(!0),o(n,null,h(e.displayItems,(l,r)=>(a(),o("div",{key:r,class:"fc-cus-select-selection-overflow-item",style:{opacity:"1"}},[i("span",{class:"fc-cus-select-selection-item",title:l.label},[i("span",q,u(l.label),1),i("span",{class:"fc-cus-select-selection-item-remove",onClick:t=>e.removeItem(l.value,t)},[...t[4]||(t[4]=[i("span",{role:"img","aria-label":"close",class:"anticon anticon-close"},[i("svg",{focusable:"false","data-icon":"close",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true","fill-rule":"evenodd",viewBox:"64 64 896 896"},[i("path",{d:"M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z"})])],-1)])],8,Q)],8,Y)]))),128)),p(" 折叠提示 "),e.remainingCount>0?(a(),o("div",W,[i("span",J,[i("span",H," +"+u(e.remainingCount),1)])])):p("v-if",!0),p(" 空值占位符 "),e.hasValue?p("v-if",!0):(a(),o("span",G,u(e.placeholder||"请选择"),1))]),e.showClear?(a(),o("span",{key:0,class:"fc-cus-select-clear",onClick:t[1]||(t[1]=(...t)=>e.clearValue&&e.clearValue(...t))},[...t[5]||(t[5]=[i("span",{role:"img","aria-label":"close-circle",class:"anticon anticon-close-circle"},[i("svg",{focusable:"false","data-icon":"close-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true","fill-rule":"evenodd",viewBox:"64 64 896 896"},[i("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})])],-1)])])):(a(),o("span",X,[...t[6]||(t[6]=[i("span",{role:"img","aria-label":"down",class:"anticon anticon-down"},[i("svg",{focusable:"false","data-icon":"down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"64 64 896 896"},[i("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"})])],-1)])]))],2)],14,z)],2112)):(a(),o("div",{key:0,class:c(["fc-cus-select fc-cus-select-single",{"fc-cus-select-disabled":e.disabled}]),style:d(e.style),tabindex:e.disabled?-1:0},[i("div",{class:c(["fc-cus-select-selector",{"fc-cus-select-selector-borderless":!e.bordered}])},[e.displayValue?(a(),o("span",{key:0,class:"fc-cus-select-selection-item",title:e.displayLabel},u(e.displayLabel),9,_)):(a(),o("span",L,u(e.placeholder||"请选择"),1)),e.showClear?(a(),o("span",{key:2,class:"fc-cus-select-clear",onClick:t[0]||(t[0]=(...t)=>e.clearValue&&e.clearValue(...t))},[...t[2]||(t[2]=[i("span",{role:"img","aria-label":"close-circle",class:"anticon anticon-close-circle"},[i("svg",{focusable:"false","data-icon":"close-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true","fill-rule":"evenodd",viewBox:"64 64 896 896"},[i("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})])],-1)])])):(a(),o("span",N,[...t[3]||(t[3]=[i("span",{role:"img","aria-label":"down",class:"anticon anticon-down"},[i("svg",{focusable:"false","data-icon":"down",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",viewBox:"64 64 896 896"},[i("path",{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"})])],-1)])]))],2)],14,M))],2112)};var Z=s({name:"CusStoreSelect",components:{CusSelect:K},props:{formCreateInject:{type:Object,default:null},modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},maxTagCount:{type:Number,default:void 0},placeholder:{type:String,default:"请选择"},disabled:{type:Boolean,default:!1},style:{type:[String,Object],default:()=>({width:"100%"})},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},allowClear:{type:Boolean,default:!1},field:{type:String,default:""},bordered:{type:Boolean,default:!0},extraQuery:{type:Object,default:()=>({})},extraQueryFn:{type:Function,default:()=>{}}},emits:["update:modelValue","change"],data:()=>({messageId:0,pendingCallbacks:{},internalOptions:[],sourceItems:[]}),computed:{mergedOptions(){if(this.internalOptions.length>0){const e=new Map;return this.options.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),this.internalOptions.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),Array.from(e.values())}return this.options}},watch:{options:{immediate:!0,handler(e){0===this.internalOptions.length&&Array.isArray(e)&&e.length>0&&(this.internalOptions=[...e])}}},mounted(){window.addEventListener("message",this.handleMessage)},beforeUnmount(){window.removeEventListener("message",this.handleMessage)},methods:{serializeForPostMessage(e){if(null==e)return e;try{return JSON.parse(JSON.stringify(e))}catch(t){if(console.warn("CusStoreSelect: 数据序列化失败,尝试递归处理",t),Array.isArray(e))return 0===e.length?[]:e.map(e=>this.serializeForPostMessage(e));if("object"==typeof e){const t={};for(const l in e)if(Object.prototype.hasOwnProperty.call(e,l))try{t[l]=this.serializeForPostMessage(e[l])}catch(e){console.warn("CusStoreSelect: 跳过无法序列化的属性: "+l,e)}return t}return e}},handleClick(){if(this.disabled)return;const e=`store-select-${this.field||"default"}-${Date.now()}-${++this.messageId}`,t=Array.isArray(this.modelValue)?this.modelValue:[];let l=null;t.length>0&&(l=t);const r=null==l?null:this.serializeForPostMessage(l),a={...this.extraQuery};this.extraQueryFn&&Object.assign(a,this.extraQueryFn());const o={type:"OPEN_STORE_SELECT",field:this.field||"",multiple:this.multiple,currentValue:r,valueKey:this.valueKey,labelKey:this.labelKey,extraQuery:a,messageId:e};if(window.parent&&window.parent!==window)try{window.parent.postMessage(o,"*")}catch(e){console.error("CusStoreSelect: 发送消息失败",e)}else console.warn("CusStoreSelect: 当前不在 iframe 环境中,无法向父窗口发送消息");this.pendingCallbacks[e]=(e,t)=>{t&&Array.isArray(t)&&t.length>0&&this.mergeOptions(t),this.sourceItems=t,this.handleUpdate(e),this.handleChange(e)}},handleMessage(e){const t=e.data;if(t&&"STORE_SELECT_RESULT"===t.type){const{field:e,value:l,sourceItems:r,messageId:a}=t;if(e!==this.field)return;const o=this.pendingCallbacks[a];o&&(o(l,r),delete this.pendingCallbacks[a])}},mergeOptions(e){if(!Array.isArray(e)||0===e.length)return;const t=new Map;this.internalOptions.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),e.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),this.internalOptions=Array.from(t.values())},handleUpdate(e){this.$emit("update:modelValue",e),this.triggerValidate()},handleChange(e){this.$emit("change",e,this.sourceItems&&this.sourceItems.length>0?this.multiple?this.sourceItems:this.sourceItems[0]:this.multiple?[]:null)},triggerValidate(){this.$nextTick(()=>{this.$nextTick(()=>{try{if(this.formCreateInject&&this.formCreateInject.api&&this.field)return void this.formCreateInject.api.validateField(this.field).catch(()=>{});let e=this.$parent;for(;e;){if(e.$options&&"FormCreate"===e.$options.name&&e.fapi){this.field&&e.fapi.validateField&&e.fapi.validateField(this.field).catch(()=>{});break}e=e.$parent}}catch(e){console.warn("CusStoreSelect: 触发校验失败",e)}})})}}});Z.render=function(e,t,l,r,i,s){const n=f("CusSelect");return a(),o("div",{onClick:t[1]||(t[1]=(...t)=>e.handleClick&&e.handleClick(...t))},[m(n,{"model-value":e.modelValue,options:e.mergedOptions,"source-items":e.sourceItems,"onUpdate:sourceItems":t[0]||(t[0]=t=>e.sourceItems=t),multiple:e.multiple,"max-tag-count":e.maxTagCount,placeholder:e.placeholder,disabled:e.disabled,style:d(e.style),valueKey:e.valueKey,labelKey:e.labelKey,allowClear:e.allowClear,bordered:e.bordered,"onUpdate:modelValue":e.handleUpdate,onChange:e.handleChange},null,8,["model-value","options","source-items","multiple","max-tag-count","placeholder","disabled","style","valueKey","labelKey","allowClear","bordered","onUpdate:modelValue","onChange"])])};var ee=s({name:"CusUserSelect",components:{CusSelect:K},props:{formCreateInject:{type:Object,default:null},modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},multiple:{type:Boolean,default:!1},maxTagCount:{type:Number,default:void 0},placeholder:{type:String,default:"请选择"},disabled:{type:Boolean,default:!1},style:{type:[String,Object],default:()=>({width:"100%"})},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},allowClear:{type:Boolean,default:!1},field:{type:String,default:""},bordered:{type:Boolean,default:!0},selectType:{type:[String,Number],default:null},extraQuery:{type:Object,default:()=>({})},extraQueryFn:{type:Function,default:()=>{}}},emits:["update:modelValue","change"],data:()=>({messageId:0,pendingCallbacks:{},internalOptions:[],sourceItems:[]}),computed:{mergedOptions(){if(this.internalOptions.length>0){const e=new Map;return this.options.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),this.internalOptions.forEach(t=>{const l="object"==typeof t?t[this.valueKey]:t;e.set(l,t)}),Array.from(e.values())}return this.options}},watch:{options:{immediate:!0,handler(e){0===this.internalOptions.length&&Array.isArray(e)&&e.length>0&&(this.internalOptions=[...e])}}},mounted(){window.addEventListener("message",this.handleMessage)},beforeUnmount(){window.removeEventListener("message",this.handleMessage)},methods:{serializeForPostMessage(e){if(null==e)return e;try{return JSON.parse(JSON.stringify(e))}catch(t){if(console.warn("CusUserSelect: 数据序列化失败,尝试递归处理",t),Array.isArray(e))return 0===e.length?[]:e.map(e=>this.serializeForPostMessage(e));if("object"==typeof e){const t={};for(const l in e)if(Object.prototype.hasOwnProperty.call(e,l))try{t[l]=this.serializeForPostMessage(e[l])}catch(e){console.warn("CusUserSelect: 跳过无法序列化的属性: "+l,e)}return t}return e}},handleClick(){if(this.disabled)return;const e=`user-select-${this.field||"default"}-${Date.now()}-${++this.messageId}`,t=Array.isArray(this.modelValue)?this.modelValue:[];let l=null;t.length>0&&(l=t);const r=null==l?null:this.serializeForPostMessage(l),a={...this.extraQuery};this.extraQueryFn&&Object.assign(a,this.extraQueryFn());const o={type:"OPEN_USER_SELECT",field:this.field||"",multiple:this.multiple,currentValue:r,valueKey:this.valueKey,labelKey:this.labelKey,selectType:this.selectType,extraQuery:a,messageId:e};if(window.parent&&window.parent!==window)try{window.parent.postMessage(o,"*")}catch(e){console.error("CusUserSelect: 发送消息失败",e)}else console.warn("CusUserSelect: 当前不在 iframe 环境中,无法向父窗口发送消息");this.pendingCallbacks[e]=(e,t)=>{t&&Array.isArray(t)&&t.length>0&&this.mergeOptions(t),this.sourceItems=t,this.handleUpdate(e),this.handleChange(e)}},handleMessage(e){const t=e.data;if(t&&"USER_SELECT_RESULT"===t.type){const{field:e,value:l,sourceItems:r,messageId:a}=t;if(e!==this.field)return;const o=this.pendingCallbacks[a];o&&(o(l,r),delete this.pendingCallbacks[a])}},mergeOptions(e){if(!Array.isArray(e)||0===e.length)return;const t=new Map;this.internalOptions.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),e.forEach(e=>{const l="object"==typeof e?e[this.valueKey]:e;t.set(l,e)}),this.internalOptions=Array.from(t.values())},handleUpdate(e){this.$emit("update:modelValue",e),this.triggerValidate()},handleChange(e){this.$emit("change",e,this.sourceItems&&this.sourceItems.length>0?this.multiple?this.sourceItems:this.sourceItems[0]:this.multiple?[]:null)},triggerValidate(){this.$nextTick(()=>{this.$nextTick(()=>{try{if(this.formCreateInject&&this.formCreateInject.api&&this.field)return void this.formCreateInject.api.validateField(this.field).catch(()=>{});let e=this.$parent;for(;e;){if(e.$options&&"FormCreate"===e.$options.name&&e.fapi){this.field&&e.fapi.validateField&&e.fapi.validateField(this.field).catch(()=>{});break}e=e.$parent}}catch(e){console.warn("CusUserSelect: 触发校验失败",e)}})})}}});ee.render=function(e,t,l,r,i,s){const n=f("CusSelect");return a(),o("div",{onClick:t[1]||(t[1]=(...t)=>e.handleClick&&e.handleClick(...t))},[m(n,{"model-value":e.modelValue,options:e.mergedOptions,"source-items":e.sourceItems,"onUpdate:sourceItems":t[0]||(t[0]=t=>e.sourceItems=t),multiple:e.multiple,"max-tag-count":e.maxTagCount,placeholder:e.placeholder,disabled:e.disabled,style:d(e.style),valueKey:e.valueKey,labelKey:e.labelKey,allowClear:e.allowClear,bordered:e.bordered,"onUpdate:modelValue":e.handleUpdate,onChange:e.handleChange},null,8,["model-value","options","source-items","multiple","max-tag-count","placeholder","disabled","style","valueKey","labelKey","allowClear","bordered","onUpdate:modelValue","onChange"])])};var te={name:"TableForm",emits:["change","add","delete","update:modelValue"],props:{formCreateInject:Object,modelValue:{type:Array,default:()=>[]},columns:{type:Array,required:!0,default:()=>[]},filterEmptyColumn:{type:Boolean,default:!0},deletable:{type:Boolean,default:!0},addable:{type:Boolean,default:!0},options:{type:Object,default:()=>y({submitBtn:!1,resetBtn:!1})},min:Number,max:Number,disabled:Boolean},watch:{modelValue:{handler(){this.updateTable()},deep:!0},"formCreateInject.preview":function(e){this.emptyRule.children[0].props.colspan=this.columns.length+(e?1:2)}},data(){return{rule:[],trs:[],fapi:{},Form:v(this.formCreateInject.form.$form()),copyTrs:"",oldValue:"",emptyRule:{type:"tr",_isEmpty:!0,native:!0,subRule:!0,children:[{type:"td",style:{textAlign:"center"},native:!0,subRule:!0,props:{colspan:this.columns.length+(this.formCreateInject.preview?1:2)},children:[this.formCreateInject.t("dataEmpty")||"暂无数据"]}]}}},methods:{formChange(){this.updateValue()},updateValue(){const e=this.trs.map((e,t)=>({...this.modelValue[t]||{},...this.fapi.getChildrenFormData(e)})).filter(e=>{if(!this.filterEmptyColumn)return!0;if(null==e)return!1;let t=!1;return Object.keys(e).forEach(l=>{t=t||void 0!==e[l]&&""!==e[l]&&null!==e[l]}),t}),t=JSON.stringify(e);t!==this.oldValue&&(this.oldValue=t,this.$emit("update:modelValue",e),this.$emit("change",e))},setRawData(e,t){const l=this.trs[e];this.fapi.setChildrenFormData(l,t,!0)},updateTable(){const e=JSON.stringify(this.modelValue);this.oldValue!==e&&(this.oldValue=e,this.trs=this.trs.splice(0,this.modelValue.length),this.modelValue.length?this.clearEmpty():this.addEmpty(),this.modelValue.forEach((e,t)=>{this.trs[t]||this.addRaw(),this.setRawData(t,e||{})}),this.rule[0].children[1].children=this.trs)},addEmpty(){this.trs.length&&this.trs.splice(0,this.trs.length),this.trs.push(this.emptyRule)},clearEmpty(){this.trs[0]&&this.trs[0]._isEmpty&&this.trs.splice(0,1)},delRaw(e){this.disabled||!this.deletable||this.min>0&&this.trs.length<=this.min||(this.trs.splice(e,1),this.updateValue(),this.trs.length?this.trs.forEach(e=>this.updateRaw(e)):this.addEmpty(),this.$emit("delete",e))},addRaw(e){if(e&&this.disabled)return;const t=this.formCreateInject.form.parseJson(this.copyTrs)[0];1===this.trs.length&&this.trs[0]._isEmpty&&this.trs.splice(0,1),this.trs.push(t),this.updateRaw(t),e&&(this.$emit("add",this.trs.length),this.updateValue())},updateRaw(e){const t=this.trs.indexOf(e);e.children[0].props.innerText=t+1,e.children[e.children.length-1].children[0].props.onClick=()=>{this.delRaw(t)}},loadRule(){const e=[{type:"th",native:!0,class:"_fc-tf-head-idx",props:{innerText:"#"}}];let t=[{type:"td",class:"_fc-tf-idx",native:!0,props:{innerText:"0"}}];this.columns.forEach(l=>{e.push({type:"th",native:!0,style:{...l.style||{},textAlign:l.align||"center"},class:l.required?"_fc-tf-head-required":"",props:{innerText:l.label||""}}),t.push({type:"td",native:!0,children:[...l.rule||[]]})}),e.push({type:"th",native:!0,class:"_fc-tf-edit fc-clock",props:{innerText:this.formCreateInject.t("operation")||"操作"}}),t.push({type:"td",native:!0,class:"_fc-tf-btn fc-clock",children:[{type:"i",native:!0,class:"fc-icon icon-delete",props:{}}]}),this.copyTrs=this.formCreateInject.form.toJson([{type:"tr",native:!0,subRule:!0,children:t}]),this.rule=[{type:"table",native:!0,class:"_fc-tf-table",props:{border:"1",cellspacing:"0",cellpadding:"0"},children:[{type:"thead",native:!0,children:[{type:"tr",native:!0,children:e}]},{type:"tbody",native:!0,children:this.trs}]}]}},created(){this.loadRule()},mounted(){this.updateTable()}};te.render=function(e,t,l,r,s,n){const d=f("a-button");return a(),o("div",{class:c(["_fc-table-form",{"_fc-disabled":l.disabled}])},[(a(),g(b(s.Form),{option:l.options,rule:s.rule,extendOption:!0,disabled:l.disabled,onChange:n.formChange,api:s.fapi,"onUpdate:api":t[0]||(t[0]=e=>s.fapi=e),onEmitEvent:e.$emit},null,40,["option","rule","disabled","onChange","api","onEmitEvent"])),l.addable&&(!l.max||l.max>this.trs.length)?(a(),g(d,{key:0,type:"link",class:"fc-clock",onClick:t[1]||(t[1]=e=>n.addRaw(!0)),disabled:l.disabled},{default:w(()=>[t[2]||(t[2]=i("i",{class:"fc-icon icon-add-circle",style:{"font-weight":"700"}},null,-1)),C(" "+u(l.formCreateInject.t("add")||"添加"),1)]),_:1},8,["disabled"])):p("v-if",!0)],2)};var le=s({name:"TableFormView",data:()=>({})});const re={class:"_fd-table-form"},ae={key:0,class:"_fd-tf-wrap"},oe={key:1,class:"_fc-child-empty"};le.render=function(e,t,l,r,i,s){return a(),o("div",re,[e.$slots.default?(a(),o("div",ae,[x(e.$slots,"default")])):(a(),o("div",oe))])};var ie=s({name:"TableFormColumnView",props:{label:String,align:String,width:[Number,String],color:String,required:Boolean},computed:{colStyle(){const e=this.width,t={width:V.Number(e)?e+"px":e&&"auto"!==e?e:"180px"};return this.color&&(t.color=this.color),t}},data:()=>({})});const se={key:0,class:"_fd-tf-required"},ne={class:"_fd-tf-con"};ie.render=function(e,t,l,r,s,n){return a(),o("div",{class:"_fd-tf-col",style:d(e.colStyle)},[i("div",{class:"_fd-tf-title",style:d({textAlign:e.align||"center"})},[e.required?(a(),o("span",se,"*")):p("v-if",!0),C(u(e.label||""),1)],4),i("div",ne,[x(e.$slots,"default")])],4)};var pe=[e,t,l,r,R,K,Z,ee,te,le,ie],ce={name:"checkbox",modelField:"value",mergeProp(e){const t=e.prop.props;F(t,"options")||(t.options=e.prop.options||[])}},de={...ce,name:"radio"},ue={...ce,name:"select",mergeProp(e){const t=e.prop.props;F(t,"options")||(t.options=e.prop.options||[]);const l=e.effectData("fetch");l&&!0===l.loading&&(t.disabled=!0,t.loading=!0)},render(e,t){const l=t.effectData("fetch");if(l&&!0===l.loading&&e.loading){const l={...e};return l.notFoundContent=e.loading,t.$render.defaultRender(t,l)}return t.$render.defaultRender(t,e)}},he={name:"cascader",mergeProp(e){const t=e.prop.props;F(t,"options")||(t.options=e.prop.options||[]);const l=e.effectData("fetch");if(l&&!0===l.loading&&(t.disabled=!0,t.loading=!0),t.loadData){var r;const l=null===(r=e.$handle)||void 0===r?void 0:r.api,a=e.rule,o=e;let i=V.String(t.loadData)?I(t.loadData):t.loadData;if(!V.Function(i)&&V.String(t.loadData))try{const e=t.loadData.trim();e.startsWith("function")||e.startsWith("[[FORM-CREATE-PREFIX-function")||e.startsWith("$FNX:")||(i=new Function("selectedOptions","options","updateOptions","api","rule",e))}catch(e){console.error("Failed to parse loadData:",e)}V.Function(i)&&(t.loadData=function(e){if(!e||0===e.length)return;const r=e[e.length-1];if(!0===(null==r?void 0:r.isLeaf))return;const s=t.options||[],n=()=>{var e,i;const s=t.options||[];let n=-1;r&&(n=s.findIndex(e=>e.value===r.value||e.id===r.id||e===r));const p=s.map((e,t)=>{if(t===n&&r){return{...r}}return{...e}}),c=o.effectData("fetch");c&&P(c,"props.options",p),t.options=p,null!==(e=o.prop)&&void 0!==e&&e.props&&(o.prop.props.options=p),null!==(i=o.rule)&&void 0!==i&&i.props&&(o.rule.props.options=p),l&&a&&l.sync(a),o.$handle&&o.$handle.refresh()};r&&(r.loading=!0,n());const p=i.call(this,e,s,n,l,a);return p&&"function"==typeof p.then?p.finally(()=>{n()}):p})}},render(e,t){const l=t.effectData("fetch");if(l&&!0===l.loading&&e.loading){const l={...e};return l.notFoundContent=e.loading,t.$render.defaultRender(t,l)}return t.$render.defaultRender(t,e)}};const fe={date:"YYYY-MM-DD",month:"YYYY-MM",week:"YYYY-wo",quarter:"YYYY-qQ",year:"YYYY"},me="datePicker";var ye={name:me,maker:["date","month","week"].reduce((e,t)=>(e[t]=O(me,{type:t}),e),{dateRange:O(me,{type:"range"}),datetimeRange:O(me,e=>e.props({type:"range",showTime:!0}))}),modelField:"value",mergeProp(e){const t=e.prop.props,l=t.type||t.picker;t.valueFormat||(t.valueFormat=(fe[l]||fe.date)+(!t.showTime||l&&"date"!==l?"":" HH:mm:ss"))},render:(e,t)=>t.$render.vNode[(!0===t.prop.props.range?"range":"date")+"Picker"](t.prop,e)};var ve={name:"hidden",maker:{hidden:(e,t)=>O("hidden")("",e,t)},render:()=>[]},ge={name:"text",loadChildren:!1,mounted(e){var t,l;const r=e.rule.props||{},a=e.rule.bindField||r.bindField||(null===(t=e.prop.props)||void 0===t?void 0:t.bindField),o=e.rule.template||r.template||(null===(l=e.prop.props)||void 0===l?void 0:l.template);(o||a)&&setTimeout(()=>{if(e.$handle&&e.$handle.api)try{let t="";if(o){const l=e.$handle.api.formData();t=e.$handle.loadStrVar(o,t=>{const r=e.$handle.api.getValue(t);return void 0===r&&l&&void 0!==l[t]?l[t]:r},null)}else a&&(t=e.$handle.api.getValue(a)||"");null!=t&&(e.rule.children||(e.rule.children=[]),e.rule.children[0]=String(t),e.$handle.api.sync(e.rule),e.$handle.refresh())}catch(e){}},500)},renderChildren:(e,t)=>({default:()=>{var l;let r=null===(l=t.rule)||void 0===l?void 0:l.children;r||(r=e);return(Array.isArray(r)?r:[r]).filter(e=>null!=e).map(e=>V.String(e)?e:String(e)).join("")||""}}),mergeProp(e){var t,l,r;const a=e.rule.props||{},o=e.rule.bindField||a.bindField||(null===(t=e.prop.props)||void 0===t?void 0:t.bindField),i=e.rule.template||a.template||(null===(l=e.prop.props)||void 0===l?void 0:l.template);let s=e.rule.bindMode||a.bindMode||(null===(r=e.prop.props)||void 0===r?void 0:r.bindMode);if(s||(s=i?"template":o?"field":"static"),"field"===s&&o){const t={attr:o,to:"child",modify:!0,wait:300,watch:!0};e.rule.effect||(e.rule.effect={}),e.rule.effect.loadData||(e.rule.effect.loadData=[]);e.rule.effect.loadData.some(e=>e.attr===o&&"child"===e.to)||(e.rule.effect.loadData.push(t),e.$handle&&e.$handle.effect&&e.$handle.effect(e,"loaded"))}else if("template"===s&&i){const t={template:i,to:"child",modify:!0,wait:300,watch:!0};e.rule.effect||(e.rule.effect={}),e.rule.effect.loadData||(e.rule.effect.loadData=[]);if(!e.rule.effect.loadData.some(e=>e.template===i&&"child"===e.to)&&(e.rule.effect.loadData.push(t),e.$handle&&e.$handle.effect&&(e.$handle.effect(e,"loaded"),!e._textLoadDataWatched))){e._textLoadDataWatched=!0;const t=k(e.rule.effect,"loadData");e.watch.push(S(t,(t,l)=>{e.$handle.effect(e,"watch",{loadData:t})},{deep:!0}))}}null==e.rule.formCreateChild||e.rule.children||(e.rule.children=[e.rule.formCreateChild]),e.rule.children||(e.rule.children=[]),("field"===s&&o||"template"===s&&i)&&(!e.rule.children||Array.isArray(e.rule.children)&&0===e.rule.children.length)&&(e.rule.children="template"===s?[""]:[" "])},render(e,t){let l="";if(e&&"function"==typeof e.default)try{l=e.default()||""}catch(e){l=""}l=null==l||void 0===l?"":String(l);const r={...t.prop};r.props||(r.props={}),"text"===r.type&&(r.type="div"),delete r.props.innerHTML;return t.vNode.make("div",r,[l])}};var be={name:"input",maker:["password","url","email","text","textarea","search"].reduce((e,t)=>(e[t]=O("input",{type:t}),e),{idate:O("input",{type:"date"})}),modelField:"value",render(e,t){let l=t.prop.props.type;return-1===["textarea","search","password"].indexOf(l)&&(l="input"),l={textarea:"aTextarea",search:"aInputSearch",password:"aInputPassword"}[l]||"aInput",t.$render.vNode.make(l,t.prop,e)}},we={name:"timePicker",modelField:"value",mergeProp(e){const t=e.prop.props;t.valueFormat||(t.valueFormat="HH:mm:ss")},render:(e,t)=>t.$render.vNode["time"+(!0===t.prop.props.range?"Range":"")+"Picker"](t.prop,e)},Ce={name:"tree",modelField:"checkedKeys",mergeProp(e){const t=e.prop.props;t.fieldNames?t.fieldNames.key||(t.fieldNames.key="id"):t.fieldNames={key:"id"},t.checkedKeys=e.rule.value,t.checkable=!0}},xe={name:"FcRow",render:(e,t)=>t.vNode.col({props:{span:24}},{default:()=>[t.vNode.row(t.prop,e)]})};var ke=[ce,ye,{...ye,name:"rangePicker",maker:{},render:(e,t)=>t.$render.vNode.rangePicker(t.prop,e)},ve,ge,be,we,{...we,name:"timeRangePicker",render:(e,t)=>t.$render.vNode.timeRangePicker(t.prop,e)},Ce,de,ue,he,xe,{name:"cusStoreSelect",modelField:"modelValue",toFormValue:(e,t)=>null==e||""===e?[]:Array.isArray(e)?e.map(e=>("object"!=typeof e||null===e||void 0===e.value&&e.label,e)):[e],toValue:(e,t)=>e,mergeProp(e){const t=e.prop.props;if(F(t,"options")||(t.options=e.prop.options||[]),F(t,"field")||(t.field=e.rule.field||""),void 0!==e.rule.value){const t=e.rule.value;null==t||""===t?e.rule.value=[]:Array.isArray(t)||(e.rule.value=[t])}},render(e,t){const l=t.$render.defaultRender(t,e);if(l&&l.props&&l.props.on){const e=l.props.on["update:modelValue"],r=()=>{$(()=>{$(()=>{try{const e=t.rule.field;if(e)return void t.$handle.api.validateField(e).catch(()=>{});const l=t.$handle.getFieldCtx(t.rule.field);l&&l.id&&t.$handle.$manager.validateField(l.id).catch(()=>{})}catch(e){console.warn("CusStoreSelect: 触发校验失败",e)}})})};l.props.on["update:modelValue"]=(...t)=>{e&&e(...t),r()};const a=l.props.on.change;l.props.on.change=a?(...e)=>{a(...e),r()}:r}return l}},{name:"cusUserSelect",modelField:"modelValue",toFormValue:(e,t)=>null==e||""===e?[]:Array.isArray(e)?e.map(e=>("object"!=typeof e||null===e||void 0===e.value&&e.label,e)):[e],toValue:(e,t)=>e,mergeProp(e){const t=e.prop.props;if(F(t,"options")||(t.options=e.prop.options||[]),F(t,"field")||(t.field=e.rule.field||""),F(t,"formCreateInject")||(t.formCreateInject=e.inject),void 0!==e.rule.value){const t=e.rule.value;null==t||""===t?e.rule.value=[]:Array.isArray(t)||(e.rule.value=[t])}},render(e,t){const l=t.$render.defaultRender(t,e);if(l&&l.props&&l.props.on){const e=l.props.on["update:modelValue"],r=()=>{$(()=>{$(()=>{try{const e=t.rule.field;if(e)return void t.$handle.api.validateField(e).catch(()=>{});const l=t.$handle.getFieldCtx(t.rule.field);l&&l.id&&t.$handle.$manager.validateField(l.id).catch(()=>{})}catch(e){console.warn("CusUserSelect: 触发校验失败",e)}})})};l.props.on["update:modelValue"]=(...t)=>{e&&e(...t),r()};const a=l.props.on.change;l.props.on.change=a?(...e)=>{a(...e),r()}:r}return l}},{name:"flex",mergeProp(e){var t;const l=e.rule.props||{},r=l.flexDirection||e.rule.flexDirection||"row",a=l.flexWrap||e.rule.flexWrap||"nowrap",o=l.justifyContent||e.rule.justifyContent||"flex-start",i=l.alignItems||e.rule.alignItems||"flex-start",s=l.alignContent||e.rule.alignContent||"flex-start",n="column"===r||"column-reverse"===r,p={"flex-start":"start","flex-end":"end",center:"center","space-between":"space-between","space-around":"space-around","space-evenly":"space-evenly"}[o]||"start",c={"flex-start":"start","flex-end":"end",center:"center",baseline:"baseline",stretch:"stretch"}[i]||"start";e.prop.props||(e.prop.props={}),e.prop.props.vertical=n,e.prop.props.justify=p,e.prop.props.align=c,void 0!==l.gap&&(e.prop.props.gap=l.gap);const d=e.rule.style||{},{display:u,flexDirection:h,flexWrap:f,justifyContent:m,alignItems:y,alignContent:v,...g}=d,b={display:u||"flex",flexWrap:a,...g};s&&"flex-start"!==s&&(b.alignContent=s);const w=e.prop.style||{},C=(null===(t=e.prop.props)||void 0===t?void 0:t.style)||{};e.prop.style={...w,...b},e.prop.props||(e.prop.props={}),e.prop.props.style={...C,...b},e.rule.children||(e.rule.children=[]),e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.forEach(e=>{e&&"object"==typeof e&&"DragTool"===!e.type&&"DragBox"===!e.type&&(void 0===e.col||null===e.col?e.col=!1:e.col&&"object"==typeof e.col&&!1!==e.col.show&&(e.col.show=!1))})},render(e,t){var l,r;const a={...t.prop};"flex"===a.type&&(a.type="a-flex");const o=(t.rule.props||{}).flexDirection||t.rule.flexDirection||"row",i="column"===o||"column-reverse"===o;a.props||(a.props={});const s=()=>{a.class||(a.class=[]),Array.isArray(a.class)||(a.class=[a.class])},n=null!==(l=null===(r=t.rule.props)||void 0===r?void 0:r.childFlex)&&void 0!==l?l:t.rule.childFlex;if(null!=n&&""!==n){s(),a.class.includes("_fc-flex-container")||a.class.push("_fc-flex-container");const e=String(n).trim();a.props.style||(a.props.style={}),a.props.style["--fc-child-flex"]=e,a.style||(a.style={}),a.style["--fc-child-flex"]=e}if(i){var p,c,d;const e=null!==(p=null!==(c=null===(d=t.rule.props)||void 0===d?void 0:d.childWidth)&&void 0!==c?c:t.rule.childWidth)&&void 0!==p?p:"100%";s(),a.class.includes("_fc-flex-container")||a.class.push("_fc-flex-container"),a.class.includes("_fc-flex-vertical")||a.class.push("_fc-flex-vertical");const l=String(e).trim();a.props.style||(a.props.style={}),a.props.style["--fc-child-width"]=l,a.style||(a.style={}),a.style["--fc-child-width"]=l}const u=e||[];return t.vNode.col({props:{span:24}},{default:()=>[t.vNode.make("a-flex",a,u)]})}},{name:"space",mergeProp(e){const t=e.rule.props||{},l=t.direction||e.rule.direction||"horizontal",r=t.size||e.rule.size||"small",a=t.align||e.rule.align,o=t.wrap||e.rule.wrap||!1;e.prop.props||(e.prop.props={}),e.prop.props.direction=l,e.prop.props.size=r,null!=a&&""!==a&&(e.prop.props.align=a),e.prop.props.wrap=o;const i={width:"100%",...e.rule.style||{}};e.prop.style||(e.prop.style={}),e.prop.style={...e.prop.style,...i},e.prop.props.style||(e.prop.props.style={}),e.prop.props.style={...e.prop.props.style,...i},e.rule.children||(e.rule.children=[]),e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.forEach(e=>{e&&"object"==typeof e&&"DragTool"!==e.type&&"DragBox"!==e.type&&(void 0===e.col||null===e.col?e.col=!1:e.col&&"object"==typeof e.col&&!1!==e.col.show&&(e.col.show=!1))})},render(e,t){const l={...t.prop};(t.rule.props||{}).compact||t.rule.compact||!1?l.type="a-space-compact":"space"===l.type&&(l.type="a-space");const r=e||[];return t.vNode.col({props:{span:24}},{default:()=>[t.vNode.make(l.type,l,r)]})}},{name:"spin",mergeProp(e){var t,l,r,a,o,i,s,n,p;e.rule.wrap||(e.rule.wrap={}),e.rule.wrap.title=!1;const c=e.prop.props||{},d=null===(t=null!==(l=null!==(r=e.rule.containerMode)&&void 0!==r?r:null===(a=e.rule.props)||void 0===a?void 0:a.containerMode)&&void 0!==l?l:null===(o=e.prop.props)||void 0===o?void 0:o.containerMode)||void 0===t||t;var u,h,f,m;(d||(e.rule.children=[]),F(c,"spinning"))||(c.spinning=null!==(u=null!==(h=null===(f=e.prop.props)||void 0===f?void 0:f.spinning)&&void 0!==h?h:null===(m=e.rule.props)||void 0===m?void 0:m.spinning)&&void 0!==u&&u);const y=e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.length>0;!d&&!y&&c.spinning;const v=e.rule.bindField||(null===(i=e.rule.props)||void 0===i?void 0:i.bindField)||(null===(s=e.prop.props)||void 0===s?void 0:s.bindField);let g=e.rule.bindMode||(null===(n=e.rule.props)||void 0===n?void 0:n.bindMode)||(null===(p=e.prop.props)||void 0===p?void 0:p.bindMode);if(g||(g=v?"field":"static"),"field"===g&&v){const t={attr:v,to:"props.spinning",modify:!0,wait:300,watch:!0};e.rule.effect||(e.rule.effect={}),e.rule.effect.loadData||(e.rule.effect.loadData=[]);e.rule.effect.loadData.some(e=>e.attr===v&&"props.spinning"===e.to)||(e.rule.effect.loadData.push(t),e.$handle&&e.$handle.effect&&e.$handle.effect(e,"loaded"))}d&&(e.rule.children||(e.rule.children=[]),e.rule.children&&Array.isArray(e.rule.children)&&e.rule.children.forEach(e=>{e&&"object"==typeof e&&"DragTool"!==e.type&&"DragBox"!==e.type&&(void 0===e.col||null===e.col?e.col=!1:e.col&&"object"==typeof e.col&&!1!==e.col.show&&(e.col.show=!1))}))},render(e,t){var l,r,a,o,i,s,n,p,c,d,u;const h=(t.prop.props||{}).spinning||!1;t.prop.props||(t.prop.props={}),t.prop.props.spinning=h;const f=t.rule.tip||(null===(l=t.rule.props)||void 0===l?void 0:l.tip)||(null===(r=t.prop.props)||void 0===r?void 0:r.tip);f&&(t.prop.props.tip=f);const m=t.rule.delay||(null===(a=t.rule.props)||void 0===a?void 0:a.delay)||(null===(o=t.prop.props)||void 0===o?void 0:o.delay);null!=m&&(t.prop.props.delay=m);const y=t.rule.size||(null===(i=t.rule.props)||void 0===i?void 0:i.size)||(null===(s=t.prop.props)||void 0===s?void 0:s.size);y&&(t.prop.props.size=y),"spin"===t.prop.type&&(t.prop.type="a-spin");if(!(null===(n=null!==(p=null!==(c=t.rule.containerMode)&&void 0!==c?c:null===(d=t.rule.props)||void 0===d?void 0:d.containerMode)&&void 0!==p?p:null===(u=t.prop.props)||void 0===u?void 0:u.containerMode)||void 0===n||n))return t.$render.defaultRender(t,void 0);const v=e&&Array.isArray(e)?e:e||[];return t.vNode.col({props:{span:24}},{default:()=>[t.vNode.make("a-spin",t.prop,v)]})}}];var Se={tooltip:"aTooltip",popover:"aPopover",button:"aButton",icon:"aIcon",slider:"aSlider",rate:"aRate",upload:"fcUpload",cascader:"aCascader",timePicker:"aTimePicker",timeRangePicker:"aTimeRangePicker",datePicker:"aDatePicker",rangePicker:"aRangePicker",switch:"aSwitch",select:"aSelect",checkbox:"aCheckboxGroup",radio:"aRadioGroup",input:"aInput",inputNumber:"aInputNumber",treeSelect:"aTreeSelect",search:"aInputSearch",inputPassword:"aInputPassword",textarea:"aTextarea",formItem:"aFormItem",form:"aForm",frame:"fcFrame",col:"aCol",row:"aRow",flex:"aFlex",space:"aSpace","space-compact":"aSpaceCompact",spin:"aSpin",tree:"aTree",autoComplete:"aAutoComplete",transfer:"aTransfer",group:"fcGroup",array:"fcGroup",subForm:"fcSubForm",object:"fcSubForm",image:"aImage",aImage:"aImage"};function $e(e,t){F(e,t)&&V.String(e[t])&&(e[t]={[t]:e[t],show:!0})}function Ve(e){return!1===e}function Fe(e){const t={...e};return delete t.children,t}var Ie={validate(){const e=this.form();return e?e.validate():new Promise(e=>e())},validateField(e){const t=this.form();return t?t.validateFields(e):new Promise(e=>e())},clearValidateState(e){const t=this.vm.refs[e.wrapRef];t&&t.clearValidate()},tidyOptions:e=>(["submitBtn","resetBtn","row","info","wrap","col","title"].forEach(t=>{!function(e,t){F(e,t)&&!V.Object(e[t])&&(e[t]={show:!!e[t]})}(e,t)}),e),tidyRule:({prop:e})=>($e(e,"title"),$e(e,"info"),e),mergeProp(e){const t={info:{type:"popover",placement:"topLeft",icon:"QuestionCircleOutlined"},title:{},col:{span:24},wrap:{}};if(["info","wrap","col","title"].forEach(l=>{e.prop[l]=j([this.options[l]||{},e.prop[l]||{}],t[l])}),e.parent&&e.parent.rule){const t=e.parent.rule.type,l=e.parent.rule._menu;"flex"!==t&&"a-flex"!==t&&"flex"!==(null==l?void 0:l.name)&&"space"!==t&&"a-space"!==t&&"space"!==(null==l?void 0:l.name)||(e.prop.col=!1,e.rule&&(e.rule.col=!1))}if("upload"!==e.rule.type||e.prop.props.onPreview){if("upload"===e.rule.type&&e.prop.props.onPreview){const t=e.prop.props.onPreview,l=function(e){window.parent&&window.parent!==window&&window.parent.postMessage({type:"upload-preview",file:{url:e.url,name:e.name,uid:e.uid,size:e.size,type:e.type},timestamp:Date.now()},"*")};e.prop.props.onPreview=function(e){l(e),t&&"function"==typeof t&&t.apply(this,arguments)}}}else{const t=function(e){window.parent&&window.parent!==window&&window.parent.postMessage({type:"upload-preview",file:{url:e.url,name:e.name,uid:e.uid,size:e.size,type:e.type},timestamp:Date.now()},"*")};e.prop.props.onPreview=function(e){t(e)}}if("image"!==e.rule.type&&"aImage"!==e.rule.type||e.prop.props.preview){if(("image"===e.rule.type||"aImage"===e.rule.type)&&e.prop.props.preview){const t=e.prop.props.preview,l=function(t){window.parent&&window.parent!==window&&window.parent.postMessage({type:"upload-preview",file:{url:t||e.prop.props.src||""},timestamp:Date.now()},"*")},r=e.prop.props.src||"",a=null==t?void 0:t.onVisibleChange;e.prop.props.preview={...t,visible:t.visible||!1,src:t.src||r,onVisibleChange:(e,o)=>(e&&!o&&l(t.src||r),!(!a||"function"!=typeof a)&&a.apply(this,arguments))}}}else{const t=function(t){window.parent&&window.parent!==window&&window.parent.postMessage({type:"upload-preview",file:{url:t||e.prop.props.src||""},timestamp:Date.now()},"*")},l=e.prop.props.src||"";e.prop.props.preview={visible:!1,src:l,onVisibleChange:(e,r)=>{if(e&&!r)return t(l),!1}}}},getDefaultOptions:()=>({form:{hideRequiredMark:!1,layout:"horizontal",labelAlign:"right",labelCol:{span:3},wrapperCol:{span:21},validateOnRuleChange:!0},row:{gutter:0},submitBtn:{disabled:!1,loading:!1,type:"primary",innerText:"",show:!1,col:void 0,click:void 0},resetBtn:{disabled:!1,loading:!1,type:"default",innerText:"",show:!1,col:void 0,click:void 0}}),adapterValidate:(e,t)=>(e.validator=(e,l)=>new Promise((e,r)=>t(l,t=>{t?r(t):e()})),e),update(){const e=this.options.form;this.rule={props:{...e},on:{submit:e=>{e.preventDefault()}},style:e.style,type:"form"}},beforeRender(){const{key:e,ref:t,$handle:l}=this,r=this.options.form;E(this.rule,{key:e,ref:t,class:[r.className,r.class,"form-create",this.$handle.preview?"is-preview":""]}),E(this.rule.props,{model:l.formData})},render(e){return e.slotLen()&&!this.$handle.preview&&e.setSlot(void 0,()=>this.makeFormBtn()),this.$r(this.rule,Ve(this.options.row.show)?e.getSlots():[this.makeRow(e)])},makeWrap(e,t){const l=e.prop,r=`${this.key}${e.key}`,a=l.col,o=this.isTitle(l)&&!1!==l.wrap.title,{layout:i,col:s}=this.rule.props,n=l.wrap.class;delete l.wrap.class,delete l.wrap.title;let p=!1;if(e.parent&&e.parent.rule){const t=e.parent.rule.type,l=e.parent.rule._menu;"flex"!==t&&"a-flex"!==t&&"flex"!==(null==l?void 0:l.name)&&"space"!==t&&"a-space"!==t&&"space"!==(null==l?void 0:l.name)||(p=!0)}const c=Ve(l.wrap.show)?t:this.$r(j([l.wrap,{props:{...Fe(l.wrap||{}),hasFeedback:l.hasFeedback||!1,name:e.id,rules:e.injectValidate(),..."horizontal"!==i?{labelCol:{},wrapperCol:{}}:{}},class:this.$render.mergeClass(n||l.className,"fc-form-item"),key:r+"fi",ref:e.wrapRef,type:"formItem"}]),{default:()=>t,...o?{label:()=>this.makeInfo(l,r,e)}:{}});return"inline"===i||Ve(s)||Ve(a.show)||p?c:this.makeCol(l,r,[c])},isTitle(e){if(!1===this.options.form.title)return!1;const t=e.title;return!(!t.title&&!t.native||Ve(t.show))},makeInfo(e,t,l){var r,a;const o={...e.title},i={...e.info};if(!1===this.options.form.title)return!1;if(!o.title&&!o.native||Ve(o.show))return;const s="tooltip"===i.type;const n=this.getSlot("title"),p=[n?n({title:null===(r=l.refRule)||void 0===r||null===(r=r.__$title)||void 0===r?void 0:r.value,rule:l.rule,options:this.options}):null===(a=l.refRule)||void 0===a||null===(a=a.__$title)||void 0===a?void 0:a.value];if(!Ve(i.show)&&(i.info||i.native)&&!Ve(i.icon)){const e={type:i.type||"popover",props:Fe(i),key:t+"pop"};delete e.props.icon,delete e.props.show,delete e.props.info,delete e.props.align,delete e.props.native;const r=s?"title":"content";var c;if(i.info&&!F(e.props,r))e.props[r]=null===(c=l.refRule)||void 0===c||null===(c=c.__$info)||void 0===c?void 0:c.value;p["left"!==i.align?"unshift":"push"](this.$r(j([i,e]),{[o.slot||"default"]:()=>this.$r({type:!0===i.icon?"QuestionCircleOutlined":i.icon||"",props:{type:!0===i.icon?"QuestionCircleOutlined":i.icon},key:t+"i"})}))}const d=j([o,{props:Fe(o),key:t+"tit",class:"fc-form-title",type:o.type||"span"}]);return delete d.props.show,delete d.props.title,delete d.props.native,this.$r(d,p)},makeCol(e,t,l){const r=e.col;return this.$r({class:this.$render.mergeClass(r.class,"fc-form-col"),type:"col",props:r||{span:24},key:t+"col"},l)},makeRow(e){const t=this.options.row||{};return this.$r({type:"row",props:t,class:this.$render.mergeClass(t.class,"fc-form-row"),key:this.key+"row"},e)},makeFormBtn(){let e=[];if(Ve(this.options.submitBtn.show)||e.push(this.makeSubmitBtn()),Ve(this.options.resetBtn.show)||e.push(this.makeResetBtn()),!e.length)return;let{labelCol:t,wrapperCol:l,layout:r}=this.rule.props;"horizontal"!==r&&(t=l={});const a=this.$r({type:"formItem",class:"fc-form-item fc-form-footer",key:this.key+"fb",props:{labelCol:t,wrapperCol:l,label:" ",colon:!1}},e);return"inline"===r?a:this.$r({type:"col",class:"fc-form-col",props:{span:24},key:this.key+"fc"},[a])},makeResetBtn(){const e={...this.options.resetBtn},t=e.innerText||this.$handle.api.t("reset")||"重置";return delete e.innerText,delete e.click,delete e.col,delete e.show,this.$r({type:"button",props:e,class:"fc-reset-btn",style:{width:e.width,marginLeft:"10px"},on:{click:()=>{const e=this.$handle.api;this.options.resetBtn.click?this.options.resetBtn.click(e):e.resetFields()}},key:this.key+"b2"},[t])},makeSubmitBtn(){const e={...this.options.submitBtn},t=e.innerText||this.$handle.api.t("submit")||"提交";return delete e.innerText,delete e.click,delete e.col,delete e.show,this.$r({type:"button",props:e,class:"fc-submit-btn",style:{width:e.width},on:{click:()=>{const e=this.$handle.api;this.options.submitBtn.click?this.options.submitBtn.click(e):e.submit().catch(()=>{})}},key:this.key+"b1"},[t])}};const Pe={};var Ae;function Oe(e,t){return V.Boolean(e)?e={show:e}:V.Undef(e)||V.Object(e)||(e={show:t}),e}function je(e,t){return{formEl:()=>t.$manager.form(),wrapEl(e){const l=t.getFieldCtx(e);if(l)return t.vm.refs[l.wrapRef]},validate:l=>new Promise((r,a)=>{const o=e.children,i=[t.$manager.validate()];o.filter(e=>!e.isScope).forEach(e=>{i.push(e.validate())}),Promise.all(i).then(()=>{r(!0),l&&l(!0)}).catch(r=>{a(r),l&&l(r),t.vm.emit("validate-fail",r,{api:e}),t.emitEvent("validate-fail",r,{api:e})})}),validateField:(l,r)=>new Promise((a,o)=>{const i=t.getFieldCtx(l);if(!i)return;const s=t.subForm[i.id],n=[t.$manager.validateField(i.id)];B(s).filter(e=>!e.isScope).forEach(e=>{n.push(e.validate())}),Promise.all(n).then(()=>{a(null),r&&r(null)}).catch(a=>{o(a),r&&r(a),t.vm.emit("validate-field-fail",a,{field:l,api:e})})}),clearValidateState(l,r=!0){e.helper.tidyFields(l).forEach(e=>{r&&this.clearSubValidateState(e),t.getCtxs(e).forEach(e=>{t.$manager.clearValidateState(e)})})},clearSubValidateState(l){e.helper.tidyFields(l).forEach(e=>{t.getCtxs(e).forEach(e=>{const l=t.subForm[e.id];l&&(Array.isArray(l)?l.forEach(e=>{e.clearValidateState()}):l&&l.clearValidateState())})})},btn:{loading:(t=!0)=>{e.submitBtnProps({loading:!!t})},disabled:(t=!0)=>{e.submitBtnProps({disabled:!!t})},show:(t=!0)=>{e.submitBtnProps({show:!!t})}},resetBtn:{loading:(t=!0)=>{e.resetBtnProps({loading:!!t})},disabled:(t=!0)=>{e.resetBtnProps({disabled:!!t})},show:(t=!0)=>{e.resetBtnProps({show:!!t})}},submitBtnProps:(l={})=>{let r=Oe(t.options.submitBtn,!0);E(r,l),t.options.submitBtn=r,e.refreshOptions()},resetBtnProps:(l={})=>{let r=Oe(t.options.resetBtn,!1);E(r,l),t.options.resetBtn=r,e.refreshOptions()},submit:(l,r)=>new Promise((a,o)=>{(!1===t.options.validateOnSubmit?Promise.resolve():e.validate()).then(()=>{let r=e.formData();t.beforeSubmit(r).then(()=>{V.Function(l)&&T(()=>l(r,e)),V.Function(t.options.onSubmit)&&T(()=>t.options.onSubmit(r,e)),t.vm.emit("submit",r,e),a(r)}).catch(e=>{})}).catch((...t)=>{V.Function(r)&&T(()=>r(e,...t)),o(...t)})}),request:t=>("string"==typeof t&&(t={action:t}),e.fetch(t)),throttle(e,t){let l=0;return function(...r){const a=this,o=Date.now();o-l>=(t||0)&&(l=o,e.call(a,...r))}},debounce(e,t){let l=null;return function(...r){const a=this;null!==l&&clearTimeout(l),l=setTimeout(()=>{e.call(a,...r)},t||0)}}}}!function(e){["treeSelect","upload","frame","autoComplete","cascader","datePicker","frame","inputNumber","inputPassword","radio","rate","switch","rate","slider","timePicker"].reduce((e,t)=>(e[t]=O(t),e),e),e.auto=e.autoComplete,e.number=e.inputNumber,e.time=e.timePicker,e.password=e.inputPassword}(Pe),function(e){e.sliderRange=O("slider",{range:!0})}(Pe),function(e){const t={frameInputs:["input",0],frameFiles:["file",0],frameImages:["image",0],frameInputOne:["input",1],frameFileOne:["file",1],frameImageOne:["image",1]};Object.keys(t).reduce((e,l)=>(e[l]=O("frame",e=>e.props({type:t[l][0],maxLength:t[l][1]})),e),e),e.frameInput=e.frameInputs,e.frameFile=e.frameFiles,e.frameImage=e.frameImages}(Pe),function(e){const t={image:["image",0],file:["file",0],uploadFileOne:["file",1],uploadImageOne:["image",1]};Object.keys(t).reduce((e,l)=>(e[l]=O("upload",e=>e.props({uploadType:t[l][0],maxLength:t[l][1]})),e),e),e.uploadImage=e.image,e.uploadFile=e.file}(Pe),(Ae=Pe).selectMultiple=O("select",{mode:"multiple"}),Ae.selectTags=O("select",{mode:"tags"}),Ae.selectCombobox=O("select",{mode:"combobox"}),function(e){e.cusStoreSelect=O("cusStoreSelect"),e.storeSelect=e.cusStoreSelect}(Pe),function(e){e.cusUserSelect=O("cusUserSelect"),e.userSelect=e.cusUserSelect}(Pe),function(e){e.text=O("text")}(Pe),function(e){e.flex=O("flex")}(Pe),function(e){e.space=O("space")}(Pe),function(e){e.spin=O("spin")}(Pe);var Ee={autoComplete:"value",cascader:"value",inputNumber:"value",inputPassword:"value",textarea:"value",rate:"value",slider:"value",treeSelect:"value",switch:"checked",cusStoreSelect:"modelValue",cusUserSelect:"modelValue"};const Te={name:"required",load(e,t,l){const r=function(e){return V.Boolean(e)?{required:e}:V.String(e)?{message:e}:V.Undef(e)?{required:!1}:V.Function(e)?{validator:e}:V.Object(e)?e:{}}(e.getValue());if(!1===r.required)e.clearProp(),l.clearValidateState([t.field]);else{var a;const o={required:!0,validator:(e,t)=>new Promise((e,l)=>{V.empty(t)?l(o.message):e()}),...r},i=null===(a=t.__fc__.refRule)||void 0===a||null===(a=a.__$title)||void 0===a?void 0:a.value;if(o.message){const e=o.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);e&&(o.message=l.t(e[1],{title:i}))}else o.message=l.t("required",{title:i})||i+("en"===l.getLocale()?" is required":"不能为空");e.getProp().validate=[o]}l.sync(t)},watch(...e){Te.load(...e)}};function Be(e){e.componentAlias(Se),Object.keys(Ee).forEach(t=>{e.setModelField(t,Ee[t])}),pe.forEach(t=>{e.component(t.name,t)}),e.register(Te),ke.forEach(t=>{e.parser(t)}),Object.keys(Pe).forEach(t=>{e.maker[t]=Pe[t]}),"undefined"!=typeof window&&window.antd&&e.useApp((e,t)=>{t.use(window.antd)})}const Re=A({ui:'"ant-design-vue"',version:'"3.2.72"',manager:Ie,install:Be,extendApi:je,attrs:{normal:["col","wrap"],array:["className"],key:["title","info"]}});"undefined"!=typeof window&&(window.formCreate=Re);const De=Re.maker;export{Re as default,De as maker};
8
8
  //# sourceMappingURL=form-create.esm.js.map