vxe-table 3.12.15 → 3.12.16
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/edit/mixin.js +219 -153
- package/es/table/src/methods.js +43 -12
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +330 -228
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +268 -210
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/src/methods.js +58 -14
- package/lib/table/src/methods.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/edit/mixin.ts +237 -154
- package/packages/table/src/methods.ts +45 -12
- /package/es/{iconfont.1739257460253.ttf → iconfont.1739333092714.ttf} +0 -0
- /package/es/{iconfont.1739257460253.woff → iconfont.1739333092714.woff} +0 -0
- /package/es/{iconfont.1739257460253.woff2 → iconfont.1739333092714.woff2} +0 -0
- /package/lib/{iconfont.1739257460253.ttf → iconfont.1739333092714.ttf} +0 -0
- /package/lib/{iconfont.1739257460253.woff → iconfont.1739333092714.woff} +0 -0
- /package/lib/{iconfont.1739257460253.woff2 → iconfont.1739333092714.woff2} +0 -0
package/lib/ui/index.js
CHANGED
|
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "VxeUI", {
|
|
|
13
13
|
exports.version = exports.validators = exports.use = exports.t = exports.setup = exports.setTheme = exports.setLanguage = exports.setIcon = exports.setI18n = exports.setConfig = exports.saveFile = exports.renderer = exports.readFile = exports.print = exports.modal = exports.menus = exports.log = exports.interceptor = exports.globalResize = exports.globalEvents = exports.getTheme = exports.getIcon = exports.getI18n = exports.getConfig = exports.formats = exports.default = exports.config = exports.commands = exports.clipboard = exports._t = void 0;
|
|
14
14
|
var _core = require("@vxe-ui/core");
|
|
15
15
|
var _utils = require("./src/utils");
|
|
16
|
-
const version = exports.version = "3.12.
|
|
16
|
+
const version = exports.version = "3.12.16";
|
|
17
17
|
_core.VxeUI.version = version;
|
|
18
18
|
_core.VxeUI.tableVersion = version;
|
|
19
19
|
_core.VxeUI.setConfig({
|
package/lib/ui/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");let version=exports.version="3.12.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.VXETable=void 0,Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.version=exports.validators=exports.use=exports.t=exports.setup=exports.setTheme=exports.setLanguage=exports.setIcon=exports.setI18n=exports.setConfig=exports.saveFile=exports.renderer=exports.readFile=exports.print=exports.modal=exports.menus=exports.log=exports.interceptor=exports.globalResize=exports.globalEvents=exports.getTheme=exports.getIcon=exports.getI18n=exports.getConfig=exports.formats=exports.default=exports.config=exports.commands=exports.clipboard=exports._t=void 0;var _core=require("@vxe-ui/core"),_utils=require("./src/utils");let version=exports.version="3.12.16",iconPrefix=(_core.VxeUI.version=version,_core.VxeUI.tableVersion=version,_core.VxeUI.setConfig({emptyCell:" ",table:{fit:!0,showHeader:!0,animat:!0,delayHover:250,autoResize:!0,padding:!0,minHeight:144,resizeConfig:{},resizableConfig:{dragMode:"auto",showDragTip:!0,isSyncAutoHeight:!0,isSyncAutoWidth:!0,minHeight:18},radioConfig:{strict:!0},rowDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},columnDragConfig:{showIcon:!0,animation:!0,showGuidesStatus:!0,showDragTip:!0},checkboxConfig:{strict:!0},tooltipConfig:{enterable:!0},validConfig:{showMessage:!0,autoClear:!0,autoPos:!0,message:"inline",msgMode:"single",theme:"beautify"},columnConfig:{maxFixedSize:4},cellConfig:{padding:!0},headerCellConfig:{height:"unset"},footerCellConfig:{height:"unset"},customConfig:{allowVisible:!0,allowResizable:!0,allowFixed:!0,allowSort:!0,showFooter:!0,placement:"top-right",modalOptions:{showMaximize:!0,mask:!0,lockView:!0,resize:!0,escClosable:!0},drawerOptions:{mask:!0,lockView:!0,escClosable:!0,resize:!0}},sortConfig:{showIcon:!0,allowClear:!0,allowBtn:!0,iconLayout:"vertical"},filterConfig:{showIcon:!0},treeConfig:{rowField:"id",parentField:"parentId",childrenField:"children",hasChildField:"hasChild",mapChildrenField:"_X_ROW_CHILD",indent:20,showIcon:!0},expandConfig:{showIcon:!0},editConfig:{showIcon:!0,showAsterisk:!0,autoFocus:!0},importConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},exportConfig:{_typeMaps:{csv:1,html:1,xml:1,txt:1}},printConfig:{},mouseConfig:{extension:!0},keyboardConfig:{isEsc:!0},areaConfig:{autoClear:!0,selectCellByHeader:!0,selectCellByBody:!0,extendDirection:{top:!0,left:!0,bottom:!0,right:!0}},clipConfig:{isCopy:!0,isCut:!0,isPaste:!0},fnrConfig:{isFind:!0,isReplace:!0},virtualXConfig:{enabled:!0,gt:60,preSize:0,oSize:1},virtualYConfig:{enabled:!0,gt:100,preSize:1,oSize:2},scrollbarConfig:{}},grid:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showResponseMsg:!0,showActiveMsg:!0,props:{list:null,result:"result",total:"page.total",message:"message"}}},toolbar:{}}),"vxe-table-icon-"),setTheme=(_core.VxeUI.setIcon({TABLE_SORT_ASC:iconPrefix+"caret-up",TABLE_SORT_DESC:iconPrefix+"caret-down",TABLE_FILTER_NONE:iconPrefix+"funnel",TABLE_FILTER_MATCH:iconPrefix+"funnel",TABLE_EDIT:iconPrefix+"edit",TABLE_TITLE_PREFIX:iconPrefix+"question-circle-fill",TABLE_TITLE_SUFFIX:iconPrefix+"question-circle-fill",TABLE_TREE_LOADED:iconPrefix+"spinner roll",TABLE_TREE_OPEN:iconPrefix+"caret-right rotate90",TABLE_TREE_CLOSE:iconPrefix+"caret-right",TABLE_EXPAND_LOADED:iconPrefix+"spinner roll",TABLE_EXPAND_OPEN:iconPrefix+"arrow-right rotate90",TABLE_EXPAND_CLOSE:iconPrefix+"arrow-right",TABLE_CHECKBOX_CHECKED:iconPrefix+"checkbox-checked-fill",TABLE_CHECKBOX_UNCHECKED:iconPrefix+"checkbox-unchecked",TABLE_CHECKBOX_INDETERMINATE:iconPrefix+"checkbox-indeterminate-fill",TABLE_RADIO_CHECKED:iconPrefix+"radio-checked-fill",TABLE_RADIO_UNCHECKED:iconPrefix+"radio-unchecked",TABLE_CUSTOM_SORT:iconPrefix+"drag-handle",TABLE_MENU_OPTIONS:iconPrefix+"arrow-right",TABLE_DRAG_ROW:iconPrefix+"drag-handle",TABLE_DRAG_COLUMN:iconPrefix+"drag-handle",TABLE_DRAG_STATUS_ROW:iconPrefix+"sort",TABLE_DRAG_STATUS_SUB_ROW:iconPrefix+"add-sub",TABLE_DRAG_STATUS_COLUMN:iconPrefix+"swap",TABLE_DRAG_DISABLED:iconPrefix+"no-drop",TOOLBAR_TOOLS_REFRESH:iconPrefix+"repeat",TOOLBAR_TOOLS_REFRESH_LOADING:iconPrefix+"repeat roll",TOOLBAR_TOOLS_IMPORT:iconPrefix+"upload",TOOLBAR_TOOLS_EXPORT:iconPrefix+"download",TOOLBAR_TOOLS_PRINT:iconPrefix+"print",TOOLBAR_TOOLS_FULLSCREEN:iconPrefix+"fullscreen",TOOLBAR_TOOLS_MINIMIZE:iconPrefix+"minimize",TOOLBAR_TOOLS_CUSTOM:iconPrefix+"custom-column",TOOLBAR_TOOLS_FIXED_LEFT:iconPrefix+"fixed-left",TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE:iconPrefix+"fixed-left-fill",TOOLBAR_TOOLS_FIXED_RIGHT:iconPrefix+"fixed-right",TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE:iconPrefix+"fixed-right-fill"}),exports.setTheme=_core.VxeUI.setTheme),getTheme=exports.getTheme=_core.VxeUI.getTheme,setConfig=exports.setConfig=_core.VxeUI.setConfig,getConfig=exports.getConfig=_core.VxeUI.getConfig,setIcon=exports.setIcon=_core.VxeUI.setIcon,getIcon=exports.getIcon=_core.VxeUI.getIcon,setLanguage=exports.setLanguage=_core.VxeUI.setLanguage,setI18n=exports.setI18n=_core.VxeUI.setI18n,getI18n=exports.getI18n=_core.VxeUI.getI18n,globalEvents=exports.globalEvents=_core.VxeUI.globalEvents,globalResize=exports.globalResize=_core.VxeUI.globalResize,renderer=exports.renderer=_core.VxeUI.renderer,validators=exports.validators=_core.VxeUI.validators,menus=exports.menus=_core.VxeUI.menus,formats=exports.formats=_core.VxeUI.formats,commands=exports.commands=_core.VxeUI.commands,interceptor=exports.interceptor=_core.VxeUI.interceptor,clipboard=exports.clipboard=_core.VxeUI.clipboard,log=exports.log=_core.VxeUI.log,use=exports.use=_core.VxeUI.use,setup=e=>_core.VxeUI.setConfig(e),config=(exports.setup=setup,_core.VxeUI.setup=setup,e=>_core.VxeUI.setConfig(e)),t=(exports.config=config,_core.VxeUI.config=config,(e,o)=>_core.VxeUI.getI18n(e,o)),_t=(exports.t=t,_core.VxeUI.t=t,(e,o)=>(0,_utils.getFuncText)(e,o)),VXETable=(exports._t=_t,_core.VxeUI._t=_t,exports.VXETable=_core.VxeUI),saveFile=e=>_core.VxeUI.saveFile(e),readFile=(exports.saveFile=saveFile,e=>_core.VxeUI.readFile(e)),print=(exports.readFile=readFile,e=>_core.VxeUI.print(e)),modal=(exports.print=print,exports.modal={get(e){return _core.VxeUI.modal.get(e)},close(e){return _core.VxeUI.modal.close(e)},open(e){return _core.VxeUI.modal.open(e)},alert(e,o,r){return _core.VxeUI.modal.alert(e,o,r)},confirm(e,o,r){return _core.VxeUI.modal.confirm(e,o,r)},message(e,o){return _core.VxeUI.modal.message(e,o)},notification(e,o,r){return _core.VxeUI.modal.notification(e,o,r)}});var _default=exports.default=_core.VxeUI;
|
package/lib/ui/src/log.js
CHANGED
|
@@ -8,6 +8,6 @@ var _core = require("@vxe-ui/core");
|
|
|
8
8
|
const {
|
|
9
9
|
log
|
|
10
10
|
} = _core.VxeUI;
|
|
11
|
-
const version = `table v${"3.12.
|
|
11
|
+
const version = `table v${"3.12.16"}`;
|
|
12
12
|
const warnLog = exports.warnLog = log.create('warn', version);
|
|
13
13
|
const errLog = exports.errLog = log.create('error', version);
|
package/lib/ui/src/log.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="table v3.12.
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core");let log=_core.VxeUI.log,version="table v3.12.16",warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
|
package/package.json
CHANGED
|
@@ -5,10 +5,27 @@ import { getCellValue, setCellValue, getRowid } from '../../src/util'
|
|
|
5
5
|
import { browse, removeClass, addClass } from '../../../ui/src/dom'
|
|
6
6
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
7
7
|
|
|
8
|
-
import type { VxeTableConstructor, TableReactData } from '../../../../types'
|
|
8
|
+
import type { VxeTableConstructor, TableInternalData, VxeTableDefines, TableReactData, VxeTablePrivateMethods } from '../../../../types'
|
|
9
9
|
|
|
10
10
|
const { getConfig, renderer, getI18n } = VxeUI
|
|
11
11
|
|
|
12
|
+
function getEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
13
|
+
const { model, editRender } = column
|
|
14
|
+
if (editRender) {
|
|
15
|
+
model.value = getCellValue(row, column)
|
|
16
|
+
model.update = false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function setEditColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
21
|
+
const { model, editRender } = column
|
|
22
|
+
if (editRender && model.update) {
|
|
23
|
+
setCellValue(row, column, model.value)
|
|
24
|
+
model.update = false
|
|
25
|
+
model.value = null
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
12
29
|
function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
|
|
13
30
|
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
14
31
|
if (el) {
|
|
@@ -19,6 +36,22 @@ function removeCellSelectedClass ($xeTable: VxeTableConstructor) {
|
|
|
19
36
|
}
|
|
20
37
|
}
|
|
21
38
|
|
|
39
|
+
function syncActivedCell ($xeTable: VxeTableConstructor) {
|
|
40
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
41
|
+
|
|
42
|
+
const { editStore, tableColumn } = reactData
|
|
43
|
+
const editOpts = $xeTable.computeEditOpts
|
|
44
|
+
const { actived } = editStore
|
|
45
|
+
const { row, column } = actived
|
|
46
|
+
if (row || column) {
|
|
47
|
+
if (editOpts.mode === 'row') {
|
|
48
|
+
tableColumn.forEach((column) => setEditColumnModel(row, column))
|
|
49
|
+
} else {
|
|
50
|
+
setEditColumnModel(row, column)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
22
55
|
function insertTreeRow (_vm: any, newRecords: any[], isAppend: any) {
|
|
23
56
|
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData, treeOpts } = _vm
|
|
24
57
|
const { rowField, parentField, mapChildrenField } = treeOpts
|
|
@@ -233,7 +266,7 @@ function handleInsertRowAt ($xeTable: any, records: any[], targetRow: any, isIns
|
|
|
233
266
|
})
|
|
234
267
|
}
|
|
235
268
|
|
|
236
|
-
function handleInsertChildRowAt ($xeTable:
|
|
269
|
+
function handleInsertChildRowAt ($xeTable: VxeTableConstructor, records: any, parentRow: any, targetRow: any, isInsertNextRow?: boolean) {
|
|
237
270
|
const props = $xeTable
|
|
238
271
|
|
|
239
272
|
const { treeConfig } = props
|
|
@@ -250,6 +283,183 @@ function handleInsertChildRowAt ($xeTable: any, records: any, parentRow: any, ta
|
|
|
250
283
|
return Promise.resolve({ row: null, rows: [] })
|
|
251
284
|
}
|
|
252
285
|
|
|
286
|
+
function handleClearEdit ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: Event | null, targetRow?: any) {
|
|
287
|
+
const props = $xeTable
|
|
288
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
289
|
+
|
|
290
|
+
const { mouseConfig } = props
|
|
291
|
+
const { editStore } = reactData
|
|
292
|
+
const { actived, focused } = editStore
|
|
293
|
+
const { row, column } = actived
|
|
294
|
+
const validOpts = $xeTable.computeValidOpts
|
|
295
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
296
|
+
if (row || column) {
|
|
297
|
+
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
298
|
+
return $xeTable.$nextTick()
|
|
299
|
+
}
|
|
300
|
+
syncActivedCell($xeTable)
|
|
301
|
+
actived.args = null
|
|
302
|
+
actived.row = null
|
|
303
|
+
actived.column = null
|
|
304
|
+
$xeTable.updateFooter()
|
|
305
|
+
$xeTable.dispatchEvent('edit-closed', {
|
|
306
|
+
row,
|
|
307
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
308
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
309
|
+
column,
|
|
310
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
311
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
312
|
+
}, evnt || null)
|
|
313
|
+
}
|
|
314
|
+
focused.row = null
|
|
315
|
+
focused.column = null
|
|
316
|
+
if (validOpts.autoClear) {
|
|
317
|
+
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
|
|
318
|
+
if ($xeTable.clearValidate) {
|
|
319
|
+
return $xeTable.clearValidate()
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return $xeTable.$nextTick().then(() => {
|
|
324
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
325
|
+
return $xeTable.handleRecalculateCellAreas()
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function handleEditActive ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, params: any, evnt: Event | null, isFocus: boolean) {
|
|
331
|
+
const props = $xeTable
|
|
332
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
333
|
+
|
|
334
|
+
const { editConfig, mouseConfig } = props
|
|
335
|
+
const { editStore, tableColumn } = reactData
|
|
336
|
+
const editOpts = $xeTable.computeEditOpts
|
|
337
|
+
const { mode } = editOpts
|
|
338
|
+
const { actived, focused } = editStore
|
|
339
|
+
const { row, column } = params
|
|
340
|
+
const { editRender } = column
|
|
341
|
+
const cell = (params.cell || $xeTable.getCellElement(row, column))
|
|
342
|
+
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
343
|
+
params.cell = cell
|
|
344
|
+
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
345
|
+
// 激活编辑
|
|
346
|
+
if (!$xeTable.isPendingByRow(row)) {
|
|
347
|
+
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
348
|
+
// 判断是否禁用编辑
|
|
349
|
+
let type: 'edit-disabled' | 'edit-activated' = 'edit-disabled'
|
|
350
|
+
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })) {
|
|
351
|
+
if (mouseConfig) {
|
|
352
|
+
$xeTable.clearSelected()
|
|
353
|
+
if ($xeTable.clearCellAreas) {
|
|
354
|
+
$xeTable.clearCellAreas()
|
|
355
|
+
$xeTable.clearCopyCellArea()
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
$xeTable.closeTooltip()
|
|
359
|
+
if (actived.column) {
|
|
360
|
+
handleClearEdit($xeTable, evnt)
|
|
361
|
+
}
|
|
362
|
+
type = 'edit-activated'
|
|
363
|
+
column.renderHeight = cell.offsetHeight
|
|
364
|
+
actived.args = params
|
|
365
|
+
actived.row = row
|
|
366
|
+
actived.column = column
|
|
367
|
+
if (mode === 'row') {
|
|
368
|
+
tableColumn.forEach((column: any) => getEditColumnModel(row, column))
|
|
369
|
+
} else {
|
|
370
|
+
getEditColumnModel(row, column)
|
|
371
|
+
}
|
|
372
|
+
const afterEditMethod = editOpts.afterEditMethod
|
|
373
|
+
$xeTable.$nextTick(() => {
|
|
374
|
+
if (isFocus) {
|
|
375
|
+
$xeTable.handleFocus(params, evnt)
|
|
376
|
+
}
|
|
377
|
+
if (afterEditMethod) {
|
|
378
|
+
afterEditMethod({ ...params, $table: $xeTable, $grid: $xeTable.xegrid })
|
|
379
|
+
}
|
|
380
|
+
})
|
|
381
|
+
}
|
|
382
|
+
$xeTable.dispatchEvent(type, {
|
|
383
|
+
row,
|
|
384
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
385
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
386
|
+
column,
|
|
387
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
388
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
389
|
+
}, evnt)
|
|
390
|
+
|
|
391
|
+
// v4已废弃
|
|
392
|
+
if (type === 'edit-activated') {
|
|
393
|
+
$xeTable.dispatchEvent('edit-actived', {
|
|
394
|
+
row,
|
|
395
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
396
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
397
|
+
column,
|
|
398
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
399
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
400
|
+
}, evnt)
|
|
401
|
+
}
|
|
402
|
+
} else {
|
|
403
|
+
const { column: oldColumn } = actived
|
|
404
|
+
if (mouseConfig) {
|
|
405
|
+
$xeTable.clearSelected()
|
|
406
|
+
if ($xeTable.clearCellAreas) {
|
|
407
|
+
$xeTable.clearCellAreas()
|
|
408
|
+
$xeTable.clearCopyCellArea()
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if (oldColumn !== column) {
|
|
412
|
+
const { model: oldModel } = oldColumn
|
|
413
|
+
if (oldModel.update) {
|
|
414
|
+
setCellValue(row, oldColumn, oldModel.value)
|
|
415
|
+
}
|
|
416
|
+
if ($xeTable.clearValidate) {
|
|
417
|
+
$xeTable.clearValidate(row, column)
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
column.renderHeight = cell.offsetHeight
|
|
421
|
+
actived.args = params
|
|
422
|
+
actived.column = column
|
|
423
|
+
if (isFocus) {
|
|
424
|
+
setTimeout(() => {
|
|
425
|
+
$xeTable.handleFocus(params, evnt)
|
|
426
|
+
})
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
focused.column = null
|
|
430
|
+
focused.row = null
|
|
431
|
+
$xeTable.focus()
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return $xeTable.$nextTick()
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function handleEditCell ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, row: any, fieldOrColumn: string | VxeTableDefines.ColumnInfo, isPos: boolean) {
|
|
438
|
+
const props = $xeTable
|
|
439
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
440
|
+
|
|
441
|
+
const { editConfig } = props
|
|
442
|
+
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
443
|
+
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender)) {
|
|
444
|
+
return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
|
|
445
|
+
const cell = $xeTable.getCellElement(row, column)
|
|
446
|
+
if (cell) {
|
|
447
|
+
handleEditActive($xeTable, {
|
|
448
|
+
row,
|
|
449
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
450
|
+
column,
|
|
451
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
452
|
+
cell,
|
|
453
|
+
$table: $xeTable
|
|
454
|
+
}, null, false)
|
|
455
|
+
internalData._lastCallTime = Date.now()
|
|
456
|
+
}
|
|
457
|
+
return $xeTable.$nextTick()
|
|
458
|
+
})
|
|
459
|
+
}
|
|
460
|
+
return $xeTable.$nextTick()
|
|
461
|
+
}
|
|
462
|
+
|
|
253
463
|
export default {
|
|
254
464
|
methods: {
|
|
255
465
|
/**
|
|
@@ -492,12 +702,14 @@ export default {
|
|
|
492
702
|
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
493
703
|
*/
|
|
494
704
|
_getUpdateRecords () {
|
|
705
|
+
const $xeTable = this
|
|
706
|
+
|
|
495
707
|
const { keepSource, tableFullData, isUpdateByRow, treeConfig, treeOpts, editStore } = this
|
|
496
708
|
if (keepSource) {
|
|
497
709
|
const { actived } = editStore
|
|
498
710
|
const { row, column } = actived
|
|
499
711
|
if (row || column) {
|
|
500
|
-
|
|
712
|
+
syncActivedCell($xeTable)
|
|
501
713
|
}
|
|
502
714
|
if (treeConfig) {
|
|
503
715
|
return XEUtils.filterTree(tableFullData, row => isUpdateByRow(row), treeOpts)
|
|
@@ -510,80 +722,9 @@ export default {
|
|
|
510
722
|
* 处理激活编辑
|
|
511
723
|
*/
|
|
512
724
|
handleEdit (params: any, evnt: any) {
|
|
513
|
-
const
|
|
514
|
-
const { mode } = editOpts
|
|
515
|
-
const { actived, focused } = editStore
|
|
516
|
-
const { row, column } = params
|
|
517
|
-
const { editRender } = column
|
|
518
|
-
const cell = params.cell = (params.cell || this.getCellElement(row, column))
|
|
519
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod
|
|
520
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
521
|
-
// 激活编辑
|
|
522
|
-
if (!this.hasPendingByRow(row)) {
|
|
523
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
524
|
-
// 判断是否禁用编辑
|
|
525
|
-
let type = 'edit-disabled'
|
|
526
|
-
if (!beforeEditMethod || beforeEditMethod({ ...params, $table: this, $grid: this.$xegrid })) {
|
|
527
|
-
if (mouseConfig) {
|
|
528
|
-
this.clearSelected(evnt)
|
|
529
|
-
this.clearCellAreas(evnt)
|
|
530
|
-
this.clearCopyCellArea(evnt)
|
|
531
|
-
}
|
|
532
|
-
this.closeTooltip()
|
|
533
|
-
if (actived.column) {
|
|
534
|
-
this.handleClearEdit(evnt)
|
|
535
|
-
}
|
|
536
|
-
type = 'edit-activated'
|
|
537
|
-
column.renderHeight = cell.offsetHeight
|
|
538
|
-
actived.args = params
|
|
539
|
-
actived.row = row
|
|
540
|
-
actived.column = column
|
|
541
|
-
if (mode === 'row') {
|
|
542
|
-
tableColumn.forEach((column: any) => this._getColumnModel(row, column))
|
|
543
|
-
} else {
|
|
544
|
-
this._getColumnModel(row, column)
|
|
545
|
-
}
|
|
546
|
-
const afterEditMethod = editOpts.afterEditMethod
|
|
547
|
-
this.$nextTick(() => {
|
|
548
|
-
this.handleFocus(params, evnt)
|
|
549
|
-
if (afterEditMethod) {
|
|
550
|
-
afterEditMethod({ ...params, $table: this, $grid: this.$xegrid })
|
|
551
|
-
}
|
|
552
|
-
})
|
|
553
|
-
}
|
|
554
|
-
this.emitEvent(type, params, evnt)
|
|
725
|
+
const $xeTable = this
|
|
555
726
|
|
|
556
|
-
|
|
557
|
-
if (type === 'edit-activated') {
|
|
558
|
-
this.emitEvent('edit-actived', params, evnt)
|
|
559
|
-
}
|
|
560
|
-
} else {
|
|
561
|
-
const { column: oldColumn } = actived
|
|
562
|
-
if (mouseConfig) {
|
|
563
|
-
this.clearSelected(evnt)
|
|
564
|
-
this.clearCellAreas(evnt)
|
|
565
|
-
this.clearCopyCellArea(evnt)
|
|
566
|
-
}
|
|
567
|
-
if (oldColumn !== column) {
|
|
568
|
-
const { model: oldModel } = oldColumn
|
|
569
|
-
if (oldModel.update) {
|
|
570
|
-
setCellValue(row, oldColumn, oldModel.value)
|
|
571
|
-
}
|
|
572
|
-
this.clearValidate()
|
|
573
|
-
}
|
|
574
|
-
column.renderHeight = cell.offsetHeight
|
|
575
|
-
actived.args = params
|
|
576
|
-
actived.column = column
|
|
577
|
-
setTimeout(() => {
|
|
578
|
-
this.handleFocus(params, evnt)
|
|
579
|
-
})
|
|
580
|
-
}
|
|
581
|
-
focused.column = null
|
|
582
|
-
focused.row = null
|
|
583
|
-
this.focus()
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return this.$nextTick()
|
|
727
|
+
return handleEditActive($xeTable, params, evnt, true)
|
|
587
728
|
},
|
|
588
729
|
/**
|
|
589
730
|
* @deprecated
|
|
@@ -591,32 +732,16 @@ export default {
|
|
|
591
732
|
handleActived (params: any, evnt: any) {
|
|
592
733
|
return this.handleEdit(params, evnt)
|
|
593
734
|
},
|
|
594
|
-
_getColumnModel (row: any, column:
|
|
595
|
-
|
|
596
|
-
if (editRender) {
|
|
597
|
-
model.value = getCellValue(row, column)
|
|
598
|
-
model.update = false
|
|
599
|
-
}
|
|
735
|
+
_getColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
736
|
+
getEditColumnModel(row, column)
|
|
600
737
|
},
|
|
601
|
-
_setColumnModel (row: any, column:
|
|
602
|
-
|
|
603
|
-
if (editRender && model.update) {
|
|
604
|
-
setCellValue(row, column, model.value)
|
|
605
|
-
model.update = false
|
|
606
|
-
model.value = null
|
|
607
|
-
}
|
|
738
|
+
_setColumnModel (row: any, column: VxeTableDefines.ColumnInfo) {
|
|
739
|
+
setEditColumnModel(row, column)
|
|
608
740
|
},
|
|
609
741
|
_syncActivedCell () {
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
if (row || column) {
|
|
614
|
-
if (editOpts.mode === 'row') {
|
|
615
|
-
tableColumn.forEach((column: any) => this._setColumnModel(row, column))
|
|
616
|
-
} else {
|
|
617
|
-
this._setColumnModel(row, column)
|
|
618
|
-
}
|
|
619
|
-
}
|
|
742
|
+
const $xeTable = this
|
|
743
|
+
|
|
744
|
+
syncActivedCell($xeTable)
|
|
620
745
|
},
|
|
621
746
|
_clearActived (row: any) {
|
|
622
747
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -629,54 +754,17 @@ export default {
|
|
|
629
754
|
* 清除激活的编辑
|
|
630
755
|
*/
|
|
631
756
|
_clearEdit (row: any) {
|
|
632
|
-
|
|
757
|
+
const $xeTable = this
|
|
758
|
+
|
|
759
|
+
return handleClearEdit($xeTable, null, row)
|
|
633
760
|
},
|
|
634
761
|
/**
|
|
635
762
|
* 取消编辑
|
|
636
763
|
*/
|
|
637
764
|
handleClearEdit (evnt: Event | null, targetRow?: any) {
|
|
638
765
|
const $xeTable = this
|
|
639
|
-
const props = $xeTable
|
|
640
|
-
const reactData = $xeTable
|
|
641
766
|
|
|
642
|
-
|
|
643
|
-
const { editStore } = reactData
|
|
644
|
-
const { actived, focused } = editStore
|
|
645
|
-
const { row, column } = actived
|
|
646
|
-
const validOpts = $xeTable.validOpts
|
|
647
|
-
const mouseOpts = $xeTable.computeMouseOpts
|
|
648
|
-
if (row || column) {
|
|
649
|
-
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
650
|
-
return $xeTable.$nextTick()
|
|
651
|
-
}
|
|
652
|
-
$xeTable._syncActivedCell()
|
|
653
|
-
actived.args = null
|
|
654
|
-
actived.row = null
|
|
655
|
-
actived.column = null
|
|
656
|
-
$xeTable.updateFooter()
|
|
657
|
-
$xeTable.emitEvent('edit-closed', {
|
|
658
|
-
row,
|
|
659
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
660
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
661
|
-
column,
|
|
662
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
663
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
664
|
-
}, evnt)
|
|
665
|
-
}
|
|
666
|
-
focused.row = null
|
|
667
|
-
focused.column = null
|
|
668
|
-
if (validOpts.autoClear) {
|
|
669
|
-
if (validOpts.msgMode !== 'full' || getConfig().cellVaildMode === 'obsolete') {
|
|
670
|
-
if ($xeTable.clearValidate) {
|
|
671
|
-
return $xeTable.clearValidate()
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
return $xeTable.$nextTick().then(() => {
|
|
676
|
-
if (mouseConfig && mouseOpts.area && $xeTable.handleRecalculateCellAreas) {
|
|
677
|
-
return $xeTable.handleRecalculateCellAreas()
|
|
678
|
-
}
|
|
679
|
-
})
|
|
767
|
+
return handleClearEdit($xeTable, evnt, targetRow)
|
|
680
768
|
},
|
|
681
769
|
_getActiveRecord () {
|
|
682
770
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -776,11 +864,13 @@ export default {
|
|
|
776
864
|
* 激活行编辑
|
|
777
865
|
*/
|
|
778
866
|
_setEditRow (row: any, fieldOrColumn: any) {
|
|
867
|
+
const $xeTable = this
|
|
868
|
+
|
|
779
869
|
let column = XEUtils.find(this.visibleColumn, column => isEnableConf(column.editRender))
|
|
780
870
|
if (fieldOrColumn) {
|
|
781
871
|
column = XEUtils.isString(fieldOrColumn) ? this.getColumnByField(fieldOrColumn) : fieldOrColumn
|
|
782
872
|
}
|
|
783
|
-
return
|
|
873
|
+
return handleEditCell($xeTable, row, column, false)
|
|
784
874
|
},
|
|
785
875
|
_setActiveCell (row: any, fieldOrColumn: any) {
|
|
786
876
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
@@ -793,18 +883,9 @@ export default {
|
|
|
793
883
|
* 激活单元格编辑
|
|
794
884
|
*/
|
|
795
885
|
_setEditCell (row: any, fieldOrColumn: any) {
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
return this.scrollToRow(row, true).then(() => {
|
|
800
|
-
const cell = this.getCellElement(row, column)
|
|
801
|
-
if (cell) {
|
|
802
|
-
this.handleEdit({ row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column), cell, $table: this })
|
|
803
|
-
this.lastCallTime = Date.now()
|
|
804
|
-
}
|
|
805
|
-
})
|
|
806
|
-
}
|
|
807
|
-
return this.$nextTick()
|
|
886
|
+
const $xeTable = this
|
|
887
|
+
|
|
888
|
+
return handleEditCell($xeTable, row, fieldOrColumn, true)
|
|
808
889
|
},
|
|
809
890
|
/**
|
|
810
891
|
* 只对 trigger=dblclick 有效,选中单元格
|
|
@@ -826,6 +907,8 @@ export default {
|
|
|
826
907
|
* 处理选中源
|
|
827
908
|
*/
|
|
828
909
|
handleSelected (params: any, evnt: any) {
|
|
910
|
+
const $xeTable = this
|
|
911
|
+
|
|
829
912
|
const { mouseConfig, mouseOpts, editOpts, editStore } = this
|
|
830
913
|
const { actived, selected } = editStore
|
|
831
914
|
const { row, column } = params
|
|
@@ -833,7 +916,7 @@ export default {
|
|
|
833
916
|
const selectMethod = () => {
|
|
834
917
|
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
835
918
|
if (actived.row !== row || (editOpts.mode === 'cell' ? actived.column !== column : false)) {
|
|
836
|
-
|
|
919
|
+
handleClearEdit($xeTable, evnt)
|
|
837
920
|
this.clearSelected(evnt)
|
|
838
921
|
this.clearCellAreas(evnt)
|
|
839
922
|
this.clearCopyCellArea(evnt)
|