cnhis-design-vue 3.1.50-beta.12 → 3.1.50-beta.14

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.
@@ -1 +1 @@
1
- import{unref as e}from"vue";import{promiseTimeout as n}from"@vueuse/shared";import"../../../index.js";import{useSessionStorage as t}from"@vueuse/core";import{isString as o,trim as i,isEmpty as l,isEqual as r,isFunction as u}from"lodash-es";import{selectOptionsMap as d}from"../rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{IhoTableUtils as a}from"../../utils/index.js";import{EDITABLE_WIDGET_TYPE as s}from"../../constants/index.js";import{parse as c,isValid as p,compareDesc as f}from"date-fns";import{defineTablePlugin as m}from"../../hooks/useTablePlugin.js";function v(){const v="keyboardEventPlugin",g=t("ihoTableClipData","");return m({name:v,apply(t){function m(n,t,m,v,w){var b,y;if(!(null==(b=null==m?void 0:m.keyboardConfig)?void 0:b.isClip))return;const{row:C,column:R}=t.getSelectedCell()||t.getEditRecord()||{};if(!C||!R||!E(R,s.SELECT)&&e(g)===C[R.field])return;const x=m.uuid&&E(R,s.SELECT)&&d.get(m.uuid)[R.field],T=C[R.field];if("copy"===n){const e=(null==(y=(x||[]).filter((e=>T.includes(e.value))))?void 0:y.map((e=>e.label)).join(","))||T;g.value=e}else{if(o(e(g))&&(g.value=i(e(g)||"")),!e(g)||!function(e){var n;const t=null==(n=e.editRender)?void 0:n.props;return t&&Object.keys(s).includes(a.getCellType(t))}(R)||C.$__SEPARATE||!function(e,n,t,o){var i,l;const{beforeEditMethod:r}=n.editConfig||{},d={rowIndex:null!=(i=e.getRowIndex(t))?i:0,columnIndex:null!=(l=e.getColumnIndex(o))?l:0};return!r||u(r)&&r({row:t,column:o,...d,$table:e,$grid:void 0})}(t,m,C,R))return;if(E(R,s.DATE)&&function(n,t){var i;const l=null==(i=n.editRender)?void 0:i.props,r=e(g)||"";return!p(new Date(r))||o(l.connectField)&&t[l.connectField]&&(l.isStartDate&&f(new Date(r),new Date(t[l.connectField]))<0||l.isEndDate&&f(new Date(r),new Date(t[l.connectField]))>0)}(R,C))return;if(E(R,s.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(g)||"").toString()))return;if(E(R,s.TIME)&&function(n){var t,o;const i=e(g)||"",l=null==(t=n.editRender)?void 0:t.props,r=c(i,(null==(o=null==l?void 0:l.componentProps)?void 0:o.valueFormat)||"HH:mm",new Date);return!p(r)}(R))return;let n=e(g)||"";if(x&&!l(x)){const e=x.filter((e=>n.split(",").includes(e.label))).map((e=>e.value));if(l(e))return;if(function(e){var n,t;const o=null==(n=e.editRender)?void 0:n.props;return E(e,s.SELECT)&&(null==(t=o.componentProps)?void 0:t.multiple)}(R)){if(r(T,e))return;n=e}else{if(e.includes(T))return;n=e[0]}}C[R.field]=n,v("formChange",{column:R,row:C,oldValue:T,value:n,index:t.getRowIndex(C)}),E(R,s.SEPARATE)&&(null==w||w())}}function E(e,n){var t;const o=null==(t=e.editRender)?void 0:t.props;return o&&a.getCellType(o)===n}t.eventHooks.onCopy.tap(v,(({$table:e},n,{emits:t})=>m("copy",e,n,t))),t.eventHooks.onPaste.tap(v,(({$table:e},n,{emits:t,updateTableDataRef:o})=>m("paste",e,n,t,o))),t.eventHooks.onKeydown.tap(v,(async({$event:e,$table:t},o,{emits:i})=>{await n(0);const{row:l,column:r}=t.getSelectedCell()||t.getEditRecord()||{};if(!l||!r)return;i("keyboard",{$table:t,key:e.key,index:t.getRowIndex(l),value:l[r.field],row:l,column:r})}))}})}export{v as keyboardEventPlugin};
1
+ import{unref as e}from"vue";import{promiseTimeout as t}from"@vueuse/shared";import"../../../index.js";import{useSessionStorage as n}from"@vueuse/core";import{isString as o,trim as l,isEmpty as i,isEqual as r,isFunction as u}from"lodash-es";import{selectOptionsMap as d}from"../rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{IhoTableUtils as a}from"../../utils/index.js";import{EDITABLE_WIDGET_TYPE as s}from"../../constants/index.js";import{parse as c,isValid as p,compareDesc as f}from"date-fns";import{defineTablePlugin as m}from"../../hooks/useTablePlugin.js";function v(){const v="keyboardEventPlugin",g=n("ihoTableClipData","");return m({name:v,apply(n){function m(t,n,m,v,w){var b,C;if(!(null==(b=null==m?void 0:m.keyboardConfig)?void 0:b.isClip))return;if("paste"===t&&!n.getSelectedCell())return;const{row:y,column:R}=n.getSelectedCell()||n.getEditRecord()||{};if(!y||!R||!E(R,s.SELECT)&&e(g)===y[R.field])return;const x=m.uuid&&E(R,s.SELECT)&&d.get(m.uuid)[R.field],T=y[R.field];if("copy"===t){const e=(null==(C=(x||[]).filter((e=>T.includes(e.value))))?void 0:C.map((e=>e.label)).join(","))||T;g.value=e}else{if(o(e(g))&&(g.value=l(e(g)||"")),!e(g)||!function(e){var t;const n=null==(t=e.editRender)?void 0:t.props;return n&&Object.keys(s).includes(a.getCellType(n))}(R)||y.$__SEPARATE||!function(e,t,n,o){var l,i;const{beforeEditMethod:r}=t.editConfig||{},d={rowIndex:null!=(l=e.getRowIndex(n))?l:0,columnIndex:null!=(i=e.getColumnIndex(o))?i:0};return!r||u(r)&&r({row:n,column:o,...d,$table:e,$grid:void 0})}(n,m,y,R))return;if(E(R,s.DATE)&&function(t,n){var l;const i=null==(l=t.editRender)?void 0:l.props,r=e(g)||"";return!p(new Date(r))||o(i.connectField)&&n[i.connectField]&&(i.isStartDate&&f(new Date(r),new Date(n[i.connectField]))<0||i.isEndDate&&f(new Date(r),new Date(n[i.connectField]))>0)}(R,y))return;if(E(R,s.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(g)||"").toString()))return;if(E(R,s.TIME)&&function(t){var n,o;const l=e(g)||"",i=null==(n=t.editRender)?void 0:n.props,r=c(l,(null==(o=null==i?void 0:i.componentProps)?void 0:o.valueFormat)||"HH:mm",new Date);return!p(r)}(R))return;let t=e(g)||"";if(x&&!i(x)){const e=x.filter((e=>t.split(",").includes(e.label))).map((e=>e.value));if(i(e))return;if(function(e){var t,n;const o=null==(t=e.editRender)?void 0:t.props;return E(e,s.SELECT)&&(null==(n=o.componentProps)?void 0:n.multiple)}(R)){if(r(T,e))return;t=e}else{if(e.includes(T))return;t=e[0]}}y[R.field]=t,v("formChange",{column:R,row:y,oldValue:T,value:t,index:n.getRowIndex(y)}),E(R,s.SEPARATE)&&(null==w||w())}}function E(e,t){var n;const o=null==(n=e.editRender)?void 0:n.props;return o&&a.getCellType(o)===t}n.eventHooks.onCopy.tap(v,(({$table:e},t,{emits:n})=>m("copy",e,t,n))),n.eventHooks.onPaste.tap(v,(({$table:e},t,{emits:n,updateTableDataRef:o})=>m("paste",e,t,n,o))),n.eventHooks.onKeydown.tap(v,(async({$event:e,$table:n},o,{emits:l})=>{await t(0);const{row:i,column:r}=n.getSelectedCell()||n.getEditRecord()||{};if(!i||!r)return;l("keyboard",{$table:n,key:e.key,index:n.getRowIndex(i),value:i[r.field],row:i,column:r})}))}})}export{v as keyboardEventPlugin};
@@ -49,6 +49,7 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
49
49
  type: (NumberConstructor | StringConstructor)[];
