cnhis-design-vue 3.1.51-beta.3 → 3.1.51-beta.31

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 (125) hide show
  1. package/README.md +87 -87
  2. package/es/components/annotation-edit/src/type.d.ts +1 -1
  3. package/es/components/base-search/index.d.ts +3 -0
  4. package/es/components/base-search/src/index.vue.d.ts +3 -0
  5. package/es/components/base-search/src/index.vue2.js +1 -1
  6. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  7. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  8. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  9. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  10. package/es/components/callback/src/components/render/popupMaps.d.ts +6 -4
  11. package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
  12. package/es/components/classification/src/index.vue2.js +1 -1
  13. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  14. package/es/components/fabric-chart/index.d.ts +5 -6
  15. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +5 -6
  16. package/es/components/fabric-chart/src/FabricChart.vue2.js +1 -1
  17. package/es/components/fabric-chart/src/components/PopupMenu.js +1 -1
  18. package/es/components/fabric-chart/src/components/PopupTip.vue.d.ts +0 -6
  19. package/es/components/fabric-chart/src/components/PopupTip.vue2.js +1 -1
  20. package/es/components/fabric-chart/src/hooks/birthProcess/useBirthProcessChart.js +1 -1
  21. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useCenter.js +1 -1
  22. package/es/components/fabric-chart/src/hooks/temperature/useTemperatureChart.js +1 -1
  23. package/es/components/fabric-chart/style/index.css +1 -1
  24. package/es/components/field-set/index.d.ts +33 -0
  25. package/es/components/field-set/src/FieldSet.vue.d.ts +33 -0
  26. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  27. package/es/components/field-set/src/components/Row.vue.d.ts +2 -1
  28. package/es/components/field-set/src/components/Row.vue2.js +1 -1
  29. package/es/components/field-set/src/types/index.d.ts +1 -0
  30. package/es/components/form-config/index.d.ts +6 -2
  31. package/es/components/form-config/src/FormConfig.vue.d.ts +6 -2
  32. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +3 -1
  33. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -1
  34. package/es/components/form-render/index.d.ts +3 -1
  35. package/es/components/form-render/src/FormRender.vue.d.ts +3 -1
  36. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  37. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +3 -1
  38. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  39. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  40. package/es/components/form-render/src/components/renderer/select.js +1 -1
  41. package/es/components/form-render/src/hooks/useFormEvent.d.ts +3 -1
  42. package/es/components/form-render/src/hooks/useFormEvent.js +1 -1
  43. package/es/components/form-render/src/types/index.d.ts +5 -1
  44. package/es/components/iho-table/index.d.ts +3 -3
  45. package/es/components/iho-table/src/IhoTable.vue.d.ts +4 -3
  46. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  47. package/es/components/iho-table/src/constants/index.d.ts +7 -6
  48. package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +1 -1
  49. package/es/components/iho-table/src/plugins/defaultValuePlugin.d.ts +1 -0
  50. package/es/components/iho-table/src/plugins/defaultValuePlugin.js +1 -0
  51. package/es/components/iho-table/src/plugins/index.js +1 -1
  52. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
  53. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +1 -1
  54. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.d.ts +2 -0
  55. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.js +1 -1
  56. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +27 -0
  57. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  58. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  59. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.d.ts +2 -1
  60. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
  61. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
  62. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/separateUtils.d.ts +4 -3
  63. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/separateUtils.js +1 -1
  64. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/index.js +1 -1
  65. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
  66. package/es/components/iho-table/src/types/index.d.ts +23 -1
  67. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  68. package/es/components/iho-table/src/utils/index.js +1 -1
  69. package/es/components/index.css +1 -1
  70. package/es/components/index.d.ts +4 -1
  71. package/es/components/index.js +1 -1
  72. package/es/components/info-header/index.d.ts +6 -2
  73. package/es/components/info-header/src/InfoHeader.vue.d.ts +6 -2
  74. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +3 -1
  75. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +3 -1
  76. package/es/components/quick-search/index.d.ts +3 -0
  77. package/es/components/quick-search/src/index.vue.d.ts +3 -0
  78. package/es/components/quick-search/src/index.vue2.js +1 -1
  79. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  80. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  81. package/es/components/select-person/src/SearchMultiple.vue.d.ts +0 -6
  82. package/es/components/shortcut-provider/src/hooks/useShortcuts.d.ts +1 -0
  83. package/es/components/shortcut-provider/src/hooks/useShortcuts.js +1 -1
  84. package/es/components/shortcut-setter/index.d.ts +4 -1
  85. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +4 -1
  86. package/es/components/slider-tree/index.d.ts +86 -0
  87. package/es/components/slider-tree/index.js +1 -0
  88. package/es/components/slider-tree/src/hooks/useAsyncData.d.ts +6 -0
  89. package/es/components/slider-tree/src/hooks/useAsyncData.js +1 -0
  90. package/es/components/slider-tree/src/index.vue.d.ts +84 -0
  91. package/es/components/slider-tree/src/index.vue.js +1 -0
  92. package/es/components/slider-tree/src/index.vue2.js +1 -0
  93. package/es/components/slider-tree/src/utils/index.d.ts +13 -0
  94. package/es/components/slider-tree/src/utils/index.js +1 -0
  95. package/es/components/slider-tree/src/utils/tool.d.ts +1 -0
  96. package/es/components/slider-tree/src/utils/tool.js +1 -0
  97. package/es/components/slider-tree/style/index.css +1 -0
  98. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +3 -0
  99. package/es/components/table-filter/src/components/render-widget/components/SelectDynamicOption/index.vue2.js +1 -1
  100. package/es/components/table-filter/src/hooks/useAdvanced.js +1 -1
  101. package/es/env.d.ts +25 -25
  102. package/es/shared/assets/img/failure.png.js +1 -1
  103. package/es/shared/assets/img/no-permission.png.js +1 -1
  104. package/es/shared/assets/img/nodata.png.js +1 -1
  105. package/es/shared/assets/img/notfound.png.js +1 -1
  106. package/es/shared/assets/img/qr.png.js +1 -1
  107. package/es/shared/assets/img/success.png.js +1 -1
  108. package/es/shared/assets/img/video.png.js +1 -1
  109. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  110. package/es/shared/assets/img/xb_big.png.js +1 -1
  111. package/es/shared/assets/img/xb_small.png.js +1 -1
  112. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  113. package/es/shared/directive/flexibleResize.d.ts +4 -0
  114. package/es/{components/classification/src → shared}/directive/flexibleResize.js +1 -1
  115. package/es/shared/directive/index.d.ts +1 -0
  116. package/es/shared/directive/index.js +1 -0
  117. package/es/shared/package.json.js +1 -1
  118. package/es/shared/types/business.d.ts +7 -0
  119. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  120. package/es/shared/utils/index.js +1 -1
  121. package/es/shared/utils/tapable/index.d.ts +139 -0
  122. package/package.json +2 -2
  123. package/es/components/classification/src/directive/flexibleResize.d.ts +0 -28
  124. package/es/components/table-filter/src/types/tool.d.ts +0 -7
  125. package/es/components/table-filter/src/types/tool.js +0 -1
