cnhis-design-vue 3.1.51-beta.6 → 3.1.51-beta.8
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/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.d.ts +2 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.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/index.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
- package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -1
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/index.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
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{
|
|
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{selectOptionsMap as o}from"../rendererPlugins/editableWidgets/hooks/useSelectOption.js";import{IhoTableUtils as l}from"../../utils/index.js";import{EDITABLE_WIDGET_TYPE as i}from"../../constants/index.js";import{isString as r,trim as u,isEmpty as d,isEqual as a,isFunction as s}from"lodash-es";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,i.SELECT)&&e(g)===y[R.field])return;const x=m.uuid&&E(R,i.SELECT)&&o.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(r(e(g))&&(g.value=u(e(g)||"")),!e(g)||!function(e){var t;const n=null==(t=e.editRender)?void 0:t.props;return n&&Object.keys(i).includes(l.getCellType(n))}(R)||y.$__SEPARATE||!function(e,t,n,o){var l,i;const{beforeEditMethod:r}=t.editConfig||{},u={rowIndex:null!=(l=e.getRowIndex(n))?l:0,columnIndex:null!=(i=e.getColumnIndex(o))?i:0};return!r||s(r)&&r({row:n,column:o,...u,$table:e,$grid:void 0})}(n,m,y,R))return;if(E(R,i.DATE)&&function(t,n){var o;const l=null==(o=t.editRender)?void 0:o.props,i=e(g)||"";return!p(new Date(i))||r(l.connectField)&&n[l.connectField]&&(l.isStartDate&&f(new Date(i),new Date(n[l.connectField]))<0||l.isEndDate&&f(new Date(i),new Date(n[l.connectField]))>0)}(R,y))return;if(E(R,i.NUMBER)&&!/^-?\d*\.?\d+$/.test((e(g)||"").toString()))return;if(E(R,i.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&&!d(x)){const e=x.filter((e=>t.split(",").includes(e.label))).map((e=>e.value));if(d(e))return;if(function(e){var t,n;const o=null==(t=e.editRender)?void 0:t.props;return E(e,i.SELECT)&&(null==(n=o.componentProps)?void 0:n.multiple)}(R)){if(a(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,i.SEPARATE)&&(null==w||w())}}function E(e,t){var n;const o=null==(n=e.editRender)?void 0:n.props;return o&&l.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};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { AnyObject } from '../../../../../../../../es/shared/types';
|
|
2
|
+
import { VxeTableConstructor } from 'vxe-table';
|
|
2
3
|
export declare const selectOptionsMap: Map<string, Record<string, AnyObject[]>>;
|
|
4
|
+
export declare function getSelectOptions(uuid: string, row: AnyObject, field: string, $table: VxeTableConstructor): AnyObject[];
|
package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useSelectOption.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reactive as
|
|
1
|
+
import{reactive as e}from"vue";const n=e(new Map);function t(e,t,i,l){if(!e||!i||!l)return[];const{tableColumn:o}=l.reactData,r=o.find((e=>{var n,t;const l=null==(t=(null==(n=e.editRender)?void 0:n.props).connectField)?void 0:t.split(",");return null==l?void 0:l.includes(i)}));return r&&t[r.field]?n.get(e)[`${i}__${r.field}-${t[r.field]}`]:n.get(e)[i]}export{t as getSelectOptions,n as selectOptionsMap};
|
|
@@ -59,6 +59,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
59
|
type: BooleanConstructor;
|
|
60
60
|
default: boolean;
|
|
61
61
|
};
|
|
62
|
+
deletable: {
|
|
63
|
+
type: BooleanConstructor;
|
|
64
|
+
default: boolean;
|
|
65
|
+
};
|
|
66
|
+
selectAll: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
62
70
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
71
|
value: {
|
|
64
72
|
type: PropType<string | number | (string | number)[]>;
|
|
@@ -116,6 +124,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
116
124
|
type: BooleanConstructor;
|
|
117
125
|
default: boolean;
|
|
118
126
|
};
|
|
127
|
+
deletable: {
|
|
128
|
+
type: BooleanConstructor;
|
|
129
|
+
default: boolean;
|
|
130
|
+
};
|
|
131
|
+
selectAll: {
|
|
132
|
+
type: BooleanConstructor;
|
|
133
|
+
default: boolean;
|
|
134
|
+
};
|
|
119
135
|
}>> & {
|
|
120
136
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
121
137
|
}, {
|
|
@@ -124,8 +140,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
124
140
|
labelField: string;
|
|
125
141
|
valueField: string;
|
|
126
142
|
placeholder: string;
|
|
143
|
+
deletable: boolean;
|
|
127
144
|
shouldSave: boolean;
|
|
128
145
|
consistentMenuWidth: boolean;
|
|
129
146
|
allowCreate: boolean;
|
|
147
|
+
selectAll: boolean;
|
|
130
148
|
}>;
|
|
131
149
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,inject as l,ref as t,computed as o,createVNode as
|
|
1
|
+
import{defineComponent as e,inject as l,ref as t,computed as o,createVNode as n,toRaw as a,Fragment as u,createTextVNode as i}from"vue";import{keywordMatcher as r,arrayed as d}from"../../../../../../../shared/utils/index.js";import{NSelect as s,NTooltip as p,NIcon as c,NTag as v,NButton as f}from"naive-ui";import{HelpCircleSharp as m}from"@vicons/ionicons5";import{InjectionIhoTableUUID as y}from"../../../../constants/index.js";import{getSelectOptions as h,selectOptionsMap as b}from"../hooks/useSelectOption.js";import{useIhoTableFormEvent as w}from"../../../../utils/index.js";import{useDebounceFn as F}from"@vueuse/core";import{isEmpty as g,isFunction as S,isArray as O,isObject as q,omit as x,cloneDeep as C}from"lodash-es";var $=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},multiple:{type:Boolean,default:!1},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean,default:!0}},emits:["update:value"],setup(e,{emit:$}){const _=l("$xetable"),j=t(null);function k(e){j.value=e}const P=t(!1),{emitFormChangeWithParams:B}=w({...e,$table:_}),W=t("");function A(){return I()}const D=t([]),E=o((()=>{let l=g(D.value)?e.options:D.value;return W.value?(l=l.filter((l=>l[e.labelField]&&l[e.labelField].includes(W.value)||r(W.value,l.keyword))),!e.allowCreate||l.some((l=>l[e.labelField]===W.value))?l:[...l,{[e.labelField]:W.value,[e.valueField]:W.value,created:!0,shouldSave:e.shouldSave}]):l})),M=t(!1),I=F((async function(l=""){W.value=l;try{if(M.value=!0,!S(e.queryOptions)||!g(e.options))return;D.value=await e.queryOptions({keyword:l,row:e.row,column:e.column,rowIndex:e.rowIndex})}catch(l){console.log(`获取${e.column.field}options错误`)}finally{M.value=!1}}),400),U=l(y);function V(l,t){var o,n;const u=e.value;$("update:value",l);const i=h(U,e.row,e.column.field,_);U&&O(i)&&d(t).forEach((e=>{if(!q(e))return;const l=e;l.created&&l.shouldSave&&i.push(x(a(l),["created","shouldSave"]))}));const r=null==(n=(null==(o=e.column.editRender)?void 0:o.props).connectField)?void 0:n.split(",");if(U&&r){const l=b.get(U);r.forEach((async t=>{var o;const{tableColumn:n}=_.reactData,a=n.find((e=>e.field===t)),u=null==(o=null==a?void 0:a.editRender)?void 0:o.props;if(null==u?void 0:u.queryOptions){const o=`${t}__${e.column.field}-${e.row[e.column.field]}`,n=await u.queryOptions({row:e.row,column:a,isFullData:!0});l[o]=n}}))}B({oldValue:u,option:C(t)})}function z(e){var l,t;"Tab"===e.key&&j.value&&(null==(t=(l=j.value).handleKeydown)||t.call(l,{...e,key:"Enter",preventDefault:e.preventDefault.bind(e)}))}function K(l){const t=l?E.value.map((l=>l[e.valueField])):[],o=e.value,n=O(o)?o.length:0;t.length!==n&&($("update:value",t),B({oldValue:o,option:l?C(E.value):[]}))}function N({node:e,option:l}){return l.desc?n("div",{class:"iho-table__selectOptionWrapper"},[[e,n(p,null,{trigger:()=>n(c,{component:m},null),default:()=>l.desc})]]):e}function R({option:l,handleClose:t}){var o;const a=null!=(o=e.aliasField&&l[e.aliasField])?o:l[e.labelField];return O(e.value)?e.deletable?n(v,{closable:!0,onClose:e=>{e.stopPropagation(),t()}},{default:()=>a}):`${a} ;`:n(u,null,[a])}function T(){return n(u,null,[n(f,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>K(!0)},{default:()=>[i("全选")]}),n(f,{quaternary:!0,type:"primary",size:"tiny",onClick:()=>K(!1)},{default:()=>[i("清空")]})])}const G=()=>({class:"iho-table__selectOption"}),H=o((()=>{var l,t;return{...e.menuProps,class:`iho-table__selectMenu ${null!=(t=null==(l=e.menuProps)?void 0:l.class)?t:""}`}}));return()=>{const l={};return e.multiple&&e.selectAll&&(l.action=T),n(s,{ref:k,show:P.value,"onUpdate:show":e=>P.value=e,consistentMenuWidth:e.consistentMenuWidth,placeholder:e.placeholder,labelField:e.labelField,valueField:e.valueField,loading:M.value,options:E.value,multiple:e.multiple,value:e.value,remote:!0,onSearch:I,clearable:!0,filterable:!0,nodeProps:G,menuProps:H.value,renderTag:R,renderOption:N,onUpdateShow:A,onUpdateValue:V,onKeydown:z},l)}}});export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{inject as e,createVNode as o,mergeProps as
|
|
1
|
+
import{inject as e,createVNode as o,mergeProps as l,onBeforeUnmount as t}from"vue";import{arrayed as n}from"../../../../../../../shared/utils/index.js";import"../../../../../index.js";import{EDITABLE_WIDGET_TYPE as i,InjectionIhoTableUUID as r}from"../../../../constants/index.js";import{useAutoFocus as s}from"../hooks/useAutoFocus.js";import{createIhoTableClearActivedInterceptor as u,getTitle as d,IhoTableRenderHelper as a,IhoTableUtils as c}from"../../../../utils/index.js";import p from"./editSelect.js";import{getDefaultValue as m,getArray as f}from"./selectUtils.js";import{getSelectOptions as v,selectOptionsMap as E}from"../hooks/useSelectOption.js";import{isEqual as b}from"lodash-es";import{defineTablePlugin as g}from"../../../../hooks/useTablePlugin.js";function h(){const h="selectRendererPlugin";return g({name:h,vxe(t){t.interceptor.add("event.clearActived",u(i.SELECT,(e=>e.classList.contains("iho-table__selectMenu")))),t.renderer.add(i.SELECT,{renderCell({props:l},{row:t,column:i,$table:s}){var u;const a=e(r),c=v(a,t,i.field,s),p=m(t,l,c),f=n(p).join(","),E=l&&(!0===(b=l.variableHeight)||"1"===b||(null==(u=l.componentProps)?void 0:u.indexedText));var b;return[o("span",{title:d(i,f)},[E?n(p).filter((e=>null!=e)).map(((e,l)=>[l+1,".",e,";",o("br",null,null)])):f])]},renderEdit:a.createRenderEdit((({fieldItem:t,emitFormClick:n,row:i,column:s,$rowIndex:u,$table:d})=>{const a=e(r),c=v(a,i,s.field,d);return[o(p,l({queryOptions:t.queryOptions},t.componentProps,{options:c,column:s,row:i,"row-index":u,value:i[s.field],"onUpdate:value":e=>i[s.field]=e,onClick:n}),null)]}))})},apply(e){s(e).bindAutoFocusConfig(h,i.SELECT,".n-base-selection-input");let o=null;async function l(e,o={}){var l,t,n;const i=null==(l=e.editRender)?void 0:l.props;let r=f(i.options)||f(null==(t=i.componentProps)?void 0:t.options)||[];if(i.queryOptions)try{const l={column:e,isFullData:!0,...o};r=await(null==(n=i.queryOptions)?void 0:n.call(i,l))}catch(e){console.log(`获取${i.field}_options错误`)}return r}e.fieldHooks.fieldList.tap(h,((e,{uuid:l})=>(o=e,l&&!E.get(l)&&E.set(l,{}),e))),e.fieldHooks.fieldEnd.tapPromise(h,(async({uuid:e},{$table:t})=>{if(!e)return;const n=E.get(e);null==o||o.forEach((async e=>{var i,r;const s=null==(i=e.editRender)?void 0:i.props;if(e.field&&s&&"SELECT"===c.getCellType(s)&&(n[e.field]||(n[e.field]=await l(e)),s.connectField&&(null==t?void 0:t.value))){const{tableData:i}=(null==(r=t.value)?void 0:r.getTableData())||{};i.forEach((t=>{s.connectField.split(",").forEach((async i=>{const r=`${i}__${e.field}-${t[s.columnName]}`;if(!t[s.columnName]||n[r])return;console.log("mapKey",r);const u=null==o?void 0:o.find((e=>e.field===i));u&&(n[r]=await l(u,{row:t}))}))}))}}))})),e.setupHooks.setup.tap(h,(e=>{t((()=>{e.value.uuid&&E.delete(e.value.uuid)}))})),e.eventHooks.onCellDblclick.tap(h,(({$table:e},o,{emits:l})=>{var t;const{column:n,row:r}=e.reactData.editStore.actived,s=null==(t=n.editRender)?void 0:t.props,{cellDblclickSelectable:u=!1,multiple:d=!1,valueField:a="value"}=s.componentProps||{};if(!u||!n||!function(e){return e&&c.getCellType(e)===i.SELECT}(s))return;const p=o.uuid&&E.get(o.uuid)[n.field];if(1!==(null==p?void 0:p.length))return;const m=d?[p[0][a]]:p[0][a],f=r[n.field];e.clearEdit(),b(m,f)||(r[n.field]=m,l("formChange",{column:n,row:r,oldValue:f,value:m,index:e.getRowIndex(r),$table:e,option:p[0]}))}))}})}export{h as selectRendererPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function l(l,r,u=[]){const{aliasField:
|
|
1
|
+
function l(l,r,u=[]){const{aliasField:e="",labelField:i="label",valueField:o="value"}=(null==r?void 0:r.componentProps)||{},a=l[r.columnName];return Array.isArray(a)?a.map((l=>t(l))):t(a);function t(l){var r,a,t;const d=null==(r=n(u))?void 0:r.find((n=>n[o]==l));return null!=(t=null!=(a=null==d?void 0:d[e])?a:null==d?void 0:d[i])?t:l}}function n(l){return Array.isArray(l)&&!l.length?null:l}export{n as getArray,l as getDefaultValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{unref as e,onBeforeUnmount as t,shallowReactive as o,createVNode as l,defineComponent as n,inject as r,ref as a,computed as s,provide as i,watch as u,onMounted as d,h as c}from"vue";import{traverse as p,widthAppend as f}from"../../../../../shared/utils/index.js";import{doAnimation as m}from"../../../../../shared/utils/anime.js";import{useThrottleFn as h}from"@vueuse/core";import{promiseTimeout as g}from"@vueuse/shared";import{last as v,isFunction as x,isNumber as y}from"lodash-es";import"../../../index.js";import{EDITABLE_WIDGET_TYPE as b,InjectionIhoTableUUID as I}from"../../constants/index.js";import{useUUIDMap as T,IhoTableUtils as w}from"../../utils/index.js";import{defineTablePlugin as R}from"../../hooks/useTablePlugin.js";class D{constructor(){this.records={},this.maxRecords=o(new Map)}set(e,t,o){if(this.records[e]||(this.records[e]={}),this.records[e][t]===o)return;this.records[e][t]=o;const l=Math.max(...Object.values(this.records[e]),0);this.maxRecords.get(e)!==l&&this.maxRecords.set(e,l)}getMax(e){return this.maxRecords.get(e)||0}}const{getItemFromUUID:H,removeItemFromUUID:M}=T((()=>new D),!0),{getItemFromUUID:S,removeItemFromUUID:C,setItemFromUUID:U}=T((()=>null)),{getItemFromUUID:$,removeItemFromUUID:k,setItemFromUUID:F}=T((()=>{}));let j={};function E(t,o,{scrollTop:l=0}){var n,r;const{uuid:a,rowConfig:s={}}=o;if(!a)return;const i=H(a),{oSize:u=0,gt:d=100}=null!=(n=$(a))?n:{},{internalData:c,reactData:p}=t,{scrollYStore:f,elemStore:m,afterFullData:h,fullDataRowIdData:g}=c;if(d>h.length)return;const y=null!=(r=s.height)?r:36,b=m["main-body-wrapper"],I=b?e(b):null;let T=I?Math.max(8,Math.ceil(I.clientHeight/y)+2+u):8;const w=[0];let R=0;if(l&&h.find(((e,o)=>{const n=t.getRowSeq(e),r=(v(w)||0)+Math.max(y,i.getMax(n));if(w.push(r),r>l)return R=Math.max(0,o-u),T+=Math.min(R,u),!0})),R>0&&x(o.spanMethod)){const{spanMethod:e}=o,l={rowspan:1,colspan:1};for(;R>0;){if(!t.getColumns().some(((t,o)=>{const{rowspan:n,colspan:r}=e({column:t,columnIndex:o,$columnIndex:o,row:h[R],rowIndex:R,$rowIndex:R,_rowIndex:R,isHidden:!t.visible,fixed:t.fixed,type:t.type,visibleData:h})||l;if(0===n&&0===r)return R--,!0})))break}}const D=`${w[R]}px`,M=`${h.reduce(((e,o)=>{const l=t.getRowSeq(o);return e+Math.max(y,i.getMax(l))}),0)}px`;["main","left","right"].forEach((t=>{const o=m[`${t}-body-table`],n=o?e(o):null;n&&(n.style.marginTop=D,n.scrollTop=l),["header","body","footer"].forEach((o=>{const l=m[`${t}-${o}-ySpace`],n=l?e(l):null;n&&(n.style.height=M)}))}));const S=Math.min(h.length,R+T);if(f.startIndex===R&&f.endIndex===S)return;f.startIndex=R,f.endIndex=S;const C=h.slice(f.startIndex,f.endIndex);C.forEach(((e,o)=>{const l=t.getRowid(e),n=g[l];n&&(n.$index=o)})),p.tableData.length=0,p.tableData.push(...C)}const Y=h(E,300);function q(e){var t,o;return(!0===e.variableHeight||"1"===e.variableHeight)&&(null!=(o=null==(t=e.editRender)?void 0:t.name)?o:w.getCellType(e))!==b.SEPARATE}function L(){const o="variableHeightRendererPlugin";return R({name:o,vxe(e){j=n({props:{payload:{type:Object,required:!0}},setup(t){const o=r(I),n=r("$xetable"),p=a(),m=H(o),h=s((()=>t.payload.row[t.payload.column.field]));function v(){const{row:e,column:o}=t.payload,l=n.getRowSeq(e);if(!m||null==l||!p.value)return;const r=p.value.clientHeight;m.set(l,o.field,r)}i("updateCellHeight",v),u([()=>t.payload.rowIndex,()=>t.payload.column.field,h,()=>t.payload.column.renderWidth],(async()=>{await g(0),v()})),d((()=>{n&&!S(o)&&U(o,n),v()}));const b=s((()=>{var o,l,n,r,a;const s=null!=(l=null==(o=t.payload.column.editRender)?void 0:o.props)?l:{},i=null!=(r=null==(n=s.slots)?void 0:n.default)?r:s.slotFn;if(x(i))return i;const u=null==(a=t.payload.column.editRender)?void 0:a.name;if(u){const o=e.renderer.get(u);if(null==o?void 0:o.renderCell)return()=>o.renderCell(t.payload.column.editRender,t.payload)}return()=>h.value})),T=s((()=>{if(t.payload.column.treeNode)return"";const e=t.payload.column.renderWidth;return y(e)&&e>0?f(e-20-2):""}));return()=>l("div",{ref:p,style:{padding:"7px 0",width:T.value,overflow:"hidden"}},[c(b.value,t.payload)])}})},apply(n){function r(t){const o=S(t.uuid);if(!o)return;t.scrollY={enabled:!1},o.reactData.scrollYLoad=!1;const l=function(t){const o=t.internalData.elemStore["main-body-wrapper"];return o?e(o):null}(o);l&&E(o,t,{scrollTop:l.scrollTop})}function a(e){if(!e.uuid)return;const t=$(e.uuid);t&&(e.scrollY=t),setTimeout((()=>r(e)),300)}function s(e){return l(j,{payload:e},null)}n.dataHooks.dataStart.tap(o,a),n.eventHooks.onFilterChange.tap(o,((e,t)=>a(t))),n.eventHooks.onSortChange.tap(o,((e,t)=>a(t))),n.eventHooks.onToggleTreeExpand.tap(o,((e,t)=>a(t))),n.eventHooks.onResizableChange.tap(o,(async({column:e},t)=>{e.editRender&&e.editRender.props&&q(e.editRender.props)&&a(t)})),n.eventHooks.onScroll.tap(o,h(((e,t)=>{if(e.isX)return;const{uuid:o}=t;if(!o)return;const l=S(o);l&&E(l,t,e)}),100,!0,!0)),n.fieldHooks.field.tap(o,(e=>{if(q(e)){e.slots={...e.slots,default:s};const t=e.className,o="variable-height";e.className=t?function(e){return x(t)?[t(e),o]:[t,o]}:o}return e})),n.fieldHooks.fieldList.tap(o,((t,o,{$table:l})=>(o.uuid&&p(t,((t,n)=>{var a,s
|
|
1
|
+
import{unref as e,onBeforeUnmount as t,shallowReactive as o,createVNode as l,defineComponent as n,inject as r,ref as a,computed as s,provide as i,watch as u,onMounted as d,h as c}from"vue";import{traverse as p,widthAppend as f}from"../../../../../shared/utils/index.js";import{doAnimation as m}from"../../../../../shared/utils/anime.js";import{useThrottleFn as h}from"@vueuse/core";import{promiseTimeout as g}from"@vueuse/shared";import{last as v,isFunction as x,isNumber as y}from"lodash-es";import"../../../index.js";import{EDITABLE_WIDGET_TYPE as b,InjectionIhoTableUUID as I}from"../../constants/index.js";import{useUUIDMap as T,IhoTableUtils as w}from"../../utils/index.js";import{defineTablePlugin as R}from"../../hooks/useTablePlugin.js";class D{constructor(){this.records={},this.maxRecords=o(new Map)}set(e,t,o){if(this.records[e]||(this.records[e]={}),this.records[e][t]===o)return;this.records[e][t]=o;const l=Math.max(...Object.values(this.records[e]),0);this.maxRecords.get(e)!==l&&this.maxRecords.set(e,l)}getMax(e){return this.maxRecords.get(e)||0}}const{getItemFromUUID:H,removeItemFromUUID:M}=T((()=>new D),!0),{getItemFromUUID:S,removeItemFromUUID:C,setItemFromUUID:U}=T((()=>null)),{getItemFromUUID:$,removeItemFromUUID:k,setItemFromUUID:F}=T((()=>{}));let j={};function E(t,o,{scrollTop:l=0}){var n,r;const{uuid:a,rowConfig:s={}}=o;if(!a)return;const i=H(a),{oSize:u=0,gt:d=100}=null!=(n=$(a))?n:{},{internalData:c,reactData:p}=t,{scrollYStore:f,elemStore:m,afterFullData:h,fullDataRowIdData:g}=c;if(d>h.length)return;const y=null!=(r=s.height)?r:36,b=m["main-body-wrapper"],I=b?e(b):null;let T=I?Math.max(8,Math.ceil(I.clientHeight/y)+2+u):8;const w=[0];let R=0;if(l&&h.find(((e,o)=>{const n=t.getRowSeq(e),r=(v(w)||0)+Math.max(y,i.getMax(n));if(w.push(r),r>l)return R=Math.max(0,o-u),T+=Math.min(R,u),!0})),R>0&&x(o.spanMethod)){const{spanMethod:e}=o,l={rowspan:1,colspan:1};for(;R>0;){if(!t.getColumns().some(((t,o)=>{const{rowspan:n,colspan:r}=e({column:t,columnIndex:o,$columnIndex:o,row:h[R],rowIndex:R,$rowIndex:R,_rowIndex:R,isHidden:!t.visible,fixed:t.fixed,type:t.type,visibleData:h})||l;if(0===n&&0===r)return R--,!0})))break}}const D=`${w[R]}px`,M=`${h.reduce(((e,o)=>{const l=t.getRowSeq(o);return e+Math.max(y,i.getMax(l))}),0)}px`;["main","left","right"].forEach((t=>{const o=m[`${t}-body-table`],n=o?e(o):null;n&&(n.style.marginTop=D,n.scrollTop=l),["header","body","footer"].forEach((o=>{const l=m[`${t}-${o}-ySpace`],n=l?e(l):null;n&&(n.style.height=M)}))}));const S=Math.min(h.length,R+T);if(f.startIndex===R&&f.endIndex===S)return;f.startIndex=R,f.endIndex=S;const C=h.slice(f.startIndex,f.endIndex);C.forEach(((e,o)=>{const l=t.getRowid(e),n=g[l];n&&(n.$index=o)})),p.tableData.length=0,p.tableData.push(...C)}const Y=h(E,300);function q(e){var t,o;return(!0===e.variableHeight||"1"===e.variableHeight)&&(null!=(o=null==(t=e.editRender)?void 0:t.name)?o:w.getCellType(e))!==b.SEPARATE}function L(){const o="variableHeightRendererPlugin";return R({name:o,vxe(e){j=n({props:{payload:{type:Object,required:!0}},setup(t){const o=r(I),n=r("$xetable"),p=a(),m=H(o),h=s((()=>t.payload.row[t.payload.column.field]));function v(){const{row:e,column:o}=t.payload,l=n.getRowSeq(e);if(!m||null==l||!p.value)return;const r=p.value.clientHeight;m.set(l,o.field,r)}i("updateCellHeight",v),u([()=>t.payload.rowIndex,()=>t.payload.column.field,h,()=>t.payload.column.renderWidth],(async()=>{await g(0),v()})),d((()=>{n&&!S(o)&&U(o,n),v()}));const b=s((()=>{var o,l,n,r,a;const s=null!=(l=null==(o=t.payload.column.editRender)?void 0:o.props)?l:{},i=null!=(r=null==(n=s.slots)?void 0:n.default)?r:s.slotFn;if(x(i))return i;const u=null==(a=t.payload.column.editRender)?void 0:a.name;if(u){const o=e.renderer.get(u);if(null==o?void 0:o.renderCell)return()=>o.renderCell(t.payload.column.editRender,t.payload)}return()=>h.value})),T=s((()=>{if(t.payload.column.treeNode)return"";const e=t.payload.column.renderWidth;return y(e)&&e>0?f(e-20-2):""}));return()=>l("div",{ref:p,style:{padding:"7px 0",width:T.value,overflow:"hidden"}},[c(b.value,t.payload)])}})},apply(n){function r(t){const o=S(t.uuid);if(!o)return;t.scrollY={enabled:!1},o.reactData.scrollYLoad=!1;const l=function(t){const o=t.internalData.elemStore["main-body-wrapper"];return o?e(o):null}(o);l&&E(o,t,{scrollTop:l.scrollTop})}function a(e){if(!e.uuid)return;const t=$(e.uuid);t&&(e.scrollY=t),setTimeout((()=>r(e)),300)}function s(e){return l(j,{payload:e},null)}n.dataHooks.dataStart.tap(o,a),n.eventHooks.onFilterChange.tap(o,((e,t)=>a(t))),n.eventHooks.onSortChange.tap(o,((e,t)=>a(t))),n.eventHooks.onToggleTreeExpand.tap(o,((e,t)=>a(t))),n.eventHooks.onResizableChange.tap(o,(async({column:e},t)=>{e.editRender&&e.editRender.props&&q(e.editRender.props)&&a(t)})),n.eventHooks.onScroll.tap(o,h(((e,t)=>{if(e.isX)return;const{uuid:o}=t;if(!o)return;const l=S(o);l&&E(l,t,e)}),100,!0,!0)),n.fieldHooks.field.tap(o,(e=>{if(q(e)){e.slots={...e.slots,default:s};const t=e.className,o="variable-height";e.className=t?function(e){return x(t)?[t(e),o]:[t,o]}:o}return e})),n.fieldHooks.fieldList.tap(o,((t,o,{$table:l})=>(o.uuid&&p(t,((t,n)=>{var a,s;if(q(t)){const t=null!=(s=null==(a=o.rowConfig)?void 0:a.height)?s:36,i=H(o.uuid),u=o.cellStyle;if(o.cellStyle=function(e){const o={};if(l.value){const n=Math.max(t,i.getMax(l.value.getRowSeq(e.row)));o.height=`${n}px`}return Object.assign(o,u?x(u)?u(e):u:null)},o.sortableConfig&&o.sortableConfig.enable){const t=o.sortableConfig.onEnd;o.sortableConfig.onEnd=function(l){const n=S(o.uuid);if(n){const{internalData:{elemStore:t}}=n,l=t["main-table-body"];l&&e(l)&&E(n,o,{scrollTop:e(l).scrollTop})}x(t)&&t(l)}}o.scrollY={...o.scrollY,mode:"default"},o.onWheel=function(t){let o=null,l=0,n=!0;return function(r){if(!t.uuid)return;const a=S(t.uuid);if(!a)return;const{internalData:s}=a,{isHover:i}=t.rowConfig||{},{deltaX:u,deltaY:d}=r,{refTableLeftBody:c,refTableRightBody:p,refTableBody:f}=a.getRefMaps(),h=d,g=u,v=h<0,x=e(f),y=x?x.$el:null;if(!y)return;if(v?y.scrollTop<=0:y.scrollTop>=y.scrollHeight-y.clientHeight)return;const b=y.scrollTop+h,I=y.scrollLeft+g;if(b===s.lastScrollTop)return;r.preventDefault(),s.lastScrollTop=b,s.lastScrollLeft=I,s.lastScrollTime=Date.now(),i&&a.clearHoverRow();const T=c.value,w=p.value,R=T?T.$el:null,D=w?w.$el:null,H=Math.min(100,Math.abs(Math.floor(h/2)));n&&(l=y.scrollTop,n=!1),l+=H*(v?-1:1),o&&o(),o=m(y.scrollTop,l,400,(e=>{y.scrollTop=e,R&&(R.scrollTop=e),D&&(D.scrollTop=e)}),"easeOutCubic",(()=>{l=y.scrollTop,n=!0})),Y(a,t,y)}}(o),setTimeout((()=>{F(o.uuid,o.scrollY),r(o)}),300),n()}})),t))),n.setupHooks.setup.tap(o,(e=>{t((()=>{e.value.uuid&&(M(e.value.uuid),C(e.value.uuid),k(e.value.uuid))}))}))}})}export{L as variableHeightRendererPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.51-beta.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.51-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.51-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};
|
package/es/shared/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getCurrentInstance as t,defineComponent as e,provide as n,createVNode as r}from"vue";import{useMemoize as o}from"@vueuse/core";import{isString as i,isObject as
|
|
1
|
+
import{getCurrentInstance as t,defineComponent as e,provide as n,createVNode as r}from"vue";import{useMemoize as o}from"@vueuse/core";import{isString as i,isObject as s,isNumber as u,isArray as c,isFunction as f}from"lodash-es";import a from"../package.json.js";export{getBindEventSettingTrigger,getOperationalFormHandler,isMatchLowCodeCondition,isMatchLowCodeConditionsWithSqlExpression}from"./business.js";function l(t,e,n="children",r){let o=!1;function i(){o=!0}!function t(e,n,r="children",s){r=x(r),e=x(e);for(let u=0;u<e.length;u++){if(n(e[u],i,s),o)return;for(let i=0;i<r.length;i++){const s=e[u][r[i]];if(Array.isArray(s)&&t(s,n,r,e[u]),o)return}}}(t,e,n,r)}function d(t,e,n=e.name,r){if(!n)throw new Error(`[CUI]: invalid component name for ${e}`);const{components:o={}}=t._context;o[n]||(!Reflect.get(t,"__cnhis_version")&&s(a)&&Reflect.set(t,"__cnhis_version",a.version),r?r():t.component(n,e))}function p(t){if(!i(t))return;const e=t.match(/[Hms:]+/);return e?e[0]:void 0}function x(t){return Array.isArray(t)?t:[t]}function m(){return`key${"xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}))}`}const h=o((function(t){return t?[...t].reduce(((t,e)=>/[a-z]/.test(e)?t+7.51:/[A-Z]/.test(e)?t+9.13:/\d/.test(e)?t+8.64:/[.,]/.test(e)?t+4.03:/[)(]/.test(e)?t+5.17:/[\u4e00-\u9fa5():,。]/.test(e)?t+13.95:/[-+]/.test(e)?t+7.51:/[/\\]/.test(e)?t+4.11:/%/.test(e)?t+12.68:/‰/.test(e)?t+17.75:t+6),0):0})),g=Object.seal(Object.create(null));function v(t,e){return function t(e,n){return s(e)?c(e)?e.map((e=>t(e,n))):Object.entries(e).reduce(((e,[r,o])=>(n.includes(r)||(s(o)&&!f(o)?e[r]=t(o,n):e[r]=o),e)),{}):e}(t,e)}function y(t){return Object.values(t).reduce(((t,e)=>Object.assign(t,e)),{})}function b(t,e){if(!t)return t;if(e(t))return t;let n=t.parentElement;for(;n&&!e(n);)n=n.parentElement;return n}function j(t,e="px"){if(u(t))return`${t}${e}`;if(i(t))return t.endsWith(e)?t:`${t}${e}`;throw new Error(`invalid width value ${t}, it need to be a string or number!`)}const O=o((t=>{try{return JSON.parse(t)}catch(t){return{}}}),{getKey:t=>t});function w(t,e){if(!s(t))return t;const n={...t};for(let t=0;t<e.length;t++)Reflect.deleteProperty(n,e[t]);return n}function E(e){if(!t())throw new Error(e||"can't use this hook out of setup environment")}function $(t,e=1){const[n,r,o,i,s]=t.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i)||[];if(!n)return[255,255,255,e];const c=s&&parseInt(s,16)/255;return[parseInt(r,16),parseInt(o,16),parseInt(i,16),+(u(c)?c.toFixed(2):e)]}function _(t){return e({setup(e,{slots:o}){let i=(null==t?void 0:t.parent)&&Reflect.get(t.parent,"provides");const s=[];for(;i;)Object.entries(i).forEach((([t,e])=>{s.includes(t)||(s.push(t),n(t,e))})),i=Object.getPrototypeOf(i);return()=>{var t;return r("div",null,[null==(t=o.default)?void 0:t.call(o)])}}})}const S=o((function(t,e){return!(!i(e)||!i(t))&&e.split(",").some((e=>e.trim().includes(t)))}),{getKey:(...t)=>t.reduce(((t,e)=>String(t)+"_"+String(e)),"")});export{g as DMZ,x as arrayed,E as checkInSetupEnv,_ as createProviderWrapper,v as deepOmit,b as findAncestor,p as generateTimeFormat,h as getStringWidth,$ as hex2rgba,O as jsonParse,S as keywordMatcher,d as safeComponentRegister,y as separateMetaModule,w as shallowOmit,l as traverse,m as uuidGenerator,j as widthAppend};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.51-beta.
|
|
3
|
+
"version": "3.1.51-beta.8",
|
|
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": "1d7ef0d697a3640322529c04452972ba26347f18"
|
|
67
67
|
}
|