cnhis-design-vue 3.1.57-beta.8 → 3.1.57-beta.9

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.
@@ -59,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
59
59
  } | {
60
60
  style?: undefined;
61
61
  }>;
62
- __formattedValue: import("vue").WritableComputedRef<any>;
62
+ __formattedValue: import("vue").WritableComputedRef<string | null>;
63
63
  placeholder: any;
64
64
  valueFormat: any;
65
65
  timeConfig: AnyObject;
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as l,inject as t,ref as a,computed as r,reactive as u,watch as o,nextTick as i,openBlock as n,createBlock as d,unref as c,withCtx as v,createVNode as m,mergeProps as s,isRef as f,createElementBlock as p,Fragment as h,renderList as y,createTextVNode as k,toDisplayString as b,createCommentVNode as w}from"vue";import{NPopover as _,NInput as g,NSpace as V,NScrollbar as C,NButton as F}from"naive-ui";import{useIhoTableFormEvent as x}from"../../../../utils/index.js";import D from"../../../../../../time-picker/index.js";import{parse as q,isValid as O,getHours as j,getMinutes as S,getSeconds as $,format as A}from"date-fns";var H=e({__name:"editTime",props:{formattedValue:{type:String},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},shortcutOptions:{type:Array,default:()=>[]}},emits:["update:formattedValue","click"],setup(e,{emit:H}){const I=e,P=l(),R=t("$xetable"),{emitFormChangeWithParams:E}=x({...I,$table:R}),M=a(null),U=a(!1),z=a(),K=a(),N=r((()=>K.value&&L(K.value)?{style:"text-decoration: line-through"}:{})),T=r({get(){if(!K.value)return null;const e=q(K.value,G.valueFormat,new Date);return O(e)?K.value:I.formattedValue?I.formattedValue:null},set(e){J(e)}}),{placeholder:W="请选择",valueFormat:B="HH:mm"}=P,G=u({...P,placeholder:W,valueFormat:B,format:B});function J(e){if(K.value=e||"",e&&L(e))return;const l=I.formattedValue;l!==e&&(H("update:formattedValue",e),E({oldValue:l}))}function L(e){var l,t,a;const r=q(e,G.format,new Date),u=j(r),o=S(r),i=$(r),n=null==(l=G.isHourDisabled)?void 0:l.call(G,u),d=null==(t=G.isMinuteDisabled)?void 0:t.call(G,o,u),c=null==(a=G.isSecondDisabled)?void 0:a.call(G,i,o,u);return n||d||c}function Q(){[G.valueFormat.replace(/[^\w]/g,""),G.valueFormat].some((e=>{const l=q(K.value,e,new Date);if(!K.value||O(l)){return J(K.value?A(l,G.valueFormat):null),!0}return!1}))}function X(e){var l;const{key:t}=e;"Enter"===t&&(null==(l=M.value)||l.blur(),U.value=!1)}return o((()=>I.formattedValue),(e=>{if(!e)return"";K.value=e}),{immediate:!0}),o((()=>U.value),(async e=>{var l,t,a,r,u;e&&(await i(),null==(u=null==(r=null==(a=null==(t=null==(l=z.value)?void 0:l.$timePicker)?void 0:t.panelInstRef)?void 0:a.$el)?void 0:r.querySelectorAll(".n-time-picker-col"))||u.forEach((e=>{var l,t;return null==(t=null==(l=null==e?void 0:e.querySelector)?void 0:l.call(e,".n-time-picker-col__item--active"))?void 0:t.scrollIntoView()})))})),(l,t)=>(n(),d(c(_),{show:U.value,trigger:"click",showArrow:!1,placement:"bottom-start",style:{padding:"0"},onClickoutside:t[4]||(t[4]=()=>U.value=!1)},{trigger:v((()=>[m(c(g),{ref_key:"formRef",ref:M,clearable:"",placeholder:c(W),value:K.value,"onUpdate:value":t[0]||(t[0]=e=>K.value=e),valueModifiers:{trim:!0},"input-props":c(N),onClick:t[1]||(t[1]=()=>U.value=!0),onChange:Q,onKeydown:X},null,8,["placeholder","value","input-props"])])),default:v((()=>[m(c(V),null,{default:v((()=>[m(c(D),s({ref_key:"timePickerRef",ref:z,show:""},c(G),{class:"iho-table__time-picker",to:!1,"formatted-value":c(T),"onUpdate:formatted-value":t[2]||(t[2]=e=>f(T)?T.value=e:null),onConfirm:t[3]||(t[3]=()=>U.value=!1)}),null,16,["formatted-value"]),m(c(C),{class:"iho-table__scrollbar"},{default:v((()=>[e.shortcutOptions.length?(n(),d(c(V),{key:0,vertical:"",wrap:!1},{default:v((()=>[(n(!0),p(h,null,y(e.shortcutOptions,(e=>(n(),d(c(F),{size:"tiny",key:e,disabled:L(e),onClick:l=>function(e){J(e),U.value=!1}(e)},{default:v((()=>[k(b(e),1)])),_:2},1032,["disabled","onClick"])))),128))])),_:1})):w("v-if",!0)])),_:1})])),_:1})])),_:1},8,["show"]))}});export{H as default};
1
+ import{defineComponent as e,useAttrs as l,inject as t,ref as a,computed as r,reactive as u,watch as o,nextTick as i,openBlock as n,createBlock as d,unref as c,withCtx as v,createVNode as m,mergeProps as s,isRef as f,createElementBlock as p,Fragment as h,renderList as y,createTextVNode as k,toDisplayString as b,createCommentVNode as w}from"vue";import{NPopover as _,NInput as g,NSpace as F,NScrollbar as V,NButton as C}from"naive-ui";import{useIhoTableFormEvent as x}from"../../../../utils/index.js";import D from"../../../../../../time-picker/index.js";import{parse as q,isValid as O,format as j,getHours as S,getMinutes as $,getSeconds as A}from"date-fns";var H=e({__name:"editTime",props:{formattedValue:{type:String},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},shortcutOptions:{type:Array,default:()=>[]}},emits:["update:formattedValue","click"],setup(e,{emit:H}){const I=e,P=l(),R=t("$xetable"),{emitFormChangeWithParams:E}=x({...I,$table:R}),M=a(null),U=a(!1),z=a(),K=a(),N=r((()=>K.value&&L(K.value)?{style:"text-decoration: line-through"}:{})),T=r({get(){if(!K.value)return null;const e=q(K.value,G.valueFormat,new Date);return O(e)?j(e,G.valueFormat):I.formattedValue||null},set(e){J(e)}}),{placeholder:W="请选择",valueFormat:B="HH:mm"}=P,G=u({...P,placeholder:W,valueFormat:B,format:B});function J(e){if(K.value=e||"",e&&L(e))return;const l=I.formattedValue;l!==e&&(H("update:formattedValue",e),E({oldValue:l}))}function L(e){var l,t,a;const r=q(e,G.format,new Date),u=S(r),o=$(r),i=A(r),n=null==(l=G.isHourDisabled)?void 0:l.call(G,u),d=null==(t=G.isMinuteDisabled)?void 0:t.call(G,o,u),c=null==(a=G.isSecondDisabled)?void 0:a.call(G,i,o,u);return n||d||c}function Q(){[G.valueFormat.replace(/[^\w]/g,""),G.valueFormat].some((e=>{const l=q(K.value,e,new Date);if(!K.value||O(l)){return J(K.value?j(l,G.valueFormat):null),!0}return!1}))}function X(e){var l;const{key:t}=e;"Enter"===t&&(null==(l=M.value)||l.blur(),U.value=!1)}return o((()=>I.formattedValue),(e=>{if(!e)return"";K.value=e}),{immediate:!0}),o((()=>U.value),(async e=>{var l,t,a,r,u;e&&(await i(),null==(u=null==(r=null==(a=null==(t=null==(l=z.value)?void 0:l.$timePicker)?void 0:t.panelInstRef)?void 0:a.$el)?void 0:r.querySelectorAll(".n-time-picker-col"))||u.forEach((e=>{var l,t;return null==(t=null==(l=null==e?void 0:e.querySelector)?void 0:l.call(e,".n-time-picker-col__item--active"))?void 0:t.scrollIntoView()})))})),(l,t)=>(n(),d(c(_),{show:U.value,trigger:"click",showArrow:!1,placement:"bottom-start",style:{padding:"0"},onClickoutside:t[4]||(t[4]=()=>U.value=!1)},{trigger:v((()=>[m(c(g),{ref_key:"formRef",ref:M,clearable:"",placeholder:c(W),value:K.value,"onUpdate:value":t[0]||(t[0]=e=>K.value=e),valueModifiers:{trim:!0},"input-props":c(N),onClick:t[1]||(t[1]=()=>U.value=!0),onChange:Q,onKeydown:X},null,8,["placeholder","value","input-props"])])),default:v((()=>[m(c(F),null,{default:v((()=>[m(c(D),s({ref_key:"timePickerRef",ref:z,show:""},c(G),{class:"iho-table__time-picker",to:!1,"formatted-value":c(T),"onUpdate:formatted-value":t[2]||(t[2]=e=>f(T)?T.value=e:null),onConfirm:t[3]||(t[3]=()=>U.value=!1)}),null,16,["formatted-value"]),m(c(V),{class:"iho-table__scrollbar"},{default:v((()=>[e.shortcutOptions.length?(n(),d(c(F),{key:0,vertical:"",wrap:!1},{default:v((()=>[(n(!0),p(h,null,y(e.shortcutOptions,(e=>(n(),d(c(C),{size:"tiny",key:e,disabled:L(e),onClick:l=>function(e){J(e),U.value=!1}(e)},{default:v((()=>[k(b(e),1)])),_:2},1032,["disabled","onClick"])))),128))])),_:1})):w("v-if",!0)])),_:1})])),_:1})])),_:1},8,["show"]))}});export{H as default};
@@ -1 +1 @@
1
- import{findAncestor as t}from"../../../../shared/utils/index.js";import{useEventListener as e,useDebounceFn as r}from"@vueuse/core";import{once as s,pick as a,omit as n,isFunction as u,isString as c}from"lodash-es";import{reactive as o,ref as i,unref as l,computed as h,getCurrentInstance as d,inject as p,onBeforeUnmount as g,onDeactivated as b,onActivated as v}from"vue";import{ShortcutStatus as f,InjectionShortcutManager as k}from"../constants/index.js";import{normalizeSignatureInfo as y,getKeySignature as C,getDisplaySignature as m,isInvalidSignature as S,isKeyboardEvent as w,isInvalidKeyboardEvent as E,isShortcutProvider as M}from"../utils/index.js";const K=Symbol("Glob"),j=new Map;class ${constructor(t,e=K){this.shortcutCallbackMap=o(new Map),this.shortcutCache=i({}),this.disabled=!1,this.environmentEle=t||window,j.set(e,this)}static log(t,e=!1){const r=`[ShortcutManager] ${t}`;return!e&&console.warn(r),r}get traverse(){return[...Object.values(this.shortcutCache.value)].sort(((t,e)=>(t.order||0)-(e.order||0)))}query(t){return this.shortcutCache.value[t]}async update(t,e){var r,s;const a=null==(r=this.query(t))?void 0:r.currentKeySignature;e&&u(this.shortcutCache,e);const n=this.query(t);function u(t,e){if(a!==C(e)){if(Object.values(t.value).some((t=>t.currentKeySignature===C(e))))throw`重复的快捷键=> ${m(e)}`;if(S(e))throw`非法的快捷键=>${e.key}`}}n&&(await(null==(s=n.onUpdate)?void 0:s.call(n,t,e?y(e):void 0)),u(this.shortcutCache,e),n.currentKeySignature=C(e),n.shortcutSignature=y(e),this.shortcutCallbackMap.set(n.currentKeySignature,this.shortcutCallbackMap.get(a)),this.shortcutCallbackMap.delete(a))}register(t){const e=this.query(t.key);return e?(e.status=f.ACTIVE,this.shortcutCallbackMap.set(e.currentKeySignature,t.callback),Object.assign(e,a(t,["debounce","debounceOption","label","order","key"])),r(e)):(this.shortcutCache.value[t.key]=n(t,["callback"]),this.shortcutCallbackMap.set(t.currentKeySignature,t.callback),r(this.shortcutCache.value[t.key]));function r(t){return{stop:()=>{t.status=f.INACTIVE},start:()=>{t.status=f.ACTIVE},signature:()=>t.currentKeySignature}}}start(){return this.handle?($.log(`请勿重复启动=>${this}`),this):(this.handle=async e=>{if(!w(e)||this.disabled)return;const r=t(e.target,M);if(r&&r!==l(this.environmentEle)||E(e))return;const s=C(e),a=this.shortcutCallbackMap.get(s);if(!a)return;e.preventDefault();const n=Object.values(this.shortcutCache.value).find((t=>t.currentKeySignature===s));n&&n.status===f.ACTIVE&&!n.disabled&&a(e)},e(this.environmentEle,"keyup",this.handle,{capture:!0}),this)}destroy(){var t;this.handle&&(null==(t=l(this.environmentEle))||t.removeEventListener("keyup",this.handle,{capture:!0})),this.handle=void 0,this.clear()}clear(){this.shortcutCallbackMap.clear(),this.shortcutCache.value={}}}const I=(new $).start(),O=s((()=>$.log("非setup语境下的shortcut将影响全局"))),A=s((()=>$.log("在非setup语境下使用register函数,组件销毁时可能需要手动调用stop函数使快捷键失活")));function T(t){const e=h((()=>{if(l(t)){const e=j.get(l(t));return e||$.log(`不存在的scope=>${t}, 将使用全局快捷键`),e||I}return d()?p(k,I):(O(),I)}));return{register:function(t){const{stop:s,signature:a,start:n}=l(e).register(function(t){return{...t,shortcutSignature:y(t.shortcutSignature),currentKeySignature:C(t.shortcutSignature),key:function(t){const e=t.key||t.label;if(!c(e))throw new Error($.log(`非法的key类型=>${e}`,!0));return e}(t),status:f.ACTIVE,callback:function(t){var e,s;if(!u(t.callback))throw new Error($.log(`非法的callback类型=>${t.callback}`,!0));return t.debounce?r(t.callback,null!=(s=null==(e=t.debounceOption)?void 0:e.duration)?s:300):t.callback}(t)}}(t));return d()?(g(s),b(s),v(n)):A(),{stop:s,signature:a,start:n}},traverse:function(){return l(e).traverse},clear:function(){l(e).clear()},update:function(t,r){return l(e).update(t,r)},updateManagerDisabled:function(t){l(e).disabled=!!t}}}export{K as GlobalShortcutProvider,$ as ShortcutManager,T as useShortcuts};
1
+ import{findAncestor as t}from"../../../../shared/utils/index.js";import{useEventListener as e,useDebounceFn as r}from"@vueuse/core";import{once as s,pick as a,omit as n,isFunction as u,isString as c}from"lodash-es";import{reactive as o,ref as i,unref as l,computed as h,getCurrentInstance as d,inject as p,onBeforeUnmount as g,onDeactivated as b,onActivated as v}from"vue";import{ShortcutStatus as f,InjectionShortcutManager as k}from"../constants/index.js";import{normalizeSignatureInfo as y,getKeySignature as C,getDisplaySignature as m,isInvalidSignature as S,isKeyboardEvent as w,isInvalidKeyboardEvent as E,isShortcutProvider as M}from"../utils/index.js";const K=Symbol("Glob"),j=new Map;class ${constructor(t,e=K){this.shortcutCallbackMap=o(new Map),this.shortcutCache=i({}),this.disabled=!1,this.environmentEle=t||window,j.set(e,this)}static log(t,e=!1){const r=`[ShortcutManager] ${t}`;return!e&&console.warn(r),r}get traverse(){return[...Object.values(this.shortcutCache.value)].sort(((t,e)=>(t.order||0)-(e.order||0)))}query(t){return this.shortcutCache.value[t]}async update(t,e){var r,s;const a=null==(r=this.query(t))?void 0:r.currentKeySignature;e&&c(this.shortcutCache,e);const n=this.query(t);if(!n)return;await(null==(s=n.onUpdate)?void 0:s.call(n,t,e?y(e):void 0)),c(this.shortcutCache,e),n.currentKeySignature=C(e),n.shortcutSignature=y(e);const u=this.shortcutCallbackMap.get(a);function c(t,e){if(a!==C(e)){if(Object.values(t.value).some((t=>t.currentKeySignature===C(e))))throw`重复的快捷键=> ${m(e)}`;if(S(e))throw`非法的快捷键=>${e.key}`}}this.shortcutCallbackMap.delete(a),this.shortcutCallbackMap.set(n.currentKeySignature,u)}register(t){const e=this.query(t.key);return e?(e.status=f.ACTIVE,this.shortcutCallbackMap.set(e.currentKeySignature,t.callback),Object.assign(e,a(t,["debounce","debounceOption","label","order","key"])),r(e)):(this.shortcutCache.value[t.key]=n(t,["callback"]),this.shortcutCallbackMap.set(t.currentKeySignature,t.callback),r(this.shortcutCache.value[t.key]));function r(t){return{stop:()=>{t.status=f.INACTIVE},start:()=>{t.status=f.ACTIVE},signature:()=>t.currentKeySignature}}}start(){return this.handle?($.log(`请勿重复启动=>${this}`),this):(this.handle=async e=>{if(!w(e)||this.disabled)return;const r=t(e.target,M);if(r&&r!==l(this.environmentEle)||E(e))return;const s=C(e),a=this.shortcutCallbackMap.get(s);if(!a)return;e.preventDefault();const n=Object.values(this.shortcutCache.value).find((t=>t.currentKeySignature===s));n&&n.status===f.ACTIVE&&!n.disabled&&a(e)},e(this.environmentEle,"keyup",this.handle,{capture:!0}),this)}destroy(){var t;this.handle&&(null==(t=l(this.environmentEle))||t.removeEventListener("keyup",this.handle,{capture:!0})),this.handle=void 0,this.clear()}clear(){this.shortcutCallbackMap.clear(),this.shortcutCache.value={}}}const I=(new $).start(),O=s((()=>$.log("非setup语境下的shortcut将影响全局"))),A=s((()=>$.log("在非setup语境下使用register函数,组件销毁时可能需要手动调用stop函数使快捷键失活")));function T(t){const e=h((()=>{if(l(t)){const e=j.get(l(t));return e||$.log(`不存在的scope=>${t}, 将使用全局快捷键`),e||I}return d()?p(k,I):(O(),I)}));return{register:function(t){const{stop:s,signature:a,start:n}=l(e).register(function(t){return{...t,shortcutSignature:y(t.shortcutSignature),currentKeySignature:C(t.shortcutSignature),key:function(t){const e=t.key||t.label;if(!c(e))throw new Error($.log(`非法的key类型=>${e}`,!0));return e}(t),status:f.ACTIVE,callback:function(t){var e,s;if(!u(t.callback))throw new Error($.log(`非法的callback类型=>${t.callback}`,!0));return t.debounce?r(t.callback,null!=(s=null==(e=t.debounceOption)?void 0:e.duration)?s:300):t.callback}(t)}}(t));return d()?(g(s),b(s),v(n)):A(),{stop:s,signature:a,start:n}},traverse:function(){return l(e).traverse},clear:function(){l(e).clear()},update:function(t,r){return l(e).update(t,r)},updateManagerDisabled:function(t){l(e).disabled=!!t}}}export{K as GlobalShortcutProvider,$ as ShortcutManager,T as useShortcuts};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.1.57-beta.8",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.57-beta.8",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.57-beta.9",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.57-beta.9",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.57-beta.8",
3
+ "version": "3.1.57-beta.9",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -64,5 +64,5 @@
64
64
  "iOS 7",
65
65
  "last 3 iOS versions"
66
66
  ],
67
- "gitHead": "268c642d06b1a1cc342f92f6603516c02a008e57"
67
+ "gitHead": "f0b902035e0939ec6720f2fccf9e5f2c7797c384"
68
68
  }