cnhis-design-vue 3.2.15-beta.2 → 3.2.15-beta.8

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.
Files changed (187) hide show
  1. package/README.md +87 -87
  2. package/es/components/ai-chat/src/components/ChatMain.js +1 -1
  3. package/es/components/ai-chat/src/components/ChatPatient.vue2.js +1 -1
  4. package/es/components/big-table/src/BigTable.vue2.js +1 -1
  5. package/es/components/branch-notice/index.d.ts +393 -6
  6. package/es/components/branch-notice/src/BranchNotice.vue.d.ts +369 -6
  7. package/es/components/branch-notice/src/BranchNotice.vue2.js +1 -1
  8. package/es/components/branch-notice/src/canstants.d.ts +2 -1
  9. package/es/components/branch-notice/src/canstants.js +1 -1
  10. package/es/components/branch-notice/src/components/NoticeItem.vue.d.ts +168 -44
  11. package/es/components/branch-notice/src/components/NoticeItem.vue.js +1 -0
  12. package/es/components/branch-notice/src/components/NoticeItem.vue2.js +1 -0
  13. package/es/components/branch-notice/src/components/NoticeItemAside.vue.d.ts +74 -5
  14. package/es/components/branch-notice/src/components/NoticeItemAside.vue.js +1 -0
  15. package/es/components/branch-notice/src/components/NoticeItemAside.vue2.js +1 -0
  16. package/es/components/branch-notice/src/components/NoticeOperationList.vue.js +1 -0
  17. package/es/components/branch-notice/src/components/NoticeOperationList.vue2.js +1 -0
  18. package/es/components/branch-notice/src/drawLine.js +1 -1
  19. package/es/components/branch-notice/src/hooks/useTheme.d.ts +1 -0
  20. package/es/components/branch-notice/src/hooks/useTheme.js +1 -0
  21. package/es/components/branch-notice/src/types.d.ts +22 -4
  22. package/es/components/branch-notice/style/index.css +1 -1
  23. package/es/components/button-print/src/components/IdentityVerification.vue2.js +1 -1
  24. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  25. package/es/components/classification/src/components/search-filter/index.vue2.js +1 -1
  26. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  27. package/es/components/classification/src/components/table-modal/index.vue2.js +1 -1
  28. package/es/components/expand-field/src/components/FormBatchOptionsModal.vue2.js +1 -1
  29. package/es/components/expand-field/src/components/PersonModal.vue2.js +1 -1
  30. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  31. package/es/components/expand-field/src/index.vue2.js +1 -1
  32. package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
  33. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcess.js +1 -1
  34. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  35. package/es/components/fabric-chart/src/hooks/electrocardiogram/hooks/useDetailEvent.js +1 -1
  36. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  37. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  38. package/es/components/fabric-chart/src/hooks/electrocardiogram/useMeasureInstrument.js +1 -1
  39. package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
  40. package/es/components/fabric-chart/src/hooks/index.js +1 -1
  41. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcess.js +1 -1
  42. package/es/components/fabric-chart/src/hooks/newBirthProcess/useNewBirthProcessChart.js +1 -1
  43. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  44. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useLeft.js +1 -1
  45. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useOther.js +1 -1
  46. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  47. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
  48. package/es/components/fabric-chart/src/hooks/temperature/useBottom.js +1 -1
  49. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  50. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  51. package/es/components/fabric-chart/src/hooks/temperature/useOther.js +1 -1
  52. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  53. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  54. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  55. package/es/components/fabric-chart/src/hooks/{temperature/useShadow.d.ts → useShadow.d.ts} +2 -2
  56. package/es/components/fabric-chart/src/hooks/useShadow.js +1 -0
  57. package/es/components/fabric-chart/src/utils/index.d.ts +1 -0
  58. package/es/components/fabric-chart/src/utils/index.js +1 -1
  59. package/es/components/field-set/src/FieldColor.vue.d.ts +1 -1
  60. package/es/components/field-set/src/FieldColor.vue2.js +1 -1
  61. package/es/components/field-set/src/FieldFilter.vue.d.ts +1 -1
  62. package/es/components/field-set/src/FieldFilter.vue2.js +1 -1
  63. package/es/components/field-set/src/FieldSet.vue.d.ts +1 -1
  64. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  65. package/es/components/field-set/src/TableStyle.vue2.js +1 -1
  66. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -1
  67. package/es/components/field-set/src/components/edit-filter.vue2.js +1 -1
  68. package/es/components/field-set/src/components/table-row.vue.d.ts +1 -1
  69. package/es/components/field-set/src/constants/filter.js +1 -1
  70. package/es/components/field-set/src/constants/index.js +1 -1
  71. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
  72. package/es/components/form-config/src/hooks/useLocale.js +1 -1
  73. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  74. package/es/components/form-render/src/components/renderer/combination/combination.js +1 -1
  75. package/es/components/form-render/src/components/renderer/complex.js +1 -1
  76. package/es/components/form-render/src/components/renderer/date.js +1 -1
  77. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  78. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  79. package/es/components/form-render/src/components/renderer/select.js +1 -1
  80. package/es/components/form-render/src/components/renderer/switch.js +1 -1
  81. package/es/components/form-render/src/components/renderer/text.js +1 -1
  82. package/es/components/form-render/src/components/renderer/textarea.js +1 -1
  83. package/es/components/form-render/src/hooks/useAnchor.js +1 -1
  84. package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
  85. package/es/components/form-render/src/hooks/useComplexOptions.js +1 -1
  86. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  87. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  88. package/es/components/form-render/src/hooks/usePresetScope.js +1 -1
  89. package/es/components/form-render/src/utils/index.js +1 -1
  90. package/es/components/iho-chat/index.d.ts +261 -27
  91. package/es/components/iho-chat/src/Index.vue.d.ts +261 -27
  92. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  93. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +1 -0
  94. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  95. package/es/components/iho-chat/src/components/ChatFile.vue.d.ts +2 -0
  96. package/es/components/iho-chat/src/components/ChatFile.vue2.js +1 -1
  97. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +2 -0
  98. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +11 -2
  99. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +4 -1
  100. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  101. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +1 -0
  102. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +34 -34
  103. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  104. package/es/components/iho-chat/src/components/ChatSet.vue.d.ts +4 -1
  105. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  106. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +2 -0
  107. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  108. package/es/components/iho-chat/src/components/PersonProfile.vue.d.ts +2 -1
  109. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  110. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +203 -4
  111. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  112. package/es/components/iho-chat/src/components/Video.vue.d.ts +1 -0
  113. package/es/components/iho-chat/src/components/Video.vue2.js +1 -1
  114. package/es/components/iho-chat/src/components/userItemRender.d.ts +18 -0
  115. package/es/components/iho-chat/src/components/userItemRender.js +1 -0
  116. package/es/components/iho-chat/src/hooks/useData.d.ts +4 -2
  117. package/es/components/iho-chat/src/hooks/useData.js +1 -1
  118. package/es/components/iho-chat/src/hooks/useVideo.d.ts +1 -0
  119. package/es/components/iho-chat/src/hooks/useWebSocket.js +1 -1
  120. package/es/components/iho-chat/src/types/index.d.ts +2 -0
  121. package/es/components/iho-chat/src/utils/index.js +1 -1
  122. package/es/components/iho-chat/style/index.css +1 -1
  123. package/es/components/iho-table/src/plugins/dynamicFilterRenderPlugin/dynamicFilter.vue2.js +1 -1
  124. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue2.js +1 -1
  125. package/es/components/iho-table/src/plugins/filterTextPlugin/filter.vue2.js +1 -1
  126. package/es/components/index.css +1 -1
  127. package/es/components/info-header/src/components/patientInfo/index.vue2.js +1 -1
  128. package/es/components/keyboard/src/components/NumberPanel.vue2.js +1 -1
  129. package/es/components/map/src/Map.vue2.js +1 -1
  130. package/es/components/quick-search/src/index.vue2.js +1 -1
  131. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  132. package/es/components/scale-view/src/components/formitem/r-sign.js +1 -1
  133. package/es/components/scale-view/src/components/formitem/standard-modal.js +1 -1
  134. package/es/components/scale-view/src/hooks/scaleview-methods.js +1 -1
  135. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  136. package/es/components/select-label/src/SelectLabel.vue2.js +1 -1
  137. package/es/components/select-label/src/ihoLabel/IhoSelectLabel.vue2.js +1 -1
  138. package/es/components/table-export-field/src/components/ExportModal.vue2.js +1 -1
  139. package/es/components/table-export-field/src/components/SaveProjectModal.vue2.js +1 -1
  140. package/es/components/table-filter/src/components/bi-filter/helpers/options.js +1 -1
  141. package/es/components/table-filter/src/components/render-widget/helpers/dateExtraMap.js +1 -1
  142. package/es/components/table-filter/src/tool/baseOptions.js +1 -1
  143. package/es/components/template-render/src/components/index.d.ts +23 -23
  144. package/es/components/tooth-bitmap/src/ToothBitmap.vue2.js +1 -1
  145. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue2.js +1 -1
  146. package/es/components/vod-chunk-upload/src/vod-upload-modal.js +1 -1
  147. package/es/env.d.ts +25 -25
  148. package/es/shared/assets/img/ai__avatar.png.js +1 -1
  149. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  150. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  151. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  152. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  153. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  154. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  155. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  156. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  157. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  158. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  159. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  160. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  161. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  162. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  163. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  164. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  165. package/es/shared/assets/img/failure.png.js +1 -1
  166. package/es/shared/assets/img/logo.png.js +1 -1
  167. package/es/shared/assets/img/no-permission.png.js +1 -1
  168. package/es/shared/assets/img/nodata.png.js +1 -1
  169. package/es/shared/assets/img/notfound.png.js +1 -1
  170. package/es/shared/assets/img/qr.png.js +1 -1
  171. package/es/shared/assets/img/success.png.js +1 -1
  172. package/es/shared/assets/img/table_style_2.png.js +1 -1
  173. package/es/shared/assets/img/video.png.js +1 -1
  174. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  175. package/es/shared/assets/img/xb_big.png.js +1 -1
  176. package/es/shared/assets/img/xb_small.png.js +1 -1
  177. package/es/shared/hooks/useLevelSearchCascader.js +1 -1
  178. package/es/shared/package.json.js +1 -1
  179. package/package.json +2 -2
  180. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  181. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  182. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  183. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  184. package/es/components/fabric-chart/src/hooks/temperature/useShadow.js +0 -1
  185. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  186. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  187. package/es/shared/utils/tapable/index.d.ts +0 -139
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,inject as l,createVNode as a,mergeProps as o,isVNode as n}from"vue";import i from"../../../../../shared/components/CancelRadio/CancelRadio.js";import{connect as r,mapProps as u}from"@formily/vue";import{cloneDeep as s,isArray as d,xor as c,isNumber as p,isEmpty as v}from"lodash-es";import{NCheckboxGroup as m,NCheckbox as f,NRadioGroup as h}from"naive-ui";import"../../../index.js";import{InjectionChangeContextCollector as y}from"../../constants/index.js";import{useComplexOptions as g}from"../../hooks/useComplexOptions.js";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"../../utils/business.js";import{assignUpdateValue as j,createVisitedSetter as b}from"../../utils/schema.js";import{useUrlConfigOptions as x,useAutographOptions as C}from"../../hooks/useFormRenderOptions.js";import{useCommonInjection as F}from"../../hooks/useCommonInjection.js";import{useFormField as k}from"../../hooks/useFormField.js";function S(i,r,u){return e({name:i,props:{value:{type:[String,Number,Object,Array]},options:{type:Array,default:()=>[]},urlConfig:{type:Object},autograph:{type:String},lazyRequest:{type:Boolean,default:!1},requestCache:{type:Boolean,default:!0},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},wordbook:{type:Object},vertical:{type:Boolean,default:!1},childFieldStrategy:{type:String,default:"checked"},childWidthMode:{type:String,default:"outer"},clearable:Boolean,selectAll:Boolean,onChange:{}},emits:["update:value"],setup(e,{emit:i,attrs:h}){const{field:j,fieldKey:S}=k();const w=t({get(){return t=e.value,p(t)?t+"":t;var t},set(e){i("update:value",e)}}),{renderComplexOption:O}=g(e,w),{labelKey:B,valueKey:_,fullOptions:K}=e.urlConfig?x(e,w):C(e,w);l(y).setContext(S.value,(e=>{return{currentOption:s((t=e,d(t)?function(e){const t=K.value.reduce(((e,t)=>(e[t[_.value]]=t,e)),{});return e.map((e=>t[e]))}(t):(l=t,K.value.find((e=>e[_.value]===l))))),labelField:B.value,valueField:_.value};var t,l}));const{injectValueBindKey:W,injectValueValidate:R}=F();R(w);const A=W(w);function I(){w.value=null}const M=t({get:()=>d(w.value)&&w.value.length===K.value.length,set(e){const t=e?K.value.map((e=>e[_.value])):[];c(t,w.value).length&&(w.value=t)}}),V=t((()=>d(e.value)&&e.value.length&&e.value.length<K.value.length));function P(t){let l;const o={display:"flex",alignItems:"center"};if(t.__spanPercent&&"inner"===e.childWidthMode){const e=`${t.__spanPercent}%`;o.maxWidth=e,function(e,t){return!v(t.childrenFields)&&(d(e)?e.includes(t[_.value]):e===t[_.value])}(w.value,t)&&(o.width=e)}return a(u,{key:t[_.value],value:t[_.value],disabled:t.disabled,currentValue:w.value,cancelable:e.clearable,onCancel:I,style:o},"function"==typeof(i=l=O({value:w.value,option:t,valueKey:_.value,labelKey:B.value,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode}))||"[object Object]"===Object.prototype.toString.call(i)&&!n(i)?l:{default:()=>[l]});var i}return()=>{const t=K.value.map((e=>{var t;const l=null==(t=e.childrenFields)?void 0:t.reduce(((e,t)=>e+ +(t.elem_width||3)),0);return{...e,__spanPercent:(l||0)/12*100}})),l={display:"flex",flexDirection:e.vertical?"column":"row",flexWrap:"wrap",justifyItems:"flex-start",alignItems:e.vertical?"flex-start":"center",width:"100%"},n=a(r,o({key:A.value,value:w.value,"onUpdate:value":e=>w.value=e,onClick:b(j),style:{width:"100%"}},h),{default:()=>[a("section",{style:l},[t.map(P)])]});return e.selectAll?a("section",null,[[r!==m?null:a(f,{checked:M.value,"onUpdate:checked":e=>M.value=e,indeterminate:V.value},{default:()=>{var e;return(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.37"))||"全选"}}),n]]):n}}})}const w=r(S("FormRadio",h,i),u({dataSource:"options"},j)),O=r(S("FormCheckbox",m,f),u({dataSource:"options"},j));export{O as CHECKBOX,w as RADIO};
1
+ import{defineComponent as e,computed as t,inject as l,createVNode as a,mergeProps as o,isVNode as n}from"vue";import i from"../../../../../shared/components/CancelRadio/CancelRadio.js";import{connect as r,mapProps as u}from"@formily/vue";import{cloneDeep as s,isArray as d,xor as c,isNumber as p,isEmpty as v}from"lodash-es";import{NCheckboxGroup as m,NCheckbox as f,NRadioGroup as h}from"naive-ui";import"../../../index.js";import{InjectionChangeContextCollector as y}from"../../constants/index.js";import{useComplexOptions as g}from"../../hooks/useComplexOptions.js";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"./text.js";import"../../utils/business.js";import{assignUpdateValue as j,createVisitedSetter as b}from"../../utils/schema.js";import{useUrlConfigOptions as x,useAutographOptions as C}from"../../hooks/useFormRenderOptions.js";import{useCommonInjection as F}from"../../hooks/useCommonInjection.js";import{useFormField as k}from"../../hooks/useFormField.js";function S(i,r,u){return e({name:i,props:{value:{type:[String,Number,Object,Array]},options:{type:Array,default:()=>[]},urlConfig:{type:Object},autograph:{type:String},lazyRequest:{type:Boolean,default:!1},requestCache:{type:Boolean,default:!0},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},wordbook:{type:Object},vertical:{type:Boolean,default:!1},childFieldStrategy:{type:String,default:"checked"},childWidthMode:{type:String,default:"outer"},clearable:Boolean,selectAll:Boolean,onChange:{}},emits:["update:value"],setup(e,{emit:i,attrs:h}){const{field:j,fieldKey:S}=k();const w=t({get(){return t=e.value,p(t)?t+"":t;var t},set(e){i("update:value",e)}}),{renderComplexOption:O}=g(e,w),{labelKey:B,valueKey:_,fullOptions:K}=e.urlConfig?x(e,w):C(e,w);l(y).setContext(S.value,(e=>{return{currentOption:s((t=e,d(t)?function(e){const t=K.value.reduce(((e,t)=>(e[t[_.value]]=t,e)),{});return e.map((e=>t[e]))}(t):(l=t,K.value.find((e=>e[_.value]===l))))),labelField:B.value,valueField:_.value};var t,l}));const{injectValueBindKey:W,injectValueValidate:R}=F();R(w);const A=W(w);function I(){w.value=null}const M=t({get:()=>d(w.value)&&w.value.length===K.value.length,set(e){const t=e?K.value.map((e=>e[_.value])):[];c(t,w.value).length&&(w.value=t)}}),V=t((()=>d(e.value)&&e.value.length&&e.value.length<K.value.length));function P(t){let l;const o={display:"flex",alignItems:"center"};if(t.__spanPercent&&"inner"===e.childWidthMode){const e=`${t.__spanPercent}%`;o.maxWidth=e,function(e,t){return!v(t.childrenFields)&&(d(e)?e.includes(t[_.value]):e===t[_.value])}(w.value,t)&&(o.width=e)}return a(u,{key:t[_.value],value:t[_.value],disabled:t.disabled,currentValue:w.value,cancelable:e.clearable,onCancel:I,style:o},"function"==typeof(i=l=O({value:w.value,option:t,valueKey:_.value,labelKey:B.value,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode}))||"[object Object]"===Object.prototype.toString.call(i)&&!n(i)?l:{default:()=>[l]});var i}return()=>{const t=K.value.map((e=>{var t;const l=null==(t=e.childrenFields)?void 0:t.reduce(((e,t)=>e+ +(t.elem_width||3)),0);return{...e,__spanPercent:(l||0)/12*100}})),l={display:"flex",flexDirection:e.vertical?"column":"row",flexWrap:"wrap",justifyItems:"flex-start",alignItems:e.vertical?"flex-start":"center",width:"100%"},n=a(r,o({key:A.value,value:w.value,"onUpdate:value":e=>w.value=e,onClick:b(j),style:{width:"100%"}},h),{default:()=>[a("section",{style:l},[t.map(P)])]});return e.selectAll?a("section",null,[[r!==m?null:a(f,{checked:M.value,"onUpdate:checked":e=>M.value=e,indeterminate:V.value},{default:()=>{var e;return(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.37"))||"全选"}}),n]]):n}}})}const w=r(S("FormRadio",h,i),u({dataSource:"options"},j)),O=r(S("FormCheckbox",m,f),u({dataSource:"options"},j));export{O as CHECKBOX,w as RADIO};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as a,inject as l,watch as o,createVNode as r,nextTick as n}from"vue";import{connect as u,mapProps as i}from"@formily/vue";import{last as s,isEqual as c,isArray as p,isString as d}from"lodash-es";import{NCascader as v}from"naive-ui";import"../../../index.js";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as f,InjectionAsyncQueue as h,InjectionFormUUID as y}from"../../constants/index.js";import"@formily/path";import"@vueuse/core";import"../../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"../../utils/business.js";import{assignUpdateValue as k,createVisitedSetter as j,traverseDependKey as g}from"../../utils/schema.js";import"date-fns";import"../../hooks/useComplexOptions.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"@vueuse/shared";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../../shared/hooks/useScrollLoading.js";import"./index.js";import{useFormField as b}from"../../hooks/useFormField.js";import"@formily/reactive";import"../../hooks/useFormValidator.js";const C=u(e({name:"FormCascader",props:{options:{type:Array,default:()=>[]},depth:{type:[Number,String]},urlConfig:{type:Object},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},onFocus:{type:Function},filterable:{type:Boolean,default:!1},checkStrategy:{type:String,default:"child"},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},onChange:{},value:{}},emits:["update:value"],setup(e,{slots:u,emit:i}){const k=t(),{field:C,title:S,fieldKey:F}=b(),w=t(1),A=t(!0);const H=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.nameKey)?a:e.labelField)?l:"text"})),x=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.valueKey)?a:e.valueField)?l:"value"}));l(f).setContext(F.value,(()=>({labelField:H.value,valueField:x.value})));const q=a((()=>{var t;try{const a=Array.isArray(e.value)?e.value:JSON.parse(e.value||"");if(!Array.isArray(a)||!a.length)return null;const l=null==(t=s(a))?void 0:t[x.value];return null!=l?l:a.map((e=>e[H.value])).join(" / ")}catch(e){return null}}));function K(e,t,a){i("update:value",p(a)?a.map((function(e){return{...e,label:e[H.value],children:void 0,parent:void 0,mergeItemValue:void 0}})):null)}const L=l(h);async function V(t){e.filterable?await async function(){if(!e.urlConfig||k.value&&e.requestCache)return;const t=await L.addAsync({...e.urlConfig,params:{lvlnr:"1"},key:F.value,cache:e.requestCache,payload:{field:C.value,labelKey:H.value,valueKey:x.value}});function a(e,t,o){const r=[...o,...l(e)],n={[H.value]:e[H.value],[x.value]:e[x.value],depth:t+1,isLeaf:!0,keyword:e.keyword,mergeItemValue:r};return p(e.children)&&(n.children=e.children.map((e=>a(e,t+1,r))),n.isLeaf=!e.children.length),w.value=Math.max(w.value,t+1),n}function l(e){let t=[];if(d(e[H.value])&&(t=[...t,e[H.value]]),d(e.keyword)&&e.keyword.length>0){const a=e.keyword.split(",");t=[...t,...a]}return t}k.value=t.map((e=>a(e,0,[])))}():await async function(t){if(o(e,t))return;const a=await L.addAsync(r(s(t),i(e),S.value,t));if(!a.length&&t)return t.isLeaf=!0,K(0,0,n(t)),void(N.value=!1);const l=a.map((e=>u(e,s(t))));function o(e,t){return!i(e)||!t&&k.value&&e.requestCache||s(t)>=s(e)-1}function r(t,a,l,o){const r={lvlnr:t+1+""};return o&&a.dependKey&&g(a.dependKey,((e,t)=>{r[t]=o[e]})),{params:r,...a,key:l,cache:e.requestCache}}function n(e){let t=e;const a=[e];for(;t.parent;)a.unshift(t.parent),t=t.parent;return a}function u(a,l){return{[H.value]:a[H.value],[x.value]:a[x.value],depth:l+1,parent:t,isLeaf:l+2>=s(e)}}function i(e){return e.urlConfig}function s(e){var t;return null!=(t=null==e?void 0:e.depth)?t:-1}t?t.children=l:k.value=l}(t),await I()}const B=`form-render__cascade--menu-${l(y)}`;async function I(){await n();const e=document.querySelector(`.${B} .v-vl`);e&&e.dispatchEvent(new CustomEvent("scroll"))}function E(t,a){if(!t||!a)return!1;const{mergeItemValue:l}=a;return!(e.checkStrategy.includes("child")&&a.depth<w.value)&&(l.length>0&&l.some((e=>e.includes(t.trim()))))}const{injectValueValidate:O,injectValueWatchFromEmpty:W,injectValueBindKey:z}=m();W((()=>e.value),V),O((()=>e.value)),o((()=>e.urlConfig),(async(t,a)=>{c(t,a)||(k.value=null,A.value?e.lazyRequest||(V(),A.value=!A.value):await V())}),{immediate:!0});const N=t(!1);function P(e){N.value=!!e,e&&V()}const R=a((()=>k.value||e.options||[])),U=a((()=>!e.filterable)),$=z(q);return()=>r(v,{key:$.value,remote:U.value,filterable:e.filterable,"menu-props":{class:B,onClick:I},"check-strategy":e.checkStrategy,show:!!N.value,"onUpdate:show":P,value:q.value,filter:E,"onUpdate:value":K,labelField:H.value,valueField:x.value,options:R.value,onLoad:V,onFocus:j(C)},u)}}),i({dataSource:"options"},k));export{C as SEARCH_CASCADER};
1
+ import{defineComponent as e,ref as t,computed as a,inject as l,watch as o,createVNode as r,nextTick as n}from"vue";import{connect as u,mapProps as i}from"@formily/vue";import{last as s,isEqual as c,isArray as p,isString as d}from"lodash-es";import{NCascader as v}from"naive-ui";import"../../../index.js";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as f,InjectionAsyncQueue as h,InjectionFormUUID as y}from"../../constants/index.js";import"@formily/path";import"@vueuse/core";import"../../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"./text.js";import"../../utils/business.js";import{assignUpdateValue as k,createVisitedSetter as j,traverseDependKey as g}from"../../utils/schema.js";import"date-fns";import"../../hooks/useComplexOptions.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"@vueuse/shared";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import"../../../../../shared/hooks/useScrollLoading.js";import"./index.js";import{useFormField as b}from"../../hooks/useFormField.js";import"@formily/reactive";import"../../hooks/useFormValidator.js";const C=u(e({name:"FormCascader",props:{options:{type:Array,default:()=>[]},depth:{type:[Number,String]},urlConfig:{type:Object},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},onFocus:{type:Function},filterable:{type:Boolean,default:!1},checkStrategy:{type:String,default:"child"},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},onChange:{},value:{}},emits:["update:value"],setup(e,{slots:u,emit:i}){const k=t(),{field:C,title:S,fieldKey:F}=b(),w=t(1),A=t(!0);const x=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.nameKey)?a:e.labelField)?l:"text"})),H=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.valueKey)?a:e.valueField)?l:"value"}));l(f).setContext(F.value,(()=>({labelField:x.value,valueField:H.value})));const q=a((()=>{var t;try{const a=Array.isArray(e.value)?e.value:JSON.parse(e.value||"");if(!Array.isArray(a)||!a.length)return null;const l=null==(t=s(a))?void 0:t[H.value];return null!=l?l:a.map((e=>e[x.value])).join(" / ")}catch(e){return null}}));function K(e,t,a){i("update:value",p(a)?a.map((function(e){return{...e,label:e[x.value],children:void 0,parent:void 0,mergeItemValue:void 0}})):null)}const L=l(h);async function V(t){e.filterable?await async function(){if(!e.urlConfig||k.value&&e.requestCache)return;const t=await L.addAsync({...e.urlConfig,params:{lvlnr:"1"},key:F.value,cache:e.requestCache,payload:{field:C.value,labelKey:x.value,valueKey:H.value}});function a(e,t,o){const r=[...o,...l(e)],n={[x.value]:e[x.value],[H.value]:e[H.value],depth:t+1,isLeaf:!0,keyword:e.keyword,mergeItemValue:r};return p(e.children)&&(n.children=e.children.map((e=>a(e,t+1,r))),n.isLeaf=!e.children.length),w.value=Math.max(w.value,t+1),n}function l(e){let t=[];if(d(e[x.value])&&(t=[...t,e[x.value]]),d(e.keyword)&&e.keyword.length>0){const a=e.keyword.split(",");t=[...t,...a]}return t}k.value=t.map((e=>a(e,0,[])))}():await async function(t){if(o(e,t))return;const a=await L.addAsync(r(s(t),i(e),S.value,t));if(!a.length&&t)return t.isLeaf=!0,K(0,0,n(t)),void(N.value=!1);const l=a.map((e=>u(e,s(t))));function o(e,t){return!i(e)||!t&&k.value&&e.requestCache||s(t)>=s(e)-1}function r(t,a,l,o){const r={lvlnr:t+1+""};return o&&a.dependKey&&g(a.dependKey,((e,t)=>{r[t]=o[e]})),{params:r,...a,key:l,cache:e.requestCache}}function n(e){let t=e;const a=[e];for(;t.parent;)a.unshift(t.parent),t=t.parent;return a}function u(a,l){return{[x.value]:a[x.value],[H.value]:a[H.value],depth:l+1,parent:t,isLeaf:l+2>=s(e)}}function i(e){return e.urlConfig}function s(e){var t;return null!=(t=null==e?void 0:e.depth)?t:-1}t?t.children=l:k.value=l}(t),await I()}const B=`form-render__cascade--menu-${l(y)}`;async function I(){await n();const e=document.querySelector(`.${B} .v-vl`);e&&e.dispatchEvent(new CustomEvent("scroll"))}function E(t,a){if(!t||!a)return!1;const{mergeItemValue:l}=a;return!(e.checkStrategy.includes("child")&&a.depth<w.value)&&(l.length>0&&l.some((e=>e.includes(t.trim()))))}const{injectValueValidate:O,injectValueWatchFromEmpty:W,injectValueBindKey:z}=m();W((()=>e.value),V),O((()=>e.value)),o((()=>e.urlConfig),(async(t,a)=>{c(t,a)||(k.value=null,A.value?e.lazyRequest||(V(),A.value=!A.value):await V())}),{immediate:!0});const N=t(!1);function P(e){N.value=!!e,e&&V()}const R=a((()=>k.value||e.options||[])),U=a((()=>!e.filterable)),$=z(q);return()=>r(v,{key:$.value,remote:U.value,filterable:e.filterable,"menu-props":{class:B,onClick:I},"check-strategy":e.checkStrategy,show:!!N.value,"onUpdate:show":P,value:q.value,filter:E,"onUpdate:value":K,labelField:x.value,valueField:H.value,options:R.value,onLoad:V,onFocus:j(C)},u)}}),i({dataSource:"options"},k));export{C as SEARCH_CASCADER};
@@ -1 +1 @@
1
- import{defineComponent as e,computed as o,watch as t,inject as l,useAttrs as a,ref as r,createVNode as s,mergeProps as n,toRaw as u}from"vue";import{arrayed as i}from"../../../../../shared/utils/index.js";import{NSelect as p}from"naive-ui";import"@vueuse/core";import"date-fns";import{cloneDeep as m,isArray as d,isObject as c,omit as v,xor as y}from"lodash-es";import"@vue/shared";import{useSelectAllowModify as f}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as h}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import"../../../../../shared/hooks/useScrollLoading.js";import{connect as b,mapProps as j}from"@formily/vue";import{useCommonInjection as S,useSelectOptionProps as g}from"../../hooks/useCommonInjection.js";import{useComplexOptions as k,useComplexOptionsSpan as C}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as F,InjectionFormUUID as B}from"../../constants/index.js";import"@formily/path";import"@formily/core";import"@vicons/ionicons5";import"../../utils/business.js";import{assignUpdateValue as w,assignClearBindVisited as A,createVisitedSetter as H}from"../../utils/schema.js";import"../../../index.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"./index.js";import"@vueuse/shared";import{useFormField as O}from"../../hooks/useFormField.js";import"@formily/reactive";import{useUrlConfigOptions as K,useAutographOptions as R,useRecommendOptions as x}from"../../hooks/useFormRenderOptions.js";import"../../hooks/useFormValidator.js";const V=b(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean},searchByValue:{type:Boolean},wordSplitFilter:{}},emits:["update:value","postRecommend","patternChange"],setup(e,{slots:b,emit:j}){const w=o({get:()=>e.value,async set(e){j("update:value",e),G(e)}}),{labelKey:A,valueKey:V,showKey:L,fetchData:P,searchContent:_,fullOptions:N,filterOptions:I,remoteOptions:W,loading:q}=e.urlConfig?K(e,w):R(e,w);t(_,(e=>{j("patternChange",{pattern:e,options:ue.value})}));const{modifyEvent:E,modifyAbleRef:z,getOptionsWithCreated:M}=f(e,{searchContent:_,labelKey:A,valueKey:V,valueRef:w,fullOptions:N}),{renderComplexOption:T,hasComplexOption:U}=k(e,w),{getRecommend:D,postRecommend:G,sortedOptions:J}=x(e,I,j,A,V),{field:Q,fieldKey:X}=O();l(F).setContext(X.value,(e=>({currentOption:m(function(e){const o=M(N.value);return d(e)?function(e){const t=o.reduce(((e,o)=>(e[o[V.value]]=o,e)),{});return e.map((e=>t[e]))}(e):(t=e,o.find((e=>e[V.value]===t)));var t}(e)),labelField:A.value,valueField:V.value})));const Y=async e=>(_.value=e,Promise.allSettled([P(e),D(e)])),{injectValueValidate:Z,injectValueWatchFromEmpty:$,injectValueBindKey:ee}=S();$(w,(()=>e.lazyRequest&&Y())),Z(w);const oe=ee(w),{menuProps:te,nodeProps:le}=g(),{renderTag:ae,renderLabel:re,renderSelectAll:se,titleRef:ne}=h(e,{labelKey:A,valueKey:V,valueRef:w,showKey:L,searchContent:_}),ue=o((()=>M(z.value?N.value:J.value))),ie=a(),pe=o((()=>{if(e.allowCreate||e.showCustomValue)return w.value;const o=e.multiple&&d(w.value);return N.value.find((e=>o?w.value.includes(e[V.value]):e[V.value]===w.value))?w.value:null})),me=r(!1);async function de(e){e&&await Y(),me.value=e}async function ce(e,o){await E.updateValue(e,o),W.value&&o&&i(o).forEach((e=>{if(!c(e))return;const o=e;o.created&&o.shouldSave&&W.value.push(v(u(o),["created","shouldSave"]))}))}const ve=l(B),{getSpan:ye}=C(),fe=H(Q,E.focus);function he(o){if(!e.multiple)return;const t=o?ue.value.map((e=>e[V.value])):[];y(t,e.value).length&&(w.value=t)}function be(o){let t=b;return e.multiple&&e.selectAll&&(t={action:()=>se(he),...b}),s(p,n({title:ne.value,key:oe.value,multiple:e.multiple,remote:!0,filterable:!0,loading:q.value,value:pe.value,onUpdateValue:ce,"menu-props":te,"node-props":le,labelField:A.value,valueField:V.value,options:ue.value,onSearch:Y,show:me.value,"onUpdate:show":de,onFocus:fe,onBlur:E.blur,renderLabel:re,renderTag:ae},o,ie),t)}return()=>{var e,o;if(!U.value)return be();const t=null!=(o=null==(e=Q.value.decoratorProps)?void 0:e.span)?o:6,l=ye(ve,Q.value.address);return s("section",{class:"form-render__selectChildField",style:{"--column":l+t}},[be({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),N.value.map((e=>T({option:e,value:w.value,valueKey:V.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),j({dataSource:"options"},w,A));export{V as SELECT};
1
+ import{defineComponent as e,computed as o,watch as t,inject as l,useAttrs as a,ref as r,createVNode as s,mergeProps as n,toRaw as u}from"vue";import{arrayed as i}from"../../../../../shared/utils/index.js";import{NSelect as p}from"naive-ui";import"@vueuse/core";import"date-fns";import{cloneDeep as m,isArray as d,isObject as c,omit as v,xor as y}from"lodash-es";import"@vue/shared";import{useSelectAllowModify as f}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as h}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import"../../../../../shared/hooks/useScrollLoading.js";import{connect as j,mapProps as b}from"@formily/vue";import{useCommonInjection as S,useSelectOptionProps as g}from"../../hooks/useCommonInjection.js";import{useComplexOptions as k,useComplexOptionsSpan as C}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as F,InjectionFormUUID as B}from"../../constants/index.js";import"@formily/path";import"@formily/core";import"@vicons/ionicons5";import"./text.js";import"../../utils/business.js";import{assignUpdateValue as w,assignClearBindVisited as A,createVisitedSetter as H}from"../../utils/schema.js";import"../../../index.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"./index.js";import"@vueuse/shared";import{useFormField as O}from"../../hooks/useFormField.js";import"@formily/reactive";import{useUrlConfigOptions as K,useAutographOptions as R,useRecommendOptions as x}from"../../hooks/useFormRenderOptions.js";import"../../hooks/useFormValidator.js";const V=j(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean},searchByValue:{type:Boolean},wordSplitFilter:{}},emits:["update:value","postRecommend","patternChange"],setup(e,{slots:j,emit:b}){const w=o({get:()=>e.value,async set(e){b("update:value",e),G(e)}}),{labelKey:A,valueKey:V,showKey:L,fetchData:P,searchContent:_,fullOptions:N,filterOptions:I,remoteOptions:W,loading:q}=e.urlConfig?K(e,w):R(e,w);t(_,(e=>{b("patternChange",{pattern:e,options:ue.value})}));const{modifyEvent:E,modifyAbleRef:z,getOptionsWithCreated:M}=f(e,{searchContent:_,labelKey:A,valueKey:V,valueRef:w,fullOptions:N}),{renderComplexOption:T,hasComplexOption:U}=k(e,w),{getRecommend:D,postRecommend:G,sortedOptions:J}=x(e,I,b,A,V),{field:Q,fieldKey:X}=O();l(F).setContext(X.value,(e=>({currentOption:m(function(e){const o=M(N.value);return d(e)?function(e){const t=o.reduce(((e,o)=>(e[o[V.value]]=o,e)),{});return e.map((e=>t[e]))}(e):(t=e,o.find((e=>e[V.value]===t)));var t}(e)),labelField:A.value,valueField:V.value})));const Y=async e=>(_.value=e,Promise.allSettled([P(e),D(e)])),{injectValueValidate:Z,injectValueWatchFromEmpty:$,injectValueBindKey:ee}=S();$(w,(()=>e.lazyRequest&&Y())),Z(w);const oe=ee(w),{menuProps:te,nodeProps:le}=g(),{renderTag:ae,renderLabel:re,renderSelectAll:se,titleRef:ne}=h(e,{labelKey:A,valueKey:V,valueRef:w,showKey:L,searchContent:_}),ue=o((()=>M(z.value?N.value:J.value))),ie=a(),pe=o((()=>{if(e.allowCreate||e.showCustomValue)return w.value;const o=e.multiple&&d(w.value);return N.value.find((e=>o?w.value.includes(e[V.value]):e[V.value]===w.value))?w.value:null})),me=r(!1);async function de(e){e&&await Y(),me.value=e}async function ce(e,o){await E.updateValue(e,o),W.value&&o&&i(o).forEach((e=>{if(!c(e))return;const o=e;o.created&&o.shouldSave&&W.value.push(v(u(o),["created","shouldSave"]))}))}const ve=l(B),{getSpan:ye}=C(),fe=H(Q,E.focus);function he(o){if(!e.multiple)return;const t=o?ue.value.map((e=>e[V.value])):[];y(t,e.value).length&&(w.value=t)}function je(o){let t=j;return e.multiple&&e.selectAll&&(t={action:()=>se(he),...j}),s(p,n({title:ne.value,key:oe.value,multiple:e.multiple,remote:!0,filterable:!0,loading:q.value,value:pe.value,onUpdateValue:ce,"menu-props":te,"node-props":le,labelField:A.value,valueField:V.value,options:ue.value,onSearch:Y,show:me.value,"onUpdate:show":de,onFocus:fe,onBlur:E.blur,renderLabel:re,renderTag:ae},o,ie),t)}return()=>{var e,o;if(!U.value)return je();const t=null!=(o=null==(e=Q.value.decoratorProps)?void 0:e.span)?o:6,l=ye(ve,Q.value.address);return s("section",{class:"form-render__selectChildField",style:{"--column":l+t}},[je({class:"form-render__selectChildFieldItem",style:{"--form-item-column":t}}),N.value.map((e=>T({option:e,value:w.value,valueKey:V.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),b({dataSource:"options"},w,A));export{V as SELECT};
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as o,ref as i,computed as l,createVNode as t,mergeProps as u,createTextVNode as r}from"vue";import{NSwitch as n,NModal as a,NCheckbox as d}from"naive-ui";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import"../../utils/business.js";import{assignUpdateValue as s,assignValueBindKey as v}from"../../utils/schema.js";import{connect as p,mapProps as c}from"@formily/vue";import"../../../index.js";import{useFormField as m}from"../../hooks/useFormField.js";const w=p(e({name:"FormSwitch",props:{value:{},openDescription:{type:Object},closeDescription:{type:Object},showMode:{type:String,default:"SWITCH"},onChange:{}},emits:["update:value"],setup(e,{emit:s}){const v=o(),p=i(!1),{field:c,fieldKey:w}=m(),h=l((()=>{var e,o;return null==(o=null==(e=c.value.decoratorProps)?void 0:e.fieldItem)?void 0:o.requiredReminderContent})),f=l((()=>{var o,i;return null==(i=null==(o=e.openDescription)?void 0:o.value)||i})),g=l((()=>{var o,i;return null!=(i=null==(o=e.closeDescription)?void 0:o.value)&&i})),y=()=>{var o,i;return r(null!=(i=null==(o=e.openDescription)?void 0:o.describe)?i:"")},C=()=>{var o,i;return r(null!=(i=null==(o=e.closeDescription)?void 0:o.describe)?i:"")},j=l({get:()=>e.value===f.value,set(o){if(!h.value||"SWITCH"!==e.showMode||o)return s("update:value",o?f.value:g.value);p.value=!0}});function k(){s("update:value",g.value)}return()=>{return"SWITCH"===e.showMode?[t(n,u({value:j.value,"onUpdate:value":e=>j.value=e},v),{checked:y,unchecked:C}),h.value?t(a,{show:p.value,"onUpdate:show":e=>p.value=e,"display-directive":"show",preset:"dialog",title:(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.428"))||"确认","positive-text":(null==(i=window.getLanguageByCode)?void 0:i.call(window,"10010.1.428"))||"确认","negative-text":(null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.32"))||"取消",content:h.value,onPositiveClick:k},null):null]:t(d,{checked:j.value,"onUpdate:checked":e=>j.value=e},{default:y});var o,i,l}}}),c(s,v));export{w as SWITCH};
1
+ import{defineComponent as e,useAttrs as o,ref as i,computed as l,createVNode as t,mergeProps as r,createTextVNode as u}from"vue";import{NSwitch as n,NModal as a,NCheckbox as d}from"naive-ui";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import"./text.js";import"../../utils/business.js";import{assignUpdateValue as s,assignValueBindKey as v}from"../../utils/schema.js";import{connect as p,mapProps as c}from"@formily/vue";import"../../../index.js";import{useFormField as m}from"../../hooks/useFormField.js";const w=p(e({name:"FormSwitch",props:{value:{},openDescription:{type:Object},closeDescription:{type:Object},showMode:{type:String,default:"SWITCH"},onChange:{}},emits:["update:value"],setup(e,{emit:s}){const v=o(),p=i(!1),{field:c,fieldKey:w}=m(),h=l((()=>{var e,o;return null==(o=null==(e=c.value.decoratorProps)?void 0:e.fieldItem)?void 0:o.requiredReminderContent})),f=l((()=>{var o,i;return null==(i=null==(o=e.openDescription)?void 0:o.value)||i})),g=l((()=>{var o,i;return null!=(i=null==(o=e.closeDescription)?void 0:o.value)&&i})),y=()=>{var o,i;return u(null!=(i=null==(o=e.openDescription)?void 0:o.describe)?i:"")},C=()=>{var o,i;return u(null!=(i=null==(o=e.closeDescription)?void 0:o.describe)?i:"")},j=l({get:()=>e.value===f.value,set(o){if(!h.value||"SWITCH"!==e.showMode||o)return s("update:value",o?f.value:g.value);p.value=!0}});function k(){s("update:value",g.value)}return()=>{return"SWITCH"===e.showMode?[t(n,r({value:j.value,"onUpdate:value":e=>j.value=e},v),{checked:y,unchecked:C}),h.value?t(a,{show:p.value,"onUpdate:show":e=>p.value=e,"display-directive":"show",preset:"dialog",title:(null==(o=window.getLanguageByCode)?void 0:o.call(window,"10010.1.428"))||"确认","positive-text":(null==(i=window.getLanguageByCode)?void 0:i.call(window,"10010.1.428"))||"确认","negative-text":(null==(l=window.getLanguageByCode)?void 0:l.call(window,"10010.1.28"))||"取消",content:h.value,onPositiveClick:k},null):null]:t(d,{checked:j.value,"onUpdate:checked":e=>j.value=e},{default:y});var o,i,l}}}),c(s,v));export{w as SWITCH};
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,inject as n,createVNode as o}from"vue";import{connect as r,mapProps as l,RecursionField as i}from"@formily/vue";import{isString as s}from"lodash-es";import"../../../index.js";import{InjectionBusinessCollector as a,InjectionFormGlobalProps as u}from"../../constants/index.js";import{createSlot as m,replace2Any as c}from"../../utils/index.js";import{useFieldListAdaptor as p}from"../../hooks/useFieldListAdaptor.js";import{createObjSchema as d}from"../../utils/schema.js";const f=r(e({name:"FORM_TEXT",props:{content:{},fieldItem:{type:Object},value:{},onChange:{}},setup(e){function r(t,n=!1,r=!0){return r?o("div",{style:n?{display:"flex",alignItems:"center"}:{}},[l()]):l();function l(){var n,r;return null==(r=(n=m(t,e,(e=>s(e)?e=c(e.replace("\n","<br>"),[{from:"<br>",to:o("i",{style:{width:"100%",height:"4px"}},null)},{from:" ",to:o("i",{style:{display:"inline-block",width:"4px"}},null)}]):[e]))).default)?void 0:r.call(n)}}const l=t((()=>{var t,n;return null!=(n=null==(t=e.fieldItem)?void 0:t.__textEnhance)?n:[]})),f=t((()=>l.value.length&&l.value.some((e=>"widget"===e.type)))),v=n(a),h=n(u),{schemaAdaptor:y}=p(v,h.lifeCycle);return()=>{var t;return f.value?o("div",{style:{display:"flex",alignItems:"center"}},[l.value.map((e=>{if("text"===e.type)return r(e.content,!0,!1);if(s(e.content))return r(e.content,!0,!1);const t={...e.content};return t.decoratorProps={...t.decoratorProps,showLabel:!1,showFeedback:!1},o(i,{basePath:".",schema:d(y([t]))},null)}))]):r(null!=(t=e.content)?t:e.value)}}}),l((e=>{var t;return{...e,content:null==(t=e.fieldItem)?void 0:t.content}})));export{f as TEXT};
1
+ import{defineComponent as e,computed as t,inject as n,createVNode as o}from"vue";import{connect as r,mapProps as l,RecursionField as i}from"@formily/vue";import{isString as s}from"lodash-es";import"../../../index.js";import{InjectionBusinessCollector as a,InjectionFormGlobalProps as u}from"../../constants/index.js";import{useFieldListAdaptor as m}from"../../hooks/useFieldListAdaptor.js";import{createObjSchema as c}from"../../utils/schema.js";import{createSlot as p,replace2Any as d}from"../../utils/index.js";const f=r(e({name:"FORM_TEXT",props:{content:{},fieldItem:{type:Object},value:{},onChange:{}},setup(e){function r(t,n=!1,r=!0){return r?o("div",{style:n?{display:"flex",alignItems:"center"}:{}},[l()]):l();function l(){var n,r;return null==(r=(n=p(t,e,(e=>s(e)?e=d(e.replace("\n","<br>"),[{from:"<br>",to:o("i",{style:{width:"100%",height:"4px"}},null)},{from:" ",to:o("i",{style:{display:"inline-block",width:"4px"}},null)}]):[e]))).default)?void 0:r.call(n)}}const l=t((()=>{var t,n;return null!=(n=null==(t=e.fieldItem)?void 0:t.__textEnhance)?n:[]})),f=t((()=>l.value.length&&l.value.some((e=>"widget"===e.type)))),v=n(a),h=n(u),{schemaAdaptor:y}=m(v,h.lifeCycle);return()=>{var t;return f.value?o("div",{style:{display:"flex",alignItems:"center"}},[l.value.map((e=>{if("text"===e.type)return r(e.content,!0,!1);if(s(e.content))return r(e.content,!0,!1);const t={...e.content};return t.decoratorProps={...t.decoratorProps,showLabel:!1,showFeedback:!1},o(i,{basePath:".",schema:c(y([t]))},null)}))]):r(null!=(t=e.content)?t:e.value)}}}),l((e=>{var t;return{...e,content:null==(t=e.fieldItem)?void 0:t.content}})));export{f as TEXT};
@@ -1 +1 @@
1
- import{defineComponent as e,computed as o,inject as r,createVNode as t,mergeProps as i}from"vue";import{InjectionFormGlobalProps as s}from"../../constants/index.js";import{useCommonInjection as u}from"../../hooks/useCommonInjection.js";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import{NInput as m}from"naive-ui";import"../../utils/business.js";import{assignUpdateValue as a,assignClearBindVisited as l}from"../../utils/schema.js";import{connect as n,mapProps as p,useField as v}from"@formily/vue";const d=n(e({name:"FormTextarea",props:{value:{type:String},rows:{type:Number}},emits:["update:value"],setup(e,{emit:a}){const l=o({get:()=>e.value,set:e=>a("update:value",e)}),n=u().injectValueBindKey(l),p=v(),d=r(s,{}),c=o((()=>{var e,o,r;return null!=(r=null==(o=null==(e=p.value.decoratorProps)?void 0:e.fieldItem)?void 0:o.bordered)?r:d.bordered})),f=o((()=>"underline"===c.value?{autosize:{minRows:e.rows,maxRows:99}}:{rows:e.rows}));return()=>t(m,i({type:"textarea"},f.value,{key:n.value,value:l.value,"onUpdate:value":e=>l.value=e}),null)}}),p(a,l));export{d as TEXTAREA};
1
+ import{defineComponent as e,computed as o,inject as r,createVNode as t,mergeProps as i}from"vue";import{InjectionFormGlobalProps as s}from"../../constants/index.js";import{useCommonInjection as u}from"../../hooks/useCommonInjection.js";import"../../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"lodash-es";import{NInput as m}from"naive-ui";import"./text.js";import"../../utils/business.js";import{assignUpdateValue as a,assignClearBindVisited as l}from"../../utils/schema.js";import{connect as n,mapProps as p,useField as v}from"@formily/vue";const d=n(e({name:"FormTextarea",props:{value:{type:String},rows:{type:Number}},emits:["update:value"],setup(e,{emit:a}){const l=o({get:()=>e.value,set:e=>a("update:value",e)}),n=u().injectValueBindKey(l),p=v(),d=r(s,{}),c=o((()=>{var e,o,r;return null!=(r=null==(o=null==(e=p.value.decoratorProps)?void 0:e.fieldItem)?void 0:o.bordered)?r:d.bordered})),f=o((()=>"underline"===c.value?{autosize:{minRows:e.rows,maxRows:99}}:{rows:e.rows}));return()=>t(m,i({type:"textarea"},f.value,{key:n.value,value:l.value,"onUpdate:value":e=>l.value=e}),null)}}),p(a,l));export{d as TEXTAREA};
@@ -1 +1 @@
1
- import{doAnimation as e}from"../../../../shared/utils/anime.js";import{Path as o}from"@formily/path";import{useDebounceFn as r,watchOnce as t}from"@vueuse/core";import{ref as n,nextTick as i,computed as l}from"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"../utils/business.js";import{createLinebarId as s}from"../utils/schema.js";function a(a,u,c,m){const v=n(),p=n(""),f=n([]),d=r((async function(e){var o;f.value=Object.values(e.fields).reduce(((e,o)=>{var r,t,n,i;return"LINEBAR"===o.componentType&&"visible"===o.selfDisplay&&e.push({title:null!=(t=null==(r=o.componentProps)?void 0:r.title)?t:o.title,name:o.address.toString(),index:null!=(i=null==(n=o.decoratorProps)?void 0:n._index)?i:0}),e}),[]).sort(((e,o)=>e.index-o.index)),await i(),null==(o=v.value)||o.syncBarPosition()}),100);let h=!1;async function y(r){h=!0;try{if(!c.value)return;m.trigger(o.parse(r),!0),await i();const t=c.value.querySelector(`#${s(r)}`);if(!t)return;await new Promise((o=>{e(c.value.scrollTop,t.offsetTop,300,(e=>{var o;null==(o=c.value)||o.scrollTo({top:e})}),"easeInSine",(()=>setTimeout(o,300)))}))}finally{h=!1}}const T=r((function(e){var o;if(h||!c.value)return;const{scrollTop:r,clientHeight:t}=c.value,n=f.value.find(((e,o,n)=>{const i=n[o+1];if(!i)return!0;const l=c.value.querySelector(`#${s(i.name)}`);return l?l.offsetTop>r+t/2:void 0}))||f.value[f.value.length-1];p.value=null!=(o=null==n?void 0:n.name)?o:"",u("scroll",e)}),300);t(f,(e=>{var o,r;p.value=null!=(r=null==(o=e[0])?void 0:o.name)?r:""}));return{currentAnchor:l({get:()=>p.value,async set(e){p.value=e,await new Promise((e=>setTimeout(e,100))),await y(e)}}),onScroll:T,anchorIdList:f,generateAnchorList:d,updateAnchorList:function(e){"LINEBAR"===e.componentType&&e.selfDisplay&&d(e.form)},scrollTo:y,anchorBarRef:v}}export{a as useAnchor};
1
+ import{doAnimation as e}from"../../../../shared/utils/anime.js";import{Path as o}from"@formily/path";import{useDebounceFn as r,watchOnce as t}from"@vueuse/core";import{ref as n,nextTick as i,computed as l}from"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"../components/renderer/text.js";import"../utils/business.js";import{createLinebarId as s}from"../utils/schema.js";function a(a,u,c,m){const p=n(),v=n(""),f=n([]),d=r((async function(e){var o;f.value=Object.values(e.fields).reduce(((e,o)=>{var r,t,n,i;return"LINEBAR"===o.componentType&&"visible"===o.selfDisplay&&e.push({title:null!=(t=null==(r=o.componentProps)?void 0:r.title)?t:o.title,name:o.address.toString(),index:null!=(i=null==(n=o.decoratorProps)?void 0:n._index)?i:0}),e}),[]).sort(((e,o)=>e.index-o.index)),await i(),null==(o=p.value)||o.syncBarPosition()}),100);let h=!1;async function y(r){h=!0;try{if(!c.value)return;m.trigger(o.parse(r),!0),await i();const t=c.value.querySelector(`#${s(r)}`);if(!t)return;await new Promise((o=>{e(c.value.scrollTop,t.offsetTop,300,(e=>{var o;null==(o=c.value)||o.scrollTo({top:e})}),"easeInSine",(()=>setTimeout(o,300)))}))}finally{h=!1}}const T=r((function(e){var o;if(h||!c.value)return;const{scrollTop:r,clientHeight:t}=c.value,n=f.value.find(((e,o,n)=>{const i=n[o+1];if(!i)return!0;const l=c.value.querySelector(`#${s(i.name)}`);return l?l.offsetTop>r+t/2:void 0}))||f.value[f.value.length-1];v.value=null!=(o=null==n?void 0:n.name)?o:"",u("scroll",e)}),300);t(f,(e=>{var o,r;v.value=null!=(r=null==(o=e[0])?void 0:o.name)?r:""}));return{currentAnchor:l({get:()=>v.value,async set(e){v.value=e,await new Promise((e=>setTimeout(e,100))),await y(e)}}),onScroll:T,anchorIdList:f,generateAnchorList:d,updateAnchorList:function(e){"LINEBAR"===e.componentType&&e.selfDisplay&&d(e.form)},scrollTo:y,anchorBarRef:p}}export{a as useAnchor};
@@ -1 +1 @@
1
- import{isField as e}from"@formily/core";import{Path as t}from"@formily/path";import{isString as s}from"@vueuse/core";import{format as i}from"date-fns";import{isFunction as r,isNumber as n}from"lodash-es";import{FIELD_BUSINESS_TYPE as l}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import{isIdCard as a,parseIdCard as o,parseAgeFromContext as u,parseBirthday as h,parseAge2Birthday as y}from"../utils/business.js";class c{constructor(e){this.businessFormatter=e,this.triggerDisabled=!1,this.typeLockMap=new Map,this.typeCollector=new Map,this.fieldNameCollector=new Map,this.changeHandlerMap=new Map([])}formatter(...e){return r(this.businessFormatter)?this.businessFormatter(...e):e[0].value}collect(e,t){this.typeCollector.set(e,t),this.fieldNameCollector.set(t.val_key,e)}getField(e){return this.typeCollector.get(e)}getFieldInstanceByType(e,t){const s=this.getField(t);return s?e.query(s.val_key).take():null}getType(e){return this.fieldNameCollector.get(e)}getValueByField(t,s){const i=t.query(s).take();return e(i)?i.value:null}getValueByType(e,t){const s=this.getField(t);return s?this.getValueByField(e,s.val_key):null}setValueByType(e,i,r,n){const l=this.getField(i);l&&e.setFieldState(l.val_key,(e=>{e.value!==r&&(!this.typeLockMap.get(i)&&this.typeLockMap.set(i,1),this.triggerDisabled&&s(this.triggerDisabled)&&t.parse(this.triggerDisabled).match(l.val_key)||(e.value=this.formatter({value:r,type:i,fieldKey:l.val_key,from:n})))}))}registerChangeBusiness(e,t){return this.changeHandlerMap.set(e,t),this}trigger(e,t,s="change"){var i;if(!0===this.triggerDisabled)return;const r=this.getType(t);if(!r)return;if("change"===s&&this.typeLockMap.get(r))return this.typeLockMap.set(r,0);const n="change"===s?this.changeHandlerMap:null;n&&(null==(i=n.get(r))||i.call(this,e))}}function g(){function e(){var e;const t=this.getField(l.BIRTHDAY);return null!=(e=null==t?void 0:t.date_format)?e:"yyyy-MM-dd HH:mm"}function t(t){const r=this.getValueByType(t,l.ID_CARD);if(!r||!s(r)||!a(r))return;const n=o(r),{age:h,ageUnit:y}=u(n);null!=y&&this.setValueByType(t,l.AGE_UNIT,y,l.ID_CARD),null!=h&&this.setValueByType(t,l.AGE,h,l.ID_CARD),null!=n.sex&&this.setValueByType(t,l.SEX,n.sex,l.ID_CARD),null!=n.birthday&&this.setValueByType(t,l.BIRTHDAY,i(new Date(n.birthday),e.call(this)),l.ID_CARD)}function r(e){const t=this.getValueByType(e,l.BIRTHDAY);if(!s(t))return;const{age:i,ageUnit:r}=u(h(t));this.setValueByType(e,l.AGE_UNIT,r,l.BIRTHDAY),this.setValueByType(e,l.AGE,i,l.BIRTHDAY)}function g(t){return function(i){const r=this.getValueByType(i,l.AGE),a=this.getValueByType(i,l.AGE_UNIT);(s(r)||n(r))&&""!==r&&s(a)&&""!==a&&this.setValueByType(i,l.BIRTHDAY,y(+r,a,e.call(this)),t)}}return{create:function(e){return new c(e).registerChangeBusiness(l.ID_CARD,t).registerChangeBusiness(l.AGE_UNIT,g(l.AGE_UNIT)).registerChangeBusiness(l.AGE,g(l.AGE)).registerChangeBusiness(l.BIRTHDAY,r)}}}export{c as BusinessCollector,g as useBusinessBinding};
1
+ import{isField as e}from"@formily/core";import{Path as t}from"@formily/path";import{isString as s}from"@vueuse/core";import{format as i}from"date-fns";import{isFunction as r,isNumber as n}from"lodash-es";import{FIELD_BUSINESS_TYPE as l}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import"../components/renderer/text.js";import{isIdCard as a,parseIdCard as o,parseAgeFromContext as u,parseBirthday as h,parseAge2Birthday as y}from"../utils/business.js";class p{constructor(e){this.businessFormatter=e,this.triggerDisabled=!1,this.typeLockMap=new Map,this.typeCollector=new Map,this.fieldNameCollector=new Map,this.changeHandlerMap=new Map([])}formatter(...e){return r(this.businessFormatter)?this.businessFormatter(...e):e[0].value}collect(e,t){this.typeCollector.set(e,t),this.fieldNameCollector.set(t.val_key,e)}getField(e){return this.typeCollector.get(e)}getFieldInstanceByType(e,t){const s=this.getField(t);return s?e.query(s.val_key).take():null}getType(e){return this.fieldNameCollector.get(e)}getValueByField(t,s){const i=t.query(s).take();return e(i)?i.value:null}getValueByType(e,t){const s=this.getField(t);return s?this.getValueByField(e,s.val_key):null}setValueByType(e,i,r,n){const l=this.getField(i);l&&e.setFieldState(l.val_key,(e=>{e.value!==r&&(!this.typeLockMap.get(i)&&this.typeLockMap.set(i,1),this.triggerDisabled&&s(this.triggerDisabled)&&t.parse(this.triggerDisabled).match(l.val_key)||(e.value=this.formatter({value:r,type:i,fieldKey:l.val_key,from:n})))}))}registerChangeBusiness(e,t){return this.changeHandlerMap.set(e,t),this}trigger(e,t,s="change"){var i;if(!0===this.triggerDisabled)return;const r=this.getType(t);if(!r)return;if("change"===s&&this.typeLockMap.get(r))return this.typeLockMap.set(r,0);const n="change"===s?this.changeHandlerMap:null;n&&(null==(i=n.get(r))||i.call(this,e))}}function c(){function e(){var e;const t=this.getField(l.BIRTHDAY);return null!=(e=null==t?void 0:t.date_format)?e:"yyyy-MM-dd HH:mm"}function t(t){const r=this.getValueByType(t,l.ID_CARD);if(!r||!s(r)||!a(r))return;const n=o(r),{age:h,ageUnit:y}=u(n);null!=y&&this.setValueByType(t,l.AGE_UNIT,y,l.ID_CARD),null!=h&&this.setValueByType(t,l.AGE,h,l.ID_CARD),null!=n.sex&&this.setValueByType(t,l.SEX,n.sex,l.ID_CARD),null!=n.birthday&&this.setValueByType(t,l.BIRTHDAY,i(new Date(n.birthday),e.call(this)),l.ID_CARD)}function r(e){const t=this.getValueByType(e,l.BIRTHDAY);if(!s(t))return;const{age:i,ageUnit:r}=u(h(t));this.setValueByType(e,l.AGE_UNIT,r,l.BIRTHDAY),this.setValueByType(e,l.AGE,i,l.BIRTHDAY)}function c(t){return function(i){const r=this.getValueByType(i,l.AGE),a=this.getValueByType(i,l.AGE_UNIT);(s(r)||n(r))&&""!==r&&s(a)&&""!==a&&this.setValueByType(i,l.BIRTHDAY,y(+r,a,e.call(this)),t)}}return{create:function(e){return new p(e).registerChangeBusiness(l.ID_CARD,t).registerChangeBusiness(l.AGE_UNIT,c(l.AGE_UNIT)).registerChangeBusiness(l.AGE,c(l.AGE)).registerChangeBusiness(l.BIRTHDAY,r)}}}export{p as BusinessCollector,c as useBusinessBinding};
@@ -1 +1 @@
1
- import{reactive as e,computed as t,createVNode as r,mergeProps as n,defineComponent as l,inject as o,provide as i,watch as s,onUnmounted as a,onMounted as d,withModifiers as c}from"vue";import{checkInSetupEnv as u}from"../../../../shared/utils/index.js";import{useField as p,useForm as m,RecursionField as f}from"@formily/vue";import{isArray as h,noop as v,isEmpty as y}from"lodash-es";import"../../index.js";import{InjectionFormUUID as g,InjectionBusinessCollector as x}from"../constants/index.js";import{useFieldListAdaptor as b}from"./useFieldListAdaptor.js";import{createObjSchema as F}from"../utils/schema.js";import{renderOptionLabel as S,renderDescOption as j}from"../utils/index.js";const O=e(new Map);function M(e,t,r=0){O.set(e,O.get(e)||{});O.get(e)[t+""]=r}function W(e,t,r=!0){const n=O.get(e);return n?Object.entries(n).reduce(((e,[n,l])=>r&&n===`${t}`||n.startsWith(`${t}.`)?e+l:e),0):0}function $(e,t){const r=O.get(e);r&&Reflect.deleteProperty(r,t+"")}function E(e){O.delete(e)}const K=l({props:{fieldItems:{type:Array,default:()=>[]},childFieldStrategy:{type:String,default:"checked"},childWidthMode:{type:String,default:"outer"},name:{type:String,required:!0}},setup(e){const l=o(g),u=o(x),h=p(),y=o(l+"_virtualParent",""),S=`${y?y+".":""}${h.value.address}`;function j(e){return`${S}.${e}`}i(l+"_virtualParent",S);const{schemaAdaptor:O}=b(u);function E(t){var r,n,l,o;return Object.assign(t,{"x-decorator-props":{...t["x-decorator-props"],labelPlacement:"left",isOptionChildField:!0},"x-component-props":{...t["x-component-props"],childFieldStrategy:null!=(n=null==(r=t["x-component-props"])?void 0:r.childFieldStrategy)?n:e.childFieldStrategy,childWidthMode:null!=(o=null==(l=t["x-component-props"])?void 0:l.childWidthMode)?o:e.childWidthMode,size:"small"}})}const K=t((()=>{const t=O(e.fieldItems);return Object.values(t).forEach(E),F(t)}));s(K,(()=>{return e=K.value,void Object.values(e.properties||{}).forEach((e=>{var t;M(l,j(e.name),null==(t=null==e?void 0:e["x-decorator-props"])?void 0:t.span)}));var e}),{immediate:!0});const P=m();function _(){return e.fieldItems.map((e=>P.value.query(e.val_key).take()))}a((()=>{var e;_().forEach((e=>{e&&e.setDisplay("none")})),e=K.value,Object.values(e.properties||{}).forEach((e=>{$(l,j(e.name))}))})),d((()=>{_().forEach((e=>{e&&e.setDisplay("visible")}))}));const k=c(v,["stop"]),C=["onClick","onKeydown","onKeyup","onKeypress"].reduce(((e,t)=>(e[t]=k,e)),{});return()=>{return r("section",n({class:"form-render__labelField",style:{"--column":(e=K.value,Object.values(e.properties||{}).reduce(((e,t)=>e+W(l,j(t.name))),0)),flex:"1"}},C),[r(f,{basePath:".",schema:K.value},null)]);var e}}});function P(e,l){u();const o=t((()=>e.options.some((e=>h(e.childrenFields)&&e.childrenFields.length))));function i(e,t,r="value"){return!y(t.childrenFields)&&(h(e)?e.includes(t[r]):e===t[r])}return{renderComplexOption:function({value:e,option:t,valueKey:l="value",labelKey:s="label",childFieldStrategy:a,childWidthMode:d,renderLabel:c=!0,attrs:u}){return[function(){const e=S(t,s);return c?t.desc?j(e,t):e:null}(),o.value&&("all"===a||i(e,t,l))?r(K,n({fieldItems:t.childrenFields,name:t[l],childFieldStrategy:a,childWidthMode:d},u),null):null]},valueRef:l,hasComplexOption:o}}function _(){return{getSpan:W,setSpan:M,deleteSpan:$,clearSpan:E}}export{P as useComplexOptions,_ as useComplexOptionsSpan};
1
+ import{reactive as e,computed as t,createVNode as r,mergeProps as n,defineComponent as l,inject as o,provide as i,watch as s,onUnmounted as a,onMounted as d,withModifiers as c}from"vue";import{checkInSetupEnv as u}from"../../../../shared/utils/index.js";import{useField as p,useForm as m,RecursionField as f}from"@formily/vue";import{isArray as h,noop as v,isEmpty as y}from"lodash-es";import"../../index.js";import{InjectionFormUUID as g,InjectionBusinessCollector as x}from"../constants/index.js";import{renderOptionLabel as b,renderDescOption as F}from"../utils/index.js";import{useFieldListAdaptor as S}from"./useFieldListAdaptor.js";import{createObjSchema as j}from"../utils/schema.js";const O=e(new Map);function M(e,t,r=0){O.set(e,O.get(e)||{});O.get(e)[t+""]=r}function W(e,t,r=!0){const n=O.get(e);return n?Object.entries(n).reduce(((e,[n,l])=>r&&n===`${t}`||n.startsWith(`${t}.`)?e+l:e),0):0}function $(e,t){const r=O.get(e);r&&Reflect.deleteProperty(r,t+"")}function E(e){O.delete(e)}const K=l({props:{fieldItems:{type:Array,default:()=>[]},childFieldStrategy:{type:String,default:"checked"},childWidthMode:{type:String,default:"outer"},name:{type:String,required:!0}},setup(e){const l=o(g),u=o(x),h=p(),y=o(l+"_virtualParent",""),b=`${y?y+".":""}${h.value.address}`;function F(e){return`${b}.${e}`}i(l+"_virtualParent",b);const{schemaAdaptor:O}=S(u);function E(t){var r,n,l,o;return Object.assign(t,{"x-decorator-props":{...t["x-decorator-props"],labelPlacement:"left",isOptionChildField:!0},"x-component-props":{...t["x-component-props"],childFieldStrategy:null!=(n=null==(r=t["x-component-props"])?void 0:r.childFieldStrategy)?n:e.childFieldStrategy,childWidthMode:null!=(o=null==(l=t["x-component-props"])?void 0:l.childWidthMode)?o:e.childWidthMode,size:"small"}})}const K=t((()=>{const t=O(e.fieldItems);return Object.values(t).forEach(E),j(t)}));s(K,(()=>{return e=K.value,void Object.values(e.properties||{}).forEach((e=>{var t;M(l,F(e.name),null==(t=null==e?void 0:e["x-decorator-props"])?void 0:t.span)}));var e}),{immediate:!0});const P=m();function _(){return e.fieldItems.map((e=>P.value.query(e.val_key).take()))}a((()=>{var e;_().forEach((e=>{e&&e.setDisplay("none")})),e=K.value,Object.values(e.properties||{}).forEach((e=>{$(l,F(e.name))}))})),d((()=>{_().forEach((e=>{e&&e.setDisplay("visible")}))}));const k=c(v,["stop"]),C=["onClick","onKeydown","onKeyup","onKeypress"].reduce(((e,t)=>(e[t]=k,e)),{});return()=>{return r("section",n({class:"form-render__labelField",style:{"--column":(e=K.value,Object.values(e.properties||{}).reduce(((e,t)=>e+W(l,F(t.name))),0)),flex:"1"}},C),[r(f,{basePath:".",schema:K.value},null)]);var e}}});function P(e,l){u();const o=t((()=>e.options.some((e=>h(e.childrenFields)&&e.childrenFields.length))));function i(e,t,r="value"){return!y(t.childrenFields)&&(h(e)?e.includes(t[r]):e===t[r])}return{renderComplexOption:function({value:e,option:t,valueKey:l="value",labelKey:s="label",childFieldStrategy:a,childWidthMode:d,renderLabel:c=!0,attrs:u}){return[function(){const e=b(t,s);return c?t.desc?F(e,t):e:null}(),o.value&&("all"===a||i(e,t,l))?r(K,n({fieldItems:t.childrenFields,name:t[l],childFieldStrategy:a,childWidthMode:d},u),null):null]},valueRef:l,hasComplexOption:o}}function _(){return{getSpan:W,setSpan:M,deleteSpan:$,clearSpan:E}}export{P as useComplexOptions,_ as useComplexOptionsSpan};
@@ -1 +1 @@
1
- import{arrayed as e,traverse as t}from"../../../../shared/utils/index.js";import"../../../../shared/utils/tapable/SyncHook.js";import"../../../../shared/utils/tapable/SyncBailHook.js";import l from"../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{format as a}from"date-fns";import{isString as r}from"lodash-es";import"../../index.js";import{FIELD_BUSINESS_TYPE as o}from"../constants/index.js";import{isNegative as _,isPositive as i,FieldListFilter as s,findItemByValCondition as n,parseEnhanceText as p}from"../utils/index.js";import{transformDateFormat as u}from"../utils/business.js";function c(){const c=new l(["fieldList","props"]),m=new l(["fieldItem","props"]);m.tap("__forceClearable",((e,t)=>(t.forceClearable&&(e.componentProps={...e.componentProps,clearable:!0}),e))),m.tap({name:"__fieldAlias",before:"__labelPlacementOverwrite"},(e=>("BOTTOM"===e.inputBorder&&(e.bordered="underline"),null!=e.title_h_layout&&(e.decoratorProps={...e.decoratorProps},_(e.title_h_layout)?e.decoratorProps.labelPlacement="top":i(e.title_h_layout)&&(e.decoratorProps.labelPlacement="left")),r(e.lineBarLayoutDirection)&&(e.linebarDirection=e.lineBarLayoutDirection.toLowerCase()),e))),m.tap("__labelPlacementOverwrite",((e,t)=>(t.labelPlacementOverwrite&&(e.decoratorProps={...e.decoratorProps,labelPlacement:void 0}),e))),m.tap("__time",(e=>("DATE"===e.html_type&&"time"===u(e.date_format)&&(e.html_type="TIME"),e))),m.tap("__block",(e=>(["CHECKBOX_BLOCK","RADIO_BLOCK"].includes(e.html_type)&&(e.__vertical=!0),e))),m.tap("__age",(t=>("AGE"===t.html_type&&(t.html_type="INPUT_NUMBER",t.reactions=t.reactions?e(t.reactions):[],t.reactions.push({target:t.val_key_unit,fulfill:{state:{disabled:"{{$self.disabled}}"}}}),t.suffixConfig=[{validate:{obj_type:o.AGE_UNIT},val_key:t.val_key_unit,html_type:"SELECT",option:t.option,urlConfig:t.urlConfig}]),t))),m.tap({name:"__multiple_select",before:"__defaultValue"},(e=>{const{html_type:t,multi_select:l,__multiple:a}=e;return e.__multiple="SEARCH"!==t&&("SEARCH_MORE"===t||("SELECT"===t?_(l):a)),e})),m.tap("__defaultValue",(e=>{switch(e.html_type){case"TIME":"current"===e.default_val&&(e.default_val=a(new Date,e.date_format||"HH:mm:ss"));break;case"DATE":"current"===e.default_val&&(e.default_val=a(new Date,e.date_format||"yyyy-MM-dd"));break;case"CHECKBOX":case"CHECKBOX_BLOCK":r(e.default_val)&&e.default_val&&(e.default_val=e.default_val.split(","));break;case"SELECT":case"SEARCH":case"SEARCH_MORE":r(e.default_val)&&e.default_val&&(e.default_val=e.__multiple?e.default_val.split(","):e.default_val)}return e}));const d=[[["SEARCH","PHONE_TYPE","IDCARD_TYPE","SEARCH_MORE"],"SELECT"],["DIGITAL","INPUT_NUMBER"],["CHECKBOX_BLOCK","CHECKBOX"],["RADIO_BLOCK","RADIO"],[["DATE-INPUT","DATETIME-INPUT"],"DATE"],["SWITCH_COMPONENT","SWITCH"],["SLIDER_COMPONENT","SLIDER"],["LEVEL_SEARCH_CASCADE","LEVEL_SEARCH_CASCADER"],["SEARCH_CASCADE","SEARCH_CASCADER"]];m.tap("__normalize",(e=>(d.some((([t,l])=>(Array.isArray(t)?t.includes(e.html_type):t===e.html_type)&&(e.html_type=l))),e)));const E=new Map([[["SELECT","SEARCH","SEARCH_MORE"],new Map([["H_TILE",e=>e.html_type=e.__multiple?"CHECKBOX":"RADIO"],["V_TILE",e=>{e.html_type=e.__multiple?"CHECKBOX":"RADIO",e.__vertical=!0}]])],["RADIO",new Map([["DROPDOWN",e=>e.html_type="SELECT"]])],["CHECKBOX",new Map([["DROPDOWN",e=>{e.__multiple=!0,e.html_type="SELECT"}]])]]);return m.tap({stage:9999,name:"__show_mode"},(t=>t.show_mode?([...E].some((([l,a])=>{if(!e(l).includes(t.html_type))return;const r=a.get(t.show_mode);return r&&r(t),!0})),t):t)),c.tap("__out_bordered",((e,{column:t,outBordered:l})=>e)),c.tap("__prefix/suffix",(e=>{const l=[];return t(e,(t=>{["prefix","suffix"].forEach((a=>{const o=t[a];if(!r(o))return;const _=o.match("#{(.+)}");if(!_)return;const i=r(_[1])&&n(e,(e=>e.val_key===_[1].trim()));i&&(Reflect.deleteProperty(t,a),t[`${a}Config`]=t[`${a}Config`]||[],t[`${a}Config`].push(i),l.push(i))}))}),["children","properties"]),l.length?s(e,(e=>l.includes(e))):e})),c.tap("__textEnhance",(e=>{const l=[];return t(e,(t=>{if("TEXT"!==t.html_type||!r(t.default_val))return;const a=p(t.default_val);t.__textEnhance=a,a.forEach((a=>{if("text"===a.type)return;const r=n(e,(e=>[e.name,e.val_key].includes(a.content)));r&&(Reflect.deleteProperty(t,"default_val"),l.push(r),a.content=r)}))}),["children","properties"]),s(e,(e=>l.includes(e)))})),{FieldNormalizeWaterfallHook:m,FieldListNormalizeWaterfallHook:c}}export{c as useFieldNormalize};
1
+ import{arrayed as e,traverse as t}from"../../../../shared/utils/index.js";import"../../../../shared/utils/tapable/SyncHook.js";import"../../../../shared/utils/tapable/SyncBailHook.js";import a from"../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{format as l}from"date-fns";import{isString as o,isEmpty as r}from"lodash-es";import"../../index.js";import{FIELD_BUSINESS_TYPE as _}from"../constants/index.js";import{isNegative as i,isPositive as s,FieldListFilter as n,findItemByValCondition as p,parseEnhanceText as c}from"../utils/index.js";import{transformDateFormat as u}from"../utils/business.js";function d(){const d=new a(["fieldList","props"]),m=new a(["fieldItem","props"]);m.tap("__forceClearable",((e,t)=>(t.forceClearable&&(e.componentProps={...e.componentProps,clearable:!0}),e))),m.tap({name:"__fieldAlias",before:"__labelPlacementOverwrite"},(e=>("BOTTOM"===e.inputBorder&&(e.bordered="underline"),null!=e.title_h_layout&&(e.decoratorProps={...e.decoratorProps},i(e.title_h_layout)?e.decoratorProps.labelPlacement="top":s(e.title_h_layout)&&(e.decoratorProps.labelPlacement="left")),o(e.lineBarLayoutDirection)&&(e.linebarDirection=e.lineBarLayoutDirection.toLowerCase()),e))),m.tap("__labelPlacementOverwrite",((e,t)=>(t.labelPlacementOverwrite&&(e.decoratorProps={...e.decoratorProps,labelPlacement:void 0}),e))),m.tap("__time",(e=>("DATE"===e.html_type&&"time"===u(e.date_format)&&(e.html_type="TIME"),e))),m.tap("__block",(e=>(["CHECKBOX_BLOCK","RADIO_BLOCK"].includes(e.html_type)&&(e.__vertical=!0),e))),m.tap("__age",(t=>("AGE"===t.html_type&&(t.html_type="INPUT_NUMBER",t.reactions=t.reactions?e(t.reactions):[],t.reactions.push({target:t.val_key_unit,fulfill:{state:{disabled:"{{$self.disabled}}"}}}),t.suffixConfig=[{validate:{obj_type:_.AGE_UNIT},val_key:t.val_key_unit,html_type:"SELECT",option:t.option,urlConfig:t.urlConfig}]),t))),m.tap({name:"__multiple_select",before:"__defaultValue"},(e=>{const{html_type:t,multi_select:a,__multiple:l}=e;return e.__multiple="SEARCH"!==t&&("SEARCH_MORE"===t||("SELECT"===t?i(a):l)),e})),m.tap("__defaultValue",(e=>{switch(e.html_type){case"TIME":"current"===e.default_val&&(e.default_val=l(new Date,e.date_format||"HH:mm:ss"));break;case"DATE":"current"===e.default_val&&(e.default_val=l(new Date,e.date_format||"yyyy-MM-dd"));break;case"CHECKBOX":case"CHECKBOX_BLOCK":o(e.default_val)&&e.default_val&&(e.default_val=e.default_val.split(","));break;case"SELECT":case"SEARCH":case"SEARCH_MORE":o(e.default_val)&&e.default_val&&(e.default_val=e.__multiple?e.default_val.split(","):e.default_val)}return e}));const E=[[["SEARCH","PHONE_TYPE","IDCARD_TYPE","SEARCH_MORE"],"SELECT"],["DIGITAL","INPUT_NUMBER"],["CHECKBOX_BLOCK","CHECKBOX"],["RADIO_BLOCK","RADIO"],[["DATE-INPUT","DATETIME-INPUT"],"DATE"],["SWITCH_COMPONENT","SWITCH"],["SLIDER_COMPONENT","SLIDER"],["LEVEL_SEARCH_CASCADE","LEVEL_SEARCH_CASCADER"],["SEARCH_CASCADE","SEARCH_CASCADER"]];m.tap("__normalize",(e=>(E.some((([t,a])=>(Array.isArray(t)?t.includes(e.html_type):t===e.html_type)&&(e.html_type=a))),e)));const f=new Map([[["SELECT","SEARCH","SEARCH_MORE"],new Map([["H_TILE",e=>e.html_type=e.__multiple?"CHECKBOX":"RADIO"],["V_TILE",e=>{e.html_type=e.__multiple?"CHECKBOX":"RADIO",e.__vertical=!0}]])],["RADIO",new Map([["DROPDOWN",e=>e.html_type="SELECT"]])],["CHECKBOX",new Map([["DROPDOWN",e=>{e.__multiple=!0,e.html_type="SELECT"}]])]]);return m.tap({stage:9999,name:"__show_mode"},(t=>t.show_mode?([...f].some((([a,l])=>{if(!e(a).includes(t.html_type))return;const o=l.get(t.show_mode);return o&&o(t),!0})),t):t)),d.tap("__out_bordered",((e,{column:t,outBordered:a})=>e)),d.tap("__prefix/suffix",(e=>{const a=[];return t(e,(t=>{["prefix","suffix"].forEach((l=>{const r=t[l];if(!o(r))return;const _=r.match("#{(.+)}");if(!_)return;const i=o(_[1])&&p(e,(e=>e.val_key===_[1].trim()));i&&(Reflect.deleteProperty(t,l),t[`${l}Config`]=t[`${l}Config`]||[],t[`${l}Config`].push(i),a.push(i))}))}),["children","properties"]),a.length?n(e,(e=>a.includes(e))):e})),d.tap("__checkboxOrRadioEnhance",(e=>{const a=[];return t(e,(t=>{["CHECKBOX","RADIO","RADIO_BLOCK","CHECKBOX_BLOCK"].includes(t.html_type)&&!r(t.option)&&t.option.forEach((t=>{const l=c(t.text||"");t.__textEnhance=l,l.forEach((t=>{if("text"===t.type)return;const l=p(e,(e=>[e.name,e.val_key].includes(t.content)));l&&(a.push(l),t.content=l)}))}))})),n(e,(e=>a.includes(e)))})),d.tap("__textEnhance",(e=>{const a=[];return t(e,(t=>{if("TEXT"!==t.html_type||!o(t.default_val))return;const l=c(t.default_val);t.__textEnhance=l,l.forEach((l=>{if("text"===l.type)return;const o=p(e,(e=>[e.name,e.val_key].includes(l.content)));o&&(Reflect.deleteProperty(t,"default_val"),a.push(o),l.content=o)}))}),["children","properties"]),n(e,(e=>a.includes(e)))})),{FieldNormalizeWaterfallHook:m,FieldListNormalizeWaterfallHook:d}}export{d as useFieldNormalize};
@@ -1 +1 @@
1
- import{arrayed as e}from"../../../../shared/utils/index.js";import{once as a,isNumber as i,isString as m}from"lodash-es";import"vue";import{registerValidateLocale as r,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"naive-ui";import{isIdCard as u}from"../utils/business.js";function n(){const a=new Map([["mobile",({validate:e})=>({format:"phone",message:null==e?void 0:e.message})],["integer",({validate:e})=>({format:"integer",message:null==e?void 0:e.message})],["number",({validate:e})=>({format:"number",message:null==e?void 0:e.message})],["id_card",({validate:e})=>({validator(a){var i;if(null!=a&&""!==a)return m(a)&&u(a)?void 0:null!=(i=null==e?void 0:e.message)?i:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:a,regular_error_tip:i})=>({pattern:a||(null==e?void 0:e.regular_expression)||"",message:i||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),i={triggerType:"onBlur"};return{createValidatorSchema:function(m){const r=[],{validate:{vali_obj:s,max_length:u,min_length:n,message:o,max_value:t,min_value:g,decimal_length:v}={},validator:d}=m;if(d&&e(d).forEach((e=>{l(e)&&r.push({validator:(a,i,r)=>e(a,m,r)})})),u&&r.push({max:u,message:o}),n&&r.push({min:n,message:o}),t&&r.push({maximum:t,message:o}),g&&r.push({minimum:g,message:o}),null!=v&&r.push(((e,a)=>{const i=null!=a?a:`小数位数最多${e}位`;return{validator(a){var m;return(null==(m=String(a).split(".")[1])?void 0:m.length)>e?i:""}}})(+v,o)),s){const e=a.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));r.push(Object.assign({},i,e(m)))}return r}}}const o=a((()=>{r({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,a)=>i(Number(a.maximum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e>Number(a.maximum)&&a.message||""):"",minimum:(e,a)=>i(Number(a.minimum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!i(e)||isNaN(e)?"":e<Number(a.minimum)&&a.message||""):""})}));export{n as useFormValidator,o as validateMessageLocale};
1
+ import{arrayed as e}from"../../../../shared/utils/index.js";import{once as r,isNumber as a,isString as i}from"lodash-es";import"vue";import{registerValidateLocale as m,registerValidateRules as s}from"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import{isFunction as l}from"@vueuse/core";import"naive-ui";import"../components/renderer/text.js";import{isIdCard as n}from"../utils/business.js";function o(){const r=new Map([["mobile",({validate:e})=>({format:"phone",message:null==e?void 0:e.message})],["integer",({validate:e})=>({format:"integer",message:null==e?void 0:e.message})],["number",({validate:e})=>({format:"number",message:null==e?void 0:e.message})],["id_card",({validate:e})=>({validator(r){var a;if(null!=r&&""!==r)return i(r)&&n(r)?void 0:null!=(a=null==e?void 0:e.message)?a:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:r,regular_error_tip:a})=>({pattern:r||(null==e?void 0:e.regular_expression)||"",message:a||(null==e?void 0:e.regular_error_tip)||(null==e?void 0:e.message)||"格式错误"})]]),a={triggerType:"onBlur"};return{createValidatorSchema:function(i){const m=[],{validate:{vali_obj:s,max_length:n,min_length:o,message:t,max_value:u,min_value:g,decimal_length:d}={},validator:v}=i;if(v&&e(v).forEach((e=>{l(e)&&m.push({validator:(r,a,m)=>e(r,i,m)})})),n&&m.push({max:n,message:t}),o&&m.push({min:o,message:t}),u&&m.push({maximum:u,message:t}),g&&m.push({minimum:g,message:t}),null!=d&&m.push(((e,r)=>{const a=null!=r?r:`小数位数最多${e}位`;return{validator(r){var i;return(null==(i=String(r).split(".")[1])?void 0:i.length)>e?a:""}}})(+d,t)),s){const e=r.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));m.push(Object.assign({},a,e(i)))}return m}}}const t=r((()=>{m({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,r)=>a(Number(r.maximum))&&null!=e&&""!==e&&"/"!==e?(i(e)&&(e=+e),!a(e)||isNaN(e)?"":e>Number(r.maximum)&&r.message||""):"",minimum:(e,r)=>a(Number(r.minimum))&&null!=e&&""!==e&&"/"!==e?(i(e)&&(e=+e),!a(e)||isNaN(e)?"":e<Number(r.minimum)&&r.message||""):""})}));export{o as useFormValidator,t as validateMessageLocale};
@@ -1 +1 @@
1
- import{isString as i,isEmpty as e}from"lodash-es";import"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"naive-ui";import{isIdCard as r,isMobile as s}from"../utils/business.js";function o(){return{isIdCard:e=>i(e)&&r(e),isMobile:e=>i(e)&&s(e),isEmail:e=>i(e)&&/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e),isNumber:e=>i(e)&&/\d+/.test(e),hasVisible(i){if(e(i))return!1;const r=i.slice(0,i.length/2),s=i.slice(i.length/2).map((i=>null==i?void 0:i[0]));return r.some(((i,e)=>(!i||"visible"===i)&&"LINE_BREAKS"!==s[e]))}}}export{o as usePresetScope};
1
+ import{isString as i,isEmpty as e}from"lodash-es";import"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"naive-ui";import"../components/renderer/text.js";import{isIdCard as r,isMobile as o}from"../utils/business.js";function s(){return{isIdCard:e=>i(e)&&r(e),isMobile:e=>i(e)&&o(e),isEmail:e=>i(e)&&/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e),isNumber:e=>i(e)&&/\d+/.test(e),hasVisible(i){if(e(i))return!1;const r=i.slice(0,i.length/2),o=i.slice(i.length/2).map((i=>null==i?void 0:i[0]));return r.some(((i,e)=>(!i||"visible"===i)&&"LINE_BREAKS"!==o[e]))}}}export{s as usePresetScope};
@@ -1 +1 @@
1
- import{inject as e,provide as t,computed as n,createVNode as r,Fragment as o}from"vue";import{widthAppend as i,traverse as u,arrayed as c}from"../../../../shared/utils/index.js";import{isGeneralField as s}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as l}from"@vicons/ionicons5";import{isObject as a}from"@vue/shared";import{useMemoize as p}from"@vueuse/core";import{isString as d,isFunction as m,omit as h,castArray as E,flattenDeep as T}from"lodash-es";import{NTooltip as g,NIcon as x}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as y}from"../constants/index.js";export{businessDateParser,isForeignerID,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./business.js";function v(e){console.warn(`[FormRender]: ${e}`)}function R(e){return"1"===e||!0===e||1===e}function I(e){return"0"===e||!1===e||0===e}function D(e,t,n=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function e(t,r){r.forEach((r=>{a(r)&&(null!=u(r)&&null==t[i(r)]&&f.setIn(t,i(r),u(r)),n.forEach((n=>{r[n]&&(t[i(r)]||(t[i(r)]={}),e(t[i(r)],c(r[n])))})))}))}(e,t),e;function i(e){return e[r]}function u(e){return e[o]}}function A(n,r){let o=e(n,null);return o||(o=r(),t(n,o)),o}function W(e){return e&&d(e)?+e:e}function P(e,t,n){if(a(e)&&!m(e)){const n={};return Object.entries(e).forEach((([e,r])=>{m(r)&&(n[e]=()=>r(t))})),n}return{default:()=>m(e)?e(t):n?n(e):[e]}}function _(e,t){return n((()=>{const n={};return e.prefix&&(n.prefix=()=>r(o,null,[P(e.prefix,e,t).default()])),e.suffix&&(n.suffix=()=>r(o,null,[P(e.suffix,e,t).default()])),n}))}function G(e,t){return d(e)&&e?e.replace(/\$\{([^}]*)}/g,(function(e,n){const r=n.split("||");for(const e of r){const n=t[e.trim()];if(n)return n}return""})):""}function S(e){return e.reduce(((e,t)=>(d(t.extendKey)&&t.extendKey&&e.push(t),b(t)&&e.push(...S(t.children||[])),e)),[])}function j(e,t){const n=S(e);if(!n.length)return t;const r={},o=new Map;return Object.entries(t).forEach((([e,i])=>{const u=n.find((t=>t.val_key===e));if(!u)return r[e]=i;const{val_key:c,extendKey:s}=u,l=o.get(s)||{};o.set(s,l);const a=f.getIn(t,e);null!=a&&f.setIn(l,c,a)})),[...o.entries()].forEach((([e,t])=>{r[e]=JSON.stringify(t)})),r}function w(e,t){const n=S(e);if(!n.length)return t;const r=p((e=>{try{return a(t[e])?t[e]:JSON.parse(t[e])||{}}catch(e){return{}}})),o=h(t,n.map((e=>e.extendKey)));return n.forEach((({val_key:e,extendKey:t})=>{Reflect.has(o,e)||(o[e]=r(t)[e])})),o}function $(e){return e&&y.includes(e)}function b(e){return $(s(e)?e.componentType:e.html_type)}function B(e,t){var n;const o=null!=(n=e.title)?n:e[t];return r("span",{title:o,style:{display:"inline-flex",flexDirection:"column",alignItems:"center","justify-content":"center"}},[e.imageBase64?r("img",{src:e.imageBase64,style:{width:i(e.imageWidth||80),height:i(e.imageHeight||80),marginBottom:"4px"}},null):null,e[t]])}function K(e,t){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[e,t.desc?r(g,null,{trigger:()=>r(x,{component:l},null),default:()=>t.desc}):null])}function X(e,t){return f.parse(e.startsWith(".")?e:`.${e}`,t).toString()}function k(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function C(e,t){return e.reduce(((e,n)=>(t(n)||(e.push(n),n.properties&&(n.properties=C(n.properties,t)),n.children&&(n.children=C(n.children,t))),e)),[])}function F(e,t){let n=null;return u(e,((e,r)=>{t(e)&&(n=e,r())}),["children","properties"]),n}var O=function(e){return e[e.PREPARE=0]="PREPARE",e[e.TEXT=1]="TEXT",e[e.WIDGET_START=2]="WIDGET_START",e[e.WIDGET=3]="WIDGET",e}(O||{});function N(e){const t=[...e],n=[];let r=O.PREPARE,o="";function i(e){switch(r=e,r){case O.PREPARE:case O.WIDGET_START:case O.WIDGET:o=""}}function u(e="text",t=o){n.push({type:e,content:t})}function c(){const e=n.pop();e&&("text"===e.type?o=e.content:n.push(e))}return t.forEach(((e,n)=>{const s=n===t.length-1;switch(r){case O.PREPARE:return"#"===e?(i(O.WIDGET_START),void(s&&u())):(i(O.TEXT),o=e,void(s&&u()));case O.TEXT:return"#"===e?void(s?(o+=e,u()):(u(),i(O.WIDGET_START))):(o+=e,void(s&&u()));case O.WIDGET_START:return"{"!==e||s?(c(),i(O.TEXT),o+=`#${e}`,void(s&&u())):void i(O.WIDGET);case O.WIDGET:return"}"===e?(u("widget"),void i(O.PREPARE)):"#"===e?(c(),u(),i(O.WIDGET_START),o+=`#${e}`,void(s&&u())):(o+=e,void(s&&u("text",`#{${o}`)))}})),n}function J(e,t){let n=E(e);return t.forEach((({from:e,to:t})=>{n.forEach(((r,o)=>{d(r)&&(n[o]=r.split(e).map(((e,n,r)=>[e,n<r.length-1?t:null])))})),n=T(n)})),n}function M(e){return"Enter"===e.code||"NumpadEnter"===e.code}export{C as FieldListFilter,j as combineExtendKey,_ as createInputSlot,P as createSlot,k as editorUnescape,F as findItemByValCondition,v as formRenderLog,X as getAbsoluteKey,A as injectOrProvide,M as isEnter,I as isNegative,b as isNestedFieldType,$ as isNestedType,R as isPositive,D as mergeDeepProperties,N as parseEnhanceText,W as parseNumberFromMaybeString,K as renderDescOption,B as renderOptionLabel,J as replace2Any,w as splitExtendKey,G as validateMessageParser};
1
+ import{inject as e,provide as t,computed as n,createVNode as r,Fragment as o}from"vue";import{widthAppend as i,traverse as u,arrayed as c}from"../../../../shared/utils/index.js";import{isGeneralField as s}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as l}from"@vicons/ionicons5";import{isObject as a}from"@vue/shared";import{useMemoize as p}from"@vueuse/core";import{isString as d,isFunction as m,omit as h,castArray as E,flattenDeep as T}from"lodash-es";import{NTooltip as g,NIcon as x}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as y}from"../constants/index.js";import{TEXT as v}from"../components/renderer/text.js";export{businessDateParser,isForeignerID,isIdCard,isMobile,parseAge2Birthday,parseAgeFromContext,parseBirthday,parseIdCard,transformDateFormat}from"./business.js";function I(e){console.warn(`[FormRender]: ${e}`)}function R(e){return"1"===e||!0===e||1===e}function D(e){return"0"===e||!1===e||0===e}function A(e,t,n=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function e(t,r){r.forEach((r=>{a(r)&&(null!=u(r)&&null==t[i(r)]&&f.setIn(t,i(r),u(r)),n.forEach((n=>{r[n]&&(t[i(r)]||(t[i(r)]={}),e(t[i(r)],c(r[n])))})))}))}(e,t),e;function i(e){return e[r]}function u(e){return e[o]}}function W(n,r){let o=e(n,null);return o||(o=r(),t(n,o)),o}function P(e){return e&&d(e)?+e:e}function _(e,t,n){if(a(e)&&!m(e)){const n={};return Object.entries(e).forEach((([e,r])=>{m(r)&&(n[e]=()=>r(t))})),n}return{default:()=>m(e)?e(t):n?n(e):[e]}}function G(e,t){return n((()=>{const n={};return e.prefix&&(n.prefix=()=>r(o,null,[_(e.prefix,e,t).default()])),e.suffix&&(n.suffix=()=>r(o,null,[_(e.suffix,e,t).default()])),n}))}function S(e,t){return d(e)&&e?e.replace(/\$\{([^}]*)}/g,(function(e,n){const r=n.split("||");for(const e of r){const n=t[e.trim()];if(n)return n}return""})):""}function j(e){return e.reduce(((e,t)=>(d(t.extendKey)&&t.extendKey&&e.push(t),B(t)&&e.push(...j(t.children||[])),e)),[])}function w(e,t){const n=j(e);if(!n.length)return t;const r={},o=new Map;return Object.entries(t).forEach((([e,i])=>{const u=n.find((t=>t.val_key===e));if(!u)return r[e]=i;const{val_key:c,extendKey:s}=u,l=o.get(s)||{};o.set(s,l);const a=f.getIn(t,e);null!=a&&f.setIn(l,c,a)})),[...o.entries()].forEach((([e,t])=>{r[e]=JSON.stringify(t)})),r}function $(e,t){const n=j(e);if(!n.length)return t;const r=p((e=>{try{return a(t[e])?t[e]:JSON.parse(t[e])||{}}catch(e){return{}}})),o=h(t,n.map((e=>e.extendKey)));return n.forEach((({val_key:e,extendKey:t})=>{Reflect.has(o,e)||(o[e]=r(t)[e])})),o}function b(e){return e&&y.includes(e)}function B(e){return b(s(e)?e.componentType:e.html_type)}function K(e,t){var n;const o=null!=(n=e.title)?n:e[t];return r("span",{title:o,style:{display:"inline-flex",flexDirection:"column",alignItems:"center","justify-content":"center"}},[e.imageBase64?r("img",{src:e.imageBase64,style:{width:i(e.imageWidth||80),height:i(e.imageHeight||80),marginBottom:"4px"}},null):null,r(v,{content:e[t],fieldItem:e},null)])}function X(e,t){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[e,t.desc?r(g,null,{trigger:()=>r(x,{component:l},null),default:()=>t.desc}):null])}function k(e,t){return f.parse(e.startsWith(".")?e:`.${e}`,t).toString()}function C(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">")}function F(e,t){return e.reduce(((e,n)=>(t(n)||(e.push(n),n.properties&&(n.properties=F(n.properties,t)),n.children&&(n.children=F(n.children,t))),e)),[])}function O(e,t){let n=null;return u(e,((e,r)=>{t(e)&&(n=e,r())}),["children","properties"]),n}var N=function(e){return e[e.PREPARE=0]="PREPARE",e[e.TEXT=1]="TEXT",e[e.WIDGET_START=2]="WIDGET_START",e[e.WIDGET=3]="WIDGET",e}(N||{});function J(e){const t=[...e],n=[];let r=N.PREPARE,o="";function i(e){switch(r=e,r){case N.PREPARE:case N.WIDGET_START:case N.WIDGET:o=""}}function u(e="text",t=o){n.push({type:e,content:t})}function c(){const e=n.pop();e&&("text"===e.type?o=e.content:n.push(e))}return t.forEach(((e,n)=>{const s=n===t.length-1;switch(r){case N.PREPARE:return"#"===e?(i(N.WIDGET_START),void(s&&u())):(i(N.TEXT),o=e,void(s&&u()));case N.TEXT:return"#"===e?void(s?(o+=e,u()):(u(),i(N.WIDGET_START))):(o+=e,void(s&&u()));case N.WIDGET_START:return"{"!==e||s?(c(),i(N.TEXT),o+=`#${e}`,void(s&&u())):void i(N.WIDGET);case N.WIDGET:return"}"===e?(u("widget"),void i(N.PREPARE)):"#"===e?(c(),u(),i(N.WIDGET_START),o+=`#${e}`,void(s&&u())):(o+=e,void(s&&u("text",`#{${o}`)))}})),n}function M(e,t){let n=E(e);return t.forEach((({from:e,to:t})=>{n.forEach(((r,o)=>{d(r)&&(n[o]=r.split(e).map(((e,n,r)=>[e,n<r.length-1?t:null])))})),n=T(n)})),n}function H(e){return"Enter"===e.code||"NumpadEnter"===e.code}export{F as FieldListFilter,w as combineExtendKey,G as createInputSlot,_ as createSlot,C as editorUnescape,O as findItemByValCondition,I as formRenderLog,k as getAbsoluteKey,W as injectOrProvide,H as isEnter,D as isNegative,B as isNestedFieldType,b as isNestedType,R as isPositive,A as mergeDeepProperties,J as parseEnhanceText,P as parseNumberFromMaybeString,X as renderDescOption,K as renderOptionLabel,M as replace2Any,$ as splitExtendKey,S as validateMessageParser};