cnhis-design-vue 3.1.42-beta.26 → 3.1.42-beta.28

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 (37) hide show
  1. package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
  2. package/es/components/field-set/src/FieldSet.vue.js +1 -1
  3. package/es/components/form-config/index.d.ts +5 -10
  4. package/es/components/form-config/src/FormConfig.vue.d.ts +5 -10
  5. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +3 -6
  6. package/es/components/form-render/src/components/renderer/levelSearchCascader.d.ts +18 -0
  7. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  8. package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +36 -0
  9. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  10. package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +18 -0
  11. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  12. package/es/components/form-render/src/components/renderer/searchCascade.d.ts +18 -0
  13. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  14. package/es/components/form-render/src/components/renderer/select.d.ts +30 -3
  15. package/es/components/form-render/src/components/renderer/select.js +1 -1
  16. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +13 -8
  17. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  18. package/es/components/form-render/src/types/fieldItem.d.ts +3 -4
  19. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  20. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  21. package/es/components/map/index.d.ts +2 -14
  22. package/es/components/map/src/Map.vue.d.ts +1 -14
  23. package/es/components/map/src/types/index.d.ts +19 -0
  24. package/es/components/map/src/types/index.js +1 -0
  25. package/es/components/recommend-search/index.d.ts +3 -0
  26. package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +3 -0
  27. package/es/components/recommend-search/src/RecommendSearch.vue.js +1 -1
  28. package/es/components/recommend-search/src/components/BaseSearch.js +1 -1
  29. package/es/components/recommend-search/src/constant/index.d.ts +2 -1
  30. package/es/components/recommend-search/src/constant/index.js +1 -1
  31. package/es/components/scale-view/src/hooks/use-component.d.ts +0 -3
  32. package/es/components/shortcut-setter/index.d.ts +1 -2
  33. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -2
  34. package/es/components/vod-chunk-upload/index.d.ts +0 -3
  35. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +0 -3
  36. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.js +1 -1
  37. package/package.json +2 -2