@@ -1 +1 @@
1
- import{defineComponent as t,openBlock as l,createBlock as p,Teleport as o,withDirectives as e,createElementVNode as r,normalizeStyle as s,unref as u,createElementBlock as a,Fragment as i,renderList as c,toDisplayString as n,vShow as f}from"vue";import m from"./useStyle.js";var h=t({__name:"PopupTip",props:{show:{type:Boolean,default:!1},point:null,list:{default:()=>[]},propItems:null},setup(t){const h=m(t);return(m,y)=>(l(),p(o,{to:".c-fabric-chart"},[e(r("ul",{class:"c-fabric-chart-popup-tip",style:s(u(h))},[(l(!0),a(i,null,c(t.list,(t=>(l(),a("li",{key:t},n(t),1)))),128))],4),[[f,t.show]])]))}});export{h as default};
1
+ import{defineComponent as t,withDirectives as l,openBlock as p,createElementBlock as e,normalizeStyle as o,unref as s,Fragment as u,renderList as r,toDisplayString as a,vShow as i}from"vue";import n from"./useStyle.js";var f=t({__name:"PopupTip",props:{show:{type:Boolean,default:!1},point:null,list:{default:()=>[]},propItems:null},setup(t){const f=n(t);return(n,m)=>l((p(),e("ul",{class:"c-fabric-chart-popup-tip",style:o(s(f))},[(p(!0),e(u,null,r(t.list,(t=>(p(),e("li",{key:t},a(t),1)))),128))],4)),[[i,t.show]])}});export{f as default};
@@ -1 +1 @@
1
- import{ref as e,computed as a,reactive as t,onMounted as l,nextTick as r}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as i}from"../../utils/index.js";import{useCanvasEvent as s}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import"naive-ui";import"@vueuse/core";import{useBirthProcess as d}from"./useBirthProcess.js";function n(n,o,v,c,h,m){const f=e(),p=e(),g=e(),x=a((()=>o.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),w=a((()=>o.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),y=a((()=>{var e;return(null==(e=w.value)?void 0:e.length)?30:0})),V=a((()=>{var e;return 30+(null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),b=a((()=>{var e;const{width:a}=o.data,t=null==(e=w.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-y.value-t})),j=a((()=>o.data.grid.mainXCell)),A=a((()=>{const e=o.data.grid.mainYCell||14;return o.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),C=a((()=>(b.value-V.value)/j.value)),k=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(A.value+t)})),Y=a((()=>{const{xAxis:e}=o.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return k.value*a})),S=a((()=>{var e;const{scaleValues:a}=o.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!Y.value)return Y.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],r=(null==t?void 0:t.spaceValue)||1;return H.value-l*r*k.value})),H=a((()=>{const{xAxis:e,height:a}=o.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-k.value*t})),P=a((()=>i(o.data.xAxis.time.startTime))),X=a((()=>36e5/C.value)),F=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"cervix"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),R=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"FHR"===e.key));return k.value/((null==a?void 0:a.spaceValue)||10)})),W=a((()=>{const{scaleValues:e}=o.data,a=e.find((e=>"fetalPresentation"===e.key));return k.value/((null==a?void 0:a.spaceValue)||1)})),O=a((()=>{var e;return(null==(e=o.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),M=t({canvasWidth:o.data.width,canvasHeight:o.data.height,borderStyle:{...u,...o.data.borderStyle||{}},selectionStyle:o.data.selectionStyle||{},grid:o.data.grid,other:o.data.other,originX:V.value,endX:b.value,originY:Y.value,endY:H.value,xCellWidth:C.value,yCellHeight:k.value,gridXNumber:j.value,gridYNumber:A.value,xAxis:o.data.xAxis,leftScales:x.value,rightScales:w.value,leftAddAreaWidth:30,rightAddAreaWidth:y.value,startTime:P.value,timeXCell:X.value,cervixYCell:F.value,FHRYCell:R.value,fetalPresentationYCell:W.value,scaleValues:o.data.scaleValues,event:O.value,originYCervix:S.value});return l((()=>{r((()=>{const{clickMenu:e,redrawPoints:a}=d(n,M,v,h,m);p.value=a,g.value=e;const{select:t}=s(n,M,v);f.value=t}))})),{propItems:M,redrawPoints:p,select:f,clickMenu:g}}export{n as useBirthProcessChart};
1
+ import{ref as e,computed as a,reactive as t,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import{getTime as r}from"../../utils/index.js";import{useCanvasEvent as i}from"../useEvent.js";import"../temperature/useShadow.js";import"lodash-es";import"naive-ui";import"@vueuse/core";import{useBirthProcess as s}from"./useBirthProcess.js";function d(d,n,o,v,c,h){const m=e(),f=e(),p=e(),g=a((()=>n.data.scaleValues.filter((e=>"left"===e.layout&&e.show)))),x=a((()=>n.data.scaleValues.filter((e=>"right"===e.layout&&e.show)))),w=a((()=>{var e;return(null==(e=x.value)?void 0:e.length)?30:0})),y=a((()=>{var e;return 30+(null==(e=g.value)?void 0:e.reduce(((e,a)=>e+=a.width),0))})),V=a((()=>{var e;const{width:a}=n.data,t=null==(e=x.value)?void 0:e.reduce(((e,a)=>e+=a.width),0);return a-w.value-t})),b=a((()=>n.data.grid.mainXCell)),j=a((()=>{const e=n.data.grid.mainYCell||14;return n.data.scaleValues.find((e=>e.show&&"FHR"===e.key))||14!==e?e:10})),A=a((()=>(V.value-y.value)/b.value)),C=a((()=>{const{xAxis:e,height:a}=n.data,t=Object.values(e).reduce(((e,a)=>(a.show&&e++,e)),0);return a/(j.value+t)})),k=a((()=>{const{xAxis:e}=n.data,a=Object.values(e).reduce(((e,a)=>(a.show&&"top"===a.position&&e++,e)),0);return C.value*a})),Y=a((()=>{var e;const{scaleValues:a}=n.data;if(!(null==(e=a.find((e=>"FHR"===e.key)))?void 0:e.show)&&!k.value)return k.value;const t=a.find((e=>"cervix"===e.key)),[,l]=(null==t?void 0:t.range)||[0,10],u=(null==t?void 0:t.spaceValue)||1;return S.value-l*u*C.value})),S=a((()=>{const{xAxis:e,height:a}=n.data,t=Object.values(e).reduce(((e,a)=>(a.show&&"bottom"===a.position&&e++,e)),0);return a-C.value*t})),H=a((()=>r(n.data.xAxis.time.startTime))),P=a((()=>36e5/A.value)),X=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"cervix"===e.key));return C.value/((null==a?void 0:a.spaceValue)||1)})),F=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"FHR"===e.key));return C.value/((null==a?void 0:a.spaceValue)||10)})),R=a((()=>{const{scaleValues:e}=n.data,a=e.find((e=>"fetalPresentation"===e.key));return C.value/((null==a?void 0:a.spaceValue)||1)})),W=a((()=>{var e;return(null==(e=n.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),O=t({canvasWidth:n.data.width,canvasHeight:n.data.height,borderStyle:{...u,...n.data.borderStyle||{}},selectionStyle:n.data.selectionStyle||{},grid:n.data.grid,other:n.data.other,originX:y.value,endX:V.value,originY:k.value,endY:S.value,xCellWidth:A.value,yCellHeight:C.value,gridXNumber:b.value,gridYNumber:j.value,xAxis:n.data.xAxis,leftScales:g.value,rightScales:x.value,leftAddAreaWidth:30,rightAddAreaWidth:w.value,startTime:H.value,timeXCell:P.value,cervixYCell:X.value,FHRYCell:F.value,fetalPresentationYCell:R.value,scaleValues:n.data.scaleValues,event:W.value,originYCervix:Y.value});return l((()=>d.value),(e=>{e&&function(){const{clickMenu:e,redrawPoints:a}=s(d,O,o,c,h);f.value=a,p.value=e;const{select:t}=i(d,O,o);m.value=t}()}),{immediate:!0}),{propItems:O,redrawPoints:f,select:m,clickMenu:p}}export{d as useBirthProcessChart};
@@ -1 +1 @@
1
- import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as o,drawPoint as i}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as u,isEffectiveNode as c,getTime as p}from"../../utils/index.js";import{cloneDeep as d,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function y(y,g,h,k,x){const{cumputedX:L,cumputedY:P,getXValue:w,getYValue:b}=r(g),{xCellWidth:A,pointSelectionStyle:C,originX:K,endX:j,originY:E,endY:I,event:T,scaleValues:M,xAxis:S,startTime:V,timeXCell:X,itemList:$,dialog:O}=g,Y=new Map,D=new Set,_=d(M);let z=[],N=null;const G=new Set;l(y,g);const{getEqualXTypes:J,handleAddPrevent:q,setPrevAndNextPoint:F}=s(y,h,g),{pause:R,resume:W}=v((()=>{!function(){if(!G.size)return;for(const e of G)e.set("opacity",1===e.opacity?.5:1);y.value.renderAll()}()}),800);function B(){_.forEach((e=>{e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:i={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:i,lineStyle:l}){if(!e||!n)return;const r=P(t.type,t.range,n),a=o([K,r,j,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});T.hovered&&i&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${i} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),y.value.add(a)}a(n),a(i),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==N?void 0:N.areaPos))return[];const{startPos:t,endPos:n}=N.areaPos,[o,i]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:ae()).filter((e=>e.left>=o&&e.left<=i&&e.top>=l&&e.top<=r))}function Q(e){O.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){N&&y.value.remove(N),N=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];Y.set(e.key,[]),function(e,t){G.size&&[...G].forEach((n=>{const{dataIndex:o,type:i}=n.origin;o===t&&i===e&&G.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,u)=>{!function(e,l,u,c){var p;let d,v,x=c;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:C="",key:K,type:j="circle"}=x,E=re(c.list[u+1],n);e&&E&&!l.breakpoint&&e[0]!==E[0]&&(v=o([...e,...E],P));const I=f[u-1],M={origin:{data:l,title:C,key:c.key,selfKey:K,unit:a,type:r,dataIndex:t,index:u,lineAttr:P},__type:"main",leftLine:I,rightLine:v,...L,...g.event.hovered?g.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:g.event};I?d=i(j,{left:I.get("x2"),top:I.get("y2"),...M}):e&&(M.leftLine=null,d=i(j,{left:e[0],top:e[1],...M}));f.push(v),d&&(d.originLeft=d.left,d.originTop=d.top,function(e){T.hovered&&(e.on("mouseover",(()=>{ie(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{le(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),T.hovered&&ie(e),function(e){const{originLeft:t,originTop:n,left:o,top:i,origin:l}=e,r=~~((o-t)/A);if(o>t+A&&!e.nextPoint){if(0===z.length){ee(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[t,n],t,n]),e.leftLine&&e.leftLine.set({stroke:"transparent"})}const o=t+A*r;if(z.every((e=>e.left!==o))){const t=w(o),n=b(l.type,i);z.push({data:{time:t,value:n,...l.selfKey!==l.key?{key:l.selfKey}:{}},left:o,top:i}),ee(e,[...e.prevPointer,o,i])}z.length<r&&function(e,t){const{originLeft:n,originTop:o,origin:i}=e;let l=1;for(;l<=t;){const t=n+A*l,r=z.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=z.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=z[l-1]||{left:n,top:o},f=~~((r.left-(t-A))/A),u=(r.top-s.top)/f;a.top=s.top+u,a.left=t,a.data={time:w(t),value:b(i.type,a.top),...i.selfKey!==i.key?{key:i.selfKey}:{}},z.splice(l,0,a),ee(e,[s.left,s.top,a.left,a.top])}}l++}}(e,r)}if(z.length>0&&o<z[z.length-1].left){for(const e of D)e.left>o&&(e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e));if(z=z.filter((e=>e.left<=o)),0===z.length){e.leftLine&&e.leftLine.set(e.origin.lineAttr);for(const e of D)e.leftLine&&y.value.remove(e.leftLine),y.value.remove(e)}if(z.length>0){const t=z.at(-1);e.prevPointer=[t.left,t.top]}}}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n}=e.origin,o={...e.origin,data:{...e.origin.data,time:w(e.left),value:b(t,e.top)}};if(y.value.discardActiveObject(),z.length>0){const e=z.map((e=>e.data)),i=_.find((e=>e.type===t)),l=i.dataList.findIndex((e=>e.key===n));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:l,key:n,data:e}),te({...o,data:e})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),te(o,"change")}}))}(d),null==(p=Y.get(c.key))||p.push(d))}(re(l,n),l,u,e)})),Promise.all(Y.get(e.key)).then((t=>{const n=f.filter((e=>e));F(t),y.value.add(...n,...t),function(e,t){const{max:n={},min:o={}}=t.panicValue||{},{max:i={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:o},i){!t&&n&&o&&e.forEach((e=>{const t=e.origin.data.value;"max"===i&&t<n||"min"===i&&t>n||G.add(e)}))}r(n,"max"),r(o,"min"),r(i,"max"),r(l,"min")}(t,e)}))}function ee(e,t){const[,,n,i]=t;e.clone((l=>{l.set({left:n,top:i}),e.prevPointer=[n,i];const r=o(t,e.origin.lineAttr);l.leftLine=r,D.add(l),y.value.add(r,l)}))}function te(e,t="add",n=1){const{data:o,index:i,key:l,type:r}=e;let{dataIndex:a}=e;const s=_.find((e=>e.type===r)),f=s.dataList.find(((e,t)=>(a=t,e.key===l)));switch(t){case"remove":f.list.splice(i,n),f.list[i-1]&&(f.list[i-1].breakpoint=!0);break;case"change":f.list[i]=o;break;default:{const e=Array.isArray(o)?o[0].time:o.time,t=u(e,f.list),n=Array.isArray(o)?o:[o];f.list.splice(t,0,...n);break}}ne({dataIndex:a,scaleValue:s})}function ne(e){var t,n,o;if(D.size&&(null==(t=y.value)||t.remove(...oe([...D]))),D.clear(),z=[],e){const{dataIndex:t,scaleValue:o}=e,i=o.dataList[t];null==(n=y.value)||n.remove(...oe(Y.get(i.key))),Y.delete(i.key),Z(i,t,o)}else Y.size&&(null==(o=y.value)||o.remove(...oe(ae()))),Y.clear(),B()}function oe(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)})),t}function ie(e,t="moving"){const{title:n,type:o,data:i,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?i.value:b(o,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${w(e.left).slice(-5)}`],k.show=!0}function le(e){e.setCoords();const t=6e4/X,n=e.prevPoint?e.prevPoint.left+t:K,o=e.nextPoint?e.nextPoint.left-t:j;e.top<E&&e.set("top",E),e.top>I&&e.set("top",I),e.left<n&&e.set("left",n),e.left>o&&e.set("left",o)}function re(e,t){if(c(e)&&function(e){const t=Date.parse(S.list.at(-1)),n=p(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),o=P(t.type,t.range,e.value);return[n,o<E?E:o>I?I:o]}}function ae(){return Array.from(Y.values()).flat()}return e((()=>{R()})),B(),function(){if(!T.evented)return;let e=!1,o={x:0,y:0};y.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=K&&t<=j&&n>=E&&n<=I)if(e.target){if("main"!==e.target.__type)return;o(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:i,maxTop:l}=f(e.target);ae().forEach((o=>{"main"===o.__type&&o.left>t&&o.left<n&&o.top>i&&o.top<l&&x.list.push({renderItem:()=>o.origin.title,origin:{...o.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else o(e.pointer,null,["新增节点"]),$.forEach((n=>{J(ae(),t,"key",2*A).includes(n.linkKey||n.key)||x.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===x.list.length&&(x.show=!1,q("repeat"),console.log("当前时间段内无可新增节点"));function o(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return te(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(N)}})),y.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,o=t.pointer)})),y.value.on("mouse:move",(i=>{if(!e)return;const{x:l,y:r}=o,{x:a,y:s}=i.pointer;N&&y.value.remove(N),N=new t.Rect({...n,fill:"#CAF982",opacity:.4,...C,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),N.areaPos={startPos:o,endPos:i.pointer},y.value.add(N)}))}(),{redrawPoints:ne,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),te(n,"remove")):(Object.assign(n,{data:{time:w(e.pointer.x),value:b(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),te({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:le,setPopup:ie,updateData:te,getGridPoints:ae,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{y as useCenter};
1
+ import{onUnmounted as e}from"vue";import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as n,drawLine as i,drawPoint as o}from"../useDraw.js";import{useGrid as l}from"../useGrid.js";import{useBirthProcessCumputedPoint as r}from"../useCumputedPoint.js";import{bus as a}from"../useEvent.js";import{useCommon as s}from"../useCommon.js";import{getPointRange as f,getIndex as c,isEffectiveNode as u,getTime as d}from"../../utils/index.js";import{cloneDeep as p,omit as m}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"naive-ui";import{useIntervalFn as v}from"@vueuse/core";function g(g,y,h,k,x){const{cumputedX:L,cumputedY:P,getXValue:b,getYValue:w}=r(y),{xCellWidth:A,pointSelectionStyle:I,originX:C,endX:K,originY:j,endY:E,event:X,scaleValues:M,xAxis:T,startTime:V,timeXCell:Y,itemList:S,dialog:$}=y,F=new Map,O=new Set,D=p(M);let _=[],z=null;const N=new Set;l(g,y);const{getEqualXTypes:G,handleAddPrevent:J,setPrevAndNextPoint:q}=s(g,h,y),{pause:R,resume:W}=v((()=>{!function(){if(!N.size)return;for(const e of N)e.set("opacity",1===e.opacity?.5:1);g.value.renderAll()}()}),800);function B(){D.forEach((e=>{e.dataList.forEach(((t,n)=>{t.show&&(!function(e,t){const{max:n={},min:o={}}=e.panicValue||{},{max:l={},min:r={}}=e.diffValue||{};function a({show:e=!1,value:n,name:o,lineStyle:l}){if(!e||!n)return;const r=P(t.type,t.range,n),a=i([C,r,K,r],{...l,evented:!0,lockMovementX:!0,lockMovementY:!0,hoverCursor:"pointer"});X.hovered&&o&&(a.on("mousemove",(({pointer:e})=>{k.point={...e||{x:a.left,y:a.top}},k.list=[`${o} ${n}${t.unit||""}`],k.show=!0})),a.on("mouseout",(()=>{k.show=!1}))),g.value.add(a)}a(n),a(o),a(l),a(r)}(t,e),Z(t,n,e))}))}))}function H(e=[]){if(!(null==z?void 0:z.areaPos))return[];const{startPos:t,endPos:n}=z.areaPos,[i,o]=[t.x,n.x].sort(((e,t)=>e-t)),[l,r]=[t.y,n.y].sort(((e,t)=>e-t));return(e.length?e:se()).filter((e=>e.left>=i&&e.left<=o&&e.top>=l&&e.top<=r))}function Q(e){$.warning({maskClosable:!1,closeOnEsc:!1,title:"警告",content:"确认删除当前选中的节点?",positiveText:"确定",negativeText:"取消",onPositiveClick:()=>{e(),U()},onNegativeClick:()=>U(),onClose:()=>U()})}function U(){z&&g.value.remove(z),z=null}function Z(e,t,n){var l;const{type:r,unit:a,dataList:s=[]}=n,f=[];F.set(e.key,[]),function(e,t){N.size&&[...N].forEach((n=>{const{dataIndex:i,type:o}=n.origin;i===t&&o===e&&N.delete(n)}))}(r,t),null==(l=e.list)||l.forEach(((l,c)=>{!function(e,l,c,u){var d;let p,v,x=u;l.key&&(x=s.find((e=>e.key===l.key)));const{pointAttr:L={},lineAttr:P={},title:I="",key:C,type:K="circle"}=x,j=ae(u.list[c+1],n);e&&j&&!l.breakpoint&&e[0]!==j[0]&&(v=i([...e,...j],P));const E=f[c-1],M={origin:{data:l,title:I,key:u.key,selfKey:C,unit:a,type:r,dataIndex:t,index:c,lineAttr:P},__type:"main",leftLine:E,rightLine:v,...L,...y.event.hovered?y.event.evented?{selectable:!0}:{selectable:!0,lockMovementX:!0,lockMovementY:!0}:y.event};E?p=o(K,{left:E.get("x2"),top:E.get("y2"),...M}):e&&(M.leftLine=null,p=o(K,{left:e[0],top:e[1],...M}));f.push(v),p&&(p.originLeft=p.left,p.originTop=p.top,function(e){X.hovered&&(e.on("mouseover",(()=>{le(e,"hover")})),e.on("mouseout",(()=>{k.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{re(e),function(e){var t,n;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(n=e.rightLine)||n.setCoords().set({x1:e.left,y1:e.top})}(e),X.hovered&&le(e),function(e){var t,n,i,o;const{originLeft:l,originTop:r,left:a,top:s,origin:f}=e,c=~~((a-l)/A);if(a>l+A){if(0===_.length){te(e,[...e.leftLine?[e.leftLine.x1,e.leftLine.y1]:[l,r],l,r]),null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,"stroke","transparent"),null==(o=null==(i=e.rightLine)?void 0:i.set)||o.call(i,"stroke","transparent")}const u=l+A*c;if(_.every((e=>e.left!==u))){const t=b(u),n=w(f.type,s);_.push({data:{time:t,value:n,...f.selfKey!==f.key?{key:f.selfKey}:{}},left:u,top:s}),te(e,[...e.prevPointer,u,s])}if(_.length<c&&function(e,t){const{originLeft:n,originTop:i,origin:o}=e;let l=1;for(;l<=t;){const t=n+A*l,r=_.some((e=>Math.abs(e.left-t)<=1));if(!r){let l=0;const r=_.find(((e,n)=>(e.left>t&&(l=n),e.left>t)));if(r){const a=JSON.parse(JSON.stringify(r)),s=_[l-1]||{left:n,top:i},f=~~((r.left-(t-A))/A),c=(r.top-s.top)/f;a.top=s.top+c,a.left=t,a.data={time:b(t),value:w(o.type,a.top),...o.selfKey!==o.key?{key:o.selfKey}:{}},_.splice(l,0,a),te(e,[s.left,s.top,a.left,a.top])}}l++}}(e,c),e.nextPoint){const t=F.get(f.key);!function(e,t){const{left:n,top:i,origin:o}=t,l=A/2,r=e.findIndex((e=>Math.abs(n-e.left)<l&&Math.abs(i-e.top)<l&&o.index!==e.origin.index));r>-1?(t.set({scaleX:2.5,scaleY:2.5}),t.coincidePoint=e[r]):t.set({scaleX:t.scale,scaleY:t.scale})}(t,e),null==t||t.forEach((e=>{e.left<=l||f.index===e.origin.index||(e.left<a?ee(e,"#999"):ee(e,e.origin.lineAttr.stroke))}))}}!function(e){var t,n;const{left:i}=e;if(_.length>0&&i<_[_.length-1].left){for(const e of O)e.left>i&&(e.leftLine&&g.value.remove(e.leftLine),g.value.remove(e));if(_=_.filter((e=>e.left<=i)),0===_.length){null==(n=null==(t=e.leftLine)?void 0:t.set)||n.call(t,e.origin.lineAttr);for(const e of O)e.leftLine&&g.value.remove(e.leftLine),g.value.remove(e)}if(_.length>0){const t=_.at(-1);e.prevPointer=[t.left,t.top]}}}(e)}(e)})),e.on("mouseup",(t=>{if(k.show=!1,1===t.button){const{type:t,selfKey:n,dataIndex:i}=e.origin,o={...e.origin,data:{...e.origin.data,time:b(e.left),value:w(t,e.top)}};if(g.value.discardActiveObject(),_.length>0){const l=D.find((e=>e.type===t));let r=-1;const a=_.map((e=>e.data));if(e.nextPoint){if(2.5!==e.scaleX)return void ie({dataIndex:i,scaleValue:l});const t=e.coincidePoint.origin,n=t.data;r=t.index;const o=a.findIndex((e=>e.time===n.time));o>-1?a[o].value=n.value:a.push({...a.at(-1),time:n.time,value:n.value})}const s=l.dataList.findIndex((e=>e.key===n));h("add",{...m(o,["index","selfKey","lineAttr"]),dataIndex:s,key:n,data:a}),ne({...o,data:a,coincideIndex:r})}else h("change",{...m(o,["selfKey","lineAttr"]),key:n}),ne(o,"change")}}))}(p),null==(d=F.get(u.key))||d.push(p))}(ae(l,n),l,c,e)})),Promise.all(F.get(e.key)).then((t=>{const n=f.filter((e=>e));q(t),g.value.add(...n,...t),function(e,t){const{max:n={},min:i={}}=t.panicValue||{},{max:o={},min:l={}}=t.diffValue||{};function r({show:t=!1,value:n,flickerable:i},o){!t&&n&&i&&e.forEach((e=>{const t=e.origin.data.value;"max"===o&&t<n||"min"===o&&t>n||N.add(e)}))}r(n,"max"),r(i,"min"),r(o,"max"),r(l,"min")}(t,e)}))}function ee(e,t){["stroke","fill"].forEach((n=>{const i=e[n];i&&!["transparent","#fff","#ffffff","#FFFFFF"].includes(i)&&i!==t&&e.set(n,t)})),e.rightLine&&e.rightLine.stroke!==t&&e.rightLine.set("stroke",t)}function te(e,t){const[,,n,o]=t;e.clone((l=>{l.set({left:n,top:o,scaleX:1,scaleY:1}),e.prevPointer=[n,o];const r=i(t,e.origin.lineAttr);l.leftLine=r,O.add(l),g.value.add(r,l)}))}function ne(e,t="add",n=1){const{data:i,index:o,key:l,type:r,coincideIndex:a}=e;let{dataIndex:s}=e;const f=D.find((e=>e.type===r)),u=f.dataList.find(((e,t)=>(s=t,e.key===l)));switch(t){case"remove":u.list.splice(o,n),u.list[o-1]&&(u.list[o-1].breakpoint=!0);break;case"change":u.list[o]=i;break;default:{const e=Array.isArray(i)?i[0].time:i.time,t=c(e,u.list),n=Array.isArray(i)?i:[i];u.list.splice(t,a>-1?a-t+1:0,...n);break}}ie({dataIndex:s,scaleValue:f})}function ie(e){var t,n,i;if(O.size&&(null==(t=g.value)||t.remove(...oe([...O]))),O.clear(),_=[],e){const{dataIndex:t,scaleValue:i}=e,o=i.dataList[t];null==(n=g.value)||n.remove(...oe(F.get(o.key))),F.delete(o.key),Z(o,t,i)}else F.size&&(null==(i=g.value)||i.remove(...oe(se()))),F.clear(),B()}function oe(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)})),t}function le(e,t="moving"){const{title:n,type:i,data:o,unit:l}=e.origin;k.point={x:e.left,y:e.top};const r=`${"hover"===t?o.value:w(i,e.top)}`;k.list=[`${n} ${r}${l||""}`,`时间 ${b(e.left).slice(-5)}`],k.show=!0}function re(e){e.setCoords();const t=6e4/Y,n=e.prevPoint?e.prevPoint.left+t:C,i=K;e.top<j&&e.set("top",j),e.top>E&&e.set("top",E),e.left<n&&e.set("left",n),e.left>i&&e.set("left",i)}function ae(e,t){if(u(e)&&function(e){const t=Date.parse(T.list.at(-1)),n=d(e);return n>=V&&n<=t}(e.time)){const n=L(e.time),i=P(t.type,t.range,e.value);return[n,i<j?j:i>E?E:i]}}function se(){return Array.from(F.values()).flat()}return e((()=>{R()})),B(),function(){if(!X.evented)return;let e=!1,i={x:0,y:0};g.value.on("mouse:up",(t=>{if(3===t.button&&function(e){const{x:t=0,y:n=0}=e.pointer||{};if(t>=C&&t<=K&&n>=j&&n<=E)if(e.target){if("main"!==e.target.__type)return;i(e.pointer,e.target,["删除节点"]);const{minLeft:t,maxLeft:n,minTop:o,maxTop:l}=f(e.target);se().forEach((i=>{"main"===i.__type&&i.left>t&&i.left<n&&i.top>o&&i.top<l&&x.list.push({renderItem:()=>i.origin.title,origin:{...i.origin},mode:"remove",pointer:e.pointer})})),1===x.list.length&&(x.show=!1,console.log("当前时间段内无可删除节点"))}else i(e.pointer,null,["新增节点"]),S.forEach((n=>{G(se(),t,"key",2*A).includes(n.linkKey||n.key)||x.list.push({renderItem:()=>n.title,origin:{title:n.title,unit:n.unit,type:n.bigType,dataIndex:n.dataIndex,key:n.key,linkKey:n.linkKey},pointer:e.pointer})})),1===x.list.length&&(x.show=!1,J("repeat"),console.log("当前时间段内无可新增节点"));function i(e,t,n){Object.assign(x,{point:e,show:!0,target:t,list:n})}}(t),1===t.button&&e){e=!1;const t=H();t.length>0?Q((()=>{const e=function(e){const t=e.reduce(((e,t)=>{const{key:n}=t.origin;return e[n]=e[n]?e[n].concat(t.origin):[t.origin],e}),{});return Object.keys(t).map((e=>{const n=t[e].sort(((e,t)=>Date.parse(e.data.time)-Date.parse(t.data.time)));return ne(n[0],"remove",n.length),n.map((e=>({...m(e,["selfKey","lineAttr"]),key:e.selfKey})))}))}(t);h("remove",e)})):a.emit(z)}})),g.value.on("mouse:down",(t=>{1!==t.button||t.target||(e=!0,i=t.pointer)})),g.value.on("mouse:move",(o=>{if(!e)return;const{x:l,y:r}=i,{x:a,y:s}=o.pointer;z&&g.value.remove(z),z=new t.Rect({...n,fill:"#CAF982",opacity:.4,...I,left:l,top:r,width:a-l,height:s-r,objectCaching:!0}),z.areaPos={startPos:i,endPos:o.pointer},g.value.add(z)}))}(),{redrawPoints:ie,clickMenu:function({item:e,target:t}){const n={...e.origin};"remove"===e.mode?(h("remove",n),ne(n,"remove")):(Object.assign(n,{data:{time:b(e.pointer.x),value:w(e.origin.type,e.pointer.y),...e.origin.linkKey?{key:e.origin.key}:{}}}),h("add",n),ne({...n,key:e.origin.linkKey||e.origin.key}))},moveLimit:re,setPopup:le,updateData:ne,getGridPoints:se,getContainPoints:H,showDialog:Q,removeCurrentSelection:U}}export{g as useCenter};
@@ -1 +1 @@
1
- import{ref as e,computed as t,reactive as a,onMounted as l,nextTick as u}from"vue";import{defaultBorderStyle as i}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as r}from"../useCumputedPoint.js";import{useCanvasEvent as n}from"../useEvent.js";import{setOtherType as o,getFloorNumber as s}from"../../utils/index.js";import"lodash-es";import{format as d,addDays as v}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as c}from"./useTop.js";import{useLeft as p}from"./useLeft.js";import{useRight as h}from"./useRight.js";import{useCenter as g}from"./useCenter.js";import{useBottom as m}from"./useBottom.js";import{useOther as f}from"./useOther.js";function y(y,Y,S,b,w,C){const x=15,D=e(),j=e(),V=e(),X=t((()=>{const{top:e}=Y.data;return e.date.show&&(e.date.height||x)||0})),H=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||x)||0})),L=t((()=>{var e;const{top:t}=Y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||x)||0})),I=t((()=>{var e,t,a;const{top:l}=Y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||x)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),M=t((()=>{var e;const{bottom:t}=Y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),P=t((()=>{const{grid:e}=Y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),N=t((()=>{const{grid:e}=Y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),O=t((()=>{var e;const{width:t,right:a=null,top:l}=Y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),W=t((()=>{const{grid:e}=Y.data;return O.value-e.surplusXCell*q.value})),$=t((()=>{const{top:e,left:t}=Y.data;return e.titleWidth+T.value})),k=t((()=>{const{bottom:e=null,height:t}=Y.data;if(!e)return t;return t-(e.height||30)})),G=t((()=>{var e;const{top:t}=Y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||x)||0;return X.value+a+l+H.value+L.value})),R=t((()=>{const{grid:e}=Y.data;return G.value+e.surplusYCell*z.value})),q=t((()=>(O.value-$.value)/P.value)),z=t((()=>(k.value-G.value)/N.value)),T=t((()=>{var e,t;const{left:a}=Y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),A=t((()=>{var e,t;const{top:a,grid:l}=Y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=$.value-q.value;const n=a.date.startDate||d(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(d(v(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=q.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+q.value/2,scaleCell:(l-a)/q.value}})))).flat()})),B=t((()=>ue("breathe"))),E=t((()=>ue("pulse"))),F=t((()=>ue("temperature"))),J=t((()=>ue("pain"))),K=t((()=>{var e;return(null==(e=Y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),Q=t((()=>{const{left:e}=Y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:o(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),U=t((()=>{const{left:e}=Y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),Z=t((()=>{const{grid:e}=Y.data;return-1===U.value?0:z.value*e.subYCell})),_=t((()=>{const{left:e}=Y.data,t={originY:k.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value,t.endY=R.value+Z.value):U.value===e.yScaleValue.length-1&&(t.originY=k.value-Z.value,t.endY=k.value),t})),ee=t((()=>{const{left:e}=Y.data,t={originY:G.value,endY:k.value};return 0===U.value&&e.yScaleValue.length>1?(t.originY=R.value+Z.value,t.endY=k.value):U.value===e.yScaleValue.length-1&&(t.originY=R.value,t.endY=k.value-Z.value),t})),te=t((()=>{var e,t;const{top:a,grid:l}=Y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),ae=t((()=>{var e;const{left:t,right:a}=Y.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>s(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),le=a({canvasWidth:Y.data.width,canvasHeight:Y.data.height,borderStyle:{...i,...Y.data.borderStyle||{}},selectionStyle:Y.data.selectionStyle||{},dateHeight:X.value,hospitalDaysHeight:H.value,operationDaysHeight:L.value,xScalevalueHeight:I.value,topList:te.value,breathingHeight:M.value,hospitalizationDate:Y.data.hospitalizationDate,grid:Y.data.grid,top:Y.data.top,left:Y.data.left,right:Y.data.right,bottom:Y.data.bottom,other:Y.data.other,painIndex:U.value,painHeight:Z.value,painOriginY:_.value,vitalSignsOriginY:ee.value,gridXNumber:P.value,gridYNumber:N.value,iconsWidth:T.value,originX:$.value,originY:G.value,originYLimit:R.value,endX:O.value,endXLimit:W.value,endY:k.value,xCellWidth:q.value,yCellHeight:z.value,xScaleList:A.value,breatheYCell:B.value,pulseYCell:E.value,temperatureYCell:F.value,painYCell:J.value,event:K.value,itemList:Q.value,getRightInfo:ae.value,config:Y.data.config||{}});function ue(e){const{yScaleValue:t}=Y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?z.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ie,cumputedY:re,getXValue:ne,getYValue:oe}=r(le);return l((()=>{u((()=>{c(y,le);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=g(y,le,S,ie,re,ne,oe,Y.addRenderItem,w,C);j.value=l,V.value=u;const{drawScaleValue:r}=p(y,le,S,e,w,ie,re,ne,oe,t,a,i);h(y,le,r),m(y,le),f(y,le,ie);const{select:o}=n(y,le,S);D.value=o}))})),{propItems:le,redrawPoints:j,select:D,clickMenu:V}}export{y as useTemperatureChart};
1
+ import{ref as e,computed as t,reactive as a,watch as l}from"vue";import{defaultBorderStyle as u}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import{useCumputedPoint as i}from"../useCumputedPoint.js";import{useCanvasEvent as r}from"../useEvent.js";import{setOtherType as n,getFloorNumber as o}from"../../utils/index.js";import"lodash-es";import{format as s,addDays as d}from"date-fns";import"naive-ui";import"@vueuse/core";import{useTop as v}from"./useTop.js";import{useLeft as c}from"./useLeft.js";import{useRight as p}from"./useRight.js";import{useCenter as h}from"./useCenter.js";import{useBottom as g}from"./useBottom.js";import{useOther as m}from"./useOther.js";function f(f,y,Y,S,b,w){const C=15,x=e(),D=e(),j=e(),V=t((()=>{const{top:e}=y.data;return e.date.show&&(e.date.height||C)||0})),X=t((()=>{var e;const{top:t}=y.data;return(null==(e=t.hospitalDays)?void 0:e.show)&&(t.hospitalDays.height||C)||0})),H=t((()=>{var e;const{top:t}=y.data;return(null==(e=t.operationDays)?void 0:e.show)&&(t.operationDays.height||C)||0})),L=t((()=>{var e,t,a;const{top:l}=y.data;return((null==(e=l.xScalevalue)?void 0:e.show)&&(l.xScalevalue.height||C)||0)+((null==(t=l.xScalevalue)?void 0:t.show)&&null!=(a=l.dayHeight)?a:0)})),I=t((()=>{var e;const{bottom:t}=y.data;return(null==(e=null==t?void 0:t.breathing)?void 0:e.show)&&(t.breathing.height||30)||0})),M=t((()=>{const{grid:e}=y.data;return e.mainXCell*e.subXCell+e.surplusXCell})),P=t((()=>{const{grid:e}=y.data;return e.mainYCell*e.subYCell+e.surplusYCell})),N=t((()=>{var e;const{width:t,right:a=null,top:l}=y.data;if(!a)return t;return t-(null!=(e=a.width)?e:0)})),O=t((()=>{const{grid:e}=y.data;return N.value-e.surplusXCell*R.value})),W=t((()=>{const{top:e,left:t}=y.data;return e.titleWidth+z.value})),$=t((()=>{const{bottom:e=null,height:t}=y.data;if(!e)return t;return t-(e.height||30)})),k=t((()=>{var e;const{top:t}=y.data,a=t.xScalevalue.show&&(null!=(e=t.dayHeight)?e:0)||0,l=t.xScalevalue.show&&(t.xScalevalue.height||C)||0;return V.value+a+l+X.value+H.value})),G=t((()=>{const{grid:e}=y.data;return k.value+e.surplusYCell*q.value})),R=t((()=>(N.value-W.value)/M.value)),q=t((()=>($.value-k.value)/P.value)),z=t((()=>{var e,t;const{left:a}=y.data;return(null==(e=a.icons)?void 0:e.show)&&((null==(t=a.icons)?void 0:t.width)||100)||0})),T=t((()=>{var e,t;const{top:a,grid:l}=y.data,u=(null==(t=null==(e=a.date.list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],i=a.xScalevalue.times;let r=W.value-R.value;const n=a.date.startDate||s(new Date,"yyyy-MM-dd");return u.reduce(((e,t,a)=>0===a?e.concat(n):e.concat(s(d(new Date(n.replace(/-/g,"/")),a),"yyyy-MM-dd"))),[]).map((e=>i.map((t=>{r+=R.value;const a=Date.parse(`${e} ${t.start}`),l=Date.parse(`${e} ${t.end}`);return{start:a,end:l,left:r,center:r+R.value/2,scaleCell:(l-a)/R.value}})))).flat()})),A=t((()=>le("breathe"))),B=t((()=>le("pulse"))),E=t((()=>le("temperature"))),F=t((()=>le("pain"))),J=t((()=>{var e;return(null==(e=y.data.grid)?void 0:e.event)||{selectable:!0,evented:!0,hovered:!0}})),K=t((()=>{const{left:e}=y.data;return e.yScaleValue.map((e=>e.dataList.filter((e=>e.show)).map(((t,a)=>({...t,bigType:n(t.title,e.type),unit:e.unit,dataIndex:a}))))).flat()})),Q=t((()=>{const{left:e}=y.data;return e.yScaleValue.findIndex((e=>"pain"===e.type))})),U=t((()=>{const{grid:e}=y.data;return-1===Q.value?0:q.value*e.subYCell})),Z=t((()=>{const{left:e}=y.data,t={originY:$.value,endY:$.value};return 0===Q.value&&e.yScaleValue.length>1?(t.originY=G.value,t.endY=G.value+U.value):Q.value===e.yScaleValue.length-1&&(t.originY=$.value-U.value,t.endY=$.value),t})),_=t((()=>{const{left:e}=y.data,t={originY:k.value,endY:$.value};return 0===Q.value&&e.yScaleValue.length>1?(t.originY=G.value+U.value,t.endY=$.value):Q.value===e.yScaleValue.length-1&&(t.originY=G.value,t.endY=$.value-U.value),t})),ee=t((()=>{var e,t;const{top:a,grid:l}=y.data,u=[];for(const i in a)a[i].show&&u.push({...a[i],list:(null==(t=null==(e=a[i].list)?void 0:e.slice)?void 0:t.call(e,0,l.mainXCell))||[],key:i});return u.sort(((e,t)=>e.seq-t.seq))})),te=t((()=>{var e;const{left:t,right:a}=y.data,l=t.yScaleValue.find((e=>"temperature"===e.type)),u=(null==a?void 0:a.yScaleValue)||{};return(null==(e=null==l?void 0:l.list)?void 0:e.length)&&Object.assign(u,{list:l.list.map((e=>o(1.8*e+32))),spaceGridNumber:l.spaceGridNumber}),u})),ae=a({canvasWidth:y.data.width,canvasHeight:y.data.height,borderStyle:{...u,...y.data.borderStyle||{}},selectionStyle:y.data.selectionStyle||{},dateHeight:V.value,hospitalDaysHeight:X.value,operationDaysHeight:H.value,xScalevalueHeight:L.value,topList:ee.value,breathingHeight:I.value,hospitalizationDate:y.data.hospitalizationDate,grid:y.data.grid,top:y.data.top,left:y.data.left,right:y.data.right,bottom:y.data.bottom,other:y.data.other,painIndex:Q.value,painHeight:U.value,painOriginY:Z.value,vitalSignsOriginY:_.value,gridXNumber:M.value,gridYNumber:P.value,iconsWidth:z.value,originX:W.value,originY:k.value,originYLimit:G.value,endX:N.value,endXLimit:O.value,endY:$.value,xCellWidth:R.value,yCellHeight:q.value,xScaleList:T.value,breatheYCell:A.value,pulseYCell:B.value,temperatureYCell:E.value,painYCell:F.value,event:J.value,itemList:K.value,getRightInfo:te.value,config:y.data.config||{}});function le(e){const{yScaleValue:t}=y.data.left,a=t.find((t=>t.type===e)),l=(null==a?void 0:a.list)||[];return l.length?q.value/((l[1]-l[0])/a.spaceGridNumber):0}const{cumputedX:ue,cumputedY:ie,getXValue:re,getYValue:ne}=i(ae);return l((()=>f.value),(e=>{e&&function(){v(f,ae);const{setPopup:e,isAddPoint:t,updateData:a,redrawPoints:l,clickMenu:u,gridPoints:i}=h(f,ae,Y,ue,ie,re,ne,y.addRenderItem,b,w);D.value=l,j.value=u;const{drawScaleValue:n}=c(f,ae,Y,e,b,ue,ie,re,ne,t,a,i);p(f,ae,n),g(f,ae),m(f,ae,ue);const{select:o}=r(f,ae,Y);x.value=o}()}),{immediate:!0}),{propItems:ae,redrawPoints:D,select:x,clickMenu:j}}export{f as useTemperatureChart};
@@ -1 +1 @@
1
- .c-fabric-chart-popup-menu,.c-fabric-chart-popup-tip{display:flex;flex-flow:column nowrap;font-size:12px;margin:0;padding:8px 12px;position:absolute;z-index:1001}.c-fabric-chart-popup-menu>li,.c-fabric-chart-popup-tip>li{list-style:none}.c-fabric-chart-popup-tip{background:rgba(0,0,0,.7);border-radius:4px}.c-fabric-chart-popup-tip>li{color:#fff}.c-fabric-chart-popup-menu{background:#fff;border:1px solid #e2e6ed;border-radius:2px;box-shadow:0 2px 12px 0 rgba(56,56,56,.2);padding:8px 5px!important;z-index:1001}.c-fabric-chart-popup-menu>li{background:#fff;cursor:pointer;padding:5px}.c-fabric-chart-popup-menu>li:hover{background:#f0f7ff}.c-fabric-chart-popup-menu>li.no-click{cursor:default}.c-fabric-chart-popup-menu>li.no-click:hover{background:#fff}
1
+ .c-fabric-chart{position:relative;user-select:none}.c-fabric-chart-popup-menu,.c-fabric-chart-popup-tip{display:flex;flex-flow:column nowrap;font-size:12px;margin:0;padding:8px 12px;position:absolute;z-index:1001}.c-fabric-chart-popup-menu>li,.c-fabric-chart-popup-tip>li{list-style:none}.c-fabric-chart-popup-tip{background:rgba(0,0,0,.7);border-radius:4px}.c-fabric-chart-popup-tip>li{color:#fff}.c-fabric-chart-popup-menu{background:#fff;border:1px solid #e2e6ed;border-radius:2px;box-shadow:0 2px 12px 0 rgba(56,56,56,.2);padding:8px 5px!important;z-index:1001}.c-fabric-chart-popup-menu>li{background:#fff;cursor:pointer;padding:5px}.c-fabric-chart-popup-menu>li:hover{background:#f0f7ff}.c-fabric-chart-popup-menu>li.no-click{cursor:default}.c-fabric-chart-popup-menu>li.no-click:hover{background:#fff}
@@ -57,6 +57,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
57
57
  type: BooleanConstructor;
58
58
  default: boolean;
59
59
  };
60
+ showHeadFilter: {
61
+ type: BooleanConstructor;
62
+ default: boolean;
63
+ };
60
64
  }, {
61
65
  fieldsMapping: Record<string, string>;
62
66
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -115,6 +119,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
115
119
  type: BooleanConstructor;
116
120
  default: boolean;
117
121
  };
122
+ showHeadFilter: {
123
+ type: BooleanConstructor;
124
+ default: boolean;
125
+ };
118
126
  }>> & {
119
127
  onReset?: ((...args: any[]) => any) | undefined;
120
128
  onClose?: ((...args: any[]) => any) | undefined;
@@ -132,6 +140,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
132
140
  field: string;
133
141
  checkedAll?: boolean | undefined;
134
142
  disabledAll?: boolean | undefined;
143
+ isHeadCheckHide?: boolean | undefined;
135
144
  isShow?: boolean | undefined;
136
145
  }[]>;
137
146
  fieldList: import("vue").ComputedRef<import("../../../es/shared/types").AnyObject[]>;
@@ -142,6 +151,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
142
151
  field: string;
143
152
  checkedAll?: boolean | undefined;
144
153
  disabledAll?: boolean | undefined;
154
+ isHeadCheckHide?: boolean | undefined;
145
155
  isShow?: boolean | undefined;
146
156
  }[];
147
157
  fieldList: import("../../../es/shared/types").AnyObject[];
@@ -388,6 +398,24 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
388
398
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
389
399
  }>>;
390
400
  emit: (event: "updateChecked", ...args: any[]) => void;
401
+ isCheckboxShow: (item: Partial<{
402
+ [key: string]: any;
403
+ id: string;
404
+ name: string;
405
+ show: boolean;
406
+ sort: boolean;
407
+ sortDirection: "NONE" | "ASC" | "DESC";
408
+ title: string;
409
+ alias: string;
410
+ fixedShow: boolean;
411
+ fixedWay: "NONE" | "LEFT" | "RIGHT";
412
+ columnWidth: number | null;
413
+ editable: boolean;
414
+ editableDisable: boolean;
415
+ required: boolean;
416
+ requiredDisable: boolean;
417
+ hide: boolean;
418
+ }>, key: string) => any;
391
419
  getSortPriorityOptions: () => {
392
420
  label: string;
393
421
  value: number;
@@ -570,6 +598,10 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
570
598
  type: BooleanConstructor;
571
599
  default: boolean;
572
600
  };
601
+ showHeadFilter: {
602
+ type: BooleanConstructor;
603
+ default: boolean;
604
+ };
573
605
  }>> & {
574
606
  onReset?: ((...args: any[]) => any) | undefined;
575
607
  onClose?: ((...args: any[]) => any) | undefined;
@@ -600,5 +632,6 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
600
632
  customColumns: import("./src/types").FieldSetColumnItem[];
601
633
  showSearch: boolean;
602
634
  showSortPriority: boolean;
635
+ showHeadFilter: boolean;
603
636
  }>>;
604
637
  export default FieldSet;
@@ -59,6 +59,10 @@ declare const _default: import("vue").DefineComponent<{
59
59
  type: BooleanConstructor;
60
60
  default: boolean;
61
61
  };
62
+ showHeadFilter: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
62
66
  }, {
63
67
  fieldsMapping: Record<string, string>;
64
68
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -117,6 +121,10 @@ declare const _default: import("vue").DefineComponent<{
117
121
  type: BooleanConstructor;
118
122
  default: boolean;
119
123
  };
124
+ showHeadFilter: {
125
+ type: BooleanConstructor;
126
+ default: boolean;
127
+ };
120
128
  }>> & {
121
129
  onReset?: ((...args: any[]) => any) | undefined;
122
130
  onClose?: ((...args: any[]) => any) | undefined;
@@ -134,6 +142,7 @@ declare const _default: import("vue").DefineComponent<{
134
142
  field: string;
135
143
  checkedAll?: boolean | undefined;
136
144
  disabledAll?: boolean | undefined;
145
+ isHeadCheckHide?: boolean | undefined;
137
146
  isShow?: boolean | undefined;
138
147
  }[]>;
139
148
  fieldList: import("vue").ComputedRef<AnyObject[]>;
@@ -144,6 +153,7 @@ declare const _default: import("vue").DefineComponent<{
144
153
  field: string;
145
154
  checkedAll?: boolean | undefined;
146
155
  disabledAll?: boolean | undefined;
156
+ isHeadCheckHide?: boolean | undefined;
147
157
  isShow?: boolean | undefined;
148
158
  }[];
149
159
  fieldList: AnyObject[];
@@ -373,6 +383,24 @@ declare const _default: import("vue").DefineComponent<{
373
383
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
374
384
  }>>;
375
385
  emit: (event: "updateChecked", ...args: any[]) => void;
386
+ isCheckboxShow: (item: Partial<{
387
+ [key: string]: any;
388
+ id: string;
389
+ name: string;
390
+ show: boolean;
391
+ sort: boolean;
392
+ sortDirection: "NONE" | "ASC" | "DESC";
393
+ title: string;
394
+ alias: string;
395
+ fixedShow: boolean;
396
+ fixedWay: "NONE" | "LEFT" | "RIGHT";
397
+ columnWidth: number | null;
398
+ editable: boolean;
399
+ editableDisable: boolean;
400
+ required: boolean;
401
+ requiredDisable: boolean;
402
+ hide: boolean;
403
+ }>, key: string) => any;
376
404
  getSortPriorityOptions: () => {
377
405
  label: string;
378
406
  value: number;
@@ -555,6 +583,10 @@ declare const _default: import("vue").DefineComponent<{
555
583
  type: BooleanConstructor;
556
584
  default: boolean;
557
585
  };
586
+ showHeadFilter: {
587
+ type: BooleanConstructor;
588
+ default: boolean;
589
+ };
558
590
  }>> & {
559
591
  onReset?: ((...args: any[]) => any) | undefined;
560
592
  onClose?: ((...args: any[]) => any) | undefined;
@@ -585,5 +617,6 @@ declare const _default: import("vue").DefineComponent<{
585
617
  customColumns: FieldSetColumnItem[];
586
618
  showSearch: boolean;
587
619
  showSortPriority: boolean;
620
+ showHeadFilter: boolean;
588
621
  }>;
589
622
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as y,createTextVNode as v,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as A,NCheckbox as _,NTooltip as S,NIcon as C,NPopconfirm as W,NButton as E}from"naive-ui";import P from"../../../shared/components/VueDraggable/src/vuedraggable.js";import q from"./components/Row.vue.js";import{isArray as F,cloneDeep as N,isString as R,omit as j}from"lodash-es";import{isDisable as B,setStyle as I,getGroupTree as U}from"./utils/index.js";import{uuidGenerator as D}from"../../../shared/utils/index.js";import{HelpCircleSharp as O}from"@vicons/ionicons5";const T={class:"c-field-set__table-header"},V=h("span",null,"数值越小,优先级越高",-1),K=["tabindex"],L={key:1,class:"c-field-set__table-footer"};var G=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:G,emit:H}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y,fieldList:Z,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{H("save",{tableFields:ae()})},ie=()=>{H("close")};function oe(){X.value=de(),ne(),H("reset")}function de(){const e=N(M.fields).map((e=>({...e,uuid:D()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return U(M.groupSetting,e).reduce(((t,i)=>{const o=R(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>j(e,["uuid"])))}function re(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function se(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function ne(){var e,l;(null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),Y.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!M.isEdit||"sortPriority"===e.field&&!M.showSortPriority)}(e),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!B(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),ne())}),{immediate:!0,deep:!0}),G({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:r({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),s(n(A),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(re,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:r(n(I)(e))},["checkbox"===e.type?(d(),s(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{B(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:y((()=>[v(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])):f("v-if",!0),v(" "+b("checkbox"!==e.type?e.title:"")+" ",1),"sortPriority"===e.field?(d(),s(n(S),{key:1,trigger:"hover"},{trigger:y((()=>[k(n(C),{component:n(O),style:{top:"2px"}},null,8,["component"])])),default:y((()=>[V])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(n(P),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:y((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[n(F)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),s(q,g(ee,{key:t,element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(q,g({key:1},ee,{element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"]))],8,K))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",L,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:oe},{trigger:y((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:y((()=>[v("恢复默认设置")])),_:1})])),default:y((()=>[v(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:ie},{default:y((()=>[v("取消")])),_:1}),k(n(E),{type:"primary",onClick:te},{default:y((()=>[v("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{G as default};
1
+ import{defineComponent as e,ref as l,computed as t,reactive as i,watch as o,openBlock as d,createElementBlock as a,normalizeStyle as r,createBlock as s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,withCtx as y,createTextVNode as v,toDisplayString as b,createVNode as k,mergeProps as g,renderSlot as x}from"vue";import{useThemeVars as w,NInput as S,NCheckbox as A,NTooltip as _,NIcon as C,NPopconfirm as F,NButton as W}from"naive-ui";import E from"../../../shared/components/VueDraggable/src/vuedraggable.js";import H from"./components/Row.vue.js";import{isArray as P,cloneDeep as q,isString as N,omit as R}from"lodash-es";import{isDisable as j,setStyle as B,getGroupTree as I}from"./utils/index.js";import{uuidGenerator as U}from"../../../shared/utils/index.js";import{HelpCircleSharp as D}from"@vicons/ionicons5";const O={class:"c-field-set__table-header"},T=h("span",null,"数值越小,优先级越高",-1),V=["tabindex"],K={key:1,class:"c-field-set__table-footer"};var L=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1},showHeadFilter:{type:Boolean,default:!1}},emits:["save","close","reset"],setup(e,{expose:L,emit:G}){const M=e,$={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},z=l(w().value.primaryColor),J=l(""),Q=l(),X=l([]),Y=l([{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"show"},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"},{title:"表头筛选",type:"checkbox",isHeadCheckHide:!0,field:"isShowHeaderFilter"}]),Z=t((()=>X.value.flat())),ee=i({columns:Y,fieldList:Z,onUpdateChecked:function({checked:e,column:l}){const t=!e||ue(l.field);l.checkedAll=!t}}),le={keyword:J.value,idx:0,startIdx:0},te=()=>{G("save",{tableFields:ae()})},ie=()=>{G("close")};function oe(){X.value=de(),ne(),G("reset")}function de(){const e=q(M.fields).map((e=>({...e,uuid:U()})));return Object.keys($).forEach((l=>{e.forEach((e=>{"old"==M.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[$[l]]=1==e[l]:e[$[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1)}))})),function(e){if(M.groupSetting){return I(M.groupSetting,e).reduce(((t,i)=>{const o=N(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function ae(){let e=[];return e="old"==M.type?Z.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...M.isEdit?{required:e.required,editable:e.editable}:{}}))):Z.value,e.map((e=>R(e,["uuid"])))}function re(){const e=le.keyword!==J.value;let l=J.value?Z.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(J.value))return!!e||t>le.idx})):0;-1!==l||e||(l=le.startIdx),Q.value.scrollTop=52*l,Object.assign(le,{keyword:J.value,idx:l},e?{startIdx:l}:{})}function se(e){var l;return!!J.value&&(null==(l=e.title)?void 0:l.includes(J.value))}function ne(){var e,l;(null==(e=M.showColumnNames)?void 0:e.length)&&(Y.value=Y.value.filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=M.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=M.customColumns)?void 0:l.length)&&Y.value.push(...M.customColumns),M.showSeq&&Y.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),Y.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!M.isEdit||"sortPriority"===e.field&&!M.showSortPriority||"isShowHeaderFilter"===e.field&&!M.showHeadFilter)}(e),"checkbox"===e.type){const l=X.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ue(e.field)&&!l}}))}function ue(e){return X.value.flat().some((l=>!j(l,e)&&!l[e]&&"0001"!=l.id))}return o([()=>M.fields,()=>{var e;return null==(e=M.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(X.value=de(),ne())}),{immediate:!0,deep:!0}),L({getTableFields:ae}),(l,t)=>(d(),a("div",{class:"c-field-set",style:r({"--row-height":"52px","--primary-color":z.value})},[e.showSearch?(d(),s(n(S),{key:0,class:"c-field-set__search-wrapper",value:J.value,"onUpdate:value":t[0]||(t[0]=e=>J.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(re,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",O,[(d(!0),a(p,null,m(Y.value,((e,l)=>(d(),a(p,{key:l},[e.isShow?(d(),a("span",{key:0,class:"table-cell",style:r(n(B)(e))},["checkbox"!==e.type||e.isHeadCheckHide?(d(),a(p,{key:1},[v(b(e.title),1)],64)):(d(),s(n(A),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void Z.value.forEach((e=>{j(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:y((()=>[v(b(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===e.field?(d(),s(n(_),{key:2,trigger:"hover"},{trigger:y((()=>[k(n(C),{component:n(D),style:{top:"2px"}},null,8,["component"])])),default:y((()=>[T])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"c-field-set__table-body",ref_key:"tableBodyRef",ref:Q},[k(n(E),{modelValue:X.value,"onUpdate:modelValue":t[1]||(t[1]=e=>X.value=e),animation:"150","item-key":"id",draggable:".item"},{item:y((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),a("div",{key:0,class:"item",tabindex:l},[n(P)(e)?(d(!0),a(p,{key:0},m(e,((e,t)=>(d(),s(H,g(ee,{key:t,element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(H,g({key:1},ee,{element:e,idx:l+1,"is-highlight":se(e)}),null,16,["element","idx","is-highlight"]))],8,V))])),_:1},8,["modelValue"])],512),e.footerFlag?(d(),a("div",K,[f(" 底部按钮插槽 "),x(l.$slots,"footer",{},(()=>[k(n(F),{onPositiveClick:oe},{trigger:y((()=>[k(n(W),{style:{"margin-right":"8px"}},{default:y((()=>[v("恢复默认设置")])),_:1})])),default:y((()=>[v(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(W),{style:{"margin-right":"8px"},onClick:ie},{default:y((()=>[v("取消")])),_:1}),k(n(W),{type:"primary",onClick:te},{default:y((()=>[v("保存")])),_:1})]))])):f("v-if",!0)],4))}});export{L as default};
@@ -1,6 +1,6 @@
1
1
  import { PropType } from 'vue';
2
2
  import { AnyObject } from '../../../../../es/shared/types';
3
- import { FieldSetColumnItem } from '../../../../../es/components/field-set';
3
+ import { FieldSetItem, FieldSetColumnItem } from '../../../../../es/components/field-set';
4
4
  import { setStyle, isDisable } from '../utils';
5
5
  declare const _default: import("vue").DefineComponent<{
6
6
  element: {
@@ -123,6 +123,7 @@ declare const _default: import("vue").DefineComponent<{
123
123
  onUpdateChecked?: ((...args: any[]) => any) | undefined;
124
124
  }>>;
125
125
  emit: (event: "updateChecked", ...args: any[]) => void;
126
+ isCheckboxShow: (item: FieldSetItem, key: string) => any;
126
127
  getSortPriorityOptions: () => {
127
128
  label: string;
128
129
  value: number;
@@ -1 +1 @@
1
- import{defineComponent as e,openBlock as l,createElementBlock as t,Fragment as i,renderList as n,normalizeStyle as a,unref as o,createBlock as r,withCtx as u,createVNode as d,createCommentVNode as s,createElementVNode as f,normalizeClass as c,toDisplayString as p,withDirectives as m,vShow as v}from"vue";import{NTooltip as y,NIcon as h,NCheckbox as b,NSelect as k,NInput as g,NInputNumber as x}from"naive-ui";import{setStyle as N,isDisable as U}from"../utils/index.js";import{ReorderTwoOutline as E}from"@vicons/ionicons5";import{range as O}from"lodash-es";const P={class:"row"},w=["title"],C=f("span",null,"拖拽调整顺序",-1);var D=e({__name:"Row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},fieldList:{type:Array,default:()=>[]},isHighlight:{type:Boolean}},emits:["updateChecked"],setup(e,{emit:D}){const L=e,S=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],A=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}];function H(e){switch(e.field){case"fixedWay":return S;case"sortDirection":return A;case"sortPriority":return function(){const e=O(1,L.fieldList.length+1).map((e=>({label:e.toString(),value:e}))),l=L.fieldList.filter((e=>!!e.sortPriority&&e.uuid!==L.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!l.includes(e.value)))}();default:return[]}}function _(e){if("sortPriority"!==e.field)return!1;const{sortDirection:l}=L.element;return!l||"NONE"===l}return(O,S)=>(l(),t("div",P,[(l(!0),t(i,null,n(e.columns,((n,O)=>(l(),t(i,{key:O},[n.isShow?(l(),t("span",{key:0,class:"table-cell",title:e.element[n.field],style:a(o(N)(n))},["text"===n.type?(l(),t(i,{key:0},[0===O?(l(),r(o(y),{key:0,trigger:"hover"},{trigger:u((()=>[d(o(h),{style:{"margin-right":"5px",top:"2px"},component:o(E)},null,8,["component"])])),default:u((()=>[C])),_:1})):s("v-if",!0),f("span",{class:c([e.isHighlight&&"title"===n.field?"highlight":""])},p("seq"===n.field?e.idx:e.element[n.field]),3)],64)):s("v-if",!0),"checkbox"===n.type?m((l(),r(o(b),{key:1,disabled:o(U)(e.element,n.field),checked:e.element[n.field],"onUpdate:checked":[l=>e.element[n.field]=l,e=>function(e,l){D("updateChecked",{checked:e,column:l})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"select"===n.type?m((l(),r(o(k),{key:2,clearable:"",disabled:_(n),value:e.element[n.field],"onUpdate:value":[l=>e.element[n.field]=l,e=>function(e,l){"sortDirection"===l.field&&"NONE"===e&&(L.element.sortPriority=null)}(e,n)],options:H(n)},null,8,["disabled","value","onUpdate:value","options"])),[[v,"fixedWay"===n.field||"0001"!=e.element.id]]):s("v-if",!0),"input"===n.type?m((l(),r(o(g),{key:3,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(l(),r(o(x),{key:4,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l},null,8,["value","onUpdate:value"])):s("v-if",!0)],12,w)):s("v-if",!0)],64)))),128))]))}});export{D as default};
1
+ import{defineComponent as e,openBlock as l,createElementBlock as t,Fragment as i,renderList as n,normalizeStyle as a,unref as r,createBlock as o,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as f,normalizeClass as c,toDisplayString as m,withDirectives as p,vShow as v}from"vue";import{NTooltip as y,NIcon as h,NCheckbox as b,NSelect as k,NInput as g,NInputNumber as x}from"naive-ui";import{setStyle as N,isDisable as U}from"../utils/index.js";import{ReorderTwoOutline as E}from"@vicons/ionicons5";import{range as w}from"lodash-es";const C={class:"row"},H=["title"],O=f("span",null,"拖拽调整顺序",-1);var P=e({__name:"Row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},fieldList:{type:Array,default:()=>[]},isHighlight:{type:Boolean}},emits:["updateChecked"],setup(e,{emit:P}){const S=e,D=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],L=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}];function A(e){switch(e.field){case"fixedWay":return D;case"sortDirection":return L;case"sortPriority":return function(){const e=w(1,S.fieldList.length+1).map((e=>({label:e.toString(),value:e}))),l=S.fieldList.filter((e=>!!e.sortPriority&&e.uuid!==S.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!l.includes(e.value)))}();default:return[]}}function F(e){if("sortPriority"!==e.field)return!1;const{sortDirection:l}=S.element;return!l||"NONE"===l}return(w,D)=>(l(),t("div",C,[(l(!0),t(i,null,n(e.columns,((n,w)=>{return l(),t(i,{key:w},[n.isShow?(l(),t("span",{key:0,class:"table-cell",title:e.element[n.field],style:a(r(N)(n))},["text"===n.type?(l(),t(i,{key:0},[0===w?(l(),o(r(y),{key:0,trigger:"hover"},{trigger:d((()=>[u(r(h),{style:{"margin-right":"5px",top:"2px"},component:r(E)},null,8,["component"])])),default:d((()=>[O])),_:1})):s("v-if",!0),f("span",{class:c([e.isHighlight&&"title"===n.field?"highlight":""])},m("seq"===n.field?e.idx:e.element[n.field]),3)],64)):s("v-if",!0),"checkbox"===n.type?p((l(),o(r(b),{key:1,disabled:r(U)(e.element,n.field),checked:e.element[n.field],"onUpdate:checked":[l=>e.element[n.field]=l,e=>function(e,l){P("updateChecked",{checked:e,column:l})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,(C=e.element,D=n.field,"isShowHeaderFilter"===D?C.isConfiguredHeaderFilter&&"0001"!=S.element.id:"0001"!=S.element.id)]]):s("v-if",!0),"select"===n.type?p((l(),o(r(k),{key:2,clearable:"",disabled:F(n),value:e.element[n.field],"onUpdate:value":[l=>e.element[n.field]=l,e=>function(e,l){"sortDirection"===l.field&&"NONE"===e&&(S.element.sortPriority=null)}(e,n)],options:A(n)},null,8,["disabled","value","onUpdate:value","options"])),[[v,"fixedWay"===n.field||"0001"!=e.element.id]]):s("v-if",!0),"input"===n.type?p((l(),o(r(g),{key:3,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(l(),o(r(x),{key:4,value:e.element[n.field],"onUpdate:value":l=>e.element[n.field]=l},null,8,["value","onUpdate:value"])):s("v-if",!0)],12,H)):s("v-if",!0)],64);var C,D})),128))]))}});export{P as default};
@@ -23,5 +23,6 @@ export declare type FieldSetColumnItem = {
23
23
  field: string;
24
24
  checkedAll?: boolean;
25
25
  disabledAll?: boolean;
26
+ isHeadCheckHide?: boolean;
26
27
  isShow?: boolean;
27
28
  };
@@ -7839,7 +7839,9 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
7839
7839
  onKeydown: (event: KeyboardEvent) => Promise<void>;
7840
7840
  clearSpan: (uuid: string) => void;
7841
7841
  exposeEvent: {
7842
- validate(path?: string): Promise<void>;
7842
+ validate(path?: string, { force }?: {
7843
+ force?: boolean | undefined;
7844
+ }): Promise<void>;
7843
7845
  getFormValues(needCombineExtendKey?: boolean): any;
7844
7846
  setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
7845
7847
  setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
@@ -14221,7 +14223,9 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
14221
14223
  onKeydown: (event: KeyboardEvent) => Promise<void>;
14222
14224
  clearSpan: (uuid: string) => void;
14223
14225
  exposeEvent: {
14224
- validate(path?: string): Promise<void>;
14226
+ validate(path?: string, { force }?: {
14227
+ force?: boolean | undefined;
14228
+ }): Promise<void>;
14225
14229
  getFormValues(needCombineExtendKey?: boolean): any;
14226
14230
  setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
14227
14231
  setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core").Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
@@ -7841,7 +7841,9 @@ declare const _default: import("vue").DefineComponent<{
7841
7841
  onKeydown: (event: KeyboardEvent) => Promise<void>;
7842
7842
  clearSpan: (uuid: string) => void;
7843
7843
  exposeEvent: {
7844
- validate(path?: string): Promise<void>;
7844
+ validate(path?: string, { force }?: {
7845
+ force?: boolean | undefined;
7846
+ }): Promise<void>;
7845
7847
  getFormValues(needCombineExtendKey?: boolean): any;
7846
7848
  setFormValues(values: import("../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
7847
7849
  setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
@@ -14223,7 +14225,9 @@ declare const _default: import("vue").DefineComponent<{
14223
14225
  onKeydown: (event: KeyboardEvent) => Promise<void>;
14224
14226
  clearSpan: (uuid: string) => void;
14225
14227
  exposeEvent: {
14226
- validate(path?: string): Promise<void>;
14228
+ validate(path?: string, { force }?: {
14229
+ force?: boolean | undefined;
14230
+ }): Promise<void>;
14227
14231
  getFormValues(needCombineExtendKey?: boolean): any;
14228
14232
  setFormValues(values: import("../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
14229
14233
  setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
@@ -573,7 +573,9 @@ declare const _default: import("vue").DefineComponent<{}, {
573
573
  onKeydown: (event: KeyboardEvent) => Promise<void>;
574
574
  clearSpan: (uuid: string) => void;
575
575
  exposeEvent: {
576
- validate(path?: string): Promise<void>;
576
+ validate(path?: string, { force }?: {
577
+ force?: boolean | undefined;
578
+ }): Promise<void>;
577
579
  getFormValues(needCombineExtendKey?: boolean): any;
578
580
  setFormValues(values: AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
579
581
  setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../../es/components/form-render").NonFunctionPropertyNames<{
@@ -5945,7 +5945,9 @@ declare const _default: import("vue").DefineComponent<{
5945
5945
  onKeydown: (event: KeyboardEvent) => Promise<void>;
5946
5946
  clearSpan: (uuid: string) => void;
5947
5947
  exposeEvent: {
5948
- validate(path?: string): Promise<void>;
5948
+ validate(path?: string, { force }?: {
5949
+ force?: boolean | undefined;
5950
+ }): Promise<void>;
5949
5951
  getFormValues(needCombineExtendKey?: boolean): any;
5950
5952
  setFormValues(values: import("../../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
5951
5953
  setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../../es/components/form-render").NonFunctionPropertyNames<{
@@ -560,7 +560,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{}, {
560
560
  onKeydown: (event: KeyboardEvent) => Promise<void>;
561
561
  clearSpan: (uuid: string) => void;
562
562
  exposeEvent: {
563
- validate(path?: string): Promise<void>;
563
+ validate(path?: string, { force }?: {
564
+ force?: boolean | undefined;
565
+ }): Promise<void>;
564
566
  getFormValues(needCombineExtendKey?: boolean): any;
565
567
  setFormValues(values: import("../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
566
568
  setFieldState(path: string, setter: (field: Partial<Pick<import("@formily/core/esm/models/Field").Field<any, any, any, any>, import("@formily/core/esm/types").NonFunctionPropertyNames<{
@@ -555,7 +555,9 @@ declare const _default: import("vue").DefineComponent<{
555
555
  onKeydown: (event: KeyboardEvent) => Promise<void>;
556
556
  clearSpan: (uuid: string) => void;
557
557
  exposeEvent: {
558
- validate(path?: string): Promise<void>;
558
+ validate(path?: string, { force }?: {
559
+ force?: boolean | undefined;
560
+ }): Promise<void>;
559
561
  getFormValues(needCombineExtendKey?: boolean): any;
560
562
  setFormValues(values: AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
561
563
  setFieldState(path: string, setter: (field: Partial<Pick<Field<any, any, any, any>, import("@formily/core").NonFunctionPropertyNames<{
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as g,createCommentVNode as j,createElementVNode as b,withKeys as k,toDisplayString as v,renderSlot as F}from"vue";import{useTheme as C}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as H,isObject as x,isBoolean as A}from"lodash-es";import{createForm as L,onFieldValueChange as B,onFieldMount as O,onFieldUnmount as R,onFieldReact as w,onFormMount as _}from"@formily/core";import{FormProvider as D,FormConsumer as V}from"@formily/vue";import{NForm as I,NTabs as N,NTabPane as q,NConfigProvider as W}from"naive-ui";import{InjectionFormLifeCycleCaller as E,InjectionFormGraph as K}from"./constants/index.js";import{useAutoHidden as T}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as U}from"./hooks/useComplexOptions.js";import{useFormDomEvent as G,useFormExposeEvent as M}from"./hooks/useFormEvent.js";import{useFormGraph as P}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as J}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as $}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as z}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as Q}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as X}from"./hooks/useOperationalForm.js";import{useWordbookSetting as Y}from"./hooks/useWordbookSetting.js";import"../../../shared/utils/index.js";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"../index.js";import{createObjSchema as Z}from"./utils/schema.js";import{useFieldListAdaptor as ee}from"./hooks/useFieldListAdaptor.js";import{useFieldVisitor as oe}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as te}from"./hooks/useFormValidator.js";import{useAnchor as re}from"./hooks/useAnchor.js";import{useFormContext as se}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";const ae={key:0,style:{height:"54px"}},ie={style:{"white-space":"pre"}};var le=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean},emits:["formChange","annotationChange","scroll"],setup(e,{expose:le,emit:ne}){const me=e,de=C(),{nuiThemeOverrides:pe}=Q();te();const ue=o(),ce=t((()=>S(me.maxHeight)?me.maxHeight+"px":me.maxHeight)),{SchemaField:fe,businessCollector:he,formItemDepsCollector:ye,changeContextCollector:ge,formUUID:je}=se(me,ne),{anchorBarRef:be,currentAnchor:ke,updateAnchorList:ve,anchorIdList:Fe,onScroll:Ce}=re(me,ne,ue,ye),{callLifeCycle:Se}=J(me);r(E,Se),Se("onSetup");const{trigger:He}=T(),{observeFormGraph:xe,setGraph:Ae,removeGraph:Le}=P();r(K,xe);const{lowCodeEventTrigger:Be}=$(),Oe=L({initialValues:me.initialData,effects(e){B("*",(o=>{const t=o.props.name.toString();he.trigger(e,t),ye.trigger(t),ne("formChange",{fieldInstance:o,fieldKey:t,fieldName:o.title,value:o.value,context:ge.getContext(t,o.value)}),Be(o),Re(t),_e(t),Ve(t,o.value)})),O("*",Ae),R("*",Le),me.linebarAutoHidden&&(w("*",He),_((e=>e.query("*").forEach(He)))),me.anchor&&w("*",ve)}}),{lowCodeReactionsHandler:Re,triggerAllReactionsHandler:we}=z(t((()=>me.lowCodeReactions)),Oe),{operationalFormHandler:_e,triggerAllOperationalFormHandler:De}=X(t((()=>me.operationalForm)),Oe),{wordbookSettingHandler:Ve}=Y(Oe,ge);s(we),s(De);const{schemaAdaptor:Ie}=ee(he);let Ne=me.fieldList||[];const qe=t((()=>me.schema?me.schema:me.fieldList?(Ne=oe().traverse(H(me.fieldList),me.fieldVisitor),Z(Ie(Ne,me))):Z({}))),{onKeydown:We}=G({formModel:Oe,formRenderRef:ue,props:me}),{clearSpan:Ee}=U();a((()=>Ee(je)));const Ke=M({formModel:Oe,formRenderRef:ue,formItemDepsCollector:ye,getFieldList:()=>Ne,formUUID:je});return le({formModel:Oe,validate:(e="*")=>Ke.validate(e),getFormValues:(e=!0)=>Ke.getFormValues(e),async setFormValues(e,o={},t=!1,r=!0){var s,a,l,n;let m=!0,d=!0;x(o)?(d=null==(s=o.needSplitExtendKey)||s,m=null==(a=o.avoidDependKeyConnection)||a,t=null!=(l=o.avoidBusinessConnection)&&l,r=null==(n=o.overwrite)||n):A(o)&&(d=o),t&&(he.triggerLock=!0),m&&(ye.triggerDisabled=!0),Ke.setFormValues(e,d,r),await i(),he.triggerLock=!1,ye.triggerDisabled=!1},setFieldState(e,o){Ke.setFieldState(e,o)},resetFields(e="*"){Ke.resetFields(e)},queryWidget:async e=>Ke.queryWidget(e),getFieldList:()=>Ne,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(I),{class:d(["form-render",{"form-render--out-border":e.outBordered}]),"require-mark-placement":"left",style:p(m(de))},{default:u((()=>[e.anchor?(l(),c("section",ae,[f(m(N),{value:m(ke),"onUpdate:value":t[0]||(t[0]=e=>h(ke)?ke.value=e:null),type:"line",ref_key:"anchorBarRef",ref:be},{default:u((()=>[(l(!0),c(y,null,g(m(Fe),(e=>(l(),n(m(q),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):j("v-if",!0),f(m(W),{"theme-overrides":m(pe)},{default:u((()=>[b("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(ce)}),ref_key:"formRenderRef",ref:ue,onScroll:t[1]||(t[1]=(...e)=>m(Ce)&&m(Ce)(...e)),onKeydownCapture:t[2]||(t[2]=k(((...e)=>m(We)&&m(We)(...e)),["enter"]))},[f(m(D),{form:m(Oe)},{default:u((()=>[f(m(fe),{schema:m(qe)},null,8,["schema"]),e.consumer?(l(),n(m(V),{key:0},{default:u((({form:e})=>[b("div",ie,v(JSON.stringify(e.values,null,2)),1)])),_:1})):j("v-if",!0),F(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{le as default};
1
+ import{defineComponent as e,ref as o,computed as t,provide as r,onMounted as s,onUnmounted as a,nextTick as i,openBlock as l,createBlock as n,unref as m,normalizeClass as d,normalizeStyle as p,withCtx as u,createElementBlock as c,createVNode as f,isRef as h,Fragment as y,renderList as g,createCommentVNode as j,createElementVNode as b,withKeys as v,toDisplayString as k,renderSlot as F}from"vue";import{useTheme as C}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{isNumber as S,cloneDeep as H,isObject as x,isBoolean as A}from"lodash-es";import{createForm as L,onFormMount as O,onFieldValueChange as B,onFieldMount as R,onFieldUnmount as w,onFieldReact as _}from"@formily/core";import{Path as D}from"@formily/path";import{FormProvider as V,FormConsumer as I}from"@formily/vue";import{NForm as N,NTabs as q,NTabPane as W,NConfigProvider as E}from"naive-ui";import{InjectionFormLifeCycleCaller as K,InjectionFormGraph as T}from"./constants/index.js";import{useAutoHidden as U}from"./hooks/useAutoHidden.js";import{useComplexOptionsSpan as G}from"./hooks/useComplexOptions.js";import{useFormDomEvent as M,useFormExposeEvent as P}from"./hooks/useFormEvent.js";import{useFormGraph as J}from"./hooks/useFormGraph.js";import{useFormRenderLifeCycle as $}from"./hooks/useFormRenderLifeCycle.js";import{useLowCodeEvent as z}from"./hooks/useLowCodeEvent.js";import{useLowCodeReactions as Q}from"./hooks/useLowCodeReactions.js";import{useNuiThemeOverrides as X}from"./hooks/useNuiThemeOverrides.js";import{useOperationalForm as Y}from"./hooks/useOperationalForm.js";import{useWordbookSetting as Z}from"./hooks/useWordbookSetting.js";import"../../../shared/utils/index.js";import"@vicons/ionicons5";import"@vue/shared";import"../index.js";import{createObjSchema as ee}from"./utils/schema.js";import{useFieldListAdaptor as oe}from"./hooks/useFieldListAdaptor.js";import{useFieldVisitor as te}from"./hooks/useFieldVisitor.js";import"../../../shared/utils/tapable/SyncHook.js";import"../../../shared/utils/tapable/SyncBailHook.js";import"../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../shared/utils/tapable/SyncLoopHook.js";import"../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import{validateMessageLocale as re}from"./hooks/useFormValidator.js";import{useAnchor as se}from"./hooks/useAnchor.js";import{useFormContext as ae}from"./hooks/useFormContext.js";import"./hooks/useFormRenderOptions.js";const ie={key:0,style:{height:"54px"}},le={style:{"white-space":"pre"}};var ne=e({__name:"FormRender",props:{fieldList:{type:Array},initialData:{type:Object,default:()=>({})},fieldVisitor:{type:Object},column:{type:Number,default:24},maxHeight:{type:[Number,String],default:""},anchor:{type:Boolean,default:!1},parallelism:{type:Number,default:3},businessFormatter:{type:Function},schema:{type:Object},components:{type:Object,default:()=>({})},scope:{type:Object,default:()=>({})},annotation:{type:Object},consumer:{type:Boolean,default:!1},uuid:{type:String},lifeCycle:{type:Object},requestInstance:{type:Object},enterToNextWidget:{type:[Boolean,Function],default:!0},lowCodeReactions:{type:Array},operationalForm:{type:Object},linebarAutoHidden:{type:Boolean},bordered:{type:[Boolean,String],default:!0},outBordered:{type:Boolean,default:!1},uniqueCacheData:{type:Boolean,default:!1},forceClearable:Boolean},emits:["formChange","annotationChange","scroll"],setup(e,{expose:ne,emit:me}){const de=e,pe=C(),{nuiThemeOverrides:ue}=X();re();const ce=o(),fe=t((()=>S(de.maxHeight)?de.maxHeight+"px":de.maxHeight)),{SchemaField:he,businessCollector:ye,formItemDepsCollector:ge,changeContextCollector:je,formUUID:be}=ae(de,me),{anchorBarRef:ve,currentAnchor:ke,updateAnchorList:Fe,anchorIdList:Ce,onScroll:Se}=se(de,me,ce,ge),{callLifeCycle:He}=$(de);r(K,He),He("onSetup");const{trigger:xe}=U(),{observeFormGraph:Ae,setGraph:Le,removeGraph:Oe}=J();r(T,Ae);const{lowCodeEventTrigger:Be}=z(),Re=L({initialValues:de.initialData,effects(e){const o={};O((()=>{Object.assign(o,H(e.values))})),B("*",(t=>{const r=D.getIn(o,t.path);D.setIn(o,t.path,t.value);const s=t.props.name.toString();ye.trigger(e,s),ge.trigger(s),me("formChange",{fieldInstance:t,fieldKey:s,oldValue:r,fieldName:t.title,value:t.value,context:je.getContext(s,t.value)}),Be(t),we(s),De(s),Ie(s,t.value)})),R("*",Le),w("*",Oe),de.linebarAutoHidden&&(_("*",xe),O((e=>e.query("*").forEach(xe)))),de.anchor&&_("*",Fe)}}),{lowCodeReactionsHandler:we,triggerAllReactionsHandler:_e}=Q(t((()=>de.lowCodeReactions)),Re),{operationalFormHandler:De,triggerAllOperationalFormHandler:Ve}=Y(t((()=>de.operationalForm)),Re),{wordbookSettingHandler:Ie}=Z(Re,je);s(_e),s(Ve);const{schemaAdaptor:Ne}=oe(ye);let qe=de.fieldList||[];const We=t((()=>de.schema?de.schema:de.fieldList?(qe=te().traverse(H(de.fieldList),de.fieldVisitor),ee(Ne(qe,de))):ee({}))),{onKeydown:Ee}=M({formModel:Re,formRenderRef:ce,props:de}),{clearSpan:Ke}=G();a((()=>Ke(be)));const Te=P({formModel:Re,formRenderRef:ce,formItemDepsCollector:ge,getFieldList:()=>qe,formUUID:be});return ne({formModel:Re,validate:(e="*",o={})=>Te.validate(e,o),getFormValues:(e=!0)=>Te.getFormValues(e),async setFormValues(e,o={},t=!1,r=!0){var s,a,l,n;let m=!0,d=!0;x(o)?(d=null==(s=o.needSplitExtendKey)||s,m=null==(a=o.avoidDependKeyConnection)||a,t=null!=(l=o.avoidBusinessConnection)&&l,r=null==(n=o.overwrite)||n):A(o)&&(d=o),t&&(ye.triggerLock=!0),m&&(ge.triggerDisabled=!0),Te.setFormValues(e,d,r),await i(),ye.triggerLock=!1,ge.triggerDisabled=!1},setFieldState(e,o){Te.setFieldState(e,o)},resetFields(e="*"){Te.resetFields(e)},queryWidget:async e=>Te.queryWidget(e),getFieldList:()=>qe,async reload(){console.error("reload function is abstract,it should be overwrite!")}}),(o,t)=>(l(),n(m(N),{class:d(["form-render",{"form-render--out-border":e.outBordered}]),"require-mark-placement":"left",style:p(m(pe))},{default:u((()=>[e.anchor?(l(),c("section",ie,[f(m(q),{value:m(ke),"onUpdate:value":t[0]||(t[0]=e=>h(ke)?ke.value=e:null),type:"line",ref_key:"anchorBarRef",ref:ve},{default:u((()=>[(l(!0),c(y,null,g(m(Ce),(e=>(l(),n(m(W),{name:e.name,tab:e.title,key:e.name},null,8,["name","tab"])))),128))])),_:1},8,["value"])])):j("v-if",!0),f(m(E),{"theme-overrides":m(ue)},{default:u((()=>[b("section",{class:"form-render__wrapper",style:p({"--column":e.column,"--form-height":m(fe)}),ref_key:"formRenderRef",ref:ce,onScroll:t[1]||(t[1]=(...e)=>m(Se)&&m(Se)(...e)),onKeydownCapture:t[2]||(t[2]=v(((...e)=>m(Ee)&&m(Ee)(...e)),["enter"]))},[f(m(V),{form:m(Re)},{default:u((()=>[f(m(he),{schema:m(We)},null,8,["schema"]),e.consumer?(l(),n(m(I),{key:0},{default:u((({form:e})=>[b("div",le,k(JSON.stringify(e.values,null,2)),1)])),_:1})):j("v-if",!0),F(o.$slots,"default")])),_:3},8,["form"])],36)])),_:3},8,["theme-overrides"])])),_:3},8,["class","style"]))}});export{ne as default};
@@ -558,7 +558,9 @@ declare const _default: import("vue").DefineComponent<{}, {
558
558
  onKeydown: (event: KeyboardEvent) => Promise<void>;
559
559
  clearSpan: (uuid: string) => void;
560
560
  exposeEvent: {
561
- validate(path?: string): Promise<void>;
561
+ validate(path?: string, { force }?: {
562
+ force?: boolean | undefined;
563
+ }): Promise<void>;
562
564
  getFormValues(needCombineExtendKey?: boolean): any;
563
565
  setFormValues(values: import("../../../../es/shared/types").AnyObject, needSplitExtendKey?: boolean, overwrite?: boolean): void;
564
566
  setFieldState(path: string, setter: (field: Partial<Pick<import("../../../../es/components/form-render").Field<any, any, any, any>, import("../../../../es/components/form-render").NonFunctionPropertyNames<{
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,computed as t,inject as a,watch as o,createVNode as l}from"vue";import{useVModel as n}from"@vueuse/core";import{isEqual as u,isArray as i,isString as s,isNumber as c,isEmpty as v,isFunction as d,omit as p,cloneDeep as f}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as y}from"../../constants/index.js";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{formRenderLog as h}from"../../utils/index.js";import{connect as k,mapProps as j}from"@formily/vue";import g from"../../../../search-cascader/index.js";import w from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as K}from"../../hooks/useFormRequest.js";const F=k(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:k}){const j=n(e,"value",k),_=r(!1),F=r([]),{field:O,fieldKey:q}=b(),S=t((()=>{var r,t,a;return null!=(a=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?a:e.labelField})),C=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),x=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),L=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),V=a(y),{getSearchRequestInfo:A}=K(),I=r(150),P=r();async function R(r,t){var a,o,l;if(I.value=t&&(null==(a=P.value)?void 0:a.getWidth())||150,i(e.value)&&e.value.length&&e.value.every((e=>e[C.value]))&&!r&&!t){const[r,t]=function(e){if(!e.length)return[];const r=[(e=f(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const a=e[r];a&&(t.children=[a],a.parent=t,t=a)}return[e,r]}(e.value);F.value=t;const a=r[Math.max(0,r.length-2)];return await R(a),a}try{if(r&&!r.__keyword&&r.isLeaf)return n(r);if(null==r?void 0:r.__keyword){if(!s(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));c(L.value)&&L.value!==1/0&&t.splice(L.value);const a=await async function(r){if(!A().primaryKeyUrl)return[];try{return await V.addAsync(t(e.wordbook,e.autograph,r,q.value))}catch(e){s(e)&&h(e)}function t(r,t,a,o){const l=A();return{key:o,params:{autograph:t,tableId:r.id,primaryKeyValue:a.join(","),page:1},...l,url:l.primaryKeyUrl,cache:e.requestCache,payload:{field:O.value,labelKey:S.value,valueKey:C.value}}}}(t);if(!a)return Promise.reject();const{lastOption:o,options:n}=function(e,r){let t=e[0];return{options:r.reduce(((r,o,l)=>{const n=a(e,o);return 0===l?(t=n,[n]):(Object.assign(n,{parent:t,isLeaf:l+1>=L.value}),t.children=[n],t=n,r)}),[]),lastOption:t};function a(e,r){return e.find((e=>e[C.value]===r))}}(a,t);return n.length<L.value&&(await R(o),v(o.children))?(j.value=function(e,r){return r.map((r=>e.find((e=>e[C.value]===r))))}(a,t),_.value=!1,Promise.reject()):(F.value=n,null==(l=P.value)||l.setCursor(o),o)}{const a=await V.addAsync(function(r,a,o,l,n){const u={autograph:()=>a,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[C.value]}]:e.conObjFirstLevel||[]}(r,t,l)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},i=Object.entries(u).reduce(((e,[t,a])=>(e[t]=s(a)?r[a]:d(a)?a():void 0,e)),{});return{...A(),params:i,key:n,cache:e.requestCache}}(e.wordbook,e.autograph,O.value,r,q.value));if(r){if(!a.length)return n(r);r.children=a.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:u(r)+1>=t}}(e,r,L.value)))}else F.value=a.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[S.value]=e[x.value||S.value]||e[S.value]);return e}(e,t))),t&&(null==(o=P.value)||o.setCursor(F.value[0]))}}catch(e){s(e)&&h(e)}function n(e){return j.value=function(e){const r=[];let t=e;for(;t;)r.unshift(p(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function u(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}function U(){I.value=150}o((()=>e.wordbook),((r,t)=>{u(r,t)||(F.value=[],r&&(j.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:B,injectValueWatchFromEmpty:N,injectValueBindKey:W}=m();N(j,R),B(j);const z=W(j);return()=>l(g,{ref:P,value:j.value,"onUpdate:value":e=>j.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:F.value,key:z.value,labelKey:S.value,valueKey:C.value,search:R,onFocus:U,menuWidth:I.value},{empty:()=>l(w,null,null)})}}),j({dataSource:"options"},_));export{F as LEVEL_SEARCH_CASCADER};
1
+ import{defineComponent as e,computed as r,ref as t,inject as a,watch as l,createVNode as o}from"vue";import{isEqual as n,isArray as u,isEmpty as i,isString as s,isNumber as v,isFunction as d,omit as c,cloneDeep as p}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as f}from"../../constants/index.js";import{useCommonInjection as y}from"../../hooks/useCommonInjection.js";import{formRenderLog as m}from"../../utils/index.js";import{connect as h,mapProps as k}from"@formily/vue";import g from"../../../../search-cascader/index.js";import j from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as w}from"../../utils/schema.js";import{useFormField as _}from"../../hooks/useFormField.js";import{useFormRequest as b}from"../../hooks/useFormRequest.js";const K=h(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:h}){const k=r({get:()=>e.value,set(r){n(r,e.value)||h("update:value",r)}}),w=t(!1),K=t([]),{field:F,fieldKey:O}=_(),q=r((()=>{var r,t,a;return null!=(a=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?a:e.labelField})),S=r((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),x=r((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),C=r((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),L=a(f),{getSearchRequestInfo:P}=b(),A=t(150),I=t();async function R(r,t,a=!0){var l,o,n,f;if(A.value=t&&(null==(l=I.value)?void 0:l.getWidth())||150,u(e.value)&&!i(e.value)&&e.value.every((e=>e[S.value]))&&!r&&!t){const r=1===e.value.length,t=null==(o=K.value)?void 0:o.length,[a,l]=function(e){if(!e.length)return[];const r=[(e=p(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const a=e[r];a&&(t.children=[a],a.parent=t,t=a)}return[e,r]}(e.value),n=a[Math.max(0,a.length-2)];if(!r){K.value=l;const e=a[Math.max(0,a.length-2)];return await R(e,void 0),e}if(t)return n}try{if(r&&!r.__keyword&&r.isLeaf)return y(r);if(!(null==r?void 0:r.__keyword)){const l=await L.addAsync(function(r,a,l,o,n){const u={autograph:()=>a,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,t){return r?e.conObj||[]:t?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:t[S.value]}]:e.conObjFirstLevel||[]}(r,t,o)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},i=Object.entries(u).reduce(((e,[t,a])=>(e[t]=s(a)?r[a]:d(a)?a():void 0,e)),{});return{...P(),params:i,key:n,cache:e.requestCache}}(e.wordbook,e.autograph,F.value,r,O.value));if(r){if(!l.length)return a?y(r):Promise.reject();r.children=l.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:h(r)+1>=t}}(e,r,C.value)))}else K.value=l.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[q.value]=e[x.value||q.value]||e[q.value]);return e}(e,t))),t&&(null==(n=I.value)||n.setCursor(K.value[0]));return}if(!s(r.id_link))return Promise.reject();const l=r.id_link.split("_").filter((e=>e));v(C.value)&&C.value!==1/0&&l.splice(C.value);const o=await async function(r){if(!P().primaryKeyUrl)return[];try{return await L.addAsync(t(e.wordbook,e.autograph,r,O.value))}catch(e){s(e)&&m(e)}function t(r,t,a,l){const o=P();return{key:l,params:{autograph:t,tableId:r.id,primaryKeyValue:a.join(","),page:1},...o,url:o.primaryKeyUrl,cache:e.requestCache,payload:{field:F.value,labelKey:q.value,valueKey:S.value}}}}(l);if(!o)return Promise.reject();const{lastOption:u,options:c}=function(e,r){let t=e[0];return{options:r.reduce(((r,l,o)=>{const n=a(e,l);return 0===o?(t=n,[n]):(Object.assign(n,{parent:t,isLeaf:o+1>=C.value}),t.children=[n],t=n,r)}),[]),lastOption:t};function a(e,r){return e.find((e=>e[S.value]===r))}}(o,l);return c.length<C.value&&(await R(u),i(u.children))?(k.value=function(e,r){return r.map((r=>e.find((e=>e[S.value]===r))))}(o,l),w.value=!1,Promise.reject()):(K.value=c,null==(f=I.value)||f.setCursor(u),u)}catch(e){s(e)&&m(e)}function y(e){return k.value=function(e){const r=[];let t=e;for(;t;)r.unshift(c(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),w.value=!1,Promise.reject()}function h(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}function U(){A.value=150}l((()=>e.wordbook),((r,t)=>{n(r,t)||(K.value=[],r&&(k.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:V,injectValueBindKey:B}=y();V(k);const N=B(k);return()=>o(g,{ref:I,value:k.value,"onUpdate:value":e=>k.value=e,show:w.value,"onUpdate:show":e=>w.value=e,options:K.value,key:N.value,labelKey:q.value,valueKey:S.value,search:R,onFocus:U,menuWidth:A.value},{empty:()=>o(j,null,null)})}}),k({dataSource:"options"},w));export{K as LEVEL_SEARCH_CASCADER};