cnhis-design-vue 3.1.50-beta.16 → 3.1.50-beta.17

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{isField as e}from"@formily/core";import{isString as t}from"@vueuse/core";import{format as s}from"date-fns";import{isFunction as i,isNumber as r}from"lodash-es";import{FIELD_BUSINESS_TYPE as n}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import"../../index.js";import{isIdCard as a,parseIdCard as l,parseAgeFromContext as o,parseBirthday as u,parseAge2Birthday as h}from"../utils/business.js";class y{constructor(e){this.businessFormatter=e,this.triggerLock=!1,this.typeLockMap=new Map,this.typeCollector=new Map,this.fieldNameCollector=new Map,this.changeHandlerMap=new Map([])}formatter(...e){return i(this.businessFormatter)?this.businessFormatter(...e):e[0].value}collect(e,t){this.typeCollector.set(e,t),this.fieldNameCollector.set(t.val_key,e)}getField(e){return this.typeCollector.get(e)}getFieldInstanceByType(e,t){const s=this.getField(t);return s?e.query(s.val_key).take():null}getType(e){return this.fieldNameCollector.get(e)}getValueByField(t,s){const i=t.query(s).take();return e(i)?i.value:null}getValueByType(e,t){const s=this.getField(t);return s?this.getValueByField(e,s.val_key):null}setValueByType(e,t,s,i){const n=this.getField(t);n&&e.setFieldState(n.val_key,(e=>{if(e.value===s)return;const a=this.typeLockMap.get(t);this.typeLockMap.set(t,r(a)?a+1:1),e.value=this.formatter({value:s,type:t,fieldKey:n.val_key,from:i})}))}registerChangeBusiness(e,t){return this.changeHandlerMap.set(e,t),this}trigger(e,t,s="change"){var i;if(this.triggerLock)return;const r=this.getType(t);if(!r)return;if("change"===s&&this.typeLockMap.get(r)>0)return this.typeLockMap.set(r,this.typeLockMap.get(r)-1);const n="change"===s?this.changeHandlerMap:null;n&&(null==(i=n.get(r))||i.call(this,e))}}function c(){function e(){var e;const t=this.getField(n.BIRTHDAY);return null!=(e=null==t?void 0:t.date_format)?e:"yyyy-MM-dd HH:mm"}function i(i){const r=this.getValueByType(i,n.ID_CARD);if(!r||!t(r)||!a(r))return;const u=l(r),{age:h,ageUnit:y}=o(u);this.setValueByType(i,n.AGE_UNIT,y,n.ID_CARD),this.setValueByType(i,n.AGE,h,n.ID_CARD),this.setValueByType(i,n.SEX,u.sex,n.ID_CARD),this.setValueByType(i,n.BIRTHDAY,s(new Date(u.birthday),e.call(this)),n.ID_CARD)}function c(e){const s=this.getValueByType(e,n.BIRTHDAY);if(!t(s))return;const{age:i,ageUnit:r}=o(u(s));this.setValueByType(e,n.AGE_UNIT,r,n.BIRTHDAY),this.setValueByType(e,n.AGE,i,n.BIRTHDAY)}function p(s){return function(i){const a=this.getValueByType(i,n.AGE),l=this.getValueByType(i,n.AGE_UNIT);(t(a)||r(a))&&""!==a&&t(l)&&""!==l&&this.setValueByType(i,n.BIRTHDAY,h(+a,l,e.call(this)),s)}}return{create:function(e){return new y(e).registerChangeBusiness(n.ID_CARD,i).registerChangeBusiness(n.AGE_UNIT,p(n.AGE_UNIT)).registerChangeBusiness(n.AGE,p(n.AGE)).registerChangeBusiness(n.BIRTHDAY,c)}}}export{y as BusinessCollector,c as useBusinessBinding};
1
+ import{isField as e}from"@formily/core";import{isString as t}from"@vueuse/core";import{format as s}from"date-fns";import{isFunction as i,isNumber as r}from"lodash-es";import{FIELD_BUSINESS_TYPE as n}from"../constants/index.js";import"vue";import"../../../../shared/utils/index.js";import"@formily/path";import"@vicons/ionicons5";import"@vue/shared";import"naive-ui";import"../../index.js";import{isIdCard as a,parseIdCard as l,parseAgeFromContext as o,parseBirthday as u,parseAge2Birthday as h}from"../utils/business.js";class y{constructor(e){this.businessFormatter=e,this.triggerLock=!1,this.typeLockMap=new Map,this.typeCollector=new Map,this.fieldNameCollector=new Map,this.changeHandlerMap=new Map([])}formatter(...e){return i(this.businessFormatter)?this.businessFormatter(...e):e[0].value}collect(e,t){this.typeCollector.set(e,t),this.fieldNameCollector.set(t.val_key,e)}getField(e){return this.typeCollector.get(e)}getFieldInstanceByType(e,t){const s=this.getField(t);return s?e.query(s.val_key).take():null}getType(e){return this.fieldNameCollector.get(e)}getValueByField(t,s){const i=t.query(s).take();return e(i)?i.value:null}getValueByType(e,t){const s=this.getField(t);return s?this.getValueByField(e,s.val_key):null}setValueByType(e,t,s,i){const r=this.getField(t);r&&e.setFieldState(r.val_key,(e=>{e.value!==s&&(!this.typeLockMap.get(t)&&this.typeLockMap.set(t,1),e.value=this.formatter({value:s,type:t,fieldKey:r.val_key,from:i}))}))}registerChangeBusiness(e,t){return this.changeHandlerMap.set(e,t),this}trigger(e,t,s="change"){var i;if(this.triggerLock)return;const r=this.getType(t);if(!r)return;if("change"===s&&this.typeLockMap.get(r))return this.typeLockMap.set(r,0);const n="change"===s?this.changeHandlerMap:null;n&&(null==(i=n.get(r))||i.call(this,e))}}function c(){function e(){var e;const t=this.getField(n.BIRTHDAY);return null!=(e=null==t?void 0:t.date_format)?e:"yyyy-MM-dd HH:mm"}function i(i){const r=this.getValueByType(i,n.ID_CARD);if(!r||!t(r)||!a(r))return;const u=l(r),{age:h,ageUnit:y}=o(u);this.setValueByType(i,n.AGE_UNIT,y,n.ID_CARD),this.setValueByType(i,n.AGE,h,n.ID_CARD),this.setValueByType(i,n.SEX,u.sex,n.ID_CARD),this.setValueByType(i,n.BIRTHDAY,s(new Date(u.birthday),e.call(this)),n.ID_CARD)}function c(e){const s=this.getValueByType(e,n.BIRTHDAY);if(!t(s))return;const{age:i,ageUnit:r}=o(u(s));this.setValueByType(e,n.AGE_UNIT,r,n.BIRTHDAY),this.setValueByType(e,n.AGE,i,n.BIRTHDAY)}function p(s){return function(i){const a=this.getValueByType(i,n.AGE),l=this.getValueByType(i,n.AGE_UNIT);(t(a)||r(a))&&""!==a&&t(l)&&""!==l&&this.setValueByType(i,n.BIRTHDAY,h(+a,l,e.call(this)),s)}}return{create:function(e){return new y(e).registerChangeBusiness(n.ID_CARD,i).registerChangeBusiness(n.AGE_UNIT,p(n.AGE_UNIT)).registerChangeBusiness(n.AGE,p(n.AGE)).registerChangeBusiness(n.BIRTHDAY,c)}}}export{y as BusinessCollector,c as useBusinessBinding};
@@ -41,6 +41,14 @@ declare const _default: import("vue").DefineComponent<{
41
41
  type: BooleanConstructor;
42
42
  default: boolean;
43
43
  };
