cnhis-design-vue 3.1.45-beta.1 → 3.1.45-beta.3

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 (21) hide show
  1. package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useSurgicalAnesthesiaChart.js +1 -1
  2. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  3. package/es/components/fabric-chart/src/hooks/temperature/useRight.js +1 -1
  4. package/es/components/fabric-chart/src/hooks/temperature/useTop.js +1 -1
  5. package/es/components/fabric-chart/src/hooks/useDraw.js +1 -1
  6. package/es/components/fabric-chart/src/interface.d.ts +9 -0
  7. package/es/components/form-render/src/components/renderer/combination.d.ts +5 -5
  8. package/es/components/form-render/src/components/renderer/combination.js +1 -1
  9. package/es/components/form-render/src/components/renderer/jsonCombination/index.d.ts +5 -5
  10. package/es/components/form-render/src/components/renderer/jsonCombination/index.js +1 -1
  11. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  12. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  13. package/es/components/search-cascader/index.d.ts +16 -3
  14. package/es/components/search-cascader/src/SearchCascader.vue.d.ts +16 -3
  15. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  16. package/es/shared/package.json.js +1 -1
  17. package/package.json +2 -2
  18. package/es/components/search-cascader/src/hooks/index.d.ts +0 -1
  19. package/es/components/search-cascader/src/hooks/index.js +0 -1
  20. package/es/components/search-cascader/src/hooks/useCssVariable.d.ts +0 -3
  21. package/es/components/search-cascader/src/hooks/useCssVariable.js +0 -1
