cnhis-design-vue 3.2.7-release.1 → 3.2.7-release.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. package/README.md +87 -87
  2. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  3. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  4. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  5. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  6. package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
  7. package/es/components/classification/index.d.ts +60 -5
  8. package/es/components/classification/src/components/search-filter/index.vue.d.ts +60 -5
  9. package/es/components/classification/src/components/set-classification/index.vue.d.ts +60 -5
  10. package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
  11. package/es/components/classification/src/index.vue.d.ts +60 -5
  12. package/es/components/date-picker/index.d.ts +13 -0
  13. package/es/components/date-picker/src/DatePicker.vue.d.ts +13 -0
  14. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  15. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  16. package/es/components/field-set/src/FieldColor.vue.d.ts +26 -0
  17. package/es/components/field-set/src/components/condition.vue.d.ts +13 -0
  18. package/es/components/field-set/src/components/edit-dialog.vue.d.ts +26 -0
  19. package/es/components/field-set/src/components/edit-filter.vue.d.ts +13 -0
  20. package/es/components/form-config/src/components/FormConfigEdit.vue2.js +1 -1
  21. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  22. package/es/components/form-render/src/types/index.d.ts +1 -1
  23. package/es/components/form-render/src/utils/business.js +1 -1
  24. package/es/components/form-render/src/utils/schema.d.ts +1 -1
  25. package/es/components/form-render/src/utils/schema.js +1 -1
  26. package/es/components/iho-chat/index.d.ts +171 -85
  27. package/es/components/iho-chat/src/Index.vue.d.ts +171 -85
  28. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  29. package/es/components/iho-chat/src/components/ChatAdd.vue.d.ts +34 -13
  30. package/es/components/iho-chat/src/components/ChatAdd.vue2.js +1 -1
  31. package/es/components/iho-chat/src/components/ChatFooter.vue.d.ts +38 -13
  32. package/es/components/iho-chat/src/components/ChatFooter.vue2.js +1 -1
  33. package/es/components/iho-chat/src/components/ChatHeader.vue.d.ts +48 -14
  34. package/es/components/iho-chat/src/components/ChatHeader.vue2.js +1 -1
  35. package/es/components/iho-chat/src/components/ChatMain.vue.d.ts +9 -19
  36. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  37. package/es/components/iho-chat/src/components/ChatRecord.vue.d.ts +13 -0
  38. package/es/components/iho-chat/src/components/ChatSearch.vue.d.ts +3 -10
  39. package/es/components/iho-chat/src/components/ChatSearch.vue2.js +1 -1
  40. package/es/components/iho-chat/src/components/ContextMenu.d.ts +5 -5
  41. package/es/components/iho-chat/src/components/ContextMenu.js +1 -1
  42. package/es/components/iho-chat/src/components/MultipleVideo.vue.d.ts +47 -22
  43. package/es/components/iho-chat/src/components/MultipleVideo.vue2.js +1 -1
  44. package/es/components/iho-chat/src/hooks/useSearchUserList.d.ts +11 -0
  45. package/es/components/iho-chat/src/hooks/useSearchUserList.js +1 -0
  46. package/es/components/iho-chat/src/types/index.d.ts +0 -1
  47. package/es/components/iho-chat/style/index.css +1 -1
  48. package/es/components/iho-table/src/plugins/filterDaterangeRenderPlugin/filter.vue.d.ts +13 -0
  49. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +13 -0
  50. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +20 -2
  51. package/es/components/index.css +1 -1
  52. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  53. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  54. package/es/components/table-filter/src/components/bi-filter/ValueCfg.vue.d.ts +13 -0
  55. package/es/components/table-filter/src/components/bi-filter/components/Date.vue.d.ts +13 -0
  56. package/es/components/table-filter/src/components/bi-filter/components/index.d.ts +13 -0
  57. package/es/components/table-filter/src/components/bi-filter/index.vue.d.ts +13 -0
  58. package/es/components/table-filter/src/components/classify-filter/ValueCfg.vue.d.ts +47 -5
  59. package/es/components/table-filter/src/components/classify-filter/components/Date.vue.d.ts +13 -0
  60. package/es/components/table-filter/src/components/classify-filter/components/DateRange.vue.d.ts +13 -0
  61. package/es/components/table-filter/src/components/classify-filter/components/SelectDynamic.vue.d.ts +37 -19
  62. package/es/components/table-filter/src/components/classify-filter/components/SelectDynamic.vue2.js +1 -1
  63. package/es/components/table-filter/src/components/classify-filter/components/index.d.ts +47 -5
  64. package/es/components/table-filter/src/components/classify-filter/hooks/useFilterConditions.js +1 -1
  65. package/es/components/table-filter/src/components/classify-filter/index.vue.d.ts +47 -5
  66. package/es/components/table-filter/src/components/render-widget/components/DateInner.vue.d.ts +13 -0
  67. package/es/components/table-filter/src/components/render-widget/components/DateOut.vue.d.ts +13 -0
  68. package/es/components/table-filter/src/components/render-widget/components/DateRangeInner.vue.d.ts +13 -0
  69. package/es/components/table-filter/src/components/render-widget/components/DateRangeOut.vue.d.ts +13 -0
  70. package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue.d.ts +33 -18
  71. package/es/components/table-filter/src/components/render-widget/components/SelectDynamic.vue2.js +1 -1
  72. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue.d.ts +13 -0
  73. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue2.js +1 -1
  74. package/es/components/table-filter/src/components/render-widget/components/index.d.ts +69 -4
  75. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +69 -4
  76. package/es/components/table-filter/src/tool/transformData.js +1 -1
  77. package/es/components/table-filter/src/types/index.d.ts +1 -0
  78. package/es/components/time-picker/index.d.ts +20 -2
  79. package/es/components/time-picker/src/TimePicker.vue.d.ts +21 -2
  80. package/es/components/time-picker/src/TimePicker.vue2.js +1 -1
  81. package/es/env.d.ts +25 -25
  82. package/es/shared/assets/img/defaultCover/10review_successful.png.js +1 -1
  83. package/es/shared/assets/img/defaultCover/11review_fail.png.js +1 -1
  84. package/es/shared/assets/img/defaultCover/12no_setting.png.js +1 -1
  85. package/es/shared/assets/img/defaultCover/13no_menu_setting.png.js +1 -1
  86. package/es/shared/assets/img/defaultCover/14no_call_setting.png.js +1 -1
  87. package/es/shared/assets/img/defaultCover/15no_use_tag.png.js +1 -1
  88. package/es/shared/assets/img/defaultCover/16no_table_data.png.js +1 -1
  89. package/es/shared/assets/img/defaultCover/1location.png.js +1 -1
  90. package/es/shared/assets/img/defaultCover/2notfound.png.js +1 -1
  91. package/es/shared/assets/img/defaultCover/3loading.png.js +1 -1
  92. package/es/shared/assets/img/defaultCover/4no_permission.png.js +1 -1
  93. package/es/shared/assets/img/defaultCover/5no_data.png.js +1 -1
  94. package/es/shared/assets/img/defaultCover/6no_network.png.js +1 -1
  95. package/es/shared/assets/img/defaultCover/7no_doctor.png.js +1 -1
  96. package/es/shared/assets/img/defaultCover/8system_error.png.js +1 -1
  97. package/es/shared/assets/img/defaultCover/9system_upgrade.png.js +1 -1
  98. package/es/shared/assets/img/failure.png.js +1 -1
  99. package/es/shared/assets/img/no-permission.png.js +1 -1
  100. package/es/shared/assets/img/nodata.png.js +1 -1
  101. package/es/shared/assets/img/notfound.png.js +1 -1
  102. package/es/shared/assets/img/qr.png.js +1 -1
  103. package/es/shared/assets/img/success.png.js +1 -1
  104. package/es/shared/assets/img/table_style_2.png.js +1 -1
  105. package/es/shared/assets/img/video.png.js +1 -1
  106. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  107. package/es/shared/assets/img/xb_big.png.js +1 -1
  108. package/es/shared/assets/img/xb_small.png.js +1 -1
  109. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  110. package/es/shared/package.json.js +1 -1
  111. package/es/shared/utils/business.js +1 -1
  112. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  113. package/es/shared/utils/tapable/index.d.ts +139 -0
  114. package/package.json +2 -2
