cnhis-design-vue 3.1.55-beta.1 → 3.1.55-beta.11

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 (112) hide show
  1. package/README.md +87 -87
  2. package/es/components/audio-sdk/index.d.ts +2 -0
  3. package/es/components/audio-sdk/index.js +1 -0
  4. package/es/components/{chat-sdk/src/chatSDK.d.ts → audio-sdk/src/audioSDK.d.ts} +8 -4
  5. package/es/components/audio-sdk/src/audioSDK.js +1 -0
  6. package/es/components/{chat-sdk → audio-sdk}/src/components/recordingDialog.vue.d.ts +1 -0
  7. package/es/components/audio-sdk/src/components/recordingDialog.vue2.js +1 -0
  8. package/es/components/audio-sdk/style/index.css +1 -0
  9. package/es/components/base-search/src/index.vue2.js +1 -1
  10. package/es/components/{multi-chat → biunique-chat}/index.d.ts +2 -2
  11. package/es/components/biunique-chat/index.js +1 -0
  12. package/es/components/biunique-chat/src/BiuniqueChat.vue.js +1 -0
  13. package/es/components/biunique-chat/src/BiuniqueChat.vue2.js +1 -0
  14. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  15. package/es/components/callback/src/components/render/popupMaps.d.ts +13 -0
  16. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  17. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogram.js +1 -1
  18. package/es/components/fabric-chart/src/hooks/electrocardiogram/useElectrocardiogramChart.js +1 -1
  19. package/es/components/form-config/index.d.ts +26 -0
  20. package/es/components/form-config/src/FormConfig.vue.d.ts +26 -0
  21. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +13 -0
  22. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +13 -0
  23. package/es/components/form-render/index.d.ts +13 -0
  24. package/es/components/form-render/index.js +1 -1
  25. package/es/components/form-render/src/FormRender.vue.d.ts +13 -0
  26. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  27. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +13 -0
  28. package/es/components/form-render/src/components/renderer/complex.js +1 -1
  29. package/es/components/form-render/src/components/renderer/date.js +1 -1
  30. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -1
  31. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue2.js +1 -1
  32. package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -1
  33. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  34. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  35. package/es/components/form-render/src/components/renderer/select.js +1 -1
  36. package/es/components/form-render/src/components/renderer/switch.js +1 -1
  37. package/es/components/form-render/src/components/renderer/textarea.js +1 -1
  38. package/es/components/form-render/src/constants/index.d.ts +0 -1
  39. package/es/components/form-render/src/constants/index.js +1 -1
  40. package/es/components/form-render/src/hooks/useAnchor.js +1 -1
  41. package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
  42. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  43. package/es/components/form-render/src/hooks/useFormItemDeps.d.ts +3 -3
  44. package/es/components/form-render/src/hooks/useFormItemDeps.js +1 -1
  45. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +12 -8
  46. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  47. package/es/components/form-render/src/hooks/useFormValidator.js +1 -1
  48. package/es/components/form-render/src/hooks/usePresetScope.js +1 -1
  49. package/es/components/form-render/src/utils/index.d.ts +3 -17
  50. package/es/components/form-render/src/utils/index.js +1 -1
  51. package/es/components/index.css +1 -1
  52. package/es/components/index.d.ts +3 -3
  53. package/es/components/index.js +1 -1
  54. package/es/components/info-header/index.d.ts +26 -0
  55. package/es/components/info-header/src/InfoHeader.vue.d.ts +26 -0
  56. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +13 -0
  57. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +13 -0
  58. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  59. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  60. package/es/components/select-person/src/SearchMultiple.vue.d.ts +6 -0
  61. package/es/components/shortcut-setter/index.d.ts +13 -0
  62. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +13 -0
  63. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +0 -3
  64. package/es/env.d.ts +25 -25
  65. package/es/shared/assets/img/failure.png.js +1 -1
  66. package/es/shared/assets/img/no-permission.png.js +1 -1
  67. package/es/shared/assets/img/nodata.png.js +1 -1
  68. package/es/shared/assets/img/notfound.png.js +1 -1
  69. package/es/shared/assets/img/qr.png.js +1 -1
  70. package/es/shared/assets/img/success.png.js +1 -1
  71. package/es/shared/assets/img/video.png.js +1 -1
  72. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  73. package/es/shared/assets/img/xb_big.png.js +1 -1
  74. package/es/shared/assets/img/xb_small.png.js +1 -1
  75. package/es/shared/package.json.js +1 -1
  76. package/package.json +2 -2
  77. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  78. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
  79. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
  80. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
  81. package/es/components/chat-sdk/index.d.ts +0 -2
  82. package/es/components/chat-sdk/index.js +0 -1
  83. package/es/components/chat-sdk/src/chatSDK.js +0 -1
  84. package/es/components/chat-sdk/src/components/recordingDialog.vue2.js +0 -1
  85. package/es/components/chat-sdk/style/index.css +0 -1
  86. package/es/components/multi-chat/index.js +0 -1
  87. package/es/components/multi-chat/src/MultiChat.vue.js +0 -1
  88. package/es/components/multi-chat/src/MultiChat.vue2.js +0 -1
  89. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +0 -86
  90. package/es/shared/utils/fabricjs/index.d.ts +0 -6823
  91. package/es/shared/utils/tapable/index.d.ts +0 -139
  92. /package/es/components/{chat-sdk → audio-sdk}/src/components/recordingDialog.vue.js +0 -0
  93. /package/es/components/{chat-sdk → audio-sdk}/src/utils/recordingDialog.d.ts +0 -0
  94. /package/es/components/{chat-sdk → audio-sdk}/src/utils/recordingDialog.js +0 -0
  95. /package/es/components/{multi-chat/src/MultiChat.vue.d.ts → biunique-chat/src/BiuniqueChat.vue.d.ts} +0 -0
  96. /package/es/components/{multi-chat → biunique-chat}/src/api/index.d.ts +0 -0
  97. /package/es/components/{multi-chat → biunique-chat}/src/api/index.js +0 -0
  98. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatFooter.vue.d.ts +0 -0
  99. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatFooter.vue.js +0 -0
  100. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatFooter.vue2.js +0 -0
  101. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatHeader.vue.d.ts +0 -0
  102. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatHeader.vue.js +0 -0
  103. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatHeader.vue2.js +0 -0
  104. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatMain.vue.d.ts +0 -0
  105. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatMain.vue.js +0 -0
  106. /package/es/components/{multi-chat → biunique-chat}/src/components/ChatMain.vue2.js +0 -0
  107. /package/es/components/{multi-chat → biunique-chat}/src/components/SiderList.vue.d.ts +0 -0
  108. /package/es/components/{multi-chat → biunique-chat}/src/components/SiderList.vue.js +0 -0
  109. /package/es/components/{multi-chat → biunique-chat}/src/components/SiderList.vue2.js +0 -0
  110. /package/es/components/{multi-chat → biunique-chat}/src/utils/chatSock.d.ts +0 -0
  111. /package/es/components/{multi-chat → biunique-chat}/src/utils/chatSock.js +0 -0
  112. /package/es/components/{multi-chat → biunique-chat}/style/index.css +0 -0