50
50
  default: number;
51
51
  };
52
+ disabled: BooleanConstructor;
52
53
  }, {
53
54
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
54
55
  value: {
@@ -100,6 +101,7 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
100
101
  type: (NumberConstructor | StringConstructor)[];
101
102
  default: number;
102
103
  };
104
+ disabled: BooleanConstructor;
103
105
  }>> & {
104
106
  onFocus?: ((...args: any[]) => any) | undefined;
105
107
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
@@ -240,11 +242,13 @@ declare const SearchCascader: SFCWithInstall<import("vue").DefineComponent<{
240
242
  type: (NumberConstructor | StringConstructor)[];
241
243
  default: number;
242
244
  };
245
+ disabled: BooleanConstructor;
243
246
  }>> & {
244
247
  onFocus?: ((...args: any[]) => any) | undefined;
245
248
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
246
249
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
247
250
  }, {
251
+ disabled: boolean;
248
252
  show: boolean;
249
253
  options: import("../../../es/shared/types").AnyObject[];
250
254
  placeholder: string;
@@ -51,6 +51,7 @@ declare const _default: import("vue").DefineComponent<{
51
51
  type: (NumberConstructor | StringConstructor)[];
52
52
  default: number;
53
53
  };
54
+ disabled: BooleanConstructor;
54
55
  }, {
55
56
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
56
57
  value: {
@@ -102,6 +103,7 @@ declare const _default: import("vue").DefineComponent<{
102
103
  type: (NumberConstructor | StringConstructor)[];
103
104
  default: number;
104
105
  };
106
+ disabled: BooleanConstructor;
105
107
  }>> & {
106
108
  onFocus?: ((...args: any[]) => any) | undefined;
107
109
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
@@ -242,11 +244,13 @@ declare const _default: import("vue").DefineComponent<{
242
244
  type: (NumberConstructor | StringConstructor)[];
243
245
  default: number;
244
246
  };
247
+ disabled: BooleanConstructor;
245
248
  }>> & {
246
249
  onFocus?: ((...args: any[]) => any) | undefined;
247
250
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
248
251
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
249
252
  }, {
253
+ disabled: boolean;
250
254
  show: boolean;
251
255
  options: AnyObject[];
252
256
  placeholder: string;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as a,provide as l,ref as t,nextTick as r,watch as o,openBlock as u,createBlock as n,unref as s,isRef as i,normalizeStyle as c,withCtx as v,createVNode as d,createElementVNode as p,renderSlot as f}from"vue";import{useTheme as h}from"../../../shared/hooks/useTheme.js";import{useEventBus as y,useVModel as m,onClickOutside as g,useDebounceFn as b}from"@vueuse/core";import"date-fns";import{isString as w,isArray as k,isObject as S,isFunction as K}from"lodash-es";import{uuidGenerator as C}from"../../../shared/utils/index.js";import{NOOP as N}from"@vue/shared";import{NPopover as _,NInput as P}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as j,InjectionKeyboardEventBus as x,InjectionSearchCascaderLoadingNode as A,InjectionSearchCascaderValue as U}from"./constants/index.js";import{SearchMenu as W}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},menuWidth:{type:[Number,String],default:150}},emits:["update:value","focus","update:show"],setup(e,{expose:L,emit:T}){const V=e,B=h();function E(){var e;e=[],Promise.resolve(K(V.beforeSetValue)?V.beforeSetValue(e):e).then((e=>T("update:value",e)),N)}function I(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&O()}const R=e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||z.value?M.emit(e.key,e):O()},$=a((()=>({"--menu-width":V.menuWidth}))),M=y("cascaderKeydown"),q=C(),z=m(V,"show",T);l(j,a((()=>V.checkAbleLevel))),l(x,M);const D=t(""),G=a((()=>w(V.value)&&V.value?V.value:k(V.value)&&V.value.length?V.value.map((e=>S(e)?e[V.labelKey]:e)).join(" / "):V.editPlaceholder)),H=a({get:()=>z.value?D.value:w(V.value)?V.value:k(V.value)?V.value.reduce(((e,a,l)=>0===l?a[V.labelKey]:e+" / "+a[V.labelKey]),""):"",set(e){D.value=e,le(void 0,e)}});function J(e){T("focus",e)}function O(){z.value||(z.value=!0,D.value="",le())}async function Q(){var e;z.value=!1,null==(e=X.value)||e.blur()}const X=t();g(X,(e=>{var a;if(!z.value)return;const l=e;if(!l.target)return Q();!function(e){let a=!1,l=e;for(;l;){if(l.id===q){a=!0;break}l=l.parentElement}return a}(l.target)?Q():null==(a=X.value)||a.focus()}));const Y=t(),Z=t(),ee=t(),ae=t(null);l(A,ae),l(U,a((()=>V.value)));const le=b((async(e,a)=>{var l;const{type:t,node:o}=e||{};try{if("update"===t)return void(K(V.search)&&V.search({...o,isLeaf:!0}));ae.value=o;const e=await(K(V.search)&&V.search(o,a));Z.value=S(e)||k(e)?e:o}finally{ae.value=null,await r(),null==(l=Y.value)||l.syncPosition()}}),400),te=e=>{ee.value=e};return o((()=>V.show),(e=>{e&&(ee.value={})})),L({getWidth(){var e;if(!X.value)return 0;const a=null==(e=X.value)?void 0:e.$el;return a?a.clientWidth:void 0},setCursor(e){ee.value=e}}),(a,l)=>(u(),n(s(_),{class:"search-cascader",trigger:"manual",show:s(z),"onUpdate:show":l[1]||(l[1]=e=>i(z)?z.value=e:null),"show-arrow":!1,placement:"bottom-start",style:c(s($)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:Y},{trigger:v((()=>[d(s(P),{class:"search-cascader__input",placeholder:s(z)?s(G):e.placeholder,clearable:e.clearable,onClear:E,value:s(H),"onUpdate:value":l[0]||(l[0]=e=>i(H)?H.value=e:null),ref_key:"inputRef",ref:X,onFocus:J,onClick:I,onKeydown:R},null,8,["placeholder","clearable","value"])])),default:v((()=>[p("section",{id:s(q)},[d(s(W),{style:c(s(B)),"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:s(le),onChangeCursor:te,"current-node":Z.value,"cursor-node":ee.value},{empty:v((()=>[f(a.$slots,"empty")])),_:3},8,["style","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 l,ref as t,nextTick as o,watch as r,openBlock as u,createBlock as n,unref as s,isRef as i,normalizeStyle as d,withCtx as c,createVNode as v,normalizeClass as p,createElementVNode as f,renderSlot as h}from"vue";import{useTheme as y}from"../../../shared/hooks/useTheme.js";import{useEventBus as m,useVModel as b,onClickOutside as g,useDebounceFn as w}from"@vueuse/core";import"date-fns";import{isString as k,isArray as S,isObject as K,isFunction as C}from"lodash-es";import{uuidGenerator as N}from"../../../shared/utils/index.js";import{NOOP as _}from"@vue/shared";import{NPopover as P,NInput as j}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as x,InjectionKeyboardEventBus as A,InjectionSearchCascaderLoadingNode as U,InjectionSearchCascaderValue as W}from"./constants/index.js";import{SearchMenu as B}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},menuWidth:{type:[Number,String],default:150},disabled:Boolean},emits:["update:value","focus","update:show"],setup(e,{expose:L,emit:T}){const V=e,E=y();function I(){var e;e=[],Promise.resolve(C(V.beforeSetValue)?V.beforeSetValue(e):e).then((e=>T("update:value",e)),_)}function R(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&Q()}const $=e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||D.value?q.emit(e.key,e):Q()},M=a((()=>({"--menu-width":V.menuWidth}))),q=m("cascaderKeydown"),z=N(),D=b(V,"show",T);l(x,a((()=>V.checkAbleLevel))),l(A,q);const G=t(""),H=a((()=>k(V.value)&&V.value?V.value:S(V.value)&&V.value.length?V.value.map((e=>K(e)?e[V.labelKey]:e)).join(" / "):V.editPlaceholder)),J=a({get:()=>D.value?G.value:k(V.value)?V.value:S(V.value)?V.value.reduce(((e,a,l)=>0===l?a[V.labelKey]:e+" / "+a[V.labelKey]),""):"",set(e){G.value=e,te(void 0,e)}});function O(e){T("focus",e)}function Q(){D.value||V.disabled||(D.value=!0,G.value="",te())}async function X(){var e;D.value=!1,null==(e=Y.value)||e.blur()}const Y=t();g(Y,(e=>{var a;if(!D.value)return;const l=e;if(!l.target)return X();!function(e){let a=!1,l=e;for(;l;){if(l.id===z){a=!0;break}l=l.parentElement}return a}(l.target)?X():null==(a=Y.value)||a.focus()}));const Z=t(),ee=t(),ae=t(),le=t(null);l(U,le),l(W,a((()=>V.value)));const te=w((async(e,a)=>{var l;const{type:t,node:r}=e||{};try{if("update"===t)return void(C(V.search)&&V.search({...r,isLeaf:!0}));le.value=r;const e=await(C(V.search)&&V.search(r,a));ee.value=K(e)||S(e)?e:r}finally{le.value=null,await o(),null==(l=Z.value)||l.syncPosition()}}),400),oe=e=>{ae.value=e};return r((()=>V.show),(e=>{e&&(ae.value={})})),L({getWidth(){var e;if(!Y.value)return 0;const a=null==(e=Y.value)?void 0:e.$el;return a?a.clientWidth:void 0},setCursor(e){ae.value=e}}),(a,l)=>(u(),n(s(P),{class:"search-cascader",trigger:"manual",show:s(D),"onUpdate:show":l[1]||(l[1]=e=>i(D)?D.value=e:null),"show-arrow":!1,placement:"bottom-start",style:d(s(M)),disabled:e.disabled,width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:Z},{trigger:c((()=>[v(s(j),{disabled:e.disabled,class:p({"search-cascader__input":!e.disabled}),placeholder:s(D)?s(H):e.placeholder,clearable:e.clearable,onClear:I,value:s(J),"onUpdate:value":l[0]||(l[0]=e=>i(J)?J.value=e:null),ref_key:"inputRef",ref:Y,onFocus:O,onClick:R,onKeydown:$},null,8,["disabled","class","placeholder","clearable","value"])])),default:c((()=>[f("section",{id:s(z)},[v(s(B),{style:d(s(E)),"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:s(te),onChangeCursor:oe,"current-node":ee.value,"cursor-node":ae.value},{empty:c((()=>[h(a.$slots,"empty")])),_:3},8,["style","label-key","value-key","options","onNodeClick","current-node","cursor-node"])],8,F)])),_:3},8,["show","style","disabled","width"]))}});export{L as default};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.1.50-beta.12",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.50-beta.12",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.50-beta.14",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.50-beta.14",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.50-beta.12",
3
+ "version": "3.1.50-beta.14",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -63,5 +63,5 @@
63
63
  "iOS 7",
64
64
  "last 3 iOS versions"
65
65
  ],
66
- "gitHead": "a8f7d7cdca3113620c2a7b0dbaf062673dfc51cc"
66
+ "gitHead": "d1237dbb4545921b286d41dfc9aa8e7b5554d8bf"
67
67
  }