@@ -15,6 +15,10 @@ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{
15
15
  allowedInvalidValue: {
16
16
  type: StringConstructor;
17
17
  };
18
+ to: {
19
+ type: import("vue").PropType<string | false | HTMLElement>;
20
+ default: string;
21
+ };
18
22
  }, {
19
23
  attrs: {
20
24
  [x: string]: unknown;
@@ -35,6 +39,10 @@ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{
35
39
  allowedInvalidValue: {
36
40
  type: StringConstructor;
37
41
  };
42
+ to: {
43
+ type: import("vue").PropType<string | false | HTMLElement>;
44
+ default: string;
45
+ };
38
46
  }>> & {
39
47
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
40
48
  }>>;
@@ -71,9 +79,14 @@ declare const DatePicker: SFCWithInstall<import("vue").DefineComponent<{
71
79
  allowedInvalidValue: {
72
80
  type: StringConstructor;
73
81
  };
82
+ to: {
83
+ type: import("vue").PropType<string | false | HTMLElement>;
84
+ default: string;
85
+ };
74
86
  }>> & {
75
87
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
76
88
  }, {
77
89
  updateUnchangedValue: boolean;
90
+ to: string | false | HTMLElement;
78
91
  }>>;
79
92
  export default DatePicker;
@@ -17,6 +17,10 @@ declare const _default: import("vue").DefineComponent<{
17
17
  allowedInvalidValue: {
18
18
  type: StringConstructor;
19
19
  };
20
+ to: {
21
+ type: PropType<string | false | HTMLElement>;
22
+ default: string;
23
+ };
20
24
  }, {
21
25
  attrs: {
22
26
  [x: string]: unknown;
@@ -37,6 +41,10 @@ declare const _default: import("vue").DefineComponent<{
37
41
  allowedInvalidValue: {
38
42
  type: StringConstructor;
39
43
  };
44
+ to: {
45
+ type: PropType<string | false | HTMLElement>;
46
+ default: string;
47
+ };
40
48
  }>> & {
41
49
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
42
50
  }>>;
@@ -73,9 +81,14 @@ declare const _default: import("vue").DefineComponent<{
73
81
  allowedInvalidValue: {
74
82
  type: StringConstructor;
75
83
  };
84
+ to: {
85
+ type: PropType<string | false | HTMLElement>;
86
+ default: string;
87
+ };
76
88
  }>> & {
77
89
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
78
90
  }, {
79
91
  updateUnchangedValue: boolean;
92
+ to: string | false | HTMLElement;
80
93
  }>;
81
94
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as t,ref as a,computed as l,watch as n,openBlock as o,createBlock as u,unref as r,isRef as i,createSlots as s,renderList as d,withCtx as c,renderSlot as f,nextTick as m}from"vue";import{NDatePicker as p}from"naive-ui";import"../../../shared/utils/index.js";import{useDateTime as v,handleInputEvent as y}from"../../../shared/hooks/useDateTime.js";import{isArray as h,isEqual as g,isString as w}from"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{format as V,sub as k,startOfDay as R,endOfDay as D}from"date-fns";var I=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function},formattedValue:{type:[String,Array]},placeholder:{type:String},allowedInvalidValue:{type:String}},emits:["update:formatted-value"],setup(e,{expose:I,emit:S}){const C=e,M=t(),_=a(null),$=a(null),P=a();let U="";const b=l({get:()=>z(C.formattedValue)?null:C.formattedValue,set(e){h(e)&&h(U)&&g(U,e)||U===e||(S("update:formatted-value",e,w(e)?Date.parse(e):h(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),U=e)}}),j=l((()=>{const e=Reflect.get(M,"type")||"";return["datetime","datetimerange"].includes(e)})),x=l((()=>{if(Reflect.get(M,"format"))return M.format;const e=M.type||"";return j.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),H=l((()=>j.value?x.value.split(" "):"")),{focus:q,blur:A,handleConfirm:B}=v(_,{formatRef:x,attrs:M,emit:S,allowedInvalidValue:C.allowedInvalidValue});async function F(e){e&&j.value&&(await m(),async function e(t=0){var a;t>2||($.value=null==(a=_.value)?void 0:a.panelInstRef,$.value?v($,{formatRef:H,attrs:M,isPanel:!0}):(await m(),e(++t)))}())}async function T(...e){var t,a,l,n,o,u;const r=Reflect.get(M,"type")||"",i=null==(n=null==(l=null==(a=null==(t=_.value)?void 0:t.inputInstRef)?void 0:a.$el)?void 0:l.querySelector)?void 0:n.call(l,"input");if(r.includes("range")?null==(o=C.onConfirm)||o.call(C,...e):(await m(),i.focus(),B(i),i.blur(),null==(u=C.onConfirm)||u.call(C,Date.parse(i.value),i.value)),!(null==i?void 0:i.value)||!C.updateUnchangedValue||r.includes("range"))return;const s=i.value;y(i,V(new Date,x.value)),y(i,s)}function z(e){return C.allowedInvalidValue&&C.allowedInvalidValue===e}return n((()=>C.formattedValue),(e=>{P.value=z(e)?e:C.placeholder?C.placeholder:"选择日期时间",z(e)||(U=e)}),{immediate:!0}),I({$datePicker:_,focus:q,blur:A,setShortcutValue:async function(e){const t=Reflect.get(M,"type")||"";if(!t||!t.includes("range")||!_.value)return;const a=_.value.$el.querySelectorAll(".n-input__input-el");let l,n;const o=new Date;if("week"===e){const e=k(o,{weeks:1});l=V(R(e),x.value)}else{const e=k(o,{months:1});l=V(R(e),x.value)}n=V(D(o),x.value),y(a[0],l),await m(),y(a[1],n)}}),(e,t)=>(o(),u(r(p),{ref_key:"datePickerRef",ref:_,"onUpdate:show":F,onConfirm:T,placeholder:P.value,"formatted-value":r(b),"onUpdate:formatted-value":t[0]||(t[0]=e=>i(b)?b.value=e:null)},s({_:2},[d(e.$slots,((t,a)=>({name:a,fn:c((()=>[f(e.$slots,a)]))})))]),1032,["placeholder","formatted-value"]))}});export{I as default};
1
+ import{defineComponent as e,useAttrs as t,ref as a,computed as l,watch as n,openBlock as o,createBlock as u,unref as r,isRef as i,createSlots as s,renderList as d,withCtx as c,renderSlot as f,nextTick as m}from"vue";import{NDatePicker as p}from"naive-ui";import"../../../shared/utils/index.js";import{useDateTime as v,handleInputEvent as y}from"../../../shared/hooks/useDateTime.js";import{isArray as h,isEqual as g,isString as w}from"lodash-es";import"@vue/shared";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{format as V,sub as k,startOfDay as R,endOfDay as D}from"date-fns";var S=e({__name:"DatePicker",props:{updateUnchangedValue:{type:Boolean},onConfirm:{type:Function},formattedValue:{type:[String,Array]},placeholder:{type:String},allowedInvalidValue:{type:String},to:{type:[Object,String,Boolean],default:"body"}},emits:["update:formatted-value"],setup(e,{expose:S,emit:I}){const C=e,M=t(),_=a(null),b=a(null),$=a();let j="";const P=l({get:()=>T(C.formattedValue)?null:C.formattedValue,set(e){h(e)&&h(j)&&g(j,e)||j===e||(I("update:formatted-value",e,w(e)?Date.parse(e):h(e)?[Date.parse(e[0]),Date.parse(e[1])]:null),j=e)}}),U=l((()=>{const e=Reflect.get(M,"type")||"";return["datetime","datetimerange"].includes(e)})),x=l((()=>{if(Reflect.get(M,"format"))return M.format;const e=M.type||"";return U.value?"yyyy-MM-dd HH:mm:ss":"month"===e?"yyyy-MM":"year"===e?"yyyy":"yyyy-MM-dd"})),H=l((()=>U.value?x.value.split(" "):"")),{focus:q,blur:A,handleConfirm:B}=v(_,{formatRef:x,attrs:M,emit:I,allowedInvalidValue:C.allowedInvalidValue});async function F(e){e&&U.value&&(await m(),async function e(t=0){var a;t>2||(b.value=null==(a=_.value)?void 0:a.panelInstRef,b.value?v(b,{formatRef:H,attrs:M,isPanel:!0}):(await m(),e(++t)))}())}async function O(...e){var t,a,l,n,o,u;const r=Reflect.get(M,"type")||"",i=null==(n=null==(l=null==(a=null==(t=_.value)?void 0:t.inputInstRef)?void 0:a.$el)?void 0:l.querySelector)?void 0:n.call(l,"input");if(r.includes("range")?null==(o=C.onConfirm)||o.call(C,...e):(await m(),i.focus(),B(i),i.blur(),null==(u=C.onConfirm)||u.call(C,Date.parse(i.value),i.value)),!(null==i?void 0:i.value)||!C.updateUnchangedValue||r.includes("range"))return;const s=i.value;y(i,V(new Date,x.value)),y(i,s)}function T(e){return C.allowedInvalidValue&&C.allowedInvalidValue===e}return n((()=>C.formattedValue),(e=>{$.value=T(e)?e:C.placeholder?C.placeholder:"选择日期时间",T(e)||(j=e)}),{immediate:!0}),S({$datePicker:_,focus:q,blur:A,setShortcutValue:async function(e){const t=Reflect.get(M,"type")||"";if(!t||!t.includes("range")||!_.value)return;const a=_.value.$el.querySelectorAll(".n-input__input-el");let l,n;const o=new Date;if("week"===e){const e=k(o,{weeks:1});l=V(R(e),x.value)}else{const e=k(o,{months:1});l=V(R(e),x.value)}n=V(D(o),x.value),y(a[0],l),await m(),y(a[1],n)}}),(t,a)=>(o(),u(r(p),{ref_key:"datePickerRef",ref:_,"onUpdate:show":F,onConfirm:O,placeholder:$.value,to:e.to,"formatted-value":r(P),"onUpdate:formatted-value":a[0]||(a[0]=e=>i(P)?P.value=e:null)},s({_:2},[d(t.$slots,((e,a)=>({name:a,fn:c((()=>[f(t.$slots,a)]))})))]),1032,["placeholder","to","formatted-value"]))}});export{S as default};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,P,C,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie}=$,ne=new Set,oe=["xinmai","mai"],le=new Map,se=new Set,re=new Set,ue=new Set,ae=x(F.yScaleValue),ce=new Set;function de(t){var o;const l=ae.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(ne.size&&E.value.remove(...ne),ne.clear(),le.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=le.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of le)t.push(e[1]),e[0]===oe[0]&&e[1].forEach((e=>{(le.get(oe[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ue).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===oe[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),ne.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),ne.add(n)}))}E.value.add(...e)}ne.add(l),E.value.add(l)}))}}function pe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:P=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ve(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ge(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ge(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ve(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?V(a,S,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||ue.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&ce.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=fe(a,e.list[u].value),L=l&&fe(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||P)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:z(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w?n[1]-5:n[1],...V}));I.push(f),p&&(x===oe[1]?se.add(p):z(s)||re.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{he(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),de(e)}(e),Q.hovered&&he(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=C(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),me(n,"change")}}))}(p),A.push(p),ue.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;le.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function fe(e,t){return"pain"===e&&0==t}function he(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||P(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:C(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ve(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ge(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ve(e.time))return;const n=T(e.time),o=V(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function ye(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${P(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function me(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ae.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;xe()}function xe(){var e;ue.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ue]))),ue.clear(),be()}function be(e){le.clear(),ue.clear(),se.clear(),ce.clear(),re.clear(),ae.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||pe(e,i,t)}))})),de(),[...ue].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ae.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];se.size&&[...se].forEach((e=>{[...re].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ue.add(e)}))}))}()}return be((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.list,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...ue],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=ye(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:P(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),me(r,"change")}else{const t={data:{time:P(e.pointer.x),value:C(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),me(t)}},setPopup:he,isAddPoint:ye,updateData:me,redrawPoints:xe,gridPoints:ue,fixedNoRisePoints:ce}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
1
+ import{fabric as e}from"../../../../../shared/utils/fabricjs/index.js";import{useShadow as t}from"./useShadow.js";import{drawLine as i,defaultStyle as n,drawPoint as o,drawText as l,drawArrow as s}from"../useDraw.js";import{useGrid as r}from"../useGrid.js";import{format as u}from"date-fns";import{getType as a,getTime as c,isOneLine as d,isOverlapPoint as p,getFloorNumber as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,deleteProperty as y,getIndex as m}from"../../utils/index.js";import{cloneDeep as x,flatten as b,last as j}from"lodash-es";import"../useEvent.js";import{useCommon as w}from"../useCommon.js";import"vue";import"naive-ui";import"@vueuse/core";import{TEMPERATURE_MENU as k,PAIN_MENU as L,OVERLAP as S}from"../../constants/index.js";import{promiseTimeout as Y}from"@vueuse/shared";function E(E,$,O,T,V,C,P,A,R,I){r(E,$);const{getEqualXTypes:X,handleAddPrevent:D,getPointEventProps:H}=w(E,O,$),{createShadowLines:z}=t(),{left:F,xScaleList:_,xCellWidth:W,yCellHeight:q,originX:G,endX:N,originY:B,endY:J,itemList:K,event:Q,vitalSignsOriginY:U,painOriginY:Z,hospitalizationDate:ee,config:te,canvasHeight:ie,painSurplusCell:ne}=$,oe=new Set,le=["xinmai","mai"],se=new Map,re=new Set,ue=new Set,ae=new Set,ce=x(F.yScaleValue),de=new Set;function pe(t){var o;const l=ce.find((e=>"pulse"===e.type));if(l&&(null==(o=l.dataList)?void 0:o.length)&&(oe.size&&E.value.remove(...oe),oe.clear(),se.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=se.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}const o=function(){const e=[],t=[],i=[];for(const e of se)t.push(e[1]),e[0]===le[0]&&e[1].forEach((e=>{(se.get(le[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),u=n[i],a=o[r],c=n[i-1],d=n[i+1],p=o[r-1],f=o[r+1];if(c&&p){if(c[0]!==p[0]){const e=Math.max(c[0],p[0]);l.push([c,p].find((t=>t[0]===e)))}}else c?l.push(c):p&&s.push(p);const h=Math.min(u[1],a[1]);l.push([u,a].find((e=>e[1]===h)));const v=Math.max(u[1],a[1]);s.push([u,a].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=j(t);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(d&&f){if(d[0]!==f[0]){const e=Math.min(d[0],f[0]);l.push([d,f].find((t=>t[0]===e))),g()}}else d?(l.push(d),g()):f?(s.push(f),g()):g()})),e}();o.length>0&&function(e){Y(0).then((()=>{e.forEach((e=>{const t=[],i=[];Array.from(ae).forEach((n=>{var o,l;"pulse"===(null==(o=null==n?void 0:n.origin)?void 0:o.type)&&e.find((e=>Math.abs(n.left-e[0])<=1&&Math.abs(n.top-e[1])<=1))&&((null==(l=null==n?void 0:n.origin)?void 0:l.key)===le[0]?t.push(n):i.push(n))})),[t,i].forEach((e=>{1!==(null==e?void 0:e.length)&&e.sort(((e,t)=>e.left-t.left)).forEach(((e,t)=>{t>0&&e.leftLine&&E.value.remove(e.leftLine)}))}))}))}))}(o);const{mode:s,style:r={}}=l.shadow||{};o.forEach((t=>{const o=t.map((e=>({x:e[0],y:e[1]}))),l=new e.Polygon(o,{...n,...r,strokeWidth:1});if(["slash","line"].includes(s)){l.set({fill:"transparent",stroke:r.stroke||"#f00"});const e=[];if(["slash"].includes(s))e.push(...z(t,r._angle,r.space)),e.forEach((e=>{Object.assign(e,{...n,...r}),oe.add(e)}));else{const n=function(e){const t=e.reduce(((e,t)=>{const i=Math.trunc(t[0]);return e[i]=e[i]?e[i].concat([t]):[t],e}),{}),i=Object.values(t).filter((e=>2===e.length&&Math.trunc(e[0][1])!==Math.trunc(e[1][1])));return i}(t);n.forEach((t=>{const n=i([...b(t)],{...r,originX:"center"});e.push(n),oe.add(n)}))}E.value.add(...e)}oe.add(l),E.value.add(l)}))}}function fe(e,t,r){var u;const{type:a,riseStyle:c={},noRiseStyle:p={},verifiedStyle:g={},reduceStyle:y={},pacemaker:m={},upArrowStyle:x={},limitValueStyle:b={},nonePainPointStyle:j={},belowMinValueStyle:w={},respiratorStyle:k={},dataList:L=[],list:S=[]}=r,{type:Y,textStyle:$,showConnectLine:C=!1}=j,A=[],I=[],X=[];let D=null;const z=e=>"breathe"==a&&e.respirator&&k.type&&k.fixedValue&&!e.value&&ge(e.time);if(null==(u=e.list)||u.forEach(((u,j)=>{const F=d(a)?L.find((e=>e.key===u.key)):e,_=ye(z(u)?{...u,value:k.fixedValue}:u,r),G=e.list[j+1],N=G?ye(z(G)?{...G,value:k.fixedValue}:G,r):void 0,B=G?d(a)?L.find((e=>e.key===G.key)):e:{},{title:J=""}=F;if("脉搏"===J&&"脉搏"!==B.title||"脉搏"!==J&&"脉搏"===B.title||!_||!N||f(_[0],1)!==f(N[0],1))_&&D&&(_[0]=D),D=null;else{const e=_[0]-W/2;_[0]=e+W/4,N[0]=D=_[0]+W/2}const K={};K.value=function(e,t,i){if(!(null==e?void 0:e.length)||!te.showValue)return;const{lineAttr:n={}}=i,o=e[1]<=U.originY+q?e[1]+q:e[1]-q,s=l([e[0],o],{value:z(t)?k.fixedValue:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return X.push(s),{obj:s,top:-q}}(_,u,F),function(e,t,r,u){var d,f;if(!["temperature","pain","breathe"].includes(a))return;if(!(null==e?void 0:e.length)&&"temperature"===a&&!ge(t.time))return;if(!(null==e?void 0:e.length)&&"pain"===a)return;if(!t.value&&"breathe"===a)return;const{lineAttr:v={}}=r,{value:m}=u,x=T(t.time);let b,j,w,L,Y,E;if(t.noRise&&p.show){const i=M(p,t)?V(a,S,35):(null==e?void 0:e[1])||0;if(p.text)w=l([x,M(p,t)?i:i+5],{value:p.text.split("").join("\n"),originY:"top",...p.style}),t.value||ae.add(w);else if(t.value){w=s([x,i,i+2*q],{...p.style})}w&&X.push(w),w&&M(p,t)&&de.add(w)}if(null==e?void 0:e[1]){if(t.rise&&c.show&&c.text&&(L=l([x,e[1]-(m?q:0)-5],{value:c.text.split("").join("\n"),originY:"bottom",...c.style}),X.push(L)),t.verified&&(Y=l([x,e[1]-(m?q:0)-5],{value:"v",originX:"center",originY:"bottom",...g}),X.push(Y)),h(t.physicsReduce)||h(t.drugReduce)){const l=V(a,S,null!=(d=t.physicsReduce)?d:t.drugReduce),s=l<e[1]&&(null==te?void 0:te.hypothermyViewCustom)?x+W/2:x;b=i([...e,s,l],{...v,...y.line,...n}),j=o((null==(f=null==y?void 0:y.point)?void 0:f.type)||"circle",{left:s,top:l,...y.point,...n,originY:l===ie?"bottom":"center"}),b&&X.push(b),j&&X.push(j)}t.respirator&&(E=o(k.type,{left:x,top:e[1]-(m?q:0)-5,originX:"center",originY:"bottom",...k.style}),X.push(E))}Object.assign(u,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:w,top:p.text?5:2*q,isFixed:M(p,t)},riseText:{obj:L,top:(m?-q:0)-5},verifiedText:{obj:Y,top:(m?-q:0)-5},reducePoint:{obj:j,type:"reduce"},respirator:{obj:E,top:(m?-q:0)-5}})}(_,u,F,K),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(a))return;const o=Math.max(...S),r=Math.min(...S);let u,c,d;const{upArrowShow:p=!1,limitValueShow:f=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*q,i=[e[1]-q/2,t];t<U.originY&&(t=e[1]+2.5*q,i=[t,e[1]+q/2]),u=s([e[0],i[0],i[1]],x,"up"),X.push(u)}if(f){const i={value:t.value,originX:"center",originY:"center",...b};if(+t.value>o){const t=u?e[1]+q/2+u.height:e[1]+q;c=l([e[0],t],i),X.push(c)}+t.value<r&&(c=l([e[0],e[1]-q],i),X.push(c))}if(w.show&&+t.value<r){const t=e[1];if(w.text)d=l([e[0],e[1]+5],{value:w.text.split("").join("\n"),originY:"top",...w.style});else{const i=t+2*q;d=s([e[0],t,i],{...w.style})}X.push(d)}Object.assign(n,{upArrow:{obj:u},limitValue:{obj:c,top:-q},belowMinValue:{obj:d,top:w.text?5:2*q,moveHide:!0}})}(_,u,F,K),function(n,l,s,u,c,d){let p,f;const{pointAttr:h={},lineAttr:g={},title:y="",key:x,type:b="circle"}=c,j=e.list[u+1],w=he(a,e.list[u].value),L=l&&he(a,j.value),S=()=>"pulse"==a&&s.pacemakerShow?m.value:z(s)?k.type:w&&"number"===Y?0:b;if(n&&l&&!s.breakpoint&&(!w&&!L||C)){f=i([...n,...l],{...g});const{obj:e}=(null==d?void 0:d.reducePoint)||{};if((null==e?void 0:e.top)<n[1]&&(null==te?void 0:te.hypothermyViewCustom)){const t=i([e.left,e.top,...l],{...g});X.unshift(t),Object.assign(d,{reduceRightLine:{obj:t,type:"reduce"}}),f.set("stroke","transparent")}}const M=S(),T=I[u-1],V={origin:{data:z(s)?{...s,value:k.fixedValue}:s,title:y,key:x||"",unit:r.unit,type:a,_type:v(y,a),dataIndex:t,index:u},leftLine:T,rightLine:f,otherObj:d,...s.pacemakerShow&&"pulse"==a?m.style:z(s)?k.style:h,lockMovementX:!0,...H(),...w?{selectable:!1,evented:!1,..."number"===Y?$:{}}:{}};n&&(T?V.leftLine.set("x2",n[0]):V.leftLine=null,p=o(M,{left:n[0],top:w&&!ne[1]?n[1]-5:n[1],...V}));I.push(f),p&&(x===le[1]?re.add(p):z(s)||ue.add(p),function(e){Q.hovered&&(e.on("mouseover",(()=>{ve(e,"hover")})),e.on("mouseout",(()=>{R.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?Z:U;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0,isFixed:l,moveHide:s=!1}=t||{};"reduce"!==n&&i&&("line"===n?i.setCoords().set({x1:e.left,y1:e.top}):(l||i.setCoords().set({left:e.left,top:e.top+o}),s&&(E.value.remove(i),delete e.otherObj.obj)))})),pe(e)}(e),Q.hovered&&ve(e)})),e.on("mouseup",(t=>{if(R.show=!1,1===t.button){const{type:t}=e.origin,i=P(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};E.value.discardActiveObject(),O("change",n),xe(n,"change")}}))}(p),A.push(p),ae.add(p))}(_,N,u,j,F,K)})),"pulse"===a){const{key:t}=e;let i=null;se.set(t,A.map(((e,t,n)=>{var o,l;const s=n[t+1];if(s&&f(e.left,1)===f(s.left,1)){const t=e.left-W/2;e.set("left",t+W/4),null==(o=e.rightLine)||o.set("x1",e.left),i=e.left+W/2,s.set("left",i)}else i&&(null==(l=e.leftLine)||l.set("x2",i),e.set("left",i)),i=null;return[e.left,e.top]})))}const F=I.filter((e=>e));E.value.add(...F,...A,...X)}function he(e,t){return"pain"===e&&0==t}function ve(e,t="moving"){const{title:i,unit:n,type:o,data:l}=e.origin;R.point={x:e.left,y:e.top};let s=`时间 ${((null==l?void 0:l.time)||C(e.left)).slice(-5)}`;R.list=[function(){const{drugReduce:r,physicsReduce:u}=l||{},a="hover"===t?l.value:P(o,e.top);if(h(r))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`药物降${"pain"==o?"痛":"温"} ${a}—>${r}${n||""}`;if(h(u))return s+=(null==l?void 0:l.changeTime)?"—>"+(null==l?void 0:l.changeTime.slice(-5)):"",`物理降${"pain"==o?"痛":"温"} ${a}—>${u}${n||""}`;return`${i} ${a}${n||""}`}(),s],R.show=!0}function ge(e){const[t]=_,i=j(_),n=t.start,o=i.end,l=c(e);return l>=n&&l<=o}function ye(e,t){const i="pain"===t.type?Z:U;if(!g(e)||!ge(e.time))return;const n=T(e.time),o=V(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}function me(e){const t=new Date,i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),o=c(`${t.getFullYear()}-${i}-${n} 23:59:59`),l=c(`${C(e)}:00`);return ee&&l<c(ee)?(D("exceedMin"),!1):!(l>o)||(D("exceedMax"),!1)}function xe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ce.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=m(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;be()}function be(){var e;ae.size&&(null==(e=E.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...ae]))),ae.clear(),je()}function je(e){se.clear(),ae.clear(),re.clear(),de.clear(),ue.clear(),ce.forEach((t=>{null==e||e(t),t.dataList.forEach(((e,i)=>{!e.show||d(t.type)&&!e.enable||fe(e,i,t)}))})),pe(),[...ae].forEach((e=>{null==e||e.bringToFront()})),function(){var e;const t=ce.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const i=Object.assign({},S,F.overlap||{}),l=[];re.size&&[...re].forEach((e=>{[...ue].forEach((t=>{if(t.origin&&p(e,t)){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...n,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),l.push(o(r,{...i[e],...s}))}}}))})),setTimeout((()=>{E.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),ae.add(e)}))}))}()}return je((e=>function(e){if("temperature"!==e.type||!e.positionLine)return;const t=V(e.type,e.list,e.positionLine.value),n=i([G,t,N,t],e.positionLine);E.value.add(n)}(e))),E.value.on("mouse:up",(e=>{const{button:t,target:i,pointer:n={}}=e;if(3===t){if(!$.event.evented)return;const{x:e=0,y:t=0}=n;if(e>=G&&e<=N&&t>=B&&t<=J){I.point={x:e,y:t},I.show=!0;const{type:o}=(null==i?void 0:i.origin)||{};if(i&&["temperature","pain"].includes(o))"temperature"===o&&(I.list=[...k]),"pain"===o&&(I.list=[...L]),I.target=i;else{I.target=null,I.list=["新增节点"],K.forEach((i=>{if(!X([...ae],e,"_type").includes(i.bigType)){const e=["pain"].includes(i.bigType)?Z:U;t>=e.originY&&t<=e.endY&&I.list.push({renderItem:A?A(i):()=>i.title,origin:{title:i.title,unit:i.unit,type:a(i.bigType),dataIndex:i.dataIndex,key:i.key},pointer:n})}}));const i=me(e);i&&1!==I.list.length||(I.show=!1,1===I.list.length&&i&&D("repeat"))}}}if(1===t){if(i)return;const{x:e=0,y:t=0}=n;e>=G&&e<=N&&t>0&&t<ie&&O("click:grid",{x:e,y:t,time:C(e)})}})),{clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=y(i,[...k,...L]);s[`${e.type}`]=e.value,s.changeTime=u(new Date,"yyyy-MM-dd HH:mm"),d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};O("change",r),xe(r,"change")}else{const t={data:{time:C(e.pointer.x),value:P(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};O("add",t),xe(t)}},setPopup:ve,isAddPoint:me,updateData:xe,redrawPoints:be,gridPoints:ae,fixedNoRisePoints:de}}function M(e,t){return e.fixed||!t.value&&0!==t.value}export{E as useCenter};
@@ -713,6 +713,10 @@ declare const _default: import("vue").DefineComponent<{
713
713
  allowedInvalidValue: {
714
714
  type: StringConstructor;
715
715
  };
716
+ to: {
717
+ type: PropType<string | false | HTMLElement>;
718
+ default: string;
719
+ };
716
720
  }, {
717
721
  attrs: {
718
722
  [x: string]: unknown;
@@ -733,6 +737,10 @@ declare const _default: import("vue").DefineComponent<{
733
737
  allowedInvalidValue: {
734
738
  type: StringConstructor;
735
739
  };
740
+ to: {
741
+ type: PropType<string | false | HTMLElement>;
742
+ default: string;
743
+ };
736
744
  }>> & {
737
745
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
738
746
  }>>;
@@ -769,10 +777,15 @@ declare const _default: import("vue").DefineComponent<{
769
777
  allowedInvalidValue: {
770
778
  type: StringConstructor;
771
779
  };
780
+ to: {
781
+ type: PropType<string | false | HTMLElement>;
782
+ default: string;
783
+ };
772
784
  }>> & {
773
785
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
774
786
  }, {
775
787
  updateUnchangedValue: boolean;
788
+ to: string | false | HTMLElement;
776
789
  }>>;
777
790
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
778
791
  data: {
@@ -982,6 +995,10 @@ declare const _default: import("vue").DefineComponent<{
982
995
  allowedInvalidValue: {
983
996
  type: StringConstructor;
984
997
  };
998
+ to: {
999
+ type: PropType<string | false | HTMLElement>;
1000
+ default: string;
1001
+ };
985
1002
  }, {
986
1003
  attrs: {
987
1004
  [x: string]: unknown;
@@ -1002,6 +1019,10 @@ declare const _default: import("vue").DefineComponent<{
1002
1019
  allowedInvalidValue: {
1003
1020
  type: StringConstructor;
1004
1021
  };
1022
+ to: {
1023
+ type: PropType<string | false | HTMLElement>;
1024
+ default: string;
1025
+ };
1005
1026
  }>> & {
1006
1027
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
1007
1028
  }>>;
@@ -1038,10 +1059,15 @@ declare const _default: import("vue").DefineComponent<{
1038
1059
  allowedInvalidValue: {
1039
1060
  type: StringConstructor;
1040
1061
  };
1062
+ to: {
1063
+ type: PropType<string | false | HTMLElement>;
1064
+ default: string;
1065
+ };
1041
1066
  }>> & {
1042
1067
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
1043
1068
  }, {
1044
1069
  updateUnchangedValue: boolean;
1070
+ to: string | false | HTMLElement;
1045
1071
  }>>;
1046
1072
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1047
1073
  data: {
@@ -102,6 +102,10 @@ declare const _default: import("vue").DefineComponent<{
102
102
  allowedInvalidValue: {
103
103
  type: StringConstructor;
104
104
  };
105
+ to: {
106
+ type: PropType<string | false | HTMLElement>;
107
+ default: string;
108
+ };
105
109
  }, {
106
110
  attrs: {
107
111
  [x: string]: unknown;
@@ -122,6 +126,10 @@ declare const _default: import("vue").DefineComponent<{
122
126
  allowedInvalidValue: {
123
127
  type: StringConstructor;
124
128
  };
129
+ to: {
130
+ type: PropType<string | false | HTMLElement>;
131
+ default: string;
132
+ };
125
133
  }>> & {
126
134
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
127
135
  }>>;
@@ -158,10 +166,15 @@ declare const _default: import("vue").DefineComponent<{
158
166
  allowedInvalidValue: {
159
167
  type: StringConstructor;
160
168
  };
169
+ to: {
170
+ type: PropType<string | false | HTMLElement>;
171
+ default: string;
172
+ };
161
173
  }>> & {
162
174
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
163
175
  }, {
164
176
  updateUnchangedValue: boolean;
177
+ to: string | false | HTMLElement;
165
178
  }>>;
166
179
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
167
180
  data: {
@@ -242,6 +242,10 @@ declare const _default: import("vue").DefineComponent<{
242
242
  allowedInvalidValue: {
243
243
  type: StringConstructor;
244
244
  };
245
+ to: {
246
+ type: PropType<string | false | HTMLElement>;
247
+ default: string;
248
+ };
245
249
  }, {
246
250
  attrs: {
247
251
  [x: string]: unknown;
@@ -262,6 +266,10 @@ declare const _default: import("vue").DefineComponent<{
262
266
  allowedInvalidValue: {
263
267
  type: StringConstructor;
264
268
  };
269
+ to: {
270
+ type: PropType<string | false | HTMLElement>;
271
+ default: string;
272
+ };
265
273
  }>> & {
266
274
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
267
275
  }>>;
@@ -298,10 +306,15 @@ declare const _default: import("vue").DefineComponent<{
298
306
  allowedInvalidValue: {
299
307
  type: StringConstructor;
300
308
  };
309
+ to: {
310
+ type: PropType<string | false | HTMLElement>;
311
+ default: string;
312
+ };
301
313
  }>> & {
302
314
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
303
315
  }, {
304
316
  updateUnchangedValue: boolean;
317
+ to: string | false | HTMLElement;
305
318
  }>>;
306
319
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
307
320
  data: {
@@ -511,6 +524,10 @@ declare const _default: import("vue").DefineComponent<{
511
524
  allowedInvalidValue: {
512
525
  type: StringConstructor;
513
526
  };
527
+ to: {
528
+ type: PropType<string | false | HTMLElement>;
529
+ default: string;
530
+ };
514
531
  }, {
515
532
  attrs: {
516
533
  [x: string]: unknown;
@@ -531,6 +548,10 @@ declare const _default: import("vue").DefineComponent<{
531
548
  allowedInvalidValue: {
532
549
  type: StringConstructor;
533
550
  };
551
+ to: {
552
+ type: PropType<string | false | HTMLElement>;
553
+ default: string;
554
+ };
534
555
  }>> & {
535
556
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
536
557
  }>>;
@@ -567,10 +588,15 @@ declare const _default: import("vue").DefineComponent<{
567
588
  allowedInvalidValue: {
568
589
  type: StringConstructor;
569
590
  };
591
+ to: {
592
+ type: PropType<string | false | HTMLElement>;
593
+ default: string;
594
+ };
570
595
  }>> & {
571
596
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
572
597
  }, {
573
598
  updateUnchangedValue: boolean;
599
+ to: string | false | HTMLElement;
574
600
  }>>;
575
601
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
576
602
  data: {
@@ -200,6 +200,10 @@ declare const _default: import("vue").DefineComponent<{
200
200
  allowedInvalidValue: {
201
201
  type: StringConstructor;
202
202
  };
203
+ to: {
204
+ type: PropType<string | false | HTMLElement>;
205
+ default: string;
206
+ };
203
207
  }, {
204
208
  attrs: {
205
209
  [x: string]: unknown;
@@ -220,6 +224,10 @@ declare const _default: import("vue").DefineComponent<{
220
224
  allowedInvalidValue: {
221
225
  type: StringConstructor;
222
226
  };
227
+ to: {
228
+ type: PropType<string | false | HTMLElement>;
229
+ default: string;
230
+ };
223
231
  }>> & {
224
232
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
225
233
  }>>;
@@ -256,10 +264,15 @@ declare const _default: import("vue").DefineComponent<{
256
264
  allowedInvalidValue: {
257
265
  type: StringConstructor;
258
266
  };
267
+ to: {
268
+ type: PropType<string | false | HTMLElement>;
269
+ default: string;
270
+ };
259
271
  }>> & {
260
272
  "onUpdate:formatted-value"?: ((...args: any[]) => any) | undefined;
261
273
  }, {
262
274
  updateUnchangedValue: boolean;
275
+ to: string | false | HTMLElement;
263
276
  }>>;
264
277
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
265
278
  data: {
@@ -1 +1 @@
1
- import{defineComponent as e,computed as o,ref as i,inject as t,watch as l,toRaw as a,openBlock as r,createElementBlock as n,Fragment as s,createVNode as u,unref as d,mergeProps as m,nextTick as v}from"vue";import{cloneDeep as f}from"lodash-es";import{InjectionActiveFieldItem as p}from"../constants/index.js";import"../../../../shared/components/VueDraggable/src/vuedraggable.js";import{findFieldItemByKey as c}from"../utils/index.js";import"@vicons/ionicons5";import{NModal as g}from"naive-ui";import"../../../../shared/utils/index.js";import{useConfigurationField as h}from"../hooks/useConfigurationField.js";import"../../../index.js";import y from"../../../form-render/index.js";var b=e({__name:"FormConfigEdit",props:{uuid:{type:String,required:!0},bindFormRenderRef:{type:Object},formProps:{type:Object}},setup(e,{expose:b}){const j=e,x=o((()=>`#${j.uuid} .form-config__config`)),F=i(),w=t(p),R=i([]),k=i({}),{generateFieldListByFormConfigItem:C}=h(),P=i(!1);async function _(){var e;w.value=L,await v(),null==(e=F.value)||e.validate()}let L=null;function O({fieldKey:e,value:o}){w.value&&(w.value[e]=o)}return l(w,(async(e,o)=>{var i,t,l;if(!e)return R.value=[];if(o&&e!==L)try{await(null==(i=F.value)?void 0:i.validate())}catch(e){return P.value=!0}L=e,k.value={editable:!0,show:!0,...f(a(e))};const r=null==(t=j.bindFormRenderRef)?void 0:t.getFieldList();R.value=C(e,c(r,e.key)).map((e=>({...e,componentProps:{...e.componentProps,to:x.value}}))),null==(l=F.value)||l.reload()}),{immediate:!0}),b({validate(){var e;return null==(e=F.value)?void 0:e.validate()}}),(o,i)=>(r(),n(s,null,[u(d(y),m({size:"small"},e.formProps,{column:12,ref_key:"formRenderRef",ref:F,onFormChange:O,"field-list":R.value,"initial-data":k.value}),null,16,["field-list","initial-data"]),u(d(g),{show:P.value,"onUpdate:show":i[0]||(i[0]=e=>P.value=e),preset:"dialog",to:d(x),"close-on-esc":!1,"mask-closable":!1,closable:!1,title:"存在填写错误的字段","positive-text":"继续编辑",onPositiveClick:_},null,8,["show","to"])],64))}});export{b as default};
1
+ import{defineComponent as e,computed as i,ref as o,inject as l,watch as t,toRaw as a,openBlock as r,createElementBlock as n,Fragment as s,createVNode as u,unref as d,mergeProps as m,nextTick as v}from"vue";import{cloneDeep as f}from"lodash-es";import{InjectionActiveFieldItem as p}from"../constants/index.js";import"../../../../shared/components/VueDraggable/src/vuedraggable.js";import{findFieldItemByKey as c}from"../utils/index.js";import"@vicons/ionicons5";import{NModal as g}from"naive-ui";import"../../../../shared/utils/index.js";import{useConfigurationField as h}from"../hooks/useConfigurationField.js";import"../../../index.js";import y from"../../../form-render/index.js";var b=e({__name:"FormConfigEdit",props:{uuid:{type:String,required:!0},bindFormRenderRef:{type:Object},formProps:{type:Object}},setup(e,{expose:b}){const j=e,x=i((()=>`#${j.uuid} .form-config__config`)),F=o(),w=l(p),R=o([]),k=o({}),{generateFieldListByFormConfigItem:C}=h(),_=o(!1);async function P(){var e;w.value=L,await v(),null==(e=F.value)||e.validate()}let L=null;function O({fieldKey:e,value:i}){w.value&&(w.value[e]=i)}return t(w,(async(e,i)=>{var o,l,t;if(!e)return R.value=[];if(i&&e!==L)try{await(null==(o=F.value)?void 0:o.validate())}catch(e){return _.value=!0}L=e,k.value={editable:!0,show:!0,...f(a(e))};const r=null==(l=j.bindFormRenderRef)?void 0:l.getFieldList();R.value=C(e,c(r,e.key)),null==(t=F.value)||t.reload()}),{immediate:!0}),b({validate(){var e;return null==(e=F.value)?void 0:e.validate()}}),(i,o)=>(r(),n(s,null,[u(d(y),m({size:"small"},e.formProps,{column:12,ref_key:"formRenderRef",ref:F,onFormChange:O,"field-list":R.value,"initial-data":k.value}),null,16,["field-list","initial-data"]),u(d(g),{show:_.value,"onUpdate:show":o[0]||(o[0]=e=>_.value=e),preset:"dialog",to:d(x),"close-on-esc":!1,"mask-closable":!1,closable:!1,title:"存在填写错误的字段","positive-text":"继续编辑",onPositiveClick:P},null,8,["show","to"])],64))}});export{b as default};
@@ -1 +1 @@
1
- import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,castArray as n,pick as i}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as l}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as c}from"./useFormValidator.js";import{transformDateFormat as d}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...i(o,["wordbook","autograph"])})}function u(e,o){Object.assign(e["x-component-props"],{...i(o,["urlConfig","wordbook"])})}function f(e){return"1"===e||!0===e}function x(x,_){const{createValidatorSchema:h}=c(),b=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=h(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},v=e=>{var o,t,n,l,s,a,p,c,d,x,_,h,v,g;const y=b(e);e.urlConfig?u(y,e):e.autograph&&m(y,e);const w=!!e.__multiple,C=f(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=f(null!=(l=null==(n=e.componentProps)?void 0:n.selectAll)?l:e.selectAll),A=f(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=f(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(x=null==(d=e.componentProps)?void 0:d.showField)?x:e.show_key,k=null!=(h=null==(_=e.componentProps)?void 0:_.options)?h:e.option,N=null!=(g=r(e.multi_select_value))?g:null==(v=e.componentProps)?void 0:v.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...i(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},g=e=>{var o,t;const n=b(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?u(n,e):e.autograph&&m(n,e),n},y=e=>{const t=b(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},w=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),C=new Map([["LINEBAR",w],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=b(e);return Object.assign(o["x-component-props"],{...i(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=b(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=b(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:r(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",v],["REMOTE_SEARCH",v],["DATE",e=>{const o=b(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:d(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=b(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:d(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=b(e);return Object.assign(o["x-component-props"],{...i(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=b(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=b(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",g],["CHECKBOX",g],["SWITCH",e=>{const o=b(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=b(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=b(e);Array.isArray(e.properties)&&l("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?k(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],i(e,["wrapperStyle","display"])),o}]]),O=e=>{if(e.suffixConfig)return A(e);return(C.get(e.html_type)||y)(e)},A=o=>{if(!o.suffixConfig&&!o.prefixConfig)return O(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"})))],i=b(o),r=n.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(i,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...i["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:k(n)}),i},{FieldNormalizeWaterfallHook:E,FieldListNormalizeWaterfallHook:j}=s();function k(o,i={column:9999}){let r=null;const l=j.call(t(o),i).reduce(((e,o,n)=>{var l;const a=null==(l=(o=E.call(o,i)).validate)?void 0:l.obj_type;return a&&x&&x.collect(a,t(o)),"LINEBAR"===o.html_type?(e[p(o)]=s(w(o),n),r=e[p(o)].properties={}):r?r[p(o)]=s(O(o),n):(r=null,e[p(o)]=s(O(o),n)),e}),{});return i.linebarAutoHidden&&Object.values(l).forEach((e=>{if("LINEBAR"!==e["x-component"])return;e["x-reactions"]?e["x-reactions"]=n(e["x-reactions"]):e["x-reactions"]=[];const o=Object.keys(e.properties||{}).map((o=>`${e.name}.${o}#selfDisplay`));e["x-reactions"].push({dependencies:o,fulfill:{state:{visible:"{{hasVisible($deps)}}"}}})})),l;function s(e,o){return e["x-index"]=o,e["x-decorator-props"]={_index:o,...e["x-decorator-props"]},e}function p(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:k}}export{x as useFieldListAdaptor};
1
+ import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,castArray as n,pick as i}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as l}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{traverseSchema as a,fieldKeyEscape as p,createLinebarId as c}from"../utils/schema.js";import{useFormValidator as d}from"./useFormValidator.js";import{transformDateFormat as m}from"../utils/business.js";function u(e,o){Object.assign(e["x-component-props"],{...i(o,["wordbook","autograph"])})}function f(e,o){Object.assign(e["x-component-props"],{...i(o,["urlConfig","wordbook"])})}function x(e){return"1"===e||!0===e}function _(n,_){const{createValidatorSchema:b}=d(),v=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=b(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},g=e=>{var o,t,n,l,s,a,p,c,d,m,_,h,b,g;const y=v(e);e.urlConfig?f(y,e):e.autograph&&u(y,e);const w=!!e.__multiple,C=x(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=x(null!=(l=null==(n=e.componentProps)?void 0:n.selectAll)?l:e.selectAll),A=x(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=x(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(m=null==(d=e.componentProps)?void 0:d.showField)?m:e.show_key,k=null!=(h=null==(_=e.componentProps)?void 0:_.options)?h:e.option,N=null!=(g=r(e.multi_select_value))?g:null==(b=e.componentProps)?void 0:b.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...i(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},y=e=>{var o,t;const n=v(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?f(n,e):e.autograph&&u(n,e),n},w=e=>{const t=v(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},C=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:c(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),O=new Map([["LINEBAR",C],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=v(e);return Object.assign(o["x-component-props"],{...i(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=v(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=v(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:r(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",g],["REMOTE_SEARCH",g],["DATE",e=>{const o=v(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=v(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=v(e);return Object.assign(o["x-component-props"],{...i(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=v(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=v(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",y],["CHECKBOX",y],["SWITCH",e=>{const o=v(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=v(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=v(e);Array.isArray(e.properties)&&l("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?N(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],i(e,["wrapperStyle","display"])),o}]]),A=e=>{if(e.suffixConfig)return E(e);return(O.get(e.html_type)||w)(e)},E=o=>{if(!o.suffixConfig&&!o.prefixConfig)return A(o);const t=o.suffixConfig?e(o.suffixConfig):[],n=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"}))),{...o,is_show:"1",hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...t.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:"1"})))],i=v(o),r=n.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(i,{type:"void",name:p(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...i["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:N(n)}),i},{FieldNormalizeWaterfallHook:j,FieldListNormalizeWaterfallHook:k}=s();function N(o,i={column:9999}){let r=null;const l=k.call(t(o),i).reduce(((e,o,l)=>{var a;const p=null==(a=(o=j.call(o,i)).validate)?void 0:a.obj_type;return p&&n&&n.collect(p,t(o)),"LINEBAR"===o.html_type?(e[c(o)]=s(C(o),l),r=e[c(o)].properties={}):r?r[c(o)]=s(A(o),l):(r=null,e[c(o)]=s(A(o),l)),e}),{});return i.linebarAutoHidden&&Object.values(l).forEach((e=>{"LINEBAR"===e["x-component"]&&h(e)})),a({properties:l,"x-root":!0},((e,o)=>{"INPUT_GROUP"===e["x-component"]&&h(e,!!o&&!o["x-root"])})),l;function s(e,o){return e["x-index"]=o,e["x-decorator-props"]={_index:o,...e["x-decorator-props"]},e}function c(o){return o.suffixConfig?p([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:N}}function h(e,o=!1){e["x-reactions"]?e["x-reactions"]=n(e["x-reactions"]):e["x-reactions"]=[];const t=Object.keys(e.properties||{}).map((t=>`${o?"*.":""}${e.name}.${t}#selfDisplay`));e["x-reactions"].push({dependencies:t,fulfill:{state:{visible:'{{hasVisible($deps) && $self.selfDisplay==="visible"}}'}}})}export{_ as useFieldListAdaptor};
@@ -15,7 +15,7 @@ export interface FieldVisitorContext {
15
15
  insertAfter(f: FieldItem | FieldItem[]): void;
16
16
  }
17
17
  export type FieldVisitor = Record<string, (context: FieldVisitorContext) => void>;
18
- export type AgeContext = Record<'age' | 'day' | 'month' | 'year' | 'hours', number>;
18
+ export type AgeContext = Record<'age' | 'day' | 'month' | 'year' | 'hours' | 'minutes', number>;
19
19
  export type IdCardParseInfo = Record<'sex' | 'birthday', string> & AgeContext;
20
20
  export type FormRenderExpose = {
21
21
  formModel: Form;
@@ -1 +1 @@
1
- import{differenceInDays as t,differenceInMonths as e,differenceInYears as n,differenceInHours as a,format as r}from"date-fns";import{isString as s}from"lodash-es";import{FIELD_AGE_UNIT as o,FIELD_SEX_VALUE as u}from"../constants/index.js";function d(t){return((t,e,n)=>{const a={},r=1-t.substr(e,1)%2;a.sex=1===r?u.FEMALE:u.MALE;const s=(2==n?"19":"")+t.substr(6,n),o=t.substr(6+n,2),d=t.substr(8+n,2);a.birthday=s+"-"+o+"-"+d+" 00:00";const c=new Date,i=c.getMonth()+1<parseInt(o,10)||c.getMonth()+1==parseInt(o,10)&&c.getDate()<parseInt(d,10)?1:0;return Object.assign(a,g(a.birthday)),a.age=a.year=c.getFullYear()-parseInt(s,10)-i,a})(t,15==t.length?14:16,15==t.length?2:4)}function c(t=""){if(!s(t)||!t)return"date";const e=t.includes("y"),n=t.includes("M"),a=t.includes("d"),r=t.includes("H"),o=t.includes("m"),u=t.includes("s");return e||n||a||!(r||o||u)?r||o||u?"datetime":!e||n||a?!e&&n&&a?"month":"date":"year":"time"}const i=/^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/,h=/^[1-9]\d{5}\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}$/;function f(t){return i.test(t)&&function(t){if(!t||18!==t.length)return!1;const e=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];let n=0;for(let a=0;a<17;a++)n+=+t[a]*e[a];return t.charAt(17).toUpperCase()===["1","0","X","9","8","7","6","5","4","3","2"][n%11]}(t)||h.test(t)}function l(t){return/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(t)}function g(r){const s={},o=new Date,u=new Date(r);return s.day=t(o,u),s.month=e(o,u),s.age=s.year=n(o,u),s.hours=a(o,u),s}function m(t,e,n="yyyy-MM-dd HH:mm"){var a;const s=new Date,u={[o.MINUTE]:()=>d(s,"Minutes",t),[o.HOUR]:()=>d(s,"Hours",t),[o.DAY]:()=>d(s,"Date",t),[o.WEEK]:()=>d(s,"Date",7*t),[o.MONTH]:()=>d(s,"Month",t),[o.YEAR]:()=>d(s,"FullYear",t)};return null==(a=u[e])||a.call(u),r(function(t,e){const n=[{[o.DAY]:"Date",[o.WEEK]:"Date",[o.MONTH]:"Date",[o.YEAR]:"Date"},{[o.HOUR]:"Hours"},{[o.MINUTE]:"Minutes"}],a=n.findIndex((t=>Reflect.has(t,e)));~a&&n.slice(a+1).forEach((e=>{Object.values(e).forEach((e=>{t[`set${e}`]("Date"===e?1:0)}))}));return t.setSeconds(0),t}(s,e),n);function d(t,e,n){t[`set${e}`](t[`get${e}`]()-n)}}function M(t){const e=t.hours<24?{ageUnit:o.HOUR,age:Math.max(t.hours,1)}:t.day<30?{ageUnit:o.DAY,age:Math.max(t.day,1)}:t.day<365?{ageUnit:o.MONTH,age:Math.max(t.month,1)}:{ageUnit:o.YEAR,age:Math.max(t.year,1)};return e.age=Math.max(e.age,1),e}const D=/^(\d{4})-?(\d{2})-?(\d{2})?\s?(\d{2})?:?(\d{2})?:?(\d{2})?$/;function y(t){if(!s(t))return;const e=t.match(D);if(!e)return;const[,n,a,r,o,u,d]=e;return new Date(`${n}-${a}-${r||"01"} ${o||"00"}:${u||"00"}:${d||"00"}`)}export{y as businessDateParser,f as isIdCard,l as isMobile,m as parseAge2Birthday,M as parseAgeFromContext,g as parseBirthday,d as parseIdCard,c as transformDateFormat};
1
+ import{format as t,differenceInDays as e,differenceInMonths as n,differenceInYears as r,differenceInHours as s,differenceInMinutes as a}from"date-fns";import{isString as u}from"lodash-es";import{FIELD_AGE_UNIT as o,FIELD_SEX_VALUE as d}from"../constants/index.js";function i(t){return((t,e,n)=>{const r={},s=1-t.substr(e,1)%2;r.sex=1===s?d.FEMALE:d.MALE;const a=(2==n?"19":"")+t.substr(6,n),u=t.substr(6+n,2),o=t.substr(8+n,2);r.birthday=a+"-"+u+"-"+o+" 00:00";const i=new Date,c=i.getMonth()+1<parseInt(u,10)||i.getMonth()+1==parseInt(u,10)&&i.getDate()<parseInt(o,10)?1:0;return Object.assign(r,m(r.birthday)),r.age=r.year=i.getFullYear()-parseInt(a,10)-c,r})(t,15==t.length?14:16,15==t.length?2:4)}function c(t=""){if(!u(t)||!t)return"date";const e=t.includes("y"),n=t.includes("M"),r=t.includes("d"),s=t.includes("H"),a=t.includes("m"),o=t.includes("s");return e||n||r||!(s||a||o)?s||a||o?"datetime":!e||n||r?!e&&n&&r?"month":"date":"year":"time"}const l=/^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/,f=/^[1-9]\d{5}\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}$/;function g(t){return l.test(t)&&function(t){if(!t||18!==t.length)return!1;const e=[7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2];let n=0;for(let r=0;r<17;r++)n+=+t[r]*e[r];return t.charAt(17).toUpperCase()===["1","0","X","9","8","7","6","5","4","3","2"][n%11]}(t)||f.test(t)}function h(t){return/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(t)}function m(t){const u={},o=new Date,d=new Date(t),i=[["day",e],["month",n],["year",r],["hours",s],["minutes",a]];return Object.defineProperties(u,i.reduce(((t,[e,n])=>(t[e]={get:(()=>{let t=null;return()=>(null===t&&(t=n(o,d)),t)})()},t)),{})),u}function M(e,n,r="yyyy-MM-dd HH:mm"){var s;const a=new Date,u={[o.MINUTE]:()=>d(a,"Minutes",e),[o.HOUR]:()=>d(a,"Hours",e),[o.DAY]:()=>d(a,"Date",e),[o.WEEK]:()=>d(a,"Date",7*e),[o.MONTH]:()=>d(a,"Month",e),[o.YEAR]:()=>d(a,"FullYear",e)};return null==(s=u[n])||s.call(u),t(function(t,e){const n=[{[o.DAY]:"Date",[o.WEEK]:"Date",[o.MONTH]:"Date",[o.YEAR]:"Date"},{[o.HOUR]:"Hours"},{[o.MINUTE]:"Minutes"}],r=n.findIndex((t=>Reflect.has(t,e)));~r&&n.slice(r+1).forEach((e=>{Object.values(e).forEach((e=>{t[`set${e}`]("Date"===e?1:0)}))}));return t.setSeconds(0),t}(a,n),r);function d(t,e,n){t[`set${e}`](t[`get${e}`]()-n)}}function D(t){const e=t.minutes<60?{ageUnit:o.MINUTE,age:t.minutes}:t.hours<24?{ageUnit:o.HOUR,age:t.hours}:t.day<30?{ageUnit:o.DAY,age:t.day}:t.day<365?{ageUnit:o.MONTH,age:t.month}:{ageUnit:o.YEAR,age:t.year};return e.age=Math.max(e.age,1),e}const y=/^(\d{4})-?(\d{2})-?(\d{2})?\s?(\d{2})?:?(\d{2})?:?(\d{2})?$/;function E(t){if(!u(t))return;const e=t.match(y);if(!e)return;const[,n,r,s,a,o,d]=e;return new Date(`${n}-${r}-${s||"01"} ${a||"00"}:${o||"00"}:${d||"00"}`)}export{E as businessDateParser,g as isIdCard,h as isMobile,M as parseAge2Birthday,D as parseAgeFromContext,m as parseBirthday,i as parseIdCard,c as transformDateFormat};
@@ -3,7 +3,7 @@ import { GeneralField } from '@formily/core';
3
3
  import { ISchema } from '@formily/json-schema/esm/types';
4
4
  import { Ref } from 'vue';
5
5
  import { DependKeyType, FieldItem, ObjectDependKey } from '../../../../components/form-render';
6
- export declare function traverseSchema(schema: ISchema, handler: (_s: ISchema) => void): void;
6
+ export declare function traverseSchema(schema: ISchema, handler: (_s: ISchema, parent?: ISchema) => void, parent?: ISchema): void;
7
7
  export declare function fieldKeyEscape(fieldList: FieldItem[]): string;
8
8
  export declare function dotEscape(id: string): string;
9
9
  export declare function createFieldAddressId(id: string): string;
@@ -1 +1 @@
1
- import{isField as e}from"@formily/core";import{isObject as t,isPromise as r}from"@vue/shared";import{isString as n,isArray as o,isFunction as u,noop as a}from"lodash-es";function i(e,r){r(e),t(e.properties)&&Object.values(e.properties).forEach((e=>{i(e,r)}))}function c(e){return l(e.map((e=>e.val_key)).join("-"))}function l(e){return e.replace(/[.]/g,"-")}function f(e){return l(`address-${e}`)}function s(e){return l(`id-${e}`)}function p(e,r){e&&function(){const r=new Map;o(e)?e.forEach((e=>{var n;t(e)?r.set(e.paramName,{key:null!=(n=e.paramValue)?n:e.paramName,dependKey:e}):r.set(e,e)})):t(e)?Object.entries(e).forEach((([e,t])=>{r.set(e,t)})):n(e)&&r.set(e,e);return r}().forEach(((e,t)=>{if(n(e))return r(t,e);r(t,e.key,e.dependKey)}))}function d(e,t){let r=null;for(const o of t){if(o.val_key===e){n(o)&&(r=null);break}n(o)&&(r=o.val_key)}return r;function n(e){return"LINEBAR"===e.html_type}}function v(t,n){const o={...t};return e(n)&&Object.assign(o,{"onUpdate:value"(e){var t;const o=null==(t=n.decoratorProps)?void 0:t.beforeSetValue;if(u(o)){const t=o(n.path.toString(),e,{field:n,oldValue:n.value});return r(t)?t.then((e=>n.setValue(e)),a):n.setValue(t)}n.setValue(e)}}),o}function m(t,r){const n={...t};return e(r)&&(n.key=void 0===n.value?0:1),n}function y(t,r){const n={...t};return e(r)&&(n.onClear=()=>r.visited=!0),n}function h(e){return{type:"object",properties:e}}function k(t,r){return(...n)=>(e(t.value)&&(t.value.visited=!0),u(r)?r(...n):void 0)}export{y as assignClearBindVisited,v as assignUpdateValue,m as assignValueBindKey,f as createFieldAddressId,s as createLinebarId,h as createObjSchema,k as createVisitedSetter,l as dotEscape,c as fieldKeyEscape,d as getParentLinebar,p as traverseDependKey,i as traverseSchema};
1
+ import{isField as e}from"@formily/core";import{isObject as t,isPromise as r}from"@vue/shared";import{isString as n,isArray as o,isFunction as u,noop as a}from"lodash-es";function i(e,r,n){r(e,n),t(e.properties)&&Object.values(e.properties).forEach((t=>{i(t,r,e)}))}function c(e){return l(e.map((e=>e.val_key)).join("-"))}function l(e){return e.replace(/[.]/g,"-")}function f(e){return l(`address-${e}`)}function s(e){return l(`id-${e}`)}function p(e,r){e&&function(){const r=new Map;o(e)?e.forEach((e=>{var n;t(e)?r.set(e.paramName,{key:null!=(n=e.paramValue)?n:e.paramName,dependKey:e}):r.set(e,e)})):t(e)?Object.entries(e).forEach((([e,t])=>{r.set(e,t)})):n(e)&&r.set(e,e);return r}().forEach(((e,t)=>{if(n(e))return r(t,e);r(t,e.key,e.dependKey)}))}function d(e,t){let r=null;for(const o of t){if(o.val_key===e){n(o)&&(r=null);break}n(o)&&(r=o.val_key)}return r;function n(e){return"LINEBAR"===e.html_type}}function v(t,n){const o={...t};return e(n)&&Object.assign(o,{"onUpdate:value"(e){var t;const o=null==(t=n.decoratorProps)?void 0:t.beforeSetValue;if(u(o)){const t=o(n.path.toString(),e,{field:n,oldValue:n.value});return r(t)?t.then((e=>n.setValue(e)),a):n.setValue(t)}n.setValue(e)}}),o}function m(t,r){const n={...t};return e(r)&&(n.key=void 0===n.value?0:1),n}function y(t,r){const n={...t};return e(r)&&(n.onClear=()=>r.visited=!0),n}function h(e){return{type:"object",properties:e}}function k(t,r){return(...n)=>(e(t.value)&&(t.value.visited=!0),u(r)?r(...n):void 0)}export{y as assignClearBindVisited,v as assignUpdateValue,m as assignValueBindKey,f as createFieldAddressId,s as createLinebarId,h as createObjSchema,k as createVisitedSetter,l as dotEscape,c as fieldKeyEscape,d as getParentLinebar,p as traverseDependKey,i as traverseSchema};