44
+ labelField: {
45
+ type: StringConstructor;
46
+ default: string;
47
+ };
48
+ valueField: {
49
+ type: StringConstructor;
50
+ default: string;
51
+ };
44
52
  aliasField: {
45
53
  type: StringConstructor;
46
54
  };
@@ -86,6 +94,14 @@ declare const _default: import("vue").DefineComponent<{
86
94
  type: BooleanConstructor;
87
95
  default: boolean;
88
96
  };
97
+ labelField: {
98
+ type: StringConstructor;
99
+ default: string;
100
+ };
101
+ valueField: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
89
105
  aliasField: {
90
106
  type: StringConstructor;
91
107
  };
@@ -96,6 +112,8 @@ declare const _default: import("vue").DefineComponent<{
96
112
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
97
113
  }, {
98
114
  options: AnyObject[];
115
+ labelField: string;
116
+ valueField: string;
99
117
  placeholder: string;
100
118
  consistentMenuWidth: boolean;
101
119
  allowCreate: boolean;
@@ -1 +1 @@
1
- import{defineComponent as e,inject as l,ref as o,computed as t,createVNode as n,toRaw as a,Fragment as u}from"vue";import{keywordMatcher as r,arrayed as i}from"../../../../../../../shared/utils/index.js";import{NSelect as s,NTooltip as d,NIcon as p,NTag as c}from"naive-ui";import{HelpCircleSharp as v}from"@vicons/ionicons5";import{InjectionIhoTableUUID as m}from"../../../../constants/index.js";import{selectOptionsMap as f}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as h}from"../../../../utils/index.js";import{useDebounceFn as y}from"@vueuse/core";import{isEmpty as b,isFunction as w,isArray as S,isObject as g,omit as O,cloneDeep as x}from"lodash-es";var j=e({name:"EditSelect",props:{value:{type:[Array,String,Number]},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},options:{type:Array,default:()=>[]},queryOptions:{type:Function},placeholder:{type:String,default:"请选择"},allowCreate:{type:Boolean,default:!1},shouldSave:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},aliasField:{type:String},menuProps:{type:Object}},emits:["update:value"],setup(e,{emit:j}){const P=l("$xetable"),q=o(null);function _(e){q.value=e}const k=o(!1),{emitFormChangeWithParams:C}=h({...e,$table:P}),F=o("");function W(){return E()}const M=o([]),$=t((()=>{let l=b(M.value)?e.options:M.value;return F.value?(l=l.filter((e=>e.label&&e.label.includes(F.value)||r(F.value,e.keyword))),!e.allowCreate||l.some((e=>e.label===F.value))?l:[...l,{label:F.value,value:F.value,created:!0,shouldSave:e.shouldSave}]):l})),B=o(!1),E=y((async function(l=""){F.value=l;try{if(B.value=!0,!w(e.queryOptions)||!b(e.options))return;M.value=await e.queryOptions({keyword:l,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(l){console.log(`获取${e.column.field}options错误`)}finally{B.value=!1}}),400),I=l(m);function U(l,o){const t=e.value;j("update:value",l);const n=f.get(I);n&&S(n[e.column.field])&&i(o).forEach((l=>{if(!g(l))return;const o=l;o.created&&o.shouldSave&&n[e.column.field].push(O(a(o),["created","shouldSave"]))})),C({oldValue:t,option:x(o)})}function A(e){var l,o;"Tab"===e.key&&q.value&&(null==(o=(l=q.value).handleKeydown)||o.call(l,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function D({node:e,option:l}){return l.desc?n("div",{class:"iho-table__selectOptionWrapper"},[[e,n(d,null,{trigger:()=>n(p,{component:v},null),default:()=>l.desc})]]):e}function K({option:l,handleClose:o}){var t;const a=null!=(t=e.aliasField&&l[e.aliasField])?t:l.label;return S(e.value)?n(c,{closable:!0,onClose:e=>{e.stopPropagation(),o()}},{default:()=>a}):n(u,null,[a])}const N=()=>({class:"iho-table__selectOption"}),T=t((()=>{var l,o;return{...e.menuProps,class:`iho-table__selectMenu ${null!=(o=null==(l=e.menuProps)?void 0:l.class)?o:""}`}}));return()=>n(s,{ref:_,show:k.value,"onUpdate:show":e=>k.value=e,consistentMenuWidth:e.consistentMenuWidth,placeholder:e.placeholder,loading:B.value,options:$.value,value:e.value,remote:!0,onSearch:E,clearable:!0,filterable:!0,nodeProps:N,menuProps:T.value,renderTag:K,renderOption:D,onUpdateShow:W,onUpdateValue:U,onKeydown:A},null)}});export{j as default};
1
+ import{defineComponent as e,inject as l,ref as o,computed as t,createVNode as a,toRaw as n,Fragment as u}from"vue";import{keywordMatcher as r,arrayed as i}from"../../../../../../../shared/utils/index.js";import{NSelect as s,NTooltip as d,NIcon as p,NTag as c}from"naive-ui";import{HelpCircleSharp as v}from"@vicons/ionicons5";import{InjectionIhoTableUUID as m}from"../../../../constants/index.js";import{selectOptionsMap as f}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as h}from"../../../../utils/index.js";import{useDebounceFn as y}from"@vueuse/core";import{isEmpty as b,isFunction as F,isArray as w,isObject as S,omit as g,cloneDeep as O}from"lodash-es";var x=e({name:"EditSelect",props:{value:{type:[Array,String,Number]},column:{type:Object,required:!0},row:{type:Object,required:!0},rowIndex:{type:Number,required:!0},options:{type:Array,default:()=>[]},queryOptions:{type:Function},placeholder:{type:String,default:"请选择"},allowCreate:{type:Boolean,default:!1},shouldSave:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},aliasField:{type:String},menuProps:{type:Object}},emits:["update:value"],setup(e,{emit:x}){const j=l("$xetable"),P=o(null);function q(e){P.value=e}const _=o(!1),{emitFormChangeWithParams:k}=h({...e,$table:j}),C=o("");function W(){return E()}const M=o([]),$=t((()=>{let l=b(M.value)?e.options:M.value;return C.value?(l=l.filter((l=>l[e.labelField]&&l[e.labelField].includes(C.value)||r(C.value,l.keyword))),!e.allowCreate||l.some((l=>l[e.labelField]===C.value))?l:[...l,{[e.labelField]:C.value,[e.valueField]:C.value,created:!0,shouldSave:e.shouldSave}]):l})),B=o(!1),E=y((async function(l=""){C.value=l;try{if(B.value=!0,!F(e.queryOptions)||!b(e.options))return;M.value=await e.queryOptions({keyword:l,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(l){console.log(`获取${e.column.field}options错误`)}finally{B.value=!1}}),400),I=l(m);function U(l,o){const t=e.value;x("update:value",l);const a=f.get(I);a&&w(a[e.column.field])&&i(o).forEach((l=>{if(!S(l))return;const o=l;o.created&&o.shouldSave&&a[e.column.field].push(g(n(o),["created","shouldSave"]))})),k({oldValue:t,option:O(o)})}function A(e){var l,o;"Tab"===e.key&&P.value&&(null==(o=(l=P.value).handleKeydown)||o.call(l,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function D({node:e,option:l}){return l.desc?a("div",{class:"iho-table__selectOptionWrapper"},[[e,a(d,null,{trigger:()=>a(p,{component:v},null),default:()=>l.desc})]]):e}function K({option:l,handleClose:o}){var t;const n=null!=(t=e.aliasField&&l[e.aliasField])?t:l[e.labelField];return w(e.value)?a(c,{closable:!0,onClose:e=>{e.stopPropagation(),o()}},{default:()=>n}):a(u,null,[n])}const N=()=>({class:"iho-table__selectOption"}),T=t((()=>{var l,o;return{...e.menuProps,class:`iho-table__selectMenu ${null!=(o=null==(l=e.menuProps)?void 0:l.class)?o:""}`}}));return()=>a(s,{ref:q,show:_.value,"onUpdate:show":e=>_.value=e,consistentMenuWidth:e.consistentMenuWidth,placeholder:e.placeholder,labelField:e.labelField,valueField:e.valueField,loading:B.value,options:$.value,value:e.value,remote:!0,onSearch:E,clearable:!0,filterable:!0,nodeProps:N,menuProps:T.value,renderTag:K,renderOption:D,onUpdateShow:W,onUpdateValue:U,onKeydown:A},null)}});export{x as default};
@@ -1 +1 @@
1
- function n(n,r,o=[]){const{aliasField:u=""}=(null==r?void 0:r.componentProps)||{},i=n[r.columnName];return Array.isArray(i)?i.map((n=>a(n))).join(","):a(i);function a(n){var r,i;const a=(l(o)||[]).find((l=>l.value==n));return null!=(i=null!=(r=null==a?void 0:a[u])?r:null==a?void 0:a.label)?i:n}}function l(n){return Array.isArray(n)&&!n.length?null:n}export{l as getArray,n as getDefaultValue};
1
+ function l(l,r,u=[]){const{aliasField:i="",labelField:o="label",valueField:e="value"}=(null==r?void 0:r.componentProps)||{},a=l[r.columnName];return Array.isArray(a)?a.map((l=>t(l))).join(","):t(a);function t(l){var r,a,t;const d=null==(r=n(u))?void 0:r.find((n=>n[e]==l));return null!=(t=null!=(a=null==d?void 0:d[i])?a:null==d?void 0:d[o])?t:l}}function n(l){return Array.isArray(l)&&!l.length?null:l}export{n as getArray,l as getDefaultValue};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.1.50-beta.16",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.16",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.17",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.17",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.16",
3
+ "version": "3.1.50-beta.17",
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": "59648819a6c7ec75e5d2775bff05453ddca56268"
66
+ "gitHead": "a8f7d7cdca3113620c2a7b0dbaf062673dfc51cc"
67
67
  }