vxe-table 3.17.0-beta.13 → 3.17.0-beta.15
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/style.css +1 -1
- package/es/table/module/custom/mixin.js +11 -2
- package/es/table/src/columnInfo.js +4 -0
- package/es/table/src/methods.js +73 -32
- package/es/table/src/table.js +1 -1
- package/es/table/src/util.js +9 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +121 -36
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/mixin.js +15 -2
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/src/columnInfo.js +4 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +91 -33
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +1 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +10 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/module/custom/mixin.ts +11 -2
- package/packages/table/src/columnInfo.ts +5 -0
- package/packages/table/src/methods.ts +76 -33
- package/packages/table/src/table.ts +1 -1
- package/packages/table/src/util.ts +10 -0
- /package/es/{iconfont.1753775808744.ttf → iconfont.1753843895290.ttf} +0 -0
- /package/es/{iconfont.1753775808744.woff → iconfont.1753843895290.woff} +0 -0
- /package/es/{iconfont.1753775808744.woff2 → iconfont.1753843895290.woff2} +0 -0
- /package/lib/{iconfont.1753775808744.ttf → iconfont.1753843895290.ttf} +0 -0
- /package/lib/{iconfont.1753775808744.woff → iconfont.1753843895290.woff} +0 -0
- /package/lib/{iconfont.1753775808744.woff2 → iconfont.1753843895290.woff2} +0 -0
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
8
|
+
var _util = require("../../src/util");
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
function calcMaxHeight($xeTable) {
|
|
10
11
|
const reactData = $xeTable;
|
|
@@ -115,7 +116,7 @@ var _default = exports.default = {
|
|
|
115
116
|
});
|
|
116
117
|
reactData.isCustomStatus = true;
|
|
117
118
|
return $xeTable.saveCustomStore('confirm').then(() => {
|
|
118
|
-
if (allowGroup && allowValues &&
|
|
119
|
+
if (allowGroup && allowValues && !!$xeTable.handlePivotTableAggregateData) {
|
|
119
120
|
if (rowGroupList.length !== aggHandleFields.length || rowGroupList.some((conf, i) => conf.field !== aggHandleFields[i])) {
|
|
120
121
|
// 更新数据分组
|
|
121
122
|
if (aggHandleFields.length) {
|
|
@@ -123,7 +124,7 @@ var _default = exports.default = {
|
|
|
123
124
|
} else {
|
|
124
125
|
$xeTable.clearRowGroups();
|
|
125
126
|
}
|
|
126
|
-
} else {
|
|
127
|
+
} else if (allowValues) {
|
|
127
128
|
// 更新聚合函数
|
|
128
129
|
$xeTable.handleUpdateAggData();
|
|
129
130
|
}
|
|
@@ -193,6 +194,7 @@ var _default = exports.default = {
|
|
|
193
194
|
sort: options === true,
|
|
194
195
|
aggFunc: options === true
|
|
195
196
|
}, options);
|
|
197
|
+
const allCols = [];
|
|
196
198
|
_xeUtils.default.eachTree(collectColumn, column => {
|
|
197
199
|
if (opts.resizable) {
|
|
198
200
|
column.resizeWidth = 0;
|
|
@@ -202,6 +204,7 @@ var _default = exports.default = {
|
|
|
202
204
|
}
|
|
203
205
|
if (opts.sort) {
|
|
204
206
|
column.renderSortNumber = column.sortNumber;
|
|
207
|
+
column.parentId = column.defaultParentId;
|
|
205
208
|
}
|
|
206
209
|
if (!checkMethod || checkMethod({
|
|
207
210
|
$table: $xeTable,
|
|
@@ -214,7 +217,17 @@ var _default = exports.default = {
|
|
|
214
217
|
column.renderAggFn = column.defaultAggFunc;
|
|
215
218
|
}
|
|
216
219
|
column.renderResizeWidth = column.renderWidth;
|
|
220
|
+
allCols.push(column);
|
|
217
221
|
});
|
|
222
|
+
if (opts.sort) {
|
|
223
|
+
const newCollectCols = _xeUtils.default.toArrayTree(_xeUtils.default.orderBy(allCols, 'renderSortNumber'), {
|
|
224
|
+
key: 'id',
|
|
225
|
+
parentKey: 'parentId',
|
|
226
|
+
children: 'children'
|
|
227
|
+
});
|
|
228
|
+
internalData.collectColumn = newCollectCols;
|
|
229
|
+
internalData.tableFullColumn = (0, _util.getColumnList)(newCollectCols);
|
|
230
|
+
}
|
|
218
231
|
reactData.isCustomStatus = false;
|
|
219
232
|
$xeTable.saveCustomStore('reset');
|
|
220
233
|
return $xeTable.handleCustom().then(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function calcMaxHeight(e){var t=e.customStore,e=e.$refs.refElem;let s=0;e&&(s=e.clientHeight-28),t.maxHeight=Math.max(88,s)}function emitCustomEvent(e,t,s){(e.$xeGrid||e).dispatchEvent("custom",{type:t},s)}var _default=exports.default={methods:{_openCustom(){let e=this;var{initStore:t,customStore:s}=e;return s.visible=!0,t.custom=!0,e.handleUpdateCustomColumn(),e.checkCustomStatus(),calcMaxHeight(e),e.$nextTick().then(()=>calcMaxHeight(e))},_closeCustom(){var e=this,t=e.customStore,s=e.computeCustomOpts;return t.visible&&(t.visible=!1,s.immediate||e.handleCustom()),e.$nextTick()},_toggleCustom(){var e=this,t=e.customStore;return t.visible?e.closeCustom():e.openCustom()},_saveCustom(){let e=this;var t=e;let{customColumnList:s,aggHandleFields:i,rowGroupList:l}=t,{allowVisible:o,allowSort:r,allowFixed:u,allowResizable:a,allowGroup:n,allowValues:d}=e.computeCustomOpts;return _xeUtils.default.eachTree(s,(e,t,s,i,l)=>{l?e.fixed=l.fixed:(r&&(e.renderSortNumber=t+1),u&&(e.fixed=e.renderFixed)),a&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),o&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),t.isCustomStatus=!0,e.saveCustomStore("confirm").then(()=>{n&&d&&e.handlePivotTableAggregateData&&(l.length!==i.length||l.some((e,t)=>e.field!==i[t])?i.length?e.setRowGroups(i):e.clearRowGroups():e.handleUpdateAggData())})},_cancelCustom(){var e=this,{customColumnList:t,customStore:s}=e;let{oldSortMaps:l,oldFixedMaps:o,oldVisibleMaps:r}=s,{allowVisible:u,allowSort:a,allowFixed:n,allowResizable:d}=e.computeCustomOpts;return _xeUtils.default.eachTree(t,e=>{var t=e.getKey(),s=!!r[t],i=o[t]||"";u&&(e.renderVisible=s,e.visible=s),n&&(e.renderFixed=i,e.fixed=i),a&&(e.renderSortNumber=l[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),e.$nextTick()},_resetCustom(e){let t=this;var s=t,i=t;let l=s.rowGroupList;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_util=require("../../src/util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function calcMaxHeight(e){var t=e.customStore,e=e.$refs.refElem;let s=0;e&&(s=e.clientHeight-28),t.maxHeight=Math.max(88,s)}function emitCustomEvent(e,t,s){(e.$xeGrid||e).dispatchEvent("custom",{type:t},s)}var _default=exports.default={methods:{_openCustom(){let e=this;var{initStore:t,customStore:s}=e;return s.visible=!0,t.custom=!0,e.handleUpdateCustomColumn(),e.checkCustomStatus(),calcMaxHeight(e),e.$nextTick().then(()=>calcMaxHeight(e))},_closeCustom(){var e=this,t=e.customStore,s=e.computeCustomOpts;return t.visible&&(t.visible=!1,s.immediate||e.handleCustom()),e.$nextTick()},_toggleCustom(){var e=this,t=e.customStore;return t.visible?e.closeCustom():e.openCustom()},_saveCustom(){let e=this;var t=e;let{customColumnList:s,aggHandleFields:i,rowGroupList:l}=t,{allowVisible:o,allowSort:r,allowFixed:u,allowResizable:a,allowGroup:n,allowValues:d}=e.computeCustomOpts;return _xeUtils.default.eachTree(s,(e,t,s,i,l)=>{l?e.fixed=l.fixed:(r&&(e.renderSortNumber=t+1),u&&(e.fixed=e.renderFixed)),a&&e.renderVisible&&(!e.children||e.children.length)&&e.renderResizeWidth!==e.renderWidth&&(e.resizeWidth=e.renderResizeWidth,e.renderWidth=e.renderResizeWidth),o&&(e.visible=e.renderVisible),n&&d&&(e.aggFunc=e.renderAggFn)}),t.isCustomStatus=!0,e.saveCustomStore("confirm").then(()=>{n&&d&&e.handlePivotTableAggregateData&&(l.length!==i.length||l.some((e,t)=>e.field!==i[t])?i.length?e.setRowGroups(i):e.clearRowGroups():d&&e.handleUpdateAggData())})},_cancelCustom(){var e=this,{customColumnList:t,customStore:s}=e;let{oldSortMaps:l,oldFixedMaps:o,oldVisibleMaps:r}=s,{allowVisible:u,allowSort:a,allowFixed:n,allowResizable:d}=e.computeCustomOpts;return _xeUtils.default.eachTree(t,e=>{var t=e.getKey(),s=!!r[t],i=o[t]||"";u&&(e.renderVisible=s,e.visible=s),n&&(e.renderFixed=i,e.fixed=i),a&&(e.renderSortNumber=l[t]||0),d&&(e.renderResizeWidth=e.renderWidth)},{children:"children"}),e.$nextTick()},_resetCustom(e){let t=this;var s=t,i=t;let l=s.rowGroupList;var o=i.collectColumn;let r=t.computeCustomOpts.checkMethod,u=Object.assign({visible:!0,resizable:!0===e,fixed:!0===e,sort:!0===e,aggFunc:!0===e},e),a=[];return _xeUtils.default.eachTree(o,e=>{u.resizable&&(e.resizeWidth=0),u.fixed&&(e.fixed=e.defaultFixed),u.sort&&(e.renderSortNumber=e.sortNumber,e.parentId=e.defaultParentId),r&&!r({$table:t,column:e})||(e.visible=e.defaultVisible),u.aggFunc&&(e.aggFunc=e.defaultAggFunc,e.renderAggFn=e.defaultAggFunc),e.renderResizeWidth=e.renderWidth,a.push(e)}),u.sort&&(e=_xeUtils.default.toArrayTree(_xeUtils.default.orderBy(a,"renderSortNumber"),{key:"id",parentKey:"parentId",children:"children"}),i.collectColumn=e,i.tableFullColumn=(0,_util.getColumnList)(e)),s.isCustomStatus=!1,t.saveCustomStore("reset"),t.handleCustom().then(()=>{var e;u.aggFunc&&t.handlePivotTableAggregateData&&(((e=t.computeRowGroupFields)||l).length?e&&e.length?t.setRowGroups(e):t.clearRowGroups():t.handleUpdateAggData())})},_toggleCustomAllCheckbox(){var e=this.customStore,e=!e.isAll;return this.setCustomAllCheckbox(e)},_setCustomAllCheckbox(e){let t=this;var s=t,i=s.customStore,l=s.customColumnList,o=t.computeCustomOpts;let{checkMethod:r,visibleMethod:u}=o,a=!!e;o.immediate?(_xeUtils.default.eachTree(l,e=>{u&&!u({$table:t,column:e})||r&&!r({$table:t,column:e})||(e.visible=a,e.renderVisible=a,e.halfVisible=!1)}),i.isAll=a,s.isCustomStatus=!0,t.handleCustom(),t.saveCustomStore("update:visible")):(_xeUtils.default.eachTree(l,e=>{u&&!u({$table:t,column:e})||r&&!r({$table:t,column:e})||(e.renderVisible=a,e.halfVisible=!1)}),i.isAll=a),t.checkCustomStatus()},checkCustomStatus(){let t=this;var e=t.customStore,s=t.collectColumn;let i=t.computeCustomOpts.checkMethod;e.isAll=s.every(e=>!!i&&!i({$table:t,column:e})||e.renderVisible),e.isIndeterminate=!e.isAll&&s.some(e=>(!i||i({$table:t,column:e}))&&(e.renderVisible||e.halfVisible))},emitCustomEvent(e,t){(this.$xeGrid||this).dispatchEvent("custom",{type:e},t)},triggerCustomEvent(e){var t=this.customStore;t.visible?(this.closeCustom(),emitCustomEvent(this,"close",e)):(t.btnEl=e.target,this.openCustom(),emitCustomEvent(this,"open",e))},customOpenEvent(e){var t=this.customStore;t.visible&&(t.activeBtn=!0,t.btnEl=e.target,this.openCustom(),emitCustomEvent(this,"open",e))},customCloseEvent(e){var t=this.customStore;t.visible&&(t.activeBtn=!1,this.closeCustom(),emitCustomEvent(this,"close",e))},handleUpdateCustomColumn(){var e=this,t=e.customStore,o=this.collectColumn;if(t.visible){let s={},i={},l={};_xeUtils.default.eachTree(o,e=>{var t=e.getKey();e.renderFixed=e.fixed,e.renderVisible=e.visible,e.renderResizeWidth=e.renderWidth,s[t]=e.renderSortNumber,i[t]=e.fixed,l[t]=e.visible}),t.oldSortMaps=s,t.oldFixedMaps=i,t.oldVisibleMaps=l,e.customColumnList=o.slice(0)}}}};
|
|
@@ -138,6 +138,7 @@ class ColumnInfo {
|
|
|
138
138
|
parentId: null,
|
|
139
139
|
visible,
|
|
140
140
|
// 内部属性(一旦被使用,将导致不可升级版本)
|
|
141
|
+
defaultParentId: null,
|
|
141
142
|
halfVisible: false,
|
|
142
143
|
defaultVisible: visible,
|
|
143
144
|
defaultFixed: _vm.fixed,
|
|
@@ -145,8 +146,11 @@ class ColumnInfo {
|
|
|
145
146
|
checked: false,
|
|
146
147
|
halfChecked: false,
|
|
147
148
|
disabled: false,
|
|
149
|
+
// 分组层级
|
|
148
150
|
level: 1,
|
|
151
|
+
// 跨行
|
|
149
152
|
rowSpan: 1,
|
|
153
|
+
// 跨列
|
|
150
154
|
colSpan: 1,
|
|
151
155
|
// 数据排序
|
|
152
156
|
order: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.ColumnInfo=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util"),_utils=require("../../ui/src/utils"),_log=require("../../ui/src/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getI18n,formats}=_ui.VxeUI;class ColumnInfo{constructor(e,r,{renderHeader:t,renderCell:o,renderFooter:l,renderData:i}={}){var d=e,n=e.$xeGrid,{field:s,editRender:a}=r,u=n?n.computeProxyOpts:null,f=r.formatter,g=!_xeUtils.default.isBoolean(r.visible)||r.visible,c=["seq","checkbox","radio","expand","html"];r.type&&-1===c.indexOf(r.type)&&(0,_log.warnLog)("vxe.error.errProp",["type="+r.type,c.join(", ")]),(_xeUtils.default.isBoolean(r.cellRender)||r.cellRender&&!_xeUtils.default.isObject(r.cellRender))&&(0,_log.warnLog)("vxe.error.errProp",["column.cell-render="+r.cellRender,"column.cell-render={}"]),(_xeUtils.default.isBoolean(r.editRender)||r.editRender&&!_xeUtils.default.isObject(r.editRender))&&(0,_log.warnLog)("vxe.error.errProp",["column.edit-render="+r.editRender,"column.edit-render={}"]),"expand"===r.type&&(c=d.treeConfig,c)&&(e.treeOpts.showLine||e.treeOpts.line)&&(0,_log.errLog)("vxe.error.errConflicts",["tree-config.line","column.type=expand"]),r.remoteSort&&(0,_log.warnLog)("vxe.error.delProp",["column.remote-sort","sort-config.remote"]),r.sortMethod&&(0,_log.warnLog)("vxe.error.delProp",["column.sort-method","sort-config.sortMethod"]),f&&(_xeUtils.default.isString(f)?(d=formats.get(f)||_xeUtils.default[f])&&_xeUtils.default.isFunction(d.tableCellFormatMethod||d.cellFormatMethod)||(0,_log.errLog)("vxe.error.notFormats",[f]):!_xeUtils.default.isArray(f)||(c=formats.get(f[0])||_xeUtils.default[f[0]])&&_xeUtils.default.isFunction(c.tableCellFormatMethod||c.cellFormatMethod)||(0,_log.errLog)("vxe.error.notFormats",[f[0]])),r.aggFunc&&!e.handlePivotTableAggregateData&&!0!==r.aggFunc&&(0,_log.errLog)("vxe.error.errProp",["column.agg-func="+r.aggFunc,"column.agg-func=true"]),s&&a&&(a.startField&&0<=(""+a.startField).indexOf(s)&&(0,_log.errLog)("vxe.error.modelConflicts",["field="+s,"edit-render.startField="+a.startField]),a.endField)&&0<=(""+a.endField).indexOf(s)&&(0,_log.errLog)("vxe.error.modelConflicts",["field="+s,"edit-render.endField="+a.endField]),Object.assign(this,{type:r.type,property:r.field,field:s,title:r.title,width:r.width,minWidth:r.minWidth,maxWidth:r.maxWidth,resizable:r.resizable,fixed:r.fixed,align:r.align,headerAlign:r.headerAlign,footerAlign:r.footerAlign,showOverflow:r.showOverflow,showHeaderOverflow:r.showHeaderOverflow,showFooterOverflow:r.showFooterOverflow,className:r.className,headerClassName:r.headerClassName,footerClassName:r.footerClassName,formatter:f,footerFormatter:r.footerFormatter,padding:r.padding,verticalAlign:r.verticalAlign,sortable:r.sortable,sortBy:r.sortBy,sortType:r.sortType,sortMethod:r.sortMethod,remoteSort:r.remoteSort,filters:(0,_util.toFilters)(r.filters),filterMultiple:!_xeUtils.default.isBoolean(r.filterMultiple)||r.filterMultiple,filterMethod:r.filterMethod,filterResetMethod:r.filterResetMethod,filterRecoverMethod:r.filterRecoverMethod,filterRender:r.filterRender,rowGroupNode:r.rowGroupNode,treeNode:r.treeNode,dragSort:r.dragSort,rowResize:r.rowResize,cellType:r.cellType,cellRender:r.cellRender,editRender:a,contentRender:r.contentRender,headerExportMethod:r.headerExportMethod,exportMethod:r.exportMethod,footerExportMethod:r.footerExportMethod,titleHelp:r.titleHelp,titlePrefix:r.titlePrefix,titleSuffix:r.titleSuffix,aggFunc:r.aggFunc,params:r.params,id:r.colId||_xeUtils.default.uniqueId("col_"),parentId:null,visible:g,halfVisible:!1,defaultVisible:g,defaultFixed:r.fixed,defaultAggFunc:r.aggFunc,checked:!1,halfChecked:!1,disabled:!1,level:1,rowSpan:1,colSpan:1,order:null,sortTime:0,sortNumber:0,renderSortNumber:0,renderAggFn:"",renderFixed:"",renderVisible:!1,renderWidth:0,renderHeight:0,renderResizeWidth:0,renderAutoWidth:0,resizeWidth:0,renderLeft:0,renderArgs:[],model:{},renderHeader:t||r.renderHeader,renderCell:o||r.renderCell,renderFooter:l||r.renderFooter,renderData:i,slots:r.slots}),u&&u.beforeColumn&&u.beforeColumn({$grid:n,column:this})}getTitle(){return(0,_utils.getFuncText)(this.title||("seq"===this.type?getI18n("vxe.table.seqTitle"):""))}getKey(){var e=this.type;return this.field||(e?"type="+e:null)}update(e,r){"filters"!==e&&("field"===e&&(this.property=r),this[e]=r)}}exports.ColumnInfo=ColumnInfo;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.ColumnInfo=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_util=require("./util"),_utils=require("../../ui/src/utils"),_log=require("../../ui/src/log");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let{getI18n,formats}=_ui.VxeUI;class ColumnInfo{constructor(e,r,{renderHeader:t,renderCell:o,renderFooter:l,renderData:i}={}){var d=e,n=e.$xeGrid,{field:s,editRender:a}=r,u=n?n.computeProxyOpts:null,f=r.formatter,g=!_xeUtils.default.isBoolean(r.visible)||r.visible,c=["seq","checkbox","radio","expand","html"];r.type&&-1===c.indexOf(r.type)&&(0,_log.warnLog)("vxe.error.errProp",["type="+r.type,c.join(", ")]),(_xeUtils.default.isBoolean(r.cellRender)||r.cellRender&&!_xeUtils.default.isObject(r.cellRender))&&(0,_log.warnLog)("vxe.error.errProp",["column.cell-render="+r.cellRender,"column.cell-render={}"]),(_xeUtils.default.isBoolean(r.editRender)||r.editRender&&!_xeUtils.default.isObject(r.editRender))&&(0,_log.warnLog)("vxe.error.errProp",["column.edit-render="+r.editRender,"column.edit-render={}"]),"expand"===r.type&&(c=d.treeConfig,c)&&(e.treeOpts.showLine||e.treeOpts.line)&&(0,_log.errLog)("vxe.error.errConflicts",["tree-config.line","column.type=expand"]),r.remoteSort&&(0,_log.warnLog)("vxe.error.delProp",["column.remote-sort","sort-config.remote"]),r.sortMethod&&(0,_log.warnLog)("vxe.error.delProp",["column.sort-method","sort-config.sortMethod"]),f&&(_xeUtils.default.isString(f)?(d=formats.get(f)||_xeUtils.default[f])&&_xeUtils.default.isFunction(d.tableCellFormatMethod||d.cellFormatMethod)||(0,_log.errLog)("vxe.error.notFormats",[f]):!_xeUtils.default.isArray(f)||(c=formats.get(f[0])||_xeUtils.default[f[0]])&&_xeUtils.default.isFunction(c.tableCellFormatMethod||c.cellFormatMethod)||(0,_log.errLog)("vxe.error.notFormats",[f[0]])),r.aggFunc&&!e.handlePivotTableAggregateData&&!0!==r.aggFunc&&(0,_log.errLog)("vxe.error.errProp",["column.agg-func="+r.aggFunc,"column.agg-func=true"]),s&&a&&(a.startField&&0<=(""+a.startField).indexOf(s)&&(0,_log.errLog)("vxe.error.modelConflicts",["field="+s,"edit-render.startField="+a.startField]),a.endField)&&0<=(""+a.endField).indexOf(s)&&(0,_log.errLog)("vxe.error.modelConflicts",["field="+s,"edit-render.endField="+a.endField]),Object.assign(this,{type:r.type,property:r.field,field:s,title:r.title,width:r.width,minWidth:r.minWidth,maxWidth:r.maxWidth,resizable:r.resizable,fixed:r.fixed,align:r.align,headerAlign:r.headerAlign,footerAlign:r.footerAlign,showOverflow:r.showOverflow,showHeaderOverflow:r.showHeaderOverflow,showFooterOverflow:r.showFooterOverflow,className:r.className,headerClassName:r.headerClassName,footerClassName:r.footerClassName,formatter:f,footerFormatter:r.footerFormatter,padding:r.padding,verticalAlign:r.verticalAlign,sortable:r.sortable,sortBy:r.sortBy,sortType:r.sortType,sortMethod:r.sortMethod,remoteSort:r.remoteSort,filters:(0,_util.toFilters)(r.filters),filterMultiple:!_xeUtils.default.isBoolean(r.filterMultiple)||r.filterMultiple,filterMethod:r.filterMethod,filterResetMethod:r.filterResetMethod,filterRecoverMethod:r.filterRecoverMethod,filterRender:r.filterRender,rowGroupNode:r.rowGroupNode,treeNode:r.treeNode,dragSort:r.dragSort,rowResize:r.rowResize,cellType:r.cellType,cellRender:r.cellRender,editRender:a,contentRender:r.contentRender,headerExportMethod:r.headerExportMethod,exportMethod:r.exportMethod,footerExportMethod:r.footerExportMethod,titleHelp:r.titleHelp,titlePrefix:r.titlePrefix,titleSuffix:r.titleSuffix,aggFunc:r.aggFunc,params:r.params,id:r.colId||_xeUtils.default.uniqueId("col_"),parentId:null,visible:g,defaultParentId:null,halfVisible:!1,defaultVisible:g,defaultFixed:r.fixed,defaultAggFunc:r.aggFunc,checked:!1,halfChecked:!1,disabled:!1,level:1,rowSpan:1,colSpan:1,order:null,sortTime:0,sortNumber:0,renderSortNumber:0,renderAggFn:"",renderFixed:"",renderVisible:!1,renderWidth:0,renderHeight:0,renderResizeWidth:0,renderAutoWidth:0,resizeWidth:0,renderLeft:0,renderArgs:[],model:{},renderHeader:t||r.renderHeader,renderCell:o||r.renderCell,renderFooter:l||r.renderFooter,renderData:i,slots:r.slots}),u&&u.beforeColumn&&u.beforeColumn({$grid:n,column:this})}getTitle(){return(0,_utils.getFuncText)(this.title||("seq"===this.type?getI18n("vxe.table.seqTitle"):""))}getKey(){var e=this.type;return this.field||(e?"type="+e:null)}update(e,r){"filters"!==e&&("field"===e&&(this.property=r),this[e]=r)}}exports.ColumnInfo=ColumnInfo;
|
package/lib/table/src/methods.js
CHANGED
|
@@ -151,18 +151,48 @@ function handleVirtualXVisible($xeTable) {
|
|
|
151
151
|
function handleCustomRestore($xeTable, storeData) {
|
|
152
152
|
const reactData = $xeTable;
|
|
153
153
|
const internalData = $xeTable;
|
|
154
|
-
|
|
154
|
+
const {
|
|
155
155
|
collectColumn
|
|
156
156
|
} = internalData;
|
|
157
|
-
|
|
157
|
+
let {
|
|
158
158
|
resizableData,
|
|
159
159
|
sortData,
|
|
160
160
|
visibleData,
|
|
161
161
|
fixedData
|
|
162
162
|
} = storeData;
|
|
163
|
-
let hasCustomSort = false;
|
|
164
163
|
// 处理还原
|
|
165
164
|
if (resizableData || sortData || visibleData || fixedData) {
|
|
165
|
+
const sortColMaps = {};
|
|
166
|
+
// 转换兼容老版本数据
|
|
167
|
+
if (sortData) {
|
|
168
|
+
if (!_xeUtils.default.isArray(sortData)) {
|
|
169
|
+
const sortRests = [];
|
|
170
|
+
_xeUtils.default.each(sortData, (index, colKey) => {
|
|
171
|
+
sortRests.push({
|
|
172
|
+
key: colKey,
|
|
173
|
+
index
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
sortData = _xeUtils.default.orderBy(sortRests, {
|
|
177
|
+
field: 'index',
|
|
178
|
+
order: 'asc'
|
|
179
|
+
}).map(item => ({
|
|
180
|
+
k: item.key
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
let colNum = 1;
|
|
184
|
+
_xeUtils.default.eachTree(sortData, (sObj, index, sOjs, path, pSObj) => {
|
|
185
|
+
sortColMaps[sObj.k] = {
|
|
186
|
+
key: sObj.k,
|
|
187
|
+
sNum: colNum++,
|
|
188
|
+
pKey: pSObj ? pSObj.k : null
|
|
189
|
+
};
|
|
190
|
+
}, {
|
|
191
|
+
children: 'c'
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const colKeyMaps = {};
|
|
195
|
+
const allCols = [];
|
|
166
196
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
167
197
|
const colKey = column.getKey();
|
|
168
198
|
// 支持一级
|
|
@@ -170,10 +200,6 @@ function handleCustomRestore($xeTable, storeData) {
|
|
|
170
200
|
if (fixedData && fixedData[colKey] !== undefined) {
|
|
171
201
|
column.fixed = fixedData[colKey];
|
|
172
202
|
}
|
|
173
|
-
if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
|
|
174
|
-
hasCustomSort = true;
|
|
175
|
-
column.renderSortNumber = sortData[colKey];
|
|
176
|
-
}
|
|
177
203
|
}
|
|
178
204
|
if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
|
|
179
205
|
column.resizeWidth = resizableData[colKey];
|
|
@@ -181,12 +207,27 @@ function handleCustomRestore($xeTable, storeData) {
|
|
|
181
207
|
if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
|
|
182
208
|
column.visible = visibleData[colKey];
|
|
183
209
|
}
|
|
210
|
+
colKeyMaps[colKey] = column;
|
|
211
|
+
allCols.push(column);
|
|
184
212
|
});
|
|
185
213
|
// 如果自定义了顺序
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
214
|
+
if (sortData) {
|
|
215
|
+
allCols.forEach(column => {
|
|
216
|
+
const colKey = column.getKey();
|
|
217
|
+
const scItem = sortColMaps[colKey];
|
|
218
|
+
if (scItem) {
|
|
219
|
+
const parentColumn = scItem.pKey ? colKeyMaps[scItem.pKey] : null;
|
|
220
|
+
column.parentId = parentColumn ? parentColumn.id : null;
|
|
221
|
+
column.renderSortNumber = scItem.sNum;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
const newCollectCols = _xeUtils.default.toArrayTree(_xeUtils.default.orderBy(allCols, 'renderSortNumber'), {
|
|
225
|
+
key: 'id',
|
|
226
|
+
parentKey: 'parentId',
|
|
227
|
+
children: 'children'
|
|
228
|
+
});
|
|
229
|
+
internalData.collectColumn = newCollectCols;
|
|
230
|
+
internalData.tableFullColumn = (0, _util.getColumnList)(newCollectCols);
|
|
190
231
|
}
|
|
191
232
|
reactData.isCustomStatus = true;
|
|
192
233
|
} else {
|
|
@@ -3627,7 +3668,7 @@ function handleUpdateColumn($xeTable) {
|
|
|
3627
3668
|
const internalData = $xeTable;
|
|
3628
3669
|
const columnList = _xeUtils.default.orderBy(internalData.collectColumn, 'renderSortNumber');
|
|
3629
3670
|
internalData.collectColumn = columnList;
|
|
3630
|
-
const tableFullColumn = getColumnList(columnList);
|
|
3671
|
+
const tableFullColumn = (0, _util.getColumnList)(columnList);
|
|
3631
3672
|
internalData.tableFullColumn = tableFullColumn;
|
|
3632
3673
|
cacheColumnMap($xeTable);
|
|
3633
3674
|
}
|
|
@@ -3672,14 +3713,6 @@ function loadScrollXData($xeTable) {
|
|
|
3672
3713
|
}
|
|
3673
3714
|
$xeTable.closeTooltip();
|
|
3674
3715
|
}
|
|
3675
|
-
// 获取所有的列,排除分组
|
|
3676
|
-
function getColumnList(columns) {
|
|
3677
|
-
const result = [];
|
|
3678
|
-
columns.forEach(column => {
|
|
3679
|
-
result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]));
|
|
3680
|
-
});
|
|
3681
|
-
return result;
|
|
3682
|
-
}
|
|
3683
3716
|
function parseColumns($xeTable, isReset) {
|
|
3684
3717
|
const props = $xeTable;
|
|
3685
3718
|
const reactData = $xeTable;
|
|
@@ -3818,27 +3851,31 @@ function parseColumns($xeTable, isReset) {
|
|
|
3818
3851
|
}
|
|
3819
3852
|
return $xeTable.updateFooter();
|
|
3820
3853
|
}
|
|
3821
|
-
function
|
|
3854
|
+
function initColumnHierarchy($xeTable) {
|
|
3822
3855
|
const internalData = $xeTable;
|
|
3823
3856
|
const {
|
|
3824
3857
|
collectColumn
|
|
3825
3858
|
} = internalData;
|
|
3826
|
-
|
|
3827
|
-
|
|
3859
|
+
let sortIndex = 1;
|
|
3860
|
+
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
3861
|
+
const parentId = parentColumn ? parentColumn.id : null;
|
|
3862
|
+
column.parentId = parentId;
|
|
3863
|
+
column.defaultParentId = parentId;
|
|
3828
3864
|
column.sortNumber = sortIndex;
|
|
3829
3865
|
column.renderSortNumber = sortIndex;
|
|
3866
|
+
sortIndex++;
|
|
3830
3867
|
});
|
|
3831
3868
|
}
|
|
3832
|
-
function
|
|
3869
|
+
function handleInitColumn($xeTable, collectColumn) {
|
|
3833
3870
|
const $xeToolbar = $xeTable.$refs.$xeToolbar;
|
|
3834
3871
|
const reactData = $xeTable;
|
|
3835
3872
|
const internalData = $xeTable;
|
|
3836
3873
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
3837
3874
|
internalData.collectColumn = collectColumn;
|
|
3838
|
-
const tableFullColumn = getColumnList(collectColumn);
|
|
3875
|
+
const tableFullColumn = (0, _util.getColumnList)(collectColumn);
|
|
3839
3876
|
internalData.tableFullColumn = tableFullColumn;
|
|
3840
3877
|
reactData.isColLoading = true;
|
|
3841
|
-
|
|
3878
|
+
initColumnHierarchy($xeTable);
|
|
3842
3879
|
return Promise.resolve(restoreCustomStorage($xeTable)).then(() => {
|
|
3843
3880
|
const {
|
|
3844
3881
|
scrollXLoad,
|
|
@@ -4565,7 +4602,7 @@ const Methods = {
|
|
|
4565
4602
|
const collectColumn = _xeUtils.default.mapTree(columns, column => _cell.default.createColumn($xeTable, column), {
|
|
4566
4603
|
children: 'children'
|
|
4567
4604
|
});
|
|
4568
|
-
return
|
|
4605
|
+
return handleInitColumn($xeTable, collectColumn).then(() => {
|
|
4569
4606
|
let targetScrollLeft = lastScrollLeft;
|
|
4570
4607
|
let targetScrollTop = lastScrollTop;
|
|
4571
4608
|
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
@@ -4590,9 +4627,9 @@ const Methods = {
|
|
|
4590
4627
|
return this.loadColumn(columns);
|
|
4591
4628
|
});
|
|
4592
4629
|
},
|
|
4593
|
-
|
|
4630
|
+
handleInitColumn(collectColumn) {
|
|
4594
4631
|
const $xeTable = this;
|
|
4595
|
-
return
|
|
4632
|
+
return handleInitColumn($xeTable, collectColumn);
|
|
4596
4633
|
},
|
|
4597
4634
|
/**
|
|
4598
4635
|
* 更新数据行的 Map
|
|
@@ -5949,7 +5986,7 @@ const Methods = {
|
|
|
5949
5986
|
const isCustomSort = hangleStorageDefaultValue(storageOpts.sort, isAllCustom);
|
|
5950
5987
|
const isCustomAggFunc = hangleStorageDefaultValue(storageOpts.aggFunc, isAllCustom);
|
|
5951
5988
|
const resizableData = {};
|
|
5952
|
-
const sortData =
|
|
5989
|
+
const sortData = [];
|
|
5953
5990
|
const visibleData = {};
|
|
5954
5991
|
const fixedData = {};
|
|
5955
5992
|
const aggFuncData = {};
|
|
@@ -5971,18 +6008,39 @@ const Methods = {
|
|
|
5971
6008
|
let hasFixed = 0;
|
|
5972
6009
|
let hasVisible = 0;
|
|
5973
6010
|
let hasAggFunc = 0;
|
|
6011
|
+
const sortMaps = {};
|
|
5974
6012
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
5975
6013
|
const colKey = column.getKey();
|
|
5976
6014
|
if (!colKey) {
|
|
5977
6015
|
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
5978
6016
|
return;
|
|
5979
6017
|
}
|
|
5980
|
-
|
|
5981
|
-
if (!parentColumn) {
|
|
6018
|
+
if (parentColumn) {
|
|
5982
6019
|
if (isCustomSort) {
|
|
6020
|
+
const pColKey = parentColumn.getKey();
|
|
6021
|
+
const psObj = sortMaps[pColKey];
|
|
5983
6022
|
hasSort = 1;
|
|
5984
|
-
|
|
6023
|
+
if (psObj) {
|
|
6024
|
+
const sObj = {
|
|
6025
|
+
k: colKey
|
|
6026
|
+
};
|
|
6027
|
+
sortMaps[colKey] = sObj;
|
|
6028
|
+
if (!psObj.c) {
|
|
6029
|
+
psObj.c = [];
|
|
6030
|
+
}
|
|
6031
|
+
psObj.c.push(sObj);
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6034
|
+
} else {
|
|
6035
|
+
if (isCustomSort) {
|
|
6036
|
+
hasSort = 1;
|
|
6037
|
+
const sObj = {
|
|
6038
|
+
k: colKey
|
|
6039
|
+
};
|
|
6040
|
+
sortMaps[colKey] = sObj;
|
|
6041
|
+
sortData.push(sObj);
|
|
5985
6042
|
}
|
|
6043
|
+
// 只支持一级
|
|
5986
6044
|
if (isCustomFixed && column.fixed !== column.defaultFixed) {
|
|
5987
6045
|
hasFixed = 1;
|
|
5988
6046
|
fixedData[colKey] = column.fixed;
|