vxe-table 3.3.14-beta.0 → 3.3.14-beta.1
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/lib/form/src/form-gather.js +13 -0
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +123 -1
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +72 -102
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +81 -0
- package/lib/form/src/render.min.js +1 -0
- package/lib/grid/src/grid.js +6 -3
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +298 -186
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +15 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/textarea/src/textarea.js +11 -3
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/textarea/style/style.css +11 -12
- package/lib/textarea/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/form/src/form-gather.js +10 -0
- package/packages/form/src/form-item.js +101 -1
- package/packages/form/src/form.js +49 -107
- package/packages/form/src/render.js +79 -0
- package/packages/grid/src/grid.js +4 -3
- package/packages/table/src/body.js +12 -4
- package/packages/textarea/src/textarea.js +8 -3
- package/styles/textarea.scss +11 -11
- package/styles/variable.scss +198 -198
package/lib/table/src/body.js
CHANGED
|
@@ -687,6 +687,7 @@ var _default = {
|
|
|
687
687
|
$xetable = this.$parent,
|
|
688
688
|
fixedType = this.fixedType;
|
|
689
689
|
var $refs = $xetable.$refs,
|
|
690
|
+
elemStore = $xetable.elemStore,
|
|
690
691
|
highlightHoverRow = $xetable.highlightHoverRow,
|
|
691
692
|
scrollXLoad = $xetable.scrollXLoad,
|
|
692
693
|
scrollYLoad = $xetable.scrollYLoad,
|
|
@@ -703,6 +704,10 @@ var _default = {
|
|
|
703
704
|
var bodyElem = tableBody.$el;
|
|
704
705
|
var leftElem = leftBody ? leftBody.$el : null;
|
|
705
706
|
var rightElem = rightBody ? rightBody.$el : null;
|
|
707
|
+
var bodyYElem = elemStore['main-body-ySpace'];
|
|
708
|
+
var bodyXElem = elemStore['main-body-xSpace'];
|
|
709
|
+
var bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0;
|
|
710
|
+
var bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0;
|
|
706
711
|
var scrollTop = scrollBodyElem.scrollTop;
|
|
707
712
|
var scrollLeft = bodyElem.scrollLeft;
|
|
708
713
|
var isRollX = scrollLeft !== lastScrollLeft;
|
|
@@ -758,6 +763,8 @@ var _default = {
|
|
|
758
763
|
fixed: fixedType,
|
|
759
764
|
scrollTop: scrollTop,
|
|
760
765
|
scrollLeft: scrollLeft,
|
|
766
|
+
bodyHeight: bodyHeight,
|
|
767
|
+
bodyWidth: bodyWidth,
|
|
761
768
|
isX: isRollX,
|
|
762
769
|
isY: isRollY
|
|
763
770
|
}, evnt);
|
|
@@ -766,7 +773,8 @@ var _default = {
|
|
|
766
773
|
var _this = this;
|
|
767
774
|
|
|
768
775
|
var $xetable = this.$parent;
|
|
769
|
-
var $refs = $xetable.$refs
|
|
776
|
+
var $refs = $xetable.$refs,
|
|
777
|
+
elemStore = $xetable.elemStore;
|
|
770
778
|
var tableBody = $refs.tableBody,
|
|
771
779
|
leftBody = $refs.leftBody,
|
|
772
780
|
rightBody = $refs.rightBody;
|
|
@@ -774,6 +782,10 @@ var _default = {
|
|
|
774
782
|
var leftElem = leftBody ? leftBody.$el : null;
|
|
775
783
|
var rightElem = rightBody ? rightBody.$el : null;
|
|
776
784
|
var remainSize = this.isPrevWheelTop === isTopWheel ? Math.max(0, this.wheelYSize - this.wheelYTotal) : 0;
|
|
785
|
+
var bodyYElem = elemStore['main-body-ySpace'];
|
|
786
|
+
var bodyXElem = elemStore['main-body-xSpace'];
|
|
787
|
+
var bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0;
|
|
788
|
+
var bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0;
|
|
777
789
|
this.isPrevWheelTop = isTopWheel;
|
|
778
790
|
this.wheelYSize = Math.abs(isTopWheel ? deltaTop - remainSize : deltaTop + remainSize);
|
|
779
791
|
this.wheelYInterval = 0;
|
|
@@ -819,6 +831,8 @@ var _default = {
|
|
|
819
831
|
fixed: fixedType,
|
|
820
832
|
scrollTop: bodyElem.scrollTop,
|
|
821
833
|
scrollLeft: bodyElem.scrollLeft,
|
|
834
|
+
bodyHeight: bodyHeight,
|
|
835
|
+
bodyWidth: bodyWidth,
|
|
822
836
|
isX: isRollX,
|
|
823
837
|
isY: isRollY
|
|
824
838
|
}, evnt);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_vXETable=_interopRequireDefault(require("../../v-x-e-table")),_tools=require("../../tools"),_util=require("./util"),_dom=require("../../tools/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,l,t){return l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,l){if(e){if("string"==typeof e)return _arrayLikeToArray(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,l):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,r=new Array(l);t<l;t++)r[t]=e[t];return r}var scrollProcessTimeout,renderType="body";function isOperateMouse(e){return e._isResize||e.lastScrollTime&&Date.now()<e.lastScrollTime+e.delayHover}function renderLine(e,l,t,r,o,n){var i=n.column,s=t.treeOpts,a=t.treeConfig,c=i.slots,i=i.treeNode;return c&&c.line?t.callSlot(c.line,n,e):a&&i&&s.line?[e("div",{class:"vxe-tree--line-wrapper"},[e("div",{class:"vxe-tree--line",style:{height:"".concat((0,_util.calcTreeLine)(n,o),"px"),left:"".concat(r*s.indent+(r?2-(0,_util.getOffsetSize)(t):0)+16,"px")}})])]:[]}function renderColumn(e,l,t,r,o,n,i,s,a,c,d,u,p,f,h,y){var v,g=t.$listeners,m=t.afterFullData,x=t.tableData,w=t.height,b=t.columnKey,T=t.overflowX,_=t.sYOpts,S=t.scrollXLoad,O=t.scrollYLoad,$=t.highlightCurrentRow,C=t.showOverflow,L=t.isAllOverflow,I=t.align,k=t.currentColumn,E=t.cellClassName,Y=t.cellStyle,R=t.mergeList,A=t.spanMethod,P=t.radioOpts,B=t.checkboxOpts,H=t.expandOpts,M=t.treeOpts,D=t.tooltipOpts,U=t.mouseConfig,q=t.editConfig,X=t.editOpts,j=t.editRules,N=t.validOpts,W=t.editStore,z=t.validStore,F=t.tooltipConfig,V=p.type,K=p.cellRender,G=p.editRender,J=p.align,Q=p.showOverflow,Z=p.className,ee=p.treeNode,le=W.actived,te=_.rHeight,re=D.showAll||D.enabled,oe=t.getColumnIndex(p),ne=t.getVTColumnIndex(p),W=(0,_tools.isEnableConf)(G),_=i?p.fixed!==i:p.fixed&&T,D=_xeUtils.default.isUndefined(Q)||_xeUtils.default.isNull(Q)?C:Q,T="ellipsis"===D,ie="title"===D,se=!0===D||"tooltip"===D,Q=ie||se||T,D={},J=J||I,I=z.row===a&&z.column===p,j=j&&N.showMessage&&("default"===N.message?w||1<x.length:"inline"===N.message),w={colid:p.id},ae=g["cell-mouseenter"],ce=g["cell-mouseleave"],N=G&&q&&"dblclick"===X.trigger,de={$table:t,$seq:r,seq:o,rowid:n,row:a,rowIndex:c,$rowIndex:d,_rowIndex:u,column:p,columnIndex:oe,$columnIndex:f,_columnIndex:ne,fixed:i,type:renderType,isHidden:_,level:s,visibleData:m,data:x,items:y};if(!S&&!O||Q||(T=Q=!0),(ie||se||re||ae||F)&&(D.mouseenter=function(e){isOperateMouse(t)||(ie?_tools.DomTools.updateCellTitle(e.currentTarget,p):(se||re)&&t.triggerBodyTooltipEvent(e,de),ae&&t.emitEvent("cell-mouseenter",Object.assign({cell:e.currentTarget},de),e))}),(se||re||ce||F)&&(D.mouseleave=function(e){isOperateMouse(t)||((se||re)&&t.handleTargetLeaveEvent(e),ce&&t.emitEvent("cell-mouseleave",Object.assign({cell:e.currentTarget},de),e))}),(B.range||U)&&(D.mousedown=function(e){t.triggerCellMousedownEvent(e,de)}),($||g["cell-click"]||G&&q||"row"===H.trigger||"cell"===H.trigger||"row"===P.trigger||"radio"===p.type&&"cell"===P.trigger||"row"===B.trigger||"checkbox"===p.type&&"cell"===B.trigger||"row"===M.trigger||p.treeNode&&"cell"===M.trigger)&&(D.click=function(e){t.triggerCellClickEvent(e,de)}),(N||g["cell-dblclick"])&&(D.dblclick=function(e){t.triggerCellDblclickEvent(e,de)}),R.length){u=(0,_util.mergeBodyMethod)(R,u,ne);if(u){var ne=u.rowspan,ue=u.colspan;if(!ne||!ue)return null;1<ne&&(w.rowspan=ne),1<ue&&(w.colspan=ue)}}else if(A){ue=A(de)||{},A=ue.rowspan,A=void 0===A?1:A,ue=ue.colspan,ue=void 0===ue?1:ue;if(!A||!ue)return null;1<A&&(w.rowspan=A),1<ue&&(w.colspan=ue)}!(_=_&&R&&(1<w.colspan||1<w.rowspan)?!1:_)&&q&&(G||K)&&(X.showStatus||X.showUpdateStatus)&&(v=t.isUpdateByRow(a,p.property));K=[];return _&&C&&L?K.push(e("div",{class:["vxe-cell",{"c--title":ie,"c--tooltip":se,"c--ellipsis":T}],style:{maxHeight:Q&&te?"".concat(te,"px"):""}})):(K.push.apply(K,_toConsumableArray(renderLine(e,l,t,s,y,de)).concat([e("div",{class:["vxe-cell",{"c--title":ie,"c--tooltip":se,"c--ellipsis":T}],style:{maxHeight:Q&&te?"".concat(te,"px"):""},attrs:{title:ie?t.getCellLabel(a,p):null}},p.renderCell(e,de))])),j&&I&&K.push(e("div",{class:"vxe-cell--valid",style:z.rule&&z.rule.maxWidth?{width:"".concat(z.rule.maxWidth,"px")}:null},[e("span",{class:"vxe-cell--valid-msg"},z.content)]))),e("td",{class:["vxe-body--column",p.id,(_defineProperty(e={},"col--".concat(J),J),_defineProperty(e,"col--".concat(V),V),_defineProperty(e,"col--last",f===h.length-1),_defineProperty(e,"col--tree-node",ee),_defineProperty(e,"col--edit",W),_defineProperty(e,"col--ellipsis",Q),_defineProperty(e,"fixed--hidden",_),_defineProperty(e,"col--dirty",v),_defineProperty(e,"col--actived",q&&W&&le.row===a&&(le.column===p||"row"===X.mode)),_defineProperty(e,"col--valid-error",I),_defineProperty(e,"col--current",k===p),e),_tools.UtilTools.getClass(Z,de),_tools.UtilTools.getClass(E,de)],key:b?p.id:f,attrs:w,style:Object.assign({height:Q&&te?"".concat(te,"px"):""},Y?_xeUtils.default.isFunction(Y)?Y(de):Y:null),on:D},K)}function renderRows(u,p,f,h,y,v,g,m){var x=f.stripe,w=f.rowKey,b=f.highlightHoverRow,T=f.rowClassName,_=f.rowStyle,S=f.editConfig,O=f.showOverflow,$=f.treeConfig,C=f.treeOpts,L=f.editOpts,I=f.treeExpandeds,k=f.scrollYLoad,E=f.scrollYStore,Y=f.editStore,R=f.rowExpandeds,A=f.radioOpts,P=f.checkboxOpts,B=f.expandColumn,H=f.hasFixedColumn,M=[];return g.forEach(function(t,r){var e={},o=(i=r)+1;k&&(o+=E.startIndex);var n=f.getVTRowIndex(t),i=f.getRowIndex(t);b&&(e.mouseenter=function(e){isOperateMouse(f)||f.triggerHoverEvent(e,{row:t,rowIndex:i})},e.mouseleave=function(){isOperateMouse(f)||f.clearHoverRow()});var l,s,a=_tools.UtilTools.getRowid(f,t),c={$table:f,$seq:h,seq:o,rowid:a,fixed:v,type:renderType,level:y,row:t,rowIndex:i,$rowIndex:r},d=!1;S&&(d=-1<Y.insertList.indexOf(t)),M.push(u("tr",{class:["vxe-body--row",{"row--stripe":x&&(f.getVTRowIndex(t)+1)%2==0,"is--new":d,"row--new":d&&(L.showStatus||L.showInsertStatus),"row--radio":A.highlight&&f.selectRow===t,"row--checked":P.highlight&&f.isCheckedByCheckboxRow(t)},T?_xeUtils.default.isFunction(T)?T(c):T:""],attrs:{rowid:a},style:_?_xeUtils.default.isFunction(_)?_(c):_:null,key:w||$?a:r,on:e},m.map(function(e,l){return renderColumn(u,p,f,h,o,a,v,y,t,i,r,n,e,l,m,g)}))),B&&R.length&&-1<R.indexOf(t)&&($&&(l={paddingLeft:"".concat(y*C.indent+30,"px")}),s=B.showOverflow,c=_xeUtils.default.isUndefined(s)||_xeUtils.default.isNull(s)?O:s,s={$table:f,$seq:h,seq:o,column:B,fixed:v,type:renderType,level:y,row:t,rowIndex:i,$rowIndex:r},M.push(u("tr",{class:"vxe-body--expanded-row",key:"expand_".concat(a),style:_?_xeUtils.default.isFunction(_)?_(s):_:null,on:e},[u("td",{class:["vxe-body--expanded-column",{"fixed--hidden":v&&!H,"col--ellipsis":c}],attrs:{colspan:m.length}},[u("div",{class:"vxe-body--expanded-cell",style:l},[B.renderData(u,s)])])]))),$&&I.length&&((s=t[C.children])&&s.length&&-1<I.indexOf(t)&&M.push.apply(M,_toConsumableArray(renderRows(u,p,f,(h?"".concat(h,"."):"").concat(o),y+1,v,s,m))))}),M}function syncBodyScroll(e,l,t){(l||t)&&(l&&((0,_util.removeScrollListener)(l),l.scrollTop=e),t&&((0,_util.removeScrollListener)(t),t.scrollTop=e),clearTimeout(scrollProcessTimeout),scrollProcessTimeout=setTimeout(function(){(0,_util.restoreScrollListener)(l),(0,_util.restoreScrollListener)(t)},300))}var _default={name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,fixedColumn:Array,size:String,fixedType:String},data:function(){return{wheelTime:null,wheelYSize:0,wheelYInterval:0,wheelYTotal:0}},mounted:function(){var e=this.$parent,l=this.$el,t=this.$refs,r=this.fixedType,e=e.elemStore,r="".concat(r||"main","-body-");e["".concat(r,"wrapper")]=l,e["".concat(r,"table")]=t.table,e["".concat(r,"colgroup")]=t.colgroup,e["".concat(r,"list")]=t.tbody,e["".concat(r,"xSpace")]=t.xSpace,e["".concat(r,"ySpace")]=t.ySpace,e["".concat(r,"emptyBlock")]=t.emptyBlock,this.$el.onscroll=this.scrollEvent,this.$el._onscroll=this.scrollEvent},beforeDestroy:function(){clearTimeout(this.wheelTime),this.$el._onscroll=null,this.$el.onscroll=null},render:function(t){var e=this._e,l=this.$parent,r=this.fixedColumn,o=this.fixedType,n=l.$scopedSlots,i=l.tId,s=l.tableData,a=l.tableColumn,c=l.visibleColumn,d=l.showOverflow,u=l.keyboardConfig,p=l.keyboardOpts,f=l.mergeList,h=l.spanMethod,y=l.scrollXLoad,v=l.scrollYLoad,g=l.isAllOverflow,m=l.emptyOpts,x=l.mouseConfig,w=l.mouseOpts,b=l.sYOpts;return o&&(a=!(y||v||d&&g)||f.length||h||u&&p.isMerge?c:r),m=n.empty?n.empty.call(this,{$table:l},t):(n=(n=m.name?_vXETable.default.renderer.get(m.name):null)?n.renderEmpty:null)?n.call(this,t,m,{$table:l}):l.emptyText||_conf.default.i18n("vxe.table.emptyText"),t("div",{class:["vxe-table--body-wrapper",o?"fixed-".concat(o,"--wrapper"):"body--wrapper"],attrs:{xid:i},on:v&&"wheel"===b.mode?{wheel:this.wheelEvent}:{}},[o?e():t("div",{class:"vxe-body--x-space",ref:"xSpace"}),t("div",{class:"vxe-body--y-space",ref:"ySpace"}),t("table",{class:"vxe-table--body",attrs:{xid:i,cellspacing:0,cellpadding:0,border:0},ref:"table"},[t("colgroup",{ref:"colgroup"},a.map(function(e,l){return t("col",{attrs:{name:e.id},key:l})})),t("tbody",{ref:"tbody"},renderRows(t,this,l,"",0,o,s,a))]),t("div",{class:"vxe-table--checkbox-range"}),x&&w.area?t("div",{class:"vxe-table--cell-area"},[t("span",{class:"vxe-table--cell-main-area"},w.extension?[t("span",{class:"vxe-table--cell-main-area-btn",on:{mousedown:function(e){l.triggerCellExtendMousedownEvent(e,{$table:l,fixed:o,type:renderType})}}})]:null),t("span",{class:"vxe-table--cell-copy-area"}),t("span",{class:"vxe-table--cell-extend-area"}),t("span",{class:"vxe-table--cell-multi-area"}),t("span",{class:"vxe-table--cell-active-area"})]):null,o?null:t("div",{class:"vxe-table--empty-block",ref:"emptyBlock"},[t("div",{class:"vxe-table--empty-content"},m)])])},methods:{scrollEvent:function(e){var l=this.$el,t=this.$parent,r=this.fixedType,o=t.$refs,n=t.highlightHoverRow,i=t.scrollXLoad,s=t.scrollYLoad,a=t.lastScrollTop,c=t.lastScrollLeft,d=o.tableHeader,u=o.tableBody,p=o.leftBody,f=o.rightBody,h=o.tableFooter,y=o.validTip,o=d?d.$el:null,d=h?h.$el:null,h=u.$el,u=p?p.$el:null,p=f?f.$el:null,f=l.scrollTop,l=h.scrollLeft,c=l!==c,a=f!==a;t.lastScrollTop=f,t.lastScrollLeft=l,t.lastScrollTime=Date.now(),n&&t.clearHoverRow(),u&&"left"===r?syncBodyScroll(f=u.scrollTop,h,p):p&&"right"===r?syncBodyScroll(f=p.scrollTop,h,u):(c&&(o&&(o.scrollLeft=h.scrollLeft),d&&(d.scrollLeft=h.scrollLeft)),(u||p)&&(t.checkScrolling(),a&&syncBodyScroll(f,u,p))),i&&c&&t.triggerScrollXEvent(e),s&&a&&t.triggerScrollYEvent(e),c&&y&&y.visible&&y.updatePlacement(),t.emitEvent("scroll",{type:renderType,fixed:r,scrollTop:f,scrollLeft:l,isX:c,isY:a},e)},handleWheel:function(s,a,e,c,d){var u=this,p=this.$parent,l=p.$refs,t=l.tableBody,r=l.leftBody,l=l.rightBody,f=t.$el,h=r?r.$el:null,y=l?l.$el:null,l=this.isPrevWheelTop===a?Math.max(0,this.wheelYSize-this.wheelYTotal):0;this.isPrevWheelTop=a,this.wheelYSize=Math.abs(a?e-l:e+l),this.wheelYInterval=0,this.wheelYTotal=0,clearTimeout(this.wheelTime),function e(){var l,t,r=u.fixedType,o=u.wheelYTotal,n=u.wheelYSize,i=u.wheelYInterval;o<n&&(n<(o+=i=Math.max(5,Math.floor(1.5*i)))&&(i-=o-n),t=f.scrollTop,l=f.clientHeight,n=f.scrollHeight,t=t+i*(a?-1:1),f.scrollTop=t,h&&(h.scrollTop=t),y&&(y.scrollTop=t),(a?t<n-l:0<=t)&&(u.wheelTime=setTimeout(e,10)),u.wheelYTotal=o,u.wheelYInterval=i,p.emitEvent("scroll",{type:renderType,fixed:r,scrollTop:f.scrollTop,scrollLeft:f.scrollLeft,isX:c,isY:d},s))}()},wheelEvent:function(e){var l=e.deltaY,t=e.deltaX,r=this.$el,o=this.$parent,n=o.$refs,i=o.highlightHoverRow,s=o.scrollYLoad,a=o.lastScrollTop,c=o.lastScrollLeft,d=n.tableBody.$el,n=_dom.browse.firefox?40*l:l,l=_dom.browse.firefox?40*t:t,t=n<0;(t?r.scrollTop<=0:r.scrollTop>=r.scrollHeight-r.clientHeight)||(r=r.scrollTop+n,c=(l=d.scrollLeft+l)!==c,(a=r!==a)&&(e.preventDefault(),o.lastScrollTop=r,o.lastScrollLeft=l,o.lastScrollTime=Date.now(),i&&o.clearHoverRow(),this.handleWheel(e,t,n,c,a),s&&o.triggerScrollYEvent(e)))}}};exports.default=_default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_vXETable=_interopRequireDefault(require("../../v-x-e-table")),_tools=require("../../tools"),_util=require("./util"),_dom=require("../../tools/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,l,t){return l in e?Object.defineProperty(e,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[l]=t,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,l){if(e){if("string"==typeof e)return _arrayLikeToArray(e,l);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,l):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,o=new Array(l);t<l;t++)o[t]=e[t];return o}var scrollProcessTimeout,renderType="body";function isOperateMouse(e){return e._isResize||e.lastScrollTime&&Date.now()<e.lastScrollTime+e.delayHover}function renderLine(e,l,t,o,r,i){var n=i.column,a=t.treeOpts,s=t.treeConfig,c=n.slots,n=n.treeNode;return c&&c.line?t.callSlot(c.line,i,e):s&&n&&a.line?[e("div",{class:"vxe-tree--line-wrapper"},[e("div",{class:"vxe-tree--line",style:{height:"".concat((0,_util.calcTreeLine)(i,r),"px"),left:"".concat(o*a.indent+(o?2-(0,_util.getOffsetSize)(t):0)+16,"px")}})])]:[]}function renderColumn(e,l,t,o,r,i,n,a,s,c,d,u,p,f,h,y){var v,g=t.$listeners,m=t.afterFullData,x=t.tableData,w=t.height,b=t.columnKey,T=t.overflowX,_=t.sYOpts,S=t.scrollXLoad,O=t.scrollYLoad,$=t.highlightCurrentRow,C=t.showOverflow,L=t.isAllOverflow,I=t.align,k=t.currentColumn,E=t.cellClassName,Y=t.cellStyle,R=t.mergeList,A=t.spanMethod,H=t.radioOpts,P=t.checkboxOpts,B=t.expandOpts,M=t.treeOpts,D=t.tooltipOpts,U=t.mouseConfig,q=t.editConfig,W=t.editOpts,X=t.editRules,j=t.validOpts,N=t.editStore,z=t.validStore,F=t.tooltipConfig,V=p.type,K=p.cellRender,G=p.editRender,J=p.align,Q=p.showOverflow,Z=p.className,ee=p.treeNode,le=N.actived,te=_.rHeight,oe=D.showAll||D.enabled,re=t.getColumnIndex(p),ie=t.getVTColumnIndex(p),N=(0,_tools.isEnableConf)(G),_=n?p.fixed!==n:p.fixed&&T,D=_xeUtils.default.isUndefined(Q)||_xeUtils.default.isNull(Q)?C:Q,T="ellipsis"===D,ne="title"===D,ae=!0===D||"tooltip"===D,Q=ne||ae||T,D={},J=J||I,I=z.row===s&&z.column===p,X=X&&j.showMessage&&("default"===j.message?w||1<x.length:"inline"===j.message),w={colid:p.id},se=g["cell-mouseenter"],ce=g["cell-mouseleave"],j=G&&q&&"dblclick"===W.trigger,de={$table:t,$seq:o,seq:r,rowid:i,row:s,rowIndex:c,$rowIndex:d,_rowIndex:u,column:p,columnIndex:re,$columnIndex:f,_columnIndex:ie,fixed:n,type:renderType,isHidden:_,level:a,visibleData:m,data:x,items:y};if(!S&&!O||Q||(T=Q=!0),(ne||ae||oe||se||F)&&(D.mouseenter=function(e){isOperateMouse(t)||(ne?_tools.DomTools.updateCellTitle(e.currentTarget,p):(ae||oe)&&t.triggerBodyTooltipEvent(e,de),se&&t.emitEvent("cell-mouseenter",Object.assign({cell:e.currentTarget},de),e))}),(ae||oe||ce||F)&&(D.mouseleave=function(e){isOperateMouse(t)||((ae||oe)&&t.handleTargetLeaveEvent(e),ce&&t.emitEvent("cell-mouseleave",Object.assign({cell:e.currentTarget},de),e))}),(P.range||U)&&(D.mousedown=function(e){t.triggerCellMousedownEvent(e,de)}),($||g["cell-click"]||G&&q||"row"===B.trigger||"cell"===B.trigger||"row"===H.trigger||"radio"===p.type&&"cell"===H.trigger||"row"===P.trigger||"checkbox"===p.type&&"cell"===P.trigger||"row"===M.trigger||p.treeNode&&"cell"===M.trigger)&&(D.click=function(e){t.triggerCellClickEvent(e,de)}),(j||g["cell-dblclick"])&&(D.dblclick=function(e){t.triggerCellDblclickEvent(e,de)}),R.length){u=(0,_util.mergeBodyMethod)(R,u,ie);if(u){var ie=u.rowspan,ue=u.colspan;if(!ie||!ue)return null;1<ie&&(w.rowspan=ie),1<ue&&(w.colspan=ue)}}else if(A){ue=A(de)||{},A=ue.rowspan,A=void 0===A?1:A,ue=ue.colspan,ue=void 0===ue?1:ue;if(!A||!ue)return null;1<A&&(w.rowspan=A),1<ue&&(w.colspan=ue)}!(_=_&&R&&(1<w.colspan||1<w.rowspan)?!1:_)&&q&&(G||K)&&(W.showStatus||W.showUpdateStatus)&&(v=t.isUpdateByRow(s,p.property));K=[];return _&&C&&L?K.push(e("div",{class:["vxe-cell",{"c--title":ne,"c--tooltip":ae,"c--ellipsis":T}],style:{maxHeight:Q&&te?"".concat(te,"px"):""}})):(K.push.apply(K,_toConsumableArray(renderLine(e,l,t,a,y,de)).concat([e("div",{class:["vxe-cell",{"c--title":ne,"c--tooltip":ae,"c--ellipsis":T}],style:{maxHeight:Q&&te?"".concat(te,"px"):""},attrs:{title:ne?t.getCellLabel(s,p):null}},p.renderCell(e,de))])),X&&I&&K.push(e("div",{class:"vxe-cell--valid",style:z.rule&&z.rule.maxWidth?{width:"".concat(z.rule.maxWidth,"px")}:null},[e("span",{class:"vxe-cell--valid-msg"},z.content)]))),e("td",{class:["vxe-body--column",p.id,(_defineProperty(e={},"col--".concat(J),J),_defineProperty(e,"col--".concat(V),V),_defineProperty(e,"col--last",f===h.length-1),_defineProperty(e,"col--tree-node",ee),_defineProperty(e,"col--edit",N),_defineProperty(e,"col--ellipsis",Q),_defineProperty(e,"fixed--hidden",_),_defineProperty(e,"col--dirty",v),_defineProperty(e,"col--actived",q&&N&&le.row===s&&(le.column===p||"row"===W.mode)),_defineProperty(e,"col--valid-error",I),_defineProperty(e,"col--current",k===p),e),_tools.UtilTools.getClass(Z,de),_tools.UtilTools.getClass(E,de)],key:b?p.id:f,attrs:w,style:Object.assign({height:Q&&te?"".concat(te,"px"):""},Y?_xeUtils.default.isFunction(Y)?Y(de):Y:null),on:D},K)}function renderRows(u,p,f,h,y,v,g,m){var x=f.stripe,w=f.rowKey,b=f.highlightHoverRow,T=f.rowClassName,_=f.rowStyle,S=f.editConfig,O=f.showOverflow,$=f.treeConfig,C=f.treeOpts,L=f.editOpts,I=f.treeExpandeds,k=f.scrollYLoad,E=f.scrollYStore,Y=f.editStore,R=f.rowExpandeds,A=f.radioOpts,H=f.checkboxOpts,P=f.expandColumn,B=f.hasFixedColumn,M=[];return g.forEach(function(t,o){var e={},r=(n=o)+1;k&&(r+=E.startIndex);var i=f.getVTRowIndex(t),n=f.getRowIndex(t);b&&(e.mouseenter=function(e){isOperateMouse(f)||f.triggerHoverEvent(e,{row:t,rowIndex:n})},e.mouseleave=function(){isOperateMouse(f)||f.clearHoverRow()});var l,a,s=_tools.UtilTools.getRowid(f,t),c={$table:f,$seq:h,seq:r,rowid:s,fixed:v,type:renderType,level:y,row:t,rowIndex:n,$rowIndex:o},d=!1;S&&(d=-1<Y.insertList.indexOf(t)),M.push(u("tr",{class:["vxe-body--row",{"row--stripe":x&&(f.getVTRowIndex(t)+1)%2==0,"is--new":d,"row--new":d&&(L.showStatus||L.showInsertStatus),"row--radio":A.highlight&&f.selectRow===t,"row--checked":H.highlight&&f.isCheckedByCheckboxRow(t)},T?_xeUtils.default.isFunction(T)?T(c):T:""],attrs:{rowid:s},style:_?_xeUtils.default.isFunction(_)?_(c):_:null,key:w||$?s:o,on:e},m.map(function(e,l){return renderColumn(u,p,f,h,r,s,v,y,t,n,o,i,e,l,m,g)}))),P&&R.length&&-1<R.indexOf(t)&&($&&(l={paddingLeft:"".concat(y*C.indent+30,"px")}),a=P.showOverflow,c=_xeUtils.default.isUndefined(a)||_xeUtils.default.isNull(a)?O:a,a={$table:f,$seq:h,seq:r,column:P,fixed:v,type:renderType,level:y,row:t,rowIndex:n,$rowIndex:o},M.push(u("tr",{class:"vxe-body--expanded-row",key:"expand_".concat(s),style:_?_xeUtils.default.isFunction(_)?_(a):_:null,on:e},[u("td",{class:["vxe-body--expanded-column",{"fixed--hidden":v&&!B,"col--ellipsis":c}],attrs:{colspan:m.length}},[u("div",{class:"vxe-body--expanded-cell",style:l},[P.renderData(u,a)])])]))),$&&I.length&&((a=t[C.children])&&a.length&&-1<I.indexOf(t)&&M.push.apply(M,_toConsumableArray(renderRows(u,p,f,(h?"".concat(h,"."):"").concat(r),y+1,v,a,m))))}),M}function syncBodyScroll(e,l,t){(l||t)&&(l&&((0,_util.removeScrollListener)(l),l.scrollTop=e),t&&((0,_util.removeScrollListener)(t),t.scrollTop=e),clearTimeout(scrollProcessTimeout),scrollProcessTimeout=setTimeout(function(){(0,_util.restoreScrollListener)(l),(0,_util.restoreScrollListener)(t)},300))}var _default={name:"VxeTableBody",props:{tableData:Array,tableColumn:Array,fixedColumn:Array,size:String,fixedType:String},data:function(){return{wheelTime:null,wheelYSize:0,wheelYInterval:0,wheelYTotal:0}},mounted:function(){var e=this.$parent,l=this.$el,t=this.$refs,o=this.fixedType,e=e.elemStore,o="".concat(o||"main","-body-");e["".concat(o,"wrapper")]=l,e["".concat(o,"table")]=t.table,e["".concat(o,"colgroup")]=t.colgroup,e["".concat(o,"list")]=t.tbody,e["".concat(o,"xSpace")]=t.xSpace,e["".concat(o,"ySpace")]=t.ySpace,e["".concat(o,"emptyBlock")]=t.emptyBlock,this.$el.onscroll=this.scrollEvent,this.$el._onscroll=this.scrollEvent},beforeDestroy:function(){clearTimeout(this.wheelTime),this.$el._onscroll=null,this.$el.onscroll=null},render:function(t){var e=this._e,l=this.$parent,o=this.fixedColumn,r=this.fixedType,i=l.$scopedSlots,n=l.tId,a=l.tableData,s=l.tableColumn,c=l.visibleColumn,d=l.showOverflow,u=l.keyboardConfig,p=l.keyboardOpts,f=l.mergeList,h=l.spanMethod,y=l.scrollXLoad,v=l.scrollYLoad,g=l.isAllOverflow,m=l.emptyOpts,x=l.mouseConfig,w=l.mouseOpts,b=l.sYOpts;return r&&(s=!(y||v||d&&g)||f.length||h||u&&p.isMerge?c:o),m=i.empty?i.empty.call(this,{$table:l},t):(i=(i=m.name?_vXETable.default.renderer.get(m.name):null)?i.renderEmpty:null)?i.call(this,t,m,{$table:l}):l.emptyText||_conf.default.i18n("vxe.table.emptyText"),t("div",{class:["vxe-table--body-wrapper",r?"fixed-".concat(r,"--wrapper"):"body--wrapper"],attrs:{xid:n},on:v&&"wheel"===b.mode?{wheel:this.wheelEvent}:{}},[r?e():t("div",{class:"vxe-body--x-space",ref:"xSpace"}),t("div",{class:"vxe-body--y-space",ref:"ySpace"}),t("table",{class:"vxe-table--body",attrs:{xid:n,cellspacing:0,cellpadding:0,border:0},ref:"table"},[t("colgroup",{ref:"colgroup"},s.map(function(e,l){return t("col",{attrs:{name:e.id},key:l})})),t("tbody",{ref:"tbody"},renderRows(t,this,l,"",0,r,a,s))]),t("div",{class:"vxe-table--checkbox-range"}),x&&w.area?t("div",{class:"vxe-table--cell-area"},[t("span",{class:"vxe-table--cell-main-area"},w.extension?[t("span",{class:"vxe-table--cell-main-area-btn",on:{mousedown:function(e){l.triggerCellExtendMousedownEvent(e,{$table:l,fixed:r,type:renderType})}}})]:null),t("span",{class:"vxe-table--cell-copy-area"}),t("span",{class:"vxe-table--cell-extend-area"}),t("span",{class:"vxe-table--cell-multi-area"}),t("span",{class:"vxe-table--cell-active-area"})]):null,r?null:t("div",{class:"vxe-table--empty-block",ref:"emptyBlock"},[t("div",{class:"vxe-table--empty-content"},m)])])},methods:{scrollEvent:function(e){var l=this.$el,t=this.$parent,o=this.fixedType,r=t.$refs,i=t.elemStore,n=t.highlightHoverRow,a=t.scrollXLoad,s=t.scrollYLoad,c=t.lastScrollTop,d=t.lastScrollLeft,u=r.tableHeader,p=r.tableBody,f=r.leftBody,h=r.rightBody,y=r.tableFooter,v=r.validTip,g=u?u.$el:null,r=y?y.$el:null,u=p.$el,y=f?f.$el:null,p=h?h.$el:null,f=i["main-body-ySpace"],h=i["main-body-xSpace"],i=f?f.clientHeight:0,f=h?h.clientWidth:0,h=l.scrollTop,l=u.scrollLeft,d=l!==d,c=h!==c;t.lastScrollTop=h,t.lastScrollLeft=l,t.lastScrollTime=Date.now(),n&&t.clearHoverRow(),y&&"left"===o?syncBodyScroll(h=y.scrollTop,u,p):p&&"right"===o?syncBodyScroll(h=p.scrollTop,u,y):(d&&(g&&(g.scrollLeft=u.scrollLeft),r&&(r.scrollLeft=u.scrollLeft)),(y||p)&&(t.checkScrolling(),c&&syncBodyScroll(h,y,p))),a&&d&&t.triggerScrollXEvent(e),s&&c&&t.triggerScrollYEvent(e),d&&v&&v.visible&&v.updatePlacement(),t.emitEvent("scroll",{type:renderType,fixed:o,scrollTop:h,scrollLeft:l,bodyHeight:i,bodyWidth:f,isX:d,isY:c},e)},handleWheel:function(a,s,e,c,d){var u=this,p=this.$parent,l=p.$refs,t=p.elemStore,o=l.tableBody,r=l.leftBody,l=l.rightBody,f=o.$el,h=r?r.$el:null,y=l?l.$el:null,r=this.isPrevWheelTop===s?Math.max(0,this.wheelYSize-this.wheelYTotal):0,l=t["main-body-ySpace"],t=t["main-body-xSpace"],v=l?l.clientHeight:0,g=t?t.clientWidth:0;this.isPrevWheelTop=s,this.wheelYSize=Math.abs(s?e-r:e+r),this.wheelYInterval=0,this.wheelYTotal=0,clearTimeout(this.wheelTime),function e(){var l,t,o=u.fixedType,r=u.wheelYTotal,i=u.wheelYSize,n=u.wheelYInterval;r<i&&(i<(r+=n=Math.max(5,Math.floor(1.5*n)))&&(n-=r-i),t=f.scrollTop,l=f.clientHeight,i=f.scrollHeight,t=t+n*(s?-1:1),f.scrollTop=t,h&&(h.scrollTop=t),y&&(y.scrollTop=t),(s?t<i-l:0<=t)&&(u.wheelTime=setTimeout(e,10)),u.wheelYTotal=r,u.wheelYInterval=n,p.emitEvent("scroll",{type:renderType,fixed:o,scrollTop:f.scrollTop,scrollLeft:f.scrollLeft,bodyHeight:v,bodyWidth:g,isX:c,isY:d},a))}()},wheelEvent:function(e){var l=e.deltaY,t=e.deltaX,o=this.$el,r=this.$parent,i=r.$refs,n=r.highlightHoverRow,a=r.scrollYLoad,s=r.lastScrollTop,c=r.lastScrollLeft,d=i.tableBody.$el,i=_dom.browse.firefox?40*l:l,l=_dom.browse.firefox?40*t:t,t=i<0;(t?o.scrollTop<=0:o.scrollTop>=o.scrollHeight-o.clientHeight)||(o=o.scrollTop+i,c=(l=d.scrollLeft+l)!==c,(s=o!==s)&&(e.preventDefault(),r.lastScrollTop=o,r.lastScrollLeft=l,r.lastScrollTime=Date.now(),n&&r.clearHoverRow(),this.handleWheel(e,t,i,c,s),a&&r.triggerScrollYEvent(e)))}}};exports.default=_default;
|
|
@@ -40,6 +40,10 @@ var _default2 = {
|
|
|
40
40
|
type: [String, Number],
|
|
41
41
|
default: 2
|
|
42
42
|
},
|
|
43
|
+
cols: {
|
|
44
|
+
type: [String, Number],
|
|
45
|
+
default: null
|
|
46
|
+
},
|
|
43
47
|
showWordCount: Boolean,
|
|
44
48
|
countMethod: Function,
|
|
45
49
|
autosize: [Boolean, Object],
|
|
@@ -123,14 +127,18 @@ var _default2 = {
|
|
|
123
127
|
maxlength = this.maxlength,
|
|
124
128
|
autosize = this.autosize,
|
|
125
129
|
showWordCount = this.showWordCount,
|
|
126
|
-
countMethod = this.countMethod
|
|
130
|
+
countMethod = this.countMethod,
|
|
131
|
+
rows = this.rows,
|
|
132
|
+
cols = this.cols;
|
|
127
133
|
var attrs = {
|
|
128
134
|
name: name,
|
|
129
135
|
form: form,
|
|
130
136
|
placeholder: placeholder,
|
|
131
137
|
maxlength: maxlength,
|
|
132
138
|
readonly: readonly,
|
|
133
|
-
disabled: disabled
|
|
139
|
+
disabled: disabled,
|
|
140
|
+
rows: rows,
|
|
141
|
+
cols: cols
|
|
134
142
|
};
|
|
135
143
|
|
|
136
144
|
if (placeholder) {
|
|
@@ -138,7 +146,7 @@ var _default2 = {
|
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
return h('div', {
|
|
141
|
-
class: ['vxe-textarea', className, (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, 'is--autosize', autosize), _defineProperty(_ref, 'is--disabled', disabled), _ref)]
|
|
149
|
+
class: ['vxe-textarea', className, (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, 'is--autosize', autosize), _defineProperty(_ref, 'is--disabled', disabled), _defineProperty(_ref, 'def--rows', !_xeUtils.default.eqNull(rows)), _defineProperty(_ref, 'def--cols', !_xeUtils.default.eqNull(cols)), _ref)]
|
|
142
150
|
}, [h('textarea', {
|
|
143
151
|
ref: 'textarea',
|
|
144
152
|
class: 'vxe-textarea--inner',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var autoTxtElem,_xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var autoTxtElem,_xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var _default2={name:"VxeTextarea",mixins:[_size.default],model:{prop:"value",event:"modelValue"},props:{value:[String,Number],immediate:{type:Boolean,default:!0},name:String,readonly:Boolean,disabled:Boolean,placeholder:String,maxlength:[String,Number],rows:{type:[String,Number],default:2},cols:{type:[String,Number],default:null},showWordCount:Boolean,countMethod:Function,autosize:[Boolean,Object],form:String,resize:{type:String,default:function(){return _conf.default.textarea.resize}},className:String,size:{type:String,default:function(){return _conf.default.textarea.size||_conf.default.size}}},data:function(){return{inputValue:this.value}},computed:{inputCount:function(){return _xeUtils.default.getSize(this.inputValue)},isCountError:function(){return this.maxlength&&this.inputCount>_xeUtils.default.toNumber(this.maxlength)},defaultEvents:function(){var i=this,n={};return _xeUtils.default.each(this.$listeners,function(e,t){-1===["input","change","blur"].indexOf(t)&&(n[t]=i.triggerEvent)}),n.input=this.inputEvent,n.change=this.changeEvent,n.blur=this.blurEvent,n},sizeOpts:function(){return Object.assign({minRows:1,maxRows:10},_conf.default.textarea.autosize,this.autosize)}},watch:{value:function(e){this.inputValue=e,this.updateAutoTxt()}},mounted:function(){this.autosize&&(this.updateAutoTxt(),this.handleResize())},render:function(e){var t=this.className,i=this.defaultEvents,n=this.inputValue,a=this.vSize,u=this.name,s=this.form,r=this.resize,o=this.placeholder,l=this.readonly,d=this.disabled,h=this.maxlength,c=this.autosize,f=this.showWordCount,p=this.countMethod,m=this.rows,x=this.cols,l={name:u,form:s,placeholder:o,maxlength:h,readonly:l,disabled:d,rows:m,cols:x};return o&&(l.placeholder=_tools.UtilTools.getFuncText(o)),e("div",{class:["vxe-textarea",t,(_defineProperty(t={},"size--".concat(a),a),_defineProperty(t,"is--autosize",c),_defineProperty(t,"is--disabled",d),_defineProperty(t,"def--rows",!_xeUtils.default.eqNull(m)),_defineProperty(t,"def--cols",!_xeUtils.default.eqNull(x)),t)]},[e("textarea",{ref:"textarea",class:"vxe-textarea--inner",domProps:{value:n},attrs:l,style:r?{resize:r}:null,on:i}),f?e("span",{class:["vxe-textarea--count",{"is--error":this.isCountError}]},p?"".concat(p({value:n})):"".concat(this.inputCount).concat(h?"/".concat(h):"")):null])},methods:{focus:function(){return this.$refs.textarea.focus(),this.$nextTick()},blur:function(){return this.$refs.textarea.blur(),this.$nextTick()},triggerEvent:function(e){var t=this.inputValue;this.$emit(e.type,{value:t,$event:e})},emitUpdate:function(e,t){this.inputValue=e,this.$emit("modelValue",e),this.value!==e&&this.$emit("change",{value:e,$event:t})},inputEvent:function(e){var t=this.immediate,i=e.target.value;this.inputValue=i,t&&this.emitUpdate(i,e),this.handleResize(),this.triggerEvent(e)},changeEvent:function(e){this.immediate?this.triggerEvent(e):this.emitUpdate(this.inputValue,e)},blurEvent:function(e){var t=this.inputValue;this.immediate||this.emitUpdate(t,e),this.$emit("blur",{value:t,$event:e})},updateAutoTxt:function(){var e,t=this.$refs,i=this.inputValue,n=this.size;this.autosize&&((autoTxtElem=autoTxtElem||document.createElement("div")).parentNode||document.body.appendChild(autoTxtElem),e=t.textarea,t=getComputedStyle(e),autoTxtElem.className=["vxe-textarea--autosize",n?"size--".concat(n):""].join(" "),autoTxtElem.style.width="".concat(e.clientWidth,"px"),autoTxtElem.style.padding=t.padding,autoTxtElem.innerHTML=(""+(i||" ")).replace(/\n$/,"\n "))},handleResize:function(){var r=this;this.autosize&&this.$nextTick(function(){var e=r.$refs,t=r.sizeOpts,i=t.minRows,n=t.maxRows,a=e.textarea,u=autoTxtElem.clientHeight,s=getComputedStyle(a),t=_xeUtils.default.toNumber(s.lineHeight),e=_xeUtils.default.toNumber(s.paddingTop)+_xeUtils.default.toNumber(s.paddingBottom)+_xeUtils.default.toNumber(s.borderTopWidth)+_xeUtils.default.toNumber(s.borderBottomWidth),s=(u-e)/t,u=s&&/[0-9]/.test(s)?s:Math.floor(s)+1,s=u;u<i?s=i:n<u&&(s=n),a.style.height="".concat(s*t+e,"px")})}}};exports.default=_default2;
|
|
@@ -25,8 +25,11 @@
|
|
|
25
25
|
/*pulldown*/
|
|
26
26
|
.vxe-textarea {
|
|
27
27
|
position: relative;
|
|
28
|
-
display: inline-block;
|
|
29
|
-
|
|
28
|
+
display: inline-block; }
|
|
29
|
+
.vxe-textarea:not(.def--cols) {
|
|
30
|
+
width: 100%; }
|
|
31
|
+
.vxe-textarea:not(.def--cols) .vxe-textarea--inner {
|
|
32
|
+
width: 100%; }
|
|
30
33
|
|
|
31
34
|
.vxe-textarea--inner {
|
|
32
35
|
border-radius: 4px;
|
|
@@ -36,16 +39,7 @@
|
|
|
36
39
|
color: #606266;
|
|
37
40
|
line-height: inherit;
|
|
38
41
|
border: 1px solid #dcdfe6;
|
|
39
|
-
background-color: #fff;
|
|
40
|
-
.vxe-textarea--inner:focus {
|
|
41
|
-
border: 1px solid #409eff; }
|
|
42
|
-
.vxe-textarea--inner[disabled] {
|
|
43
|
-
cursor: not-allowed;
|
|
44
|
-
background-color: #f3f3f3; }
|
|
45
|
-
|
|
46
|
-
.vxe-textarea--inner {
|
|
47
|
-
width: 100%;
|
|
48
|
-
height: 100%;
|
|
42
|
+
background-color: #fff;
|
|
49
43
|
display: block;
|
|
50
44
|
padding: 0.3em 0.6em; }
|
|
51
45
|
.vxe-textarea--inner::-webkit-input-placeholder {
|
|
@@ -58,6 +52,11 @@
|
|
|
58
52
|
color: #C0C4CC; }
|
|
59
53
|
.vxe-textarea--inner::placeholder {
|
|
60
54
|
color: #C0C4CC; }
|
|
55
|
+
.vxe-textarea--inner:focus {
|
|
56
|
+
border: 1px solid #409eff; }
|
|
57
|
+
.vxe-textarea--inner[disabled] {
|
|
58
|
+
cursor: not-allowed;
|
|
59
|
+
background-color: #f3f3f3; }
|
|
61
60
|
|
|
62
61
|
.vxe-textarea--inner,
|
|
63
62
|
.vxe-textarea--autosize {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.vxe-textarea{position:relative;display:inline-block
|
|
1
|
+
.vxe-textarea{position:relative;display:inline-block}.vxe-textarea:not(.def--cols){width:100%}.vxe-textarea:not(.def--cols) .vxe-textarea--inner{width:100%}.vxe-textarea--inner{border-radius:4px;outline:0;font-size:inherit;padding:0 .6em;color:#606266;line-height:inherit;border:1px solid #dcdfe6;background-color:#fff;display:block;padding:.3em .6em}.vxe-textarea--inner::-webkit-input-placeholder{color:#c0c4cc}.vxe-textarea--inner::-moz-placeholder{color:#c0c4cc}.vxe-textarea--inner:-ms-input-placeholder{color:#c0c4cc}.vxe-textarea--inner::-ms-input-placeholder{color:#c0c4cc}.vxe-textarea--inner::placeholder{color:#c0c4cc}.vxe-textarea--inner:focus{border:1px solid #409eff}.vxe-textarea--inner[disabled]{cursor:not-allowed;background-color:#f3f3f3}.vxe-textarea--autosize,.vxe-textarea--inner{line-height:1.5715;color:#606266;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}.vxe-textarea--autosize{display:block;position:fixed;top:0;left:0;width:100%;margin:0;padding:.3em .6em;word-wrap:break-word;white-space:pre-wrap;z-index:-1;visibility:hidden}.vxe-textarea--count{position:absolute;bottom:.2em;right:1.4em;padding-left:.2em;color:#999;background-color:#fff}.vxe-textarea--count.is--error{color:#f56c6c}.vxe-textarea,.vxe-textarea--autosize{font-size:14px}.vxe-textarea--autosize.size--medium,.vxe-textarea.size--medium{font-size:14px}.vxe-textarea--autosize.size--small,.vxe-textarea.size--small{font-size:13px}.vxe-textarea--autosize.size--mini,.vxe-textarea.size--mini{font-size:12px}.vxe-textarea:not(.is--autosize){min-height:34px}.vxe-textarea.size--medium{font-size:14px}.vxe-textarea.size--medium:not(.is--autosize){min-height:32px}.vxe-textarea.size--small:not(.is--autosize){min-height:30px}.vxe-textarea.size--mini:not(.is--autosize){min-height:28px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "3.3.14-beta.
|
|
3
|
+
"version": "3.3.14-beta.1",
|
|
4
4
|
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、弹窗、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"vxe-table-plugin-virtual-tree": "0.6.10",
|
|
89
89
|
"xe-ajax": "^4.0.5",
|
|
90
90
|
"xe-clipboard": "^1.10.1",
|
|
91
|
-
"xe-utils": "^3.
|
|
91
|
+
"xe-utils": "^3.4.0",
|
|
92
92
|
"xlsx": "^0.17.0"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import VxeFormItem from './form-item'
|
|
2
|
+
import { UtilTools } from '../../tools'
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
name: 'VxeFormGather',
|
|
@@ -8,6 +9,15 @@ export default {
|
|
|
8
9
|
xeformgather: this
|
|
9
10
|
}
|
|
10
11
|
},
|
|
12
|
+
created () {
|
|
13
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
14
|
+
this.$nextTick(() => {
|
|
15
|
+
if (this.$xeform && this.$xeform.customLayout) {
|
|
16
|
+
UtilTools.error('vxe.error.errConflicts', ['custom-layout', '<form-gather ...>'])
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
},
|
|
11
21
|
render (h) {
|
|
12
22
|
return h('div', this.$slots.default)
|
|
13
23
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
|
+
import VXETable from '../../v-x-e-table'
|
|
4
|
+
import { UtilTools, isEnableConf } from '../../tools'
|
|
1
5
|
import { createItem, destroyItem, assemItem } from './util'
|
|
6
|
+
import { renderTitle } from './render'
|
|
2
7
|
|
|
3
8
|
const props = {
|
|
4
9
|
title: String,
|
|
@@ -27,6 +32,100 @@ Object.keys(props).forEach(name => {
|
|
|
27
32
|
}
|
|
28
33
|
})
|
|
29
34
|
|
|
35
|
+
const renderItem = (h, _vm, item, slots) => {
|
|
36
|
+
const { rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
|
|
37
|
+
const { title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow } = item
|
|
38
|
+
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
39
|
+
const span = item.span || _vm.span
|
|
40
|
+
const align = item.align || _vm.align
|
|
41
|
+
const titleAlign = item.titleAlign || _vm.titleAlign
|
|
42
|
+
const titleWidth = item.titleWidth || _vm.titleWidth
|
|
43
|
+
let itemVisibleMethod = visibleMethod
|
|
44
|
+
const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
|
|
45
|
+
const showEllipsis = itemOverflow === 'ellipsis'
|
|
46
|
+
const showTitle = itemOverflow === 'title'
|
|
47
|
+
const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
|
|
48
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
49
|
+
const params = { data, property: field, item, $form: _vm }
|
|
50
|
+
let isRequired
|
|
51
|
+
if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
|
|
52
|
+
itemVisibleMethod = compConf.itemVisibleMethod
|
|
53
|
+
}
|
|
54
|
+
if (rules) {
|
|
55
|
+
const itemRules = rules[field]
|
|
56
|
+
if (itemRules) {
|
|
57
|
+
isRequired = itemRules.some(rule => rule.required)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
let contentVNs = []
|
|
61
|
+
if (slots && slots.default) {
|
|
62
|
+
contentVNs = _vm.callSlot(slots.default, params, h)
|
|
63
|
+
} else if (compConf && compConf.renderItemContent) {
|
|
64
|
+
contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params)
|
|
65
|
+
} else if (compConf && compConf.renderItem) {
|
|
66
|
+
contentVNs = compConf.renderItem.call(_vm, h, itemRender, params)
|
|
67
|
+
} else if (field) {
|
|
68
|
+
contentVNs = [`${XEUtils.get(data, field)}`]
|
|
69
|
+
}
|
|
70
|
+
const ons = showTooltip ? {
|
|
71
|
+
mouseenter (evnt) {
|
|
72
|
+
_vm.triggerHeaderHelpEvent(evnt, params)
|
|
73
|
+
},
|
|
74
|
+
mouseleave: _vm.handleTargetLeaveEvent
|
|
75
|
+
} : {}
|
|
76
|
+
return h('div', {
|
|
77
|
+
class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
|
|
78
|
+
'is--title': title,
|
|
79
|
+
'is--required': isRequired,
|
|
80
|
+
'is--hidden': visible === false || (folding && collapseAll),
|
|
81
|
+
'is--active': !itemVisibleMethod || itemVisibleMethod(params),
|
|
82
|
+
'is--error': showError
|
|
83
|
+
}]
|
|
84
|
+
}, [
|
|
85
|
+
h('div', {
|
|
86
|
+
class: 'vxe-form--item-inner'
|
|
87
|
+
}, [
|
|
88
|
+
title || (slots && slots.title) ? h('div', {
|
|
89
|
+
class: ['vxe-form--item-title', titleAlign ? `align--${titleAlign}` : null, {
|
|
90
|
+
'is--ellipsis': hasEllipsis
|
|
91
|
+
}],
|
|
92
|
+
style: titleWidth ? {
|
|
93
|
+
width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
|
|
94
|
+
} : null,
|
|
95
|
+
attrs: {
|
|
96
|
+
title: showTitle ? UtilTools.getFuncText(title) : null
|
|
97
|
+
},
|
|
98
|
+
on: ons
|
|
99
|
+
}, renderTitle(h, _vm, item)) : null,
|
|
100
|
+
h('div', {
|
|
101
|
+
class: ['vxe-form--item-content', align ? `align--${align}` : null]
|
|
102
|
+
}, contentVNs.concat(
|
|
103
|
+
[
|
|
104
|
+
collapseNode ? h('div', {
|
|
105
|
+
class: 'vxe-form--item-trigger-node',
|
|
106
|
+
on: {
|
|
107
|
+
click: _vm.toggleCollapseEvent
|
|
108
|
+
}
|
|
109
|
+
}, [
|
|
110
|
+
h('span', {
|
|
111
|
+
class: 'vxe-form--item-trigger-text'
|
|
112
|
+
}, collapseAll ? GlobalConfig.i18n('vxe.form.unfolding') : GlobalConfig.i18n('vxe.form.folding')),
|
|
113
|
+
h('i', {
|
|
114
|
+
class: ['vxe-form--item-trigger-icon', collapseAll ? GlobalConfig.icon.FORM_FOLDING : GlobalConfig.icon.FORM_UNFOLDING]
|
|
115
|
+
})
|
|
116
|
+
]) : null,
|
|
117
|
+
errRule && validOpts.showMessage ? h('div', {
|
|
118
|
+
class: 'vxe-form--item-valid',
|
|
119
|
+
style: errRule.maxWidth ? {
|
|
120
|
+
width: `${errRule.maxWidth}px`
|
|
121
|
+
} : null
|
|
122
|
+
}, errRule.message) : null
|
|
123
|
+
])
|
|
124
|
+
)
|
|
125
|
+
])
|
|
126
|
+
])
|
|
127
|
+
}
|
|
128
|
+
|
|
30
129
|
export default {
|
|
31
130
|
name: 'VxeFormItem',
|
|
32
131
|
props,
|
|
@@ -49,6 +148,7 @@ export default {
|
|
|
49
148
|
destroyItem(this)
|
|
50
149
|
},
|
|
51
150
|
render (h) {
|
|
52
|
-
|
|
151
|
+
const { $xeform } = this
|
|
152
|
+
return $xeform && $xeform.customLayout ? renderItem(h, $xeform, this.itemConfig, this.$scopedSlots) : h('div')
|
|
53
153
|
}
|
|
54
154
|
}
|
|
@@ -2,8 +2,9 @@ import XEUtils from 'xe-utils'
|
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
import vSize from '../../mixins/size'
|
|
4
4
|
import VXETable from '../../v-x-e-table'
|
|
5
|
-
import { UtilTools, isEnableConf } from '../../tools'
|
|
5
|
+
import { UtilTools, DomTools, isEnableConf } from '../../tools'
|
|
6
6
|
import { createItem } from './util'
|
|
7
|
+
import { renderTitle } from './render'
|
|
7
8
|
import { eqEmptyValue } from '../../tools/src/utils'
|
|
8
9
|
import { browse } from '../../tools/src/dom'
|
|
9
10
|
|
|
@@ -57,95 +58,6 @@ function getResetValue (value, resetValue) {
|
|
|
57
58
|
return resetValue
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
function callSlot (_vm, slotFunc, params, h) {
|
|
61
|
-
if (slotFunc) {
|
|
62
|
-
const { $scopedSlots } = _vm
|
|
63
|
-
if (XEUtils.isString(slotFunc)) {
|
|
64
|
-
slotFunc = $scopedSlots[slotFunc] || null
|
|
65
|
-
}
|
|
66
|
-
if (XEUtils.isFunction(slotFunc)) {
|
|
67
|
-
return slotFunc.call(_vm, params, h)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return []
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function renderPrefixIcon (h, titlePrefix) {
|
|
74
|
-
return h('span', {
|
|
75
|
-
class: 'vxe-form--item-title-prefix'
|
|
76
|
-
}, [
|
|
77
|
-
h('i', {
|
|
78
|
-
class: titlePrefix.icon || GlobalConfig.icon.FORM_PREFIX
|
|
79
|
-
})
|
|
80
|
-
])
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function renderSuffixIcon (h, titleSuffix) {
|
|
84
|
-
return h('span', {
|
|
85
|
-
class: 'vxe-form--item-title-suffix'
|
|
86
|
-
}, [
|
|
87
|
-
h('i', {
|
|
88
|
-
class: titleSuffix.icon || GlobalConfig.icon.FORM_SUFFIX
|
|
89
|
-
})
|
|
90
|
-
])
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function renderTitle (h, _vm, item) {
|
|
94
|
-
const { data } = _vm
|
|
95
|
-
const { slots, field, itemRender, titlePrefix, titleSuffix } = item
|
|
96
|
-
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
97
|
-
const params = { data, property: field, item, $form: _vm }
|
|
98
|
-
const contVNs = []
|
|
99
|
-
const titVNs = []
|
|
100
|
-
if (titlePrefix) {
|
|
101
|
-
titVNs.push(
|
|
102
|
-
titlePrefix.message
|
|
103
|
-
? h('vxe-tooltip', {
|
|
104
|
-
props: {
|
|
105
|
-
content: UtilTools.getFuncText(titlePrefix.message),
|
|
106
|
-
enterable: titlePrefix.enterable,
|
|
107
|
-
theme: titlePrefix.theme
|
|
108
|
-
}
|
|
109
|
-
}, [
|
|
110
|
-
renderPrefixIcon(h, titlePrefix)
|
|
111
|
-
])
|
|
112
|
-
: renderPrefixIcon(h, titlePrefix)
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
titVNs.push(
|
|
116
|
-
h('span', {
|
|
117
|
-
class: 'vxe-form--item-title-label'
|
|
118
|
-
}, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : (slots && slots.title ? callSlot(_vm, slots.title, params, h) : UtilTools.getFuncText(item.title)))
|
|
119
|
-
)
|
|
120
|
-
contVNs.push(
|
|
121
|
-
h('div', {
|
|
122
|
-
class: 'vxe-form--item-title-content'
|
|
123
|
-
}, titVNs)
|
|
124
|
-
)
|
|
125
|
-
const fixVNs = []
|
|
126
|
-
if (titleSuffix) {
|
|
127
|
-
fixVNs.push(
|
|
128
|
-
titleSuffix.message
|
|
129
|
-
? h('vxe-tooltip', {
|
|
130
|
-
props: {
|
|
131
|
-
content: UtilTools.getFuncText(titleSuffix.message),
|
|
132
|
-
enterable: titleSuffix.enterable,
|
|
133
|
-
theme: titleSuffix.theme
|
|
134
|
-
}
|
|
135
|
-
}, [
|
|
136
|
-
renderSuffixIcon(h, titleSuffix)
|
|
137
|
-
])
|
|
138
|
-
: renderSuffixIcon(h, titleSuffix)
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
contVNs.push(
|
|
142
|
-
h('div', {
|
|
143
|
-
class: 'vxe-form--item-title-postfix'
|
|
144
|
-
}, fixVNs)
|
|
145
|
-
)
|
|
146
|
-
return contVNs
|
|
147
|
-
}
|
|
148
|
-
|
|
149
61
|
function renderItems (h, _vm, itemList) {
|
|
150
62
|
const { _e, rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
|
|
151
63
|
return itemList.map((item, index) => {
|
|
@@ -185,7 +97,7 @@ function renderItems (h, _vm, itemList) {
|
|
|
185
97
|
}
|
|
186
98
|
let contentVNs = []
|
|
187
99
|
if (slots && slots.default) {
|
|
188
|
-
contentVNs = callSlot(
|
|
100
|
+
contentVNs = _vm.callSlot(slots.default, params, h)
|
|
189
101
|
} else if (compConf && compConf.renderItemContent) {
|
|
190
102
|
contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params)
|
|
191
103
|
} else if (compConf && compConf.renderItem) {
|
|
@@ -258,6 +170,7 @@ export default {
|
|
|
258
170
|
name: 'VxeForm',
|
|
259
171
|
mixins: [vSize],
|
|
260
172
|
props: {
|
|
173
|
+
collapseStatus: { type: Boolean, default: true },
|
|
261
174
|
loading: Boolean,
|
|
262
175
|
data: Object,
|
|
263
176
|
size: { type: String, default: () => GlobalConfig.form.size || GlobalConfig.size },
|
|
@@ -272,11 +185,12 @@ export default {
|
|
|
272
185
|
items: Array,
|
|
273
186
|
rules: Object,
|
|
274
187
|
preventSubmit: { type: Boolean, default: () => GlobalConfig.form.preventSubmit },
|
|
275
|
-
validConfig: Object
|
|
188
|
+
validConfig: Object,
|
|
189
|
+
customLayout: { type: Boolean, default: () => GlobalConfig.form.customLayout }
|
|
276
190
|
},
|
|
277
191
|
data () {
|
|
278
192
|
return {
|
|
279
|
-
collapseAll:
|
|
193
|
+
collapseAll: this.collapseStatus,
|
|
280
194
|
staticItems: [],
|
|
281
195
|
formItems: [],
|
|
282
196
|
|
|
@@ -305,24 +219,32 @@ export default {
|
|
|
305
219
|
return opts
|
|
306
220
|
}
|
|
307
221
|
},
|
|
308
|
-
created () {
|
|
309
|
-
this.$nextTick(() => {
|
|
310
|
-
const { items } = this
|
|
311
|
-
if (items) {
|
|
312
|
-
this.loadItem(items)
|
|
313
|
-
}
|
|
314
|
-
})
|
|
315
|
-
},
|
|
316
222
|
watch: {
|
|
317
223
|
staticItems (value) {
|
|
318
224
|
this.formItems = value
|
|
319
225
|
},
|
|
320
226
|
items (value) {
|
|
321
227
|
this.loadItem(value)
|
|
228
|
+
},
|
|
229
|
+
collapseStatus (value) {
|
|
230
|
+
this.collapseAll = !!value
|
|
322
231
|
}
|
|
323
232
|
},
|
|
233
|
+
created () {
|
|
234
|
+
this.$nextTick(() => {
|
|
235
|
+
const { items } = this
|
|
236
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
237
|
+
if (this.customLayout && this.items) {
|
|
238
|
+
UtilTools.error('vxe.error.errConflicts', ['custom-layout', 'items'])
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (items) {
|
|
242
|
+
this.loadItem(items)
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
},
|
|
324
246
|
render (h) {
|
|
325
|
-
const { _e, loading, className, data, vSize, tooltipOpts, formItems } = this
|
|
247
|
+
const { _e, loading, className, data, vSize, tooltipOpts, formItems, customLayout } = this
|
|
326
248
|
const hasUseTooltip = VXETable._tooltip
|
|
327
249
|
return h('form', {
|
|
328
250
|
class: ['vxe-form', className ? (XEUtils.isFunction(className) ? className({ items: formItems, data, $form: this }) : className) : '', {
|
|
@@ -338,11 +260,11 @@ export default {
|
|
|
338
260
|
}, [
|
|
339
261
|
h('div', {
|
|
340
262
|
class: 'vxe-form--wrapper vxe-row'
|
|
341
|
-
}, renderItems(h, this, formItems)),
|
|
263
|
+
}, customLayout ? this.$slots.default : renderItems(h, this, formItems)),
|
|
342
264
|
h('div', {
|
|
343
265
|
class: 'vxe-form-slots',
|
|
344
266
|
ref: 'hideItem'
|
|
345
|
-
}, this.$slots.default),
|
|
267
|
+
}, customLayout ? [] : this.$slots.default),
|
|
346
268
|
h('div', {
|
|
347
269
|
class: ['vxe-loading', {
|
|
348
270
|
'is--visible': loading
|
|
@@ -362,6 +284,18 @@ export default {
|
|
|
362
284
|
])
|
|
363
285
|
},
|
|
364
286
|
methods: {
|
|
287
|
+
callSlot (slotFunc, params, h) {
|
|
288
|
+
if (slotFunc) {
|
|
289
|
+
const { $scopedSlots } = this
|
|
290
|
+
if (XEUtils.isString(slotFunc)) {
|
|
291
|
+
slotFunc = $scopedSlots[slotFunc] || null
|
|
292
|
+
}
|
|
293
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
294
|
+
return slotFunc.call(this, params, h)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return []
|
|
298
|
+
},
|
|
365
299
|
loadItem (list) {
|
|
366
300
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
367
301
|
const { $scopedSlots } = this
|
|
@@ -388,12 +322,16 @@ export default {
|
|
|
388
322
|
return itemList
|
|
389
323
|
},
|
|
390
324
|
toggleCollapse () {
|
|
391
|
-
|
|
325
|
+
const status = !this.collapseAll
|
|
326
|
+
this.collapseAll = status
|
|
327
|
+
this.$emit('update:collapseStatus', status)
|
|
392
328
|
return this.$nextTick()
|
|
393
329
|
},
|
|
394
330
|
toggleCollapseEvent (evnt) {
|
|
395
331
|
this.toggleCollapse()
|
|
396
|
-
|
|
332
|
+
const status = this.collapseAll
|
|
333
|
+
this.$emit('toggle-collapse', { status, collapse: status, data: this.data, $form: this, $event: evnt }, evnt)
|
|
334
|
+
this.$emit('collapse', { status, collapse: status, data: this.data, $form: this, $event: evnt }, evnt)
|
|
397
335
|
},
|
|
398
336
|
submitEvent (evnt) {
|
|
399
337
|
evnt.preventDefault()
|
|
@@ -631,12 +569,16 @@ export default {
|
|
|
631
569
|
handleFocus (fields) {
|
|
632
570
|
const { $el } = this
|
|
633
571
|
const itemList = this.getItems()
|
|
634
|
-
fields.some(property => {
|
|
572
|
+
fields.some((property, index) => {
|
|
635
573
|
const item = itemList.find(item => item.field === property)
|
|
636
574
|
if (item && isEnableConf(item.itemRender)) {
|
|
637
575
|
const { itemRender } = item
|
|
638
576
|
const compConf = VXETable.renderer.get(itemRender.name)
|
|
639
577
|
let inputElem
|
|
578
|
+
// 定位到第一个
|
|
579
|
+
if (!index) {
|
|
580
|
+
DomTools.scrollToView($el.querySelector(`.${item.id}`))
|
|
581
|
+
}
|
|
640
582
|
// 如果指定了聚焦 class
|
|
641
583
|
if (itemRender.autofocus) {
|
|
642
584
|
inputElem = $el.querySelector(`.${item.id} ${itemRender.autofocus}`)
|