@@ -1 +1 @@
1
- import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as g,isEffectiveNode as v,getIndex as y,deleteProperty as m}from"../utils/utils.js";function x(x,b,w,L,j,k,Y,S,E,$,T){s(x,b);const{getEqualXTypes:P,repeatTip:O,maxLimitTip:M,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=b,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&x.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const g=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===g)));const v=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),v()}}else c?(l.push(c),v()):f?(s.push(f),v()):v()})),e})().forEach((t=>{var n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),x.value.add(...e)}N.add(c),x.value.add(c)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{x.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:v={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],P=[];null==(a=e.list)||a.forEach(((a,O)=>{const M=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return P.push(s),{obj:s,top:-X}}(I,a,M),function(e,s,a,d){var g,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:x}=d;let b,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),P.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),P.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(x?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),P.push(Y));s.verified&&(S=o([e[0],e[1]-(x?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),P.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(g=s.physicsReduce)?g:s.drugReduce);b=t([...e,e[0],o],{...m,...v.line,...i}),w=n((null==(y=null==v?void 0:v.point)?void 0:y.type)||"circle",{left:e[0],top:o,...v.point,...i,originY:o===K?"bottom":"center"}),b&&P.push(b),w&&P.push(w)}Object.assign(d,{reduceLine:{obj:b,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(x?-X:0)-5},verifiedText:{obj:S,top:(x?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,M,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),P.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(+t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),P.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),P.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,M,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:v="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),P=se(u,e.list[l].value),O=S&&se(u,j.value);!i||!S||o.breakpoint||P||O||i[0]===S[0]||(d=t([...i,...S],{...h}));const M=o.pacemakerShow&&"pulse"==u?y.value:P?0:L,I=T[l-1],A={origin:{data:o,title:v,key:m||"",unit:r.unit,type:u,_type:g(v,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...b.event,...P?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(M,{left:I.get("x2"),top:P?e-5:e,...A})}else i&&(A.leftLine=null,c=n(M,{left:i[0],top:P?i[1]-5:i[1],...A}));T.push(d),c&&(v.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};x.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,O,M,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=T.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(P).then((i=>{x.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&x.value.remove(e.leftLine),e.rightLine&&x.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{drugReduce:l,physicsReduce:s}=o||{},r=Y(n,e.top);if(h(l))return`药物降${"pain"==n?"痛":"温"} ${r}—>${l}${i||""}`;if(h(s))return`物理降${"pain"==n?"痛":"温"} ${r}—>${s}${i||""}`;return`${t} ${r}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(v(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(M(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=x.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);x.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),b.event.evented&&x.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!P(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&O())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{x as useCenter};
1
+ import{fabric as e}from"../utils/index.js";import{drawLine as t,defaultStyle as i,drawPoint as n,drawText as o,drawArrow as l}from"./useDraw.js";import s from"./useGrid.js";import{useShadow as r}from"./useShadow.js";import{TEMPERATURE_MENU as a,PAIN_MENU as u,OVERLAP as p}from"./constant.js";import{cloneDeep as c}from"lodash-es";import{isOneLine as d,getType as f,isValidValue as h,setOtherType as v,isEffectiveNode as g,getIndex as y,deleteProperty as m}from"../utils/utils.js";function b(b,x,w,L,j,k,Y,S,E,$,T){s(b,x);const{getEqualXTypes:M,repeatTip:P,maxLimitTip:O,minLimitTip:I}=T,{createShadowLines:A}=r(),{left:D,xScaleList:R,xCellWidth:C,yCellHeight:X,originX:z,endX:V,originY:F,endY:_,itemList:G,event:H,vitalSignsOriginY:q,painOriginY:W,hospitalizationDate:B,config:J,canvasHeight:K}=x,N=new Set,Q=["xinmai","mai"],U=new Map,Z=new Set,ee=new Set,te=new Set,ie=c(D.yScaleValue);function ne(t){var n;const o=ie.find((e=>"pulse"===e.type));if(o&&(null==(n=o.dataList)?void 0:n.length)&&(N.size&&b.value.remove(...N),N.clear(),U.size>1)){if(t){const{type:e,key:i}=t.origin||{};if("pulse"===e){const e=U.get(i),n=null==e?void 0:e.findIndex((e=>e[0]===t.left));e.splice(n,1,[t.left,t.top])}}(function(){const e=[],t=[],i=[];for(const e of U)t.push(e[1]),e[0]===Q[0]&&e[1].forEach((e=>{(U.get(Q[1])||[]).findIndex((t=>t[0]===e[0]))>-1&&i.push(e[0])}));const[n,o]=t;let l=[],s=[];return i.forEach((t=>{const i=n.findIndex((e=>e[0]===t)),r=o.findIndex((e=>e[0]===t)),a=n[i],u=o[r],p=n[i-1],c=n[i+1],d=o[r-1],f=o[r+1];if(p&&d){if(p[0]!==d[0]){const e=Math.max(p[0],d[0]);l.push([p,d].find((t=>t[0]===e)))}}else p?l.push(p):d&&s.push(d);const h=Math.min(a[1],u[1]);l.push([a,u].find((e=>e[1]===h)));const v=Math.max(a[1],u[1]);s.push([a,u].find((e=>e[1]===v)));const g=()=>{const t=[...l,...s.reverse()],[i]=t,n=t.at(-1);i[0]===n[0]&&i[1]===n[1]&&t.splice(-1,1),e.push(t),l=[],s=[]};if(c&&f){if(c[0]!==f[0]){const e=Math.min(c[0],f[0]);l.push([c,f].find((t=>t[0]===e))),g()}}else c?(l.push(c),g()):f?(s.push(f),g()):g()})),e})().forEach((t=>{var n,l,s,r,a,u;const p=t.map((e=>({x:e[0],y:e[1]}))),c=new e.Polygon(p,{...i,...(null==(n=o.shadow)?void 0:n.style)||{}});if("slash"==(null==(l=o.shadow)?void 0:l.mode)){c.set({fill:"transparent",stroke:(null==(r=null==(s=o.shadow)?void 0:s.style)?void 0:r.stroke)||"#f00"});const e=A(t,null==(a=o.shadow)?void 0:a.style._angle,null==(u=o.shadow)?void 0:u.style.space);e.forEach((e=>{var t;Object.assign(e,{...i,...(null==(t=o.shadow)?void 0:t.style)||{}}),N.add(e)})),b.value.add(...e)}N.add(c),b.value.add(c)}))}}function oe(){var e;const t=ie.find((e=>"pulse"===e.type));if(!t||!(null==(e=t.dataList)?void 0:e.length))return;if(!t.dataList.some((e=>e.title.includes("脉搏"))))return;const o=Object.assign({},p,D.overlap||{}),l=[];Z.size&&[...Z].forEach((e=>{[...ee].forEach((t=>{if(t.origin&&e.left===t.left&&e.top===t.top){const e=t.origin.key;if(e){const s={left:t.left,top:t.top,...i,hoverCursor:"default"};let r="koumai";"yemai"===e&&(r=e),"humai"===e&&(r="circle"),l.push(n(r,{...o[e]||{},...s}))}}}))})),setTimeout((()=>{b.value.add(...l),l.forEach((e=>{null==e||e.bringToFront(),te.add(e)}))}))}function le(e,s,r){var a;const{type:u,riseStyle:p={},noRiseStyle:c={},verifiedStyle:f={},reduceStyle:g={},pacemaker:y={},upArrowStyle:m={},limitValueStyle:L={},nonePainPointStyle:k={},dataList:S=[]}=r,$=[],T=[],M=[];null==(a=e.list)||a.forEach(((a,P)=>{const O=d(u)?S.find((e=>e.key===a.key)):e,I=ae(a,r),A={};A.value=function(e,t,i){if(!(null==e?void 0:e.length)||!J.showValue)return;const{lineAttr:n={}}=i,l=e[1]<=q.originY+X?e[1]+X:e[1]-X,s=o([e[0],l],{value:t.value,originX:"center",originY:"center",fill:n.stroke||"#000"});return M.push(s),{obj:s,top:-X}}(I,a,O),function(e,s,a,d){var v,y;if(!(null==e?void 0:e.length)||!["temperature","pain"].includes(u))return;const{lineAttr:m={}}=a,{value:b}=d;let x,w,L,k,Y,S;if(s.noRise&&c.show)if(c.text)L=o([e[0],e[1]+5],{value:c.text.split("").join("\n"),originY:"top",...c.style||{}}),M.push(L);else{const t=e[1]+2*X;k=l([e[0],e[1],t],c.style||{}),M.push(k)}s.rise&&p.show&&p.text&&(Y=o([e[0],e[1]-(b?X:0)-5],{value:p.text.split("").join("\n"),originY:"bottom",...p.style||{}}),M.push(Y));s.verified&&(S=o([e[0],e[1]-(b?X:0)-5],{value:"v",originX:"center",originY:"bottom",...f}),M.push(S));if(h(s.physicsReduce)||h(s.drugReduce)){const o=j(u,r.list,null!=(v=s.physicsReduce)?v:s.drugReduce);x=t([...e,e[0],o],{...m,...g.line,...i}),w=n((null==(y=null==g?void 0:g.point)?void 0:y.type)||"circle",{left:e[0],top:o,...g.point,...i,originY:o===K?"bottom":"center"}),x&&M.push(x),w&&M.push(w)}Object.assign(d,{reduceLine:{obj:x,type:"line"},noRiseText:{obj:L,top:5},arrowGroup:{obj:k,top:2*X},riseText:{obj:Y,top:(b?-X:0)-5},verifiedText:{obj:S,top:(b?-X:0)-5},reducePoint:{obj:w,type:"reduce"}})}(I,a,O,A),function(e,t,i,n){if(!(null==e?void 0:e.length)||!["pulse"].includes(u))return;let s,a;const{upArrowShow:p=!1,limitValueShow:c=!1}=i;if(p&&+t.value>180){let t=e[1]-2.5*X,i=[e[1]-X/2,t];t<q.originY&&(t=e[1]+2.5*X,i=[t,e[1]+X/2]),s=l([e[0],i[0],i[1]],m,"up"),M.push(s)}if(c){const i={value:t.value,originX:"center",originY:"center",...L};if(+t.value>Math.max(...r.list)){const t=s?e[1]+X/2+s.height:e[1]+X;a=o([e[0],t],i),M.push(a)}+t.value<Math.min(...r.list)&&(a=o([e[0],e[1]-X],i),M.push(a))}Object.assign(n,{upArrow:{obj:s},limitValue:{obj:a,top:-X}})}(I,a,O,A),function(i,o,l,a,p){let c,d;const{pointAttr:f={},lineAttr:h={},title:g="",key:m,type:L="circle"}=a,j=e.list[l+1],S=ae(j,r),M=se(u,e.list[l].value),P=S&&se(u,j.value);!i||!S||o.breakpoint||M||P||i[0]===S[0]||(d=t([...i,...S],{...h}));const O=o.pacemakerShow&&"pulse"==u?y.value:M?0:L,I=T[l-1],A={origin:{data:o,title:g,key:m||"",unit:r.unit,type:u,_type:v(g,u),dataIndex:s,index:l},leftLine:I,rightLine:d,otherObj:p,lockMovementX:!0,...o.pacemakerShow&&"pulse"==u?y.style:f,...x.event.hovered?x.event.evented?{selectable:!0}:{selectable:!0,lockMovementY:!0}:x.event,...M?{selectable:!1,evented:!1,...k}:{}};if(I){const e=I.get("y2");c=n(O,{left:I.get("x2"),top:M?e-5:e,...A})}else i&&(A.leftLine=null,c=n(O,{left:i[0],top:M?i[1]-5:i[1],...A}));T.push(d),c&&(g.includes("脉搏")?Z.add(c):ee.add(c),function(e){H.hovered&&(e.on("mouseover",(()=>{re(e)})),e.on("mouseout",(()=>{E.show=!1})));if(e.lockMovementX&&e.lockMovementY)return;e.on("moving",(()=>{!function(e){e.setCoords();const t="pain"===e.origin.type?W:q;e.top<t.originY&&e.set("top",t.originY);e.top>t.endY&&e.set("top",t.endY)}(e),function(e){var t,i;null==(t=e.leftLine)||t.setCoords().set({x2:e.left,y2:e.top}),null==(i=e.rightLine)||i.setCoords().set({x1:e.left,y1:e.top}),Object.values(e.otherObj).forEach((t=>{const{obj:i,type:n="",top:o=0}=t||{};"reduce"!==n&&("line"===n?null==i||i.setCoords().set({x1:e.left,y1:e.top}):null==i||i.setCoords().set({left:e.left,top:e.top+o}))})),ne(e)}(e),H.hovered&&re(e)})),e.on("mouseup",(t=>{if(E.show=!1,1===t.button){const{type:t}=e.origin,i=Y(t,e.top),n={...e.origin,data:{...e.origin.data,value:i}};b.value.discardActiveObject(),w("change",n),pe(n,"change")}}))}(c),$.push(c),te.add(c))}(I,a,P,O,A)})),"pulse"===u&&Q.forEach((e=>{U.set(e,$.filter((t=>{var i;return(null==(i=t.origin)?void 0:i.key)===e})).map((e=>[e.left,e.top])))})),Promise.all($).then((e=>{const t=T.filter((e=>e));let i=null;e=e.map((e=>(e&&i&&(i.nextPoint=e,e.prevPoint=i),i=e||i,e))),Promise.all(M).then((i=>{b.value.add(...t,...e,...i),e.forEach((t=>{null==t||t.bringToFront(),function(e,t){if("pulse"===e.origin.type){t.filter((t=>t.left===e.left&&"pulse"===t.origin.type)).length>1&&(e.leftLine&&b.value.remove(e.leftLine),e.rightLine&&b.value.remove(e.rightLine))}}(t,e)}))}))}))}function se(e,t){return"pain"===e&&0==t}function re(e){const{title:t,unit:i,type:n,data:o}=e.origin;E.point={x:e.left,y:e.top},E.list=[function(){const{drugReduce:l,physicsReduce:s}=o||{},r=Y(n,e.top);if(h(l))return`药物降${"pain"==n?"痛":"温"} ${r}—>${l}${i||""}`;if(h(s))return`物理降${"pain"==n?"痛":"温"} ${r}—>${s}${i||""}`;return`${t} ${r}${i||""}`}(),`时间 ${((null==o?void 0:o.time)||k(e.left)).slice(-5)}`],E.show=!0}function ae(e,t){const i="pain"===t.type?W:q;if(g(e)&&function(e){const[t]=R,i=R.at(-1),n=t.start,o=i.end,l=new Date(e).getTime();return l>=n&&l<=o}(e.time)){const n=L(e.time),o=j(t.type,t.list,e.value);return[n,o<i.originY?i.originY:o>i.endY?i.endY:o]}}function ue(e){const t=new Date,i=`00${t.getMonth()+1}`.slice(-2),n=`00${t.getDate()}`.slice(-2),o=new Date(`${t.getFullYear()}-${i}-${n} 23:59:59`).getTime(),l=new Date(`${k(e)}:00`).getTime();return B&&l<new Date(B).getTime()?(I(),!1):!(l>o)||(O(),!1)}function pe(e,t="add"){const{type:i,dataIndex:n,index:o,data:l,key:s}=e,r=ie.find((e=>e.type===i));if("add"===t){const e=d(i)?r.dataList.find((e=>e.enable)):r.dataList[n],t=y(l.time,e.list);e.list.splice(t,0,l)}else r.dataList[n].list[o]=l;ce()}function ce(){var e;te.size&&(null==(e=b.value)||e.remove(...function(e){const t=[];return e.forEach((e=>{e&&t.push(e),(null==e?void 0:e.leftLine)&&t.push(null==e?void 0:e.leftLine),(null==e?void 0:e.rightLine)&&t.push(null==e?void 0:e.rightLine),Object.values((null==e?void 0:e.otherObj)||{}).forEach((e=>{(null==e?void 0:e.obj)&&t.push(null==e?void 0:e.obj)}))})),t}([...te]))),U.clear(),te.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe()}return U.clear(),Z.clear(),ee.clear(),ie.forEach((e=>{!function(e){if("temperature"!==e.type||!e.positionLine)return;const i=j(e.type,e.list,e.positionLine.value),n=t([z,i,V,i],e.positionLine);b.value.add(n)}(e),e.dataList.forEach(((t,i)=>{d(e.type)&&!t.enable||le(t,i,e)}))})),ne(),oe(),x.event.evented&&b.value.on("mouse:up",(e=>{var t;if(3===e.button){const{x:i=0,y:n=0}=e.pointer||{};if(i>=z&&i<=V&&n>=F&&n<=_){$.point={x:i,y:n},$.show=!0;const{type:o}=(null==(t=e.target)?void 0:t.origin)||{};if(e.target&&["temperature","pain"].includes(o))"temperature"===o&&($.list=[...a]),"pain"===o&&($.list=[...u]),$.target=e.target;else{$.target=null,$.list=["新增节点"],G.forEach((t=>{if(!M(i,"_type",C).includes(t.bigType)){const i=["pain"].includes(t.bigType)?W:q;n>=i.originY&&n<=i.endY&&$.list.push({renderItem:S?S(t):()=>t.title,origin:{title:t.title,unit:t.unit,type:f(t.bigType),dataIndex:t.dataIndex,key:t.key},pointer:e.pointer})}}));const t=ue(i);t&&1!==$.list.length||($.show=!1,1===$.list.length&&t&&P())}}}})),{pointTipProps:E,pointMenuProps:$,clickMenu:function({item:e,target:t}){if(t){const{data:i,type:n,dataIndex:o,index:l}=t.origin,s=m(i,[...a,...u]);s[`${e.type}`]=e.value,d(n)&&(s.key=t.origin.key);const r={...t.origin,data:s};w("change",r),pe(r,"change")}else{const t={data:{time:k(e.pointer.x),value:Y(e.origin.type,e.pointer.y),...d(e.origin.type)?{key:e.origin.key}:{}},...e.origin};w("add",t),pe(t)}},setPopup:re,isAddPoint:ue,updateData:pe,redrawPoints:ce}}export{b as useCenter};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as n,unref as c,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as v,withDirectives as k,vShow as y,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as S,NInput as x,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import C from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const F={class:"fields-set-content"},q={class:"fields-table"},D=r("span",{class:"width-show",style:{width:"4%"}},null,-1),N=r("span",{class:"width-large"},"所有字段",-1),P={class:"width-show"},j={key:0,class:"width-show"},R={key:1,class:"width-show"},I={class:"width-show"},L={class:"width-show"},T=r("span",{class:"width-showed"},"默认排序",-1),z=r("span",{class:"width-showed"},"固定",-1),A=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),K={class:"width-show"},M={key:0,class:"width-show"},Q={key:1,class:"width-show"},X={class:"width-show"},Y={class:"width-show"},Z={class:"width-showed"},ee={class:"width-showed"},le={class:"width-word"},te={class:"width-showed"},ie={key:0,class:"check-options"},se={class:"btn-operate"};var de=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:de}){const ae=e,oe={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ne=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],ce=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],he=l(null);function re(){const e=ae.fields?JSON.parse(JSON.stringify(ae.fields)):[];return Object.keys(oe).forEach((l=>{e.forEach((e=>{"old"==ae.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[oe[l]]=1==e[l]:e[oe[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)}))})),e}const ue=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),pe=e=>ue.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),fe=()=>{if("old"==ae.type){let e=[];return ue.fields.length>0&&ue.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,sortDirection:l.sortDirection,...ae.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ue.fields},we=()=>{de("onSave",{tableFields:fe()})},ve=()=>{de("onClose")};function ke(){ue.fields=re(),de("reset")}const ye=e=>!!ue.fields.length&&ue.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ge(l,e))||l[e])),be=(e,l)=>{const t=e,i=ue.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ge(e,l)&&(e[l]=t),e)));ue.fields=i};function ge(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]||["sort"].includes(l)&&1==e.notParticipatingSort}return i((()=>ae.fields),(e=>{(null==e?void 0:e.length)>0&&(ue.fields=re())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=he.value)||e.style.setProperty("margin","auto"),ae.isEdit&&(ue.widthShow="8%",ue.widthLarge="13%")})),O({getTableFields:fe}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:he,class:"c-field-set",style:o({"--width-show":ue.widthShow,"--width-large":ue.widthLarge})},[n(c(g),{show:ue.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",F,[r("div",q,[r("div",{class:u(["setting-title",{"seting-title-api":!ue.isCustomSearch}])},[D,p(" 字段名称 "),N,p(" 显示 "),r("span",P,[pe("show")?(d(),f(c(m),{key:0,checked:ye("show"),"onUpdate:checked":t[0]||(t[0]=e=>be(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",j,[pe("editable")?(d(),f(c(m),{key:0,checked:ye("editable"),"onUpdate:checked":t[1]||(t[1]=e=>be(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",R,[pe("required")?(d(),f(c(m),{key:0,checked:ye("required"),"onUpdate:checked":t[2]||(t[2]=e=>be(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",I,[pe("sort")?(d(),f(c(m),{key:0,checked:ye("sort"),"onUpdate:checked":t[3]||(t[3]=e=>be(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",L,[n(c(m),{checked:ye("bold"),"onUpdate:checked":t[4]||(t[4]=e=>be(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 默认排序 "),T,p(" 固定 "),z,p(" 自定义标题 "),A,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ue.isCustomSearch}])},[n(c(C),{list:ue.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ue.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ue.clickItem=t);var t}},[r("span",H,[n(c(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,v(l.title),1)],2),p(" 显示 "),r("span",K,[k(n(c(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",M,[k(n(c(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",Q,[k(n(c(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",X,[k(n(c(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[y,"0001"!=l.id]])]),p(" 加粗 "),r("span",Y,[k(n(c(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 默认排序 "),r("span",Z,[k(n(c(S),{value:l.sortDirection,"onUpdate:value":e=>l.sortDirection=e,options:ce,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 固定 "),r("span",ee,[n(c(S),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ne,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",le,[k(n(c(x),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 列宽 "),r("span",te,[n(c(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),ae.footerFlag?(d(),a("div",ie,[r("div",se,[b(l.$slots,"footer",{},(()=>[n(c(_),{onPositiveClick:ke},{trigger:h((()=>[n(c(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),n(c(W),{style:{"margin-right":"8px"},onClick:ve},{default:h((()=>[w("取消")])),_:1}),n(c(W),{type:"primary",onClick:we},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{de as default};
1
+ import{defineComponent as e,ref as l,reactive as t,watch as i,onMounted as s,openBlock as d,createElementBlock as a,normalizeStyle as o,createVNode as n,unref as c,withCtx as h,createElementVNode as r,normalizeClass as u,createCommentVNode as p,createBlock as f,createTextVNode as w,toDisplayString as v,withDirectives as k,vShow as y,renderSlot as b}from"vue";import{NSpin as g,NCheckbox as m,NTooltip as U,NSelect as S,NInput as x,NInputNumber as E,NPopconfirm as _,NButton as W}from"naive-ui";import C from"../../../shared/components/VueDraggable/src/vuedraggable.js";import O from"../../../_virtual/plugin-vue_export-helper.js";const F={class:"fields-set-content"},q={class:"fields-table"},D=r("span",{class:"width-show",style:{width:"4%"}},null,-1),N=r("span",{class:"width-large"},"所有字段",-1),P={class:"width-show"},j={key:0,class:"width-show"},R={key:1,class:"width-show"},I={class:"width-show"},L={class:"width-show"},T=r("span",{class:"width-showed"},"默认排序",-1),z=r("span",{class:"width-showed"},"固定",-1),A=r("span",{class:"width-word"},"自定义标题",-1),B=r("span",{class:"width-showed"},"列宽",-1),G=["onClick"],H={class:"width-show drag-icon-wrap"},J=r("span",{class:"iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",style:{color:"#000"}},null,-1),V=r("span",null,"拖拽调整顺序",-1),$=r("span",{style:{width:"14px","margin-right":"6px"}},null,-1),K={class:"width-show"},M={key:0,class:"width-show"},Q={key:1,class:"width-show"},X={class:"width-show"},Y={class:"width-show"},Z={class:"width-showed"},ee={class:"width-showed"},le={class:"width-word"},te={class:"width-showed"},ie={key:0,class:"check-options"},se={class:"btn-operate"};var de=O(e({__name:"FieldSet",props:{fields:{type:Array,default:function(){return[]}},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1}},emits:["onSave","onClose","reset"],setup(e,{expose:O,emit:de}){const ae=e,oe={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},ne=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],ce=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],he=l(null);function re(){const e=ae.fields?JSON.parse(JSON.stringify(ae.fields)):[];return Object.keys(oe).forEach((l=>{e.forEach((e=>{"old"==ae.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[oe[l]]=1==e[l]:e[oe[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)}))})),e}const ue=t({spinning:!1,isCustomSearch:!0,clickItem:{},fields:[],widthShow:"9%",widthLarge:"19%"}),pe=e=>ue.fields.some((l=>Object.prototype.hasOwnProperty.call(l,e))),fe=()=>{if("old"==ae.type){let e=[];return ue.fields.length>0&&ue.fields.forEach(((l,t)=>{e.push({id:l.id,field:l.name,visible:l.show,sequence:t,sortable:l.sort,title:l.alias,fixed:l.fixedWay,minWidth:l.columnWidth,bold:l.bold,sortDirection:l.sortDirection,...ae.isEdit?{required:l.required,editable:l.editable}:{}})})),e}return ue.fields},we=()=>{de("onSave",{tableFields:fe()})},ve=()=>{de("onClose")};function ke(){ue.fields=re(),de("reset")}const ye=e=>!!ue.fields.length&&ue.fields.every((l=>!(Object.prototype.hasOwnProperty.call(l,e)&&!ge(l,e))||l[e])),be=(e,l)=>{const t=e,i=ue.fields.map((e=>(Object.prototype.hasOwnProperty.call(e,l)&&!ge(e,l)&&(e[l]=t),e)));ue.fields=i};function ge(e,l){return["editable","required"].includes(l)&&e[`${l}Disable`]||["sort"].includes(l)&&1==e.notParticipatingSort}return i((()=>ae.fields),(e=>{(null==e?void 0:e.length)>0&&(ue.fields=re())}),{immediate:!0,deep:!0}),s((()=>{var e;null==(e=he.value)||e.style.setProperty("margin","auto"),ae.isEdit&&(ue.widthShow="8%",ue.widthLarge="13%")})),O({getTableFields:fe}),(l,t)=>(d(),a("div",{ref_key:"settingView",ref:he,class:"c-field-set",style:o({"--width-show":ue.widthShow,"--width-large":ue.widthLarge})},[n(c(g),{show:ue.spinning,tip:"...",style:{width:"100%",height:"100%"}},{default:h((()=>[r("div",F,[r("div",q,[r("div",{class:u(["setting-title",{"seting-title-api":!ue.isCustomSearch}])},[D,p(" 字段名称 "),N,p(" 显示 "),r("span",P,[pe("show")?(d(),f(c(m),{key:0,checked:ye("show"),"onUpdate:checked":t[0]||(t[0]=e=>be(e,"show"))},null,8,["checked"])):p("v-if",!0),w(" 显示 ")]),p(" 可编辑 "),e.isEdit?(d(),a("span",j,[pe("editable")?(d(),f(c(m),{key:0,checked:ye("editable"),"onUpdate:checked":t[1]||(t[1]=e=>be(e,"editable"))},null,8,["checked"])):p("v-if",!0),w(" 编辑 ")])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",R,[pe("required")?(d(),f(c(m),{key:0,checked:ye("required"),"onUpdate:checked":t[2]||(t[2]=e=>be(e,"required"))},null,8,["checked"])):p("v-if",!0),w(" 必填 ")])):p("v-if",!0),p(" 排序 "),r("span",I,[pe("sort")?(d(),f(c(m),{key:0,checked:ye("sort"),"onUpdate:checked":t[3]||(t[3]=e=>be(e,"sort"))},null,8,["checked"])):p("v-if",!0),w(" 排序 ")]),r("span",L,[n(c(m),{checked:ye("bold"),"onUpdate:checked":t[4]||(t[4]=e=>be(e,"bold"))},null,8,["checked"]),w(" 加粗 ")]),p(" 默认排序 "),T,p(" 固定 "),z,p(" 自定义标题 "),A,p(" 列宽 "),B],2),r("div",{ref:"setShow",class:u(["set-show",{"set-show-api":!ue.isCustomSearch}])},[n(c(C),{list:ue.fields,animation:"150","item-key":"id",tag:"ul"},{item:h((({element:l})=>{return[l.hide?p("v-if",!0):(d(),a("li",{key:0,class:"left-style",style:o((t=l,{background:ue.clickItem.id===t.id?"#f2f2f2":void 0})),onClick:e=>{return t=l,void(ue.clickItem=t);var t}},[r("span",H,[n(c(U),{trigger:"hover"},{trigger:h((()=>[J])),default:h((()=>[V])),_:1})]),p(" 字段名称 "),r("span",{class:u(["width-large title-item",{blue:l.extraField}])},[$,r("span",null,v(l.title),1)],2),p(" 显示 "),r("span",K,[k(n(c(m),{checked:l.show,"onUpdate:checked":e=>l.show=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 是否可编辑 "),e.isEdit?(d(),a("span",M,[k(n(c(m),{disabled:l.editableDisable,checked:l.editable,"onUpdate:checked":e=>l.editable=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 是否必填 "),e.isEdit?(d(),a("span",Q,[k(n(c(m),{disabled:l.requiredDisable,checked:l.required,"onUpdate:checked":e=>l.required=e},null,8,["disabled","checked","onUpdate:checked"]),[[y,"0001"!=l.id]])])):p("v-if",!0),p(" 排序 "),r("span",X,[k(n(c(m),{checked:l.sort,"onUpdate:checked":e=>l.sort=e,disabled:1==l.notParticipatingSort},null,8,["checked","onUpdate:checked","disabled"]),[[y,"0001"!=l.id]])]),p(" 加粗 "),r("span",Y,[k(n(c(m),{checked:l.bold,"onUpdate:checked":e=>l.bold=e},null,8,["checked","onUpdate:checked"]),[[y,"0001"!=l.id]])]),p(" 默认排序 "),r("span",Z,[k(n(c(S),{value:l.sortDirection,"onUpdate:value":e=>l.sortDirection=e,options:ce,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 固定 "),r("span",ee,[n(c(S),{value:l.fixedWay,"onUpdate:value":e=>l.fixedWay=e,options:ne,style:{width:"90%",display:"flex"}},null,8,["value","onUpdate:value"])]),p(" 自定义标题 "),r("span",le,[k(n(c(x),{value:l.alias,"onUpdate:value":e=>l.alias=e,style:{width:"90%"},clearable:""},null,8,["value","onUpdate:value"]),[[y,"0001"!=l.id]])]),p(" 列宽 "),r("span",te,[n(c(E),{value:l.columnWidth,"onUpdate:value":e=>l.columnWidth=e,clearable:""},null,8,["value","onUpdate:value"])])],12,G))];var t})),_:1},8,["list"])],2)]),ae.footerFlag?(d(),a("div",ie,[r("div",se,[p(" 底部按钮插槽 "),b(l.$slots,"footer",{},(()=>[n(c(_),{onPositiveClick:ke},{trigger:h((()=>[n(c(W),{style:{"margin-right":"8px"}},{default:h((()=>[w("恢复默认设置")])),_:1})])),default:h((()=>[w(" 确认要恢复系统默认设置吗? ")])),_:1}),n(c(W),{style:{"margin-right":"8px"},onClick:ve},{default:h((()=>[w("取消")])),_:1}),n(c(W),{type:"primary",onClick:we},{default:h((()=>[w("保存")])),_:1})]))])])):p("v-if",!0)])])),_:3},8,["show"])],4))}}),[["__file","FieldSet.vue"]]);export{de as default};
@@ -108,8 +108,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
108
108
  message?: string | undefined;
109
109
  } | undefined;
110
110
  option?: {
111
- text: string;
112
- value: any;
111
+ [x: string]: any;
113
112
  keyword?: string | undefined;
114
113
  disabled?: boolean | undefined;
115
114
  children?: any[] | undefined;
@@ -1802,8 +1801,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
1802
1801
  message?: string | undefined;
1803
1802
  } | undefined;
1804
1803
  option?: {
1805
- text: string;
1806
- value: any;
1804
+ [x: string]: any;
1807
1805
  keyword?: string | undefined;
1808
1806
  disabled?: boolean | undefined;
1809
1807
  children?: any[] | undefined;
@@ -4427,8 +4425,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
4427
4425
  message?: string | undefined;
4428
4426
  } | undefined;
4429
4427
  option?: {
4430
- text: string;
4431
- value: any;
4428
+ [x: string]: any;
4432
4429
  keyword?: string | undefined;
4433
4430
  disabled?: boolean | undefined;
4434
4431
  children?: any[] | undefined;
@@ -6133,8 +6130,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
6133
6130
  message?: string | undefined;
6134
6131
  } | undefined;
6135
6132
  option?: {
6136
- text: string;
6137
- value: any;
6133
+ [x: string]: any;
6138
6134
  keyword?: string | undefined;
6139
6135
  disabled?: boolean | undefined;
6140
6136
  children?: any[] | undefined;
@@ -7811,8 +7807,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
7811
7807
  message?: string | undefined;
7812
7808
  } | undefined;
7813
7809
  option?: {
7814
- text: string;
7815
- value: any;
7810
+ [x: string]: any;
7816
7811
  keyword?: string | undefined;
7817
7812
  disabled?: boolean | undefined;
7818
7813
  children?: any[] | undefined;
@@ -110,8 +110,7 @@ declare const _default: import("vue").DefineComponent<{
110
110
  message?: string | undefined;
111
111
  } | undefined;
112
112
  option?: {
113
- text: string;
114
- value: any;
113
+ [x: string]: any;
115
114
  keyword?: string | undefined;
116
115
  disabled?: boolean | undefined;
117
116
  children?: any[] | undefined;
@@ -1804,8 +1803,7 @@ declare const _default: import("vue").DefineComponent<{
1804
1803
  message?: string | undefined;
1805
1804
  } | undefined;
1806
1805
  option?: {
1807
- text: string;
1808
- value: any;
1806
+ [x: string]: any;
1809
1807
  keyword?: string | undefined;
1810
1808
  disabled?: boolean | undefined;
1811
1809
  children?: any[] | undefined;
@@ -4429,8 +4427,7 @@ declare const _default: import("vue").DefineComponent<{
4429
4427
  message?: string | undefined;
4430
4428
  } | undefined;
4431
4429
  option?: {
4432
- text: string;
4433
- value: any;
4430
+ [x: string]: any;
4434
4431
  keyword?: string | undefined;
4435
4432
  disabled?: boolean | undefined;
4436
4433
  children?: any[] | undefined;
@@ -6135,8 +6132,7 @@ declare const _default: import("vue").DefineComponent<{
6135
6132
  message?: string | undefined;
6136
6133
  } | undefined;
6137
6134
  option?: {
6138
- text: string;
6139
- value: any;
6135
+ [x: string]: any;
6140
6136
  keyword?: string | undefined;
6141
6137
  disabled?: boolean | undefined;
6142
6138
  children?: any[] | undefined;
@@ -7813,8 +7809,7 @@ declare const _default: import("vue").DefineComponent<{
7813
7809
  message?: string | undefined;
7814
7810
  } | undefined;
7815
7811
  option?: {
7816
- text: string;
7817
- value: any;
7812
+ [x: string]: any;
7818
7813
  keyword?: string | undefined;
7819
7814
  disabled?: boolean | undefined;
7820
7815
  children?: any[] | undefined;
@@ -73,8 +73,7 @@ declare const _default: import("vue").DefineComponent<{
73
73
  message?: string | undefined;
74
74
  } | undefined;
75
75
  option?: {
76
- text: string;
77
- value: any;
76
+ [x: string]: any;
78
77
  keyword?: string | undefined;
79
78
  disabled?: boolean | undefined;
80
79
  children?: any[] | undefined;
@@ -1779,8 +1778,7 @@ declare const _default: import("vue").DefineComponent<{
1779
1778
  message?: string | undefined;
1780
1779
  } | undefined;
1781
1780
  option?: {
1782
- text: string;
1783
- value: any;
1781
+ [x: string]: any;
1784
1782
  keyword?: string | undefined;
1785
1783
  disabled?: boolean | undefined;
1786
1784
  children?: any[] | undefined;
@@ -3457,8 +3455,7 @@ declare const _default: import("vue").DefineComponent<{
3457
3455
  message?: string | undefined;
3458
3456
  } | undefined;
3459
3457
  option?: {
3460
- text: string;
3461
- value: any;
3458
+ [x: string]: any;
3462
3459
  keyword?: string | undefined;
3463
3460
  disabled?: boolean | undefined;
3464
3461
  children?: any[] | undefined;
@@ -6,6 +6,14 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
6
6
  type: PropType<AnyObject[]>;
7
7
  default: () => never[];
8
8
  };
9
+ labelField: {
10
+ type: StringConstructor;
11
+ default: string;
12
+ };
13
+ valueField: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
9
17
  autograph: {
10
18
  type: StringConstructor;
11
19
  required: true;
@@ -46,6 +54,14 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
46
54
  type: PropType<AnyObject[]>;
47
55
  default: () => never[];
48
56
  };
57
+ labelField: {
58
+ type: StringConstructor;
59
+ default: string;
60
+ };
61
+ valueField: {
62
+ type: StringConstructor;
63
+ default: string;
64
+ };
49
65
  autograph: {
50
66
  type: StringConstructor;
51
67
  required: true;
@@ -85,6 +101,8 @@ export declare const LEVEL_SEARCH_CASCADER: import("vue").DefineComponent<{
85
101
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
86
102
  }, {
87
103
  options: AnyObject[];
104
+ labelField: string;
105
+ valueField: string;
88
106
  lazyRequest: boolean;
89
107
  requestCache: boolean;
90
108
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as r,computed as o,inject as t,watch as a,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as i,isString as l,isEmpty as s,isFunction as c,omit as d}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as p}from"../../constants/index.js";import{useCommonInjection as m}from"../../hooks/useCommonInjection.js";import{formRenderLog as f}from"../../utils/index.js";import{connect as y,mapProps as v}from"@formily/vue";import h from"../../../../search-cascader/index.js";import k from"../../../../../shared/components/no-data/NoData.vue.js";import{createVisitedSetter as j,assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as w}from"../../hooks/useFormField.js";import{useFormRequest as b}from"../../hooks/useFormRequest.js";const g=y(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},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:y}){const v=u(e,"value",y),_=r(!1),g=r([]),{field:K,fieldKey:O}=w(),q=o((()=>{var r,o,t;return null!=(t=null==(o=null==(r=e.wordbook)?void 0:r.render_key)?void 0:o[0])?t:"text"})),F=o((()=>{var r,o;return null!=(o=null==(r=e.wordbook)?void 0:r.value_key)?o:"value"})),S=o((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),x=t(p),{getSearchRequestInfo:C}=b();async function L(r,o){try{if(r&&!r.__keyword&&r.isLeaf)return t(r);if(null==r?void 0:r.__keyword){if(!l(r.id_link))return Promise.reject();const o=r.id_link.split("_").filter((e=>e)),t=await async function(r){if(!C().primaryKeyUrl)return[];try{return await x.addAsync(o(e.wordbook,e.autograph,r,O.value))}catch(e){l(e)&&f(e)}function o(r,o,t,a){const n=C();return{key:a,params:{autograph:o,tableId:r.id,primaryKeyValue:t.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(o);if(!t)return Promise.reject();const{lastOption:a,options:n}=function(e,r){let o=e[0];return{options:r.reduce(((r,a,n)=>{const u=t(e,a);return 0===n?(o=u,[u]):(Object.assign(u,{parent:o,isLeaf:n+1>=S.value}),o.children=[u],o=u,r)}),[]),lastOption:o};function t(e,r){return e.find((e=>e[F.value]===r))}}(t,o);return await L(a),s(a.children)?(v.value=function(e,r){return r.map((r=>e.find((e=>e[F.value]===r))))}(t,o),_.value=!1,Promise.reject()):(g.value=n,a)}{const n=await x.addAsync(function(r,t,a,n,u){const i={autograph:()=>t,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,o){return r?e.conObj||[]:o?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:o[F.value]}]:e.conObjFirstLevel||[]}(r,o,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>o,page:()=>1},s=Object.entries(i).reduce(((e,[o,t])=>(e[o]=l(t)?r[t]:c(t)?t():void 0,e)),{});return{...C(),params:s,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,K.value,r,O.value));if(r){if(!n.length)return t(r);r.children=n.map((e=>function(e,r,o){return{...e,parent:r,isLeaf:a(r)+1>=o}}(e,r,S.value)))}else g.value=n.map((e=>function(e,r){return e.__keyword=!!r,e.isLeaf=!!r,e}(e,o)))}}catch(e){l(e)&&f(e)}function t(e){return v.value=function(e){const r=[];let o=e;for(;o;)r.unshift(d(o,["parent","isLeaf","__keyword","children"])),o=o.parent;return r}(e),_.value=!1,Promise.reject()}function a(e){let r=1,o=e.parent;for(;o;)r++,o=o.parent;return r}}a((()=>e.wordbook),((r,o)=>{i(r,o)||(g.value=[],r&&(v.value||!e.lazyRequest)&&L())}),{immediate:!0});const{injectValueValidate:V,injectValueWatchFromEmpty:A,injectValueBindKey:I}=m();A(v,L),V(v);const P=I(v);return()=>n(h,{value:v.value,"onUpdate:value":e=>v.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:g.value,key:P.value,labelKey:q.value,valueKey:F.value,search:L,onFocus:j(K)},{empty:()=>n(k,null,null)})}}),v({dataSource:"options"},_));export{g as LEVEL_SEARCH_CASCADER};
1
+ import{defineComponent as e,ref as r,computed as t,inject as o,watch as a,createVNode as n}from"vue";import{useVModel as u}from"@vueuse/core";import{isEqual as i,isString as l,isEmpty as s,isFunction as c,omit as d}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as p}from"../../constants/index.js";import{useCommonInjection as f}from"../../hooks/useCommonInjection.js";import{formRenderLog as m}from"../../utils/index.js";import{connect as y,mapProps as v}from"@formily/vue";import h from"../../../../search-cascader/index.js";import k from"../../../../../shared/components/no-data/NoData.vue.js";import{createVisitedSetter as j,assignUpdateValue as _}from"../../utils/schema.js";import{useFormField as w}from"../../hooks/useFormField.js";import{useFormRequest as b}from"../../hooks/useFormRequest.js";const g=y(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:y}){const v=u(e,"value",y),_=r(!1),g=r([]),{field:F,fieldKey:K}=w(),O=t((()=>{var r,t,o,a;return null!=(a=null!=(o=null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0])?o:e.labelField)?a:"text"})),q=t((()=>{var r,t,o;return null!=(o=null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField)?o:"value"})),S=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),x=o(p),{getSearchRequestInfo:C}=b();async function L(r,t){try{if(r&&!r.__keyword&&r.isLeaf)return o(r);if(null==r?void 0:r.__keyword){if(!l(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e)),o=await async function(r){if(!C().primaryKeyUrl)return[];try{return await x.addAsync(t(e.wordbook,e.autograph,r,K.value))}catch(e){l(e)&&m(e)}function t(r,t,o,a){const n=C();return{key:a,params:{autograph:t,tableId:r.id,primaryKeyValue:o.join(","),page:1},...n,url:n.primaryKeyUrl,cache:e.requestCache}}}(t);if(!o)return Promise.reject();const{lastOption:a,options:n}=function(e,r){let t=e[0];return{options:r.reduce(((r,a,n)=>{const u=o(e,a);return 0===n?(t=u,[u]):(Object.assign(u,{parent:t,isLeaf:n+1>=S.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function o(e,r){return e.find((e=>e[q.value]===r))}}(o,t);return await L(a),s(a.children)?(v.value=function(e,r){return r.map((r=>e.find((e=>e[q.value]===r))))}(o,t),_.value=!1,Promise.reject()):(g.value=n,a)}{const n=await x.addAsync(function(r,o,a,n,u){const i={autograph:()=>o,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[q.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},s=Object.entries(i).reduce(((e,[t,o])=>(e[t]=l(o)?r[o]:c(o)?o():void 0,e)),{});return{...C(),params:s,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,F.value,r,K.value));if(r){if(!n.length)return o(r);r.children=n.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:a(r)+1>=t}}(e,r,S.value)))}else g.value=n.map((e=>function(e,r){return e.__keyword=!!r,e.isLeaf=!!r,e}(e,t)))}}catch(e){l(e)&&m(e)}function o(e){return v.value=function(e){const r=[];let t=e;for(;t;)r.unshift(d(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function a(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}a((()=>e.wordbook),((r,t)=>{i(r,t)||(g.value=[],r&&(v.value||!e.lazyRequest)&&L())}),{immediate:!0});const{injectValueValidate:V,injectValueWatchFromEmpty:A,injectValueBindKey:I}=f();A(v,L),V(v);const P=I(v);return()=>n(h,{value:v.value,"onUpdate:value":e=>v.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:g.value,key:P.value,labelKey:O.value,valueKey:q.value,search:L,onFocus:j(F)},{empty:()=>n(k,null,null)})}}),v({dataSource:"options"},_));export{g as LEVEL_SEARCH_CASCADER};
@@ -19,6 +19,14 @@ export declare const RADIO: import("vue").DefineComponent<{
19
19
  type: BooleanConstructor;
20
20
  default: boolean;
21
21
  };
22
+ labelField: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ valueField: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
22
30
  wordbook: {
23
31
  type: PropType<Partial<{
24
32
  level_num: number;
@@ -61,6 +69,14 @@ export declare const RADIO: import("vue").DefineComponent<{
61
69
  type: BooleanConstructor;
62
70
  default: boolean;
63
71
  };
72
+ labelField: {
73
+ type: StringConstructor;
74
+ default: string;
75
+ };
76
+ valueField: {
77
+ type: StringConstructor;
78
+ default: string;
79
+ };
64
80
  wordbook: {
65
81
  type: PropType<Partial<{
66
82
  level_num: number;
@@ -88,6 +104,8 @@ export declare const RADIO: import("vue").DefineComponent<{
88
104
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
89
105
  }, {
90
106
  options: AnyObject[];
107
+ labelField: string;
108
+ valueField: string;
91
109
  lazyRequest: boolean;
92
110
  requestCache: boolean;
93
111
  vertical: boolean;
@@ -111,6 +129,14 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
111
129
  type: BooleanConstructor;
112
130
  default: boolean;
113
131
  };
132
+ labelField: {
133
+ type: StringConstructor;
134
+ default: string;
135
+ };
136
+ valueField: {
137
+ type: StringConstructor;
138
+ default: string;
139
+ };
114
140
  wordbook: {
115
141
  type: PropType<Partial<{
116
142
  level_num: number;
@@ -153,6 +179,14 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
153
179
  type: BooleanConstructor;
154
180
  default: boolean;
155
181
  };
182
+ labelField: {
183
+ type: StringConstructor;
184
+ default: string;
185
+ };
186
+ valueField: {
187
+ type: StringConstructor;
188
+ default: string;
189
+ };
156
190
  wordbook: {
157
191
  type: PropType<Partial<{
158
192
  level_num: number;
@@ -180,6 +214,8 @@ export declare const CHECKBOX: import("vue").DefineComponent<{
180
214
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
181
215
  }, {
182
216
  options: AnyObject[];
217
+ labelField: string;
218
+ valueField: string;
183
219
  lazyRequest: boolean;
184
220
  requestCache: boolean;
185
221
  vertical: boolean;
@@ -1 +1 @@
1
- import{defineComponent as e,createVNode as o,isVNode as t}from"vue";import{connect as a,mapProps as l}from"@formily/vue";import{NSpace as r,NRadio as u,NRadioGroup as i,NCheckbox as n,NCheckboxGroup as p}from"naive-ui";import"../../../index.js";import{useComplexOptions as s}from"../../hooks/useComplexOptions.js";import"../../utils/index.js";import{useAutographOptions as m}from"../../hooks/useFormRenderOptions.js";import{useCommonInjection as v}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as c,createVisitedSetter as d}from"../../utils/schema.js";import{useFormField as f}from"../../hooks/useFormField.js";function y(a,l,u){return e({name:a,props:{value:{type:[String,Number,Object,Array]},options:{type:Array,default:()=>[]},autograph:{type:String},lazyRequest:{type:Boolean,default:!1},requestCache:{type:Boolean,default:!0},wordbook:{type:Object},vertical:{type:Boolean,default:!1},onChange:{}},emits:["update:value"],setup(e,{emit:a}){const{field:i}=f(),{renderComplexOption:n,valueRef:p}=s(e,a),{labelKey:c,valueKey:y,fullOptions:j}=m(e,p),{injectValueBindKey:b,injectValueValidate:h}=v();h(p);const k=b(p);return()=>o(l,{key:k.value,value:p.value,"onUpdate:value":e=>p.value=e,onClick:d(i)},{default:()=>[o(r,{vertical:e.vertical,"vertical-space":e.vertical},{default:()=>{var e;return[null==(e=j.value)?void 0:e.map((e=>{let a;return o(u,{key:e[y.value],value:e[y.value],disabled:e.disabled},"function"==typeof(l=a=n({value:p.value,option:e,valueKey:y.value,labelKey:c.value}))||"[object Object]"===Object.prototype.toString.call(l)&&!t(l)?a:{default:()=>[a]});var l}))]}})]})}})}const j=a(y("FormRadio",i,u),l({dataSource:"options"},c)),b=a(y("FormCheckbox",p,n),l({dataSource:"options"},c));export{b as CHECKBOX,j as RADIO};
1
+ import{defineComponent as e,createVNode as t,isVNode as o}from"vue";import{connect as a,mapProps as l}from"@formily/vue";import{NSpace as r,NRadio as u,NRadioGroup as i,NCheckbox as n,NCheckboxGroup as p}from"naive-ui";import"../../../index.js";import{useComplexOptions as s}from"../../hooks/useComplexOptions.js";import"../../utils/index.js";import{useAutographOptions as m}from"../../hooks/useFormRenderOptions.js";import{useCommonInjection as v}from"../../hooks/useCommonInjection.js";import{assignUpdateValue as d,createVisitedSetter as c}from"../../utils/schema.js";import{useFormField as f}from"../../hooks/useFormField.js";function y(a,l,u){return e({name:a,props:{value:{type:[String,Number,Object,Array]},options:{type:Array,default:()=>[]},autograph:{type:String},lazyRequest:{type:Boolean,default:!1},requestCache:{type:Boolean,default:!0},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},wordbook:{type:Object},vertical:{type:Boolean,default:!1},onChange:{}},emits:["update:value"],setup(e,{emit:a}){const{field:i}=f(),{renderComplexOption:n,valueRef:p}=s(e,a),{labelKey:d,valueKey:y,fullOptions:j}=m(e,p),{injectValueBindKey:b,injectValueValidate:h}=v();h(p);const k=b(p);return()=>t(l,{key:k.value,value:p.value,"onUpdate:value":e=>p.value=e,onClick:c(i)},{default:()=>[t(r,{vertical:e.vertical,"vertical-space":e.vertical},{default:()=>{var e;return[null==(e=j.value)?void 0:e.map((e=>{let a;return t(u,{key:e[y.value],value:e[y.value],disabled:e.disabled},"function"==typeof(l=a=n({value:p.value,option:e,valueKey:y.value,labelKey:d.value}))||"[object Object]"===Object.prototype.toString.call(l)&&!o(l)?a:{default:()=>[a]});var l}))]}})]})}})}const j=a(y("FormRadio",i,u),l({dataSource:"options"},d)),b=a(y("FormCheckbox",p,n),l({dataSource:"options"},d));export{b as CHECKBOX,j as RADIO};
@@ -13,6 +13,14 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
13
13
  type: PropType<AnyObject[]>;
14
14
  default: () => never[];
15
15
  };
16
+ labelField: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ valueField: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
16
24
  urlConfig: {
17
25
  type: PropType<UrlConfig>;
18
26
  };
@@ -29,6 +37,14 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
29
37
  type: PropType<AnyObject[]>;
30
38
  default: () => never[];
31
39
  };
40
+ labelField: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ valueField: {
45
+ type: StringConstructor;
46
+ default: string;
47
+ };
32
48
  urlConfig: {
33
49
  type: PropType<UrlConfig>;
34
50
  };
@@ -37,5 +53,7 @@ export declare const REMOTE_SEARCH: import("vue").DefineComponent<{
37
53
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
38
54
  }, {
39
55
  options: AnyObject[];
56
+ labelField: string;
57
+ valueField: string;
40
58
  requestCache: boolean;
41
59
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as o,inject as u,watch as a,createVNode as r}from"vue";import{connect as t,mapProps as n}from"@formily/vue";import{useVModel as i,useDebounceFn as s}from"@vueuse/core";import{isString as v,isArray as m,cloneDeep as p,isEqual as d}from"lodash-es";import{NSelect as f}from"naive-ui";import"../../../index.js";import{InjectionAsyncQueue as c,InjectionChangeContextCollector as y,InjectionFormItemDepsCollector as h}from"../../constants/index.js";import{createUrlConfigParams as C,formRenderLog as g}from"../../utils/index.js";import{useCommonInjection as j,useSelectOptionProps as x}from"../../hooks/useCommonInjection.js";import{useFormField as F}from"../../hooks/useFormField.js";import{createVisitedSetter as K,assignUpdateValue as b,assignClearBindVisited as k}from"../../utils/schema.js";const w=t(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},urlConfig:{type:Object},onChange:{}},emits:["update:value"],setup(e,{slots:t,emit:n}){const b=i(e,"value",n),{field:k,fieldKey:w}=F(),S=l(null),V=o((()=>{var l,o;return null!=(o=null==(l=e.urlConfig)?void 0:l.nameKey)?o:"text"})),q=o((()=>{var l,o;return null!=(o=null==(l=e.urlConfig)?void 0:l.valueKey)?o:"value"})),A=u(c),B=s((async(l="",o="label")=>{if(!e.urlConfig)return S.value=null;try{S.value=await A.addAsync(await C({config:{...e.urlConfig,params:{...e.urlConfig.params,["value"===o?q.value:"keyword"]:l}},cache:e.requestCache,field:k.value}))}catch(e){v(e)&&g(e)}})),O=o((()=>m(S.value)?S.value:m(e.options)?e.options:[])),{injectValueValidate:P,injectValueBindKey:U}=j();P(b);const D=U(b);a(b,(e=>{if(e&&!O.value.find((l=>l[q.value]===e)))return B(e,"value")}));u(y).setContext(w.value,(e=>{return{currentOption:p((l=e,O.value.find((e=>e[q.value]===l))))};var l}));const I=u(h);a((()=>e.urlConfig),((e,l)=>{d(e,l)||(S.value=null,e&&(I.setDeps(w.value,e.dependKey||[],(async()=>{S.value=null,b.value=null})),b.value&&B(b.value,"value")))}),{immediate:!0});const{menuProps:R,nodeProps:z}=x();return()=>r(f,{remote:!0,filterable:!0,key:D.value,value:b.value,"onUpdate:value":e=>b.value=e,labelField:V.value,valueField:q.value,"menu-props":R,"node-props":z,onSearch:B,"onUpdate:show":e=>e&&B(),options:O.value,onFocus:K(k)},t)}}),n(b,k));export{w as REMOTE_SEARCH};
1
+ import{defineComponent as e,ref as l,computed as u,inject as a,watch as o,createVNode as t}from"vue";import{connect as n,mapProps as r}from"@formily/vue";import{useVModel as i,useDebounceFn as s}from"@vueuse/core";import{isString as v,isArray as m,cloneDeep as p,isEqual as d}from"lodash-es";import{NSelect as f}from"naive-ui";import"../../../index.js";import{InjectionAsyncQueue as c,InjectionChangeContextCollector as y,InjectionFormItemDepsCollector as g}from"../../constants/index.js";import{createUrlConfigParams as h,formRenderLog as C}from"../../utils/index.js";import{useCommonInjection as j,useSelectOptionProps as F}from"../../hooks/useCommonInjection.js";import{useFormField as x}from"../../hooks/useFormField.js";import{createVisitedSetter as b,assignUpdateValue as K,assignClearBindVisited as S}from"../../utils/schema.js";const k=n(e({name:"FormRemoteSearch",props:{value:{type:String},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},urlConfig:{type:Object},onChange:{}},emits:["update:value"],setup(e,{slots:n,emit:r}){const K=i(e,"value",r),{field:S,fieldKey:k}=x(),w=l(null),V=u((()=>{var l,u,a;return null!=(a=null!=(u=null==(l=e.urlConfig)?void 0:l.nameKey)?u:e.labelField)?a:"text"})),q=u((()=>{var l,u,a;return null!=(a=null!=(u=null==(l=e.urlConfig)?void 0:l.valueKey)?u:e.valueField)?a:"value"})),A=a(c),B=s((async(l="",u="label")=>{if(!e.urlConfig)return w.value=null;try{w.value=await A.addAsync(await h({config:{...e.urlConfig,params:{...e.urlConfig.params,["value"===u?q.value:"keyword"]:l}},cache:e.requestCache,field:S.value}))}catch(e){v(e)&&C(e)}})),O=u((()=>m(w.value)?w.value:m(e.options)?e.options:[])),{injectValueValidate:P,injectValueBindKey:U}=j();P(K);const D=U(K);o(K,(e=>{if(e&&!O.value.find((l=>l[q.value]===e)))return B(e,"value")}));a(y).setContext(k.value,(e=>{return{currentOption:p((l=e,O.value.find((e=>e[q.value]===l))))};var l}));const I=a(g);o((()=>e.urlConfig),((e,l)=>{d(e,l)||(w.value=null,e&&(I.setDeps(k.value,e.dependKey||[],(async()=>{w.value=null,K.value=null})),K.value&&B(K.value,"value")))}),{immediate:!0});const{menuProps:R,nodeProps:z}=F();return()=>t(f,{remote:!0,filterable:!0,key:D.value,value:K.value,"onUpdate:value":e=>K.value=e,labelField:V.value,valueField:q.value,"menu-props":R,"node-props":z,onSearch:B,"onUpdate:show":e=>e&&B(),options:O.value,onFocus:b(S)},n)}}),r(K,S));export{k as REMOTE_SEARCH};
@@ -23,6 +23,14 @@ export declare const SEARCH_CASCADER: import("vue").DefineComponent<{
23
23
  type: BooleanConstructor;
24
24
  default: boolean;
25
25
  };
26
+ labelField: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ valueField: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
26
34
  onChange: {};
27
35
  value: {};
28
36
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -47,12 +55,22 @@ export declare const SEARCH_CASCADER: import("vue").DefineComponent<{
47
55
  type: BooleanConstructor;
48
56
  default: boolean;
49
57
  };
58
+ labelField: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ valueField: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
50
66
  onChange: {};
51
67
  value: {};
52
68
  }>> & {
53
69
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
54
70
  }, {
55
71
  options: AnyObject[];
72
+ labelField: string;
73
+ valueField: string;
56
74
  requestCache: boolean;
57
75
  filterable: boolean;
58
76
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,computed as a,inject as o,watch as r,createVNode as l,nextTick as n}from"vue";import{isEqual as i,isArray as u}from"lodash-es";import"../../../index.js";import{useCommonInjection as s}from"../../hooks/useCommonInjection.js";import{InjectionAsyncQueue as c,InjectionFormUUID as p}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"../../utils/index.js";import{useFormField as m}from"../../hooks/useFormField.js";import{NCascader as d}from"naive-ui";import"@vueuse/core";import"date-fns";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"../../hooks/useFormValidator.js";import"@formily/core";import"@formily/reactive";import{connect as v,mapProps as f}from"@formily/vue";import"@vue/shared";import"./index.js";import"../../hooks/useFormRenderOptions.js";import{createVisitedSetter as h,assignUpdateValue as y,traverseDependKey as j}from"../../utils/schema.js";const b=v(e({name:"FormCascader",props:{options:{type:Array,default:()=>[]},depth:{type:[Number,String]},urlConfig:{type:Object},requestCache:{type:Boolean,default:!0},onFocus:{type:Function},filterable:{type:Boolean,default:!1},onChange:{},value:{}},emits:["update:value"],setup(e,{slots:v,emit:f}){const y=t(),{field:b,title:k}=m(),C=a((()=>{var t,a;return null!=(a=null==(t=e.urlConfig)?void 0:t.nameKey)?a:"text"})),g=a((()=>{var t,a;return null!=(a=null==(t=e.urlConfig)?void 0:t.valueKey)?a:"value"})),A=a((()=>{try{const t=Array.isArray(e.value)?e.value:JSON.parse(e.value||"");return Array.isArray(t)&&t.length?t.map((e=>e[C.value])).join(" / "):null}catch(e){return null}}));function S(e,t,a){f("update:value",a.map((function(e){return{...e,label:e[C.value],children:void 0,parent:void 0}})))}const F=o(c);async function w(t){e.filterable?await async function(){if(!e.urlConfig||y.value&&e.requestCache)return;const t=await F.addAsync({...e.urlConfig,params:{lvlnr:"1"},key:k.value,cache:e.requestCache});function a(e,t){const o={[C.value]:e[C.value],[g.value]:e[g.value],depth:t+1,isLeaf:!0};return u(e.children)&&(o.children=e.children.map((e=>a(e,t+1))),o.isLeaf=!e.children.length),o}y.value=t.map((e=>a(e,0)))}():await async function(t){if(r(e,t))return;const a=await F.addAsync(l(s(t),u(e),k.value,t));if(!a.length&&t)return t.isLeaf=!0,S(0,0,n(t)),void(K.value=!1);const o=a.map((e=>i(e,s(t))));function r(e,t){return!u(e)||!t&&y.value&&e.requestCache||s(t)>=s(e)-1}function l(t,a,o,r){const l={lvlnr:t+1+""};return r&&a.dependKey&&j(a.dependKey,((e,t)=>{l[t]=r[e]})),{params:l,...a,key:o,cache:e.requestCache}}function n(e){let t=e;const a=[e];for(;t.parent;)a.unshift(t.parent),t=t.parent;return a}function i(a,o){return{[C.value]:a[C.value],[g.value]:a[g.value],depth:o+1,parent:t,isLeaf:o+2>=s(e)}}function u(e){return e.urlConfig}function s(e){var t;return null!=(t=null==e?void 0:e.depth)?t:-1}t?t.children=o:y.value=o}(t),await x()}const H=`form-render__cascade--menu-${o(p)}`;async function x(){await n();const e=document.querySelector(`.${H} .v-vl`);e&&e.dispatchEvent(new CustomEvent("scroll"))}const{injectValueValidate:L,injectValueWatchFromEmpty:q,injectValueBindKey:B}=s();q((()=>e.value),w),L((()=>e.value)),r((()=>e.urlConfig),(async(e,t)=>{i(e,t)||(y.value=null,await w())}));const K=t(!1);function V(e){K.value=!!e,e&&w()}const E=a((()=>y.value||e.options||[])),O=a((()=>!e.filterable)),W=B(A);return()=>l(d,{key:W.value,remote:O.value,filterable:e.filterable,"menu-props":{class:H,onClick:x},checkStrategy:"child",show:!!K.value,"onUpdate:show":V,value:A.value,"onUpdate:value":S,labelField:C.value,valueField:g.value,options:E.value,onLoad:w,onFocus:h(b)},v)}}),f({dataSource:"options"},y));export{b as SEARCH_CASCADER};
1
+ import{defineComponent as e,ref as t,computed as a,inject as l,watch as r,createVNode as o,nextTick as n}from"vue";import{isEqual as i,isArray as u}from"lodash-es";import"../../../index.js";import{useCommonInjection as s}from"../../hooks/useCommonInjection.js";import{InjectionAsyncQueue as c,InjectionFormUUID as p}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"../../utils/index.js";import{useFormField as d}from"../../hooks/useFormField.js";import{NCascader as m}from"naive-ui";import"@vueuse/core";import"date-fns";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"../../hooks/useFormValidator.js";import"@formily/core";import"@formily/reactive";import{connect as v,mapProps as f}from"@formily/vue";import"@vue/shared";import"./index.js";import"../../hooks/useFormRenderOptions.js";import{createVisitedSetter as h,assignUpdateValue as y,traverseDependKey as j}from"../../utils/schema.js";const b=v(e({name:"FormCascader",props:{options:{type:Array,default:()=>[]},depth:{type:[Number,String]},urlConfig:{type:Object},requestCache:{type:Boolean,default:!0},onFocus:{type:Function},filterable:{type:Boolean,default:!1},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},onChange:{},value:{}},emits:["update:value"],setup(e,{slots:v,emit:f}){const y=t(),{field:b,title:k}=d(),C=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.nameKey)?a:e.labelField)?l:"text"})),g=a((()=>{var t,a,l;return null!=(l=null!=(a=null==(t=e.urlConfig)?void 0:t.valueKey)?a:e.valueField)?l:"value"})),F=a((()=>{try{const t=Array.isArray(e.value)?e.value:JSON.parse(e.value||"");return Array.isArray(t)&&t.length?t.map((e=>e[C.value])).join(" / "):null}catch(e){return null}}));function S(e,t,a){f("update:value",a.map((function(e){return{...e,label:e[C.value],children:void 0,parent:void 0}})))}const A=l(c);async function w(t){e.filterable?await async function(){if(!e.urlConfig||y.value&&e.requestCache)return;const t=await A.addAsync({...e.urlConfig,params:{lvlnr:"1"},key:k.value,cache:e.requestCache});function a(e,t){const l={[C.value]:e[C.value],[g.value]:e[g.value],depth:t+1,isLeaf:!0};return u(e.children)&&(l.children=e.children.map((e=>a(e,t+1))),l.isLeaf=!e.children.length),l}y.value=t.map((e=>a(e,0)))}():await async function(t){if(r(e,t))return;const a=await A.addAsync(o(s(t),u(e),k.value,t));if(!a.length&&t)return t.isLeaf=!0,S(0,0,n(t)),void(K.value=!1);const l=a.map((e=>i(e,s(t))));function r(e,t){return!u(e)||!t&&y.value&&e.requestCache||s(t)>=s(e)-1}function o(t,a,l,r){const o={lvlnr:t+1+""};return r&&a.dependKey&&j(a.dependKey,((e,t)=>{o[t]=r[e]})),{params:o,...a,key:l,cache:e.requestCache}}function n(e){let t=e;const a=[e];for(;t.parent;)a.unshift(t.parent),t=t.parent;return a}function i(a,l){return{[C.value]:a[C.value],[g.value]:a[g.value],depth:l+1,parent:t,isLeaf:l+2>=s(e)}}function u(e){return e.urlConfig}function s(e){var t;return null!=(t=null==e?void 0:e.depth)?t:-1}t?t.children=l:y.value=l}(t),await x()}const H=`form-render__cascade--menu-${l(p)}`;async function x(){await n();const e=document.querySelector(`.${H} .v-vl`);e&&e.dispatchEvent(new CustomEvent("scroll"))}const{injectValueValidate:L,injectValueWatchFromEmpty:q,injectValueBindKey:B}=s();q((()=>e.value),w),L((()=>e.value)),r((()=>e.urlConfig),(async(e,t)=>{i(e,t)||(y.value=null,await w())}));const K=t(!1);function V(e){K.value=!!e,e&&w()}const E=a((()=>y.value||e.options||[])),O=a((()=>!e.filterable)),W=B(F);return()=>o(m,{key:W.value,remote:O.value,filterable:e.filterable,"menu-props":{class:H,onClick:x},checkStrategy:"child",show:!!K.value,"onUpdate:show":V,value:F.value,"onUpdate:value":S,labelField:C.value,valueField:g.value,options:E.value,onLoad:w,onFocus:h(b)},v)}}),f({dataSource:"options"},y));export{b as SEARCH_CASCADER};
@@ -20,6 +20,14 @@ export declare const SELECT: import("vue").DefineComponent<{
20
20
  default: () => never[];
21
21
  };
22
22
  onChange: {};
23
+ labelField: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ valueField: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
23
31
  allowCreate: BooleanConstructor;
24
32
  urlConfig: {
25
33
  type: PropType<UrlConfig>;
@@ -58,7 +66,11 @@ export declare const SELECT: import("vue").DefineComponent<{
58
66
  getRecommendInfo: {
59
67
  type: PropType<() => RecommendIds>;
60
68
  };
61
- recommendNum: {
69
+ commonNum: {
70
+ type: NumberConstructor;
71
+ default: number;
72
+ };
73
+ recentNum: {
62
74
  type: NumberConstructor;
63
75
  default: number;
64
76
  };
@@ -83,6 +95,14 @@ export declare const SELECT: import("vue").DefineComponent<{
83
95
  default: () => never[];
84
96
  };
85
97
  onChange: {};
98
+ labelField: {
99
+ type: StringConstructor;
100
+ default: string;
101
+ };
102
+ valueField: {
103
+ type: StringConstructor;
104
+ default: string;
105
+ };
86
106
  allowCreate: BooleanConstructor;
87
107
  urlConfig: {
88
108
  type: PropType<UrlConfig>;
@@ -121,7 +141,11 @@ export declare const SELECT: import("vue").DefineComponent<{
121
141
  getRecommendInfo: {
122
142
  type: PropType<() => RecommendIds>;
123
143
  };
124
- recommendNum: {
144
+ commonNum: {
145
+ type: NumberConstructor;
146
+ default: number;
147
+ };
148
+ recentNum: {
125
149
  type: NumberConstructor;
126
150
  default: number;
127
151
  };
@@ -134,10 +158,13 @@ export declare const SELECT: import("vue").DefineComponent<{
134
158
  onPostRecommend?: ((...args: any[]) => any) | undefined;
135
159
  }, {
136
160
  options: AnyObject[];
161
+ labelField: string;
162
+ valueField: string;
137
163
  lazyRequest: boolean;
138
164
  requestCache: boolean;
139
165
  recommend: boolean;
140
166
  recommendCache: boolean;
141
- recommendNum: number;
167
+ commonNum: number;
168
+ recentNum: number;
142
169
  allowCreate: boolean;
143
170
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as o,inject as t,ref as a,createVNode as r}from"vue";import{useDebounceFn as l}from"@vueuse/core";import{cloneDeep as s,isString as i}from"lodash-es";import{useCommonInjection as n,useSelectOptionProps as u}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as p}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"../../../index.js";import"../../utils/index.js";import{useFormField as m}from"../../hooks/useFormField.js";import{NSelect as c}from"naive-ui";import"date-fns";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"../../hooks/useFormValidator.js";import"@formily/core";import"@formily/reactive";import{connect as d,mapProps as y}from"@formily/vue";import"@vue/shared";import"./index.js";import{useUrlConfigOptions as v,useAutographOptions as f,useRecommendOptions as h,searchContentMatcher as j}from"../../hooks/useFormRenderOptions.js";import{createVisitedSetter as b,assignUpdateValue as k,assignClearBindVisited as S}from"../../utils/schema.js";const g=d(e({name:"FormSelect",props:{value:{type:[String,Array]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},allowCreate:Boolean,urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},recommendNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1}},emits:["update:value","postRecommend"],setup(e,{slots:d,emit:y}){const k=o({get:()=>e.value,async set(e){y("update:value",e),C(e)}}),{labelKey:S,valueKey:g,fetchData:A,fullOptions:F,filterOptions:H}=e.urlConfig?v(e,k):f(e,k),{getRecommend:B,postRecommend:C,sortedOptions:x}=h(e,H,y,S,g),{field:O,fieldKey:R}=m();t(p).setContext(R.value,(e=>{return{currentOption:s((o=e,F.value.find((e=>e[g.value]===o))))};var o}));const L=a(""),V=l((async(e="")=>{L.value=e,A(e),B(e)}),300),{injectValueValidate:w,injectValueWatchFromEmpty:K,injectValueBindKey:P}=n();K(k,V),w(k);const W=P(k),{menuProps:q,nodeProps:I}=u();function N(e){const o=e[S.value];if(!o||!i(o))return"";const t=j(L.value,o);return t?r("section",null,[t.map(((e,o)=>0!==o&&e?r("span",{style:{color:o%2==0?"var(--n-option-text-color-active)":""}},[e]):null))]):o}const U=o((()=>x.value.length||!e.allowCreate?x.value:L.value?[{[S.value]:L.value,[g.value]:L.value},...x.value]:x.value));return()=>r(c,{key:W.value,remote:!0,filterable:!0,value:k.value,"onUpdate:value":e=>k.value=e,"menu-props":q,"node-props":I,labelField:S.value,valueField:g.value,options:U.value,onSearch:V,"onUpdate:show":e=>e&&V(),onFocus:b(O),renderLabel:N},d)}}),y({dataSource:"options"},k,S));export{g as SELECT};
1
+ import{defineComponent as e,computed as o,inject as t,ref as a,createVNode as l}from"vue";import{useDebounceFn as r}from"@vueuse/core";import{cloneDeep as s,isString as i}from"lodash-es";import{useCommonInjection as n,useSelectOptionProps as u}from"../../hooks/useCommonInjection.js";import{InjectionChangeContextCollector as p}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"../../../index.js";import"../../utils/index.js";import{useFormField as m}from"../../hooks/useFormField.js";import{NSelect as d}from"naive-ui";import"date-fns";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"../../hooks/useFormValidator.js";import"@formily/core";import"@formily/reactive";import{connect as c,mapProps as y}from"@formily/vue";import"@vue/shared";import"./index.js";import{useUrlConfigOptions as v,useAutographOptions as f,useRecommendOptions as h,searchContentMatcher as j}from"../../hooks/useFormRenderOptions.js";import{createVisitedSetter as b,assignUpdateValue as k,assignClearBindVisited as S}from"../../utils/schema.js";const g=c(e({name:"FormSelect",props:{value:{type:[String,Array]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},allowCreate:Boolean,urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1}},emits:["update:value","postRecommend"],setup(e,{slots:c,emit:y}){const k=o({get:()=>e.value,async set(e){y("update:value",e),B(e)}}),{labelKey:S,valueKey:g,fetchData:F,fullOptions:A,filterOptions:H}=e.urlConfig?v(e,k):f(e,k),{getRecommend:x,postRecommend:B,sortedOptions:C}=h(e,H,y,S,g),{field:O,fieldKey:R}=m();t(p).setContext(R.value,(e=>{return{currentOption:s((o=e,A.value.find((e=>e[g.value]===o))))};var o}));const L=a(""),V=r((async(e="")=>{L.value=e,F(e),x(e)}),300),{injectValueValidate:w,injectValueWatchFromEmpty:K,injectValueBindKey:N}=n();K(k,V),w(k);const P=N(k),{menuProps:W,nodeProps:q}=u();function I(e){const o=e[S.value];if(!o||!i(o))return"";const t=j(L.value,o);return t?l("section",null,[t.map(((e,o)=>0!==o&&e?l("span",{style:{color:o%2==0?"var(--n-option-text-color-active)":""}},[e]):null))]):o}const U=o((()=>C.value.length||!e.allowCreate?C.value:L.value?[{[S.value]:L.value,[g.value]:L.value},...C.value]:C.value));return()=>l(d,{key:P.value,remote:!0,filterable:!0,value:k.value,"onUpdate:value":e=>k.value=e,"menu-props":W,"node-props":q,labelField:S.value,valueField:g.value,options:U.value,onSearch:V,"onUpdate:show":e=>e&&V(),onFocus:b(O),renderLabel:I},c)}}),y({dataSource:"options"},k,S));export{g as SELECT};
@@ -9,13 +9,16 @@ export declare function useRecommendOptions(props: {
9
9
  recentList?: RecommendItem[];
10
10
  getRecommendInfo?: () => RecommendIds;
11
11
  recommendCache: boolean;
12
- recommendNum: number;
12
+ commonNum: number;
13
+ recentNum: number;
13
14
  }, options: Ref<AnyObject[]>, emit: Func, labelKey: Ref<string>, valueKey: Ref<string>): {
14
15
  postRecommend: (value: unknown) => Promise<void>;
15
16
  getRecommend: (content?: string) => Promise<void>;
16
17
  sortedOptions: import("vue").ComputedRef<AnyObject[]>;
17
18
  };
18
19
  export declare function useUrlConfigOptions(props: {
20
+ labelField?: string;
21
+ valueField?: string;
19
22
  urlConfig?: UrlConfig;
20
23
  options?: AnyObject[];
21
24
  requestCache: boolean;
@@ -27,13 +30,15 @@ export declare function useUrlConfigOptions(props: {
27
30
  fullOptions: import("vue").ComputedRef<AnyObject[]>;
28
31
  fetchData: (content?: string) => Promise<null | undefined>;
29
32
  };
30
- export declare function useAutographOptions(props: {
31
- requestCache?: boolean;
32
- wordbook?: FormWordbook;
33
- autograph?: string;
34
- lazyRequest?: boolean;
35
- options?: AnyObject[];
36
- }, valueRef: Ref): {
33
+ export declare function useAutographOptions(props: Partial<{
34
+ labelField: string;
35
+ valueField: string;
36
+ requestCache: boolean;
37
+ wordbook: FormWordbook;
38
+ autograph: string;
39
+ lazyRequest: boolean;
40
+ options: AnyObject[];
41
+ }>, valueRef: Ref): {
37
42
  labelKey: import("vue").ComputedRef<string>;
38
43
  valueKey: import("vue").ComputedRef<string>;
39
44
  filterOptions: import("vue").ComputedRef<AnyObject[]>;
@@ -1 +1 @@
1
- import{checkInSetupEnv as e,jsonParse as n}from"../../../../shared/utils/index.js";import{useMemoize as t,useDebounceFn as o}from"@vueuse/core";import{identity as r,uniqBy as u,isString as l,isEqual as a,omit as i,isFunction as c}from"lodash-es";import{computed as s,inject as v,ref as m,watch as d}from"vue";import"../../index.js";import{InjectionAsyncQueue as f,InjectionFormItemDepsCollector as y}from"../constants/index.js";import{createUrlConfigParams as p,formRenderLog as h,keywordMatcher as g}from"../utils/index.js";import{useFormField as w}from"./useFormField.js";import{useFormRequest as k}from"./useFormRequest.js";function R(e,n){const t=m();return s({get:()=>t.value?t.value:e[n],set(e){t.value=e}})}const C=(()=>{const e=new Map,n=t((e=>new RegExp(`(.*)${e.split("").map((e=>`(${e})`)).join("(.*)")}(.*)`)),{getKey:r});return(t,o)=>{const r=e.get(t)||{};return e.set(t,r),Reflect.has(r,o)?r[o]:r[o]=o.match(n(t))}})();function b(){const e=m();return{searchContent:e,optionSearchFilter:function(n,t){return e.value?n.filter((n=>function(n,t){if(!e.value)return!0;const o=n?n[t]:"";return!!l(o)&&(!!C(e.value,o)||g(e.value,n.keyword))}(n,t))):n}}}function K(e,t,o,r,l){const a=R(e,"commonList"),m=R(e,"recentList"),{searchContent:d,optionSearchFilter:y}=b();function p(e){return n(e.itemObj)}const h=s((()=>{var e,n;return null!=(n=null==(e=a.value)?void 0:e.map(p))?n:[]})),g=s((()=>{var e,n;return null!=(n=null==(e=m.value)?void 0:e.map(p))?n:[]})),C=s((()=>{if(!e.recommend||!h.value.length&&!g.value.length)return t.value;const n=u(h.value.concat(g.value),(e=>e[l.value])),o=t.value.filter((e=>n.every((function(n){return n[l.value]!==e[l.value]}))));return[...y(n,r.value),...o]})),{getRecommendRequestInfo:K,getHttpInstance:j}=k();function O(n){const{url:t,getRecommendIds:o}=K(),r=c(o)?o():{},u=c(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:t[n],info:Object.assign({},r,u)}}const{fieldKey:q}=w(),x=v(f);return{postRecommend:async function(n){if(!e.recommend)return;const t=j();if(!t)return;const{url:r,info:u}=O("post"),a=C.value.find((e=>e[l.value]===n));a&&o("postRecommend",await t.post(r,{...u,keyword:"",itemId:l.value,itemObj:JSON.stringify(a)}))},getRecommend:async function(n){if(!e.recommend)return;if(d.value=n,a.value&&m.value&&e.recommendCache)return;const t=await x.addAsync(function(n,t){const{url:o,info:r}=O("get");return{url:o,method:"get",key:n,cache:t,params:{...r,recNum:e.recommendNum,keyword:""}}}(q.value,e.recommendCache)),{commonly:o,recently:r}=t.reduce(((e,n)=>("commonly"===n.type?e.commonly.push(i(n,["type"])):"recently"===n.type&&e.recently.push(i(n,["type"])),e)),{commonly:[],recently:[]});a.value=o,m.value=r},sortedOptions:C}}function j(n,t){e();const r=v(f),u=s((()=>{var e,t;return null!=(t=null==(e=n.urlConfig)?void 0:e.nameKey)?t:"text"})),i=s((()=>{var e,t;return null!=(t=null==(e=n.urlConfig)?void 0:e.valueKey)?t:"value"})),{searchContent:c,optionSearchFilter:g}=b(),k=m(null),{field:R,fieldKey:C}=w(),K=o((async function(e){if(c.value=e||"",!n.urlConfig)return k.value=null;try{k.value=await r.addAsync(await p({config:n.urlConfig,cache:n.requestCache,field:R.value}))}catch(e){l(e)&&h(e)}}),300),j=s((()=>k.value?g(k.value,u.value):Array.isArray(n.options)?g(n.options,u.value):[])),O=s((()=>k.value||n.options||[])),q=v(y);return d((()=>n.urlConfig),((e,o)=>{a(e,o)||(k.value=null,e&&(q.setDeps(C.value,e.dependKey||[],(async()=>{k.value=null,t.value=null,!n.lazyRequest&&await K()})),(t.value||!n.lazyRequest)&&K()))}),{immediate:!0}),{labelKey:u,valueKey:i,filterOptions:j,fullOptions:O,fetchData:K}}function O(n,t){e();const r=v(f),u=s((()=>{var e,t,o;return null!=(o=null==(t=null==(e=n.wordbook)?void 0:e.render_key)?void 0:t[0])?o:"text"})),i=s((()=>{var e,t;return null!=(t=null==(e=n.wordbook)?void 0:e.value_key)?t:"value"})),{searchContent:c,optionSearchFilter:y}=b(),p=m(null),{fieldKey:g}=w(),{getSearchRequestInfo:R}=k(),C=o((async function(e){if(c.value=e||"",!n.autograph||!n.wordbook)return p.value=null;try{p.value=await r.addAsync(function(e,t,o){const r={autograph:t,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1};return{...R(),params:r,key:o,cache:n.requestCache}}(n.wordbook,n.autograph,g.value))}catch(e){l(e)&&h(e)}}),300),K=s((()=>p.value?y(p.value,u.value):Array.isArray(n.options)?y(n.options,u.value):[])),j=s((()=>p.value||n.options||[]));return d((()=>n.wordbook),((e,o)=>{a(e,o)||(p.value=null,e&&(t.value||!n.lazyRequest)&&C())}),{immediate:!0}),{labelKey:u,valueKey:i,filterOptions:K,fullOptions:j,fetchData:C}}export{C as searchContentMatcher,O as useAutographOptions,K as useRecommendOptions,j as useUrlConfigOptions};
1
+ import{checkInSetupEnv as e,jsonParse as n}from"../../../../shared/utils/index.js";import{useMemoize as t,useDebounceFn as l}from"@vueuse/core";import{identity as u,uniqBy as o,isString as r,isEqual as a,omit as i,isFunction as c}from"lodash-es";import{computed as s,inject as m,ref as v,watch as d}from"vue";import"../../index.js";import{InjectionAsyncQueue as f,InjectionFormItemDepsCollector as y}from"../constants/index.js";import{createUrlConfigParams as p,formRenderLog as h,keywordMatcher as g}from"../utils/index.js";import{useFormField as w}from"./useFormField.js";import{useFormRequest as k}from"./useFormRequest.js";function R(e,n){const t=v();return s({get:()=>t.value?t.value:e[n],set(e){t.value=e}})}const b=(()=>{const e=new Map,n=t((e=>new RegExp(`(.*)${e.split("").map((e=>`(${e})`)).join("(.*)")}(.*)`)),{getKey:u});return(t,l)=>{const u=e.get(t)||{};return e.set(t,u),Reflect.has(u,l)?u[l]:u[l]=l.match(n(t))}})();function C(){const e=v();return{searchContent:e,optionSearchFilter:function(n,t){return e.value?n.filter((n=>function(n,t){if(!e.value)return!0;const l=n?n[t]:"";return!!r(l)&&(!!b(e.value,l)||g(e.value,n.keyword))}(n,t))):n}}}function K(e,t,l,u,r){const a=R(e,"commonList"),v=R(e,"recentList"),{searchContent:d,optionSearchFilter:y}=C();function p(e){return n(e.itemObj)}const h=s((()=>{var e,n;return null!=(n=null==(e=a.value)?void 0:e.map(p))?n:[]})),g=s((()=>{var e,n;return null!=(n=null==(e=v.value)?void 0:e.map(p))?n:[]})),b=s((()=>{if(!e.recommend||!h.value.length&&!g.value.length)return t.value;const n=o(h.value.concat(g.value),(e=>e[r.value])),l=t.value.filter((e=>n.every((function(n){return n[r.value]!==e[r.value]}))));return[...y(n,u.value),...l]})),{getRecommendRequestInfo:K,getHttpInstance:F}=k();function j(n){const{url:t,getRecommendIds:l}=K(),u=c(l)?l():{},o=c(e.getRecommendInfo)?e.getRecommendInfo():{};return{url:t[n],info:Object.assign({},u,o)}}const{fieldKey:x}=w(),O=m(f);return{postRecommend:async function(n){if(!e.recommend)return;const t=F();if(!t)return;const{url:u,info:o}=j("post"),a=b.value.find((e=>e[r.value]===n));a&&l("postRecommend",await t.post(u,{...o,keyword:"",itemId:r.value,itemObj:JSON.stringify(a)}))},getRecommend:async function(n){if(!e.recommend)return;if(d.value=n,a.value&&v.value&&e.recommendCache)return;const t=await O.addAsync(function(n,t){const{url:l,info:u}=j("get");return{url:l,method:"get",key:n,cache:t,params:{...u,recNum:Math.max(e.commonNum,e.recentNum),keyword:""}}}(x.value,e.recommendCache)),{commonly:l,recently:u}=t.reduce(((e,n)=>("commonly"===n.type?e.commonly.push(i(n,["type"])):"recently"===n.type&&e.recently.push(i(n,["type"])),e)),{commonly:[],recently:[]});a.value=l.slice(0,e.commonNum),v.value=u.slice(0,e.recentNum)},sortedOptions:b}}function F(n,t){e();const u=m(f),o=s((()=>{var e,t,l;return null!=(l=null!=(t=null==(e=n.urlConfig)?void 0:e.nameKey)?t:n.labelField)?l:"text"})),i=s((()=>{var e,t,l;return null!=(l=null!=(t=null==(e=n.urlConfig)?void 0:e.valueKey)?t:n.valueField)?l:"value"})),{searchContent:c,optionSearchFilter:g}=C(),k=v(null),{field:R,fieldKey:b}=w(),K=l((async function(e){if(c.value=e||"",!n.urlConfig)return k.value=null;try{k.value=await u.addAsync(await p({config:n.urlConfig,cache:n.requestCache,field:R.value}))}catch(e){r(e)&&h(e)}}),300),F=s((()=>k.value?g(k.value,o.value):Array.isArray(n.options)?g(n.options,o.value):[])),j=s((()=>k.value||n.options||[])),x=m(y);return d((()=>n.urlConfig),((e,l)=>{a(e,l)||(k.value=null,e&&(x.setDeps(b.value,e.dependKey||[],(async()=>{k.value=null,t.value=null,!n.lazyRequest&&await K()})),(t.value||!n.lazyRequest)&&K()))}),{immediate:!0}),{labelKey:o,valueKey:i,filterOptions:F,fullOptions:j,fetchData:K}}function j(n,t){e();const u=m(f),o=s((()=>{var e,t,l,u;return null!=(u=null!=(l=null==(t=null==(e=n.wordbook)?void 0:e.render_key)?void 0:t[0])?l:n.labelField)?u:"text"})),i=s((()=>{var e,t,l;return null!=(l=null!=(t=null==(e=n.wordbook)?void 0:e.value_key)?t:n.valueField)?l:"value"})),{searchContent:c,optionSearchFilter:y}=C(),p=v(null),{fieldKey:g}=w(),{getSearchRequestInfo:R}=k(),b=l((async function(e){if(c.value=e||"",!n.autograph||!n.wordbook)return p.value=null;try{p.value=await u.addAsync(function(e,t,l){const u={autograph:t,wordbookId:e.id,wordbookType:e.type,fieldKeys:e.search_key,keyword:"",page:1};return{...R(),params:u,key:l,cache:n.requestCache}}(n.wordbook,n.autograph,g.value))}catch(e){r(e)&&h(e)}}),300),K=s((()=>p.value?y(p.value,o.value):Array.isArray(n.options)?y(n.options,o.value):[])),F=s((()=>p.value||n.options||[]));return d((()=>n.wordbook),((e,l)=>{a(e,l)||(p.value=null,e&&(t.value||!n.lazyRequest)&&b())}),{immediate:!0}),{labelKey:o,valueKey:i,filterOptions:K,fullOptions:F,fetchData:b}}export{b as searchContentMatcher,j as useAutographOptions,K as useRecommendOptions,F as useUrlConfigOptions};
@@ -25,14 +25,13 @@ export declare type ValidateItem = Partial<{
25
25
  message: string;
26
26
  [key: string]: any;
27
27
  }>;
28
- export interface FormOptionItem {
29
- text: string;
30
- value: any;
28
+ export declare type FormOptionItem = {
31
29
  keyword?: string;
32
30
  disabled?: boolean;
33
31
  children?: FormOptionItem[];
34
32
  childrenFields?: FieldItem[];
35
- }
33
+ [key: string]: any;
34
+ };
36
35
  interface FormRendererPayload {
37
36
  clearable: boolean;
38
37
  disabled: boolean;
@@ -1 +1 @@
1
- import{defineComponent as e,reactive as o,createVNode as t,mergeProps as r}from"vue";import{NSelect as l}from"naive-ui";import{useIhoTableFormEvent as a}from"../../../../utils/index.js";import{useAutoFocus as n}from"../hooks/useAutoFocus.js";import{useDebounceFn as i}from"@vueuse/core";var u=e({name:"EditSelect",inheritAttrs:!1,components:{NSelect:l},props:{value:{type:[Array,String,Number],default:void 0},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0}},emits:["update:value"],setup(e,{attrs:u,emit:s}){const{isShow:c,setRef:p}=n(),{emitFormChangeWithParams:d}=a(e),m=o({placeholder:u.placeholder||"请选择",options:u.options});async function v(o){var t;m.loading=!0;const r={keyword:o,row:e.row,column:e.column,rowIndex:e.rowIndex};try{m.options=await(null==(t=u.queryOptions)?void 0:t.call(u,r)),m.loading=!1}catch(o){console.log(`获取${e.column.field}_options错误`)}}function h(o){const t=e.value;s("update:value",o),d({oldValue:t})}m.options||(m.remote=!0,m.loading=!1,m.onSearch=i(v,400),m.onSearch(""));const f=()=>({class:"iho-table__selectOption"}),w={class:"iho-table__selectMenu"};return()=>t(l,r({ref:p,show:c.value,"onUpdate:show":e=>c.value=e},u,m,{value:e.value,clearable:!0,filterable:!0,nodeProps:f,menuProps:w,onUpdateValue:h}),null)}});export{u as default};
1
+ import{defineComponent as e,reactive as o,watch as t,createVNode as n,mergeProps as l}from"vue";import{NSelect as r}from"naive-ui";import{useIhoTableFormEvent as a}from"../../../../utils/index.js";import{useAutoFocus as u}from"../hooks/useAutoFocus.js";import{useDebounceFn as i}from"@vueuse/core";import{cloneDeep as s}from"lodash-es";var c=e({name:"EditSelect",inheritAttrs:!1,components:{NSelect:r},props:{value:{type:[Array,String,Number],default:void 0},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0}},emits:["update:value"],setup(e,{attrs:c,emit:p}){const{isShow:d,setRef:m,formRef:v}=u(),{emitFormChangeWithParams:f}=a(e),h=o({placeholder:c.placeholder||"请选择",options:c.options});var w;async function y(o){var t;h.loading=!0;const n={keyword:o,row:e.row,column:e.column,rowIndex:e.rowIndex};try{h.options=await(null==(t=c.queryOptions)?void 0:t.call(c,n)),h.loading=!1}catch(o){console.log(`获取${e.column.field}_options错误`)}}function b(o){const t=e.value;p("update:value",o),f({oldValue:t})}function g(e){var o,t;const n=s(e);"Tab"===e.key&&(null==(t=null==(o=v.value)?void 0:o.handleKeydown)||t.call(o,{...n,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}t((()=>c.options),(e=>{e.length&&(h.options=e,h.remote=!1,h.onSearch=null)})),(null==(w=h.options)?void 0:w.length)||(h.remote=!0,h.loading=!1,h.onSearch=i(y,400),h.onSearch(""));const S=()=>({class:"iho-table__selectOption"}),x={class:"iho-table__selectMenu"};return()=>n(r,l({ref:m,show:d.value,"onUpdate:show":e=>d.value=e},c,h,{value:e.value,clearable:!0,filterable:!0,nodeProps:S,menuProps:x,onUpdateValue:b,onKeydown:g}),null)}});export{c as default};
@@ -1 +1 @@
1
- import{reactive as e,inject as o,createVNode as t,mergeProps as i,onBeforeUnmount as n}from"vue";import"../../../../../index.js";import{EDITABLE_WIDGET_TYPE as l,InjectionIhoTableUUID as r}from"../../../../constants/index.js";import{createIhoTableClearActivedInterceptor as s,IhoTableRenderHelper as d}from"../../../../utils/index.js";import u from"./editSelect.js";import{getDefaultValue as p}from"./selectUtils.js";import{defineTablePlugin as a}from"../../../../hooks/useTablePlugin.js";function c(){const c="selectRendererPlugin",f=e(new Map),m=e(new Map);return a({name:c,vxe(e){e.interceptor.add("event.clearActived",s(l.SELECT,(e=>e.classList.contains("iho-table__selectMenu")))),e.renderer.add(l.SELECT,{renderCell({props:e},{row:i,column:n}){var l;const s=o(r),d=(null==(l=f.get(s).find((e=>e.field===n.field)))?void 0:l.options)||[],u=p(i,e,d);return[t("span",null,[u])]},renderEdit:d.createRenderEdit((({fieldItem:e,emitFormClick:o,row:n,column:l,$rowIndex:r})=>[t(u,i({options:e.options,queryOptions:e.queryOptions},e.componentProps,{column:l,row:n,"row-index":r,value:n[l.field],"onUpdate:value":e=>n[l.field]=e,onClick:o}),null)]))})},apply(e){e.fieldHooks.fieldList.tap(c,((e,{uuid:o})=>(o&&(m.set(o,e),f.set(o,[])),e))),e.fieldHooks.fieldEnd.tapPromise(c,(async({uuid:e},{$table:o})=>{if(!e)return;const t=m.get(e),i=f.get(e);t.forEach((async o=>{var t;if(o.field&&"select"===o.formType){if(i.findIndex((e=>e.field===o.field))>-1)return;let n=o.options||[];if(o.queryOptions)try{const e={keyword:"",column:o,isFullData:!0};n=await(null==(t=o.queryOptions)?void 0:t.call(o,e))}catch(e){console.log(`获取${o.field}_options错误`)}i.push({field:o.field,options:n}),f.set(e,i)}}))})),e.setupHooks.setup.tap(c,(e=>{n((()=>{e.value.uuid&&(m.delete(e.value.uuid),f.delete(e.value.uuid))}))}))}})}export{c as selectRendererPlugin};
1
+ import{reactive as e,inject as o,createVNode as t,mergeProps as i,onBeforeUnmount as n}from"vue";import"../../../../../index.js";import{EDITABLE_WIDGET_TYPE as l,InjectionIhoTableUUID as r}from"../../../../constants/index.js";import{createIhoTableClearActivedInterceptor as s,IhoTableRenderHelper as d}from"../../../../utils/index.js";import u from"./editSelect.js";import{getDefaultValue as a}from"./selectUtils.js";import{defineTablePlugin as p}from"../../../../hooks/useTablePlugin.js";function f(){const f="selectRendererPlugin",c=e(new Map),m=e(new Map);return p({name:f,vxe(e){e.interceptor.add("event.clearActived",s(l.SELECT,(e=>e.classList.contains("iho-table__selectMenu")))),e.renderer.add(l.SELECT,{renderCell({props:e},{row:i,column:n}){var l;const s=o(r),d=(null==(l=c.get(s).find((e=>e.field===n.field)))?void 0:l.options)||[],u=a(i,e,d);return[t("span",null,[u])]},renderEdit:d.createRenderEdit((({fieldItem:e,emitFormClick:n,row:l,column:s,$rowIndex:d})=>{var a;const p=o(r),f=(null==(a=c.get(p).find((e=>e.field===s.field)))?void 0:a.options)||[];return[t(u,i({queryOptions:e.queryOptions},e.componentProps,{options:f,column:s,row:l,"row-index":d,value:l[s.field],"onUpdate:value":e=>l[s.field]=e,onClick:n}),null)]}))})},apply(e){e.fieldHooks.fieldList.tap(f,((e,{uuid:o})=>(o&&(m.set(o,e),c.set(o,[])),e))),e.fieldHooks.fieldEnd.tapPromise(f,(async({uuid:e},{$table:o})=>{if(!e)return;const t=m.get(e),i=c.get(e);t.forEach((async o=>{var t;if(o.field&&"select"===o.formType){if(i.findIndex((e=>e.field===o.field))>-1)return;let n=o.options||[];if(o.queryOptions)try{const e={keyword:"",column:o,isFullData:!0};n=await(null==(t=o.queryOptions)?void 0:t.call(o,e))}catch(e){console.log(`获取${o.field}_options错误`)}i.push({field:o.field,options:n}),c.set(e,i)}}))})),e.setupHooks.setup.tap(f,(e=>{n((()=>{e.value.uuid&&(m.delete(e.value.uuid),c.delete(e.value.uuid))}))}))}})}export{f as selectRendererPlugin};
@@ -1,4 +1,5 @@
1
1
  import { SFCWithInstall } from '../../../es/shared/types';
2
+ export * from './src/types';
2
3
  declare const Map: SFCWithInstall<import("vue").DefineComponent<{
3
4
  locationProp: {
4
5
  type: StringConstructor;
@@ -21,20 +22,7 @@ declare const Map: SFCWithInstall<import("vue").DefineComponent<{
21
22
  }>> & {
22
23
  onSelectLocation?: ((...args: any[]) => any) | undefined;
23
24
  }>>;
24
- state: {
25
- qq: any;
26
- searchKey: any;
27
- centrePoint: any;
28
- location: any;
29
- localObj: any;
30
- map: any;
31
- ac: any;
32
- addressList: any[];
33
- markers: any[];
34
- timeout: any;
35
- searchService: any;
36
- geocoder: any;
37
- };
25
+ state: import("./src/types").IState;
38
26
  defAdress: import("vue").ComputedRef<any>;
39
27
  emit: (event: "selectLocation", ...args: any[]) => void;
40
28
  calculateLocationProp: import("vue").ComputedRef<any>;
@@ -1,17 +1,4 @@
1
- declare type IState = {
2
- qq: any;
3
- searchKey: any;
4
- centrePoint: any;
5
- location: any;
6
- localObj: any;
7
- map: any;
8
- ac: any;
9
- addressList: any[];
10
- markers: any[];
11
- timeout: any;
12
- searchService: any;
13
- geocoder: any;
14
- };
1
+ import { IState } from '../../../../es/components/map/src/types';
15
2
  declare const _default: import("vue").DefineComponent<{
16
3
  locationProp: {
17
4
  type: StringConstructor;
@@ -0,0 +1,19 @@
1
+ export declare type IState = {
2
+ qq: any;
3
+ searchKey: any;
4
+ centrePoint: any;
5
+ location: any;
6
+ localObj: any;
7
+ map: any;
8
+ ac: any;
9
+ addressList: any[];
10
+ markers: any[];
11
+ timeout: any;
12
+ searchService: any;
13
+ geocoder: any;
14
+ };
15
+ export declare type IMapLocation = Partial<{
16
+ isInit: boolean;
17
+ locationProp: string;
18
+ [key: string]: any;
19
+ }>;
@@ -628,6 +628,9 @@ declare const RecommendSearch: SFCWithInstall<import("vue").DefineComponent<{
628
628
  }>;
629
629
  };
630
630
  currentComponent: import("vue").ComputedRef<any>;
631
+ inputRef: import("vue").Ref<any>;
632
+ exposeMethods: Record<any, any>;
633
+ instance: import("vue").ComponentInternalInstance | null;
631
634
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "clear" | "update:value" | "search" | "choose" | "openMenu" | "closeMenu")[], "search" | "closeMenu" | "delete" | "clear" | "update:value" | "choose" | "openMenu", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
632
635
  mode: {
633
636
  type: import("vue").PropType<"input" | "select">;
@@ -630,6 +630,9 @@ declare const _default: import("vue").DefineComponent<{
630
630
  }>;
631
631
  };
632
632
  currentComponent: import("vue").ComputedRef<any>;
633
+ inputRef: import("vue").Ref<any>;
634
+ exposeMethods: Record<any, any>;
635
+ instance: import("vue").ComponentInternalInstance | null;
633
636
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "clear" | "update:value" | "search" | "choose" | "openMenu" | "closeMenu")[], "search" | "closeMenu" | "delete" | "clear" | "update:value" | "choose" | "openMenu", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
634
637
  mode: {
635
638
  type: PropType<"input" | "select">;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,provide as o,useSlots as l,openBlock as r,createBlock as n,resolveDynamicComponent as p,unref as a,mergeProps as u,isRef as m,withCtx as i,renderSlot as s}from"vue";import{useVModel as c}from"@vueuse/core";import{InjectionRecommendSearchRootSlots as d}from"./constant/index.js";import y from"./components/RecommendInput.vue.js";import f from"./components/RecommendSelect.vue.js";import v from"../../../_virtual/plugin-vue_export-helper.js";var h=v(e({__name:"RecommendSearch",props:{mode:{type:String,default:"input"},value:{type:[String,Number]},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},placeholder:{type:String},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},clearable:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},commonList:{type:Array,default:()=>[]},recentList:{type:Array,default:()=>[]},recommendDeletable:{type:Boolean,default:!0},inputProps:{type:Object},popProps:{type:Object}},emits:["update:value","search","delete","choose","clear","openMenu","closeMenu"],setup(e,{emit:v}){const h=e,S=c(h,"value",v),b={input:y,select:f},g=t((()=>b[h.mode]));return o(d,l()),(e,t)=>(r(),n(p(a(g)),u(e.$props,{value:a(S),"onUpdate:value":t[0]||(t[0]=e=>m(S)?S.value=e:null),onSearch:t[1]||(t[1]=t=>e.$emit("search",t)),onChoose:t[2]||(t[2]=t=>e.$emit("choose",t)),onOpenMenu:t[3]||(t[3]=t=>e.$emit("openMenu",t)),onCloseMenu:t[4]||(t[4]=t=>e.$emit("closeMenu",t)),onDelete:t[5]||(t[5]=t=>e.$emit("delete",t))}),{empty:i((()=>[s(e.$slots,"empty")])),_:3},16,["value"]))}}),[["__file","RecommendSearch.vue"]]);export{h as default};
1
+ import{defineComponent as e,computed as t,provide as o,useSlots as n,ref as a,getCurrentInstance as p,watch as r,openBlock as l,createBlock as c,resolveDynamicComponent as u,unref as s,mergeProps as m,isRef as i,withCtx as d,renderSlot as f}from"vue";import{useVModel as y}from"@vueuse/core";import{isObject as v}from"lodash-es";import{InjectionRecommendSearchRootSlots as h,InjectionRecommendSearchRef as g}from"./constant/index.js";import b from"./components/RecommendInput.vue.js";import S from"./components/RecommendSelect.vue.js";import j from"../../../_virtual/plugin-vue_export-helper.js";var x=j(e({__name:"RecommendSearch",props:{mode:{type:String,default:"input"},value:{type:[String,Number]},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},placeholder:{type:String},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},clearable:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},commonList:{type:Array,default:()=>[]},recentList:{type:Array,default:()=>[]},recommendDeletable:{type:Boolean,default:!0},inputProps:{type:Object},popProps:{type:Object}},emits:["update:value","search","delete","choose","clear","openMenu","closeMenu"],setup(e,{expose:j,emit:x}){const C=e,$=y(C,"value",x),_={input:b,select:S},M=t((()=>_[C.mode]));o(h,n());const O=a();o(g,O);const R={},P=p();return r(O,(e=>{if(Object.keys(R).forEach((e=>Reflect.deleteProperty(R,e))),v(e))try{if(P&&P.appContext&&v(P.appContext.config)){const t=P.appContext.config.warnHandler;P.appContext.config.warnHandler=()=>1,Object.assign(R,e),P.appContext.config.warnHandler=t}else Object.assign(R,e)}catch(e){}})),j(R),(e,t)=>(l(),c(u(s(M)),m(e.$props,{value:s($),"onUpdate:value":t[0]||(t[0]=e=>i($)?$.value=e:null),onSearch:t[1]||(t[1]=t=>e.$emit("search",t)),onChoose:t[2]||(t[2]=t=>e.$emit("choose",t)),onOpenMenu:t[3]||(t[3]=t=>e.$emit("openMenu",t)),onCloseMenu:t[4]||(t[4]=t=>e.$emit("closeMenu",t)),onDelete:t[5]||(t[5]=t=>e.$emit("delete",t))}),{empty:d((()=>[f(e.$slots,"empty")])),_:3},16,["value"]))}}),[["__file","RecommendSearch.vue"]]);export{x as default};
@@ -1 +1 @@
1
- import{defineComponent as e,inject as a,ref as t,computed as o,createVNode as l,mergeProps as n}from"vue";import{isFunction as r}from"lodash-es";import{uuidGenerator as u}from"../../../../shared/utils/index.js";import{useDebounceFn as s,onClickOutside as p}from"@vueuse/core";import{NPopover as i,NInput as c,NSpin as d}from"naive-ui";import{InjectionRecommendSearchRootSlots as v}from"../constant/index.js";var m=e({props:{displayValue:{type:String},valueFormatter:{type:Function},show:{type:Boolean},loading:{type:Boolean},placeholder:{type:String,default:"请输入"},clearable:{type:Boolean,default:!0},inputProps:{type:Object,default:()=>({})},popProps:{type:Object,default:()=>({})},clearPatternOnOpenMenu:{type:Boolean,default:!0}},emits:["update:show","keydown","clear","search","openMenu","closeMenu"],setup(e,{expose:m,emit:f,slots:h}){const g=a(v,{}),y=u(),w=s(((e="")=>{f("search",e)}),300),b=t(e.show),M=o({get:()=>b.value||e.show,set(e){f("update:show",e),b.value=e}}),P=t(),O=t(""),x=o({get:()=>M.value?O.value:e.displayValue,set(e){O.value=e||"",w(e)}});function j(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&k()}function k(){M.value||(M.value=!0,f("openMenu"),e.clearPatternOnOpenMenu&&(O.value=""))}function B(){var e;M.value=!1,null==(e=P.value)||e.blur(),f("closeMenu")}function F(){f("clear")}return p(P,(e=>{var a;if(!M.value)return;const t=e;if(!t.target)return B();!function(e){let a=!1,t=e;for(;t;){if(t.id===y){a=!0;break}t=t.parentElement}return a}(t.target)?B():null==(a=P.value)||a.focus()})),m({setPattern(e){O.value=e},closeMenu:B,openMenu:k}),()=>l(i,n({trigger:"manual",class:"recommend-search",placement:"bottom-start",show:M.value,"onUpdate:show":e=>M.value=e,"show-arrow":!1,width:"trigger"},e.popProps),{trigger:()=>l(c,n(e.inputProps,{placeholder:e.placeholder,clearable:e.clearable,onClear:F,onFocus:j,onClick:j,onKeydown:e=>f("keydown",e),ref:P,value:x.value,"onUpdate:value":e=>x.value=e}),g),default:()=>l(d,{show:e.loading},{default:()=>[l("section",{id:y,class:"base-search__menu",style:"min-height: 100px"},[r(null==h?void 0:h.menu)?h.menu():null])]})})}});export{m as default};
1
+ import{defineComponent as e,inject as a,ref as t,computed as o,createVNode as l,mergeProps as n}from"vue";import{isFunction as r}from"lodash-es";import{uuidGenerator as u}from"../../../../shared/utils/index.js";import{useDebounceFn as s,onClickOutside as p}from"@vueuse/core";import{NPopover as i,NInput as c,NSpin as d}from"naive-ui";import{InjectionRecommendSearchRootSlots as v,InjectionRecommendSearchRef as m}from"../constant/index.js";var f=e({props:{displayValue:{type:String},valueFormatter:{type:Function},show:{type:Boolean},loading:{type:Boolean},placeholder:{type:String,default:"请输入"},clearable:{type:Boolean,default:!0},inputProps:{type:Object,default:()=>({})},popProps:{type:Object,default:()=>({})},clearPatternOnOpenMenu:{type:Boolean,default:!0}},emits:["update:show","keydown","clear","search","openMenu","closeMenu"],setup(e,{expose:f,emit:h,slots:g}){const y=a(v,{}),w=u(),b=s(((e="")=>{h("search",e)}),300),M=t(e.show),P=o({get:()=>M.value||e.show,set(e){h("update:show",e),M.value=e}}),O=a(m,t()),x=t(""),j=o({get:()=>P.value?x.value:e.displayValue,set(e){x.value=e||"",b(e)}});function k(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&B()}function B(){P.value||(P.value=!0,h("openMenu"),e.clearPatternOnOpenMenu&&(x.value=""))}function F(){var e;P.value=!1,null==(e=O.value)||e.blur(),h("closeMenu")}function U(){h("clear")}return p(O,(e=>{var a;if(!P.value)return;const t=e;if(!t.target)return F();!function(e){let a=!1,t=e;for(;t;){if(t.id===w){a=!0;break}t=t.parentElement}return a}(t.target)?F():null==(a=O.value)||a.focus()})),f({setPattern(e){x.value=e},closeMenu:F,openMenu:B}),()=>l(i,n({trigger:"manual",class:"recommend-search",placement:"bottom-start",show:P.value,"onUpdate:show":e=>P.value=e,"show-arrow":!1,width:"trigger"},e.popProps),{trigger:()=>l(c,n(e.inputProps,{placeholder:e.placeholder,clearable:e.clearable,onClear:U,onFocus:k,onClick:k,onKeydown:e=>h("keydown",e),ref:O,value:j.value,"onUpdate:value":e=>j.value=e}),y),default:()=>l(d,{show:e.loading},{default:()=>[l("section",{id:w,class:"base-search__menu",style:"min-height: 100px"},[r(null==g?void 0:g.menu)?g.menu():null])]})})}});export{f as default};
@@ -1,6 +1,7 @@
1
- import { InjectionKey } from 'vue';
1
+ import { InjectionKey, Ref } from 'vue';
2
2
  export declare enum RecommendType {
3
3
  COMMONLY = "COMMONLY",
4
4
  RECENTLY = "RECENTLY"
5
5
  }
6
6
  export declare const InjectionRecommendSearchRootSlots: InjectionKey<Record<string, any>>;
7
+ export declare const InjectionRecommendSearchRef: InjectionKey<Ref>;
@@ -1 +1 @@
1
- var o=(o=>(o.COMMONLY="COMMONLY",o.RECENTLY="RECENTLY",o))(o||{});const e=Symbol("InjectionRecommendSearchRootSlots ");export{e as InjectionRecommendSearchRootSlots,o as RecommendType};
1
+ var o=(o=>(o.COMMONLY="COMMONLY",o.RECENTLY="RECENTLY",o))(o||{});const e=Symbol("InjectionRecommendSearchRootSlots"),c=Symbol("InjectionRecommendSearchRef");export{c as InjectionRecommendSearchRef,e as InjectionRecommendSearchRootSlots,o as RecommendType};
@@ -1125,7 +1125,6 @@ export declare const componentMap: {
1125
1125
  type: ObjectConstructor;
1126
1126
  default: () => {};
1127
1127
  };
1128
- defList: (ArrayConstructor | StringConstructor)[];
1129
1128
  source: StringConstructor;
1130
1129
  limitNum: {
1131
1130
  default: number;
@@ -1190,7 +1189,6 @@ export declare const componentMap: {
1190
1189
  type: ObjectConstructor;
1191
1190
  default: () => {};
1192
1191
  };
1193
- defList: (ArrayConstructor | StringConstructor)[];
1194
1192
  source: StringConstructor;
1195
1193
  limitNum: {
1196
1194
  default: number;
@@ -1322,7 +1320,6 @@ export declare const componentMap: {
1322
1320
  type: ObjectConstructor;
1323
1321
  default: () => {};
1324
1322
  };
1325
- defList: (ArrayConstructor | StringConstructor)[];
1326
1323
  source: StringConstructor;
1327
1324
  limitNum: {
1328
1325
  default: number;
@@ -86,8 +86,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
86
86
  message?: string | undefined;
87
87
  } | undefined;
88
88
  option?: {
89
- text: string;
90
- value: any;
89
+ [x: string]: any;
91
90
  keyword?: string | undefined;
92
91
  disabled?: boolean | undefined;
93
92
  children?: any[] | undefined;
@@ -88,8 +88,7 @@ declare const _default: import("vue").DefineComponent<{
88
88
  message?: string | undefined;
89
89
  } | undefined;
90
90
  option?: {
91
- text: string;
92
- value: any;
91
+ [x: string]: any;
93
92
  keyword?: string | undefined;
94
93
  disabled?: boolean | undefined;
95
94
  children?: any[] | undefined;
@@ -5,7 +5,6 @@ declare const VodChunkUpload: SFCWithInstall<import("vue").DefineComponent<{
5
5
  type: ObjectConstructor;
6
6
  default: () => {};
7
7
  };
8
- defList: (ArrayConstructor | StringConstructor)[];
9
8
  source: StringConstructor;
10
9
  limitNum: {
11
10
  default: number;
@@ -70,7 +69,6 @@ declare const VodChunkUpload: SFCWithInstall<import("vue").DefineComponent<{
70
69
  type: ObjectConstructor;
71
70
  default: () => {};
72
71
  };
73
- defList: (ArrayConstructor | StringConstructor)[];
74
72
  source: StringConstructor;
75
73
  limitNum: {
76
74
  default: number;
@@ -202,7 +200,6 @@ declare const VodChunkUpload: SFCWithInstall<import("vue").DefineComponent<{
202
200
  type: ObjectConstructor;
203
201
  default: () => {};
204
202
  };
205
- defList: (ArrayConstructor | StringConstructor)[];
206
203
  source: StringConstructor;
207
204
  limitNum: {
208
205
  default: number;
@@ -3,7 +3,6 @@ declare const _default: import("vue").DefineComponent<{
3
3
  type: ObjectConstructor;
4
4
  default: () => {};
5
5
  };
6
- defList: (ArrayConstructor | StringConstructor)[];
7
6
  source: StringConstructor;
8
7
  limitNum: {
9
8
  default: number;
@@ -68,7 +67,6 @@ declare const _default: import("vue").DefineComponent<{
68
67
  type: ObjectConstructor;
69
68
  default: () => {};
70
69
  };
71
- defList: (ArrayConstructor | StringConstructor)[];
72
70
  source: StringConstructor;
73
71
  limitNum: {
74
72
  default: number;
@@ -200,7 +198,6 @@ declare const _default: import("vue").DefineComponent<{
200
198
  type: ObjectConstructor;
201
199
  default: () => {};
202
200
  };
203
- defList: (ArrayConstructor | StringConstructor)[];
204
201
  source: StringConstructor;
205
202
  limitNum: {
206
203
  default: number;
@@ -1 +1 @@
1
- import{defineComponent as e,reactive as o,computed as l,onMounted as i,resolveComponent as s,openBlock as t,createElementBlock as a,withDirectives as r,normalizeClass as n,unref as d,createElementVNode as u,Fragment as p,vShow as m,createCommentVNode as c,createVNode as v,withCtx as f,normalizeStyle as g,toDisplayString as h,createTextVNode as y,withModifiers as k,createBlock as b}from"vue";import C from"xe-utils";import"moment";import{getVodData as U}from"../hooks/vod-data.js";import{VodComputed as L}from"../hooks/vod-computed.js";import V from"../../../../shared/components/player-vod/video-modal.js";import _ from"../vod-upload-modal.js";import{NIcon as D,NButton as O}from"naive-ui";import{PlayCircleSharp as S,PlayCircleOutline as w,RemoveCircleSharp as x}from"@vicons/ionicons5";import j from"../../../../shared/assets/img/video_default_cover.png.js";import F from"../../../../shared/assets/img/video.png.js";import z from"../../../../shared/assets/img/success.png.js";import N from"../../../../_virtual/plugin-vue_export-helper.js";const A={class:"c-upload"},M={class:"chunk-btn-content"},J={class:"c-uploader-btn"},B=["src"],P=u("div",{class:"uploader-text"},[u("p",null,"点击上传"),u("span",{class:"guage-text"},"上传视频(不超过50M)")],-1),E=["src"],T=u("div",{class:"uploader-text"},[u("p",null,"上传视频")],-1),R={class:"vod-wrap c-uploader-preview-wrap"},G={key:0,class:"vod-def-bg vod-uploading"},H={class:"vod-def-bg vod-done"},K=["src"],$=["src"],q={class:"c-icon-wrap"},I={class:"vod-def-bg vod-error"},Q=["src"],W={class:"tooltip-wrap error-wrap"},X=["onClick"];var Y=N(e({__name:"vod-chunk-upload",props:{formData:{type:Object,default:()=>({})},defList:[Array,String],source:String,limitNum:{default:1},defFileList:{default:""},isLock:Boolean,isDetail:{type:Boolean,default:!1},getChunkUploadConfig:{type:Function,default:()=>Promise.resolve({})}},emits:["vodFileList"],setup(e,{emit:N}){const Y=e,{VodState:Z}=U(),ee=o(Z),oe={},{isShowBtn:le,maskHeight:ie,showPercent:se,allow_format:te,defaultValue:ae,isDisabled:re,max_size:ne,maxlength:de}=L(Y,ee,{mainForm:oe});console.log(le.value,"----isShowBtn---",Y.formData.title),l((()=>ue()));const ue=()=>{const{formData:e}=Y;let o=[];if(o="guage"===Y.source?Y.defFileList:null==oe?void 0:oe.handleSysParams(oe.defaultValue[e.name]||e.default_val),o=JSON.parse(JSON.stringify(o)),!o)return[];let l=[];return Array.isArray(o)&&(l=[...o]),C.isJSON(o)&&(l=JSON.parse(o)),Array.isArray(l)?(l.forEach((e=>{e.thumbUrl=e.vodCoverUrl||void 0,e.uid=(-Math.random()).toString(),e.status="done"})),ee.fileList=l,console.log(ee.fileList,"----list---list"),pe(l),l):[]},pe=e=>{if(!Array.isArray(e))return"";const{formData:o,source:l}=Y;let i=[];e.forEach((e=>{if("done"===e.status&&(e.response&&"00000"==e.response.code||e.url)){const{data:o={}}=e.response||{};e.url||o.videoUrl;let l=e.vodCoverUrl||o.vodCoverUrl;i.push({name:e.name,size:e.size,url:e.url||o.videoUrl,vodCoverUrl:l,uid:e.id||e.uid||(-Math.random()).toString()})}})),console.log(i,"---resList---",Y.formData.title);let s=JSON.stringify(i);"guage"!==l?oe.baseForm.setFieldsValue({[o.val_key]:s}):N("vodFileList",s,Y.formData)},me=(e,o)=>{let l,i;if(e.type&&(i=e.type),e.url||e.videoUrl){if(l=e.url||e.videoUrl,!i){let e=l.split(".");i=`video/${e[e.length-1]}`}}else l=URL.createObjectURL(e.originFileObj);ee.playerOptions={sources:[{type:i,src:l}]},ee.videoVisible=!0},ce=()=>{ee.videoVisible=!1},ve=()=>{re.value||(ee.chunkUploadVisible=!0)},fe=e=>{let o=[];e.forEach((e=>{let l=e.videoCoverPic||void 0;o.push({name:e.videoName||e.name,url:e.videoUrl||e.url,size:e.size,vodCoverUrl:l,status:"done",uid:(-Math.random()).toString()})})),ee.fileList.push(...o),pe(ee.fileList)},ge=()=>{pe(ee.fileList)};return i((()=>{ue()})),(o,l)=>{const i=s("draggable");return t(),a("div",A,[e.isDetail||Y.isLock?c("v-if",!0):r((t(),a("div",{key:0,class:n(["c-chunk-uploader-btn",{"disable-upload":d(re)}]),onClick:ve},[u("div",M,[u("div",J,["guage"==Y.source?(t(),a(p,{key:0},[u("img",{src:d(F),class:"guage-img"},null,8,B),P],64)):(t(),a(p,{key:1},[u("img",{src:d(F),class:"guage-img"},null,8,E),T],64))])])],2)),[[m,d(le)]]),v(i,{modelValue:ee.fileList,"onUpdate:modelValue":l[0]||(l[0]=e=>ee.fileList=e),animation:"150",itemKey:"uid",disabled:d(re).value,options:ee.draggableOptions,onUpdate:ge,class:"drag-content"},{item:f((({element:o,index:l})=>{return[u("div",R,[c(" 上传中 "),"uploading"===o.status?(t(),a("div",G,[c(" TODO: 封面图补充 "),u("div",{class:"uploading-mask",style:g({height:d(ie)(o)})},[u("span",null,h(d(se)(o.percent))+"%",1)],4)])):"done"===o.status?(t(),a(p,{key:1},[c(" 上传完成 "),u("div",H,[u("img",{src:(i=o,i.thumbUrl?i.thumbUrl:j),class:"vod-cover-img"},null,8,K),u("div",{class:n(["tooltip-wrap",{"is-new":o.isNew}])},[u("img",{src:d(z),class:"upload-img"},null,8,$),y(" 上传成功 ")],2),c(" 播放图标 "),u("div",q,[v(d(D),{component:d(S),class:"icon-play theme_filled",onClick:k((e=>me(o)),["prevent","stop"])},null,8,["component","onClick"]),v(d(D),{component:d(w),class:"icon-play theme_outlined",onClick:k((e=>me(o)),["prevent","stop"])},null,8,["component","onClick"])])])],64)):"error"===o.status?(t(),a(p,{key:2},[c(" 上传失败 "),u("div",I,[u("img",{src:o.thumbUrl,class:"vod-cover-img"},null,8,Q),u("div",W,[u("span",null,h(o.message?o.message:"上传失败,继续上传?"),1),v(d(O),{size:"small",onClick:k((e=>{}),["prevent","stop"])},{default:f((()=>[y("确定")])),_:2},1032,["onClick"])])])],64)):c("v-if",!0),!["done","error"].includes(o.status)||d(re)||e.isDetail?c("v-if",!0):(t(),a("div",{key:3,onClick:k((e=>{return o=l,ee.fileList.splice(o,1),void pe(ee.fileList);var o}),["stop"]),class:"uploader-preview-delete"},[v(d(D),{class:"pre-delete",component:d(x)},null,8,["component"])],8,X))])];var i})),_:1},8,["modelValue","disabled","options"]),ee.videoVisible?(t(),b(d(V),{key:1,visible:ee.videoVisible,formData:Y.formData,playerOptions:ee.playerOptions,onCloseVideoModal:ce},null,8,["visible","formData","playerOptions"])):c("v-if",!0),v(d(_),{modelValue:ee.chunkUploadVisible,"onUpdate:modelValue":l[1]||(l[1]=e=>ee.chunkUploadVisible=e),modalTitle:Y.formData.name,max_size:d(ne),maxLength:d(de),propsCategoryMap:d(te),defaultList:ee.fileList,getChunkUploadConfig:e.getChunkUploadConfig,onGetSumbitList:fe},null,8,["modelValue","modalTitle","max_size","maxLength","propsCategoryMap","defaultList","getChunkUploadConfig"])])}}}),[["__file","vod-chunk-upload.vue"]]);export{Y as default};
1
+ import{defineComponent as e,reactive as o,computed as l,onMounted as i,resolveComponent as s,openBlock as t,createElementBlock as a,withDirectives as r,normalizeClass as n,unref as d,createElementVNode as u,Fragment as p,vShow as m,createCommentVNode as c,createVNode as v,withCtx as f,normalizeStyle as g,toDisplayString as h,createTextVNode as k,withModifiers as y,createBlock as b}from"vue";import C from"xe-utils";import"moment";import{getVodData as U}from"../hooks/vod-data.js";import{VodComputed as L}from"../hooks/vod-computed.js";import V from"../../../../shared/components/player-vod/video-modal.js";import _ from"../vod-upload-modal.js";import{NIcon as D,NButton as O}from"naive-ui";import{PlayCircleSharp as w,PlayCircleOutline as S,RemoveCircleSharp as x}from"@vicons/ionicons5";import j from"../../../../shared/assets/img/video_default_cover.png.js";import F from"../../../../shared/assets/img/video.png.js";import z from"../../../../shared/assets/img/success.png.js";import N from"../../../../_virtual/plugin-vue_export-helper.js";const M={class:"c-upload"},A={class:"chunk-btn-content"},J={class:"c-uploader-btn"},B=["src"],P=u("div",{class:"uploader-text"},[u("p",null,"点击上传"),u("span",{class:"guage-text"},"上传视频(不超过50M)")],-1),E=["src"],T=u("div",{class:"uploader-text"},[u("p",null,"上传视频")],-1),R={class:"vod-wrap c-uploader-preview-wrap"},G={key:0,class:"vod-def-bg vod-uploading"},H={class:"vod-def-bg vod-done"},K=["src"],$=["src"],q={class:"c-icon-wrap"},I={class:"vod-def-bg vod-error"},Q=["src"],W={class:"tooltip-wrap error-wrap"},X=["onClick"];var Y=N(e({__name:"vod-chunk-upload",props:{formData:{type:Object,default:()=>({})},source:String,limitNum:{default:1},defFileList:{default:""},isLock:Boolean,isDetail:{type:Boolean,default:!1},getChunkUploadConfig:{type:Function,default:()=>Promise.resolve({})}},emits:["vodFileList"],setup(e,{emit:N}){const Y=e,{VodState:Z}=U(),ee=o(Z),oe={},{isShowBtn:le,maskHeight:ie,showPercent:se,allow_format:te,defaultValue:ae,isDisabled:re,max_size:ne,maxlength:de}=L(Y,ee,{mainForm:oe});console.log(le.value,"----isShowBtn---",Y.formData.title),l((()=>ue()));const ue=()=>{const{formData:e}=Y;let o=[];if(o="guage"===Y.source?Y.defFileList:null==oe?void 0:oe.handleSysParams(oe.defaultValue[e.name]||e.default_val),o=JSON.parse(JSON.stringify(o)),!o)return[];let l=[];return Array.isArray(o)&&(l=[...o]),C.isJSON(o)&&(l=JSON.parse(o)),Array.isArray(l)?(l.forEach((e=>{e.thumbUrl=e.vodCoverUrl||void 0,e.uid=(-Math.random()).toString(),e.status="done"})),ee.fileList=l,console.log(ee.fileList,"----list---list"),pe(l),l):[]},pe=e=>{if(!Array.isArray(e))return"";const{formData:o,source:l}=Y;let i=[];e.forEach((e=>{if("done"===e.status&&(e.response&&"00000"==e.response.code||e.url)){const{data:o={}}=e.response||{};e.url||o.videoUrl;let l=e.vodCoverUrl||o.vodCoverUrl;i.push({name:e.name,size:e.size,url:e.url||o.videoUrl,vodCoverUrl:l,uid:e.id||e.uid||(-Math.random()).toString()})}})),console.log(i,"---resList---",Y.formData.title);let s=JSON.stringify(i);"guage"!==l?oe.baseForm.setFieldsValue({[o.val_key]:s}):N("vodFileList",s,Y.formData)},me=(e,o)=>{let l,i;if(e.type&&(i=e.type),e.url||e.videoUrl){if(l=e.url||e.videoUrl,!i){let e=l.split(".");i=`video/${e[e.length-1]}`}}else l=URL.createObjectURL(e.originFileObj);ee.playerOptions={sources:[{type:i,src:l}]},ee.videoVisible=!0},ce=()=>{ee.videoVisible=!1},ve=()=>{re.value||(ee.chunkUploadVisible=!0)},fe=e=>{let o=[];e.forEach((e=>{let l=e.videoCoverPic||void 0;o.push({name:e.videoName||e.name,url:e.videoUrl||e.url,size:e.size,vodCoverUrl:l,status:"done",uid:(-Math.random()).toString()})})),ee.fileList.push(...o),pe(ee.fileList)},ge=()=>{pe(ee.fileList)};return i((()=>{ue()})),(o,l)=>{const i=s("draggable");return t(),a("div",M,[e.isDetail||Y.isLock?c("v-if",!0):r((t(),a("div",{key:0,class:n(["c-chunk-uploader-btn",{"disable-upload":d(re)}]),onClick:ve},[u("div",A,[u("div",J,["guage"==Y.source?(t(),a(p,{key:0},[u("img",{src:d(F),class:"guage-img"},null,8,B),P],64)):(t(),a(p,{key:1},[u("img",{src:d(F),class:"guage-img"},null,8,E),T],64))])])],2)),[[m,d(le)]]),v(i,{modelValue:ee.fileList,"onUpdate:modelValue":l[0]||(l[0]=e=>ee.fileList=e),animation:"150",itemKey:"uid",disabled:d(re).value,options:ee.draggableOptions,onUpdate:ge,class:"drag-content"},{item:f((({element:o,index:l})=>{return[u("div",R,[c(" 上传中 "),"uploading"===o.status?(t(),a("div",G,[c(" TODO: 封面图补充 "),u("div",{class:"uploading-mask",style:g({height:d(ie)(o)})},[u("span",null,h(d(se)(o.percent))+"%",1)],4)])):"done"===o.status?(t(),a(p,{key:1},[c(" 上传完成 "),u("div",H,[u("img",{src:(i=o,i.thumbUrl?i.thumbUrl:j),class:"vod-cover-img"},null,8,K),u("div",{class:n(["tooltip-wrap",{"is-new":o.isNew}])},[u("img",{src:d(z),class:"upload-img"},null,8,$),k(" 上传成功 ")],2),c(" 播放图标 "),u("div",q,[v(d(D),{component:d(w),class:"icon-play theme_filled",onClick:y((e=>me(o)),["prevent","stop"])},null,8,["component","onClick"]),v(d(D),{component:d(S),class:"icon-play theme_outlined",onClick:y((e=>me(o)),["prevent","stop"])},null,8,["component","onClick"])])])],64)):"error"===o.status?(t(),a(p,{key:2},[c(" 上传失败 "),u("div",I,[u("img",{src:o.thumbUrl,class:"vod-cover-img"},null,8,Q),u("div",W,[u("span",null,h(o.message?o.message:"上传失败,继续上传?"),1),v(d(O),{size:"small",onClick:y((e=>{}),["prevent","stop"])},{default:f((()=>[k("确定")])),_:2},1032,["onClick"])])])],64)):c("v-if",!0),!["done","error"].includes(o.status)||d(re)||e.isDetail?c("v-if",!0):(t(),a("div",{key:3,onClick:y((e=>{return o=l,ee.fileList.splice(o,1),void pe(ee.fileList);var o}),["stop"]),class:"uploader-preview-delete"},[v(d(D),{class:"pre-delete",component:d(x)},null,8,["component"])],8,X))])];var i})),_:1},8,["modelValue","disabled","options"]),ee.videoVisible?(t(),b(d(V),{key:1,visible:ee.videoVisible,formData:Y.formData,playerOptions:ee.playerOptions,onCloseVideoModal:ce},null,8,["visible","formData","playerOptions"])):c("v-if",!0),v(d(_),{modelValue:ee.chunkUploadVisible,"onUpdate:modelValue":l[1]||(l[1]=e=>ee.chunkUploadVisible=e),modalTitle:Y.formData.name,max_size:d(ne),maxLength:d(de),propsCategoryMap:d(te),defaultList:ee.fileList,getChunkUploadConfig:e.getChunkUploadConfig,onGetSumbitList:fe},null,8,["modelValue","modalTitle","max_size","maxLength","propsCategoryMap","defaultList","getChunkUploadConfig"])])}}}),[["__file","vod-chunk-upload.vue"]]);export{Y as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.42-beta.26",
3
+ "version": "3.1.42-beta.28",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -61,5 +61,5 @@
61
61
  "iOS 7",
62
62
  "last 3 iOS versions"
63
63
  ],
64
- "gitHead": "4c2de1fb102e0ce00c41dfe8aafa7cec60f5983c"
64
+ "gitHead": "aba77a9460d3f640cda7deee84e143f0ee88a982"
65
65
  }