@vxe-ui/plugin-menu 4.3.2 → 4.3.4

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.
@@ -1 +1 @@
1
- ((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("xe-utils"),require("vue")):"function"==typeof define&&define.amd?define(["xe-utils","vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VxeUIPluginMenu=t(e.XEUtils,e.Vue)})(this,function(e,t){function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,u,i,c,l,o,_,g,r={};function s(a){return{tableMenuMethod:function(e){var t=e.$table;c.default.eachTree([e.column],function(e){e.fixed=a}),t.refreshColumn()}}}function m(){var e=u.globalStore;return e?e.clipboard||"":(e=u.config)&&e.clipboard?e.clipboard:null}function d(e){var t,a;try{t=e,o||((o=document.createElement("textarea")).id="$XECopy",(a=o.style).width="48px",a.height="24px",a.position="fixed",a.zIndex="0",a.left="-500px",a.top="-500px",document.body.appendChild(o)),o.value=null==t?"":""+t,o.select(),o.setSelectionRange(0,o.value.length),document.execCommand("copy"),o.blur()}catch(e){}}function E(e,t){var a,n,l,o=e.$event,r=e.$table,s=e.row,e=e.column;s&&e&&(a=r.props.mouseConfig,l=r.getComputeMaps().computeMouseOpts.value,n="",a&&l.area?(t?r.triggerCutCellAreaEvent(o):r.triggerCopyCellAreaEvent(o),n=(a=m())?a.text:""):(n=c.default.toValueString(c.default.get(s,e.field)),l={text:n,html:""},(t=u.globalStore)?t.clipboard=l:u.config&&(u.config.clipboard=l)),(c.default.isFunction(i)?i:d)(n))}function f(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}function b(e){var u=e.$table,e=u.props.mouseConfig,t=u.getComputeMaps().computeMouseOpts.value,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,a=e&&t.area?u.getCellAreas():[];return u.getMergeCells().filter(function(e){var l=e.row,o=e.col,r=e.rowspan,s=e.colspan;return a.some(function(e){var t=e.rows,e=e.cols,a=g(u,i,t[0]),t=g(u,i,t[t.length-1]),n=_(c,e[0]),e=_(c,e[e.length-1]);return a<=l&&l+r-1<=t&&n<=o&&o+s-1<=e})})}function C(e){var t=e.$table,e=b(e);return e.length&&t.removeMergeCells(e),e}function M(e,t){var a=e.code,n=t.$table,l=t.$grid,o=t.row,r=t.column,s=t.type,u=n.props,i=u.editConfig,c=u.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var d=n.getSortColumns();e.disabled=!d.length;break;case"CLEAR_ALL_FILTER":d=n.getCheckedFilters();e.disabled=!d.length;break;case"CLEAR_ALL_MERGE":var d=n.getMergeCells(),E=n.getMergeFooterItems();e.disabled=!d.length&&!E.length;break;case"CLEAR_MERGE_CELL":d=b(t);e.disabled=!d.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==s;break;case"SELECT_ALL_AREA":E=n.getTableData().visibleData,d=n.getTableColumn().visibleColumn;e.disabled=!E.length||!d.length;break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!r||!o;break;case"DELETE_CHECKBOX_ROW":E=n.getCheckboxRecords();e.disabled=!E.length;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"DELETE_ROW":case"DELETE_AREA_ROW":case"CLEAR_SORT":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=!r,r){var f=n.getComputeMaps().computeMouseOpts.value,C=!!r.parentId;switch(a){case"CLEAR_SORT":e.disabled=!r.sortable||!r.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!r.filters||!r.filters.length,e.disabled||"CLEAR_FILTER"===a&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!n.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!n.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(c&&f.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var M=c&&f.area?n.getCellAreas():[];e.disabled=1<M.length,e.disabled||"PASTE_CELL"===a&&(M=m(),e.disabled=!M||!M.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":M=c&&f.area?n.getCellAreas():[];e.disabled=!M.length||1===M.length&&1===M[0].rows.length&&1===M[0].cols.length||!((e,t)=>{for(var a=e.$table,n=a.getTableData().visibleData,l=a.getTableColumn().visibleColumn,o={},r=0,s=t.length;r<s;r++)for(var u=t[r],i=u.rows,c=u.cols,d=0,E=i.length;d<E;d++)for(var f=i[d],C=g(a,n,f),M=0,m=c.length;M<m;M++){var b=c[M],b=C+":"+_(l,b);if(o[b])return;o[b]=!0}return 1})(t,M);break;case"FIXED_LEFT_COLUMN":e.disabled=C||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=C||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=C||!r.fixed}}break;case"COMMIT_PROXY_INITIAL":case"COMMIT_PROXY_QUERY":case"COMMIT_PROXY_RELOAD":case"COMMIT_PROXY_DELETE":case"COMMIT_PROXY_SAVE":e.disabled=!l}}function R(t){return t.options.forEach(function(e){e.forEach(function(e){M(e,t),e.children&&e.children.forEach(function(e){M(e,t)})})}),!0}function p(){return new Promise(function(t){var e,a;u.modal?(e=u.getComponent("VxeNumberInput"))?(a=(0,l.ref)(1),u.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,l.h)(e,{modelValue:a.value,min:1,max:100,type:"integer",align:"center",controlConfig:{layout:"default"},style:{width:"100%"},"onUpdate:modelValue":function(e){a.value=e}})}}}).then(function(e){t("confirm"===e?{size:a.value||1}:{size:0})})):(console.error(u.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function h(){location.reload()}function v(){history.forward()}function L(){history.back()}function T(e){e&&e.copy&&(i=e.copy)}return n||(n=1,n=r,Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.VxeUIPluginMenu=void 0,c=(e=e)&&e.__esModule?e:{default:e},l=t,_=function(e,t){return c.default.findIndexOf(e,function(e){return e.id===t.id})},g=function(e,t,a){return e.findRowIndexOf(t,a)},e=n.VxeUIPluginMenu={setConfig:T,install:function(e,t){(u=e).checkVersion?u.checkVersion(u.tableVersion,4,11)||console.error("[@vxe-ui/plugin-menu 4.3.2] ".concat(u.getI18n("vxe.error.errorVersion",["vxe-table@".concat(u.tableVersion||"?"),"vxe-table v".concat(4,".").concat(11,"+")])," https://vxeui.com/other4/#/plugin-menu/install")):/^(4)\./.test(u.uiVersion||u.tableVersion)||console.error("[@vxe-ui/plugin-menu 4.3.2] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install"),T(t),u.menus.mixin({SYSTEM_PAGE_REFRESH:{tableMenuMethod:h,treeMenuMethod:h,calendarMenuMethod:h,menuMenuMethod:h,formDesignMenuMethod:h},SYSTEM_PAGE_FORWARD:{tableMenuMethod:v,treeMenuMethod:v,calendarMenuMethod:v,menuMenuMethod:v,formDesignMenuMethod:v},SYSTEM_PAGE_BACK:{tableMenuMethod:L,treeMenuMethod:L,calendarMenuMethod:L,menuMenuMethod:L,formDesignMenuMethod:L},CLEAR_CELL:{tableMenuMethod:function(e){var t,a,n=e.$table,l=e.row,e=e.column;l&&e&&(a=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,a&&t.area?(a=n.getCellAreas())&&a.length&&a.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.field)})})}):n.clearData(l,e.field))}},CLEAR_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;n&&l.area?(n&&l.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):a&&e&&t.clearData(a)}},CLEAR_ALL:{tableMenuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{tableMenuMethod:function(e){var e=e.$table,t=e.props.mouseConfig,a=e.getComputeMaps().computeMouseOpts.value;t&&a.area&&(t=e.getTableData().visibleData,a=e.getTableColumn().visibleColumn,e.setCellAreas([{startRow:c.default.first(t),endRow:c.default.last(t),startColumn:c.default.first(a),endColumn:c.default.last(a)}]))}},SELECT_AREA_TO_LEFT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableColumn().visibleColumn,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(l.rows),startColumn:c.default.first(n),endColumn:c.default.last(l.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:c.default.first(n),endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_RIGHT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableColumn().visibleColumn,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(l.rows),startColumn:c.default.first(l.cols),endColumn:c.default.last(n)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:e,endColumn:c.default.last(n)}],{column:e,row:a}))}},SELECT_AREA_TO_TOP:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(n),endRow:c.default.last(l.rows),startColumn:c.default.first(l.cols),endColumn:c.default.last(l.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:c.default.first(n),endRow:a,startColumn:e,endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_BOTTON:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&l.area&&(n=t.getTableData().visibleData,1===(l=t.getCellAreas()).length?(l=l[0],t.setCellAreas([{startRow:c.default.first(l.rows),endRow:c.default.last(n),startColumn:c.default.first(l.cols),endColumn:c.default.last(l.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:c.default.last(n),startColumn:e,endColumn:e}],{column:e,row:a}))}},REVERT_CELL:{tableMenuMethod:function(e){var t,a,n=e.$table,l=e.row,e=e.column;l&&e&&(a=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,a&&t.area?(a=n.getCellAreas())&&a.length&&a.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.revertData(e,t.field)})})}):n.revertData(l,e.field))}},REVERT_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{tableMenuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{tableMenuMethod:function(e){e=e.column.getTitle();e&&(c.default.isFunction(i)?i:d)(e)}},COPY_CELL:{tableMenuMethod:function(e){E(e)}},CUT_CELL:{tableMenuMethod:function(e){E(e,!0)}},PASTE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=e.row,e=e.column,l=a.props.mouseConfig,o=a.getComputeMaps().computeMouseOpts.value;l&&o.area?a.triggerPasteCellAreaEvent(t):(l=m())&&l.text&&c.default.set(n,e.field,l.text)}},MERGE_OR_CLEAR:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getCellAreas(),e=b(e),l=!1,e=(e.length?a.removeMergeCells(e):(l=!0,a.setMergeCells(n.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),n.map(function(e){return{rows:e.rows,cols:e.cols}}));a.dispatchEvent("cell-area-merge",{status:l,targetAreas:e},t)}},MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getTableData().visibleData,l=a.getTableColumn().visibleColumn,o=a.getCellAreas();C(e),o.some(function(e){return e.rows.length===n.length||e.cols.length===l.length})?u.modal&&u.modal.message({content:u.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(a.setMergeCells(o.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=o.map(function(e){return{rows:e.rows,cols:e.cols}}),a.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=C(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.getMergeCells(),n=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:a,mergeFooterItems:n},t)}},EDIT_CELL:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column;t.setEditCell?t.setEditCell(a,e):t.setActiveCell(a,e.field)}},EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.column,l=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;t.insert(a.params||{}).then(function(e){e=e.rows;n&&l&&o.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:n,endColumn:n}])})}},INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;(n?t.insertAt(a.params||{},n):t.insert(a.params||{})).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])})}},BATCH_INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])}))})}},INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;(n?t.insertNextAt(a.params||{},n):t.insert(a.params||{})).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])})}},BATCH_INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,l=e.column,o=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.rows;l&&o&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:l,endColumn:l}])}))})}},INSERT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_AT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)})}},INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)})}},BATCH_INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[];p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},l[0])}),(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)}))})}},INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[],e=Object.assign({},l[0]||{});(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)})}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,l=e.menu.params||[];p().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},l[0])}),(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,l[1]||n):t.setActiveCell(e,l[1]||n.field)}))})}},DELETE_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row,a=t.props.mouseConfig,n=t.getComputeMaps().computeMouseOpts.value;a&&n.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{tableMenuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{tableMenuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.getSortColumns();a.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:a},t))}},SORT_ASC:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")}},SORT_DESC:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.getCheckedFilters();a.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:a},t))}},FILTER_CELL:{tableMenuMethod:function(e){var t,a=e.$table,n=e.row,e=e.column;n&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=c.default.get(n,t),e.checked=!0,a.updateData())}},EXPORT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(c.default.assign({},a.params?a.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.exportData(c.default.assign({},e.params?e.params[0]:{},a))}},EXPORT_ALL:{tableMenuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{tableMenuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.print(c.default.assign(a,e.params))}},OPEN_FIND:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"find"):e.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"replace"):e.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{tableMenuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:s("left"),FIXED_RIGHT_COLUMN:s("right"),CLEAR_FIXED_COLUMN:s(null),RESET_COLUMN:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{tableMenuMethod:function(e){e.$table.resetColumn(!0)}},COMMIT_PROXY_INITIAL:{tableMenuMethod:f("initial")},COMMIT_PROXY_QUERY:{tableMenuMethod:f("query")},COMMIT_PROXY_RELOAD:{tableMenuMethod:f("reload")},COMMIT_PROXY_DELETE:{tableMenuMethod:f("delete")},COMMIT_PROXY_SAVE:{tableMenuMethod:f("save")}}),u.interceptor.add("event.showMenu",R)}},"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(e),n.default=e),a(r)});
1
+ ((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("xe-utils"),require("vue")):"function"==typeof define&&define.amd?define(["xe-utils","vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VxeUIPluginMenu=t(e.XEUtils,e.Vue)})(this,function(e,t){function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,u,i,c,o,l,_,R,r={};function s(a){return{tableMenuMethod:function(e){var t=e.$table;c.default.eachTree([e.column],function(e){e.fixed=a}),t.refreshColumn()}}}function b(){var e=u.globalStore;return e?e.clipboard||"":(e=u.config)&&e.clipboard?e.clipboard:null}function d(e){var t,a;try{t=e,l||((l=document.createElement("textarea")).id="$XECopy",(a=l.style).width="48px",a.height="24px",a.position="fixed",a.zIndex="0",a.left="-500px",a.top="-500px",document.body.appendChild(l)),l.value=null==t?"":""+t,l.select(),l.setSelectionRange(0,l.value.length),document.execCommand("copy"),l.blur()}catch(e){}}function E(e,t){var a,n,o,l=e.$event,r=e.$table,s=e.row,e=e.column;s&&e&&(a=r.props.mouseConfig,o=r.getComputeMaps().computeMouseOpts.value,a&&o.area?(t?r.triggerCutCellAreaEvent(l):r.triggerCopyCellAreaEvent(l),n=(a=b())?a.text:""):(n=c.default.toValueString(c.default.get(s,e.field)),o={text:n,html:""},(t=u.globalStore)?t.clipboard=o:u.config&&(u.config.clipboard=o)),(c.default.isFunction(i)?i:d)(n))}function C(t){return function(e){e=e.$grid;e&&e.commitProxy(t)}}function p(e){var u=e.$table,e=u.props.mouseConfig,t=u.getComputeMaps().computeMouseOpts.value,i=u.getTableData().visibleData,c=u.getTableColumn().visibleColumn,a=e&&t.area?u.getCellAreas():[];return u.getMergeCells().filter(function(e){var o=e.row,l=e.col,r=e.rowspan,s=e.colspan;return a.some(function(e){var t=e.rows,e=e.cols,a=R(u,i,t[0]),t=R(u,i,t[t.length-1]),n=_(c,e[0]),e=_(c,e[e.length-1]);return a<=o&&o+r-1<=t&&n<=l&&l+s-1<=e})})}function f(e){var t=e.$table,e=p(e);return e.length&&t.removeMergeCells(e),e}function M(e,t){var a=e.code,n=t.$table,o=t.$grid,l=t.row,r=t.column,s=t.type,u=n.props,i=u.editConfig,c=u.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var d=n.getSortColumns();e.disabled=!d.length;break;case"CLEAR_ALL_FILTER":d=n.getCheckedFilters();e.disabled=!d.length;break;case"CLEAR_ALL_MERGE":var d=n.getMergeCells(),E=n.getMergeFooterItems();e.disabled=!d.length&&!E.length;break;case"CLEAR_MERGE_CELL":d=p(t);e.disabled=!d.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==s;break;case"SELECT_ALL_AREA":E=n.getTableData().visibleData,d=n.getTableColumn().visibleColumn;e.disabled=!E.length||!d.length;break;case"SELECT_AREA_TO_LEFT":case"SELECT_AREA_TO_RIGHT":case"SELECT_AREA_TO_TOP":case"SELECT_AREA_TO_BOTTON":e.disabled=!r||!l;break;case"DELETE_CHECKBOX_ROW":E=n.getCheckboxRecords();e.disabled=!E.length;break;case"EDIT_CELL":case"CLEAR_CELL":case"CLEAR_AREA_CELL":case"CLEAR_ROW":case"COPY_CELL":case"COPY_AREA_CELL":case"CUT_CELL":case"CUT_AREA_CELL":case"PASTE_CELL":case"PASTE_AREA_CELL":case"MERGE_OR_CLEAR":case"MERGE_CELL":case"REVERT_CELL":case"REVERT_ROW":case"DELETE_ROW":case"DELETE_AREA_ROW":case"CLEAR_SORT":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=!r,r){var C=n.getComputeMaps().computeMouseOpts.value,f=!!r.parentId;switch(a){case"CLEAR_SORT":e.disabled=!r.sortable||!r.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!r.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!r.filters||!r.filters.length,e.disabled||"CLEAR_FILTER"===a&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!l||!r.field||!n.isUpdateByRow(l,r.field);break;case"REVERT_ROW":e.disabled=!l||!r.field||!n.isUpdateByRow(l);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(c&&C.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"COPY_AREA_CELL":case"CUT_CELL":case"CUT_AREA_CELL":case"PASTE_CELL":case"PASTE_AREA_CELL":var M=c&&C.area?n.getCellAreas():[];if(e.disabled=1<M.length,!e.disabled)switch(a){case"PASTE_CELL":case"PASTE_AREA_CELL":var m=b();e.disabled=!m||!m.text}break;case"MERGE_OR_CLEAR":case"MERGE_CELL":M=c&&C.area?n.getCellAreas():[];e.disabled=!M.length||1===M.length&&1===M[0].rows.length&&1===M[0].cols.length||!((e,t)=>{for(var a=e.$table,n=a.getTableData().visibleData,o=a.getTableColumn().visibleColumn,l={},r=0,s=t.length;r<s;r++)for(var u=t[r],i=u.rows,c=u.cols,d=0,E=i.length;d<E;d++)for(var C=i[d],f=R(a,n,C),M=0,m=c.length;M<m;M++){var b=c[M],b=f+":"+_(o,b);if(l[b])return;l[b]=!0}return 1})(t,M);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===r.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===r.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!r.fixed}}break;case"COMMIT_PROXY_INITIAL":case"COMMIT_PROXY_QUERY":case"COMMIT_PROXY_RELOAD":case"COMMIT_PROXY_DELETE":case"COMMIT_PROXY_SAVE":e.disabled=!o}}function m(t){return t.options.forEach(function(e){e.forEach(function(e){M(e,t),e.children&&e.children.forEach(function(e){M(e,t)})})}),!0}function g(){return new Promise(function(t){var e,a;u.modal?(e=u.getComponent("VxeNumberInput"))?(a=(0,o.ref)(1),u.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,o.h)(e,{modelValue:a.value,min:1,max:100,type:"integer",align:"center",controlConfig:{layout:"default"},style:{width:"100%"},"onUpdate:modelValue":function(e){a.value=e}})}}}).then(function(e){t("confirm"===e?{size:a.value||1}:{size:0})})):(console.error(u.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function h(){location.reload()}function v(){history.forward()}function L(){history.back()}function A(e){e&&e.copy&&(i=e.copy)}return n||(n=1,n=r,Object.defineProperty(n,"__esModule",{value:!0}),n.default=n.VxeUIPluginMenu=void 0,c=(e=e)&&e.__esModule?e:{default:e},o=t,_=function(e,t){return c.default.findIndexOf(e,function(e){return e.id===t.id})},R=function(e,t,a){return e.findRowIndexOf(t,a)},e=n.VxeUIPluginMenu={setConfig:A,install:function(e,t){(u=e).checkVersion?u.checkVersion(u.tableVersion,4,11)||console.error("[@vxe-ui/plugin-menu 4.3.4] ".concat(u.getI18n("vxe.error.errorVersion",["vxe-table@".concat(u.tableVersion||"?"),"vxe-table v".concat(4,".").concat(11,"+")])," https://vxeui.com/other4/#/plugin-menu/install")):/^(4)\./.test(u.uiVersion||u.tableVersion)||console.error("[@vxe-ui/plugin-menu 4.3.4] Requires vxe-table 4.7.0+ version. https://vxeui.com/other4/#/plugin-menu/install"),A(t),u.menus.mixin({SYSTEM_PAGE_REFRESH:{tableMenuMethod:h,treeMenuMethod:h,calendarMenuMethod:h,menuMenuMethod:h,formDesignMenuMethod:h},SYSTEM_PAGE_FORWARD:{tableMenuMethod:v,treeMenuMethod:v,calendarMenuMethod:v,menuMenuMethod:v,formDesignMenuMethod:v},SYSTEM_PAGE_BACK:{tableMenuMethod:L,treeMenuMethod:L,calendarMenuMethod:L,menuMenuMethod:L,formDesignMenuMethod:L},CLEAR_CELL:{tableMenuMethod:function(e){var t,a,n=e.$table,o=e.row,e=e.column;o&&e&&(a=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,a&&t.area?(a=n.getCellAreas())&&a.length&&a.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.clearData(e,t.field)})})}):n.clearData(o,e.field))}},CLEAR_AREA_CELL:{tableMenuMethod:function(e){var t,n=e.$table;e.row&&e.column&&(e=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,e)&&t.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.field)})})})}},CLEAR_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;n&&o.area?(n&&o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):a&&e&&t.clearData(a)}},CLEAR_ALL:{tableMenuMethod:function(e){e.$table.clearData()}},SELECT_ALL_AREA:{tableMenuMethod:function(e){var e=e.$table,t=e.props.mouseConfig,a=e.getComputeMaps().computeMouseOpts.value;t&&a.area&&(t=e.getTableData().visibleData,a=e.getTableColumn().visibleColumn,e.setCellAreas([{startRow:c.default.first(t),endRow:c.default.last(t),startColumn:c.default.first(a),endColumn:c.default.last(a)}]))}},SELECT_AREA_TO_LEFT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableColumn().visibleColumn,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:c.default.first(o.rows),endRow:c.default.last(o.rows),startColumn:c.default.first(n),endColumn:c.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:c.default.first(n),endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_RIGHT:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableColumn().visibleColumn,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:c.default.first(o.rows),endRow:c.default.last(o.rows),startColumn:c.default.first(o.cols),endColumn:c.default.last(n)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:a,startColumn:e,endColumn:c.default.last(n)}],{column:e,row:a}))}},SELECT_AREA_TO_TOP:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableData().visibleData,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:c.default.first(n),endRow:c.default.last(o.rows),startColumn:c.default.first(o.cols),endColumn:c.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:c.default.first(n),endRow:a,startColumn:e,endColumn:e}],{column:e,row:a}))}},SELECT_AREA_TO_BOTTON:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column,n=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&e&&n&&o.area&&(n=t.getTableData().visibleData,1===(o=t.getCellAreas()).length?(o=o[0],t.setCellAreas([{startRow:c.default.first(o.rows),endRow:c.default.last(n),startColumn:c.default.first(o.cols),endColumn:c.default.last(o.cols)}],{column:e,row:a})):t.setCellAreas([{startRow:a,endRow:c.default.last(n),startColumn:e,endColumn:e}],{column:e,row:a}))}},REVERT_CELL:{tableMenuMethod:function(e){var t,a,n=e.$table,o=e.row,e=e.column;o&&e&&(a=n.props.mouseConfig,t=n.getComputeMaps().computeMouseOpts.value,a&&t.area?(a=n.getCellAreas())&&a.length&&a.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){n.revertData(e,t.field)})})}):n.revertData(o,e.field))}},REVERT_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{tableMenuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{tableMenuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{tableMenuMethod:function(e){e=e.column.getTitle();e&&(c.default.isFunction(i)?i:d)(e)}},COPY_CELL:{tableMenuMethod:function(e){E(e)}},COPY_AREA_CELL:{tableMenuMethod:function(e){E(e)}},CUT_CELL:{tableMenuMethod:function(e){E(e,!0)}},CUT_AREA_CELL:{tableMenuMethod:function(e){E(e,!0)}},PASTE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=e.row,e=e.column,o=a.props.mouseConfig,l=a.getComputeMaps().computeMouseOpts.value;o&&l.area?a.triggerPasteCellAreaEvent(t):(o=b())&&o.text&&c.default.set(n,e.field,o.text)}},PASTE_AREA_CELL:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.props.mouseConfig,n=e.getComputeMaps().computeMouseOpts.value;a&&n.area&&e.triggerPasteCellAreaEvent(t)}},MERGE_OR_CLEAR:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getCellAreas(),e=p(e),o=!1,e=(e.length?a.removeMergeCells(e):(o=!0,a.setMergeCells(n.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}}))),n.map(function(e){return{rows:e.rows,cols:e.cols}}));a.dispatchEvent("cell-area-merge",{status:o,targetAreas:e},t)}},MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,n=a.getTableData().visibleData,o=a.getTableColumn().visibleColumn,l=a.getCellAreas();f(e),l.some(function(e){return e.rows.length===n.length||e.cols.length===o.length})?u.modal&&u.modal.message({content:u.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(a.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}})),e=l.map(function(e){return{rows:e.rows,cols:e.cols}}),a.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=f(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.getMergeCells(),n=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:a,mergeFooterItems:n},t)}},EDIT_CELL:{tableMenuMethod:function(e){var t=e.$table,a=e.row,e=e.column;t.setEditCell?t.setEditCell(a,e):t.setActiveCell(a,e.field)}},EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.column,o=t.props.mouseConfig,l=t.getComputeMaps().computeMouseOpts.value;t.insert(a.params||{}).then(function(e){e=e.rows;n&&o&&l.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:n,endColumn:n}])})}},INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;(n?t.insertAt(a.params||{},n):t.insert(a.params||{})).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:o,endColumn:o}])})}},BATCH_INSERT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;g().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertAt(e,n):t.insert(e)).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:o,endColumn:o}])}))})}},INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;(n?t.insertNextAt(a.params||{},n):t.insert(a.params||{})).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:o,endColumn:o}])})}},BATCH_INSERT_NEXT_AT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,n=e.row,o=e.column,l=t.props.mouseConfig,r=t.getComputeMaps().computeMouseOpts.value;g().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},a.params)}),(n?t.insertNextAt(e,n):t.insert(e)).then(function(e){e=e.rows;o&&l&&r.area&&t.setCellAreas([{startRow:c.default.first(e),endRow:c.default.last(e),startColumn:o,endColumn:o}])}))})}},INSERT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.column,n=e.menu.params||[],e=Object.assign({},n[0]||{});t.insert(e).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,n[1]||a):t.setActiveCell(e,n[1]||a.field)})}},INSERT_AT_ACTIVED_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[],e=Object.assign({},o[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)})}},INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[],e=Object.assign({},o[0]||{});(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)})}},BATCH_INSERT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[];g().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},o[0])}),(a?t.insertAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)}))})}},INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[],e=Object.assign({},o[0]||{});(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)})}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.row,n=e.column,o=e.menu.params||[];g().then(function(e){var e=e.size;e&&(e=c.default.range(0,e).map(function(){return Object.assign({},o[0])}),(a?t.insertNextAt(e,a):t.insert(e)).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,o[1]||n):t.setActiveCell(e,o[1]||n.field)}))})}},DELETE_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.row,a=t.props.mouseConfig,n=t.getComputeMaps().computeMouseOpts.value;a&&n.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{tableMenuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{tableMenuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.getSortColumns();a.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:a},t))}},SORT_ASC:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")}},SORT_DESC:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{tableMenuMethod:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{tableMenuMethod:function(e){var t=e.$event,e=e.$table,a=e.getCheckedFilters();a.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:a},t))}},FILTER_CELL:{tableMenuMethod:function(e){var t,a=e.$table,n=e.row,e=e.column;n&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=c.default.get(n,t),e.checked=!0,a.updateData())}},EXPORT_ROW:{tableMenuMethod:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(c.default.assign({},a.params?a.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.exportData(c.default.assign({},e.params?e.params[0]:{},a))}},EXPORT_ALL:{tableMenuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{tableMenuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{tableMenuMethod:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.print(c.default.assign(a,e.params))}},OPEN_FIND:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"find"):e.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{tableMenuMethod:function(e){var t=e.$event,e=e.$table;e.triggerFnrOpenEvent?e.triggerFnrOpenEvent(t,"replace"):e.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{tableMenuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:s("left"),FIXED_RIGHT_COLUMN:s("right"),CLEAR_FIXED_COLUMN:s(null),RESET_COLUMN:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{tableMenuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{tableMenuMethod:function(e){e.$table.resetColumn(!0)}},COMMIT_PROXY_INITIAL:{tableMenuMethod:C("initial")},COMMIT_PROXY_QUERY:{tableMenuMethod:C("query")},COMMIT_PROXY_RELOAD:{tableMenuMethod:C("reload")},COMMIT_PROXY_DELETE:{tableMenuMethod:C("delete")},COMMIT_PROXY_SAVE:{tableMenuMethod:C("save")}}),u.interceptor.add("event.showMenu",m)}},"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(e),n.default=e),a(r)});
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@vxe-ui/plugin-menu",
3
- "version": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "description": "Vxe UI plug-in supports context menu.",
5
5
  "scripts": {
6
- "update": "npm install --legacy-peer-deps",
6
+ "update": "npm install",
7
7
  "lib": "gulp build"
8
8
  },
9
9
  "files": [
@@ -20,24 +20,22 @@
20
20
  "style": "lib/style.css",
21
21
  "typings": "types/index.d.ts",
22
22
  "devDependencies": {
23
- "@types/node": "20.14.8",
23
+ "@eslint/css": "^1.4.0",
24
+ "@eslint/js": "^10.0.1",
25
+ "@eslint/json": "^2.0.1",
26
+ "@eslint/markdown": "^8.0.3",
27
+ "@types/node": "~24.12.3",
24
28
  "@babel/core": "~7.28.6",
25
29
  "@babel/preset-env": "~7.28.6",
26
30
  "@babel/runtime": "~7.28.6",
27
31
  "@rollup/plugin-commonjs": "^29.0.0",
28
- "@typescript-eslint/eslint-plugin": "^4.6.1",
29
- "@typescript-eslint/parser": "^4.6.1",
32
+ "@typescript-eslint/eslint-plugin": "^8.67.0",
33
+ "@typescript-eslint/parser": "^8.67.0",
30
34
  "del": "^6.0.0",
31
- "eslint": "^7.13.0",
32
- "eslint-config-prettier": "^6.15.0",
33
- "eslint-config-standard": "^16.0.1",
34
- "eslint-friendly-formatter": "^4.0.1",
35
- "eslint-plugin-import": "^2.22.1",
36
- "eslint-plugin-node": "^11.1.0",
37
- "eslint-plugin-prettier": "^3.1.4",
38
- "eslint-plugin-promise": "^4.2.1",
39
- "eslint-plugin-standard": "^4.0.2",
40
- "eslint-plugin-typescript": "^0.14.0",
35
+ "eslint": "^10.8.1",
36
+ "eslint-config-flat": "^1.0.0",
37
+ "eslint-plugin-vue": "^10.10.0",
38
+ "globals": "^17.11.0",
41
39
  "gulp": "^4.0.2",
42
40
  "gulp-autoprefixer": "^8.0.0",
43
41
  "gulp-babel": "^8.0.0",
@@ -53,11 +51,12 @@
53
51
  "prettier": "^2.1.2",
54
52
  "rollup": "^4.53.3",
55
53
  "sass": "^1.55.0",
56
- "typescript": "~4.7.4",
54
+ "typescript": "~6.0.3",
55
+ "typescript-eslint": "^8.67.0",
57
56
  "vinyl-source-stream": "^2.0.0",
58
57
  "vue": "3.4.27",
59
- "vxe-pc-ui": "~4.14.15",
60
- "vxe-table": "~4.18.13"
58
+ "vxe-pc-ui": "~4.17.14",
59
+ "vxe-table": "~4.21.0"
61
60
  },
62
61
  "repository": {
63
62
  "type": "git",
package/src/index.ts CHANGED
@@ -91,7 +91,7 @@ function handleCopyOrCut (params: VxeGlobalMenusHandles.TableMenuMethodParams &
91
91
  const { mouseConfig } = tableProps
92
92
  const { computeMouseOpts } = $table.getComputeMaps()
93
93
  const mouseOpts = computeMouseOpts.value
94
- let text = ''
94
+ let text: string
95
95
  if (mouseConfig && mouseOpts.area) {
96
96
  if (isCut) {
97
97
  $table.triggerCutCellAreaEvent($event)
@@ -230,10 +230,14 @@ function checkPrivilege (item: VxeTableDefines.MenuFirstOption | VxeTableDefines
230
230
  }
231
231
  case 'EDIT_CELL':
232
232
  case 'CLEAR_CELL':
233
+ case 'CLEAR_AREA_CELL':
233
234
  case 'CLEAR_ROW':
234
235
  case 'COPY_CELL':
236
+ case 'COPY_AREA_CELL':
235
237
  case 'CUT_CELL':
238
+ case 'CUT_AREA_CELL':
236
239
  case 'PASTE_CELL':
240
+ case 'PASTE_AREA_CELL':
237
241
  case 'MERGE_OR_CLEAR':
238
242
  case 'MERGE_CELL':
239
243
  case 'REVERT_CELL':
@@ -295,13 +299,17 @@ function checkPrivilege (item: VxeTableDefines.MenuFirstOption | VxeTableDefines
295
299
  break
296
300
  }
297
301
  case 'COPY_CELL':
302
+ case 'COPY_AREA_CELL':
298
303
  case 'CUT_CELL':
299
- case 'PASTE_CELL': {
304
+ case 'CUT_AREA_CELL':
305
+ case 'PASTE_CELL':
306
+ case 'PASTE_AREA_CELL': {
300
307
  const cellAreas = mouseConfig && mouseOpts.area ? $table.getCellAreas() : []
301
308
  item.disabled = cellAreas.length > 1
302
309
  if (!item.disabled) {
303
310
  switch (code) {
304
- case 'PASTE_CELL': {
311
+ case 'PASTE_CELL':
312
+ case 'PASTE_AREA_CELL': {
305
313
  const clipboard = getClipboardObj()
306
314
  item.disabled = !clipboard || !clipboard.text
307
315
  break
@@ -521,6 +529,33 @@ export const VxeUIPluginMenu = {
521
529
  }
522
530
  }
523
531
  },
532
+ /**
533
+ * 用于 mouse-config.area 功能,清除区域范围内的单元格数据
534
+ */
535
+ CLEAR_AREA_CELL: {
536
+ tableMenuMethod (params) {
537
+ const { $table, row, column } = params
538
+ if (row && column) {
539
+ const tableProps = $table.props
540
+ const { mouseConfig } = tableProps
541
+ const { computeMouseOpts } = $table.getComputeMaps()
542
+ const mouseOpts = computeMouseOpts.value
543
+ if (mouseConfig && mouseOpts.area) {
544
+ const cellAreas = $table.getCellAreas()
545
+ if (cellAreas && cellAreas.length) {
546
+ cellAreas.forEach(areaItem => {
547
+ const { rows, cols } = areaItem
548
+ cols.forEach(column => {
549
+ rows.forEach(row => {
550
+ $table.clearData(row, column.field)
551
+ })
552
+ })
553
+ })
554
+ }
555
+ }
556
+ }
557
+ }
558
+ },
524
559
  /**
525
560
  * 清除行数据的值
526
561
  */
@@ -806,6 +841,14 @@ export const VxeUIPluginMenu = {
806
841
  handleCopyOrCut(params as VxeGlobalMenusHandles.TableMenuMethodParams & { $table: VxeTableConstructor & VxeTablePrivateMethods })
807
842
  }
808
843
  },
844
+ /**
845
+ * 复制单元格数据的值;用于 mouse-config.area 功能,复制区域范围内的单元格数据,支持 Excel 和 WPS
846
+ */
847
+ COPY_AREA_CELL: {
848
+ tableMenuMethod (params) {
849
+ handleCopyOrCut(params as VxeGlobalMenusHandles.TableMenuMethodParams & { $table: VxeTableConstructor & VxeTablePrivateMethods })
850
+ }
851
+ },
809
852
  /**
810
853
  * 剪贴单元格数据的值;如果启用 mouse-config.area 功能,则剪贴区域范围内的单元格数据,支持 Excel 和 WPS
811
854
  */
@@ -814,6 +857,14 @@ export const VxeUIPluginMenu = {
814
857
  handleCopyOrCut(params as VxeGlobalMenusHandles.TableMenuMethodParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, true)
815
858
  }
816
859
  },
860
+ /**
861
+ * 剪贴单元格数据的值;用于 mouse-config.area 功能,剪贴区域范围内的单元格数据,支持 Excel 和 WPS
862
+ */
863
+ CUT_AREA_CELL: {
864
+ tableMenuMethod (params) {
865
+ handleCopyOrCut(params as VxeGlobalMenusHandles.TableMenuMethodParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }, true)
866
+ }
867
+ },
817
868
  /**
818
869
  * 粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板
819
870
  */
@@ -835,6 +886,21 @@ export const VxeUIPluginMenu = {
835
886
  }
836
887
  }
837
888
  },
889
+ /**
890
+ * 粘贴从表格中被复制的数据;用于 mouse-config.area 功能,粘贴区域范围内的单元格数据,不支持读取剪贴板
891
+ */
892
+ PASTE_AREA_CELL: {
893
+ tableMenuMethod (params) {
894
+ const { $event, $table } = params as VxeGlobalMenusHandles.TableMenuMethodParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }
895
+ const tableProps = $table.props
896
+ const { mouseConfig } = tableProps
897
+ const { computeMouseOpts } = $table.getComputeMaps()
898
+ const mouseOpts = computeMouseOpts.value
899
+ if (mouseConfig && mouseOpts.area) {
900
+ $table.triggerPasteCellAreaEvent($event)
901
+ }
902
+ }
903
+ },
838
904
  /**
839
905
  * 如果启用 mouse-config.area 功能,如果所选区域内已存在合并单元格,则取消临时合并,否则临时合并
840
906
  */