vxe-table-plugin-menus
Advanced tools
Comparing version 3.0.6 to 3.0.7
@@ -108,3 +108,3 @@ (function (global, factory) { | ||
} else { | ||
text = _xeUtils["default"].toValueString(_xeUtils["default"].get(row, column.property)); // 操作内置剪贴板 | ||
text = _xeUtils["default"].toValueString(_xeUtils["default"].get(row, column.field)); // 操作内置剪贴板 | ||
@@ -313,3 +313,3 @@ vxetable.config.clipboard = { | ||
{ | ||
item.disabled = !row || !column.property || !$table.isUpdateByRow(row, column.property); | ||
item.disabled = !row || !column.field || !$table.isUpdateByRow(row, column.field); | ||
break; | ||
@@ -320,3 +320,3 @@ } | ||
{ | ||
item.disabled = !row || !column.property || !$table.isUpdateByRow(row); | ||
item.disabled = !row || !column.field || !$table.isUpdateByRow(row); | ||
break; | ||
@@ -446,3 +446,3 @@ } | ||
rows.forEach(function (row) { | ||
$table.clearData(row, column.property); | ||
$table.clearData(row, column.field); | ||
}); | ||
@@ -453,3 +453,3 @@ }); | ||
} else { | ||
$table.clearData(row, column.property); | ||
$table.clearData(row, column.field); | ||
} | ||
@@ -513,3 +513,3 @@ } | ||
rows.forEach(function (row) { | ||
$table.revertData(row, column.property); | ||
$table.revertData(row, column.field); | ||
}); | ||
@@ -520,3 +520,3 @@ }); | ||
} else { | ||
$table.revertData(row, column.property); | ||
$table.revertData(row, column.field); | ||
} | ||
@@ -590,3 +590,3 @@ } | ||
if (clipboard && clipboard.text) { | ||
_xeUtils["default"].set(row, column.property, clipboard.text); | ||
_xeUtils["default"].set(row, column.field, clipboard.text); | ||
} | ||
@@ -730,3 +730,9 @@ } | ||
column = params.column; | ||
$table.setActiveCell(row, column.property); | ||
if ($table.setEditCell) { | ||
$table.setEditCell(row, column); | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveCell(row, column.field); | ||
} | ||
}, | ||
@@ -740,3 +746,9 @@ | ||
row = params.row; | ||
$table.setActiveRow(row); | ||
if ($table.setEditRow) { | ||
$table.setEditRow(row); | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveRow(row); | ||
} | ||
}, | ||
@@ -764,3 +776,9 @@ | ||
var row = _ref7.row; | ||
return $table.setActiveCell(row, args[1] || column.property); | ||
if ($table.setEditCell) { | ||
$table.setEditCell(row, args[1] || column); | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveCell(row, args[1] || column.field); | ||
} | ||
}); | ||
@@ -796,3 +814,9 @@ }, | ||
var row = _ref8.row; | ||
return $table.setActiveCell(row, args[1] || column.property); | ||
if ($table.setEditCell) { | ||
$table.setEditCell(row, args[1] || column); | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveCell(row, args[1] || column.field); | ||
} | ||
}); | ||
@@ -924,3 +948,3 @@ } | ||
if (row && column) { | ||
var property = column.property, | ||
var field = column.field, | ||
filters = column.filters; | ||
@@ -930,3 +954,3 @@ | ||
var option = filters[0]; | ||
option.data = _xeUtils["default"].get(row, property); | ||
option.data = _xeUtils["default"].get(row, field); | ||
option.checked = true; | ||
@@ -933,0 +957,0 @@ $table.updateData(); |
@@ -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={},e.XEUtils),e.VXETablePluginMenus=t)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,c){"use strict";var t,R,i;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VXETablePluginMenus=void 0,c=(t=c)&&t.__esModule?t:{default:t};var n,g=function(e,t){return c.default.findIndexOf(e,function(e){return e.id===t.id})},_=function(e,t,a){return e.findRowIndexOf(t,a)};function o(a){return function(e){var t=e.$table,e=e.column;c.default.eachTree([e],function(e){e.fixed=a}),t.refreshColumn()}}function u(e){var t,a,r=!1;try{t=e,n||((n=document.createElement("textarea")).id="$XECopy",(a=n.style).width="48px",a.height="24px",a.position="fixed",a.zIndex="0",a.left="-500px",a.top="-500px",document.body.appendChild(n)),n.value=null==t?"":""+t,n.select(),n.setSelectionRange(0,n.value.length),r=document.execCommand("copy"),n.blur()}catch(e){}return r}function l(e,t){var a,r,n=e.$event,o=e.$table,l=e.row,s=e.column;l&&s&&(a=o.props.mouseConfig,r=o.getComputeMaps().computeMouseOpts.value,e="",a&&r.area?(t?o.triggerCutCellAreaEvent(n):o.triggerCopyCellAreaEvent(n),e=R.config.clipboard.text):(e=c.default.toValueString(c.default.get(l,s.property)),R.config.clipboard={text:e,html:""}),(c.default.isFunction(i)?i:u)(e))}function p(e){var c=e.$table,t=c.props.mouseConfig,e=c.getComputeMaps().computeMouseOpts.value,i=c.getTableData().visibleData,u=c.getTableColumn().visibleColumn,a=t&&e.area?c.getCellAreas():[];return c.getMergeCells().filter(function(e){var n=e.row,o=e.col,l=e.rowspan,s=e.colspan;return a.some(function(e){var t=e.rows,a=e.cols,r=_(c,i,t[0]),e=_(c,i,t[t.length-1]),t=g(u,a[0]),a=g(u,a[a.length-1]);return r<=n&&n+l-1<=e&&t<=o&&o+s-1<=a})})}function s(e){var t=e.$table,e=p(e);return e.length&&t.removeMergeCells(e),e}function a(e,t){var a=e.code,r=t.$table,n=t.row,o=t.column,l=r.props,s=l.editConfig,c=l.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var i=r.getSortColumns();e.disabled=!i.length;break;case"CLEAR_ALL_FILTER":var u=r.getCheckedFilters();e.disabled=!u.length;break;case"CLEAR_ALL_MERGE":var u=r.getMergeCells(),E=r.getMergeFooterItems();e.disabled=!u.length&&!E.length;break;case"CLEAR_MERGE_CELL":E=p(t);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"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"DELETE_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=!o,o){var C=r.getComputeMaps().computeMouseOpts.value,f=!!o.parentId;switch(a){case"CLEAR_SORT":e.disabled=!o.sortable||!o.order;break;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"REVERT_CELL":e.disabled=!n||!o.property||!r.isUpdateByRow(n,o.property);break;case"REVERT_ROW":e.disabled=!n||!o.property||!r.isUpdateByRow(n);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(c&&C.area);break;case"EDIT_CELL":e.disabled=!s||!o.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var d=c&&C.area?r.getCellAreas():[];e.disabled=1<d.length,e.disabled||"PASTE_CELL"===a&&(L=R.config.clipboard,e.disabled=!L||!L.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":var L=c&&C.area?r.getCellAreas():[];e.disabled=!L.length||1===L.length&&1===L[0].rows.length&&1===L[0].cols.length||!function(e,t){for(var a=e.$table,r=a.getTableData().visibleData,n=a.getTableColumn().visibleColumn,o={},l=0,s=t.length;l<s;l++)for(var c=t[l],i=c.rows,u=c.cols,E=0,C=i.length;E<C;E++)for(var f=i[E],d=_(a,r,f),L=0,R=u.length;L<R;L++){var p=u[L],p=d+":"+g(n,p);if(o[p])return;o[p]=!0}return 1}(t,L);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===o.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===o.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!o.fixed}}}}function E(t){return t.options.forEach(function(e){e.forEach(function(e){a(e,t),e.children&&e.children.forEach(function(e){a(e,t)})})}),!0}function C(e){e&&e.copy&&(i=e.copy)}var r={setup:C,install:function(e,t){var a=e.interceptor,r=e.menus;R=e,C(t),r.mixin({CLEAR_CELL:function(e){var t,r=e.$table,a=e.row,n=e.column;a&&n&&(t=r.props.mouseConfig,e=r.getComputeMaps().computeMouseOpts.value,t&&e.area?(e=r.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){r.clearData(e,t.property)})})}):r.clearData(a,n.property))},CLEAR_ROW:function(e){var t=e.$table,e=e.row;e&&t.clearData(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 t,r=e.$table,a=e.row,n=e.column;a&&n&&(t=r.props.mouseConfig,e=r.getComputeMaps().computeMouseOpts.value,t&&e.area?(e=r.getCellAreas())&&e.length&&e.forEach(function(e){var a=e.rows;e.cols.forEach(function(t){a.forEach(function(e){r.revertData(e,t.property)})})}):r.revertData(a,n.property))},REVERT_ROW:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)},REVERT_CHECKBOX_ROW:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())},REVERT_ALL:function(e){e.$table.revertData()},COPY_CELL:function(e){l(e)},CUT_CELL:function(e){l(e,!0)},PASTE_CELL:function(e){var t=e.$event,a=e.$table,r=e.row,n=e.column,o=a.props.mouseConfig,e=a.getComputeMaps().computeMouseOpts.value;o&&e.area?a.triggerPasteCellAreaEvent(t):(t=R.config.clipboard)&&t.text&&c.default.set(r,n.property,t.text)},MERGE_OR_CLEAR:function(e){var t=e.$event,a=e.$table,r=a.getCellAreas(),n=p(e),e=!1;n.length?a.removeMergeCells(n):(e=!0,a.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}})));r=r.map(function(e){return{rows:e.rows,cols:e.cols}});a.dispatchEvent("cell-area-merge",{status:e,targetAreas:r},t)},MERGE_CELL:function(e){var t=e.$event,a=e.$table,r=a.getTableData().visibleData,n=a.getTableColumn().visibleColumn,o=a.getCellAreas();s(e),o.some(function(e){var t=e.rows,e=e.cols;return t.length===r.length||e.length===n.length})?R.modal&&R.modal.message({content:R.t("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}})),o=o.map(function(e){return{rows:e.rows,cols:e.cols}}),a.dispatchEvent("cell-area-merge",{status:!0,targetAreas:o},t))},CLEAR_MERGE_CELL:function(e){var t=e.$event,a=e.$table,e=s(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)},CLEAR_ALL_MERGE:function(e){var t=e.$event,a=e.$table,r=a.getMergeCells(),e=a.getMergeFooterItems();a.clearMergeCells(),a.clearMergeFooterItems(),a.dispatchEvent("clear-merge",{mergeCells:r,mergeFooterItems:e},t)},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,r=e.column,n=a.params||[];t.insert(n[0]).then(function(e){e=e.row;return t.setActiveCell(e,n[1]||r.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,r=e.menu,n=e.row,o=e.column;n&&(t=r.params||[],a.insertAt(t[0],n).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_CHECKBOX_ROW:function(e){e.$table.removeCheckboxRow()},DELETE_ALL:function(e){e.$table.remove()},CLEAR_SORT:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)},CLEAR_ALL_SORT:function(e){var t=e.$event,a=e.$table,e=a.getSortColumns();e.length&&(a.clearSort(),a.dispatchEvent("clear-sort",{sortList:e},t))},SORT_ASC:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")},SORT_DESC:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")},CLEAR_FILTER:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))},CLEAR_ALL_FILTER:function(e){var t=e.$event,a=e.$table,e=a.getCheckedFilters();e.length&&(a.clearFilter(),a.dispatchEvent("clear-filter",{filterList:e},t))},FILTER_CELL:function(e){var t=e.$table,a=e.row,r=e.column;a&&r&&(e=r.property,(r=r.filters).length&&((r=r[0]).data=c.default.get(a,e),r.checked=!0,t.updateData()))},EXPORT_ROW:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(c.default.assign({data:[e]},a.params[0]))},EXPORT_CHECKBOX_ROW:function(e){var t=e.$table,a=e.menu,e={data:t.getCheckboxRecords()};t.exportData(c.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_CHECKBOX_ROW:function(e){var t=e.$table,a=e.menu,e={data:t.getCheckboxRecords()};t.print(c.default.assign(e,a.params))},OPEN_FIND:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"find")},OPEN_REPLACE:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"replace")},HIDDEN_COLUMN:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)},FIXED_LEFT_COLUMN:o("left"),FIXED_RIGHT_COLUMN:o("right"),CLEAR_FIXED_COLUMN:o(null),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)}}),a.add("event.showMenu",E)}};e.VXETablePluginMenus=r,"undefined"!=typeof window&&window.VXETable&&window.VXETable.use&&window.VXETable.use(r),e.default=r}); | ||
!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={},e.XEUtils),e.VXETablePluginMenus=t)}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,function(e,i){"use strict";var d,c;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.VXETablePluginMenus=void 0,i=(t=i)&&t.__esModule?t:{default:t};function _(e,t){return i.default.findIndexOf(e,function(e){return e.id===t.id})}function b(e,t,a){return e.findRowIndexOf(t,a)}var n;function r(a){return function(e){var t=e.$table,e=e.column;i.default.eachTree([e],function(e){e.fixed=a}),t.refreshColumn()}}function u(e){var t,a;try{t=e,n||((n=document.createElement("textarea")).id="$XECopy",(a=n.style).width="48px",a.height="24px",a.position="fixed",a.zIndex="0",a.left="-500px",a.top="-500px",document.body.appendChild(n)),n.value=null==t?"":""+t,n.select(),n.setSelectionRange(0,n.value.length),document.execCommand("copy"),n.blur()}catch(e){}}function l(e,t){var a,n,r,l=e.$event,o=e.$table,s=e.row,e=e.column;s&&e&&(a=o.props.mouseConfig,n=o.getComputeMaps().computeMouseOpts.value,r="",a&&n.area?(t?o.triggerCutCellAreaEvent(l):o.triggerCopyCellAreaEvent(l),r=d.config.clipboard.text):(r=i.default.toValueString(i.default.get(s,e.field)),d.config.clipboard={text:r,html:""}),(i.default.isFunction(c)?c:u)(r))}function L(e){var i=e.$table,e=i.props.mouseConfig,t=i.getComputeMaps().computeMouseOpts.value,c=i.getTableData().visibleData,u=i.getTableColumn().visibleColumn,a=e&&t.area?i.getCellAreas():[];return i.getMergeCells().filter(function(e){var r=e.row,l=e.col,o=e.rowspan,s=e.colspan;return a.some(function(e){var t=e.rows,e=e.cols,a=b(i,c,t[0]),t=b(i,c,t[t.length-1]),n=_(u,e[0]),e=_(u,e[e.length-1]);return a<=r&&r+o-1<=t&&n<=l&&l+s-1<=e})})}function o(e){var t=e.$table,e=L(e);return e.length&&t.removeMergeCells(e),e}function a(e,t){var a=e.code,n=t.$table,r=t.row,l=t.column,o=n.props,s=o.editConfig,i=o.mouseConfig;switch(a){case"CLEAR_ALL_SORT":var c=n.getSortColumns();e.disabled=!c.length;break;case"CLEAR_ALL_FILTER":c=n.getCheckedFilters();e.disabled=!c.length;break;case"CLEAR_ALL_MERGE":var c=n.getMergeCells(),u=n.getMergeFooterItems();e.disabled=!c.length&&!u.length;break;case"CLEAR_MERGE_CELL":c=L(t);e.disabled=!c.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"INSERT_AT_ROW":case"INSERT_AT_ACTIVED_ROW":case"DELETE_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=!l,l){var E=n.getComputeMaps().computeMouseOpts.value,f=!!l.parentId;switch(a){case"CLEAR_SORT":e.disabled=!l.sortable||!l.order;break;case"SORT_ASC":case"SORT_DESC":e.disabled=!l.sortable;break;case"FILTER_CELL":case"CLEAR_FILTER":e.disabled=!l.filters||!l.filters.length,e.disabled||"CLEAR_FILTER"===a&&(e.disabled=!l.filters.some(function(e){return e.checked}));break;case"REVERT_CELL":e.disabled=!r||!l.field||!n.isUpdateByRow(r,l.field);break;case"REVERT_ROW":e.disabled=!r||!l.field||!n.isUpdateByRow(r);break;case"OPEN_FIND":case"OPEN_REPLACE":e.disabled=!(i&&E.area);break;case"EDIT_CELL":e.disabled=!s||!l.editRender;break;case"COPY_CELL":case"CUT_CELL":case"PASTE_CELL":var C=i&&E.area?n.getCellAreas():[];e.disabled=1<C.length,e.disabled||"PASTE_CELL"===a&&(C=d.config.clipboard,e.disabled=!C||!C.text);break;case"MERGE_OR_CLEAR":case"MERGE_CELL":C=i&&E.area?n.getCellAreas():[];e.disabled=!C.length||1===C.length&&1===C[0].rows.length&&1===C[0].cols.length||!function(e,t){for(var a=e.$table,n=a.getTableData().visibleData,r=a.getTableColumn().visibleColumn,l={},o=0,s=t.length;o<s;o++)for(var i=t[o],c=i.rows,u=i.cols,E=0,f=c.length;E<f;E++)for(var C=c[E],d=b(a,n,C),L=0,R=u.length;L<R;L++){var g=u[L],g=d+":"+_(r,g);if(l[g])return;l[g]=!0}return 1}(t,C);break;case"FIXED_LEFT_COLUMN":e.disabled=f||"left"===l.fixed;break;case"FIXED_RIGHT_COLUMN":e.disabled=f||"right"===l.fixed;break;case"CLEAR_FIXED_COLUMN":e.disabled=f||!l.fixed}}}}function s(t){return t.options.forEach(function(e){e.forEach(function(e){a(e,t),e.children&&e.children.forEach(function(e){a(e,t)})})}),!0}function E(e){e&&e.copy&&(c=e.copy)}var t={setup:E,install:function(e,t){var a=e.interceptor,n=e.menus;d=e,E(t),n.mixin({CLEAR_CELL:function(e){var t,a,n=e.$table,r=e.row,e=e.column;r&&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(r,e.field))},CLEAR_ROW:function(e){var t=e.$table,e=e.row;e&&t.clearData(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 t,a,n=e.$table,r=e.row,e=e.column;r&&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(r,e.field))},REVERT_ROW:function(e){var t=e.$table,e=e.row;e&&t.revertData(e)},REVERT_CHECKBOX_ROW:function(e){e=e.$table;e.revertData(e.getCheckboxRecords())},REVERT_ALL:function(e){e.$table.revertData()},COPY_CELL:function(e){l(e)},CUT_CELL:function(e){l(e,!0)},PASTE_CELL:function(e){var t=e.$event,a=e.$table,n=e.row,e=e.column,r=a.props.mouseConfig,l=a.getComputeMaps().computeMouseOpts.value;r&&l.area?a.triggerPasteCellAreaEvent(t):(r=d.config.clipboard)&&r.text&&i.default.set(n,e.field,r.text)},MERGE_OR_CLEAR:function(e){var t=e.$event,a=e.$table,n=a.getCellAreas(),e=L(e),r=!1,e=(e.length?a.removeMergeCells(e):(r=!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:r,targetAreas:e},t)},MERGE_CELL:function(e){var t=e.$event,a=e.$table,n=a.getTableData().visibleData,r=a.getTableColumn().visibleColumn,l=a.getCellAreas();o(e),l.some(function(e){var t=e.rows,e=e.cols;return t.length===n.length||e.length===r.length})?d.modal&&d.modal.message({content:d.t("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:function(e){var t=e.$event,a=e.$table,e=o(e);e.length&&a.dispatchEvent("clear-cell-area-merge",{mergeCells:e},t)},CLEAR_ALL_MERGE: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: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:function(e){var t=e.$table,e=e.row;t.setEditRow?t.setEditRow(e):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;t.setEditCell?t.setEditCell(e,r[1]||n):t.setActiveCell(e,r[1]||n.field)})},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,l=e.column;r&&(t=n.params||[],a.insertAt(t[0],r).then(function(e){e=e.row;a.setEditCell?a.setEditCell(e,t[1]||l):a.setActiveCell(e,t[1]||l.field)}))},DELETE_ROW:function(e){var t=e.$table,e=e.row;e&&t.remove(e)},DELETE_CHECKBOX_ROW:function(e){e.$table.removeCheckboxRow()},DELETE_ALL:function(e){e.$table.remove()},CLEAR_SORT:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,null)},CLEAR_ALL_SORT: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:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"asc")},SORT_DESC:function(e){var t=e.$event,a=e.$table,e=e.column;e&&a.triggerSortEvent(t,e,"desc")},CLEAR_FILTER:function(e){var t=e.$event,a=e.$table,e=e.column;e&&(a.handleClearFilter(e),a.confirmFilterEvent(t))},CLEAR_ALL_FILTER: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: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=i.default.get(n,t),e.checked=!0,a.updateData()))},EXPORT_ROW:function(e){var t=e.$table,a=e.menu,e=e.row;e&&t.exportData(i.default.assign({data:[e]},a.params[0]))},EXPORT_CHECKBOX_ROW:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.exportData(i.default.assign(a,e.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_CHECKBOX_ROW:function(e){var t=e.$table,e=e.menu,a={data:t.getCheckboxRecords()};t.print(i.default.assign(a,e.params))},OPEN_FIND:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"find")},OPEN_REPLACE:function(e){var t=e.$event;e.$table.triggerFNROpenEvent(t,"replace")},HIDDEN_COLUMN:function(e){var t=e.$table,e=e.column;e&&t.hideColumn(e)},FIXED_LEFT_COLUMN:r("left"),FIXED_RIGHT_COLUMN:r("right"),CLEAR_FIXED_COLUMN:r(null),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)}}),a.add("event.showMenu",s)}};e.VXETablePluginMenus=t,"undefined"!=typeof window&&window.VXETable&&window.VXETable.use&&window.VXETable.use(t);e.default=t}); |
54
index.ts
import XEUtils from 'xe-utils' | ||
import { VXETableCore, VxeTableConstructor, VxeTablePrivateMethods, VxeColumnPropTypes, VxeTableDefines, VxeTableProDefines, VxeGlobalInterceptorHandles, VxeGlobalMenusHandles } from 'vxe-table' | ||
let vxetable:VXETableCore | ||
let vxetable: VXETableCore | ||
@@ -72,3 +72,3 @@ let handleCopy: (content: string | number) => boolean | ||
} else { | ||
text = XEUtils.toValueString(XEUtils.get(row, column.property)) | ||
text = XEUtils.toValueString(XEUtils.get(row, column.field)) | ||
// 操作内置剪贴板 | ||
@@ -220,7 +220,7 @@ vxetable.config.clipboard = { text, html: '' } | ||
case 'REVERT_CELL': { | ||
item.disabled = !row || !column.property || !$table.isUpdateByRow(row, column.property) | ||
item.disabled = !row || !column.field || !$table.isUpdateByRow(row, column.field) | ||
break | ||
} | ||
case 'REVERT_ROW': { | ||
item.disabled = !row || !column.property || !$table.isUpdateByRow(row) | ||
item.disabled = !row || !column.field || !$table.isUpdateByRow(row) | ||
break | ||
@@ -329,3 +329,3 @@ } | ||
rows.forEach(row => { | ||
$table.clearData(row, column.property) | ||
$table.clearData(row, column.field) | ||
}) | ||
@@ -336,3 +336,3 @@ }) | ||
} else { | ||
$table.clearData(row, column.property) | ||
$table.clearData(row, column.field) | ||
} | ||
@@ -381,3 +381,3 @@ } | ||
rows.forEach(row => { | ||
$table.revertData(row, column.property) | ||
$table.revertData(row, column.field) | ||
}) | ||
@@ -388,3 +388,3 @@ }) | ||
} else { | ||
$table.revertData(row, column.property) | ||
$table.revertData(row, column.field) | ||
} | ||
@@ -443,3 +443,3 @@ } | ||
if (clipboard && clipboard.text) { | ||
XEUtils.set(row, column.property, clipboard.text) | ||
XEUtils.set(row, column.field, clipboard.text) | ||
} | ||
@@ -528,3 +528,8 @@ } | ||
const { $table, row, column } = params | ||
$table.setActiveCell(row, column.property) | ||
if ($table.setEditCell) { | ||
$table.setEditCell(row, column) | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveCell(row, column.field) | ||
} | ||
}, | ||
@@ -536,3 +541,8 @@ /** | ||
const { $table, row } = params | ||
$table.setActiveRow(row) | ||
if ($table.setEditRow) { | ||
$table.setEditRow(row) | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveRow(row) | ||
} | ||
}, | ||
@@ -553,3 +563,10 @@ /** | ||
$table.insert(args[0]) | ||
.then(({ row }) => $table.setActiveCell(row, args[1] || column.property)) | ||
.then(({ row }) => { | ||
if ($table.setEditCell) { | ||
$table.setEditCell(row, args[1] || column) | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveCell(row, args[1] || column.field) | ||
} | ||
}) | ||
}, | ||
@@ -573,3 +590,10 @@ /** | ||
$table.insertAt(args[0], row) | ||
.then(({ row }) => $table.setActiveCell(row, args[1] || column.property)) | ||
.then(({ row }) => { | ||
if ($table.setEditCell) { | ||
$table.setEditCell(row, args[1] || column) | ||
} else { | ||
// 兼容老版本 | ||
$table.setActiveCell(row, args[1] || column.field) | ||
} | ||
}) | ||
} | ||
@@ -665,6 +689,6 @@ }, | ||
if (row && column) { | ||
const { property, filters } = column | ||
const { field, filters } = column | ||
if (filters.length) { | ||
const option = filters[0] | ||
option.data = XEUtils.get(row, property) | ||
option.data = XEUtils.get(row, field) | ||
option.checked = true | ||
@@ -671,0 +695,0 @@ $table.updateData() |
{ | ||
"name": "vxe-table-plugin-menus", | ||
"version": "3.0.6", | ||
"version": "3.0.7", | ||
"description": "基于 vxe-table 的表格插件,提供实用的快捷菜单集", | ||
@@ -37,3 +37,3 @@ "scripts": { | ||
"gulp": "^4.0.2", | ||
"gulp-autoprefixer": "^7.0.1", | ||
"gulp-autoprefixer": "^8.0.0", | ||
"gulp-babel": "^8.0.0", | ||
@@ -43,5 +43,5 @@ "gulp-clean-css": "^4.3.0", | ||
"gulp-rename": "^2.0.0", | ||
"gulp-replace": "^1.0.0", | ||
"gulp-sass": "^4.1.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-replace": "^1.1.3", | ||
"gulp-sass": "^5.1.0", | ||
"gulp-sourcemaps": "^3.0.0", | ||
"gulp-typescript": "^5.0.1", | ||
@@ -51,6 +51,7 @@ "gulp-uglify": "^3.0.2", | ||
"prettier": "^2.1.2", | ||
"typescript": "^4.0.5", | ||
"vue": "^3.2.14", | ||
"vxe-table": "^4.0.30", | ||
"xe-utils": "^3.4.0" | ||
"sass": "^1.55.0", | ||
"typescript": "^4.6.4", | ||
"vue": "^3.2.39", | ||
"vxe-table": "^4.3.5", | ||
"xe-utils": "^3.5.6" | ||
}, | ||
@@ -57,0 +58,0 @@ "peerDependencies": { |
@@ -13,3 +13,3 @@ # vxe-table-plugin-menus | ||
```shell | ||
npm install xe-utils@3 vxe-table@next vxe-table-plugin-menus@next | ||
npm install xe-utils vxe-table@next vxe-table-plugin-menus@next | ||
``` | ||
@@ -16,0 +16,0 @@ |
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
220361
3061
35