@@ -1 +1 @@
1
- import{ref as t,reactive as r}from"vue";import{defaultBorderStyle as e}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"../temperature/useShadow.js";function o(o,a,i,s){t(),t(),t(),r({show:!1,point:{x:0,y:0},list:[]}),r({show:!1,point:{x:0,y:0},list:[],target:null});return{propItems:r({canvasWidth:a.data.width,canvasHeight:a.data.height,borderStyle:{...e,...a.data.borderStyle||{}},grid:a.data.grid,other:a.data.other})}}export{o as useSurgicalAnesthesiaChart};
1
+ import{ref as t,reactive as e,computed as a}from"vue";import{defaultBorderStyle as r}from"../useDraw.js";import"../../../../../shared/utils/fabricjs/index.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"../temperature/useShadow.js";function i(i,l,o,n){t(),t(),t(),e({show:!1,point:{x:0,y:0},list:[]}),e({show:!1,point:{x:0,y:0},list:[],target:null});const u=a((()=>{let t=0;return function e(a){a.forEach((a=>{var r;(null==(r=a.children)?void 0:r.length)?e(a.children):t++}))}(l.data.top.treeData),t})),d=a((()=>l.data.top.tree.cellHeight)),s=a((()=>{const{xAxis:t}=l.data;return"top"===t.position?t.height:0}));a((()=>s.value+d.value*u.value));const h=a((()=>{const{grid:t}=l.data;return t.mainXCell*t.subXCell})),v=a((()=>{const{grid:t}=l.data;return t.mainYCell*t.subYCell}));a((()=>(p.value-c.value)/h.value)),a((()=>(m.value-g.value)/v.value));const c=a((()=>l.data.width-l.data.left.width)),p=a((()=>{var t;const{width:e,right:a}=l.data;if(!a)return e;return e-(null!=(t=a.width)?t:0)})),g=a((()=>l.data.xAxis.height+d.value*u.value)),m=a((()=>{var t;const{bottom:e=null,height:a}=l.data;if(!e)return a;return a-(null!=(t=e.height)?t:0)}));return{propItems:e({canvasWidth:l.data.width,canvasHeight:l.data.height,borderStyle:{...r,...l.data.borderStyle||{}},grid:l.data.grid,other:l.data.other})}}export{i as useSurgicalAnesthesiaChart};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultTextStyle as e,defaultStyle as i,drawPoint as n,drawTextGroup as o}from"../useDraw.js";import"date-fns";import{getType as l,isOneLine as r}from"../../utils/index.js";import"@vueuse/core";import{getScaleInfo as s,drawScaleNumber as a,drawScaleLine as u}from"../useScaleColumn.js";import{useCommon as h}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";function g(g,p,c,d,f,y,m,v,w,S,b){var Y,x;const{getEqualXTypes:j,handleAddPrevent:T}=h(g,c),{originY:X,endY:C,originX:N,endX:V,xCellWidth:L,yCellHeight:M,left:k,vitalSignsOriginY:E,painOriginY:I,painHeight:A,iconsWidth:G,itemList:H,painIndex:O,right:W,canvasWidth:R,canvasHeight:_,getRightInfo:B,borderStyle:J}=p;function $(n){var l;if(!(null==n?void 0:n.length))return;const{layout:r}=n[0];let h=G,p=N;"right"===r&&(h=V,p=V+(null!=(l=null==W?void 0:W.width)?l:0));const c=[],d=A&&"right"!==r?n.length-1:n.length,f=(p-h)/d,y=f+(p-h)%d;n.forEach(((n,l)=>{if("pain"===n.type)return void function(i){const{list:n=[],spaceGridNumber:l=5,showScale:r,showNumber:u,position:h,showMaxMinNumber:p,style:c,title:d}=i,f=o({width:N-G,height:A,...J},{value:`${d}`,...e,...c||{}},{left:G,top:I.originY}),y=[];if(r||u){const{lineXMain:e,textLeft:o}=s(h,G,N-G),g=n.length;n.forEach(((n,s)=>{let h=I.endY-s*M*l;if(0===s&&(h=C-5),!u||(0===s||s===g-1)&&!p||y.push(a(n,i,o,h)),r&&0!==s){const[i,n]=e,o=new t.Line([i,h,n,h],{...J,...c});y.push(o)}}))}g.value.add(f,...y),f.sendToBack()}(n);const p=[],d=0===l?y:f,m=0===l?h:y+h+(l-1)*f,v="right"===r?0:E.originY,w="right"===r?_:E.endY,S=l>0?new t.Line([m,v,m,w],{...J}):null;S&&p.push(S);const b=m+d/2,{list:Y=[],spaceGridNumber:x=5,showScale:j,showNumber:T,position:X,showMaxMinNumber:V}=n;if(j||T){const{lineXMain:t,lineXSub:e,textLeft:i}=s(X,m,d),o=Y.length;Y.forEach(((l,r)=>{const s=E.endY-r*M*x;if(T&&(!(0===r||r===o-1)||V)){const t=0==r?s-5:s,e=a(l,n,i,t),o=E.originY+e.height/2;t<o&&e.set({top:o}),p.push(e)}p.push(...u(n,r,t,e,s,M,E.originY))}))}let L=n.title||"";n.unit&&(L+="\n"+n.unit),L&&p.push(new t.Text(String(L),{...e,left:b,top:E.originY+M*x/2,textAlign:"center",...n.style}));const k=new t.Group(p,{...i,objectCaching:!1});c.push(k)}));const m=c.length>0?new t.Group([...c],{...i,objectCaching:!1}):null;m&&g.value.add(m),m&&m.sendToBack()}function q(t){return t.left>=N&&t.left<V&&t.top>=X&&t.top<=C}G&&function(){const e=JSON.parse(JSON.stringify(H));let o=C;const s=G-k.icons.marginRight;e.reverse().forEach((e=>{o-=10;let a=e.title.replace(/(.{2})/g,"$1\n");a.endsWith("\n")&&(a=a.slice(0,a.length-1));const u=new t.Text(String(a),{...i,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:s-(e.pointAttr.width||10)-5,top:o,lineHeight:1,fontSize:12}),h=n(e.type,{left:s,top:o-(u.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:l(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:s,originTop:o-(u.height||30)/2-1,...p.event});var y;o-=u.height||30,(y=h).on("moving",(()=>{y.set("originX","center"),function(t){if(t.left>=N&&t.left<=V){t.setCoords();const e="pain"===t.origin.type?I:E;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(y),q(y)?d(y):f.show=!1})),y.on("mouseup:before",(t=>{if(f.show=!1,0===t.e.button&&q(y)){const t=j(y.left,"_type",L).includes(y.origin._type),e=S(y.left);if(!e||t)t&&e&&T("repeat");else{const t={data:{time:v(y.left),value:w(y.origin.type,y.top),...r(y.origin.type)?{key:y.origin.key}:{}},...y.origin};c("add",t),b(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(y)})),g.value.add(u,h)}))}();const z=k.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==W?void 0:W.width)&&"left"===(null==(Y=null==W?void 0:W.yScaleValue)?void 0:Y.layout)&&(null==(x=null==W?void 0:W.yScaleValue)?void 0:x.show)&&z.push(B),O>0&&k.yScaleValue[O].show){const t=k.yScaleValue[O];0===O&&k.yScaleValue.length>1&&z.unshift(t),O==k.yScaleValue.length-1&&z.push(t)}const D=z.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),P=z[D];return D>-1&&z.splice(D,0,{...P,title:(null==P?void 0:P.doubleTitle)||(null==P?void 0:P.title)}),$(z),g.value.add(new t.Rect({left:G,top:0,width:R-G-1,height:_-1,fill:"transparent",...J})),{drawScaleValue:$}}export{g as useLeft};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultTextStyle as i,defaultStyle as n,drawPoint as o,drawTextGroup as l}from"../useDraw.js";import"date-fns";import{getType as r,isOneLine as s}from"../../utils/index.js";import"@vueuse/core";import{getScaleInfo as a,drawScaleNumber as u,drawScaleLine as h}from"../useScaleColumn.js";import{useCommon as g}from"../useCommon.js";import"vue";import"lodash-es";import"./useShadow.js";function p(p,c,d,f,y,m,v,w,S,b,Y){var x,j;const{getEqualXTypes:C,handleAddPrevent:T}=g(p,d),{originY:X,endY:k,originX:N,endX:V,xCellWidth:M,yCellHeight:L,left:W,vitalSignsOriginY:E,painOriginY:I,painHeight:A,iconsWidth:G,itemList:H,painIndex:O,right:R,canvasWidth:_,canvasHeight:B,getRightInfo:J,borderStyle:$}=c;function q(o){var r;if(!(null==o?void 0:o.length))return;const{layout:s}=o[0];let g=G,c=N;"right"===s&&(g=V,c=V+(null!=(r=null==R?void 0:R.width)?r:0));const d=[],f=A&&"right"!==s?o.length-1:o.length,y=(c-g)/f,m=y+(c-g)%f;o.forEach(((o,r)=>{if("pain"===o.type)return void function(n){const{list:o=[],spaceGridNumber:r=5,showScale:s,showNumber:h,position:g,showMaxMinNumber:c,style:d,title:f}=n,y=l({width:N-G,height:A,...$},{value:`${f}`,...i,...d||{}},{left:G,top:I.originY}),m=e([G,I.originY,N,I.originY],$),v=[];if(s||h){const{lineXMain:e,textLeft:i}=a(g,G,N-G),l=o.length;o.forEach(((o,a)=>{let g=I.endY-a*L*r;if(0===a&&(g=k-5),!h||(0===a||a===l-1)&&!c||v.push(u(o,n,i,g)),s&&0!==a){const[i,n]=e,o=new t.Line([i,g,n,g],{...$,...d});v.push(o)}}))}p.value.add(m,y,...v),y.sendToBack()}(o);const c=[],f=0===r?m:y,v=0===r?g:m+g+(r-1)*y,w="right"===s?0:E.originY,S="right"===s?B:E.endY,b=r>0?e([v,w,v,S],{objectCaching:!1,...$}):null;b&&c.push(b);const Y=v+f/2,{list:x=[],spaceGridNumber:j=5,showScale:C,showNumber:T,position:X,showMaxMinNumber:V}=o;if(C||T){const{lineXMain:t,lineXSub:e,textLeft:i}=a(X,v,f),n=x.length;x.forEach(((l,r)=>{const s=E.endY-r*L*j;if(T&&(!(0===r||r===n-1)||V)){const t=0==r?s-5:s,e=u(l,o,i,t),n=E.originY+e.height/2;t<n&&e.set({top:n}),c.push(e)}c.push(...h(o,r,t,e,s,L,E.originY))}))}let M=o.title||"";o.unit&&(M+="\n"+o.unit),M&&c.push(new t.Text(String(M),{...i,left:Y,top:E.originY+L*j/2,textAlign:"center",...o.style}));const W=new t.Group(c,{...n,objectCaching:!1});d.push(W)}));const v=d.length>0?new t.Group([...d],{...n,objectCaching:!1}):null;v&&p.value.add(v),v&&v.sendToBack()}function z(t){return t.left>=N&&t.left<V&&t.top>=X&&t.top<=k}G&&function(){const e=JSON.parse(JSON.stringify(H));let i=k;const l=G-W.icons.marginRight;e.reverse().forEach((e=>{i-=10;let a=e.title.replace(/(.{2})/g,"$1\n");a.endsWith("\n")&&(a=a.slice(0,a.length-1));const u=new t.Text(String(a),{...n,objectCaching:!1,...e.titleStyle||{},originX:"right",originY:"bottom",left:l-(e.pointAttr.width||10)-5,top:i,lineHeight:1,fontSize:12}),h=o(e.type,{left:l,top:i-(u.height||30)/2-1,...e.pointAttr,originY:"center",originX:"right",origin:{title:e.title,unit:e.unit,type:r(e.bigType),_type:e.bigType,dataIndex:e.dataIndex,key:e.key,isMenu:!0},originLeft:l,originTop:i-(u.height||30)/2-1,...c.event});var g;i-=u.height||30,(g=h).on("moving",(()=>{g.set("originX","center"),function(t){if(t.left>=N&&t.left<=V){t.setCoords();const e="pain"===t.origin.type?I:E;t.top<e.originY&&t.set("top",e.originY),t.top>e.endY&&t.set("top",e.endY)}}(g),z(g)?f(g):y.show=!1})),g.on("mouseup:before",(t=>{if(y.show=!1,0===t.e.button&&z(g)){const t=C(g.left,"_type",M).includes(g.origin._type),e=b(g.left);if(!e||t)t&&e&&T("repeat");else{const t={data:{time:w(g.left),value:S(g.origin.type,g.top),...s(g.origin.type)?{key:g.origin.key}:{}},...g.origin};d("add",t),Y(t)}}!function(t){t.setCoords().set({originX:"right",left:t.originLeft,top:t.originTop})}(g)})),p.value.add(u,h)}))}();const D=W.yScaleValue.filter((t=>"left"===t.layout&&"pain"!==t.type&&t.show));if((null==R?void 0:R.width)&&"left"===(null==(x=null==R?void 0:R.yScaleValue)?void 0:x.layout)&&(null==(j=null==R?void 0:R.yScaleValue)?void 0:j.show)&&D.push(J),O>0&&W.yScaleValue[O].show){const t=W.yScaleValue[O];0===O&&W.yScaleValue.length>1&&D.unshift(t),O==W.yScaleValue.length-1&&D.push(t)}const P=D.findIndex((t=>"pulse"===t.type&&t.show&&t.doubleShow)),F=D[P];return P>-1&&D.splice(P,0,{...F,title:(null==F?void 0:F.doubleTitle)||(null==F?void 0:F.title)}),q(D),p.value.add(new t.Rect({left:G,top:0,width:_-G-$.strokeWidth,height:B-$.strokeWidth,fill:"transparent",...$})),{drawScaleValue:q}}export{p as useLeft};
@@ -1 +1 @@
1
- import{fabric as l}from"../../../../../shared/utils/fabricjs/index.js";function e(e,i,t){var o,n;const{left:d,right:u,getRightInfo:a,canvasWidth:s,endY:h,endX:r,originY:f,borderStyle:v}=i,c=d.yScaleValue.filter((l=>"right"===l.layout&&l.show));(null==u?void 0:u.width)&&"right"===(null==(o=null==u?void 0:u.yScaleValue)?void 0:o.layout)&&(null==(n=null==u?void 0:u.yScaleValue)?void 0:n.show)&&c.push(a);const w=c.findIndex((l=>"pulse"===l.type&&l.show&&l.doubleShow)),g=c[w];if(w>-1&&c.splice(w,0,{...g,title:(null==g?void 0:g.doubleTitle)||(null==g?void 0:g.title)}),(null==u?void 0:u.width)||c.length>0){const i=new l.Line([s-1,0,s-1,h],v),t=new l.Line([r+1,f,s-1,f],{...v,stroke:"#fff"});e.value.add(i,t)}t(c)}export{e as useRight};
1
+ function l(l,o,t){var e,i;const{left:u,right:n,getRightInfo:d}=o,h=u.yScaleValue.filter((l=>"right"===l.layout&&l.show));(null==n?void 0:n.width)&&"right"===(null==(e=null==n?void 0:n.yScaleValue)?void 0:e.layout)&&(null==(i=null==n?void 0:n.yScaleValue)?void 0:i.show)&&h.push(d);const a=h.findIndex((l=>"pulse"===l.type&&l.show&&l.doubleShow)),s=h[a];a>-1&&h.splice(a,0,{...s,title:(null==s?void 0:s.doubleTitle)||(null==s?void 0:s.title)}),t(h)}export{l as useRight};
@@ -1 +1 @@
1
- import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e,drawTextGroup as l,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";function o(o,s){const{grid:u,originX:h,xCellWidth:n,gridXNumber:a,top:c,xScalevalueHeight:r,iconsWidth:d,topList:p,endXLimit:f,canvasWidth:v,borderStyle:g}=s;!function(){const y=[];f&&y.push(new t.Line([f,0,v,0],g));let m=0;p.forEach(((t,e)=>{e>0&&(m+=s[`${p[e-1].key}Height`]),"xScalevalue"==t.key?(function(t,e,o){if(!c.dayHeight)return!1;const s=c.dayHeight,r=n*u.subSecondXCell,d=(a-u.surplusXCell)/u.subSecondXCell;for(let u=0;u<d;u++){const n=h+u*r,a=u%2==0?"上午":"下午",c=l({width:r,height:s,...g},{value:a,...i,...t.style||{}},{left:n,top:o});e.push(c)}}(t,y,m),function(t,e,o){var s;const a=c.xScalevalue.show&&null!=(s=c.dayHeight)?s:0,p=r-a,f=l({width:h-d,height:r,...g},{value:c.xScalevalue.title,...i,...t.style||{},...t.titleStyle||{}},{left:d,top:o});e.push(f);const v=[];for(let t=0;t<u.mainXCell;t++)v.push(c.xScalevalue.list);v.flat().forEach(((s,u)=>{const c=h+u*n,r=l({width:n,height:p,...g},{value:s.value,...i,...t.style||{},...s.style||{}},{left:c,top:o+a});e.push(r)}))}(t,y,m)):s[`${t.key}Height`]&&function(t,e,o){const a=s[`${t.key}Height`],c=l({width:h-d,height:a,...g},{value:t.title,...i,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:d,top:o});e.push(c);const r=n*u.subXCell;t.list.forEach(((s,u)=>{const n=h+u*r,c=l({width:r,height:a,...g},{value:s,...i,...(null==t?void 0:t.style)||{}},{left:n,top:o});e.push(c)}))}(t,y,m)}));const S=y.length>0?new t.Group([...y],{...e,objectCaching:!1}):null;S&&S.sendToBack(),S&&o.value.add(S)}()}export{o as useTop};
1
+ import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{drawLine as e,defaultStyle as l,drawTextGroup as s,defaultTextStyle as i}from"../useDraw.js";import"date-fns";import"lodash-es";import"@vueuse/core";import"vue";import"./useShadow.js";function o(o,u){const{grid:h,originX:n,endX:a,xCellWidth:c,gridXNumber:r,top:p,xScalevalueHeight:d,iconsWidth:f,topList:v,endXLimit:g,canvasWidth:y,borderStyle:m}=u;!function(){const S=[];g&&S.push(new t.Line([g,0,y,0],m));let w=0;v.forEach(((t,l)=>{if(l>0&&(w+=u[`${v[l-1].key}Height`]),"xScalevalue"==t.key)!function(t,l,o){const u=p.dayHeight;if(!u)return;l.push(e([n,o+u,a,o+u],m));const d=c*h.subSecondXCell,f=(r-h.surplusXCell)/h.subSecondXCell;for(let h=0;h<f;h++){const a=n+h*d,c=h%2==0?"上午":"下午",r=s({width:d,height:u,...m},{value:c,...i,...t.style||{}},{left:a,top:o});l.push(r),l.push(e([a+d,o,a+d,o+u],m))}}(t,S,w),function(t,l,o){var u;const r=p.xScalevalue.show&&null!=(u=p.dayHeight)?u:0,v=d-r;if(!v)return;l.push(e([f,o+d,a,o+d],m));const g=s({width:n-f,height:d,...m},{value:p.xScalevalue.title,...i,...t.style||{},...t.titleStyle||{}},{left:f,top:o});l.push(g),l.push(e([n,o,n,o+d],m));const y=[];for(let t=0;t<h.mainXCell;t++)y.push(p.xScalevalue.list);y.flat().forEach(((u,h)=>{const a=n+h*c,p=s({width:c,height:v,...m},{value:u.value,...i,...t.style||{},...u.style||{}},{left:a,top:o+r});l.push(p),l.push(e([a+c,o+r,a+c,o+r+v],m))}))}(t,S,w);else{if(!u[`${t.key}Height`])return;const o=u[`${v[l].key}Height`];!function(t,l,o){const a=u[`${t.key}Height`],r=s({width:n-f,height:a,...m},{value:t.title,...i,...(null==t?void 0:t.style)||{},...t.titleStyle||{}},{left:f,top:o});l.push(r);const p=c*h.subXCell;t.list.forEach(((u,h)=>{const c=n+h*p,r=s({width:p,height:a,...m},{value:u,...i,...(null==t?void 0:t.style)||{}},{left:c,top:o});l.push(e([c+p,o,c+p,o+a],m)),l.push(r)}))}(t,S,w),S.push(e([f,w+o,a,w+o],m)),S.push(e([n,w,n,w+o],m))}}));const X=S.length>0?new t.Group([...S],{...l,objectCaching:!1}):null;X&&X.sendToBack(),X&&o.value.add(X)}()}export{o as useTop};
@@ -1 +1 @@
1
- import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,...t},i={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},n={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...i,...r})}function s([t,r],i){return new e.Text(String(i.value),{...o,left:t,top:r,...i})}function l([r,i,n],o,l="down"){const a=c([r,i,r,n],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?n-3:n+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,i,c){const s=new e.Rect({...n,...r,strokeWidth:.5}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=i,g=r.width/2,h=r.height/2,d=new e.Text(String(l),{...o,...i,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function u(t="circle",r){const i={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},n=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...i});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...i});case"image":return new e.Image(r.element,{...i,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),i={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},n=new e.Line([0,t/2,t,t/2],i),o=new e.Line([t/2,0,t/2,t],i);return new e.Group([n,o])};return new e.Group([n(),t()],{scale:1,...i})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([n(),o],{scale:1,...i})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...i})}}export{r as defaultBorderStyle,i as defaultLineStyle,n as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
1
+ import{fabric as e}from"../../../../shared/utils/fabricjs/index.js";const t={evented:!1,selectable:!1},r={stroke:"#000",strokeWidth:1,...t},n={stroke:"#000",strokeWidth:1,strokeDashArray:[0,0],...t},i={fill:"transparent",stroke:"#000",strokeWidth:1,originX:"center",originY:"center",objectCaching:!1,...t},o={fontFamily:"微软雅黑",fontSize:12,fill:"#000",centeredRotation:!0,originX:"center",originY:"center",lineHeight:1,objectCaching:!1,...t};function c(t,r){return new e.Line(t,{...n,...r})}function s([t,r],n){return new e.Text(String(n.value),{...o,left:t,top:r,...n})}function l([r,n,i],o,l="down"){const a=c([r,n,r,i],{strokeWidth:1,stroke:o.fill}),u=s([r+.5,"up"===l?i-3:i+3],{value:"v",originX:"center",originY:"bottom",fontSize:16,angle:"up"===l?180:0,...o});return new e.Group([a,u],{...t,originX:"center",originY:"top"})}function a(r,n,c){const s=new e.Rect({...i,...r,stroke:"transparent"}),{value:l="标题",textAlign:a="center",verticalAlign:u="center"}=n,g=r.width/2,h=r.height/2,d=new e.Text(String(l),{...o,...n,..."left"==a||"right"==a?{originX:a,left:"left"==a?-g:g}:{},..."top"==u||"bottom"==u?{originY:u,top:"top"==u?-h:h}:{}});return new e.Group([s,d],{objectCaching:!1,...t,...c})}function u(t="circle",r){const n={originX:"center",originY:"center",hasControls:!1,hasBorders:!1,hoverCursor:"pointer",objectCaching:!1,...r},i=()=>new e.Circle({objectCaching:!1,strokeWidth:r.strokeWidth||1,stroke:r.stroke||"red",radius:r.radius||5,fill:"#fff"});switch(t){case"triangle":return new e.Triangle({width:20,height:20,strokeWidth:1,scale:1,...n});case"circle":return new e.Circle({objectCaching:!1,strokeWidth:1,radius:5,scale:1,...n});case"image":return new e.Image(r.element,{...n,scale:1});case"yemai":{const t=()=>{const t=2*((r.radius||5)+(r.strokeWidth||1)),n={stroke:r.strokeX||"blue",strokeWidth:r.strokeWidthX||1,originX:"center",originY:"center"},i=new e.Line([0,t/2,t,t/2],n),o=new e.Line([t/2,0,t/2,t],n);return new e.Group([i,o])};return new e.Group([i(),t()],{scale:1,...n})}case"koumai":{const t=(r.radius||5)+(r.strokeWidth||1),o=new e.Circle({objectCaching:!1,radius:r.radiusCircle||2,fill:r.fillCircle||"#000",originX:"center",originY:"center",left:t,top:t});return new e.Group([i(),o],{scale:1,...n})}default:return r&&Reflect.deleteProperty(r,"stroke"),new e.Text(String(t),{fontFamily:"微软雅黑",scale:1,fontSize:14,fill:"#000",...n})}}export{r as defaultBorderStyle,n as defaultLineStyle,i as defaultRectStyle,t as defaultStyle,o as defaultTextStyle,l as drawArrow,c as drawLine,u as drawPoint,s as drawText,a as drawTextGroup};
@@ -7,6 +7,15 @@ interface IEvent {
7
7
  evented: boolean;
8
8
  hovered: boolean;
9
9
  }
10
+ export declare type ITreeItem = Partial<{
11
+ title: string;
12
+ totle: number;
13
+ data: Array<{
14
+ time: string[];
15
+ value: AnyObject;
16
+ }>;
17
+ children: ITreeItem[];
18
+ }>;
10
19
  interface ImainLineStyle {
11
20
  x: fabric.ILineOptions;
12
21
  y: fabric.ILineOptions;
@@ -14,8 +14,8 @@ export declare const COMBINATION: import("vue").DefineComponent<{
14
14
  disabled: {
15
15
  type: BooleanConstructor;
16
16
  };
17
- getProperties: {
18
- type: PropType<() => FieldItem[]>;
17
+ properties: {
18
+ type: PropType<FieldItem[]>;
19
19
  default: () => never[];
20
20
  };
21
21
  combinationItemDeletable: {
@@ -39,8 +39,8 @@ export declare const COMBINATION: import("vue").DefineComponent<{
39
39
  disabled: {
40
40
  type: BooleanConstructor;
41
41
  };
42
- getProperties: {
43
- type: PropType<() => FieldItem[]>;
42
+ properties: {
43
+ type: PropType<FieldItem[]>;
44
44
  default: () => never[];
45
45
  };
46
46
  combinationItemDeletable: {
@@ -56,5 +56,5 @@ export declare const COMBINATION: import("vue").DefineComponent<{
56
56
  disabled: boolean;
57
57
  title: string;
58
58
  combinationItemDeletable: boolean | CombinationItemDeletableFn;
59
- getProperties: () => FieldItem[];
59
+ properties: FieldItem[];
60
60
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,watch as a,inject as i,onBeforeUnmount as r,createVNode as n}from"vue";import{isObjectField as m}from"@formily/core";import{autorun as l}from"@formily/reactive";import{connect as u,RecursionField as s}from"@formily/vue";import{AddCircleOutline as c,RemoveCircle as p}from"@vicons/ionicons5";import{isNumber as d,isArray as f,isFunction as v,range as b}from"lodash-es";import{NButton as y,NIcon as x}from"naive-ui";import"../../../index.js";import{InjectionBusinessCollector as h}from"../../constants/index.js";import"../../utils/index.js";import{useFormField as _}from"../../hooks/useFormField.js";import{useFieldListAdaptor as j}from"../../hooks/useFieldListAdaptor.js";import{createObjSchema as C}from"../../utils/schema.js";const F=u(e({name:"FormCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},disabled:{type:Boolean},getProperties:{type:Function,default:()=>[]},combinationItemDeletable:{type:[Boolean,Function],default:!0},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e){const{field:u,fieldKey:F}=_(),g=o(1),k=t((()=>d(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));function I(){g.value++}a((()=>e.value),(e=>{f(e)&&(g.value=Math.min(Math.max(e.length,1),k.value))}),{immediate:!0});const N=i(h),{schemaAdaptor:D}=j(N),G=o([]);return r(l((()=>{f(u.value.value)&&(G.value=u.value.value.map(((o,t)=>v(e.combinationItemDeletable)?e.combinationItemDeletable(o||{},t):e.combinationItemDeletable)))}))),()=>n("section",{class:"form-render__combination"},[n("header",{class:"form-render__combinationHeader"},[n("div",{class:"form-render__combinationHeaderText"},[e.title]),n(y,{onClick:I,text:!0,style:{"--n-text-color":"var(--c-primary-color)"},disabled:g.value>=k.value||e.disabled},{icon:()=>n(x,{component:c},null),default:()=>"新增"})]),b(g.value).map(((o,t)=>n("section",{class:"form-render__combinationContent"},[n(s,{schema:C(D(e.getProperties())),name:t},null),n(y,{text:!0,disabled:!G.value[t],type:"error",class:"form-render__combinationClose",onClick:()=>async function(e){if(g.value>1)g.value--,await u.value.remove(e);else{const o=u.value.query(`${F.value}.${e}`).take();if(!o||!m(o))return;await o.reset()}}(t)},{icon:()=>n(x,{component:p},null)})])))])}}));export{F as COMBINATION};
1
+ import{defineComponent as e,ref as o,computed as t,watch as a,inject as r,onBeforeUnmount as i,createVNode as n}from"vue";import{isObjectField as m}from"@formily/core";import{autorun as l}from"@formily/reactive";import{connect as u,RecursionField as s}from"@formily/vue";import{AddCircleOutline as c,RemoveCircle as p}from"@vicons/ionicons5";import{isNumber as d,isArray as f,isFunction as v,range as b}from"lodash-es";import{NButton as y,NIcon as x}from"naive-ui";import"../../../index.js";import{InjectionBusinessCollector as h}from"../../constants/index.js";import"../../utils/index.js";import{useFormField as _}from"../../hooks/useFormField.js";import{useFieldListAdaptor as j}from"../../hooks/useFieldListAdaptor.js";import{createObjSchema as C}from"../../utils/schema.js";const k=u(e({name:"FormCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},disabled:{type:Boolean},properties:{type:Array,default:()=>[]},combinationItemDeletable:{type:[Boolean,Function],default:!0},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e){const{field:u,fieldKey:k}=_(),F=o(1),I=t((()=>d(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));function N(){F.value++}a((()=>e.value),(e=>{f(e)&&(F.value=Math.min(Math.max(e.length,1),I.value))}),{immediate:!0});const A=r(h),{schemaAdaptor:D}=j(A),G=o([]);return i(l((()=>{f(u.value.value)&&(G.value=u.value.value.map(((o,t)=>v(e.combinationItemDeletable)?e.combinationItemDeletable(o||{},t):e.combinationItemDeletable)))}))),()=>n("section",{class:"form-render__combination"},[n("header",{class:"form-render__combinationHeader"},[n("div",{class:"form-render__combinationHeaderText"},[e.title]),n(y,{onClick:N,text:!0,style:{"--n-text-color":"var(--c-primary-color)"},disabled:F.value>=I.value||e.disabled},{icon:()=>n(x,{component:c},null),default:()=>"新增"})]),b(F.value).map(((o,t)=>n("section",{class:"form-render__combinationContent"},[n(s,{schema:C(D(e.properties)),name:t},null),n(y,{text:!0,disabled:!G.value[t],type:"error",class:"form-render__combinationClose",onClick:()=>async function(e){if(F.value>1)F.value--,await u.value.remove(e);else{const o=u.value.query(`${k.value}.${e}`).take();if(!o||!m(o))return;await o.reset()}}(t)},{icon:()=>n(x,{component:p},null)})])))])}}));export{k as COMBINATION};
@@ -11,8 +11,8 @@ export declare const JSON_COMBINATION: import("vue").DefineComponent<{
11
11
  maxGroupNum: {
12
12
  type: NumberConstructor;
13
13
  };
14
- getProperties: {
15
- type: PropType<() => FieldItem[]>;
14
+ properties: {
15
+ type: PropType<FieldItem[]>;
16
16
  default: () => never[];
17
17
  };
18
18
  onInput: {};
@@ -29,8 +29,8 @@ export declare const JSON_COMBINATION: import("vue").DefineComponent<{
29
29
  maxGroupNum: {
30
30
  type: NumberConstructor;
31
31
  };
32
- getProperties: {
33
- type: PropType<() => FieldItem[]>;
32
+ properties: {
33
+ type: PropType<FieldItem[]>;
34
34
  default: () => never[];
35
35
  };
36
36
  onInput: {};
@@ -40,5 +40,5 @@ export declare const JSON_COMBINATION: import("vue").DefineComponent<{
40
40
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
41
41
  }, {
42
42
  title: string;
43
- getProperties: () => FieldItem[];
43
+ properties: FieldItem[];
44
44
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as o,computed as t,watch as r,onMounted as n,createVNode as i}from"vue";import{isField as l}from"@formily/core";import{Path as a}from"@formily/path";import{AddCircleOutline as u,RemoveCircle as s}from"@vicons/ionicons5";import{isNumber as m,range as c,isArray as p,isEqual as f}from"lodash-es";import{useDeepValidate as v}from"./hooks/useDeepValidate.js";import{formRenderLog as d,mergeDeepProperties as h}from"../../../utils/index.js";import{connect as y,mapProps as g}from"@formily/vue";import{useDebounceFn as b,isObject as x}from"@vueuse/core";import{NButton as N,NIcon as _}from"naive-ui";import C from"../../../FormRender.vue.js";import{assignUpdateValue as j}from"../../../utils/schema.js";const F=y(e({name:"FormJsonCombination",props:{title:{type:String,default:""},value:{type:[String,Array]},maxGroupNum:{type:Number},getProperties:{type:Function,default:()=>[]},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:y}){d("当前COMBINATION控件为json模式,推荐使用非json模式,FieldItem.jsonCombination=false");const g=b((function(){y("update:value",JSON.stringify(j.value))}),300),j=o([]),F=t((()=>j.value.length));function I(o,t=!1){p(o)&&(o.length||o.push({}),o=JSON.stringify(o));const r=function(e){try{if(!e)return null;const o=JSON.parse(e);return Array.isArray(o)?o:null}catch(e){return null}}(o);var n;(n=r)&&!f(n,j.value)&&(r.splice(A.value),r.forEach((function(o,r){if(!x(o))return;j.value[r]=o,t&&h(o,e.getProperties())})),j.value.splice(r.length),j.value.forEach(J))}r((()=>e.value),(e=>I(e))),n((()=>{I(e.value||"[{}]",!0),g()}));const S=o([]);function J(e,o){var t;null==(t=S.value[o])||t.setFieldState("*",(o=>{l(o)&&(o.value=a.getIn(e,o.path))}))}function O(){j.value.push(h({},e.getProperties())),g()}v().bindDeepValidate(S);const A=t((()=>m(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));r(A,(e=>{F.value<=e||(j.value.splice(e),g(),S.value.splice(e))}),{immediate:!0});const G=C;return()=>i("section",{class:"form-render__combination"},[i("header",{class:"form-render__combinationHeader"},[i("div",{class:"form-render__combinationHeaderText"},[e.title]),i(N,{onClick:O,style:{"--n-text-color":"var(--c-primary-color)"},text:!0,disabled:F.value>=A.value},{icon:()=>i(_,{component:u},null),default:()=>"新增"})]),c(F.value).map(((o,t)=>i("section",{class:"form-render__combinationContentJson"},[i(G,{ref:e=>function(e,o){S.value[e]=o,J(j.value[e]||{},e)}(t,e),fieldList:e.getProperties(),onFormChange:e=>function(e,{fieldKey:o,value:t}){!j.value[e]&&(j.value[e]={}),a.setIn(j.value[e],o,t),g()}(t,e)},null),i(N,{text:!0,class:"form-render__combinationClose",type:"error",onClick:()=>function(e){j.value.length>1?(j.value.splice(e,1),S.value.splice(e,1)):j.value.splice(e,1,{}),g()}(t)},{icon:()=>i(_,{component:s},null)})])))])}}),g(j));export{F as JSON_COMBINATION};
1
+ import{defineComponent as e,ref as o,computed as r,watch as t,onMounted as n,createVNode as i}from"vue";import{isField as l}from"@formily/core";import{Path as a}from"@formily/path";import{AddCircleOutline as u,RemoveCircle as s}from"@vicons/ionicons5";import{isNumber as m,range as p,isArray as c,isEqual as f}from"lodash-es";import{useDeepValidate as v}from"./hooks/useDeepValidate.js";import{formRenderLog as d,mergeDeepProperties as y}from"../../../utils/index.js";import{connect as h,mapProps as g}from"@formily/vue";import{useDebounceFn as b,isObject as x}from"@vueuse/core";import{NButton as N,NIcon as _}from"naive-ui";import C from"../../../FormRender.vue.js";import{assignUpdateValue as j}from"../../../utils/schema.js";const I=h(e({name:"FormJsonCombination",props:{title:{type:String,default:""},value:{type:[String,Array]},maxGroupNum:{type:Number},properties:{type:Array,default:()=>[]},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:h}){d("当前COMBINATION控件为json模式,推荐使用非json模式,FieldItem.jsonCombination=false");const g=b((function(){h("update:value",JSON.stringify(j.value))}),300),j=o([]),I=r((()=>j.value.length));function S(o,r=!1){c(o)&&(o.length||o.push({}),o=JSON.stringify(o));const t=function(e){try{if(!e)return null;const o=JSON.parse(e);return Array.isArray(o)?o:null}catch(e){return null}}(o);var n;(n=t)&&!f(n,j.value)&&(t.splice(O.value),t.forEach((function(o,t){if(!x(o))return;j.value[t]=o,r&&y(o,e.properties)})),j.value.splice(t.length),j.value.forEach(F))}t((()=>e.value),(e=>S(e))),n((()=>{S(e.value||"[{}]",!0),g()}));const A=o([]);function F(e,o){var r;null==(r=A.value[o])||r.setFieldState("*",(o=>{l(o)&&(o.value=a.getIn(e,o.path))}))}function J(){j.value.push(y({},e.properties)),g()}v().bindDeepValidate(A);const O=r((()=>m(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));t(O,(e=>{I.value<=e||(j.value.splice(e),g(),A.value.splice(e))}),{immediate:!0});const G=C;return()=>i("section",{class:"form-render__combination"},[i("header",{class:"form-render__combinationHeader"},[i("div",{class:"form-render__combinationHeaderText"},[e.title]),i(N,{onClick:J,style:{"--n-text-color":"var(--c-primary-color)"},text:!0,disabled:I.value>=O.value},{icon:()=>i(_,{component:u},null),default:()=>"新增"})]),p(I.value).map(((o,r)=>i("section",{class:"form-render__combinationContentJson"},[i(G,{ref:e=>function(e,o){A.value[e]=o,F(j.value[e]||{},e)}(r,e),fieldList:e.properties,onFormChange:e=>function(e,{fieldKey:o,value:r}){!j.value[e]&&(j.value[e]={}),a.setIn(j.value[e],o,r),g()}(r,e)},null),i(N,{text:!0,class:"form-render__combinationClose",type:"error",onClick:()=>function(e){j.value.length>1?(j.value.splice(e,1),A.value.splice(e,1)):j.value.splice(e,1,{}),g()}(r)},{icon:()=>i(_,{component:s},null)})])))])}}),g(j));export{I as JSON_COMBINATION};
@@ -1 +1 @@
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 l,isString as i,isNumber as s,isEmpty as c,isFunction as d,omit as p}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as v}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 h}from"@formily/vue";import k from"../../../../search-cascader/index.js";import j from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _,createVisitedSetter as w}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as g}from"../../hooks/useFormRequest.js";const F=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 h=u(e,"value",y),_=r(!1),F=r([]),{field:K,fieldKey:O}=b(),q=t((()=>{var r,t,o;return null!=(o=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?o:e.labelField})),S=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),x=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),C=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),L=o(v),{getSearchRequestInfo:V}=g();async function A(r,t){try{if(r&&!r.__keyword&&r.isLeaf)return o(r);if(null==r?void 0:r.__keyword){if(!i(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));s(C.value)&&C.value!==1/0&&t.splice(C.value);const o=await async function(r){if(!V().primaryKeyUrl)return[];try{return await L.addAsync(t(e.wordbook,e.autograph,r,O.value))}catch(e){i(e)&&m(e)}function t(r,t,o,a){const n=V();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>=C.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function o(e,r){return e.find((e=>e[S.value]===r))}}(o,t);return n.length<C.value&&(await A(a),c(a.children))?(h.value=function(e,r){return r.map((r=>e.find((e=>e[S.value]===r))))}(o,t),_.value=!1,Promise.reject()):(F.value=n,a)}{const n=await L.addAsync(function(r,o,a,n,u){const l={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[S.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},s=Object.entries(l).reduce(((e,[t,o])=>(e[t]=i(o)?r[o]:d(o)?o():void 0,e)),{});return{...V(),params:s,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,K.value,r,O.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,C.value)))}else F.value=n.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[q.value]=e[x.value||q.value]||e[q.value]);return e}(e,t)))}}catch(e){i(e)&&m(e)}function o(e){return h.value=function(e){const r=[];let t=e;for(;t;)r.unshift(p(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function a(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}a((()=>e.wordbook),((r,t)=>{l(r,t)||(F.value=[],r&&(h.value||!e.lazyRequest)&&A())}),{immediate:!0});const{injectValueValidate:I,injectValueWatchFromEmpty:P,injectValueBindKey:R}=f();P(h,A),I(h);const U=R(h);return()=>n(k,{value:h.value,"onUpdate:value":e=>h.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:F.value,key:U.value,labelKey:q.value,valueKey:S.value,search:A,onFocus:w(K)},{empty:()=>n(j,null,null)})}}),h({dataSource:"options"},_));export{F 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 l,isString as i,isNumber as s,isEmpty as c,isFunction as d,omit as v}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 h}from"@formily/vue";import k from"../../../../search-cascader/index.js";import j from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as _,createVisitedSetter as w}from"../../utils/schema.js";import{useFormField as b}from"../../hooks/useFormField.js";import{useFormRequest as g}from"../../hooks/useFormRequest.js";const F=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 h=u(e,"value",y),_=r(!1),F=r([]),{field:K,fieldKey:O}=b(),q=t((()=>{var r,t,o;return null!=(o=null==(t=null==(r=e.wordbook)?void 0:r.show_key)?void 0:t[0])?o:e.labelField})),S=t((()=>{var r,t;return null!=(t=null==(r=e.wordbook)?void 0:r.value_key)?t:e.valueField})),x=t((()=>{var r,t;return null==(t=null==(r=e.wordbook)?void 0:r.render_key)?void 0:t[0]})),C=t((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),L=o(p),{getSearchRequestInfo:V}=g(),A=r(150),I=r();async function P(r,t){var o;try{if(r&&!r.__keyword&&r.isLeaf)return a(r);if(null==r?void 0:r.__keyword){if(!i(r.id_link))return Promise.reject();const t=r.id_link.split("_").filter((e=>e));s(C.value)&&C.value!==1/0&&t.splice(C.value);const o=await async function(r){if(!V().primaryKeyUrl)return[];try{return await L.addAsync(t(e.wordbook,e.autograph,r,O.value))}catch(e){i(e)&&m(e)}function t(r,t,o,a){const n=V();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>=C.value}),t.children=[u],t=u,r)}),[]),lastOption:t};function o(e,r){return e.find((e=>e[S.value]===r))}}(o,t);return n.length<C.value&&(await P(a),c(a.children))?(h.value=function(e,r){return r.map((r=>e.find((e=>e[S.value]===r))))}(o,t),_.value=!1,Promise.reject()):(F.value=n,a)}{const u=await L.addAsync(function(r,o,a,n,u){const l={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[S.value]}]:e.conObjFirstLevel||[]}(r,t,n)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>t,page:()=>1},s=Object.entries(l).reduce(((e,[t,o])=>(e[t]=i(o)?r[o]:d(o)?o():void 0,e)),{});return{...V(),params:s,key:u,cache:e.requestCache}}(e.wordbook,e.autograph,K.value,r,O.value));if(r){if(!u.length)return a(r);r.children=u.map((e=>function(e,r,t){return{...e,parent:r,isLeaf:n(r)+1>=t}}(e,r,C.value)))}else F.value=u.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[q.value]=e[x.value||q.value]||e[q.value]);return e}(e,t))),A.value=t&&(null==(o=I.value)?void 0:o.getWidth())||150}}catch(e){i(e)&&m(e)}function a(e){return h.value=function(e){const r=[];let t=e;for(;t;)r.unshift(v(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r}(e),_.value=!1,Promise.reject()}function n(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r}}a((()=>e.wordbook),((r,t)=>{l(r,t)||(F.value=[],r&&(h.value||!e.lazyRequest)&&P())}),{immediate:!0});const{injectValueValidate:R,injectValueWatchFromEmpty:U,injectValueBindKey:B}=f();U(h,P),R(h);const N=B(h);return()=>n(k,{ref:I,value:h.value,"onUpdate:value":e=>h.value=e,show:_.value,"onUpdate:show":e=>_.value=e,options:F.value,key:N.value,labelKey:q.value,valueKey:S.value,search:P,onFocus:w(K),menuWidth:A.value},{empty:()=>n(j,null,null)})}}),h({dataSource:"options"},_));export{F as LEVEL_SEARCH_CASCADER};
@@ -1 +1 @@
1
- import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(d){const{createValidatorSchema:u}=l(),x=e=>{var t;const n={name:e.val_key,type:null!=(t=e.fieldType)?t:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable"};e.reactions&&(n["x-reactions"]=e.reactions),e.noDecorator||Object.assign(n,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:o(e,["reactions"]),span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const r=u(e);return r&&(n["x-validator"]=r),"0"===e.is_null&&(n.required=!0),n},f=e=>{var o;const t=x(e);e.urlConfig?function(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig"])})}(t,e):e.autograph&&m(t,e);const i=!!e.__multiple;return Object.assign(t["x-component-props"],{multiple:i,options:e.option||(null==(o=e.componentProps)?void 0:o.options),allowCreate:"1"===e.free_entry||!!t["x-component-props"].allowCreate,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),i&&(t.type="array"),t},_=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,vertical:e.__vertical}),m(o,e),o},h=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},g=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),b=new Map([["LINEBAR",g],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n}=e;return Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",f],["REMOTE_SEARCH",f],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,getProperties:()=>e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",_],["CHECKBOX",_],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?C(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),y=e=>{if(e.suffixConfig)return v(e);return(b.get(e.html_type)||h)(e)},v=o=>{if(!o.suffixConfig)return y(o);const t=e(o.suffixConfig),n=[{...o,is_show:"1",hide_title:"1",suffixConfig:void 0}].concat(t.map((e=>({...e,hide_title:"1",is_show:"1"})))),r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:C(n)}),r},{FieldNormalizeWaterfallHook:O}=s();function C(o){let n=null;return o.reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(t(o))).validate)?void 0:a.obj_type;return p&&d&&d.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(g(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(y(o),s):(n=null,e[i(o)]=r(y(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:C}}export{d as useFieldListAdaptor};
1
+ import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,pick as n}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as i}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{fieldKeyEscape as a,createLinebarId as p}from"../utils/schema.js";import{useFormValidator as l}from"./useFormValidator.js";import{transformDateFormat as c}from"../utils/business.js";function m(e,o){Object.assign(e["x-component-props"],{...n(o,["wordbook","autograph"])})}function d(d){const{createValidatorSchema:u}=l(),x=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=u(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},f=e=>{var o;const t=x(e);e.urlConfig?function(e,o){Object.assign(e["x-component-props"],{...n(o,["urlConfig"])})}(t,e):e.autograph&&m(t,e);const i=!!e.__multiple;return Object.assign(t["x-component-props"],{multiple:i,options:e.option||(null==(o=e.componentProps)?void 0:o.options),allowCreate:"1"===e.free_entry||!!t["x-component-props"].allowCreate,maxTagCount:r(e.multi_select_value),...n(e,["lazyRequest","requestCache"])}),i&&(t.type="array"),t},_=e=>{const o=x(e);return Object.assign(o["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,vertical:e.__vertical}),m(o,e),o},h=e=>{const t=x(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},g=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{disabled:"1"===e.is_not_fold,id:p(e.val_key),show:"0"!==e.is_show,remark:e.remark}}),b=new Map([["LINEBAR",g],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=x(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=x(e),{decimal_length:t,validate:n}=e;return Object.assign(o["x-component-props"],{precision:null!=t?t:null==n?void 0:n.decimal_length,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",f],["REMOTE_SEARCH",f],["DATE",e=>{const o=x(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:c(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{...n(e,["wordbook","lazyRequest","autograph"])}),o}],["SEARCH_CASCADER",e=>{var o;const t=x(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=x(e);return o.type="array",!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",_],["CHECKBOX",_],["SWITCH",e=>{const o=x(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close}),o}],["SLIDER",e=>{const o=x(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=x(e);Array.isArray(e.properties)&&i("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?C(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],n(e,["wrapperStyle","display"])),o}]]),y=e=>{if(e.suffixConfig)return v(e);return(b.get(e.html_type)||h)(e)},v=o=>{if(!o.suffixConfig)return y(o);const t=e(o.suffixConfig),n=[{...o,is_show:"1",hide_title:"1",suffixConfig:void 0}].concat(t.map((e=>({...e,hide_title:"1",is_show:"1"})))),r=x(o);return Object.assign(r,{type:"void",name:a(n),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:2*(o.elem_width||3)},"x-decorator-props":{...r["x-decorator-props"],showFeedback:!1,suffixFields:n.map((e=>e.val_key))},properties:C(n)}),r},{FieldNormalizeWaterfallHook:O}=s();function C(o){let n=null;return o.reduce(((e,o,s)=>{var a;const p=null==(a=(o=O.call(t(o))).validate)?void 0:a.obj_type;return p&&d&&d.collect(p,t(o)),"LINEBAR"===o.html_type?(e[i(o)]=r(g(o),s),n=e[i(o)].properties={}):n?n[i(o)]=r(y(o),s):(n=null,e[i(o)]=r(y(o),s)),e}),{});function r(e,o){return e["x-index"]=o,e}function i(o){return o.suffixConfig?a([o,...e(o.suffixConfig)]):o.val_key}}return{schemaAdaptor:C}}export{d as useFieldListAdaptor};
@@ -45,6 +45,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
45
45
  beforeSetValue: {
46
46
  type: import("vue").PropType<(value: string | import("../../../es/shared/types").AnyObject[]) => void | (string | import("../../../es/shared/types").AnyObject[]) | Promise<string | import("../../../es/shared/types").AnyObject[]>>;
47
47
  };
48
+ menuWidth: {
49
+ type: (NumberConstructor | StringConstructor)[];
50
+ default: number;
51
+ };
48
52
  }, {
49
53
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
50
54
  value: {
@@ -92,6 +96,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
92
96
  beforeSetValue: {
93
97
  type: import("vue").PropType<(value: string | import("../../../es/shared/types").AnyObject[]) => void | (string | import("../../../es/shared/types").AnyObject[]) | Promise<string | import("../../../es/shared/types").AnyObject[]>>;
94
98
  };
99
+ menuWidth: {
100
+ type: (NumberConstructor | StringConstructor)[];
101
+ default: number;
102
+ };
95
103
  }>> & {
96
104
  onFocus?: ((...args: any[]) => any) | undefined;
97
105
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
@@ -102,9 +110,9 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
102
110
  onClear: () => void;
103
111
  onClick: (evt: Event) => void;
104
112
  onKeydown: (evt: KeyboardEvent) => void;
105
- cssVariable: {
106
- '--menu-width': number;
107
- };
113
+ cssVariable: import("vue").ComputedRef<{
114
+ '--menu-width': string | number;
115
+ }>;
108
116
  eventBus: import("../../../es/shared/types").AnyObject;
109
117
  uuid: string;
110
118
  show: import("vue").Ref<boolean> | import("vue").WritableComputedRef<boolean>;
@@ -226,6 +234,10 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
226
234
  beforeSetValue: {
227
235
  type: import("vue").PropType<(value: string | import("../../../es/shared/types").AnyObject[]) => void | (string | import("../../../es/shared/types").AnyObject[]) | Promise<string | import("../../../es/shared/types").AnyObject[]>>;
228
236
  };
237
+ menuWidth: {
238
+ type: (NumberConstructor | StringConstructor)[];
239
+ default: number;
240
+ };
229
241
  }>> & {
230
242
  onFocus?: ((...args: any[]) => any) | undefined;
231
243
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
@@ -240,5 +252,6 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
240
252
  editPlaceholder: string;
241
253
  labelKey: string;
242
254
  checkAbleLevel: number | "last";
255
+ menuWidth: string | number;
243
256
  }>>;
244
257
  export default SearchCascader;
@@ -47,6 +47,10 @@ declare const _default: import("vue").DefineComponent<{
47
47
  beforeSetValue: {
48
48
  type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
49
49
  };
50
+ menuWidth: {
51
+ type: (NumberConstructor | StringConstructor)[];
52
+ default: number;
53
+ };
50
54
  }, {
51
55
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
52
56
  value: {
@@ -94,6 +98,10 @@ declare const _default: import("vue").DefineComponent<{
94
98
  beforeSetValue: {
95
99
  type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
96
100
  };
101
+ menuWidth: {
102
+ type: (NumberConstructor | StringConstructor)[];
103
+ default: number;
104
+ };
97
105
  }>> & {
98
106
  onFocus?: ((...args: any[]) => any) | undefined;
99
107
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
@@ -104,9 +112,9 @@ declare const _default: import("vue").DefineComponent<{
104
112
  onClear: () => void;
105
113
  onClick: (evt: Event) => void;
106
114
  onKeydown: (evt: KeyboardEvent) => void;
107
- cssVariable: {
108
- '--menu-width': number;
109
- };
115
+ cssVariable: import("vue").ComputedRef<{
116
+ '--menu-width': string | number;
117
+ }>;
110
118
  eventBus: AnyObject;
111
119
  uuid: string;
112
120
  show: import("vue").Ref<boolean> | import("vue").WritableComputedRef<boolean>;
@@ -228,6 +236,10 @@ declare const _default: import("vue").DefineComponent<{
228
236
  beforeSetValue: {
229
237
  type: PropType<(value: ValueType) => void | ValueType | Promise<ValueType>>;
230
238
  };
239
+ menuWidth: {
240
+ type: (NumberConstructor | StringConstructor)[];
241
+ default: number;
242
+ };
231
243
  }>> & {
232
244
  onFocus?: ((...args: any[]) => any) | undefined;
233
245
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
@@ -242,5 +254,6 @@ declare const _default: import("vue").DefineComponent<{
242
254
  editPlaceholder: string;
243
255
  labelKey: string;
244
256
  checkAbleLevel: number | "last";
257
+ menuWidth: string | number;
245
258
  }>;
246
259
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,provide as a,computed as l,ref as t,nextTick as o,watch as r,openBlock as u,createBlock as n,unref as s,isRef as c,normalizeStyle as i,withCtx as d,createVNode as v,createElementVNode as p,renderSlot as f}from"vue";import{uuidGenerator as y}from"../../../shared/utils/index.js";import{NOOP as h}from"@vue/shared";import{useDebounceFn as m,useEventBus as g,useVModel as b,onClickOutside as w}from"@vueuse/core";import{isString as k,isArray as S,isFunction as K,isObject as C}from"lodash-es";import{NPopover as _,NInput as N}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as P,InjectionKeyboardEventBus as j,InjectionSearchCascaderLoadingNode as A,InjectionSearchCascaderValue as U}from"./constants/index.js";import{useCssVariable as V}from"./hooks/useCssVariable.js";import{SearchMenu as x}from"./components/SearchMenu.js";const F=["id"];var L=e({__name:"SearchCascader",props:{value:{type:[String,Array]},show:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},childKey:{type:String,default:"children"},placeholder:{type:String,default:"请选择"},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},options:{type:Array,default:()=>[]},search:{type:Function},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},checkAbleLevel:{type:[Number,String],default:"last"},beforeSetValue:{type:Function}},emits:["update:value","focus","update:show"],setup(e,{emit:L}){const B=e;function E(){var e;e=[],Promise.resolve(K(B.beforeSetValue)?B.beforeSetValue(e):e).then((e=>L("update:value",e)),h)}function I(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&H()}const R=m((e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||q.value?M.emit(e.key):H()}),50),T=V(),M=g("cascaderKeydown"),$=y(),q=b(B,"show",L);a(P,l((()=>B.checkAbleLevel))),a(j,M);const z=t(""),D=l({get:()=>q.value?z.value:k(B.value)?B.value:S(B.value)?B.value.reduce(((e,a,l)=>0===l?a[B.labelKey]:e+" / "+a[B.labelKey]),""):"",set(e){z.value=e,Z(void 0,e)}});function G(e){L("focus",e)}function H(){q.value||(q.value=!0,z.value="",Z())}async function J(){var e;q.value=!1,null==(e=O.value)||e.blur()}const O=t();w(O,(e=>{var a;if(!q.value)return;const l=e;if(!l.target)return J();!function(e){let a=!1,l=e;for(;l;){if(l.id===$){a=!0;break}l=l.parentElement}return a}(l.target)?J():null==(a=O.value)||a.focus()}));const Q=t(),W=t(),X=t(),Y=t(null);a(A,Y),a(U,l((()=>B.value)));const Z=m((async(e,a)=>{var l;const{type:t,node:r}=e||{};try{if("update"===t)return void(K(B.search)&&B.search({...r,isLeaf:!0}));Y.value=r;const e=await(K(B.search)&&B.search(r,a));W.value=C(e)?e:r}finally{Y.value=null,await o(),null==(l=Q.value)||l.syncPosition()}}),400),ee=e=>{X.value=e};return r((()=>B.show),(e=>{e&&(X.value={})})),(a,l)=>(u(),n(s(_),{class:"search-cascader",trigger:"manual",show:s(q),"onUpdate:show":l[1]||(l[1]=e=>c(q)?q.value=e:null),"show-arrow":!1,placement:"bottom-start",style:i(s(T)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:Q},{trigger:d((()=>[v(s(N),{class:"search-cascader__input",placeholder:s(q)?e.editPlaceholder:e.placeholder,clearable:e.clearable,onClear:E,value:s(D),"onUpdate:value":l[0]||(l[0]=e=>c(D)?D.value=e:null),ref_key:"inputRef",ref:O,onFocus:G,onClick:I,onKeydown:s(R)},null,8,["placeholder","clearable","value","onKeydown"])])),default:d((()=>[p("section",{id:s($)},[v(s(x),{"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:s(Z),onChangeCursor:ee,"current-node":W.value,"cursor-node":X.value},{empty:d((()=>[f(a.$slots,"empty")])),_:3},8,["label-key","value-key","options","onNodeClick","current-node","cursor-node"])],8,F)])),_:3},8,["show","style","width"]))}});export{L as default};
1
+ import{defineComponent as e,computed as a,provide as t,ref as l,nextTick as r,watch as o,openBlock as u,createBlock as n,unref as i,isRef as s,normalizeStyle as c,withCtx as d,createVNode as v,createElementVNode as p,renderSlot as f}from"vue";import{uuidGenerator as y}from"../../../shared/utils/index.js";import{NOOP as h}from"@vue/shared";import{useDebounceFn as m,useEventBus as g,useVModel as b,onClickOutside as w}from"@vueuse/core";import{isString as k,isArray as S,isFunction as K,isObject as N}from"lodash-es";import{NPopover as _,NInput as C}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as P,InjectionKeyboardEventBus as x,InjectionSearchCascaderLoadingNode as A,InjectionSearchCascaderValue as U}from"./constants/index.js";import{SearchMenu as W}from"./components/SearchMenu.js";const j=["id"];var F=e({__name:"SearchCascader",props:{value:{type:[String,Array]},show:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},childKey:{type:String,default:"children"},placeholder:{type:String,default:"请选择"},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},options:{type:Array,default:()=>[]},search:{type:Function},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},checkAbleLevel:{type:[Number,String],default:"last"},beforeSetValue:{type:Function},menuWidth:{type:[Number,String],default:150}},emits:["update:value","focus","update:show"],setup(e,{expose:F,emit:L}){const V=e;function B(){var e;e=[],Promise.resolve(K(V.beforeSetValue)?V.beforeSetValue(e):e).then((e=>L("update:value",e)),h)}function E(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&G()}const I=m((e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||M.value?T.emit(e.key):G()}),50),R=a((()=>({"--menu-width":V.menuWidth}))),T=g("cascaderKeydown"),$=y(),M=b(V,"show",L);t(P,a((()=>V.checkAbleLevel))),t(x,T);const q=l(""),z=a({get:()=>M.value?q.value:k(V.value)?V.value:S(V.value)?V.value.reduce(((e,a,t)=>0===t?a[V.labelKey]:e+" / "+a[V.labelKey]),""):"",set(e){q.value=e,Z(void 0,e)}});function D(e){L("focus",e)}function G(){M.value||(M.value=!0,q.value="",Z())}async function H(){var e;M.value=!1,null==(e=J.value)||e.blur()}const J=l();w(J,(e=>{var a;if(!M.value)return;const t=e;if(!t.target)return H();!function(e){let a=!1,t=e;for(;t;){if(t.id===$){a=!0;break}t=t.parentElement}return a}(t.target)?H():null==(a=J.value)||a.focus()}));const O=l(),Q=l(),X=l(),Y=l(null);t(A,Y),t(U,a((()=>V.value)));const Z=m((async(e,a)=>{var t;const{type:l,node:o}=e||{};try{if("update"===l)return void(K(V.search)&&V.search({...o,isLeaf:!0}));Y.value=o;const e=await(K(V.search)&&V.search(o,a));Q.value=N(e)?e:o}finally{Y.value=null,await r(),null==(t=O.value)||t.syncPosition()}}),400),ee=e=>{X.value=e};return o((()=>V.show),(e=>{e&&(X.value={})})),F({getWidth(){var e;if(!J.value)return 0;const a=null==(e=J.value)?void 0:e.$el;return a?a.clientWidth:void 0}}),(a,t)=>(u(),n(i(_),{class:"search-cascader",trigger:"manual",show:i(M),"onUpdate:show":t[1]||(t[1]=e=>s(M)?M.value=e:null),"show-arrow":!1,placement:"bottom-start",style:c(i(R)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:O},{trigger:d((()=>[v(i(C),{class:"search-cascader__input",placeholder:i(M)?e.editPlaceholder:e.placeholder,clearable:e.clearable,onClear:B,value:i(z),"onUpdate:value":t[0]||(t[0]=e=>s(z)?z.value=e:null),ref_key:"inputRef",ref:J,onFocus:D,onClick:E,onKeydown:i(I)},null,8,["placeholder","clearable","value","onKeydown"])])),default:d((()=>[p("section",{id:i($)},[v(i(W),{"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:i(Z),onChangeCursor:ee,"current-node":Q.value,"cursor-node":X.value},{empty:d((()=>[f(a.$slots,"empty")])),_:3},8,["label-key","value-key","options","onNodeClick","current-node","cursor-node"])],8,j)])),_:3},8,["show","style","width"]))}});export{F as default};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.1.45-beta.1",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.45-beta.1",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.1.45-beta.3",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.45-beta.3",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.45-beta.1",
3
+ "version": "3.1.45-beta.3",
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": "84b47ac7c176676f33c40c5e616b7044f7b84290"
64
+ "gitHead": "2a534707abc34b623eac27d3caffc959daf86c21"
65
65
  }
@@ -1 +0,0 @@
1
- export * from './useCssVariable';
@@ -1 +0,0 @@
1
- export{useCssVariable}from"./useCssVariable.js";
@@ -1,3 +0,0 @@
1
- export declare function useCssVariable(): {
2
- '--menu-width': number;
3
- };
@@ -1 +0,0 @@
1
- function n(){return{"--menu-width":150}}export{n as useCssVariable};