@vxe-ui/plugin-menu 4.0.8 → 4.0.9
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/README.md +2 -2
- package/dist/index.common.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -49,8 +49,8 @@ VxeUI.use(VxeUIPluginMenu)
|
|
|
49
49
|
| PASTE_CELL | (仅支持在单表区域内操作)粘贴从表格中被复制的数据;如果启用 mouse-config.area 功能,则粘贴区域范围内的单元格数据,不支持读取剪贴板 | — |
|
|
50
50
|
| EDIT_CELL | 编辑选中单元格 | — |
|
|
51
51
|
| EDIT_ROW | 编辑选中行并激活选中单元格 | — |
|
|
52
|
-
| INSERT_ROW |
|
|
53
|
-
| INSERT_EDIT_ROW |
|
|
52
|
+
| INSERT_ROW | 顶部插入单行数据 | record |
|
|
53
|
+
| INSERT_EDIT_ROW | 顶部插入单行数据并激活编辑状态 | Array\<record, field\> |
|
|
54
54
|
| INSERT_AT_ROW | 插入单行数据到指定位置 | record |
|
|
55
55
|
| BATCH_INSERT_AT_ROW | 插入多行数据到指定位置 | record |
|
|
56
56
|
| INSERT_NEXT_AT_ROW | 插入单行数据到指定位置 | record |
|
package/dist/index.common.js
CHANGED
|
@@ -412,7 +412,7 @@ var VxeUIPluginMenu = exports.VxeUIPluginMenu = {
|
|
|
412
412
|
VxeUI = core;
|
|
413
413
|
// 检查版本
|
|
414
414
|
if (!/^(4)\./.test(VxeUI.uiVersion)) {
|
|
415
|
-
console.error('[@vxe-ui/plugin-menu 4.0.
|
|
415
|
+
console.error('[@vxe-ui/plugin-menu 4.0.9] Requires vxe-table 4.7.0++ version. https://vxeui.com/other4/#/plugin-menu/install');
|
|
416
416
|
}
|
|
417
417
|
pluginSetup(options);
|
|
418
418
|
VxeUI.menus.mixin({
|
package/dist/index.umd.js
CHANGED
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
VxeUI = core;
|
|
425
425
|
// 检查版本
|
|
426
426
|
if (!/^(4)\./.test(VxeUI.uiVersion)) {
|
|
427
|
-
console.error('[@vxe-ui/plugin-menu 4.0.
|
|
427
|
+
console.error('[@vxe-ui/plugin-menu 4.0.9] Requires vxe-table 4.7.0++ version. https://vxeui.com/other4/#/plugin-menu/install');
|
|
428
428
|
}
|
|
429
429
|
pluginSetup(options);
|
|
430
430
|
VxeUI.menus.mixin({
|
package/dist/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((e,t)=>{"function"==typeof define&&define.amd?define("@vxe-ui/plugin-menu",["exports","xe-utils","vue"],t):"undefined"!=typeof exports?t(exports,require("xe-utils"),require("vue")):(t(t={},e.XEUtils,e.Vue),e.VxeUIPluginMenu=t)})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,i,a){var s,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VxeUIPluginMenu=void 0,i=(t=i)&&t.__esModule?t:{default:t};var o,g=function(e,t){return i.default.findIndexOf(e,function(e){return e.id===t.id})},h=function(e,t,n){return e.findRowIndexOf(t,n)};function n(n){return{menuMethod:function(e){var t=e.$table;i.default.eachTree([e.column],function(e){e.fixed=n}),t.refreshColumn()}}}function C(){var e=s.globalStore;return e?e.clipboard||"":(e=s.config)&&e.clipboard?e.clipboard:null}function E(e){var t,n;try{t=e,o||((o=document.createElement("textarea")).id="$XECopy",(n=o.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.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 r(e,t){var n,a,o,r=e.$event,l=e.$table,u=e.row,e=e.column;u&&e&&(n=l.props.mouseConfig,o=l.getComputeMaps().computeMouseOpts.value,a="",n&&o.area?(t?l.triggerCutCellAreaEvent(r):l.triggerCopyCellAreaEvent(r),a=(n=C())?n.text:""):(a=i.default.toValueString(i.default.get(u,e.field)),o={text:a,html:""},(t=s.globalStore)?t.clipboard=o:s.config&&(s.config.clipboard=o)),(i.default.isFunction(c)?c:E)(a))}function _(e){var i=e.$table,e=i.props.mouseConfig,t=i.getComputeMaps().computeMouseOpts.value,s=i.getTableData().visibleData,c=i.getTableColumn().visibleColumn,n=e&&t.area?i.getCellAreas():[];return i.getMergeCells().filter(function(e){var o=e.row,r=e.col,l=e.rowspan,u=e.colspan;return n.some(function(e){var t=e.rows,e=e.cols,n=h(i,s,t[0]),t=h(i,s,t[t.length-1]),a=g(c,e[0]),e=g(c,e[e.length-1]);return n<=o&&o+l-1<=t&&a<=r&&r+u-1<=e})})}function l(e){var t=e.$table,e=_(e);return e.length&&t.removeMergeCells(e),e}function u(e,t){var n=e.code,a=t.$table,o=t.row,r=t.column,l=t.type,u=a.props,i=u.editConfig,s=u.mouseConfig;switch(n){case"CLEAR_ALL_SORT":var c=a.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=a.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=a.getMergeCells(),E=a.getMergeFooterItems();e.disabled=!c.length&&!E.length;break;case"CLEAR_MERGE_CELL":c=_(t);e.disabled=!c.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==l;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"INSERT_AT_EDIT_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 d=a.getComputeMaps().computeMouseOpts.value,f=!!r.parentId;switch(n){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"===n&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!a.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!a.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(s&&d.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var m=s&&d.area?a.getCellAreas():[];e.disabled=1<m.length,e.disabled||"PASTE_CELL"===n&&(m=C(),e.disabled=!m||!m.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":m=s&&d.area?a.getCellAreas():[];e.disabled=!m.length||1===m.length&&1===m[0].rows.length&&1===m[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r={},l=0,u=t.length;l<u;l++)for(var i=t[l],s=i.rows,c=i.cols,E=0,d=s.length;E<d;E++)for(var f=s[E],m=h(n,a,f),C=0,_=c.length;C<_;C++){var R=c[C],R=m+":"+g(o,R);if(r[R])return;r[R]=!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}}}}function d(t){return t.options.forEach(function(e){e.forEach(function(e){u(e,t),e.children&&e.children.forEach(function(e){u(e,t)})})}),!0}function f(){return new Promise(function(t){var e,n;s.modal?(e=s.getComponent("VxeNumberInput"))?(n=(0,a.ref)(1),s.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,a.h)(e,{modelValue:n.value,min:1,max:100,align:"center",style:{width:"100%"},"onUpdate:modelValue":function(e){n.value=e}})}}}).then(function(e){t("confirm"===e?{size:n.value||1}:{size:0})})):(console.error(s.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function m(e){e&&e.copy&&(c=e.copy)}var t=e.VxeUIPluginMenu={setConfig:m,install:function(e,t){s=e,/^(4)\./.test(s.uiVersion)||console.error("[@vxe-ui/plugin-menu 4.0.8] Requires vxe-table 4.7.0++ version. https://vxeui.com/other4/#/plugin-export-xlsx/install"),m(t),s.menus.mixin({CLEAR_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(o,e.field))}},CLEAR_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&o.area?(a&&o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):n&&e&&t.clearData(n)}},CLEAR_ALL:{menuMethod:function(e){e.$table.clearData()}},REVERT_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.revertData(e,t.field)})})}):a.revertData(o,e.field))}},REVERT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{menuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{menuMethod:function(e){e=e.column.getTitle();e&&(i.default.isFunction(c)?c:E)(e)}},COPY_CELL:{menuMethod:function(e){r(e)}},CUT_CELL:{menuMethod:function(e){r(e,!0)}},PASTE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=e.row,e=e.column,o=n.props.mouseConfig,r=n.getComputeMaps().computeMouseOpts.value;o&&r.area?n.triggerPasteCellAreaEvent(t):(o=C())&&o.text&&i.default.set(a,e.field,o.text)}},MERGE_OR_CLEAR:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=_(e),o=!1,e=(e.length?n.removeMergeCells(e):(o=!0,n.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}}))),a.map(function(e){return{rows:e.rows,cols:e.cols}}));n.dispatchEvent("cell-area-merge",{status:o,targetAreas:e},t)}},MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r=n.getCellAreas();l(e),r.some(function(e){return e.rows.length===a.length||e.cols.length===o.length})?s.modal&&s.modal.message({content:s.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(n.setMergeCells(r.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=r.map(function(e){return{rows:e.rows,cols:e.cols}}),n.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,e=l(e);e.length&&n.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getMergeCells(),a=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:n,mergeFooterItems:a},t)}},EDIT_CELL:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column;t.setEditCell?t.setEditCell(n,e):t.setActiveCell(n,e.field)}},EDIT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{menuMethod:function(e){e.$table.insert(e.menu.params||{})}},INSERT_ACTIVED_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]||{}).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_EDIT_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]||{}).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertAt(e.menu.params||{},n)}},BATCH_INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,a=e.row;a&&f().then(function(e){e=e.size;e&&t.insertAt(i.default.range(0,e).map(function(){return Object.assign({},n.params)}),a)})}},INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertNextAt(e.menu.params||{},n)}},BATCH_INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,a=e.row;a&&f().then(function(e){e=e.size;e&&t.insertNextAt(i.default.range(0,e).map(function(){return Object.assign({},n.params)}),a)})}},INSERT_AT_ACTIVED_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&n.insertAt(i.default.range(0,e).map(function(){return Object.assign({},t[0])}),a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)})}))}},INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertNextAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&n.insertNextAt(i.default.range(0,e).map(function(){return Object.assign({},t[0])}),a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)})}))}},DELETE_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{menuMethod:function(e){var t=e.$table,e=e.row,n=t.props.mouseConfig,a=t.getComputeMaps().computeMouseOpts.value;n&&a.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{menuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{menuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getSortColumns();n.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:n},t))}},SORT_ASC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"asc")}},SORT_DESC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&(n.handleClearFilter(e),n.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getCheckedFilters();n.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:n},t))}},FILTER_CELL:{menuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=i.default.get(a,t),e.checked=!0,n.updateData())}},EXPORT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,e=e.row;e&&t.exportData(i.default.assign({},n.params?n.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.exportData(i.default.assign({},e.params?e.params[0]:{},n))}},EXPORT_ALL:{menuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{menuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.print(i.default.assign(n,e.params))}},OPEN_FIND:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{menuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:n("left"),FIXED_RIGHT_COLUMN:n("right"),CLEAR_FIXED_COLUMN:n(null),RESET_COLUMN:{menuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{menuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{menuMethod:function(e){e.$table.resetColumn(!0)}}}),s.interceptor.add("event.showMenu",d)}};"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(t),e.default=t});
|
|
1
|
+
((e,t)=>{"function"==typeof define&&define.amd?define("@vxe-ui/plugin-menu",["exports","xe-utils","vue"],t):"undefined"!=typeof exports?t(exports,require("xe-utils"),require("vue")):(t(t={},e.XEUtils,e.Vue),e.VxeUIPluginMenu=t)})("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,i,a){var s,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VxeUIPluginMenu=void 0,i=(t=i)&&t.__esModule?t:{default:t};var o,g=function(e,t){return i.default.findIndexOf(e,function(e){return e.id===t.id})},h=function(e,t,n){return e.findRowIndexOf(t,n)};function n(n){return{menuMethod:function(e){var t=e.$table;i.default.eachTree([e.column],function(e){e.fixed=n}),t.refreshColumn()}}}function C(){var e=s.globalStore;return e?e.clipboard||"":(e=s.config)&&e.clipboard?e.clipboard:null}function E(e){var t,n;try{t=e,o||((o=document.createElement("textarea")).id="$XECopy",(n=o.style).width="48px",n.height="24px",n.position="fixed",n.zIndex="0",n.left="-500px",n.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 r(e,t){var n,a,o,r=e.$event,l=e.$table,u=e.row,e=e.column;u&&e&&(n=l.props.mouseConfig,o=l.getComputeMaps().computeMouseOpts.value,a="",n&&o.area?(t?l.triggerCutCellAreaEvent(r):l.triggerCopyCellAreaEvent(r),a=(n=C())?n.text:""):(a=i.default.toValueString(i.default.get(u,e.field)),o={text:a,html:""},(t=s.globalStore)?t.clipboard=o:s.config&&(s.config.clipboard=o)),(i.default.isFunction(c)?c:E)(a))}function _(e){var i=e.$table,e=i.props.mouseConfig,t=i.getComputeMaps().computeMouseOpts.value,s=i.getTableData().visibleData,c=i.getTableColumn().visibleColumn,n=e&&t.area?i.getCellAreas():[];return i.getMergeCells().filter(function(e){var o=e.row,r=e.col,l=e.rowspan,u=e.colspan;return n.some(function(e){var t=e.rows,e=e.cols,n=h(i,s,t[0]),t=h(i,s,t[t.length-1]),a=g(c,e[0]),e=g(c,e[e.length-1]);return n<=o&&o+l-1<=t&&a<=r&&r+u-1<=e})})}function l(e){var t=e.$table,e=_(e);return e.length&&t.removeMergeCells(e),e}function u(e,t){var n=e.code,a=t.$table,o=t.row,r=t.column,l=t.type,u=a.props,i=u.editConfig,s=u.mouseConfig;switch(n){case"CLEAR_ALL_SORT":var c=a.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=a.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=a.getMergeCells(),E=a.getMergeFooterItems();e.disabled=!c.length&&!E.length;break;case"CLEAR_MERGE_CELL":c=_(t);e.disabled=!c.length;break;case"COPY_TITLE":e.disabled=!r||"header"!==l;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"INSERT_AT_EDIT_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 d=a.getComputeMaps().computeMouseOpts.value,f=!!r.parentId;switch(n){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"===n&&(e.disabled=!r.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!o||!r.field||!a.isUpdateByRow(o,r.field);break;case"REVERT_ROW":e.disabled=!o||!r.field||!a.isUpdateByRow(o);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(s&&d.area);break;case"EDIT_CELL":e.disabled=!i||!r.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var m=s&&d.area?a.getCellAreas():[];e.disabled=1<m.length,e.disabled||"PASTE_CELL"===n&&(m=C(),e.disabled=!m||!m.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":m=s&&d.area?a.getCellAreas():[];e.disabled=!m.length||1===m.length&&1===m[0].rows.length&&1===m[0].cols.length||!((e,t)=>{for(var n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r={},l=0,u=t.length;l<u;l++)for(var i=t[l],s=i.rows,c=i.cols,E=0,d=s.length;E<d;E++)for(var f=s[E],m=h(n,a,f),C=0,_=c.length;C<_;C++){var R=c[C],R=m+":"+g(o,R);if(r[R])return;r[R]=!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}}}}function d(t){return t.options.forEach(function(e){e.forEach(function(e){u(e,t),e.children&&e.children.forEach(function(e){u(e,t)})})}),!0}function f(){return new Promise(function(t){var e,n;s.modal?(e=s.getComponent("VxeNumberInput"))?(n=(0,a.ref)(1),s.modal.alert({title:"请输入行数",width:220,maskClosable:!1,slots:{default:function(){return(0,a.h)(e,{modelValue:n.value,min:1,max:100,align:"center",style:{width:"100%"},"onUpdate:modelValue":function(e){n.value=e}})}}}).then(function(e){t("confirm"===e?{size:n.value||1}:{size:0})})):(console.error(s.getI18n("vxe.error.reqComp",["vxe-number-input"])),t({size:0})):t({size:0})})}function m(e){e&&e.copy&&(c=e.copy)}var t=e.VxeUIPluginMenu={setConfig:m,install:function(e,t){s=e,/^(4)\./.test(s.uiVersion)||console.error("[@vxe-ui/plugin-menu 4.0.9] Requires vxe-table 4.7.0++ version. https://vxeui.com/other4/#/plugin-menu/install"),m(t),s.menus.mixin({CLEAR_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.clearData(e,t.field)})})}):a.clearData(o,e.field))}},CLEAR_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.clearData(e)}},CLEAR_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.clearData(e.getCheckboxRecords())}},CLEAR_AREA_ROW:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column,a=t.props.mouseConfig,o=t.getComputeMaps().computeMouseOpts.value;a&&o.area?(a&&o.area?t.getCellAreas():[]).forEach(function(e){e=e.rows;t.clearData(e)}):n&&e&&t.clearData(n)}},CLEAR_ALL:{menuMethod:function(e){e.$table.clearData()}},REVERT_CELL:{menuMethod:function(e){var t,n,a=e.$table,o=e.row,e=e.column;o&&e&&(n=a.props.mouseConfig,t=a.getComputeMaps().computeMouseOpts.value,n&&t.area?(n=a.getCellAreas())&&n.length&&n.forEach(function(e){var n=e.rows;e.cols.forEach(function(t){n.forEach(function(e){a.revertData(e,t.field)})})}):a.revertData(o,e.field))}},REVERT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)}},REVERT_CHECKBOX_ROW:{menuMethod:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())}},REVERT_ALL:{menuMethod:function(e){e.$table.revertData()}},COPY_TITLE:{menuMethod:function(e){e=e.column.getTitle();e&&(i.default.isFunction(c)?c:E)(e)}},COPY_CELL:{menuMethod:function(e){r(e)}},CUT_CELL:{menuMethod:function(e){r(e,!0)}},PASTE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=e.row,e=e.column,o=n.props.mouseConfig,r=n.getComputeMaps().computeMouseOpts.value;o&&r.area?n.triggerPasteCellAreaEvent(t):(o=C())&&o.text&&i.default.set(a,e.field,o.text)}},MERGE_OR_CLEAR:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getCellAreas(),e=_(e),o=!1,e=(e.length?n.removeMergeCells(e):(o=!0,n.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}}))),a.map(function(e){return{rows:e.rows,cols:e.cols}}));n.dispatchEvent("cell-area-merge",{status:o,targetAreas:e},t)}},MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,a=n.getTableData().visibleData,o=n.getTableColumn().visibleColumn,r=n.getCellAreas();l(e),r.some(function(e){return e.rows.length===a.length||e.cols.length===o.length})?s.modal&&s.modal.message({content:s.getI18n("vxe.pro.area.mergeErr"),status:"error",id:"operErr"}):(n.setMergeCells(r.map(function(e){var t=e.rows,e=e.cols;return{row:t[0],col:e[0],rowspan:t.length,colspan:e.length}})),e=r.map(function(e){return{rows:e.rows,cols:e.cols}}),n.dispatchEvent("cell-area-merge",{status:!0,targetAreas:e},t))}},CLEAR_MERGE_CELL:{menuMethod:function(e){var t=e.$event,n=e.$table,e=l(e);e.length&&n.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)}},CLEAR_ALL_MERGE:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getMergeCells(),a=e.getMergeFooterItems();e.clearMergeCells(),e.clearMergeFooterItems(),e.dispatchEvent("clear-merge",{mergeCells:n,mergeFooterItems:a},t)}},EDIT_CELL:{menuMethod:function(e){var t=e.$table,n=e.row,e=e.column;t.setEditCell?t.setEditCell(n,e):t.setActiveCell(n,e.field)}},EDIT_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):t.setActiveRow(e)}},INSERT_ROW:{menuMethod:function(e){e.$table.insert(e.menu.params||{})}},INSERT_ACTIVED_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]||{}).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_EDIT_ROW:{menuMethod:function(e){var t=e.$table,n=e.column,a=e.menu.params||[];t.insert(a[0]||{}).then(function(e){e=e.row;t.setEditCell?t.setEditCell(e,a[1]||n):t.setActiveCell(e,a[1]||n.field)})}},INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertAt(e.menu.params||{},n)}},BATCH_INSERT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,a=e.row;a&&f().then(function(e){e=e.size;e&&t.insertAt(i.default.range(0,e).map(function(){return Object.assign({},n.params)}),a)})}},INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.row;n&&t.insertNextAt(e.menu.params||{},n)}},BATCH_INSERT_NEXT_AT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,a=e.row;a&&f().then(function(e){e=e.size;e&&t.insertNextAt(i.default.range(0,e).map(function(){return Object.assign({},n.params)}),a)})}},INSERT_AT_ACTIVED_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&n.insertAt(i.default.range(0,e).map(function(){return Object.assign({},t[0])}),a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)})}))}},INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],n.insertNextAt(t[0]||{},a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)}))}},BATCH_INSERT_NEXT_AT_EDIT_ROW:{menuMethod:function(e){var t,n=e.$table,a=e.row,o=e.column;a&&(t=e.menu.params||[],f().then(function(e){e=e.size;e&&n.insertNextAt(i.default.range(0,e).map(function(){return Object.assign({},t[0])}),a).then(function(e){e=e.row;n.setEditCell?n.setEditCell(e,t[1]||o):n.setActiveCell(e,t[1]||o.field)})}))}},DELETE_ROW:{menuMethod:function(e){var t=e.$table,e=e.row;e&&t.remove(e)}},DELETE_AREA_ROW:{menuMethod:function(e){var t=e.$table,e=e.row,n=t.props.mouseConfig,a=t.getComputeMaps().computeMouseOpts.value;n&&a.area?t.getCellAreas().forEach(function(e){e=e.rows;t.remove(e)}):e&&t.remove(e)}},DELETE_CHECKBOX_ROW:{menuMethod:function(e){e.$table.removeCheckboxRow()}},DELETE_ALL:{menuMethod:function(e){e.$table.remove()}},CLEAR_SORT:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,null)}},CLEAR_ALL_SORT:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getSortColumns();n.length&&(e.clearSort(),e.dispatchEvent("clear-sort",{sortList:n},t))}},SORT_ASC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"asc")}},SORT_DESC:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&n.triggerSortEvent(t,e,"desc")}},CLEAR_FILTER:{menuMethod:function(e){var t=e.$event,n=e.$table,e=e.column;e&&(n.handleClearFilter(e),n.confirmFilterEvent(t))}},CLEAR_ALL_FILTER:{menuMethod:function(e){var t=e.$event,e=e.$table,n=e.getCheckedFilters();n.length&&(e.clearFilter(),e.dispatchEvent("clear-filter",{filterList:n},t))}},FILTER_CELL:{menuMethod:function(e){var t,n=e.$table,a=e.row,e=e.column;a&&e&&(t=e.field,(e=e.filters).length)&&((e=e[0]).data=i.default.get(a,t),e.checked=!0,n.updateData())}},EXPORT_ROW:{menuMethod:function(e){var t=e.$table,n=e.menu,e=e.row;e&&t.exportData(i.default.assign({},n.params?n.params[0]:{},{data:[e]}))}},EXPORT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.exportData(i.default.assign({},e.params?e.params[0]:{},n))}},EXPORT_ALL:{menuMethod:function(e){e.$table.exportData(e.menu.params)}},PRINT_ALL:{menuMethod:function(e){e.$table.print(e.menu.params)}},PRINT_CHECKBOX_ROW:{menuMethod:function(e){var t=e.$table,e=e.menu,n={data:t.getCheckboxRecords()};t.print(i.default.assign(n,e.params))}},OPEN_FIND:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"find")}},OPEN_REPLACE:{menuMethod:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"replace")}},HIDDEN_COLUMN:{menuMethod:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)}},FIXED_LEFT_COLUMN:n("left"),FIXED_RIGHT_COLUMN:n("right"),CLEAR_FIXED_COLUMN:n(null),RESET_COLUMN:{menuMethod:function(e){e.$table.resetColumn({visible:!0,resizable:!1})}},RESET_RESIZABLE:{menuMethod:function(e){e.$table.resetColumn({visible:!1,resizable:!0})}},RESET_ALL:{menuMethod:function(e){e.$table.resetColumn(!0)}}}),s.interceptor.add("event.showMenu",d)}};"undefined"!=typeof window&&window.VxeUI&&window.VxeUI.use&&window.VxeUI.use(t),e.default=t});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxe-ui/plugin-menu",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
4
4
|
"description": "Vxe UI plug-in supports context menu.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lib": "gulp build"
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"sass": "^1.55.0",
|
|
52
52
|
"typescript": "~4.7.4",
|
|
53
53
|
"vue": "3.4.27",
|
|
54
|
-
"vxe-pc-ui": "^4.5.
|
|
55
|
-
"vxe-table": "^4.13.
|
|
54
|
+
"vxe-pc-ui": "^4.5.36",
|
|
55
|
+
"vxe-table": "^4.13.17"
|
|
56
56
|
},
|
|
57
57
|
"repository": {
|
|
58
58
|
"type": "git",
|