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.
- package/es/components/form-render/src/hooks/useBusinessBinding.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +18 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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": "
|
|
66
|
+
"gitHead": "a8f7d7cdca3113620c2a7b0dbaf062673dfc51cc"
|
|
67
67
|
}
|