@@ -1 +1 @@
1
- import{doAnimation as e}from"../../../../shared/utils/anime.js";import{useDebounceFn as o,watchOnce as t}from"@vueuse/core";import{ref as r,computed as n,nextTick as i}from"vue";import{FormItemLineBarDepKeyPrepend as l}from"../constants/index.js";import"../../../../shared/utils/index.js";import"@formily/core";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"../../index.js";import"date-fns";import{createLinebarId as a}from"../utils/schema.js";function s(s,u,c,m){const v=r(),p=r(""),f=r([]),d=async function(e){var o;f.value=Object.values(e.fields).reduce(((e,o)=>{var t,r;return"LINEBAR"===o.componentType&&"visible"===o.selfDisplay&&e.push({title:null!=(r=null==(t=o.componentProps)?void 0:t.title)?r:o.title,name:o.address.toString()}),e}),[]),await i(),null==(o=v.value)||o.syncBarPosition()};let h=!1;async function y(o){h=!0;try{if(!c.value)return;m.trigger(l+o,!0),await i();const t=c.value.querySelector(`#${a(o)}`);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=o((function(e){var o;if(h||!c.value)return;const{scrollTop:t,clientHeight:r}=c.value,n=f.value.find(((e,o,n)=>{const i=n[o+1];if(!i)return!0;const l=c.value.querySelector(`#${a(i.name)}`);return l?l.offsetTop>t+r/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,t;p.value=null!=(t=null==(o=e[0])?void 0:o.name)?t:""}));return{currentAnchor:n({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{s as useAnchor};
1
+ import{doAnimation as e}from"../../../../shared/utils/anime.js";import{Path as o}from"@formily/path";import{useDebounceFn as t,watchOnce as r}from"@vueuse/core";import{ref as n,computed as l,nextTick as i}from"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"lodash-es";import"naive-ui";import"date-fns";import{createLinebarId as a}from"../utils/schema.js";function s(s,u,c,m){const v=n(),p=n(""),f=n([]),d=async function(e){var o;f.value=Object.values(e.fields).reduce(((e,o)=>{var t,r;return"LINEBAR"===o.componentType&&"visible"===o.selfDisplay&&e.push({title:null!=(r=null==(t=o.componentProps)?void 0:t.title)?r:o.title,name:o.address.toString()}),e}),[]),await i(),null==(o=v.value)||o.syncBarPosition()};let h=!1;async function y(t){h=!0;try{if(!c.value)return;m.trigger(o.parse(t),!0),await i();const r=c.value.querySelector(`#${a(t)}`);if(!r)return;await new Promise((o=>{e(c.value.scrollTop,r.offsetTop,300,(e=>{var o;null==(o=c.value)||o.scrollTo({top:e})}),"easeInSine",(()=>setTimeout(o,300)))}))}finally{h=!1}}const T=t((function(e){var o;if(h||!c.value)return;const{scrollTop:t,clientHeight:r}=c.value,n=f.value.find(((e,o,n)=>{const l=n[o+1];if(!l)return!0;const i=c.value.querySelector(`#${a(l.name)}`);return i?i.offsetTop>t+r/2:void 0}))||f.value[f.value.length-1];p.value=null!=(o=null==n?void 0:n.name)?o:"",u("scroll",e)}),300);r(f,(e=>{var o,t;p.value=null!=(t=null==(o=e[0])?void 0:o.name)?t:""}));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{s 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 a}from"lodash-es";import{FIELD_BUSINESS_TYPE as n}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import"../../index.js";import{isIdCard as l,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,a){const n=this.getField(i);n&&e.setFieldState(n.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(n.val_key)||(e.value=this.formatter({value:r,type:i,fieldKey:n.val_key,from:a})))}))}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 a="change"===s?this.changeHandlerMap:null;a&&(null==(i=a.get(r))||i.call(this,e))}}function c(){function e(){var e;const t=this.getField(n.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,n.ID_CARD);if(!r||!s(r)||!l(r))return;const a=o(r),{age:h,ageUnit:y}=u(a);this.setValueByType(t,n.AGE_UNIT,y,n.ID_CARD),this.setValueByType(t,n.AGE,h,n.ID_CARD),this.setValueByType(t,n.SEX,a.sex,n.ID_CARD),this.setValueByType(t,n.BIRTHDAY,i(new Date(a.birthday),e.call(this)),n.ID_CARD)}function r(e){const t=this.getValueByType(e,n.BIRTHDAY);if(!s(t))return;const{age:i,ageUnit:r}=u(h(t));this.setValueByType(e,n.AGE_UNIT,r,n.BIRTHDAY),this.setValueByType(e,n.AGE,i,n.BIRTHDAY)}function c(t){return function(i){const r=this.getValueByType(i,n.AGE),l=this.getValueByType(i,n.AGE_UNIT);(s(r)||a(r))&&""!==r&&s(l)&&""!==l&&this.setValueByType(i,n.BIRTHDAY,y(+r,l,e.call(this)),t)}}return{create:function(e){return new p(e).registerChangeBusiness(n.ID_CARD,t).registerChangeBusiness(n.AGE_UNIT,c(n.AGE_UNIT)).registerChangeBusiness(n.AGE,c(n.AGE)).registerChangeBusiness(n.BIRTHDAY,r)}}}export{p as BusinessCollector,c 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 a}from"lodash-es";import{FIELD_BUSINESS_TYPE as n}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import{isIdCard as l,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,a){const n=this.getField(i);n&&e.setFieldState(n.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(n.val_key)||(e.value=this.formatter({value:r,type:i,fieldKey:n.val_key,from:a})))}))}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 a="change"===s?this.changeHandlerMap:null;a&&(null==(i=a.get(r))||i.call(this,e))}}function g(){function e(){var e;const t=this.getField(n.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,n.ID_CARD);if(!r||!s(r)||!l(r))return;const a=o(r),{age:h,ageUnit:y}=u(a);this.setValueByType(t,n.AGE_UNIT,y,n.ID_CARD),this.setValueByType(t,n.AGE,h,n.ID_CARD),this.setValueByType(t,n.SEX,a.sex,n.ID_CARD),this.setValueByType(t,n.BIRTHDAY,i(new Date(a.birthday),e.call(this)),n.ID_CARD)}function r(e){const t=this.getValueByType(e,n.BIRTHDAY);if(!s(t))return;const{age:i,ageUnit:r}=u(h(t));this.setValueByType(e,n.AGE_UNIT,r,n.BIRTHDAY),this.setValueByType(e,n.AGE,i,n.BIRTHDAY)}function g(t){return function(i){const r=this.getValueByType(i,n.AGE),l=this.getValueByType(i,n.AGE_UNIT);(s(r)||a(r))&&""!==r&&s(l)&&""!==l&&this.setValueByType(i,n.BIRTHDAY,y(+r,l,e.call(this)),t)}}return{create:function(e){return new c(e).registerChangeBusiness(n.ID_CARD,t).registerChangeBusiness(n.AGE_UNIT,g(n.AGE_UNIT)).registerChangeBusiness(n.AGE,g(n.AGE)).registerChangeBusiness(n.BIRTHDAY,r)}}}export{c as BusinessCollector,g as useBusinessBinding};
@@ -1 +1 @@
1
- import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isFunction as a,isArray as s,isString as l,isBoolean as d}from"lodash-es";import{nextTick as u}from"vue";import"../../index.js";import{FormItemLineBarDepKeyPrepend as m,NESTED_FORM_ITEM_TYPE as f}from"../constants/index.js";import{queryDecoratorByAddress as c,queryInput as g,queryDecoratorByFieldKey as p,findNextWidget as v}from"../utils/dom.js";import{validateMessageParser as y,combineExtendKey as h,splitExtendKey as b}from"../utils/index.js";import{getParentLinebar as x}from"../utils/schema.js";function D({formModel:t,formRenderRef:n,formUUID:f,getFieldList:v,formItemDepsCollector:D,businessCollector:F,wordbookSettingHandler:I,operationalFormHandler:j}){return{validate(o="*",{force:d}={}){if(a(o)){const e=Object.entries(t.fields).reduce(((e,[t,r])=>(o(r)&&e.push(t),e)),[]);if(!e.length)return Promise.resolve();o=e.length?`*(${e.join(",")})`:"*"}const u=[];d&&t.setFieldState(o,(e=>{"visible"===e.display&&"editable"!==e.pattern&&r(e)&&(u.push({pattern:e.pattern,state:e}),e.pattern="editable")}));const m=t.validate(o).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(p,[]):e)));return d&&u.forEach((({pattern:e,state:t})=>t.pattern=e)),m;function p(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(v)),o=!0)})),!o&&t.push(v(r)),t}function v(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),a=e.messages.map((e=>function(e,t){if(!t||!i(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return y(r&&l(r)?r:e,t.fieldItem)}(e,r.get("decoratorProps")))),s=c(e.address,n.value,f);return{...e,messages:a,title:o,decoratorElement:s,...g(s)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=h(v(),r)),r},async setFormValues(e,n={},a=!1,s=!0){var l,m,f,c,g,p;let y=!0,h=!0,x=!0,w=!0;i(n)?(h=null==(l=n.needSplitExtendKey)||l,y=null==(m=n.avoidDependKeyConnection)||m,a=null!=(f=n.avoidBusinessConnection)&&f,x=null==(c=n.avoidWordbookSettingConnection)||c,w=null==(g=n.avoidOperationalFormConnection)||g,s=null==(p=n.overwrite)||p):d(n)&&(h=n),F.triggerDisabled=a,D.triggerDisabled=y,I.triggerDisabled=x,j.triggerDisabled=w,h&&(e=b(v(),e)),t.setFieldState("*",(t=>{r(t)&&(s||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))})),await u(),F.triggerDisabled=!1,D.triggerDisabled=!1,I.triggerDisabled=!1,j.triggerDisabled=!1},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return a();const o=p(e,t,f);if(o)return a(o);const i=x(e,r);return i?(D.trigger(m+i,!0),await u(),a(p(e,t,f))):a();function a(e){return{decoratorElement:e,...g(e)}}}(e,n.value,v()):null}}function F({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var l;if(e.enterToNextWidget&&s.target){if("TEXTAREA"===s.target.tagName&&!s.ctrlKey)return;s.preventDefault()}if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const d=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!d)return;const u=`.form-render__formItem${f.map((e=>`:not([widget-type=${e}])`)).join("")}`,m=Array.from(r.value.querySelectorAll(u)),c=m.findIndex((e=>e.id===d.id));if(!~c)return;const{widget:g,field:p}=v(m,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=p&&o.query(p).take();!t||e.enterToNextWidget(null==(l=t.decoratorProps)?void 0:l.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{F as useFormDomEvent,D as useFormExposeEvent};
1
+ import{arrayed as e,findAncestor as t}from"../../../../shared/utils/index.js";import{isField as r}from"@formily/core";import{Path as o}from"@formily/path";import{isObject as i}from"@vue/shared";import{promiseTimeout as n}from"@vueuse/shared";import{isFunction as a,isArray as s,isString as l,isBoolean as d}from"lodash-es";import{nextTick as u}from"vue";import"../../index.js";import{NESTED_FORM_ITEM_TYPE as m}from"../constants/index.js";import{queryDecoratorByAddress as f,queryInput as c,queryDecoratorByFieldKey as g,findNextWidget as p}from"../utils/dom.js";import{validateMessageParser as v,combineExtendKey as y,splitExtendKey as h}from"../utils/index.js";import{getParentLinebar as b}from"../utils/schema.js";function x({formModel:t,formRenderRef:n,formUUID:m,getFieldList:p,formItemDepsCollector:x,businessCollector:D,wordbookSettingHandler:F,operationalFormHandler:I}){return{validate(o="*",{force:d}={}){if(a(o)){const e=Object.entries(t.fields).reduce(((e,[t,r])=>(o(r)&&e.push(t),e)),[]);if(!e.length)return Promise.resolve();o=e.length?`*(${e.join(",")})`:"*"}const u=[];d&&t.setFieldState(o,(e=>{"visible"===e.display&&"editable"!==e.pattern&&r(e)&&(u.push({pattern:e.pattern,state:e}),e.pattern="editable")}));const g=t.validate(o).catch((e=>Promise.reject(Array.isArray(e)?e.reduce(p,[]):e)));return d&&u.forEach((({pattern:e,state:t})=>t.pattern=e)),g;function p(t,r){if(!i(r))return t;let o=!1;return s(r.messages)&&r.messages.forEach((r=>{i(r)&&(t.push(...e(r).map(y)),o=!0)})),!o&&t.push(y(r)),t}function y(e){if(e.decoratorElement)return e;const r=t.query(e.path),o=r.get("title"),a=e.messages.map((e=>function(e,t){if(!t||!i(t.fieldItem))return e;const r=t.fieldItem.defined_error_msg;return v(r&&l(r)?r:e,t.fieldItem)}(e,r.get("decoratorProps")))),s=f(e.address,n.value,m);return{...e,messages:a,title:o,decoratorElement:s,...c(s)}}},getFormValues(e=!0){let r=t.getFormState().values;return e&&(r=y(p(),r)),r},async setFormValues(e,n={},a=!1,s=!0){var l,m,f,c,g,v;let y=!0,b=!0,j=!0,w=!0;i(n)?(b=null==(l=n.needSplitExtendKey)||l,y=null==(m=n.avoidDependKeyConnection)||m,a=null!=(f=n.avoidBusinessConnection)&&f,j=null==(c=n.avoidWordbookSettingConnection)||c,w=null==(g=n.avoidOperationalFormConnection)||g,s=null==(v=n.overwrite)||v):d(n)&&(b=n),D.triggerDisabled=a,x.triggerDisabled=y,F.triggerDisabled=j,I.triggerDisabled=w,b&&(e=h(p(),e)),t.setFieldState("*",(t=>{r(t)&&(s||o.existIn(e,t.path))&&(t.value=o.getIn(e,t.path))})),await u(),D.triggerDisabled=!1,x.triggerDisabled=!1,F.triggerDisabled=!1,I.triggerDisabled=!1},setFieldState(e,r){t.setFieldState(e,r)},resetFields:(e="*")=>t.reset(e),queryWidget:async e=>n.value?await async function(e,t,r){if(!n.value)return s();const i=g(e,t,m);if(i)return s(i);const a=b(e,r);return a?(x.trigger(o.parse(a),!0),await u(),s(g(e,t,m))):s();function s(e){return{decoratorElement:e,...c(e)}}}(e,n.value,p()):null}}function D({props:e,formRenderRef:r,formModel:o}){return{onKeydown:async function i(s){var l;if(e.enterToNextWidget&&s.target){if("TEXTAREA"===s.target.tagName&&!s.ctrlKey)return;s.preventDefault()}if(await n(0),Reflect.get(s,"stopCapture")||!e.enterToNextWidget||!r.value)return;const d=t(s.target,(e=>e.classList.contains("form-render__formItem")));if(!d)return;const u=`.form-render__formItem${m.map((e=>`:not([widget-type=${e}])`)).join("")}`,f=Array.from(r.value.querySelectorAll(u)),c=f.findIndex((e=>e.id===d.id));if(!~c)return;const{widget:g,field:v}=p(f,c,s.target);if(g)if(a(e.enterToNextWidget)){const t=v&&o.query(v).take();!t||e.enterToNextWidget(null==(l=t.decoratorProps)?void 0:l.fieldItem)?y():i({target:g})}else y();async function y(){await n(0),g.focus()}}}}export{D as useFormDomEvent,x as useFormExposeEvent};
@@ -1,11 +1,11 @@
1
1
  import { AnyFn } from '../../../../../es/shared/types';
2
+ import { Path } from '@formily/path';
2
3
  import { DependKeyType } from '../../../../../es/components/form-render';
3
4
  export declare class FormItemDepsCollector {
4
5
  triggerDisabled: string | boolean;
5
6
  private readonly collector;
6
- setDeps(key: string, dependKeys: DependKeyType, callback: AnyFn): void;
7
- getDeps(dependKey: string): Map<string, AnyFn<any[], any>> | undefined;
8
- trigger(dependKey: string, payload?: unknown): void;
7
+ setDeps(fieldPath: Path, dependKeys: DependKeyType, callback: AnyFn): void;
8
+ trigger(dependPath: Path, payload?: unknown): void;
9
9
  }
10
10
  export declare function useFormItemDeps(): {
11
11
  create: () => FormItemDepsCollector;
@@ -1 +1 @@
1
- import{Path as t}from"@formily/path";import{isFunction as e,isString as r}from"lodash-es";import"vue";import"../../../../shared/utils/index.js";import"@formily/core";import"@vicons/ionicons5";import"@vue/shared";import"@vueuse/core";import"naive-ui";import"../../index.js";import"date-fns";import{traverseDependKey as i}from"../utils/schema.js";class s{constructor(){this.triggerDisabled=!1,this.collector=new Map}setDeps(t,e,r){i(e,(e=>{const i=this.collector.get(e)||new Map;i.set(t,r),this.collector.set(e,i)}))}getDeps(t){return this.collector.get(t)}trigger(i,s){if(!0===this.triggerDisabled)return;const o=this.getDeps(i);o&&[...o.entries()].forEach((([i,o])=>{!e(o)||this.triggerDisabled&&r(this.triggerDisabled)&&t.parse(this.triggerDisabled).match(i)||o(s)}))}}function o(){return{create:function(){return new s}}}export{s as FormItemDepsCollector,o as useFormItemDeps};
1
+ import{Path as t}from"@formily/path";import{isFunction as r,isString as e}from"lodash-es";import"../../index.js";import{getAbsoluteKey as i}from"../utils/index.js";import{traverseDependKey as s}from"../utils/schema.js";class o{constructor(){this.triggerDisabled=!1,this.collector=new Map}setDeps(t,r,e){s(r,(r=>{const s=i(r,t),o=this.collector.get(s)||new Map;o.set(t,e),this.collector.set(s,o)}))}trigger(i,s){if(!0===this.triggerDisabled)return;const o=this.collector.get(i.toString());o&&[...o.entries()].forEach((([i,o])=>{!r(o)||this.triggerDisabled&&e(this.triggerDisabled)&&t.parse(this.triggerDisabled).match(i)||o(s)}))}}function c(){return{create:function(){return new o}}}export{o as FormItemDepsCollector,c as useFormItemDeps};
@@ -32,14 +32,16 @@ export declare function useUrlConfigOptions(props: Partial<{
32
32
  lazyRequest: boolean;
33
33
  searchByValue: boolean;
34
34
  }>, valueRef: Ref, hooks?: UseOptionHooks): {
35
- labelKey: import("vue").ComputedRef<string>;
35
+ labelKey: Ref<string>;
36
36
  loading: Ref<boolean>;
37
- showKey: import("vue").ComputedRef<string | undefined>;
38
- valueKey: import("vue").ComputedRef<string>;
37
+ showKey: Ref<string | undefined>;
38
+ valueKey: Ref<string>;
39
39
  remoteOptions: Ref<AnyObject[] | null>;
40
40
  filterOptions: import("vue").ComputedRef<AnyObject[]>;
41
41
  fullOptions: import("vue").ComputedRef<AnyObject[]>;
42
- fetchData: (content?: string, otherParams?: AnyObject) => Promise<null | undefined>;
42
+ fetchData: (content?: string | undefined, otherParams?: AnyObject | undefined, options?: {
43
+ avoidSearchContent?: boolean | undefined;
44
+ }) => Promise<null | undefined>;
43
45
  searchContent: Ref<string | undefined>;
44
46
  };
45
47
  export declare function useAutographOptions(props: Partial<{
@@ -52,14 +54,16 @@ export declare function useAutographOptions(props: Partial<{
52
54
  lazyRequest: boolean;
53
55
  options: AnyObject[];
54
56
  }>, valueRef: Ref, hooks?: UseOptionHooks): {
55
- labelKey: import("vue").ComputedRef<string>;
56
- showKey: import("vue").ComputedRef<string | undefined>;
57
+ labelKey: Ref<string>;
57
58
  loading: Ref<boolean>;
59
+ showKey: Ref<string | undefined>;
60
+ valueKey: Ref<string>;
58
61
  remoteOptions: Ref<AnyObject[] | null>;
59
- valueKey: import("vue").ComputedRef<string>;
60
62
  filterOptions: import("vue").ComputedRef<AnyObject[]>;
61
63
  fullOptions: import("vue").ComputedRef<AnyObject[]>;
62
- fetchData: (content?: string, otherParams?: AnyObject) => Promise<null | undefined>;
64
+ fetchData: (content?: string | undefined, otherParams?: AnyObject | undefined, options?: {
65
+ avoidSearchContent?: boolean | undefined;
66
+ }) => Promise<null | undefined>;
63
67
  searchContent: Ref<string | undefined>;
64
68
  };
65
69
  export {};
@@ -1 +1 @@
1
- import{checkInSetupEnv as e,arrayed as l,jsonParse as n}from"../../../../shared/utils/index.js";import{uniqBy as u,isEqual as a,isString as o,omit as t,isFunction as r}from"lodash-es";import"naive-ui";import{computed as i,inject as s,ref as v,watch as c,toRaw as m}from"vue";import"@vueuse/core";import"date-fns";import{useFormRequest as d}from"../../../../shared/hooks/useFormRequest/index.js";import"@vueuse/shared";import{useOptionFiltered as f}from"../../../../shared/hooks/selectHooks/useOptionFiltered.js";import{useSearchContent as y}from"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{useForm as p}from"@formily/vue";import"../../index.js";import{InjectionAsyncQueue as h,InjectionFormLifeCycleCaller as g,InjectionFormItemDepsCollector as K}from"../constants/index.js";import{createUrlConfigParams as k,formRenderLog as C}from"../utils/index.js";import{useFormField as b}from"./useFormField.js";function w(e,l){const n=v();return i({get:()=>n.value?n.value:e[l],set(e){n.value=e}})}function O(e,l,a,o,v){const c=w(e,"commonList"),m=w(e,"recentList"),{searchContent:f,optionSearchFilter:p}=y();function g(e){return n(e.itemObj)}const K=i((()=>{var e,l;return null!=(l=null==(e=c.value)?void 0:e.map(g))?l:[]})),k=i((()=>{var e,l;return null!=(l=null==(e=m.value)?void 0:e.map(g))?l:[]})),C=i((()=>{if(!e.recommend||!K.value.length&&!k.value.length)return l.value;const n=u(K.value.concat(k.value),(e=>e[v.value])),a=l.value.filter((e=>n.every((function(l){return l[v.value]!==e[v.value]}))));return[...p(n,o.value),...a]})),{getRecommendRequestInfo:O,getHttpInstance:R}=d();function q(l){const{url:n,getRecommendIds:u}=O(),a=r(u)?u():{},o=r(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:n[l],info:Object.assign({},a,o)}}const{fieldKey:F,field:j}=b(),I=s(h);return{postRecommend:async function(l){if(!e.recommend)return;const n=R();if(!n)return;const{url:u,info:o}=q("post"),t=C.value.find((e=>e[v.value]===l));t&&a("postRecommend",await n.post(u,{...o,keyword:"",itemId:v.value,itemObj:JSON.stringify(t)}))},getRecommend:async function(l){if(!e.recommend)return;if(f.value=l,c.value&&m.value&&e.recommendCache)return;const n=await I.addAsync(function(l,n){const{url:u,info:a}=q("get");return{url:u,method:"get",key:l,cache:n,params:{...a,recNum:Math.max(e.commonNum,e.recentNum),keyword:""},payload:{field:j.value,labelKey:o.value,valueKey:v.value}}}(F.value,e.recommendCache)),{commonly:u,recently:a}=n.reduce(((e,l)=>("commonly"===l.type?e.commonly.push(t(l,["type"])):"recently"===l.type&&e.recently.push(t(l,["type"])),e)),{commonly:[],recently:[]});c.value=u.slice(0,e.commonNum),m.value=a.slice(0,e.recentNum)},sortedOptions:C}}function R(l,n,u){e();const t=s(h),r=s(g),d=i((()=>{var e,n,u;return null!=(u=null!=(n=null==(e=l.urlConfig)?void 0:e.nameKey)?n:l.labelField)?u:"text"})),y=i((()=>{var e,n,u;return null!=(u=null!=(n=null==(e=l.urlConfig)?void 0:e.valueKey)?n:l.valueField)?u:"value"})),p=i((()=>{var e,n;return null!=(n=null==(e=l.urlConfig)?void 0:e.showKey)?n:l.showField})),w=i((()=>{var e,n;return null!=(n=null==(e=l.urlConfig)?void 0:e.searchKey)?n:l.searchField})),{remoteOptions:O,filterOptions:R,fullOptions:q,searchContent:F}=f(l,{labelKey:d,valueKey:y,searchKey:w}),{field:j,fieldKey:I}=b(),x=v(!1),D=async function(e,n){if(F.value=e,!l.urlConfig)return O.value=null;if(null==F.value)try{x.value=!0;const e={field:j.value,labelKey:d.value,valueKey:y.value},u=await t.addAsync(await k({config:{...l.urlConfig,payload:e,params:{...l.urlConfig.params,...n}},cache:l.requestCache,field:j.value}));m(O.value)!==u&&(O.value=u,r("afterOptionInit",[I.value,O.value,e]))}catch(e){o(e)&&C(e)}finally{x.value=!1}},N=s(K);return c((()=>l.urlConfig),((e,o)=>{if(a(e,o))return;if(O.value=null,!e)return O.value=null;const t={fetchData:D,labelKey:d.value,valueKey:y.value},{onRequestConfigChange:r,onDepsChange:i}=u||{};N.setDeps(I.value,e.dependKey||[],(async()=>{O.value=null,n.value=null,l.lazyRequest||(i?i(t):D())})),!n.value&&l.lazyRequest||(r?r(t):D())}),{immediate:!0}),{labelKey:d,loading:x,showKey:p,valueKey:y,remoteOptions:O,filterOptions:R,fullOptions:q,fetchData:D,searchContent:F}}function q(n,u,t){e();const r=s(h),y=s(g),k=p(),w=i((()=>{var e;const u=l(null==(e=n.wordbook)?void 0:e.show_key)[0];return o(u)?u:null})),O=i((()=>{var e,l,u,a;const t=null==(l=null==(e=n.wordbook)?void 0:e.render_key)?void 0:l[0];return o(t)?t:null!=(a=null!=(u=w.value)?u:n.labelField)?a:"text"})),R=i((()=>{var e,l,u;return null!=(u=null!=(l=null==(e=n.wordbook)?void 0:e.value_key)?l:n.valueField)?u:"value"})),q=i((()=>{var e;return(null==(e=n.wordbook)?void 0:e.search_key)||[]})),F=i((()=>{var e;return null!=(e=w.value)?e:n.showField})),{fieldKey:j,field:I}=b(),{getSearchRequestInfo:x}=d(),{searchContent:D,remoteOptions:N,filterOptions:S,fullOptions:_}=f(n,{labelKey:O,valueKey:R,searchKey:q}),z=v(!1),A=async function(e,l){if(D.value=e,!n.autograph||!n.wordbook)return N.value=null;if(null==D.value)try{z.value=!0;const e={field:I.value,labelKey:O.value,valueKey:R.value},u=await r.addAsync(function(e,l,u,a,o){var t,r,i;const s={autograph:l,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1,...o};if(null==(t=e.queryParams)?void 0:t.length){const l=null!=(i=null==(r=k.value)?void 0:r.getFormState().values)?i:{};e.queryParams.forEach((e=>{s[e]=l[e]}))}return{...x(),params:s,key:u,cache:n.requestCache,payload:a}}(n.wordbook,n.autograph,j.value,e,l));m(N.value)!==u&&(N.value=u,y("afterOptionInit",[j.value,N.value,e]))}catch(e){o(e)&&C(e)}finally{z.value=!1}},H=s(K);return c((()=>n.wordbook),((e,l)=>{if(a(e,l))return;if(N.value=null,!e)return N.value=null;const o={fetchData:A,labelKey:O.value,valueKey:R.value},{onRequestConfigChange:r,onDepsChange:i}=t||{};H.setDeps(j.value,e.queryParams||[],(async()=>{N.value=null,i?i(o):A()})),!u.value&&n.lazyRequest||(r?r(o):A())}),{immediate:!0}),{labelKey:O,showKey:F,loading:z,remoteOptions:N,valueKey:R,filterOptions:S,fullOptions:_,fetchData:A,searchContent:D}}export{q as useAutographOptions,O as useRecommendOptions,R as useUrlConfigOptions};
1
+ import{arrayed as e,checkInSetupEnv as l,jsonParse as n}from"../../../../shared/utils/index.js";import{uniqBy as o,isString as r,isEqual as t,omit as u,isFunction as a}from"lodash-es";import"naive-ui";import{computed as s,inject as i,ref as c,watch as v,toRaw as m}from"vue";import"@vueuse/core";import"date-fns";import{useFormRequest as d}from"../../../../shared/hooks/useFormRequest/index.js";import"@vueuse/shared";import{useOptionFiltered as f}from"../../../../shared/hooks/selectHooks/useOptionFiltered.js";import{useSearchContent as y}from"../../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../index.js";import{InjectionAsyncQueue as p,InjectionFormLifeCycleCaller as h,InjectionFormItemDepsCollector as g}from"../constants/index.js";import{useFormField as K}from"./useFormField.js";import{traverseDependKey as k}from"../utils/schema.js";import{getAbsoluteKey as w,formRenderLog as C}from"../utils/index.js";function b(e,l){const n=c();return s({get:()=>n.value?n.value:e[l],set(e){n.value=e}})}function R(e,l,r,t,c){const v=b(e,"commonList"),m=b(e,"recentList"),{searchContent:f,optionSearchFilter:h}=y();function g(e){return n(e.itemObj)}const k=s((()=>{var e,l;return null!=(l=null==(e=v.value)?void 0:e.map(g))?l:[]})),w=s((()=>{var e,l;return null!=(l=null==(e=m.value)?void 0:e.map(g))?l:[]})),C=s((()=>{if(!e.recommend||!k.value.length&&!w.value.length)return l.value;const n=o(k.value.concat(w.value),(e=>e[c.value])),r=l.value.filter((e=>n.every((function(l){return l[c.value]!==e[c.value]}))));return[...h(n,t.value),...r]})),{getRecommendRequestInfo:R,getHttpInstance:O}=d();function j(l){const{url:n,getRecommendIds:o}=R(),r=a(o)?o():{},t=a(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:n[l],info:Object.assign({},r,t)}}const{fieldKey:F,field:I}=K(),q=i(p);return{postRecommend:async function(l){if(!e.recommend)return;const n=O();if(!n)return;const{url:o,info:t}=j("post"),u=C.value.find((e=>e[c.value]===l));u&&r("postRecommend",await n.post(o,{...t,keyword:"",itemId:c.value,itemObj:JSON.stringify(u)}))},getRecommend:async function(l){if(!e.recommend)return;if(f.value=l,v.value&&m.value&&e.recommendCache)return;const n=await q.addAsync(function(l,n){const{url:o,info:r}=j("get");return{url:o,method:"get",key:l,cache:n,params:{...r,recNum:Math.max(e.commonNum,e.recentNum),keyword:""},payload:{field:I.value,labelKey:t.value,valueKey:c.value}}}(F.value,e.recommendCache)),{commonly:o,recently:r}=n.reduce(((e,l)=>("commonly"===l.type?e.commonly.push(u(l,["type"])):"recently"===l.type&&e.recently.push(u(l,["type"])),e)),{commonly:[],recently:[]});v.value=o.slice(0,e.commonNum),m.value=r.slice(0,e.recentNum)},sortedOptions:C}}function O(e,l,n){const o=s((()=>{var l,n,o;return null!=(o=null!=(n=null==(l=e.urlConfig)?void 0:l.nameKey)?n:e.labelField)?o:"text"})),r=s((()=>{var l,n,o;return null!=(o=null!=(n=null==(l=e.urlConfig)?void 0:l.valueKey)?n:e.valueField)?o:"value"})),t=s((()=>{var l,n;return null!=(n=null==(l=e.urlConfig)?void 0:l.showKey)?n:e.showField})),u=s((()=>{var l,n;return null!=(n=null==(l=e.urlConfig)?void 0:l.searchKey)?n:e.searchField})),{field:a}=K();return I({props:e,labelKey:o,valueKey:r,searchKey:u,showKey:t,hooks:n,valueRef:l,getConfig:()=>e.urlConfig,getParams:()=>{var l,n;const o=F(a.value,null==(l=e.urlConfig)?void 0:l.params,null==(n=e.urlConfig)?void 0:n.dependKey);return{...e.urlConfig,params:o}},getDependKeys:()=>{var l;return null==(l=e.urlConfig)?void 0:l.dependKey}})}function j(l,n,o){const t=s((()=>{var n;const o=e(null==(n=l.wordbook)?void 0:n.show_key)[0];return r(o)?o:null})),u=s((()=>{var e,n,o,u;const a=null==(n=null==(e=l.wordbook)?void 0:e.render_key)?void 0:n[0];return r(a)?a:null!=(u=null!=(o=t.value)?o:l.labelField)?u:"text"})),a=s((()=>{var e,n,o;return null!=(o=null!=(n=null==(e=l.wordbook)?void 0:e.value_key)?n:l.valueField)?o:"value"})),i=s((()=>{var e;return(null==(e=l.wordbook)?void 0:e.search_key)||[]})),c=s((()=>{var e;return null!=(e=t.value)?e:l.showField})),{field:v}=K(),{getSearchRequestInfo:m}=d();return I({props:l,labelKey:u,valueKey:a,searchKey:i,showKey:c,hooks:o,valueRef:n,getConfig:()=>l.wordbook,getParams:()=>{const{wordbook:e,autograph:n}=l,o=F(v.value,{autograph:n,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1},e.queryParams);return{...m(),params:o}},getDependKeys:()=>{var e;return null==(e=l.wordbook)?void 0:e.queryParams}})}function F(e,l,n){const o={...l};return n&&k(n,((l,n,r)=>{const t=w(l,e.path),u=e.form.getValuesIn(t);if(r&&null==u)throw`缺少必须的参数=>${t}`;o[n]=u})),o}function I({labelKey:e,valueKey:n,searchKey:o,showKey:u,props:a,getConfig:s,getParams:d,getDependKeys:y,hooks:k,valueRef:w}){l();const b=i(p),R=i(h),{remoteOptions:O,filterOptions:j,fullOptions:F,searchContent:I}=f(a,{labelKey:e,valueKey:n,searchKey:o}),{field:q,fieldKey:x}=K(),D=c(!1),N=async function(l,o,t={avoidSearchContent:!0}){if(I.value=l,!s())return O.value=null;if(!t.avoidSearchContent||null==I.value)try{D.value=!0;const l={field:q.value,labelKey:e.value,valueKey:n.value},r={params:{...d().params,...o},key:x.value,cache:a.requestCache,payload:l},t=await b.addAsync(Object.assign({},d(),r));m(O.value)!==t&&(O.value=t,R("afterOptionInit",[x.value,O.value,l]))}catch(e){r(e)&&C(e)}finally{D.value=!1}},S=i(g);return v(s,((l,o)=>{if(t(l,o))return;if(O.value=null,!l)return O.value=null;const r={fetchData:N,labelKey:e.value,valueKey:n.value},{onRequestConfigChange:u,onDepsChange:s}=k||{};S.setDeps(q.value.path,y()||[],(async()=>{O.value=null,w.value=null,a.lazyRequest||(s?s(r):N())})),!w.value&&a.lazyRequest||(u?u(r):N())}),{immediate:!0}),{labelKey:e,loading:D,showKey:u,valueKey:n,remoteOptions:O,filterOptions:j,fullOptions:F,fetchData:N,searchContent:I}}export{j as useAutographOptions,R as useRecommendOptions,O as useUrlConfigOptions};
@@ -1 +1 @@
1
- import{arrayed as e}from"../../../../shared/utils/index.js";import{once as i,isNumber as a,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"../../index.js";import{isIdCard as n}from"../utils/business.js";function o(){const i=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(i){var a;if(null!=i&&""!==i)return m(i)&&n(i)?void 0:null!=(a=null==e?void 0:e.message)?a:"该字段不是合法的身份证格式"}})],["regular",({validate:e,regular_expression:i,regular_error_tip:a})=>({pattern:i||(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(m){const r=[],{validate:{vali_obj:s,max_length:n,min_length:o,message:u,max_value:t,min_value:g,decimal_length:d}={},validator:v}=m;if(v&&e(v).forEach((e=>{l(e)&&r.push({validator:i=>e(i,m)})})),n&&r.push({max:n,message:u}),o&&r.push({min:o,message:u}),t&&r.push({maximum:t,message:u}),g&&r.push({minimum:g,message:u}),null!=d&&r.push(((e,i)=>{const a=null!=i?i:`小数位数最多${e}位`;return{validator(i){var m;return(null==(m=String(i).split(".")[1])?void 0:m.length)>e?a:""}}})(+d,u)),s){const e=i.get(s)||(({validate:e})=>({format:s,message:null==e?void 0:e.message}));r.push(Object.assign({},a,e(m)))}return r}}}const u=i((()=>{r({"zh-CN":{required:"${alias||name}为必填"}}),s({maximum:(e,i)=>a(Number(i.maximum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!a(e)||isNaN(e)?"":e>Number(i.maximum)&&i.message||""):"",minimum:(e,i)=>a(Number(i.minimum))&&null!=e&&""!==e&&"/"!==e?(m(e)&&(e=+e),!a(e)||isNaN(e)?"":e<Number(i.minimum)&&i.message||""):""})}));export{o as useFormValidator,u as validateMessageLocale};
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=>e(a,m)})})),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 +1 @@
1
- import{isString as i}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"../../index.js";import{isIdCard as o,isMobile as r}from"../utils/business.js";function s(){return{isIdCard:r=>i(r)&&o(r),isMobile:o=>i(o)&&r(o),isEmail:o=>i(o)&&/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(o),isNumber:o=>i(o)&&/\d+/.test(o)}}export{s as usePresetScope};
1
+ import{isString as i}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 o,isMobile as r}from"../utils/business.js";function s(){return{isIdCard:r=>i(r)&&o(r),isMobile:o=>i(o)&&r(o),isEmail:o=>i(o)&&/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(o),isNumber:o=>i(o)&&/\d+/.test(o)}}export{s as usePresetScope};
@@ -1,7 +1,8 @@
1
1
  import { AnyObject, ArrayAble } from '../../../../../es/shared/types';
2
2
  import { GeneralField } from '@formily/core';
3
+ import { Pattern } from '@formily/path';
3
4
  import { FunctionalComponent, InjectionKey, VNode } from 'vue';
4
- import { FieldItem, UrlConfig } from '../types';
5
+ import { FieldItem } from '../types';
5
6
  export * from './business';
6
7
  export * from './dom';
7
8
  export * from './schema';
@@ -18,20 +19,5 @@ export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObje
18
19
  export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
19
20
  export declare function isNestedType(type?: string): boolean | "" | undefined;
20
21
  export declare function isNestedFieldType(field: FieldItem | GeneralField): boolean | "" | undefined;
21
- export declare function createUrlConfigParams({ config, field, cache }: {
22
- config: UrlConfig;
23
- field: GeneralField;
24
- cache?: boolean;
25
- }): Promise<{
26
- params: AnyObject;
27
- key: string;
28
- cache: boolean | undefined;
29
- url: string;
30
- method?: import("../../..").FormRequestDefine.RequestType | undefined;
31
- nameKey?: string | undefined;
32
- valueKey?: string | undefined;
33
- showKey?: string | undefined;
34
- searchKey?: string[] | undefined;
35
- dependKey?: import("../../../../../es/components/form-render").DependKeyType | undefined;
36
- }>;
37
22
  export declare function renderDescOption(labelNode: any, option: AnyObject): JSX.Element;
23
+ export declare function getAbsoluteKey(fieldKey: string, field: Pattern): string;
@@ -1 +1 @@
1
- import{inject as e,provide as n,computed as t,createVNode as r,Fragment as o}from"vue";import{arrayed as i}from"../../../../shared/utils/index.js";import{isGeneralField as c,isField as u}from"@formily/core";import{Path as s}from"@formily/path";import{HelpCircleSharp as f}from"@vicons/ionicons5";import{isObject as a}from"@vue/shared";import{useMemoize as l}from"@vueuse/core";import{isString as p,isFunction as m,omit as d}from"lodash-es";import{NTooltip as h,NIcon as y}from"naive-ui";import"../../index.js";import{NESTED_FORM_ITEM_TYPE as x}from"../constants/index.js";import"date-fns";import{traverseDependKey as g}from"./schema.js";export{assignClearBindVisited,assignUpdateValue,assignValueBindKey,createLinebarId,createObjSchema,createVisitedSetter,dotEscape,fieldKeyEscape,getParentLinebar,traverseDependKey,traverseSchema}from"./schema.js";function v(e){console.warn(`[FormRender]: ${e}`)}function j(e,n,t=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function e(n,r){r.forEach((r=>{a(r)&&(null!=u(r)&&null==n[c(r)]&&s.setIn(n,c(r),u(r)),t.forEach((t=>{r[t]&&(n[c(r)]||(n[c(r)]={}),e(n[c(r)],i(r[t])))})))}))}(e,n),e;function c(e){return e[r]}function u(e){return e[o]}}function K(t,r){let o=e(t,null);return o||(o=r(),n(t,o)),o}function E(e){return e&&p(e)?+e:e}function b(e,n,t){if(a(e)&&!m(e)){const t={};return Object.entries(e).forEach((([e,r])=>{m(r)&&(t[e]=()=>r(n))})),t}return{default:()=>m(e)?e(n):t?t(e):[e]}}function k(e,n){return t((()=>{const t={};return e.prefix&&(t.prefix=()=>r(o,null,[b(e.prefix,e,n).default()])),e.suffix&&(t.suffix=()=>r(o,null,[b(e.suffix,e,n).default()])),t}))}function O(e,n){return p(e)&&e?e.replace(/\$\{([^}]*)}/g,(function(e,t){const r=t.split("||");for(const e of r){const t=n[e.trim()];if(t)return t}return""})):""}function S(e){return e.reduce(((e,n)=>(p(n.extendKey)&&n.extendKey&&e.push(n),I(n)&&e.push(...S(n.children||[])),e)),[])}function _(e,n){const t=S(e);if(!t.length)return n;const r={},o=new Map;return Object.entries(n).forEach((([e,i])=>{const c=t.find((n=>n.val_key===e));if(!c)return r[e]=i;const{val_key:u,extendKey:s}=c,f=o.get(s)||{};o.set(s,f),f[u]=n[u]})),[...o.entries()].forEach((([e,n])=>{r[e]=JSON.stringify(n)})),r}function V(e,n){const t=S(e);if(!t.length)return n;const r=l((e=>{try{return a(n[e])?n[e]:JSON.parse(n[e])||{}}catch(e){return{}}})),o=d(n,t.map((e=>e.extendKey)));return t.forEach((({val_key:e,extendKey:n})=>{Reflect.has(o,e)||(o[e]=r(n)[e])})),o}function w(e){return e&&x.includes(e)}function I(e){return w(c(e)?e.componentType:e.html_type)}async function $({config:e,field:n,cache:t}){const r={},o=n.props.name.toString();try{g(e.dependKey||[],((e,t,o)=>{const i=n.query(e).take();if(!u(i)||o&&null==i.value)throw`缺少必须的参数=>${e}`;r[t]=i.value}))}catch(e){return Promise.reject(e)}return{...e,params:Object.assign({},e.params,r),key:o,cache:t}}function B(e,n){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[e,n.desc?r(h,null,{trigger:()=>r(y,{component:f},null),default:()=>n.desc}):null])}export{_ as combineExtendKey,k as createInputSlot,b as createSlot,$ as createUrlConfigParams,v as formRenderLog,K as injectOrProvide,I as isNestedFieldType,w as isNestedType,j as mergeDeepProperties,E as parseNumberFromMaybeString,B as renderDescOption,V as splitExtendKey,O as validateMessageParser};
1
+ import{inject as n,provide as t,computed as e,createVNode as r,Fragment as o}from"vue";import{arrayed as i}from"../../../../shared/utils/index.js";import{isGeneralField as u}from"@formily/core";import{Path as f}from"@formily/path";import{HelpCircleSharp as c}from"@vicons/ionicons5";import{isObject as s}from"@vue/shared";import{useMemoize as l}from"@vueuse/core";import{isString as a,isFunction as p,omit as m}from"lodash-es";import{NTooltip as d,NIcon as h}from"naive-ui";import{NESTED_FORM_ITEM_TYPE as x}from"../constants/index.js";import"date-fns";function y(n){console.warn(`[FormRender]: ${n}`)}function g(n,t,e=["children","properties","suffixConfig"],r="val_key",o="default_val"){return function n(t,r){r.forEach((r=>{s(r)&&(null!=c(r)&&null==t[u(r)]&&f.setIn(t,u(r),c(r)),e.forEach((e=>{r[e]&&(t[u(r)]||(t[u(r)]={}),n(t[u(r)],i(r[e])))})))}))}(n,t),n;function u(n){return n[r]}function c(n){return n[o]}}function v(e,r){let o=n(e,null);return o||(o=r(),t(e,o)),o}function E(n){return n&&a(n)?+n:n}function _(n,t,e){if(s(n)&&!p(n)){const e={};return Object.entries(n).forEach((([n,r])=>{p(r)&&(e[n]=()=>r(t))})),e}return{default:()=>p(n)?n(t):e?e(n):[n]}}function K(n,t){return e((()=>{const e={};return n.prefix&&(e.prefix=()=>r(o,null,[_(n.prefix,n,t).default()])),n.suffix&&(e.suffix=()=>r(o,null,[_(n.suffix,n,t).default()])),e}))}function j(n,t){return a(n)&&n?n.replace(/\$\{([^}]*)}/g,(function(n,e){const r=e.split("||");for(const n of r){const e=t[n.trim()];if(e)return e}return""})):""}function k(n){return n.reduce(((n,t)=>(a(t.extendKey)&&t.extendKey&&n.push(t),b(t)&&n.push(...k(t.children||[])),n)),[])}function O(n,t){const e=k(n);if(!e.length)return t;const r={},o=new Map;return Object.entries(t).forEach((([n,i])=>{const u=e.find((t=>t.val_key===n));if(!u)return r[n]=i;const{val_key:f,extendKey:c}=u,s=o.get(c)||{};o.set(c,s),s[f]=t[f]})),[...o.entries()].forEach((([n,t])=>{r[n]=JSON.stringify(t)})),r}function S(n,t){const e=k(n);if(!e.length)return t;const r=l((n=>{try{return s(t[n])?t[n]:JSON.parse(t[n])||{}}catch(n){return{}}})),o=m(t,e.map((n=>n.extendKey)));return e.forEach((({val_key:n,extendKey:t})=>{Reflect.has(o,n)||(o[n]=r(t)[n])})),o}function $(n){return n&&x.includes(n)}function b(n){return $(u(n)?n.componentType:n.html_type)}function w(n,t){return r("section",{style:{display:"flex",alignItems:"center",gap:"4px"}},[n,t.desc?r(d,null,{trigger:()=>r(h,{component:c},null),default:()=>t.desc}):null])}function I(n,t){return f.parse(n.startsWith(".")?n:`.${n}`,t).toString()}export{O as combineExtendKey,K as createInputSlot,_ as createSlot,y as formRenderLog,I as getAbsoluteKey,v as injectOrProvide,b as isNestedFieldType,$ as isNestedType,g as mergeDeepProperties,E as parseNumberFromMaybeString,w as renderDescOption,S as splitExtendKey,j as validateMessageParser};