vxe-table-plugin-menus
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -394,2 +394,21 @@ (function (global, factory) { | ||
/** | ||
* 编辑单元格 | ||
*/ | ||
EDIT_CELL: function EDIT_CELL(params) { | ||
var $table = params.$table, | ||
row = params.row, | ||
column = params.column; | ||
$table.setActiveCell(row, column.property); | ||
}, | ||
/** | ||
* 编辑行 | ||
*/ | ||
EDIT_ROW: function EDIT_ROW(params) { | ||
var $table = params.$table, | ||
row = params.row; | ||
$table.setActiveRow(row); | ||
}, | ||
/** | ||
* 插入数据 | ||
@@ -701,2 +720,6 @@ */ | ||
column = params.column; | ||
var editConfig = $table.editConfig, | ||
mouseConfig = $table.mouseConfig, | ||
mouseOpts = $table.mouseOpts, | ||
fnrOpts = $table.fnrOpts; | ||
@@ -737,2 +760,11 @@ switch (code) { | ||
case 'EDIT_ROW': | ||
{ | ||
item.disabled = !editConfig || !columns.some(function (column) { | ||
return column.editRender; | ||
}); | ||
break; | ||
} | ||
case 'EDIT_CELL': | ||
case 'CLEAR_CELL': | ||
@@ -765,5 +797,2 @@ case 'CLEAR_ROW': | ||
if (column) { | ||
var mouseConfig = $table.mouseConfig, | ||
mouseOpts = $table.mouseOpts, | ||
fnrOpts = $table.fnrOpts; | ||
var isChildCol = !!column.parentId; | ||
@@ -805,2 +834,8 @@ | ||
case 'EDIT_CELL': | ||
{ | ||
item.disabled = !editConfig || !column.editRender; | ||
break; | ||
} | ||
case 'COPY_CELL': | ||
@@ -807,0 +842,0 @@ case 'CUT_CELL': |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"function"==typeof define&&define.amd?define("vxe-table-plugin-menus",["exports","xe-utils"],t):"undefined"!=typeof exports?t(exports,require("xe-utils")):(t((t={exports:{}}).exports,e.XEUtils),e.VXETablePluginMenus=t.exports.default)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,o){"use strict";var t,l;function a(a){return function(e){var t=e.$table,e=e.column;o.default.eachTree([e],function(e){e.fixed=a}),t.refreshColumn()}}function n(e,t){var a=e.$table,n=e.row,r=e.column;n&&r&&(e="",a.mouseConfig&&a.mouseOpts.area?e=(t?a.cutCellArea():a.copyCellArea()).text:(a=a.$vxe,e=o.default.toString(o.default.get(n,r.property)),a.clipboard={text:e}),o.default.isFunction(l)?l(e):console.warn("Copy function does not exist, copy to clipboard failed."))}function R(e){var e=e.$table,s=e.getTableData().visibleData,c=e.getTableColumn().visibleColumn,t=e.mouseConfig&&e.mouseOpts.area?e.getCellAreas():[];return e.getMergeCells().filter(function(e){var r=e.row,o=e.col,l=e.rowspan,E=e.colspan;return t.some(function(e){var t=e.rows,a=e.cols,n=s.indexOf(t[0]),e=s.indexOf(t[t.length-1]),t=c.indexOf(a[0]),a=c.indexOf(a[a.length-1]);return n<=r&&r+l-1<=e&&t<=o&&o+E-1<=a})})}function E(e){var t=e.$table,e=R(e);e.length&&t.removeMergeCells(e)}function r(e,t){console.warn('The code "'.concat(e,'" has been scrapped, please use "').concat(t,'"'))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VXETablePluginMenus=void 0,o=(t=o)&&t.__esModule?t:{default:t};var s={CLEAR_CELL:function(e){var n=e.$table,t=e.row,a=e.column;t&&a&&(n.mouseConfig&&n.mouseOpts.area?(e=n.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.property)})})}):n.clearData(t,a.property))},CLEAR_ROW:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)},CLEAR_SELECTED_ROW:function(e){return r("CLEAR_SELECTED_ROW","CLEAR_CHECKBOX_ROW"),s.CLEAR_CHECKBOX_ROW(e)},CLEAR_CHECKBOX_ROW:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())},CLEAR_ALL:function(e){e.$table.clearData()},REVERT_CELL:function(e){var n=e.$table,t=e.row,a=e.column;t&&a&&(n.mouseConfig&&n.mouseOpts.area?(e=n.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.revertData(e,t.property)})})}):n.revertData(t,a.property))},REVERT_ROW:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)},REVERT_SELECTED_ROW:function(e){return r("REVERT_SELECTED_ROW","REVERT_CHECKBOX_ROW"),s.REVERT_CHECKBOX_ROW(e)},REVERT_CHECKBOX_ROW:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())},REVERT_ALL:function(e){e.$table.revertData()},COPY_CELL:function(e){n(e)},CUT_CELL:function(e){n(e,!0)},PASTE_CELL:function(e){var t=e.$table,a=e.row,e=e.column;t.mouseConfig&&t.mouseOpts.area?t.pasteCellArea():(t=t.$vxe.clipboard)&&t.text&&o.default.set(a,e.property,t.text)},MERGE_OR_CLEAR:function(e){var t=e.$table,a=t.getCellAreas(),e=R(e);e.length?t.removeMergeCells(e):t.setMergeCells(a.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))},MERGE_CELL:function(e){var t=e.$table,a=t.$vxe,n=a.modal,r=t.getTableData().visibleData,o=t.getTableColumn().visibleColumn,l=t.getCellAreas();E(e),l.some(function(e){var t=e.rows,e=e.cols;return t.length===r.length||e.length===o.length})?n&&n.message({message:a.t("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):t.setMergeCells(l.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))},CLEAR_MERGE_CELL:function(e){E(e)},CLEAR_ALL_MERGE:function(e){e=e.$table;e.clearMergeCells(),e.clearMergeFooterItems()},INSERT_ROW:function(e){var t=e.$table,e=e.menu;t.insert(e.params)},INSERT_ACTIVED_ROW:function(e){var t=e.$table,a=e.menu,n=e.column,r=a.params||[];t.insert(r[0]).then(function(e){e=e.row;return t.setActiveCell(e,r[1]||n.property)})},INSERT_AT_ROW:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.insertAt(a.params,e)},INSERT_AT_ACTIVED_ROW:function(e){var t,a=e.$table,n=e.menu,r=e.row,o=e.column;r&&(t=n.params||[],a.insertAt(t[0],r).then(function(e){e=e.row;return a.setActiveCell(e,t[1]||o.property)}))},DELETE_ROW:function(e){var t=e.$table,e=e.row;e&&t.remove(e)},DELETE_SELECTED_ROW:function(e){return r("DELETE_SELECTED_ROW","DELETE_CHECKBOX_ROW"),s.DELETE_CHECKBOX_ROW(e)},DELETE_CHECKBOX_ROW:function(e){e.$table.removeCheckboxRow()},DELETE_ALL:function(e){e.$table.remove()},CLEAR_SORT:function(e){e.$table.clearSort()},SORT_ASC:function(e){var t=e.$table,e=e.column;e&&t.sort(e.property,"asc")},SORT_DESC:function(e){var t=e.$table,e=e.column;e&&t.sort(e.property,"desc")},CLEAR_FILTER:function(e){var t=e.$table,e=e.column;e&&t.clearFilter(e)},CLEAR_ALL_FILTER:function(e){e.$table.clearFilter()},FILTER_CELL:function(e){var t=e.$table,a=e.row,n=e.column;a&&n&&(e=n.property,(n=n.filters).length&&((n=n[0]).data=o.default.get(a,e),n.checked=!0,t.updateData()))},EXPORT_ROW:function(e){var t=e.$table,a=e.menu,e=e.row;e&&(e={data:[e]},t.exportData(o.default.assign(e,a.params[0])))},EXPORT_SELECTED_ROW:function(e){return r("EXPORT_SELECTED_ROW","EXPORT_CHECKBOX_ROW"),s.EXPORT_CHECKBOX_ROW(e)},EXPORT_CHECKBOX_ROW:function(e){var t=e.$table,a=e.menu,e={data:t.getCheckboxRecords()};t.exportData(o.default.assign(e,a.params[0]))},EXPORT_ALL:function(e){var t=e.$table,e=e.menu;t.exportData(e.params)},PRINT_ALL:function(e){var t=e.$table,e=e.menu;t.print(e.params)},PRINT_SELECTED_ROW:function(e){return r("PRINT_SELECTED_ROW","PRINT_CHECKBOX_ROW"),s.PRINT_CHECKBOX_ROW(e)},PRINT_CHECKBOX_ROW:function(e){var t=e.$table,a=e.menu,e={data:t.getCheckboxRecords()};t.print(o.default.assign(e,a.params))},OPEN_FIND:function(e){e.$table.openFind()},OPEN_REPLACE:function(e){e.$table.openReplace()},HIDDEN_COLUMN:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)},FIXED_LEFT_COLUMN:a("left"),FIXED_RIGHT_COLUMN:a("right"),CLEAR_FIXED_COLUMN:a(""),RESET_COLUMN:function(e){e.$table.resetColumn({visible:!0,resizable:!1})},RESET_RESIZABLE:function(e){e.$table.resetColumn({visible:!1,resizable:!0})},RESET_ALL:function(e){e.$table.resetColumn(!0)}};function c(e,t){var a=e.code,n=t.$table,r=t.columns,o=t.column;switch(a){case"CLEAR_SORT":e.disabled=!r.some(function(e){return e.sortable&&e.order});break;case"CLEAR_ALL_FILTER":e.disabled=!r.some(function(e){return e.filters&&e.filters.some(function(e){return e.checked})});break;case"CLEAR_ALL_MERGE":var l=n.getMergeCells(),E=n.getMergeFooterItems();e.disabled=!l.length&&!E.length;break;case"CLEAR_MERGE_CELL":E=R(t);e.disabled=!E.length;break;case"CLEAR_CELL":case"CLEAR_ROW":case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":case"MERGE_OR_CLEAR":case"MERGE_CELL":case"REVERT_CELL":case"REVERT_ROW":case"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"DELETE_ROW":case"SORT_ASC":case"SORT_DESC":case"CLEAR_FILTER":case"FILTER_CELL":case"EXPORT_ROW":case"OPEN_FIND":case"OPEN_REPLACE":case"HIDDEN_COLUMN":case"FIXED_LEFT_COLUMN":case"FIXED_RIGHT_COLUMN":case"CLEAR_FIXED_COLUMN":if(e.disabled=!o,o){var s=n.mouseConfig,c=n.mouseOpts,i=n.fnrOpts,u=!!o.parentId;switch(a){case"SORT_ASC":case"SORT_DESC":e.disabled=!o.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!o.filters||!o.filters.length,e.disabled||"CLEAR_FILTER"===a&&(e.disabled=!o.filters.some(function(e){return e.checked}));break;case"OPEN_FIND":e.disabled=!(i&&s&&c.area&&i.isFind);break;case"OPEN_REPLACE":e.disabled=!(i&&s&&c.area&&i.isReplace);break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var C=s&&c.area?n.getCellAreas():[];e.disabled=1<C.length,e.disabled||"PASTE_CELL"===a&&(_=n.$vxe.clipboard,e.disabled=!_||!_.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":var _=s&&c.area?n.getCellAreas():[];e.disabled=!_.length||1===_.length&&1===_[0].rows.length&&1===_[0].cols.length||!function(e,t){for(var a=(e=e.$table).getTableData().visibleData,n=e.getTableColumn().visibleColumn,r={},o=0,l=t.length;o<l;o++)for(var E=t[o],s=E.rows,c=E.cols,i=0,u=s.length;i<u;i++)for(var C=s[i],_=a.indexOf(C),R=0,f=c.length;R<f;R++){var L=c[R],L=_+":"+n.indexOf(L);if(r[L])return;r[L]=!0}return 1}(t,_);break;case"FIXED_LEFT_COLUMN":e.disabled=u||"left"===o.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=u||"right"===o.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=u||!o.fixed}}}}function i(t){t.options.forEach(function(e){e.forEach(function(e){c(e,t),e.children&&e.children.forEach(function(e){c(e,t)})})})}function u(e){e&&e.copy&&(l=e.copy)}var C={setup:u,install:function(e,t){var a=e.interceptor,e=e.menus;window.XEClipboard&&(l=window.XEClipboard.copy),u(t),a.add("event.showMenu",i),e.mixin(s)}};e.VXETablePluginMenus=C,"undefined"!=typeof window&&window.VXETable&&window.VXETable.use(C),e.default=C}); | ||
!function(e,t){"function"==typeof define&&define.amd?define("vxe-table-plugin-menus",["exports","xe-utils"],t):"undefined"!=typeof exports?t(exports,require("xe-utils")):(t((t={exports:{}}).exports,e.XEUtils),e.VXETablePluginMenus=t.exports.default)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,o){"use strict";var t,l;function a(a){return function(e){var t=e.$table,e=e.column;o.default.eachTree([e],function(e){e.fixed=a}),t.refreshColumn()}}function n(e,t){var a=e.$table,n=e.row,r=e.column;n&&r&&(e="",a.mouseConfig&&a.mouseOpts.area?e=(t?a.cutCellArea():a.copyCellArea()).text:(a=a.$vxe,e=o.default.toString(o.default.get(n,r.property)),a.clipboard={text:e}),o.default.isFunction(l)?l(e):console.warn("Copy function does not exist, copy to clipboard failed."))}function f(e){var e=e.$table,s=e.getTableData().visibleData,c=e.getTableColumn().visibleColumn,t=e.mouseConfig&&e.mouseOpts.area?e.getCellAreas():[];return e.getMergeCells().filter(function(e){var r=e.row,o=e.col,l=e.rowspan,E=e.colspan;return t.some(function(e){var t=e.rows,a=e.cols,n=s.indexOf(t[0]),e=s.indexOf(t[t.length-1]),t=c.indexOf(a[0]),a=c.indexOf(a[a.length-1]);return n<=r&&r+l-1<=e&&t<=o&&o+E-1<=a})})}function E(e){var t=e.$table,e=f(e);e.length&&t.removeMergeCells(e)}function r(e,t){console.warn('The code "'.concat(e,'" has been scrapped, please use "').concat(t,'"'))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VXETablePluginMenus=void 0,o=(t=o)&&t.__esModule?t:{default:t};var s={CLEAR_CELL:function(e){var n=e.$table,t=e.row,a=e.column;t&&a&&(n.mouseConfig&&n.mouseOpts.area?(e=n.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.property)})})}):n.clearData(t,a.property))},CLEAR_ROW:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)},CLEAR_SELECTED_ROW:function(e){return r("CLEAR_SELECTED_ROW","CLEAR_CHECKBOX_ROW"),s.CLEAR_CHECKBOX_ROW(e)},CLEAR_CHECKBOX_ROW:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())},CLEAR_ALL:function(e){e.$table.clearData()},REVERT_CELL:function(e){var n=e.$table,t=e.row,a=e.column;t&&a&&(n.mouseConfig&&n.mouseOpts.area?(e=n.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.revertData(e,t.property)})})}):n.revertData(t,a.property))},REVERT_ROW:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)},REVERT_SELECTED_ROW:function(e){return r("REVERT_SELECTED_ROW","REVERT_CHECKBOX_ROW"),s.REVERT_CHECKBOX_ROW(e)},REVERT_CHECKBOX_ROW:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())},REVERT_ALL:function(e){e.$table.revertData()},COPY_CELL:function(e){n(e)},CUT_CELL:function(e){n(e,!0)},PASTE_CELL:function(e){var t=e.$table,a=e.row,e=e.column;t.mouseConfig&&t.mouseOpts.area?t.pasteCellArea():(t=t.$vxe.clipboard)&&t.text&&o.default.set(a,e.property,t.text)},MERGE_OR_CLEAR:function(e){var t=e.$table,a=t.getCellAreas(),e=f(e);e.length?t.removeMergeCells(e):t.setMergeCells(a.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))},MERGE_CELL:function(e){var t=e.$table,a=t.$vxe,n=a.modal,r=t.getTableData().visibleData,o=t.getTableColumn().visibleColumn,l=t.getCellAreas();E(e),l.some(function(e){var t=e.rows,e=e.cols;return t.length===r.length||e.length===o.length})?n&&n.message({message:a.t("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):t.setMergeCells(l.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))},CLEAR_MERGE_CELL:function(e){E(e)},CLEAR_ALL_MERGE:function(e){e=e.$table;e.clearMergeCells(),e.clearMergeFooterItems()},EDIT_CELL:function(e){var t=e.$table,a=e.row,e=e.column;t.setActiveCell(a,e.property)},EDIT_ROW:function(e){var t=e.$table,e=e.row;t.setActiveRow(e)},INSERT_ROW:function(e){var t=e.$table,e=e.menu;t.insert(e.params)},INSERT_ACTIVED_ROW:function(e){var t=e.$table,a=e.menu,n=e.column,r=a.params||[];t.insert(r[0]).then(function(e){e=e.row;return t.setActiveCell(e,r[1]||n.property)})},INSERT_AT_ROW:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.insertAt(a.params,e)},INSERT_AT_ACTIVED_ROW:function(e){var t,a=e.$table,n=e.menu,r=e.row,o=e.column;r&&(t=n.params||[],a.insertAt(t[0],r).then(function(e){e=e.row;return a.setActiveCell(e,t[1]||o.property)}))},DELETE_ROW:function(e){var t=e.$table,e=e.row;e&&t.remove(e)},DELETE_SELECTED_ROW:function(e){return r("DELETE_SELECTED_ROW","DELETE_CHECKBOX_ROW"),s.DELETE_CHECKBOX_ROW(e)},DELETE_CHECKBOX_ROW:function(e){e.$table.removeCheckboxRow()},DELETE_ALL:function(e){e.$table.remove()},CLEAR_SORT:function(e){e.$table.clearSort()},SORT_ASC:function(e){var t=e.$table,e=e.column;e&&t.sort(e.property,"asc")},SORT_DESC:function(e){var t=e.$table,e=e.column;e&&t.sort(e.property,"desc")},CLEAR_FILTER:function(e){var t=e.$table,e=e.column;e&&t.clearFilter(e)},CLEAR_ALL_FILTER:function(e){e.$table.clearFilter()},FILTER_CELL:function(e){var t=e.$table,a=e.row,n=e.column;a&&n&&(e=n.property,(n=n.filters).length&&((n=n[0]).data=o.default.get(a,e),n.checked=!0,t.updateData()))},EXPORT_ROW:function(e){var t=e.$table,a=e.menu,e=e.row;e&&(e={data:[e]},t.exportData(o.default.assign(e,a.params[0])))},EXPORT_SELECTED_ROW:function(e){return r("EXPORT_SELECTED_ROW","EXPORT_CHECKBOX_ROW"),s.EXPORT_CHECKBOX_ROW(e)},EXPORT_CHECKBOX_ROW:function(e){var t=e.$table,a=e.menu,e={data:t.getCheckboxRecords()};t.exportData(o.default.assign(e,a.params[0]))},EXPORT_ALL:function(e){var t=e.$table,e=e.menu;t.exportData(e.params)},PRINT_ALL:function(e){var t=e.$table,e=e.menu;t.print(e.params)},PRINT_SELECTED_ROW:function(e){return r("PRINT_SELECTED_ROW","PRINT_CHECKBOX_ROW"),s.PRINT_CHECKBOX_ROW(e)},PRINT_CHECKBOX_ROW:function(e){var t=e.$table,a=e.menu,e={data:t.getCheckboxRecords()};t.print(o.default.assign(e,a.params))},OPEN_FIND:function(e){e.$table.openFind()},OPEN_REPLACE:function(e){e.$table.openReplace()},HIDDEN_COLUMN:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)},FIXED_LEFT_COLUMN:a("left"),FIXED_RIGHT_COLUMN:a("right"),CLEAR_FIXED_COLUMN:a(""),RESET_COLUMN:function(e){e.$table.resetColumn({visible:!0,resizable:!1})},RESET_RESIZABLE:function(e){e.$table.resetColumn({visible:!1,resizable:!0})},RESET_ALL:function(e){e.$table.resetColumn(!0)}};function c(e,t){var a=e.code,n=t.$table,r=t.columns,o=t.column,l=n.editConfig,E=n.mouseConfig,s=n.mouseOpts,c=n.fnrOpts;switch(a){case"CLEAR_SORT":e.disabled=!r.some(function(e){return e.sortable&&e.order});break;case"CLEAR_ALL_FILTER":e.disabled=!r.some(function(e){return e.filters&&e.filters.some(function(e){return e.checked})});break;case"CLEAR_ALL_MERGE":var i=n.getMergeCells(),u=n.getMergeFooterItems();e.disabled=!i.length&&!u.length;break;case"CLEAR_MERGE_CELL":u=f(t);e.disabled=!u.length;break;case"EDIT_ROW":e.disabled=!l||!r.some(function(e){return e.editRender});break;case"EDIT_CELL":case"CLEAR_CELL":case"CLEAR_ROW":case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":case"MERGE_OR_CLEAR":case"MERGE_CELL":case"REVERT_CELL":case"REVERT_ROW":case"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"DELETE_ROW":case"SORT_ASC":case"SORT_DESC":case"CLEAR_FILTER":case"FILTER_CELL":case"EXPORT_ROW":case"OPEN_FIND":case"OPEN_REPLACE":case"HIDDEN_COLUMN":case"FIXED_LEFT_COLUMN":case"FIXED_RIGHT_COLUMN":case"CLEAR_FIXED_COLUMN":if(e.disabled=!o,o){var C=!!o.parentId;switch(a){case"SORT_ASC":case"SORT_DESC":e.disabled=!o.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!o.filters||!o.filters.length,e.disabled||"CLEAR_FILTER"===a&&(e.disabled=!o.filters.some(function(e){return e.checked}));break;case"OPEN_FIND":e.disabled=!(c&&E&&s.area&&c.isFind);break;case"OPEN_REPLACE":e.disabled=!(c&&E&&s.area&&c.isReplace);break;case"EDIT_CELL":e.disabled=!l||!o.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var _=E&&s.area?n.getCellAreas():[];e.disabled=1<_.length,e.disabled||"PASTE_CELL"===a&&(R=n.$vxe.clipboard,e.disabled=!R||!R.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":var R=E&&s.area?n.getCellAreas():[];e.disabled=!R.length||1===R.length&&1===R[0].rows.length&&1===R[0].cols.length||!function(e,t){for(var a=(e=e.$table).getTableData().visibleData,n=e.getTableColumn().visibleColumn,r={},o=0,l=t.length;o<l;o++)for(var E=t[o],s=E.rows,c=E.cols,i=0,u=s.length;i<u;i++)for(var C=s[i],_=a.indexOf(C),R=0,f=c.length;R<f;R++){var L=c[R],L=_+":"+n.indexOf(L);if(r[L])return;r[L]=!0}return 1}(t,R);break;case"FIXED_LEFT_COLUMN":e.disabled=C||"left"===o.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=C||"right"===o.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=C||!o.fixed}}}}function i(t){t.options.forEach(function(e){e.forEach(function(e){c(e,t),e.children&&e.children.forEach(function(e){c(e,t)})})})}function u(e){e&&e.copy&&(l=e.copy)}var C={setup:u,install:function(e,t){var a=e.interceptor,e=e.menus;window.XEClipboard&&(l=window.XEClipboard.copy),u(t),a.add("event.showMenu",i),e.mixin(s)}};e.VXETablePluginMenus=C,"undefined"!=typeof window&&window.VXETable&&window.VXETable.use(C),e.default=C}); |
25
index.ts
@@ -299,2 +299,16 @@ /* eslint-disable no-unused-vars */ | ||
/** | ||
* 编辑单元格 | ||
*/ | ||
EDIT_CELL(params: MenuLinkParams) { | ||
const { $table, row, column } = params | ||
$table.setActiveCell(row, column.property) | ||
}, | ||
/** | ||
* 编辑行 | ||
*/ | ||
EDIT_ROW(params: MenuLinkParams) { | ||
const { $table, row } = params | ||
$table.setActiveRow(row) | ||
}, | ||
/** | ||
* 插入数据 | ||
@@ -530,2 +544,3 @@ */ | ||
let { $table, columns, column } = params | ||
const { editConfig, mouseConfig, mouseOpts, fnrOpts } = $table | ||
switch (code) { | ||
@@ -551,2 +566,7 @@ case 'CLEAR_SORT': { | ||
} | ||
case 'EDIT_ROW': { | ||
item.disabled = !editConfig || !columns.some((column) => column.editRender) | ||
break | ||
} | ||
case 'EDIT_CELL': | ||
case 'CLEAR_CELL': | ||
@@ -577,3 +597,2 @@ case 'CLEAR_ROW': | ||
if (column) { | ||
const { mouseConfig, mouseOpts, fnrOpts } = $table | ||
const isChildCol = !!column.parentId | ||
@@ -604,2 +623,6 @@ switch (code) { | ||
} | ||
case 'EDIT_CELL': { | ||
item.disabled = !editConfig || !column.editRender | ||
break | ||
} | ||
case 'COPY_CELL': | ||
@@ -606,0 +629,0 @@ case 'CUT_CELL': |
{ | ||
"name": "vxe-table-plugin-menus", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "基于 vxe-table 的表格插件,提供实用的快捷菜单集", | ||
@@ -52,6 +52,6 @@ "scripts": { | ||
"vxe-table": "^2.10.0", | ||
"xe-utils": "^3.0.1" | ||
"xe-utils": "^3.0.4" | ||
}, | ||
"peerDependencies": { | ||
"vxe-table": ">= 2.9" | ||
"vxe-table": ">= 2.10" | ||
}, | ||
@@ -58,0 +58,0 @@ "repository": { |
@@ -58,2 +58,4 @@ # vxe-table-plugin-menus | ||
| PASTE_CELL | 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板 | — | | ||
| EDIT_CELL | 编辑选中单元格 | — | | ||
| EDIT_ROW | 编辑选中行并默认激活第一个编辑的单元格 | — | | ||
| INSERT_ROW | 插入数据 | records | | ||
@@ -60,0 +62,0 @@ | INSERT_ACTIVED_ROW | 插入数据并激活编辑状态 | Array\<records, field\> | |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180213
343
2644
134